query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Accepts string, open file, or Nokogirilike document | def initialize(doc)
@doc = self.class.convert_document(doc)
initialize_plural_accessors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse string_or_io, url = nil, encoding = nil, options = 2145, &block\n\n options = Nokogiri::XML::ParseOptions.new(options) if Fixnum === options\n # Give the options to the user\n yield options if block_given?\n\n if string_or_io.respond_to?(:read)\n url ||= string_or_io.respond_to?(:path) ? string_or_io.path : nil\n return Document.read_io(string_or_io, url, encoding, options.to_i)\n end\n\n # read_memory pukes on empty docs\n return Document.new if string_or_io.nil? or string_or_io.empty?\n\n Document.read_memory(string_or_io, url, encoding, options.to_i)\n end",
"def support_rdoc_document_file!(file = T.unsafe(nil)); end",
"def document(path); end",
"def moddify_document(path)\n doc = nil\n File.open(path,'r+') do | file|\n xml_string = file.read\n doc = process_xml(xml_string) if valid_xml?(xml_string)\n end\n doc\nend",
"def parse(string_or_io, options = nil)\n ##\n # When the current node is unparented and not an element node, use the\n # document as the parsing context instead. Otherwise, the in-context\n # parser cannot find an element or a document node.\n # Document Fragments are also not usable by the in-context parser.\n if !element? && !document? && (!parent || parent.fragment?)\n return document.parse(string_or_io, options)\n end\n\n options ||= (document.html? ? ParseOptions::DEFAULT_HTML : ParseOptions::DEFAULT_XML)\n if Integer === options\n options = Nokogiri::XML::ParseOptions.new(options)\n end\n # Give the options to the user\n yield options if block_given?\n\n contents = string_or_io.respond_to?(:read) ?\n string_or_io.read :\n string_or_io\n\n return Nokogiri::XML::NodeSet.new(document) if contents.empty?\n\n # libxml2 does not obey the `recover` option after encountering errors during `in_context`\n # parsing, and so this horrible hack is here to try to emulate recovery behavior.\n #\n # Unfortunately, this means we're no longer parsing \"in context\" and so namespaces that\n # would have been inherited from the context node won't be handled correctly. This hack was\n # written in 2010, and I regret it, because it's silently degrading functionality in a way\n # that's not easily prevented (or even detected).\n #\n # I think preferable behavior would be to either:\n #\n # a. add an error noting that we \"fell back\" and pointing the user to turning off the `recover` option\n # b. don't recover, but raise a sensible exception\n #\n # For context and background: https://github.com/sparklemotion/nokogiri/issues/313\n # FIXME bug report: https://github.com/sparklemotion/nokogiri/issues/2092\n error_count = document.errors.length\n node_set = in_context(contents, options.to_i)\n if (node_set.empty? && (document.errors.length > error_count))\n if options.recover?\n fragment = Nokogiri::HTML4::DocumentFragment.parse contents\n node_set = fragment.children\n else\n raise document.errors[error_count]\n end\n end\n node_set\n end",
"def resolve_document\n case document\n when /^http[s]?:/ then \n response = HTTPI.get(request)\n if response.error?\n raise Savon::HTTP::Error.new(response)\n else\n response.body\n end\n when /^</ then document\n else File.read(document)\n end\n end",
"def parse_DOCX input_file\n\n begin\n reader = Docx::Document.open(input_file.tempfile)\n \n # Catch common error to invalid DOCX\n rescue Zip::ZipError => error\n flash[:alert] = \"Error parsing document. Is this a Word Docuemnt (docx)?\"\n return \"\"\n end\n document = Nokogiri::HTML(reader.to_html).text\n \n flash[:notice] = \"Word Document (docx) Processed.\"\n return document\n \n end",
"def load(string_or_io)\n doc = Tools::XML.load(string_or_io)\n # Document name=\"document\" children = [\n # DTD\n # Element name=\"plist\" children = [\n # Element name=\"dict\" children = [\n # Element name=\"key\" children = [ Text \"author\" ]\n # Element name=\"string\" children = [ Text \"Z comme Zorglub\" ]\n # Element name = \"key\" children = [ Text \"name\" ]\n # Element name = \"string\" children = [ Text \"Zorgléoptère\" ]\n # ...\n # ]\n # ]\n # ]\n root_node = doc.children.last.children.first\n load_node(root_node)\n end",
"def document_from_io(io)\n REXML::Document.new(io)\n end",
"def file_or_content(str)\n return str if str.nil?\n return str unless file_param? str\n\n content = File.read(str[1..-1])\n content\n end",
"def open(uri, text, version); end",
"def open_website(url)\n page = Nokogiri::HTML(open(url)) \n # page.class # => Nokogiri::HTML::Document\n page\nend",
"def convert input, formatter\n document = case input\n when RDoc::Markup::Document then\n input\n else\n RDoc::Markup::Parser.parse input\n end\n\n document.accept formatter\n end",
"def create_document(xml)\n begin\n REXML::Document.new(xml) \n rescue REXML::ParseException\n # nil\n end \nend",
"def load_doc(path)\n page = HTTParty.get(path)\n \n Nokogiri::HTML(page)\nend",
"def input\n RDF::Util::File.open_file(inputDocument)\n end",
"def open(path)\n document = parse(File.read(path))\n document.path = path\n document\n end",
"def doc(new_markup=nil)\n if markup = new_markup || content\n @doc = nil if new_markup\n @doc ||= case parser.to_sym\n when :xml then Nokogiri::XML(markup)\n when :html then Nokogiri::HTML(markup)\n else raise InvalidParser.new(\"Nokogiri cannot parse as '#{parser.inspect}'. Please request :xml or :html.\")\n end\n end\n end",
"def parse\n return @document if @document\n\n @document = super @text, @format\n @document.file = @location\n @document\n end",
"def process_xml(string)\n xml_processor_helper(create_document(string))\nend",
"def parse(doc)\n mime = doc.properties[:mime_type]\n pdoc = PlanR::ParsedDocument.new(name, doc)\n begin\n ['text/html', 'application/xhtml+xml'].include?(mime) ?\n parse_html(pdoc, doc.contents) :\n parse_xml(pdoc, doc.contents)\n rescue Exception => e\n $stderr.puts 'Nokigiri :parse_doc Exception: ' + e.message\n $stderr.puts e.backtrace[0..5].join(\"\\n\")\n end\n pdoc\n end",
"def convert(str, op)\n document = RDoc::Markup::Parser.parse str\n\n document.accept op\n end",
"def support_rdoc_document_file!\n IO.read(\".document\").gsub(/^[ \\t]*#.+/m, '').split(/\\s+/)\n rescue Errno::ENOENT\n []\n end",
"def load_document(document_string, document_uri = nil)\n document = Nokogiri.XML(document_string, document_uri).extend(Document) # returns a Nokogiri::XML::Document\n document.root.extend(self)\n document\n end",
"def get_doc(url)\n # open-uri options\n options = {}\n if $certs\n options = {http_basic_authentication: $certs}\n end\n options[:redirect] = false;\n\n # URI object\n uri = resolve_as_uri(url)\n\n # open-uri\n charset = nil\n begin\n html = open(uri, options) do |f|\n charset = f.charset\n f.read\n end\n rescue OpenURI::HTTPRedirect => redirect\n dir(\"Redirection to other host\") if uri.host != redirect.uri.host\n uri = redirect.uri\n retry\n end\n\n # parse\n return Nokogiri::HTML.parse(html, nil, charset)\nend",
"def proofread_document(xml)\n use_document(xml)\n proofread # returns valid?\n end",
"def load_html(input) # :nodoc:\n thing = nil\n\n # TODO: duplicate options\n if @options[:with_html_string] or @options[:inline] or input.respond_to?(:read)\n thing = input\n elsif @is_local_file\n @base_dir = File.dirname(input)\n thing = File.open(input, 'r')\n else\n thing = open(input)\n end\n\n if thing.respond_to?(:read)\n thing = thing.read\n end\n\n return nil unless thing\n doc = nil\n\n # Handle HTML entities\n if @options[:replace_html_entities] == true and thing.is_a?(String)\n HTML_ENTITIES.map do |entity, replacement|\n thing.gsub! entity, replacement\n end\n end\n # Default encoding is ASCII-8BIT (binary) per http://groups.google.com/group/nokogiri-talk/msg/0b81ef0dc180dc74\n # However, we really don't want to hardcode this. ASCII-8BIG should be the default, but not the only option.\n if thing.is_a?(String) and RUBY_VERSION =~ /1.9/\n thing = thing.force_encoding(@options[:input_encoding]).encode!\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding]) {|c| c.recover }\n else\n default_encoding = RUBY_PLATFORM == 'java' ? nil : 'BINARY'\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding] || default_encoding) {|c| c.recover }\n end\n\n # Fix for removing any CDATA tags from both style and script tags inserted per\n # https://github.com/sparklemotion/nokogiri/issues/311 and\n # https://github.com/premailer/premailer/issues/199\n %w(style script).each do |tag|\n doc.search(tag).children.each do |child|\n child.swap(child.text()) if child.cdata?\n end\n end\n\n doc\n end",
"def processURI(element, href, parse, xpointer, encoding, accept, acceptlanguage)\n raise \"bad element in XInclude::parse()\" unless (element) \n # catch some fatal errors specified by the spec\n raise \"bad parse in XInclude::parse()\" if (parse != nil && parse != \"text\" && parse != \"xml\")\n raise \"bad text parse in XInclude::parse()\" if (parse == \"text\" && xpointer != nil)\n # we can't do anything without an href\n #raise \"bad href in XInclude::parse()\" if (href == nil)\n\n case href\n when nil\n doc = element.root\n when /^http:/i, /^https:/i, /^ftp:/i\n doc = REXML::Document.new(open(href));\n when /^file:/i, \n doc = REXML::Document.new(File.new(href));\n end\n \n if (xpointer) then\n p = XPointer.new()\n doc = p.process(doc, xpointer)\n end\n return doc\n end",
"def document\n @document ||= if html_content_only && content_type != \"text/html\"\n raise \"The url provided contains #{content_type} content instead of text/html content\" and nil\n else\n request.read\n end\n rescue Exception => e\n add_fatal_error \"Scraping exception: #{e.message}\"\n end",
"def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def parse(string_or_io, url = T.unsafe(nil), encoding = T.unsafe(nil), options = T.unsafe(nil)); end",
"def doc(path, options = {})\n require 'nokogiri'\n\n File.open(path) do |f|\n yield Nokogiri::XML(f)\n end\n end",
"def create_document(uri, content, doc_version)\n case document_type(uri)\n when :puppetfile\n PuppetfileDocument.new(uri, content, doc_version)\n when :manifest\n ManifestDocument.new(uri, content, doc_version)\n when :epp\n EppDocument.new(uri, content, doc_version)\n else\n Document.new(uri, content, doc_version)\n end\n end",
"def load_XML(file)\n begin\n xml_file = File.open(file)\n xml_obj = Document.new(xml_file)\n xml_file.close\n rescue => e\n puts \"ERROR: Unable to create XML object from file: #{file}\"\n puts e.message\n puts e.backtrace\n exit 1\n end\n return xml_obj\nend",
"def load_xml_document file_name\n xml_file = File.new file_name, \"r\"\n return Document.new xml_file\n end",
"def proofread_document_internal(xml_url)\n use_document(xml_url, true)\n proofread # returns valid?\n end",
"def parse(string_or_io, options = T.unsafe(nil)); end",
"def parse(string_or_io, options = T.unsafe(nil)); end",
"def open(path_or_url, ext = T.unsafe(nil), options = T.unsafe(nil)); end",
"def initialize(input)\n path = File.expand_path input, Dir.pwd\n if File.exist?(path)\n html = File.open(path).read\n @path = path\n else\n @path = String\n html = input.to_s\n end\n @doc = Nokogiri::HTML normalize(html)\n semanticize!\n end",
"def process!(document); end",
"def open_specifications(file)\n begin \n @specification_document = Nokogiri::HTML(file)\n file.close\n rescue\n puts \"Could not parse file with Nokogiri::HTML!\\n\"\n exit\n end\n end",
"def open(arg,force_encoding=nil)\n data=ONIX::Helper.arg_to_data(arg)\n\n xml=nil\n if force_encoding\n xml=Nokogiri::XML.parse(data,nil,force_encoding)\n else\n xml=Nokogiri::XML.parse(data)\n end\n\n xml.remove_namespaces!\n xml\n end",
"def document(source)\n ::Nokogiri::XML(source, *@options)\n end",
"def detect_format(stream)\n # Got to look into the file to see\n if stream.respond_to?(:rewind) && stream.respond_to?(:read)\n stream.rewind\n string = stream.read(1000)\n stream.rewind\n else\n string = stream.to_s\n end\n case string\n when /<html/i then RDF::RDFa::Reader\n when /\\{\\s*\\\"@\\\"/i then JSON::LD::Reader\n else RDF::Turtle::Reader\n end\nend",
"def open_file(io)\n io.kind_of?(File) ? io : File.open(io)\n end",
"def parse(io)\n self.doc = Nokogiri::XML(io)\n end",
"def parsed_document\n @parsed_document ||= Nokogiri::HTML(document)\n rescue Exception => e\n add_fatal_error \"Parsing exception: #{e.message}\"\n end",
"def RichText(string)\n RichText::Document.new string\nend",
"def open_document\n @document = Nokogiri::XML(open(@feed_uri).read)\n end",
"def make_document(xml)\n xml.is_a?(Atom::XML::Document) ? xml : Atom::XML::Document.string(xml)\n end",
"def open_file(language)\n begin\n xml_file = File.open(file_path(language))\n doc = Nokogiri::XML(xml_file)\n yield doc\n rescue Errno::ENOENT => e\n abort(e.message)\n end\n end",
"def parse!(markup)\n doc(markup)\n end",
"def document\n open(url).string.split(';')\n end",
"def html_markup_rdoc(text); end",
"def markup_file_contents(contents); end",
"def parse thing, url = nil, encoding = nil, options = ParseOptions::DEFAULT_XML, &block\n Document.parse(thing, url, encoding, options, &block)\n end",
"def open(io)\n return open_file(io) if file\n \n case io\n when String\n StringIO.new(io)\n when Integer\n IO.open(io)\n else \n io\n end\n end",
"def convert_to_document() \n Nokogiri::HTML.parse(convert())\n end",
"def open(file_path)\n raise NotImplementedError.new 'This is only a function body for documentation'\n end",
"def read_file(source)\n if @source_type == \"url\"\n fileHtml = open(source).read\n else\n fileHtml = File.open(source, \"r\")\n end\n\n text = \"\"\n begin\n fileHtml.each_line do |line|\n text << line\n end\n fileHtml.close\n rescue\n text = false\n ensure\n #fileHtml.close unless fileHtml.nil?\n end\n\n text\n end",
"def initialize(ng_or_string_or_io)\n @ng_xml = ng_or_string_or_io.is_a?(Nokogiri::XML::Document) ? ng_or_string_or_io : Nokogiri::XML(ng_or_string_or_io)\n end",
"def initialize(ng_or_string_or_io)\n @ng_xml = ng_or_string_or_io.is_a?(Nokogiri::XML::Document) ? ng_or_string_or_io : Nokogiri::XML(ng_or_string_or_io)\n end",
"def opendocument?\n false\n end",
"def opendocument?\n false\n end",
"def detect_format(stream)\n # Got to look into the file to see\n if stream.is_a?(IO) || stream.is_a?(StringIO)\n stream.rewind\n string = stream.read(1000)\n stream.rewind\n else\n string = stream.to_s\n end\n case string\n when /<html/i then RDF::RDFa::Reader\n when /@prefix/i then RDF::Turtle::Reader\n else RDF::NTriples::Reader\n end\n end",
"def doc\n @doc ||= Nokogiri::HTML(open(self.url))\n end",
"def doc \n Nokogiri.parse(page.body)\n end",
"def load_xml_doc( filename )\n File.open( filename, 'r') do |file|\n return Oga.parse_xml( file )\n end\n\n puts \"ERROR: loading #{filename}\"\n return nil\n end",
"def get_xml_of_type( asdcp_type, file )\n begin\n xml = Nokogiri::XML( open file )\n rescue Exception => e\n @logger.info \"#{ file }: #{ e.message }\"\n return FALSE\n end\n unless xml.errors.empty?\n xml.errors.each do |error|\n # expected errors from non-xml\n next if error.message =~ /Start tag expected/ or error.message =~ /Document is empty/\n @logger.info \"Syntax error: #{ file }: #{ error }\"\n end\n return FALSE\n end\n\n case xml.root.node_name\n when asdcp_type\n return xml\n else\n return FALSE\n end\nend",
"def doc(text)\n @doc = text\n end",
"def initialize \r\n\t\tputs \"Enter the file location & name...\"\r\n\t\tbook_file = gets.chomp\r\n\t\t# Opens and reads the html files:\r\n\t\t@page = Nokogiri::HTML(open(book_file))\r\n\tend",
"def detect_format(stream)\n # Got to look into the file to see\n if stream.is_a?(IO) || stream.is_a?(StringIO)\n stream.rewind\n string = stream.read(1000)\n stream.rewind\n else\n string = stream.to_s\n end\n case string\n when /<(\\w+:)?RDF/ then RDF::RDFXML::Reader\n when /<html/i then RDF::RDFa::Reader\n when /@prefix/i then RDF::Turtle::Reader\n else RDF::NTriples::Reader\n end\nend",
"def support_rdoc_document_file!(file = '.document')\n return [] unless use_document_file\n File.read(file).gsub(/^[ \\t]*#.+/m, '').split(/\\s+/)\n rescue Errno::ENOENT\n []\n end",
"def parse document_file_name\n raise ParserNotDefined if @@document_parser.nil?\n \n ext = ActiveDocument::FileUtils.extension_name(document_file_name)\n io = read(document_file_name)\n \n if not @@document_parsers.empty?\n document_parser = parser_for_extension(ext)\n document_data = document_parser.parse(io)\n else\n document_data = @@document_parser.parse(io)\n end\n \n document_data.parser_added_args[:filename] = document_file_name\n \n new document_data\n end",
"def read( nexml )\n case nexml\n when /\\.xml$/\n XML::Reader.file( nexml, :options => parse_opts )\n when IO\n XML::Reader.io( nexml, :options => parse_opts )\n when String\n XML::Reader.string( nexml, :options => parse_opts )\n end\n end",
"def parser(content_type); end",
"def open_pdoc(doc)\n src = case doc\n when PDoc\n doc\n when String, Pathname\n docpath = Pathname(doc)\n raise 'File not found' unless docpath.file?\n doc2 = app.open(docpath)\n doc2\n end\n src\n end",
"def document(file_name)\n origin = File.open(\"#{file_name}\",'r')\n docs = File.open(\"docs/doc-#{file_name.split('/')[-1]}.html\",'w')\n comment = true\n script = Script.new(file_name)\n \n # Need to refactor this into some form of a rules engine. It's getting a bit hairy\n str = origin.each_line.inject(\"\") do |str, line|\n # Skip if it's a shebang\n if line =~ /^ *#!/\n str << \"\"\n \n # Blank Comment line, insert newline\n elsif line =~ /^ *# *$/\n comment = true\n str << \"\\n\"\n \n # Evaluate as text if it's a comment with spaces prior\n elsif line =~ /^ *#/\n str << \"\\n\" unless comment \n comment = true\n \n # Find the meta-information in the comments and harvest it\n if line.include? '**Author**'\n script.author = line.gsub(/^.*: /,'').chomp\n elsif line.include? '**Description**'\n script.description = line.gsub(/^.*: /,'').chomp\n elsif line.include? '**Usage**'\n script.usage = line.gsub(/^.*: /,'').chomp\n elsif line.include? '**Type**'\n script.type = line.gsub(/^.*: /,'').chomp\n end\n \n str << \"#{line.gsub(/^ *# /,'')}\"\n \n # Find the Gems used\n elsif line =~ /^ *require /\n gemname = line.gsub(/^ *require /,'').delete(\"'\").delete('\"').gsub('/','-').chomp\n # Don't add it unless it's not there or it's an absolute path\n unless ($gems.include? gemname) or (gemname =~ /^[A-Za-z]\\:/)\n $gems << gemname\n end\n \n str << \"\\n\" if comment \n comment = false\n str << \" #{line}\"\n # Evaluate as a code block if it's code\n else\n str << \"\\n\" if comment \n comment = false\n str << \" #{line}\"\n end\n end\n \n # Add the current script to the collection for indexing\n $scripts << script\n \n # The following outputs a complete documentation for each and every single script that's in the directory. Very useful if you remember to type them out properly, otherwise you get to spend a few hours fixing it. Do it right the first time, trust me.\n \n # Headers and style information\n docs.puts \"<html>\"\n docs.puts \"<link rel='stylesheet' type='text/css' href='style.css' />\"\n docs.puts \"<body>\"\n \n docs.puts \"<a href='index.html'>( << Back to Index )</a>\"\n \n # Insert the string into the docs\n docs.puts GitHub::Markdown.render(str)\n \n docs.puts \"<a href='index.html'>( << Back to Index )</a>\"\n docs.puts \"</body></html>\"\nend",
"def open_resource(url_file_stream_or_string, options)\n options[:handlers] ||= []\n\n if url_file_stream_or_string.respond_to?(:read)\n return url_file_stream_or_string\n\n elsif url_file_stream_or_string == '-'\n return $stdin\n end\n \n # open-uri freaks out if there's leading spaces.\n url_file_stream_or_string.strip!\n \n \n uri = Addressable::URI.parse(url_file_stream_or_string)\n if uri && ['http','https','ftp'].include?(uri.scheme)\n auth = nil\n\n if uri.host && uri.password\n auth = Base64::encode64(\"#{uri.user}:#{uri.password}\").strip\n uri.password = nil\n url_file_stream_or_string = uri.to_s\n end\n\n req_headers = {} \n req_headers[\"User-Agent\"] = options[:agent] || USER_AGENT\n req_headers[\"If-None-Match\"] = options[:etag] if options[:etag]\n \n if options[:modified]\n if options[:modified].is_a?(String)\n req_headers[\"If-Modified-Since\"] = parse_date(options[:modified]).httpdate\n elsif options[:modified].is_a?(Time)\n req_headers[\"If-Modified-Since\"] = options[:modified].httpdate\n elsif options[:modified].is_a?(Array)\n req_headers[\"If-Modified-Since\"] = py2rtime(options[:modified]).httpdate\n end\n end\n \n req_headers[\"Referer\"] = options[:referrer] if options[:referrer]\n req_headers[\"Accept-encoding\"] = 'gzip, deflate' # FIXME make tests\n req_headers[\"Authorization\"] = \"Basic #{auth}\" if auth\n req_headers['Accept'] = ACCEPT_HEADER if ACCEPT_HEADER\n req_headers['A-IM'] = 'feed' # RFC 3229 support \n \n begin\n return open(url_file_stream_or_string, req_headers) \n rescue OpenURI::HTTPError => e\n return e.io\n rescue\n end\n end\n\n # try to open with native open function (if url_file_stream_or_string is a filename)\n begin \n return open(url_file_stream_or_string)\n rescue\n end\n # treat url_file_stream_or_string as string \n return StringIO.new(url_file_stream_or_string.to_s)\n end",
"def noko_for(url)\n Nokogiri::HTML(open(url).read) \nend",
"def noko_for(url)\n Nokogiri::HTML(open(url).read) \nend",
"def load_xml(file_path)\n # Read the source XML file.\n puts \"file_path: #{file_path}\"\n raw_xml = File.read(file_path)\n\n # Parse raw_xml using Nokogiri.\n parsed_doc = Nokogiri.XML(raw_xml)\nend",
"def input\n @input ||= File.read(inputDocument)\n end",
"def rexml_doc(obj)\n case obj\n when REXML::Document, REXML::Element\n obj\n else\n REXML::Document.new(obj)\n end\n end",
"def load_yardoc(file = T.unsafe(nil)); end",
"def parser_type(x)\n 'libxml'\n end",
"def import( file, project, input, options = {})\n # TODO - is there a default .. XML .. ?? - can't think of suitable one !\n # - if no suitable default exists raise error cos no abstract in Ruby\n end",
"def accept_document document\n document.parts.each do |item|\n case item\n when RDoc::Markup::Document then # HACK\n accept_document item\n else\n item.accept self\n end\n end\n end",
"def noko_doc(url)\n begin\n Nokogiri::HTML(open(url).read)\n rescue OpenURI::HTTPError => msg\n raise PageNotFoundError.new(\"Page not found - #{url}\")\n end\n end",
"def parse_file filename\n encoding = @options.encoding\n filename = filename.encode encoding\n\n @stats.add_file filename\n\n return if RDoc::Parser.binary? filename\n\n content = RDoc::Encoding.read_file filename, encoding\n\n return unless content\n\n filename_path = Pathname(filename).expand_path\n begin\n relative_path = filename_path.relative_path_from @options.root\n rescue ArgumentError\n relative_path = filename_path\n end\n\n if @options.page_dir and\n relative_path.to_s.start_with? @options.page_dir.to_s then\n relative_path =\n relative_path.relative_path_from @options.page_dir\n end\n\n top_level = @store.add_file filename, relative_name: relative_path.to_s\n\n parser = RDoc::Parser.for top_level, filename, content, @options, @stats\n\n return unless parser\n\n parser.scan\n\n # restart documentation for the classes & modules found\n top_level.classes_or_modules.each do |cm|\n cm.done_documenting = false\n end\n\n top_level\n\n rescue Errno::EACCES => e\n $stderr.puts <<-EOF\nUnable to read #{filename}, #{e.message}\n\nPlease check the permissions for this file. Perhaps you do not have access to\nit or perhaps the original author's permissions are to restrictive. If the\nthis is not your library please report a bug to the author.\n EOF\n rescue => e\n $stderr.puts <<-EOF\nBefore reporting this, could you check that the file you're documenting\nhas proper syntax:\n\n #{Gem.ruby} -c #{filename}\n\nRDoc is not a full Ruby parser and will fail when fed invalid ruby programs.\n\nThe internal error was:\n\n\\t(#{e.class}) #{e.message}\n\n EOF\n\n $stderr.puts e.backtrace.join(\"\\n\\t\") if $DEBUG_RDOC\n\n raise e\n nil\n end",
"def parse(thing, url = nil, encoding = nil, options = ParseOptions::DEFAULT_XML, &block)\n Document.parse(thing, url, encoding, options, &block)\n end",
"def get_result(input)\n if File.file? input\n WordCounter.parse_file input\n elsif uri? input #if the input is an uri\n WordCounter.parse_webpage input\n #otherwise \"#{today}\"\n else\n WordCounter.parse input\n end\nend",
"def read_file(filename)\n begin\n document = File.open(filename, 'r')\n document.readlines\n rescue\n puts 'File not found'\n end\nend",
"def xml_document(obj)\n case obj\n when XML::Document\n XML::Document.document(obj)\n else\n XML::Document.new('1.0')\n end\n end",
"def text\n document.text\n end",
"def initialize(input)\n if input.is_a? String\n if File.exist? input\n @path = input\n elsif input =~ URI::DEFAULT_PARSER.make_regexp\n @uri = URI.parse input\n else\n raise Errno::ENOENT, \"missing file or invalid URI - #{input}\"\n end\n elsif input.respond_to? :read\n @stream = input\n else\n raise TypeError, \"can't read from #{input.class.name}\"\n end\n end",
"def initialize(input)\n if input.is_a? String\n if File.exist? input\n @path = input\n elsif input =~ URI::DEFAULT_PARSER.make_regexp\n @uri = URI.parse input\n else\n raise Errno::ENOENT, \"missing file or invalid URI - #{input}\"\n end\n elsif input.respond_to? :read\n @stream = input\n else\n raise TypeError, \"can't read from #{input.class.name}\"\n end\n end",
"def document_snippet(doc)\n ret = nil\n File.open(\"./test 90/#{doc}\", \"r\") do |f|\n f.seek(12)\n ret = f.read(50)\n end\n return ret\nend"
] | [
"0.70236146",
"0.6404384",
"0.6389245",
"0.63688844",
"0.6271912",
"0.62354547",
"0.61656916",
"0.6160522",
"0.614113",
"0.6116489",
"0.6099931",
"0.6029202",
"0.598535",
"0.5953023",
"0.5912202",
"0.58901453",
"0.5889393",
"0.5872943",
"0.5833449",
"0.5815549",
"0.58037096",
"0.57999843",
"0.5783127",
"0.5732719",
"0.5730716",
"0.5714954",
"0.5703152",
"0.56995296",
"0.56938225",
"0.569283",
"0.569283",
"0.569283",
"0.569283",
"0.5680293",
"0.56782806",
"0.56782174",
"0.565051",
"0.56267315",
"0.5617545",
"0.5617545",
"0.561702",
"0.5614782",
"0.5604598",
"0.55920374",
"0.55861664",
"0.5562721",
"0.5561085",
"0.5551059",
"0.5549293",
"0.55445653",
"0.553749",
"0.5530616",
"0.5517704",
"0.55134684",
"0.5499943",
"0.54928136",
"0.549188",
"0.5475905",
"0.5451648",
"0.54371375",
"0.5436556",
"0.54364485",
"0.5425907",
"0.5425721",
"0.5425721",
"0.54253554",
"0.54253554",
"0.5410154",
"0.5402034",
"0.5400915",
"0.5400459",
"0.53917044",
"0.53790003",
"0.53677434",
"0.53480744",
"0.53323257",
"0.5330639",
"0.53281134",
"0.53138953",
"0.53098583",
"0.5307073",
"0.53052753",
"0.53045034",
"0.53045034",
"0.52998054",
"0.52964336",
"0.52925575",
"0.5290675",
"0.5289571",
"0.52877957",
"0.52780974",
"0.5271042",
"0.5259566",
"0.52576274",
"0.52370465",
"0.5236106",
"0.52342045",
"0.52239203",
"0.52226835",
"0.52226835",
"0.521943"
] | 0.0 | -1 |
Let it do its thing! | def parse
self.class.rules.each do |target, (selector, delegate, plural)|
if plural
@doc.search(selector).each do |node|
send(target) << parse_result(node, delegate)
end
else
send("#{target}=", parse_result(@doc.at(selector), delegate))
end
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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() end",
"def proceed!; end",
"def proceed!; end",
"def pass; end",
"def pass; end",
"def run(_); end",
"def run(_); end",
"def bye; end",
"def running; end",
"def running; end",
"def weber; end",
"def do()\r\n\tend",
"def whiny; end",
"def run\n end",
"def done; end",
"def faint; end",
"def faint; end",
"def probers; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def refork; end",
"def suivre; end",
"def perform; end",
"def perform; end",
"def run\n \n end",
"def run\n \n end",
"def schubert; end",
"def call() end",
"def run\n end",
"def does\n puts \"ALL THE THINGESSSS!!!eleventy\"\nend",
"def gounod; end",
"def pausable; end",
"def run()\n end",
"def reap; end",
"def private; end",
"def post_process; 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 refutal()\n end",
"def done?; true end",
"def starting; end",
"def how_it_works\r\n end",
"def mech; end",
"def mech; end",
"def handle; end",
"def herald; end",
"def runs; end",
"def thread; end",
"def thread; end",
"def thread; end",
"def running?; end",
"def recall; end",
"def finished; end",
"def exec; end",
"def exec; end",
"def stuff\n end",
"def ravel; end",
"def runner; end",
"def runnables; end",
"def ibu; end",
"def run\n raise \"Not implemented yet.\"\n end",
"def sleepy_run; end",
"def zuruecksetzen()\n end",
"def surge; end",
"def done?; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def process!\n end",
"def anchored; end",
"def code_like_crazy\r\n puts \"I'm crushing some code!\"\r\n end",
"def perform\n \n end"
] | [
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.7123658",
"0.7021279",
"0.7021279",
"0.6980207",
"0.6980207",
"0.6968317",
"0.6968317",
"0.6956241",
"0.69099116",
"0.69099116",
"0.68457794",
"0.6827925",
"0.6770461",
"0.676339",
"0.6746878",
"0.6722584",
"0.6722584",
"0.6700421",
"0.6689167",
"0.6689167",
"0.6689167",
"0.6689167",
"0.6689167",
"0.6689167",
"0.6689167",
"0.6689167",
"0.6663869",
"0.6649212",
"0.6649212",
"0.6649212",
"0.6649212",
"0.6649212",
"0.6649212",
"0.6649212",
"0.6649212",
"0.6641324",
"0.6584792",
"0.65578216",
"0.65578216",
"0.65323645",
"0.65323645",
"0.651763",
"0.6509045",
"0.64684486",
"0.6465857",
"0.64618784",
"0.64582986",
"0.64542943",
"0.64515907",
"0.6445971",
"0.6419945",
"0.63955224",
"0.63955224",
"0.63955224",
"0.63955224",
"0.63955224",
"0.63955224",
"0.63955224",
"0.63941324",
"0.6376248",
"0.6374848",
"0.63694155",
"0.6365706",
"0.6365706",
"0.63522893",
"0.6342648",
"0.633377",
"0.6329304",
"0.6329304",
"0.6329304",
"0.631017",
"0.6306594",
"0.6303202",
"0.6302052",
"0.6302052",
"0.62966096",
"0.6295057",
"0.6293806",
"0.62877226",
"0.62865233",
"0.6273223",
"0.6270591",
"0.6267439",
"0.62666404",
"0.6260266",
"0.62370765",
"0.62370765",
"0.62370765",
"0.62353796",
"0.62231344",
"0.6219788",
"0.62110233"
] | 0.0 | -1 |
`delegate` is optional, but should respond to `call` or `parse` | def parse_result(node, delegate)
if delegate
delegate.respond_to?(:call) ? delegate.call(node) : delegate.parse(node)
elsif node.respond_to? :inner_text
node.inner_text
else
node.to_s
end unless node.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __delegate__\n @delegate\n end",
"def delegate=(delegate)\n @delegate = delegate\n end",
"def delegate_method; end",
"def initialize(delegate)\n @delegate = delegate\n end",
"def initialize(delegate_)\n @delegate = delegate_\n end",
"def parse_result(node, delegate)\n if delegate\n method = delegate.is_a?(Proc) ? delegate : delegate.method(delegate.respond_to?(:call) ? :call : :parse)\n method.arity == 1 ? method[node] : (method.arity == 2 ? method[node, self] : method[])\n else\n node\n end\n end",
"def method_missing(method, *args, &block)\n if delegate.respond_to?(method)\n delegate.public_send(method, *args, &block)\n else\n super\n end\n end",
"def getDelegate\n return @delegate\n end",
"def delegate_object; end",
"def method_missing(method, *args, &block)\n @delegate.send(method, *args, &block)\n rescue NoMethodError => e\n raise e, e.message.sub(/ for #<.*$/, \" via proxy for #{@delegate}\")\n end",
"def delegating_method; end",
"def __delegate\n@o\nend",
"def initialize(delegate = nil)\n @delegate = delegate\n reset!\n end",
"def initialize(delegate)\n raise \"Not a proper delegate\" unless delegate.is_a? AbstractDataStructure\n @delegate = delegate\n end",
"def initialize delegate\n @delegate = delegate\n raise @@delegate_error unless @delegate.respond_to? \"timed_event\"\n @port = Config::SERVER[:port]\n end",
"def delegate\n self\n end",
"def should_delegate( &block )\n\t\t@delegate_should_be_called = true\n\t\t@delegate_behavior = block || \n\t\t\tmethod( :default_delegation_behavior ).to_proc\n\tend",
"def safe_delegation(delegate, delegation, method=delegation)\n define_method method.to_sym do |*args, &block|\n # Forwardable makes an eval so it does not care whether\n # delegate is a method or an instance variable.\n # I chose not to do it (so far), so i have to try both\n # ways to get the delegate, in a violent way. But i like it.\n interface = begin\n send :instance_variable_get, delegate.to_s\n rescue\n send delegate\n end\n\n interface && interface.send(delegation, *args, &block)\n end\n end",
"def forward(method, params = nil)\n return unless @delegate.present? && @delegate.respond_to?(method)\n params.nil? ? @delegate.send(method) : @delegate.send(method, params)\n end",
"def default_delegation_behavior\n\t\t@delegate_called = true\n\tend",
"def delegate\n old, @delegate = @delegate, true\n out = yield\n @delegate = old\n out\n end",
"def delegate=(delegate)\n @delegate = WeakRef.new(delegate)\n end",
"def delegate_to klass_or_object\n @delegators.each do |data|\n unless data.empty?\n name = data[:name]\n args = data[:params]\n klass_or_object.send(name, *args)\n end\n end\n end",
"def a(*args, &block)\n return self if args.empty? && !block\n block = args.shift if !block && ::Proc === args.first\n if block\n pass = block.arity > 0 ? block.call(@delegate) : block.call #@delegate.instance_eval(&block)\n msg = args.shift || @message || block.inspect\n else\n pass = (args.shift === @delegate) # case equality\n msg = args.shift\n end\n __assert__(pass, msg)\n end",
"def delegated_arguments; end",
"def delegate_to(message, options={})\n @delegate_to = message\n @delegate_to_options = options.dup\n end",
"def rb_delegate(method, to: nil, alias_of: method, **kwd)\n raise ArgumentError, \"to must be provided\" unless to\n def_delegator(\n to, alias_of, method, **kwd\n )\n end",
"def data_delegators(*strings); end",
"def __delegate\n @o\n end",
"def with_fixtured_delegation( chain=[], *args, &block )\n\t\ttxn, req, vargs, *args = setup_fixtured_request( \"delegated_action\", *args )\n\n\t\t# Set delegation expectation\n\t\t@delegate_behavior ||= should_delegate()\n\n\t\tif block.arity == 3\n\t\t\tblock.call( txn, req, vargs )\n\t\telse\n\t\t\tblock.call( txn, req )\n\t\tend\n\t\t\n\t\trval = @applet.delegate( txn, chain, *args, &@delegate_behavior )\n\t\t\n\t\tif @delegate_should_be_called\n\t\t\tassert @delegate_called,\n\t\t\t\t\"delegate applet was never called\" \n\t\telse\n\t\t\tassert !@delegate_called,\n\t\t\t\t\"delegate applet was called unexpectedly\"\n\t\tend\n\n\t\treturn rval\n\tend",
"def delegate(*methods)\n options = methods.pop\n unless options.is_a?(Hash) && to = options[:to]\n raise ArgumentError, \"Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter).\"\n end\n\n if options[:prefix] == true && options[:to].to_s =~ /^[^a-z_]/\n raise ArgumentError, \"Can only automatically set the delegation prefix when delegating to a method.\"\n end\n\n prefix = options[:prefix] && \"#{options[:prefix] == true ? to : options[:prefix]}_\" || ''\n\n file, line = caller.first.split(':', 2)\n line = line.to_i\n\n methods.each do |method|\n on_nil =\n if options[:allow_nil]\n 'return'\n else\n %(raise \"#{self}##{prefix}#{method} delegated to #{to}.#{method}, but #{to} is nil: \\#{self.inspect}\")\n end\n\n module_eval(<<-EOS, file, line - 5)\n if instance_methods(false).map(&:to_s).include?(\"#{prefix}#{method}\")\n remove_possible_method(\"#{prefix}#{method}\")\n end\n\n def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)\n #{to}.__send__(#{method.inspect}, *args, &block) # client.__send__(:name, *args, &block)\n rescue NoMethodError # rescue NoMethodError\n if #{to}.nil? # if client.nil?\n #{on_nil} # return # depends on :allow_nil\n else # else\n raise # raise\n end # end\n end # end\n EOS\n end\n end",
"def create\n @delegate = Delegate.new(delegate_params)\n\n respond_to do |format|\n if @delegate.save\n format.html { redirect_to delegates_path, flash: { success: \"Delegate was successfully created.\" } }\n format.json { render :show, status: :created, location: @delegate }\n else\n delegates_for_current_profile\n @staff_list = current_staff_profile.staff_list_json\n format.html { render :index }\n format.json { render json: @delegate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delegate_params\n permitted_params = params.require(:delegate).permit(:delegate_id)\n\n # the delegator can only be the logged in user\n permitted_params.merge(delegator_id: current_staff_profile.id)\n end",
"def delegate\n @delegate_url or self.consumer_id\n end",
"def set_delegate\n @delegate = Delegate.find(params[:id])\n @delegate = nil if @delegate.delegator != current_staff_profile\n rescue ActiveRecord::RecordNotFound\n nil\n end",
"def delegation_type\n ensure_setup!\n return :public if (! options.has_key?(:delegate))\n\n case options[:delegate]\n when nil, false then nil\n when true, :public then :public\n when :private then :private\n # OK to raise an untyped error here -- we should've caught this in #validate_options.\n else raise \"Impossible value for :delegate: #{options[:delegate]}\"\n end\n end",
"def new\n @delegation = Delegation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @delegation }\n end\n end",
"def delegate *names, to:\n names.each do |name|\n def_delegator to, name\n end\n end",
"def delegate(*methods)\n options = methods.pop\n unless options.is_a?(Hash) && to = options[:to]\n raise ArgumentError, \"Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter).\"\n end\n\n if options[:prefix] == true && options[:to].to_s =~ /^[^a-z_]/\n raise ArgumentError, \"Can only automatically set the delegation prefix when delegating to a method.\"\n end\n\n prefix = options[:prefix] && \"#{options[:prefix] == true ? to : options[:prefix]}_\"\n\n file, line = caller.first.split(':', 2)\n line = line.to_i\n\n methods.each do |method|\n on_nil =\n if options[:allow_nil]\n 'return'\n else\n %(raise \"#{self}##{prefix}#{method} delegated to #{to}.#{method}, but #{to} is nil: \\#{self.inspect}\")\n end\n\n module_eval(<<-EOS, file, line)\n def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)\n #{to}.__send__(#{method.inspect}, *args, &block) # client.__send__(:name, *args, &block)\n rescue NoMethodError # rescue NoMethodError\n if #{to}.nil? # if client.nil?\n #{on_nil}\n else # else\n raise # raise\n end # end\n end # end\n EOS\n end\n end",
"def delegate( txn, chain, *args )\n\t\tyield( chain )\n\tend",
"def def_hash_delegator(hash, method, key: method, **kwd)\n prefix, suffix, wrap = prepare_delegate(**kwd)\n\n if suffix\n method = method.to_s.gsub(\n /\\?$/, \"\"\n )\n end\n\n class_eval delegate_debug(<<-STR), __FILE__, __LINE__ - 9\n def #{method}#{suffix}(*args)\n #{wrap}(\n #{prefix}#{hash}[#{key.inspect}]\n )\n\n rescue Exception\n if !Forwardable.debug && $@ && $@.respond_to?(:delete_if)\n $@.delete_if do |source|\n source =~ %r\"#{Regexp.escape(__FILE__)}\"o\n end\n end\n\n raise\n end\n STR\n end",
"def lazily_built_delegates\n delegate || build_delegate\n end",
"def lazily_built_delegates\n delegate || build_delegate\n end",
"def lazily_built_delegates\n delegate || build_delegate\n end",
"def method_missing(method, *args, &block)\n results = delegate(method, args, &block)\n if results.empty?\n super\n else\n messages = results.map do |result|\n @state.record(method, args, block, result[:message])\n @instructions[:output].output(result[:message]) if output?(result[:instruction_type])\n result[:message]\n end\n messages.compact.first\n end\n end",
"def delegate_to(target)\n if @delegate_target\n return self if target == @delegate_target\n raise ToolDefinitionError,\n \"Cannot delegate tool #{display_name.inspect} to #{target.join(' ')} because it\" \\\n \" already delegates to \\\"#{@delegate_target.join(' ')}\\\".\"\n end\n if includes_arguments?\n raise ToolDefinitionError,\n \"Cannot delegate tool #{display_name.inspect} because\" \\\n \" arguments have already been defined.\"\n end\n if runnable?\n raise ToolDefinitionError,\n \"Cannot delegate tool #{display_name.inspect} because\" \\\n \" the run method has already been defined.\"\n end\n disable_argument_parsing\n self.run_handler = make_delegation_run_handler(target)\n self.completion = DefaultCompletion.new(delegation_target: target)\n @delegate_target = target\n self\n end",
"def destroy\n if @delegate.blank?\n flash[:error] = \"Invalid delegate #{params[:id]} can not be destroyed\"\n else\n @delegate.destroy\n flash[:success] = t(\"delegation.delegate_destroyed\")\n end\n respond_to do |format|\n format.html { redirect_to delegates_url }\n format.json { head :no_content }\n end\n end",
"def invoke_delegated(service_name, method_name, *args)\r\n prepare_request(service_name.to_s, service_name, method_name, *args)\r\n @controller.process(@request, @response)\r\n decode_rpc_response\r\n end",
"def forward(receiver, *methods)\n methods = Array(methods).flatten\n target = self.__send__ :eval, receiver.to_s rescue nil\n\n if target\n single_delegate methods => receiver\n else\n instance_delegate methods => receiver\n end\n end",
"def method_missing(method_name, *args, &block)\n # If `delegate_all_to` has been set up for the method name\n # then delegate to it, otherwise pass it up the food chain\n if !delegating_all_to? && delegate_all_responds_to?(method_name)\n delegate_all_to.send(method_name, *args, &block)\n else\n super\n end\n end",
"def call\n if has_docs_request?\n if has_markdown_request?\n markdown_response\n else\n html_response\n end\n else\n delegate\n end\n end",
"def instance_delegate(hash)\n hash.each do |methods, accessor|\n unless defined?(methods.each)\n def_instance_delegator(accessor, methods)\n else\n methods.each {|method| def_instance_delegator(accessor, method)}\n end\n end\n end",
"def create\n @all_delegate = AllDelegate.new(params[:all_delegate])\n\n respond_to do |format|\n if @all_delegate.save\n format.html { redirect_to admin_all_delegates_path, notice: t('app.msgs.success_created', :obj => t('activerecord.models.all_delegates')) }\n format.json { render json: @all_delegate, status: :created, location: @all_delegate }\n else\n\t\t gon.edit_all_delegate = true\n\t\t gon.started_at = @all_delegate.started_at.strftime('%m/%d/%Y') if @all_delegate.started_at.present?\n\t\t gon.ended_at = @all_delegate.ended_at.strftime('%m/%d/%Y') if @all_delegate.ended_at.present?\n format.html { render action: \"new\" }\n format.json { render json: @all_delegate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def data_delegator(key)\n define_method(key.to_sym) { @obj.data[key] }\n end",
"def delegate(hash)\n hash.each do |methods, receiver|\n forward!(receiver, *methods)\n end\n end",
"def show\n @all_delegate = AllDelegate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @all_delegate }\n end\n end",
"def method_missing(id,*args,&block)\n return @delegated_to_object.send(id,*args,&block) if delegated_instance_methods.include?(id)\n super\n end",
"def method_missing(id,*args,&block)\n return @delegated_to_object.send(id,*args,&block) if delegated_instance_methods.include?(id)\n super\n end",
"def ffi_delegate(method)\n def_delegator(:@ffi_delegate, method)\n end",
"def closure_delegate(hash)\n hash.each do |methods, receiver|\n methods = [methods] unless methods.respond_to?(:each)\n methods.each do |method|\n def_closure_delegator(receiver, method)\n end\n end\n end",
"def should_not_delegate( &block )\n\t\t@delegate_should_be_called = false\n\t\t@delegate_behavior = block || \n\t\t\tmethod( :default_delegation_behavior ).to_proc\n\tend",
"def delegate(obj, method, m_alias = method)\n dynlink(m_alias) do |*args|\n instance = (obj[0] == \"@\") ?\n instance_variable_get(obj) :\n send(obj)\n instance.send(method, *args)\n end\n end",
"def delegate_all\n # noop\n end",
"def method_missing(method, *args, &block)\n send(target_method(method), method, *args, &block).tap do \n create_delegation_method!(method)\n end\n end",
"def delegate_to_service(method_name, *args)\n super.chomp\n end",
"def call(*args, **kwargs, &block)\n forward(*args, **kwargs, &block)\n end",
"def delegate_method(method, *args, &block)\n return unless @key && _resource.respond_to?(@key)\n\n @delegate ||= _resource.send(@key)\n return unless @delegate&.respond_to?(method.to_s)\n\n @delegate.send(method, *args, &block)\n end",
"def call(*) end",
"def call(*) end",
"def name\n @delegate.name\n end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def method_missing(method, *args, &block)\n send(target_method(method), method, *args, &block).tap do\n create_delegation_method!(method)\n end\n end",
"def handler ( h )\n raise TypeError, h.class.to_s + ': Incorrectly types for <handler> method of <ParserState>.' unless\n\th.instance_of? Method\n \n @handler = h\n end",
"def delegate=(object)\n @delegate = WeakRef.new(object)\n end",
"def create\n @delegate = Delegate.find_or_create_by_user_id(params[:user_id])\n @delegate.update_attribute(:active, true)\n @user = User.find_by_id(params[:user_id])\n respond_to do |format|\n if @delegate.save\n format.html { redirect_to(@user, :notice => t('users.delegates.created')) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @delegate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def call() end",
"def should_delegate(*methods)\n require 'mocha'\n \n klass = self.name.gsub(/Test$/, '').constantize\n \n options = methods.pop\n unless options.is_a?(Hash) && client = options[:to]\n raise ArgumentError, \"Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter).\"\n end\n \n if options[:prefix] == true && options[:to].to_s =~ /^[^a-z_]/\n raise ArgumentError, \"Can only automatically set the delegation prefix when delegating to a method.\"\n end\n \n prefix = options[:prefix] && \"#{options[:prefix] == true ? client : options[:prefix]}_\"\n \n context \"#{klass}\" do\n methods.each do |method|\n should \"delegate #{method} to #{client}\" do\n method_name = \"#{prefix}#{method}\"\n obj = klass.new\n assert obj.respond_to?(method), \"Method ##{method} is not delegated.\"\n obj.stubs(client).returns(mock) if obj.send(client).nil?\n obj.send(client).expects(method_name).once\n obj.send(method)\n \n obj.stubs(client).returns(nil)\n if options[:allow_nil]\n assert_nothing_raised(\"Delegation must allow nil as recipient, but doesn't.\") do\n obj.send(method)\n end\n else\n assert_raise(RuntimeError, \"Delegation allows recipient to be nil, however it shouldn't.\") do\n obj.send(method)\n end\n end\n end\n end\n end\n end",
"def def_modern_delegator(accessor, method, alias_ = method, args: \\\n { :before => [], :after => [] }, **kwd)\n\n prefix, suffix, wrap = prepare_delegate(**kwd)\n args = { :before => args } unless args.is_a?(Hash)\n b = [args[:before]].flatten.compact.map(&:to_s).join(\", \")\n a = [args[ :after]].flatten.compact.map(&:to_s).join(\", \")\n b = b + \", \" unless args[:before].nil? || args[:before].empty?\n a = \", \" + a unless args[ :after].nil? || args[ :after].empty?\n alias_ = alias_.to_s.gsub(/\\?$/, \"\") if suffix\n\n class_eval delegate_debug(<<-STR), __FILE__, __LINE__ - 10\n def #{alias_}#{suffix}(*args, &block)\n #{wrap}(#{prefix}#{accessor}.send(\n #{method.inspect}, #{b}*args#{a}, &block\n ))\n\n rescue Exception\n if !Forwardable.debug && $@ && $@.respond_to?(:delete_if)\n $@.delete_if do |source|\n source =~ %r\"#{Regexp.escape(__FILE__)}\"o\n end\n end\n\n raise\n end\n STR\n end",
"def initialize(delegate)\n @delegate = delegate\n @cache = {}\n @mutex = Mutex.new\n end",
"def call\n end",
"def method_missing(method, *args, &block)\n generate_unsafe_delegation(method)\n send(method, *args, &block)\n end",
"def initialize(collection = nil, delegate: nil, key: nil, parse_class: nil)\n @delegate = delegate\n @key = key.to_sym if key.present?\n @collection = collection.is_a?(Array) ? collection : []\n @loaded = @collection.count > 0\n @parse_class = parse_class\n end",
"def set_delegation\n @delegation = Delegation.find(params[:id])\n end",
"def set_delegation\n @delegation = Delegation.find(params[:id])\n end",
"def set_delegation\n @delegation = Delegation.find(params[:id])\n end",
"def call\n end",
"def data_delegators(*strings)\n strings.each do |key|\n data_delegator(key) if key.is_a?(String)\n end\n nil\n end",
"def define_delegation_method( method, object = 'request' )#:nodoc:\n if request && request.respond_to?( method )\n request.send( :method )\n self.class.class_eval \"def #{method}; #{object}.try(:#{method}); end\"\n end\n true\n rescue ArgumentError => e\n false\n end",
"def delegate( to )\r\n sender = @voters[msg.sender] # assigns reference\r\n assert sender.voted? == false\r\n\r\n while @voters[to].delegate != Address(0) && @voters[to].delegate != msg.sender do\r\n to = @voters[to].delegate\r\n end\r\n assert to != msg.sender\r\n\r\n sender.voted = true\r\n sender.delegate = to\r\n delegate_to = @voters[to]\r\n if delegate_to.voted\r\n @proposals[delegate_to.vote].vote_count += sender.weight\r\n else\r\n delegate_to.weight += sender.weight\r\n end\r\nend",
"def call\n # implement in subclasses\n end",
"def from_ffi_delegate(ffi_delegate)\n obj = allocate\n obj.attach_ffi_delegate(ffi_delegate)\n obj\n end",
"def delegate( txn, chain, *args )\n\t\t\tself.log.debug \"Delegating to chain: %p\" % [ chain ]\n\n\t\t\twith_authorization( txn, chain ) do\n\t\t\t\tyield( chain )\n\t\t\tend\n\t\tend",
"def on_accepted(event)\n Qpid::Proton::Event.dispatch(@delegate, :on_accepted, event) if !@delegate.nil?\n end"
] | [
"0.6828055",
"0.6789126",
"0.66544104",
"0.6569289",
"0.65179515",
"0.6517736",
"0.641044",
"0.6385248",
"0.6252018",
"0.6172458",
"0.59729815",
"0.5947766",
"0.58498734",
"0.5829118",
"0.580686",
"0.5716394",
"0.57095426",
"0.57074755",
"0.5639398",
"0.5634523",
"0.56198245",
"0.5585271",
"0.5518747",
"0.5514083",
"0.5481149",
"0.54651546",
"0.5411366",
"0.54077435",
"0.5391137",
"0.5342188",
"0.52627444",
"0.5262124",
"0.52505314",
"0.5249542",
"0.5208045",
"0.5205973",
"0.51923615",
"0.51843715",
"0.5146239",
"0.51404345",
"0.51236206",
"0.5102843",
"0.5100275",
"0.5100275",
"0.5086236",
"0.50494003",
"0.5048388",
"0.5027356",
"0.5000544",
"0.4996835",
"0.49857733",
"0.49775282",
"0.49770966",
"0.49535722",
"0.49310988",
"0.49219614",
"0.48997232",
"0.48997232",
"0.4890001",
"0.48580256",
"0.48497254",
"0.4836287",
"0.48310304",
"0.48279864",
"0.4820298",
"0.47976324",
"0.4781121",
"0.47807127",
"0.47807127",
"0.4770854",
"0.47521508",
"0.47521508",
"0.47521508",
"0.47521508",
"0.47521508",
"0.47521508",
"0.47521508",
"0.47521508",
"0.47493777",
"0.47461638",
"0.47206965",
"0.47156546",
"0.47144422",
"0.47079098",
"0.46593222",
"0.46508846",
"0.46375856",
"0.46269956",
"0.4623468",
"0.46210262",
"0.46210262",
"0.46210262",
"0.46064913",
"0.46036693",
"0.4601654",
"0.4577835",
"0.45721132",
"0.45670012",
"0.45592898",
"0.45589092"
] | 0.57613504 | 15 |
end of response for a single document return | def successful?
@successful #make it true if everything saved successfully
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_document; end",
"def end_document; end",
"def on_end_document\n end",
"def end_accepting\n @res\n end",
"def out\n return @response.finish\n end",
"def end_accepting\n @res.compact\n end",
"def endnote\n @response, @documents = fetch(Array(params[:id]))\n respond_to do |format|\n format.endnote { render :layout => false }\n end\n end",
"def finish_response; end",
"def endnote\n @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])\n respond_to do |format|\n format.endnote { render :layout => false } #wrapped render :layout => false in {} to allow for multiple items jac244\n format.mendeley { render :layout => false } \n end\n end",
"def finish\n\t\t\t\t\t@body.finish\n\t\t\t\tend",
"def end\n\t\ttexts = get_texts(\"end\")\n\t\t@title = texts.title.html_safe\n\t\t@heading = texts.heading.html_safe\n\t\t@text = texts.body.html_safe\n\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\t# format.xml { render :xml => @foobar } #.to_xml }\n\t\t\t# format.json { render :json => @foobar } #.to_json }\n\t\tend\n\tend",
"def body\n last_response.body\nend",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def next() \n\t\treturn self.response.next()\n\tend",
"def end() end",
"def finish ; request.session.save ; @response.finish ; end",
"def response; return @response end",
"def end\n end",
"def endnote\n Rails.logger.info(\"es287_debug #{__FILE__}:#{__LINE__} params = #{params.inspect}\")\n if params[:id].nil?\n bookmarks = token_or_current_or_guest_user.bookmarks\n bookmark_ids = bookmarks.collect { |b| b.document_id.to_s }\n Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} bookmark_ids = #{bookmark_ids.inspect}\")\n Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} bookmark_ids size = #{bookmark_ids.size.inspect}\")\n if bookmark_ids.size > BookBagsController::MAX_BOOKBAGS_COUNT\n bookmark_ids = bookmark_ids[0..BookBagsController::MAX_BOOKBAGS_COUNT] \n end\n @response, @documents = search_service.fetch(bookmark_ids, :per_page => 1000,:rows => 1000)\n Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} @documents = #{@documents.size.inspect}\")\n else\n @response, @documents = search_service.fetch(params[:id])\n end\n fmt = params[:format]\n Rails.logger.debug(\"es287_debug #{__FILE__}:#{__LINE__} #{__method__} = #{fmt}\")\n respond_to do |format|\n format.endnote_xml { render \"show.endnote_xml\" ,layout: false } \n format.endnote { render :layout => false } #wrapped render :layout => false in {} to allow for multiple items jac244\n format.ris { render 'ris', :layout => false }\n end\n end",
"def process_response(obj)\n end",
"def on_end_document\n STDOUT << \"on_end_document\\n\"\n STDOUT.flush\n end",
"def response\n @response ||= datasource_response['docs']\n end",
"def response_body; end",
"def response_body; end",
"def end_document\n delegate.end_document(DOCUMENT_NODE, self) if delegate.respond_to?(:end_document)\n end",
"def endpage\n respond_to do |format|\n format.html { render :endpage }\n end\n end",
"def end_of_report?(document)\n document\n end",
"def end_document\n # postprocess @text to remove trailing spaces on lines\n @text = @text.split(\"\\n\").map(&:strip).join(\"\\n\")\n # remove trailing whitespace at end of buffer\n @text.strip!\n end",
"def finish\n\t\t\t\t\tif @body\n\t\t\t\t\t\tbody = @body.finish\n\t\t\t\t\t\t@body = nil\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn body\n\t\t\t\t\tend\n\t\t\t\tend",
"def after_destroy_response\n respond_to do |format|\n format.html { redirect_to oai_endpoints_path }\n format.xml { head :ok }\n end\n end",
"def end\n @organization_timeline_entry.ended_at = DateTime.now\n @organization_timeline_entry.save\n respond_with(@organization_timeline_entry, location: params[:url])\n end",
"def finish()\n #This is a stub, used for indexing\n end",
"def finish(consumer, session, req)\n oid = consumer.complete(req.GET, req.url)\n req.env['rack.auth.openid.response'] = oid\n req.env['rack.errors'].puts(oid.message)\n p oid if $DEBUG\n\n raise unless ValidStatus.include?(oid.status)\n __send__(oid.status, oid, req, session)\n end",
"def returned_count\n reply.documents.length\n end",
"def last_response\n @response\n end",
"def notify_end_document\n @state = :end_document\n notify(:end_document)\n end",
"def results(reply)\n reply.documents.first\n end",
"def end(resource)\n end",
"def response\n\t\t@response\n\tend",
"def end\n end",
"def last_response\n defined?(super) ? super : response\n end",
"def finalize_response(resp)\n resp.tap do |r|\n r.response[:limit] = r.response.items.size - 1\n r.response[:moreItems] = false\n end\n end",
"def response_body\n nil\n end",
"def _end!; end",
"def end; end",
"def end; end",
"def end; end",
"def api_response\n nil\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to back_index_case_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document.destroy\n respond_to do |format|\n format.html { redirect_to back_index_case_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def on_complete(env)\n assert_response_ok(env[:status], env[:body])\n env[:body] = case env[:status]\n when 204\n {\n :data => {},\n :errors => [],\n :metadata => {},\n }\n else\n parse(env[:body])\n end\n end",
"def response\n buffer_available_data\n @buffer[@cursor..-1]\n end",
"def end\n end",
"def end\n end",
"def at_end; end",
"def _roda_after(res)\n end",
"def do_eof; end",
"def finished_at; @doc['finished_at']; end",
"def response\n { nothing: true }\n end",
"def destroy\n begin\n @document.destroy\n flag = true\n rescue\n error_message = ''\n @document.errors[:error_message].each do |error|\n if error == @document.errors[:error_message].last\n error_message += error.to_s\n else\n error_message += error.to_s + ','\n end\n end\n flash.now[:error] = error_message\n flag = false\n end\n respond_to do |format|\n format.json { render :json => flag }\n format.any { head :no_content }\n end\n end",
"def hathi_holdings\n @response, @document = fetch params[:id]\n\n respond_to do |format|\n format.html { render layout: false }\n end\n end",
"def hathi_holdings\n @response, @document = fetch params[:id]\n\n respond_to do |format|\n format.html { render layout: false }\n end\n end",
"def page_complete\n doc_id = params[:id]\n doc = Typewright::Document.find_by_id(doc_id)\n doc.status = 'user_complete'\n if !doc.save\n render :text => doc.errors, :status => :error\n return\n end\n\n # get admin users\n admins = ::User.get_administrators()\n to = \"\"\n admins.each do | admin |\n if to.length > 0\n to << \",\"\n end\n to << admin.email\n end\n\n # send an email to them so they know a document has been marked as complete\n doc_url = \"#{get_base_uri()}/typewright/documents/#{doc_id}/edit\"\n status_url = \"#{get_base_uri()}/typewright/overviews?filter=#{url_encode(doc.uri)}\"\n DocumentCompleteMailer.document_complete_email(current_user, doc, doc_url, status_url, to).deliver\n\n render :text => \"OK\", :status => :ok\n end",
"def on_complete(env)\n env[:body] = case env[:status]\n when 204\n parse('')\n else\n parse(env[:body])\n end\n end",
"def handle_upload_done( request )\n\t\tself.log.warn \"Upload finished: %s (%0.2fK, %s)\" %\n\t\t\t[ request.uploaded_file, request.content_length, request.content_type ]\n\n\t\tresponse = request.response\n\t\tresponse.puts \"Upload complete: %p\" % [ request.uploaded_file ]\n\t\tresponse.content_type = 'text/plain'\n\n\t\treturn response\n\trescue Mongrel2::UploadError => err\n\t\tself.log.error \"%s when finishing an upload: %s\" % [ err.class, err.message ]\n\t\tself.log.debug { err.backtrace.join(\"\\n\\t\") }\n\n\t\tfinish_with HTTP::BAD_REQUEST, 'malformed upload headers'\n\tend",
"def destroy\n \t@document = Document.find(params[:id])\n unless @document.blank?\n \tif @document.destroy\n \t\trender json: {status: 'SUCCESS', message:'Document deleted', data:@document}, status: :ok\n \telse \n \t\trender json: {status: 'ERROR', message:'Document was not deleted', data:@document}, status: :unprocessable_entity\n \tend\n else \n \t\trender json: {status: 'ERROR', message:'No such document', data:@document}, status: :unprocessable_entity\n end\n end",
"def last_response\n @last_response\n end",
"def document?; end",
"def document?; end",
"def body\n @response.body if success?\n end",
"def end\n @history.objects.find { |o| o.name == \"end\" }.val\n end",
"def on_complete(env)\n env[:body] = case env[:status]\n when 204\n parse('{}')\n else\n parse(env[:body], env[:response_headers])\n end\n end",
"def doctype_end\n end",
"def finish_with_body(_)\n delete_empty_headers(super)\n end",
"def process_output\n return @output unless @output.nil?\n return @output = DocumentOutput.new(@response_output) unless @response_output.nil?\n \n raise \"The response output was not in it's usual places, please provide the output\" if @controller.nil? || @controller.body.empty?\n @response_output = @controller.body\n @output = DocumentOutput.new(@controller.body)\n end",
"def raw\n\t\t#puts \"raw, line \" + \"27\"\n\t\t@raw = ssl.find({id: params[:id]}).to_a.first\n\t\tif @raw.nil?\n\t\t\tredirect_to doc_index_path, notice: 'No record of doc with id: ' + params[:id].to_s \n \t\telse\n \t\t\trender json: @raw \n\t\tend\n \tend",
"def finalize\n res = RResponse.new\n begin\n order = Order.finalize(params[:id])\n Invoice.create(\n :order => order,\n :created_by => self.current_user.account\n ) \n res.msg = 'Order ' + order.bill_number.to_s + ' ' + order.order_status.name\n res.success = true\n rescue Order::FinalizeError => e\n raise e \n end\n respond(res)\n \n \n end",
"def finish_request\n unless @error\n response.headers['Location'] = \"/orders?id=#{@order.id}\"\n response.body = @order.to_json\n end\n end",
"def response\r\n @response\r\n end",
"def destroy\r\n @document.destroy\r\n respond_to do |format|\r\n format.html { redirect_to root_url, notice: 'Document was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def finish\n @length = @body.length if @body.is_a?(DelayedBody) && !@headers[RodaResponseHeaders::CONTENT_LENGTH]\n super\n end",
"def solr_resp_single_doc(doc_id, solr_params = {})\n solr_response(solr_params.merge({'qt'=>'document','id'=>doc_id}))\nend",
"def raw_response; end",
"def response\n @response\n end",
"def response\n @response\n end",
"def http_after_get(request, response)\n return unless response.header('Content-Type').index('text/calendar')\n\n result = Http::Util.negotiate(\n request.header('Accept'),\n ['text/calendar', 'application/calendar+json']\n )\n\n unless result == 'application/calendar+json'\n # Do nothing\n return\n end\n\n # Transforming.\n vobj = VObject::Reader.read(response.body)\n\n json_body = vobj.json_serialize.to_json\n response.body = json_body\n\n # Destroy circular references so PHP will garbage collect the object.\n vobj.destroy\n\n response.update_header('Content-Type', 'application/calendar+json')\n response.update_header('Content-Length', json_body.bytesize)\n end",
"def finish\n @app.log_request\n if json?\n log.h_debug(\"Serializing response into JSON\")\n @body = [ActiveSupport::JSON.encode(@body)]\n end\n super\n end",
"def end?\n @status == :end\n end",
"def on_complete(env)\n if respond_to? :parse\n env[:body] = parse(env[:body]) unless [204,304].index env[:status]\n end\n end"
] | [
"0.6550154",
"0.6550154",
"0.6512437",
"0.6307545",
"0.62537724",
"0.62127906",
"0.6177872",
"0.61542743",
"0.6128613",
"0.61256117",
"0.59980816",
"0.5950337",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.58655137",
"0.5804461",
"0.5802068",
"0.57709575",
"0.5770704",
"0.5751032",
"0.57434934",
"0.57432675",
"0.57026833",
"0.57025695",
"0.57025695",
"0.5665366",
"0.5653644",
"0.56501746",
"0.56311554",
"0.5615004",
"0.5614217",
"0.56127775",
"0.5599151",
"0.5569188",
"0.5560897",
"0.5558514",
"0.5550659",
"0.5547525",
"0.5521951",
"0.5506553",
"0.5503636",
"0.5486337",
"0.5485462",
"0.5471879",
"0.5462694",
"0.54477215",
"0.54477215",
"0.54477215",
"0.5444014",
"0.5438848",
"0.5438848",
"0.5434666",
"0.5427307",
"0.5413795",
"0.5413795",
"0.5403348",
"0.5402637",
"0.53939104",
"0.539004",
"0.53796196",
"0.53616244",
"0.5355721",
"0.5355721",
"0.5353487",
"0.5344523",
"0.5341217",
"0.5331008",
"0.5329173",
"0.5323543",
"0.5323543",
"0.53228945",
"0.5320047",
"0.5317043",
"0.5303464",
"0.5301819",
"0.5299964",
"0.52951294",
"0.5283356",
"0.5283082",
"0.5278285",
"0.52746105",
"0.52746004",
"0.52732533",
"0.5269473",
"0.526858",
"0.526858",
"0.5266577",
"0.526578",
"0.5264483",
"0.5264071"
] | 0.0 | -1 |
returns an array of the urls | def scrape
google_url = create_google_url
google_data = Scrubyt::Extractor.define do
fetch google_url
link_title "//a[@class='l']", :write_text => true do
link_url
end
end
google_data.to_hash.map {|r| r[:link_url]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urls\n @urls ||= extract_urls('url')\n end",
"def urls\n each_url.to_set\n end",
"def urls\n @@urls\n end",
"def to_a\n urls.map(&:url)\n end",
"def urls\n info.map(&:value).select { |u| u.match %r{\\Ahttps?://} }\n end",
"def urls\n (url.split(\",\") rescue []) + [cran_url]\n end",
"def urls\n @sets.collect(&:keys).flatten\n end",
"def urls\n @urls ||= all_urls(sitemap)\n end",
"def urls\n keys\n end",
"def sitemap_urls\n each_sitemap_url.to_a\n end",
"def all_urls\n urls = NG_URL.all.collect {|n| n.url}\n urls.sort!\n end",
"def get_urls\n\n url_array = []\n top_five = 0\n\n while top_five < 5\n url_array << @news_instance[\"response\"][\"docs\"][top_five][\"web_url\"]\n top_five += 1\n end\n\n # returns the array\n return url_array\n\n end",
"def get_urls(page)\n doc = Nokogiri::XML(open_url(page))\n urls = []\n\n doc.search('nodes > node').each do |node|\n url = nil\n node.search('URL').each do |t|\n url = t.inner_text\n end\n if url\n urls << url\n end\n end\n\n urls\n end",
"def paths_from_urls\n urls = []\n parsed_urls.each do |url|\n path = URI(url).path.sub(/^(http(s)?(:)?(\\/)+?(:)?)?((\\/)?www.)?gov.uk/, \"\")\n urls << (path.start_with?(\"/\") ? path : \"/#{path}\")\n end\n urls.uniq\n end",
"def image_url_list\n list = []\n images.each do |image|\n list << image.url \n end\n list\n end",
"def image_urls\n images.map {|image| image.url}\n end",
"def all_urls_external\n ngurls = NG_URL.all(:a_hrefs_external => { :$not => { :$size => 0}})\n urls_external = []\n ngurls.each {|n| urls_external += n.a_hrefs_external }\n urls_external.uniq!.sort!\n end",
"def links()\n links = Nokogiri::HTML(RedCloth.new(self.body).to_html).css(\"a\").map do |link|\n if (href = link.attr(\"href\")) && href.match(/^https?:/)\n href\n end\n end.compact\n uris = []\n links.each do |link|\n puts link\n uris.push(URI.parse(link))\n end\n return uris\n end",
"def urls\n URI.extract(self.script)\n end",
"def images_urls\n \timages.map{|image| image.url}\n end",
"def get_google_links\n linkarray = []\n @links = @links.each do |link|\n if (link.scan(\"http://\").length == 2)\n linkarray.push(link)\n end\n end\n return linkarray\n end",
"def links\n response = Clever.request :get, url\n response[:links]\n end",
"def urls\n @url.map do |el|\n case el\n when %r{^IANA$}\n IANA_URL % [ @media_type, @sub_type ]\n when %r{^RFC(\\d+)$}\n RFC_URL % $1\n when %r{^DRAFT:(.+)$}\n DRAFT_URL % $1\n when %r{^LTSW$}\n LTSW_URL % @media_type\n when %r{^\\{([^=]+)=([^\\}]+)\\}}\n [$1, $2]\n when %r{^\\[([^=]+)=([^\\]]+)\\]}\n [$1, CONTACT_URL % $2]\n when %r{^\\[([^\\]]+)\\]}\n CONTACT_URL % $1\n else\n el\n end\n end\n end",
"def urls\n @gapi.source_uris\n end",
"def get_urls()\n generate_thread(@@source_url)\n end",
"def get_urls(search_results)\n # A Google search_result looks like:\n # <a href=\"/url?q=https://www.scienceexchange.com/\">Science Exchange<b>...</b></a>\n # To get the actual page URL, use the 'href' and get the query param 'q' term.\n urls = []\n search_results.each do |result|\n url = result['href']\n query = URI.parse(url).query\n result_url = CGI.parse(query)['q'].first\n result_url = url if result_url.nil?\n urls << result_url\n end\n return urls\n end",
"def post_urls\n arr_hrefs = []\n collect_post_elements.each do |element|\n # there should only be one headline link per post\n if link = element.search( headline_element ).first \n uri = URI.parse link['href']\n uri.fragment = nil\n arr_hrefs << uri.to_s \n end\n end\n\n return arr_hrefs\n end",
"def get_all_new_urls(results)\n all_urls = results.map { |result| result.absolute_linked_resources }.flatten\n all_urls.uniq!\n #TODO: handle any other url parsing error\n all_urls.delete_if { |url| !a_domain_we_care_about?(url)}\n all_urls.delete_if { |url| i_have_seen_this_url_before?(url)}\n end",
"def urls(env)\n begin\n page = env[:page]\n agent = env[:agent]\n follower_url = page.search(FLAG)[1].attributes['href'].value\n follower_page = agent.get(follower_url)\n tables = follower_page.search(FOLLOWER_FLAG)\n tables.map{|table| get_url_from_table(table)}\n rescue => err\n CrawlingService.log(err.message)\n CrawlingService.log(err.backtrace)\n []\n end\n\n end",
"def external_links\n return [] if @links.empty?\n\n links = @links\n .reject { |link| link.relative_link?(host: @url.to_base) }\n .map(&:without_trailing_slash)\n\n Wgit::Utils.process_arr(links)\n end",
"def sitemap_index_urls\n each_sitemap_index_url.to_a\n end",
"def get_redirection_urls\n\t\tputs \"getter to retrieve all the redirection URLs from the site store.\" if @verbose\n\t\turls=Array.new\n\t\t@known_sites.keys.map do |key|\n\t\t\tunless @known_sites[key]['redirection'].nil?\n\t\t\t\turls.push(@known_sites[key]['redirection'])\n\t\t\tend\n\t\tend\n\t\turls.sort!\n\t\treturn urls\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\treturn nil\n\tend",
"def websites\n Array(@websites)\n end",
"def public_urls\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.flatten.compact.uniq\n end",
"def links\n @links ||= parsed_links.map{ |l| URL.absolutify(URL.unrelativize(l, scheme), base_url) }.compact.uniq\n end",
"def image_urls\n images = []\n\n @document.css('.user-html img').map do |image|\n images << image.attributes['src'].value\n end\n\n # Don't choke on protocol relative URL's.\n images.collect { |image| image.gsub(%r{^//}, 'https://') }\n end",
"def gets_urls\n page = Nokogiri::HTML(URI.open('http://www2.assemblee-nationale.fr/deputes/liste/alphabetique'))\n urls = []\n\n page.css('div.col-container > ul > li > a').each do |fetch|\n urls.push('http://www2.assemblee-nationale.fr' + fetch['href'])\n end\n\n urls\nend",
"def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"def get_townhall_urls\n\tpage = la_page\n\turls = page.xpath('//*[@class=\"lientxt\"]/@href') #/ toutes les URLs appartiennent à la classe lientxt\n\turl_array = []\n\turls.each do |url| #/ pour chaque URLs récupérées, il faut leur indiquer l'url parent \"http://annuaire-des-mairies.com\"\n\t\turl = \"http://annuaire-des-mairies.com\" + url.text[1..-1] #/ A l'url parent, on ajoute les urls récupérées du deuxième caractère au dernier caractère, car on veut se débarasser du point devant.\n\t\turl_array << url\n\tend\n puts url_array\n\n\treturn url_array\nend",
"def links\n @links ||= parsed_links.map{ |l| absolutify_url(unrelativize_url(l)) }.compact.uniq\n end",
"def find_links(url)\n # This should return an array of all links at the given URL\nend",
"def get_anchor_urls\n result = []\n\n @anchor.getLocations().each do |each|\n result << AnchorUrl.new(\n :url => each.getDownloadURL(),\n :anchor_url_certs => get_certs(each))\n end\n\n return result\n end",
"def get_all_urls\r\n val_d_oise = \"http://annuaire-des-mairies.com/val-d-oise.html\"\r\n page = Nokogiri::HTML(URI.open(val_d_oise))\r\n links = page.xpath('//*[@class=\"lientxt\"]').map{|anchor| anchor[\"href\"]}\r\n return links\r\nend",
"def get_urls_for_client_jars(existing, urls)\n []\n end",
"def get_urls_for_client_jars(existing, urls)\n []\n end",
"def links()\n return @links\n end",
"def to_urls!\n map! { |element| process_url_element(element) }\n end",
"def same_domain_urls\n (css_links + javascript_links + image_links + links).select{|url| \n begin \n URI.parse(url).host == @url.host\n rescue URI::InvalidURIError => e\n puts \"invalid uri \", e \n end\n }.uniq\n end",
"def urls\n keys.map{ |k| k[/^#{prefix}(.*)/, 1] }\n end",
"def return_links_array(doc)\n links = doc.css(\".search-content .teaser-item__title a\")\n recipe_links = []\n links.each do |element|\n recipe_links << \"https://www.bbcgoodfood.com\" + element.attribute('href').value\n end\n return recipe_links\n end",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def links\n return @links unless @links.nil?\n @links = []\n return @links if !doc\n\n doc.search(\"//a[@href]\").each do |a|\n next if a['data-method'] && a['data-method'] != 'get'\n u = a['href']\n next if u.nil? or u.empty?\n abs = to_absolute(u) rescue next\n @links << abs if in_domain?(abs)\n end\n @links.uniq!\n @links\n end",
"def get_townhall_urls(url)\n\n page = Nokogiri::HTML(URI.open(url)) \n #townhall_url = page.xpath(\"//a/@href\").map {|x| x.value}\n townhall_urls_array_incomplete = page.css('a[href].lientxt').map {|x| x[\"href\"]}\n #remove the dot at the beginning of the url\n townhall_urls_array_incomplete = townhall_urls_array_incomplete.map {|x| x[2..]}\n townhall_urls_array = townhall_urls_array_incomplete.map {|x| \"http://annuaire-des-mairies.com/\" + x}\n return townhall_urls_array\n\nend",
"def urls(crawled: nil, limit: 0, skip: 0)\n query = crawled.nil? ? {} : { crawled: crawled }\n sort = { date_added: 1 }\n\n results = retrieve(:urls, query,\n sort: sort, projection: {},\n limit: limit, skip: skip)\n return [] if results.count < 1 # results#empty? doesn't exist.\n\n # results.respond_to? :map! is false so we use map and overwrite the var.\n results = results.map { |url_doc| Wgit::Url.new(url_doc) }\n results.each { |url| yield(url) } if block_given?\n\n results\n end",
"def extract_urls(node_name)\n return document.to_s.each_line.map(&:strip) if plain_document?\n\n urls = []\n document.root.elements.each(\"#{node_name}/loc\") do |element|\n urls << element.text\n end\n urls\n end",
"def get_townhall_urls\n\tpage = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n\turl_array = []\n\n\turls = page.xpath('//*[@class=\"lientxt\"]/@href') \n\n urls.each do |url| \n# ->Pour chaque URL récupérée : indiquer l'url parent \"http://annuaire-des-mairies.com\"\n url = \"http://annuaire-des-mairies.com\" + url.text[1..-1] \n#->A l'url parent, on ajoute les urls récupérées du deuxième caractère au dernier caractère, car on veut se débarasser du point devant.\n\t\turl_array << url\t\t\n\tend\n\treturn url_array \nend",
"def get_townhall_urls(url)\n page = Nokogiri::HTML(open(url))\n cities_url = page.xpath('//a[@class=\"lientxt\"]').to_a\n links = (cities_url.map {|url| url[\"href\"][1..-1]}).to_a\n #puts links\n return links\nend",
"def links\n @links ||= []\n @links\n end",
"def links\n @links.values\n end",
"def links\n return @links if @links\n return false unless @source\n @links = @source.scan(HREF_CONTENTS_RE).map do |match|\n # filter some malformed URLS that come in\n # meant to be a loose filter to catch all reasonable HREF attributes.\n link = match[0]\n Link.new(@t.scheme, @t.host, link).path\n end.uniq\n end",
"def grabUrlsFromDomain(domain)\n @htmlDocument = Nokogiri::HTML(open(domain,{ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}))\n if @htmlDocument.nil?\n abort red('Something went wrong ...')\n else\n puts green('Fetched.')\n end\n\n #Varibles\n tempArray = Array.new\n count = 1\n progress = ProgressBar.create(:starting_at => 0, :total => 200)\n\n @htmlDocument.xpath('//a[@href]').each do |link|\n #se for do mesmo dominio colocar no array\n if !link['href'].to_s.include? \"http://\"\n if !link['href'].to_s.include? \"https://\"\n tempUrl = domain+\"/\"+link['href']\n tempArray << tempUrl+\"\\n\"\n end\n end\n\n if count <= 200\n progress.increment\n end\n\n count+=1\n end\n\n #make they uniq then return\n return tempArray.uniq!\n\n end",
"def urls(crawled: nil, limit: 0, skip: 0)\n query = crawled.nil? ? {} : { crawled: crawled }\n sort = { date_added: 1 }\n\n results = retrieve(URLS_COLLECTION, query,\n sort: sort, limit: limit, skip: skip)\n return [] if results.count < 1 # results#empty? doesn't exist.\n\n # results.respond_to? :map! is false so we use map and overwrite the var.\n results = results.map { |url_doc| Wgit::Url.new(url_doc) }\n results.each { |url| yield(url) } if block_given?\n\n results\n end",
"def apartments_urls(url)\n JSON(Net::HTTP.get(URI(url)))['apartments'].map { |value| value['url'] }\n #Net::HTTP.get(URI(url)).scan(/https\\:\\\\\\/\\\\\\/r\\S{10,}.s\\\\\\/\\d{4,7}/).map { |val| val.gsub(\"\\\\\", \"\") }\n end",
"def hub_site_urls\n return @hub_site_urls\n end",
"def get_hrefs\n # this will grab all the html from the url that\n # the user created the scraper with\n url_to_scrape = HTTParty.get(self.url)\n # nokogiri turns everything from HTTParty into nodes.\n nodes = Nokogiri::HTML(url_to_scrape)\n nodes.css('a').each do |a|\n self.hrefs << a['href']\n end\n self.hrefs\n end",
"def all_clicked_links\n all_clicks.collect{|c| c['url'] }.uniq\n end",
"def links\n return @links\n end",
"def links\n return @links\n end",
"def links\n return @links\n end",
"def get_img_links()\n img = @page.css('img')\n @imgLinks = Array.new\n new_url = self.get_new_url()\n\t\t\n if @url[@url.length-1] != '/'\n @url += \"/\"\n end\n print new_url\n\n img.each do |i|\n @imgLinks.push(@url+i[\"src\"])\n end\n end",
"def bad_urls\n result = []\n @pages.each do |page|\n result << page.hlu\n end\n result.compact!\n end",
"def visited_spots_urls(user_id=self.username)\n connection.get(\"/users/#{user_id}/visited_spots_urls\").body.urls\n end",
"def get_images_from_url\n @links = (images_from_img_tag + images_from_link_tag + images_from_extension).uniq\n @handler_link.remove_global_unless_symbols(@links)\n @links\n end",
"def all_URLs(group)\n urls = Hash.new()\n each_normal_group_record(group) do |item|\n if item.URL == '' then next end # Only interested in items that has an URL\n key = item.URL.to_s # To avoid using NSStrings (not that it really matters)\n @unify_url_log.debug \"<#{key}> url of '#{item.name}' \"\n if urls.has_key?(key) then\n urls[key] << item.get\n else\n urls[key] = [item.get]\n end\n end\n return urls # hash with URL - number of this URL\n end",
"def preview_urls\n image_urls\n end",
"def get_townhall_urls\r\n\r\n # Scrapping de toutes les URLs\r\n page = Nokogiri::HTML(URI.open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\r\n\turls = page.xpath('//*[@class=\"lientxt\"]/@href') # toutes les URLs appartiennent à la classe lientxt\r\n\r\n #stockage des URLs scrappées dans une array\r\n\turl_array = []\r\n urls.each do |url| # pour chaque URLs récupérées, il faut leur indiquer l'url parent \"http://annuaire-des-mairies.com\"\r\n\t\turl = \"http://annuaire-des-mairies.com\" + url.text[1..-1] # A l'url parent, on ajoute les urls récupérées du deuxième caractère au dernier caractère, car on veut se débarasser du point devant.\r\n\t\turl_array << url\r\n end\r\n\r\n puts \" ⏳ URLs scrapping in process...3️, 2️, 1️\" \r\n sleep 3\r\n puts \"⭐⭐⭐ BINGOOOOOO ⭐⭐⭐\" #https://emojipedia.org/\r\n sleep 1\r\n return url_array \r\nend",
"def urls\n payloads.group(\"url\")\n .count\n .sort_by { |k,v| -v }\n end",
"def links\n\t self.tweets.collect{|t| t.links}.flatten.compact\n\tend",
"def contract_urls\n Scrapers::ContractUrlExtractor.new(report.url).urls\n end",
"def get_all_the_urls_of_val_doise_townhalls(page_url)\n doc = Nokogiri::HTML(open(page_url))\n urls = []\n#on recupere le css a[class=lientxt]\n get_urls = doc.css(\"a[class=lientxt]\")\n get_urls.each{|link| urls.push(\"http://annuaire-des-mairies.com\"+link['href'][1...link['href'].length])}\n urls\nend",
"def links\n @links ||= begin\n if doc\n # get a list of distinct links on the page, in absolute url form\n links = doc.css('a[href]').inject([]) do |list, link|\n href = link.attributes['href'].content\n href.strip! if href\n \n unless skip_link?(href)\n begin\n url = to_absolute(href)\n rescue URI::InvalidURIError\n $stderr.puts \"ERROR: bad URI #{href.inspect} on page #{self.url.to_s.inspect}\"\n else\n list << url if url.scheme =~ /^https?$/\n end\n end\n list\n end\n \n links.uniq!\n links\n else\n []\n end\n end\n end",
"def public_urls\n #Rails.cache.fetch(\"public_urls-#{Globalize.locale}-#{self.cache_key}\") do\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.compact.uniq\n #end\n end",
"def get_compatible_sites\n ret = []\n @sites.each do |site|\n ret << site[:link]\n end\n ret\n end",
"def all\n @all ||= raw.map { |link| URL.absolutify(link, base_url) }.compact.uniq\n end",
"def urls_of_val_doise_townhalls\n\turl_parent = \"http://annuaire-des-mairies.com/\" # The parent page url which list the town hall pages url\n\tpage = Nokogiri::HTML(open(url_parent+\"/val-d-oise.html\")) # url from the page and the specific town link\n\turls_array = page.xpath('//a[@class = \"lientxt\"]').map { |node| url_parent + node.attributes[\"href\"].value[1..-1] }\n\treturn urls_array # urls sheet\nend",
"def getScrapingURLs(shared)\n\tFile.open(\"urls.txt\").each do |line|\n\t\tshared.pushurl(line.chomp)\n\tend\nend",
"def url_list\n url_list = []\n tile_generator = TileGenerator.new\n tile_size_with_gutter = @tile_size + (2 * @gutter_size)\n tile_generator.generate_tiles(@zoom_level, @bbox, @tile_size, @gutter_size, @version).each do |tile_bbox|\n url = @url_format % {\n :layer_name => @layer.gsub(\":\", \"%3A\"),\n :version => @version,\n :bbox => tile_bbox.join(\",\"),\n :width => tile_size_with_gutter,\n :height => tile_size_with_gutter\n }\n url_list << url\n end\n return url_list\n end",
"def get_all_the_urls_of_val_doise_townhalls(url)\n page = Nokogiri::HTML(open(url))\n urls = []\n source = \"http://annuaire-des-mairies.com/\"\n news_links = page.css(\"a\").select{|link| link['class'] == \"lientxt\"}\n news_links.each do |link|\n lien = link['href']\n nv_link = lien.byteslice(2,lien.length)\n nv_link = source + nv_link\n urls << nv_link\n end\n return urls\nend",
"def mirror_urls\n Array(self.get_with_key('/mirrors.xml')['Mirrors']['Mirror']['mirrorpath'])\n end",
"def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend",
"def urls(text)\n scan(text, URL, :url)\n end",
"def get_uri_hosts(tweet)\n list = []\n #tweet.uris.each { |uri| list << uri.expanded_uri.host.downcase } if tweet.uris?\n\n # Remove subdomains (e.g.: www.example.org => example.org)\n regex = '[[:word:]]{1,}\\.[[:word:]]{1,}\\z'\n tweet.uris.each do |uri|\n m = /#{regex}/.match(uri.expanded_uri.host.downcase)\n list << m[0]\n end\n\n list\n end",
"def get_queued_links()\n\t\thydra.queued_requests.map do |req|\n\t\t\treq.url\n\t\tend\n\tend",
"def all_backlinks\n\t\t@data = UrlData.all\n\n\t\t@backlinks = Array.new\n\t\t@data.each do |details|\n\t\t\t@backlinks.push details.google_backlinks\n\t\t\t@backlinks.push details.moz_backlinks\n\t\tend\n\n\t\t@backlinks = @backlinks.compact.reject { |s| s.blank? }\n\n\t\t@backlinks = @backlinks.inject(:+)\n\t\treturn @backlinks\n\tend",
"def urls\n \n # Go through the 3 urls in the record and retrieve the urls and associated \n # text for the caller\n references = []\n 1.upto(3) do |i|\n \n url = self.send(\"url#{i}\")\n break if url == ''\n \n url_text = self.send(\"url#{i}_name\")\n url_text = 'Reference' if url_text == ''\n references.push({ :text => url_text, :url => url })\n \n end\n \n references\n \n end",
"def internal_links\n return [] if @links.empty?\n\n links = @links\n .select { |link| link.is_relative?(host: @url.to_base) }\n .map(&:without_base)\n .map do |link| # We map @url.to_host into / because it's a duplicate.\n link.to_host == @url.to_host ? Wgit::Url.new('/') : link\n end\n\n Wgit::Utils.process_arr(links)\n end",
"def links\n @doc.css('a[href]').map do |a|\n parse_element_attribute_uri(a, 'href')\n end.compact.uniq\n end",
"def links\n links = []\n result = self.perform\n links = result.ft_links\n end",
"def extract_uris(uri, uri_content)\n # in our case, no new uri can be extracted from a web resource\n return Array.new()\n end",
"def get_url_cities_array(page)\r\n url_cities_array = []\r\n urls = page.xpath('//*[@class=\"lientxt\"]/@href') \r\n urls.each do |url|\r\n url_cities_array << (\"https://www.annuaire-des-mairies.com\" + url.text[1..-1]) # rajout à partir du deuxième caractère pour éviter d'ajouter le point \r\n print \".\" # affichage pour simuler le chargement\r\n end\r\n return url_cities_array\r\nend"
] | [
"0.837424",
"0.8303746",
"0.79931843",
"0.7971105",
"0.7857528",
"0.78189784",
"0.77553326",
"0.7719101",
"0.7710806",
"0.7699058",
"0.7680764",
"0.7582099",
"0.75077194",
"0.7385622",
"0.73797053",
"0.73646885",
"0.73225015",
"0.72969615",
"0.72809684",
"0.72731274",
"0.72400594",
"0.7212952",
"0.71977615",
"0.71597",
"0.7151182",
"0.71276736",
"0.71262145",
"0.7061285",
"0.7057406",
"0.70413476",
"0.70288527",
"0.7017137",
"0.70091325",
"0.7000673",
"0.6999716",
"0.6997514",
"0.69927436",
"0.6974865",
"0.6971512",
"0.69700366",
"0.69329613",
"0.6930492",
"0.69102323",
"0.68790233",
"0.68790233",
"0.686654",
"0.6844287",
"0.68360466",
"0.6831718",
"0.68257016",
"0.6812391",
"0.6812391",
"0.68019825",
"0.6797439",
"0.67782235",
"0.67706597",
"0.6747885",
"0.67468685",
"0.6727959",
"0.67124605",
"0.66982675",
"0.669779",
"0.66945136",
"0.6692594",
"0.66924715",
"0.6688861",
"0.6687925",
"0.6686059",
"0.6686059",
"0.6686059",
"0.6681791",
"0.66759014",
"0.66732126",
"0.6668806",
"0.66672355",
"0.66538143",
"0.66521764",
"0.6644379",
"0.6631289",
"0.6625481",
"0.66252565",
"0.66147596",
"0.6611319",
"0.6608977",
"0.65943086",
"0.65843666",
"0.6572946",
"0.6569266",
"0.6559601",
"0.65557295",
"0.65411496",
"0.65340227",
"0.6533332",
"0.6523107",
"0.651658",
"0.6513912",
"0.65131927",
"0.6509985",
"0.6507765",
"0.6489612",
"0.6463258"
] | 0.0 | -1 |
Return the appropriate route helper method. | def route_helper(ctrlr, action = nil, base: false)
ctr = ctrlr.to_s.underscore
ctr = ctr.split('/').map(&:singularize).join('_') if ctr.include?('/')
ctr = ctr.split('.').map(&:singularize).join('_') if ctr.include?('.')
act = action&.to_sym
act = base_action(act) if act && base
if ctr.end_with?('_url', '_path')
Log.warn("#{__method__}: #{ctrlr}: ignoring action #{act}") if act
ctr
elsif ctr == 'home'
act ? :"#{act}_path" : :main_path
else
case act
when :index, nil then :"#{ctr}_index_path"
when :show then :"#{ctr}_path"
else :"#{act}_#{ctr}_path"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_name; end",
"def route_name; end",
"def custom_routes; end",
"def route\n #TODO\n end",
"def define_resource_named_route_helper_method(method)\n self.class.send :module_eval, <<-end_eval, __FILE__, __LINE__\n def #{method}(*args)\n send \"#{method}_for_\\#{name_prefix}\", *args\n end\n end_eval\n end",
"def named_route; end",
"def route\n @route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}\n end",
"def route_for(name, *args); end",
"def anchored_routes; end",
"def route() request.route end",
"def url_for(options, route_name = T.unsafe(nil), url_strategy = T.unsafe(nil), method_name = T.unsafe(nil), reserved = T.unsafe(nil)); end",
"def action_for route\n raise \"Argument must be an Endpoint\" unless Endpoint === route\n action = @prefix[-1]\n action = PARAM_ROUTES[route[:method]] if self.action_mode == :param\n action = RESOURCE_ROUTES[route[:method]] if self.route_mode == :resource && self.action_mode == :collection\n action\n end",
"def _routes; end",
"def routes_method\n @routes_method ||= Proc.new do\n base_application.routes.routes.map do |route|\n next unless route.defaults.has_key?(:controller) &&\n controller_const = \"#{route.defaults[:controller]}_controller\"\n .classify\n .constantize rescue nil\n\n http_methods = (\n route.verb.is_a?(Regexp) ?\n route.verb.inspect.gsub(/[\\/\\$\\^]/, '') :\n route.verb\n ).split(\"|\")\n\n {\n alias: route.name,\n path: route.path.spec.to_s,\n controller_name: route.defaults[:controller],\n controller: controller_const,\n action: route.defaults[:action],\n http_methods: http_methods\n }\n end.compact\n end\n end",
"def define_path_helpers; end",
"def path_helper\n Rails.application.routes.url_helpers\n end",
"def path_helper\n Rails.application.routes.url_helpers\n end",
"def method_missing(method, *params, &block)\n route_macro = self.class.macros[method]\n if route_macro.nil?\n super\n else\n pattern = params.shift || route_macro[:pattern]\n options = route_macro[:options].merge(params.shift || {})\n if !params.empty?\n raise ArgumentError,\n \"wrong number of arguments (#{params.size + 2} for 2)\"\n end\n route(pattern, options)\n end\n end",
"def resource_named_route_helper_method?(resource_method, raise_error = false)\n if resource_method.to_s =~ /_(path|url)$/ && resource_method.to_s =~ /(^|^.*_)enclosing_resource(s)?_/\n _, route_method = *route_and_method_from_enclosing_resource_method_and_name_prefix(resource_method, name_prefix)\n elsif resource_method.to_s =~ /_(path|url)$/ && resource_method.to_s =~ /(^|^.*_)resource(s)?_/\n _, route_method = *route_and_method_from_resource_method_and_name_prefix(resource_method, name_prefix)\n else\n return false\n end\n respond_to_without_named_route_helper?(route_method) || (raise_error && raise_resource_url_mapping_error(resource_method, route_method))\n end",
"def get_route( request )\n return nil unless defined?( RAILS_ENV ) \n ::ActionController::Routing::Routes.recognize_path( request.path, {:method => request.request_method.downcase.to_sym } )\n end",
"def routes\n raise NotImplementedError\n end",
"def routeable(method, opts={})\n ctrlr_m = method.to_sym\n opts[:via] = Array.wrap(opts[:via] || :get).map{|hm|hm.to_sym}\n\n AutoRouter::Router.map_route(self, ctrlr_m, opts)\n end",
"def named_routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def routes; end",
"def route_for routename\n case routename\n when 'Start'\n \"index\"\n when 'Login'\n \"login\"\n when 'Mitarbeiterübersicht'\n \"employees\"\n when 'Neuer Mitarbeiter'\n \"employees.new\"\n when 'FAQ'\n \"faq\"\n else\n raise \"No route defined for route named '#{routename}'.\"\n end\nend",
"def define_routable_methods router_class\n define_method router_class.route_name_method_name do \n router_class.route_name self\n end\n \n define_method router_class.url_method_name do \n router_class.url self\n end\n \n define_method router_class.path_method_name do \n router_class.path self\n end\n end",
"def short_route\n @short_route ||= begin\n sr = \"#{objet}\" # sinon, passage par référence avec '<<' ci-dessous\n method && sr << \"/#{method}\"\n sr\n end\n end",
"def route(index_or_name)\n case index_or_name\n when Integer\n Rails.application.routes.routes[index_or_name]\n when Symbol # named route\n Rails.application.routes.named_routes.get index_or_name\n end\nend",
"def url_helpers\n Rails.application.routes.url_helpers\n end",
"def route14\n end",
"def helper(_method)\n ActionController::Base.helpers.method(_method)\n end",
"def route\n @route\n end",
"def route\n @base_controller.route if @base_controller\n end",
"def url_helpers\n Rails.application.routes.url_helpers\n end",
"def get_routes\n raise \"Method not implemented\"\n end",
"def href\n begin\n # The link's name should be the method name\n # for a rails route helper. We're including the route\n # helpers in an initializer, so this will only fail if\n # the route is undefined.\n #\n send(name)\n rescue NoMethodError => e\n raise ::Mariner::Errors::InvalidUrlHelperMethod.new(name)\n end\n end",
"def route_prefix_to_method_name(method)\n \"#{route_prefix + \"_\" if route_prefix}#{method}\"\n end",
"def get_requested_route(env)\n request = Rack::Request.new(env)\n \n http_method = request.request_method.downcase\n path = request.path_info\n\n [http_method, path]\n end",
"def route_to(klass_or_name, action)\n RouteToMatcher.new(klass_or_name, action)\n end",
"def routes\n routes_method.call\n end",
"def route_request\n env.logger.debug \"#{self.class} ROUTING - #{env[Goliath::Request::PATH_INFO]}\"\n if has_path = ( env[Goliath::Request::PATH_INFO] =~ /^\\/(\\w+)(\\/\\w+)*/ )\n env.logger.debug \"#{self.class} route_request:\\t pathinfo = #{$1} extended = #{$2}\"\n path_info = $1\n extended_path_info = $2\n has_path = true #it will be a number or nil - let's just make it a bool\n elsif params[:id]\n has_path = true\n end\n \n method = env[Goliath::Request::REQUEST_METHOD]\n action = case method\n when 'GET'\n has_path ? 'show' : 'index'\n when 'POST'\n has_path ? ( raise BadRequestError, \"can't post to this resource\" ) : 'create'\n when 'PUT'\n !has_path ? ( raise BadRequestError, \"no resource to PUT to\" ) : 'update'\n when 'DELETE'\n !has_path ? ( raise BadRequestError, \"no resource to DELETE\" ) : 'delete'\n else\n raise MethodNotAllowedError, \"unknown request method\"\n end\n env.logger.info \"#{self.class} route_request:\\t attempting to call #{action} action\"\n if self.respond_to?(action, true) #second param includes private methods\n env['params']['id'] = params[:id] || (path_info if has_path)\n self.send(action)\n else\n error_on MethodNotAllowedError, \"#{action} not supported for this resource\"\n end\n end",
"def route_and_method_from_enclosing_resource_method_and_name_prefix(method, name_prefix)\n if enclosing_resource\n enclosing_route = name_prefix.sub(/_$/,'')\n route_method = method.to_s.sub(/enclosing_resource(s)?/) { $1 ? enclosing_route.pluralize : enclosing_route }\n return [ActionController::Routing::Routes.named_routes.get(route_method.sub(/_(path|url)$/,'').to_sym), route_method]\n else\n raise NoMethodError, \"Tried to map :#{method} but there is no enclosing_resource for this controller\"\n end\n end",
"def has_named_route?(name); end",
"def full_route\n @parent ? (ancestors.reverse + [self]).map(&:route).join('/').squeeze('/') : route\n end",
"def requested_method\n\t\t\t\t# respond to websocket special case\n\t\t\t\treturn :pre_connect if request.upgrade?\n\t\t\t\t# respond to save 'new' special case\n\t\t\t\treturn (self.class.has_method?(:save) ? :save : false) if (request.request_method =~ /POST|PUT|PATCH/i.freeze) && (params[:id].nil? || params[:id] == 'new'.freeze)\n\t\t\t\t# set DELETE method if simulated\n\t\t\t\trequest.request_method = 'DELETE'.freeze if params[:_method] && params[:_method].to_s.downcase == 'delete'.freeze\n\t\t\t\t# respond to special :id routing\n\t\t\t\tparams[:id].to_s.downcase.to_sym.tap { |met| return met if self.class.has_exposed_method?(met) } if params[:id]\n\t\t\t\t#review general cases\n\t\t\t\tcase request.request_method\n\t\t\t\twhen 'GET'.freeze, 'HEAD'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:index) ? :index : false) unless params[:id]\n\t\t\t\t\treturn (self.class.has_method?(:show) ? :show : false)\n\t\t\t\twhen 'POST'.freeze, 'PUT'.freeze, 'PATCH'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:update) ? :update : false)\n\t\t\t\twhen 'DELETE'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:delete) ? :delete : false)\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend",
"def path_method\n View.configuration.path_methods.find { |method| value.respond_to?(method) }\n end",
"def route_for!(options = {})\n route_for(options).tap do |route|\n fail_unless_route_is_ok route\n end\n end",
"def routes\n [@name.downcase]\n end",
"def external_routes; end",
"def route\n \"#{@http_verb.to_s.upcase} #{@url}\"\n end",
"def parse_route(dn, method)\n route, action = @routes.match(\"#{dn},op=#{method.to_s}\")\n if not route or route.empty?\n @logger.warn \"No route defined for \\'#{route}\\'\"\n raise LDAP::ResultError::UnwillingToPerform\n end\n if action.nil?\n @logger.error \"No action defined for route \\'#{route}\\'\"\n raise LDAP::ResultError::UnwillingToPerform\n end\n\n class_name = action.split('#').first\n method_name = action.split('#').last\n\n params = LDAP::Server::DN.new(\"#{dn},op=#{method.to_s}\").parse(route)\n\n return class_name, method_name, params\n end",
"def route_and_method_from_resource_method_and_name_prefix(method, name_prefix)\n route_method = method.to_s.sub(/resource(s)?/) { $1 ? \"#{name_prefix}#{route_name.pluralize}\" : \"#{name_prefix}#{route_name}\" }\n return [ActionController::Routing::Routes.named_routes.get(route_method.sub(/_(path|url)$/,'').to_sym), route_method]\n end",
"def url_for options = {}\n return \"/#{options[:controller].downcase}/#{options[:action]}/#{options[:id]}\" if options[:id].present?\n \"/#{options[:controller.downcase]}/#{options[:action]}\"\nend",
"def route_name\n @route_name || default_route_name\n end",
"def url_helpers_module; end",
"def route_index; end",
"def url_helpers(supports_path = true)\n UrlHelpers\n end",
"def url_for(controller, method_sym, params = {})\n Plezi::Base::Router.url_for controller, method_sym, params\n end",
"def route_for_path(path, method=nil)\n env = Rack::MockRequest.env_for(path || \"\", {:method => method})\n req = ActionDispatch::Request.new(env)\n route, matches, params = Rails.application.routes.set.recognize(req)\n return route\n end",
"def path_helpers_module; end",
"def route_path(route_name)\n \"#{prefix}/#{public_send(:\"#{route_name}_route\")}\"\n end",
"def get_route(path, options = nil)\n conditions = options && options.delete(:conditions) || nil\n requirements = options && options.delete(:requirements) || nil\n default_values = options && options.delete(:default_values) || nil\n generate_with = options && options.delete(:generate_with) || nil\n priority = options && options.delete(:priority) || nil\n if options\n options.delete_if do |k, v|\n if v.is_a?(Regexp) || v.is_a?(Proc)\n (requirements ||= {})[k] = v\n true\n end\n end\n end\n\n if conditions && !conditions.empty?\n conditions.keys.all?{|k| request_methods.include?(k)} or raise(\"You are trying to use request methods that don't exist in the request_methods supplied #{conditions.keys.join(', ')} -> #{(conditions.keys - request_methods).join(\", \")}\")\n end\n\n if priority\n enable_priority_lookups!\n end\n\n route = parser.generate_route(path, conditions, requirements, default_values, generate_with, priority)\n raise(MultipleParameterException.new) if !allow_identical_variable_names? and route.paths.first.dynamic? and route.paths.first.dynamic_keys.uniq.size != route.paths.first.dynamic_keys.size\n route.to(options) if options && !options.empty?\n route\n end",
"def route_name_for_padrino(request)\n request.route_obj.original_path\n rescue\n nil\n end",
"def controller_method(path)\n split_path = path.split('/')\n\n split_path[split_path.length - 2] if controller_spec?(path)\n end",
"def url_for(options, route_name = nil, url_strategy = UNKNOWN, method_name = nil, reserved = RESERVED_OPTIONS)\n options = default_url_options.merge options\n\n user = password = nil\n\n if options[:user] && options[:password]\n user = options.delete :user\n password = options.delete :password\n end\n\n recall = options.delete(:_recall) { {} }\n\n original_script_name = options.delete(:original_script_name)\n script_name = find_script_name options\n\n if original_script_name\n script_name = original_script_name + script_name\n end\n\n path_options = options.dup\n reserved.each { |ro| path_options.delete ro }\n\n route_with_params = generate(route_name, path_options, recall)\n path = route_with_params.path(method_name)\n\n if options[:trailing_slash] && !options[:format] && !path.end_with?(\"/\")\n path += \"/\"\n end\n\n params = route_with_params.params\n\n if options.key? :params\n if options[:params]&.respond_to?(:to_hash)\n params.merge! options[:params]\n else\n params[:params] = options[:params]\n end\n end\n\n options[:path] = path\n options[:script_name] = script_name\n options[:params] = params\n options[:user] = user\n options[:password] = password\n\n url_strategy.call options\n end",
"def route *args\n mounted? || raise(\"`route' works only on mounted controllers. Please consider to use `base_url' instead.\")\n return base_url if args.size == 0\n (route = self[args.first]) && args.shift\n build_path(route || base_url, *args)\n end",
"def route part = \"/\", params = {}\n File.join('/', part)+\"#depricated\"\n end",
"def route_for(options)\n ensure_that_routes_are_loaded\n ActionController::Routing::Routes.generate(options)\n end",
"def route(path = request.path_info)\n path = path.gsub(%r{//+}, '/').gsub(%r{^/|/$}, '')\n return route_index if path.empty? || path == docs_prefix\n case path\n when %r{^(#{docs_prefix}|#{list_prefix}|#{search_prefix}|#{static_prefix})(/.*|$)}\n prefix = $1\n paths = $2.gsub(%r{^/|/$}, '').split('/')\n library, paths = *parse_library_from_path(paths)\n return unless library\n return case prefix\n when docs_prefix; route_docs(library, paths)\n when list_prefix; route_list(library, paths)\n when search_prefix; route_search(library, paths)\n when static_prefix; route_static(library, paths)\n end\n end\n nil\n end",
"def route(name=nil, namespace=nil, &block)\n if name\n routes = opts[:namespaced_routes][namespace] ||= {}\n routes[name] = define_roda_method(routes[name] || \"multi_route_#{namespace}_#{name}\", 1, &convert_route_block(block))\n self::RodaRequest.clear_named_route_regexp!(namespace)\n else\n super(&block)\n end\n end",
"def collection_path\n send route_prefix_to_method_name(\"#{class_name.model_name.route_key}_path\")\n end",
"def method_missing(method_id, params = {})\n request(method_id.id2name.gsub(/_/, '.'), params)\n end",
"def routing_mismatch\n raise ::ActionController::RoutingError,\"URL not supported\"\n end",
"def came_from_route\n @came_from_route\n end",
"def get_api_method\n return if params[:action] == 'index' && params[:controller] == 'api/docs'\n begin\n # load the parent module (e.g. EOL::Api::Search) to get the default version\n method_class = \"EOL::Api::#{params[:action].camelize}\".constantize\n rescue => e\n render_error(\"Invalid method: #{params[:action]}\")\n return nil\n end\n\n begin\n # load the proper version of the API method (e.g. EOL::Api::Search::V1_0)\n params[:version] ||= method_class::DEFAULT_VERSION\n @api_method = \"#{method_class}::V#{params[:version].tr('.', '_')}\".constantize\n rescue => e\n render_error(\"Invalid version: #{params[:version]}\")\n return nil\n end\n return @api_method\n end",
"def route(path = T.unsafe(nil)); end",
"def add_swagger_route http_method, path, opts = {}\n full_path = path.gsub(/{(.*?)}/, ':\\1')\n match full_path, to: \"#{opts.fetch(:controller_name)}##{opts[:action_name]}\", via: http_method\n end",
"def get_route_target server_type, msg, route_param, &block\n if @router_type\n router = case @router_type\n when :roundrobin\n method :rr_route\n when :weight_roundrobin\n method :wrr_route\n when :least_active\n method :la_route\n when :consistent_hash\n method :ch_route\n else\n method :rd_route\n end\n router.call(self, server_type, msg) { |err, server_id|\n block_given? and yield err, server_id\n }\n else\n unless @router.respond_to? :call\n block_given? and yield Exception.new 'invalid router method'\n return\n end\n @router.call(route_param, msg, @route_context) { |err, server_id|\n block_given? and yield err, server_id\n }\n end\n end",
"def route_mode\n mode = :resource\n mode = :namespace if @endpoints.count == 0\n mode = :action if @subroutes.count == 0 && @parent && @parent.route_mode == :resource\n mode = :param if /^:/ === @prefix.last\n mode\n end",
"def get_method\n request_object.method\n end",
"def route *args\n locked? || raise(\"`route' works only on mounted apps. Please consider to use `base_url' instead.\")\n return base_url if args.size == 0\n (route = self[args.first]) && args.shift\n build_path(route || base_url, *args)\n end",
"def define_url_helper(mod, name, helper, url_strategy); end",
"def route? method\n if @tracker.routes[:allow_all_actions] or @tracker.options[:assume_all_routes]\n true\n else\n routes = @tracker.routes[@current_class]\n routes and (routes.include? :allow_all_actions or routes.include? method)\n end\n end",
"def method_missing(method, *args)\r\n return super unless defined?(Rails) && Rails.application.routes.url_helpers.respond_to?(method)\r\n # Check to see if one of the args is an open struct. If it is, we'll assume it's the\r\n # test stub and try to call a path or url attribute.\r\n if args.any? {|arg| arg.kind_of?(MandrillMailer::Mock)}\r\n # take the first OpenStruct found in args and look for .url or.path\r\n args.each do |arg|\r\n if arg.kind_of?(MandrillMailer::Mock)\r\n break arg.url || arg.path\r\n end\r\n end\r\n else\r\n options = args.extract_options!.merge({host: MandrillMailer.config.default_url_options[:host], protocol: MandrillMailer.config.default_url_options[:protocol]})\r\n args << options\r\n Rails.application.routes.url_helpers.method(method).call(*args)\r\n end\r\n end",
"def body_route\n \"#{controller_name}_#{action_name}\"\n end",
"def route_for(**url_details)\n @routes.select { |rt| url_details <= rt.url_details }.first\n end",
"def method\n link_schema['method'].downcase.to_sym\n end",
"def _roda_main_route(_)\n end",
"def create_route(method, params)\n fail \"No route defined for #{method} on #{name}\" unless routes[method]\n\n url_params = params.dup\n rest_path = routes[method].gsub(/:(\\w+)/) do |m|\n fail SurveyGizmo::URLError, \"Missing RESTful parameters in request: `#{m}`\" unless url_params[$1.to_sym]\n url_params.delete($1.to_sym)\n end\n\n SurveyGizmo.configuration.api_version + rest_path + filters_to_query_string(url_params)\n end",
"def routes(&block); end"
] | [
"0.6828002",
"0.6828002",
"0.6789869",
"0.66599756",
"0.6634689",
"0.6624757",
"0.6534332",
"0.6511451",
"0.65020466",
"0.65001595",
"0.6464726",
"0.64443564",
"0.6430015",
"0.63938534",
"0.63820976",
"0.63737893",
"0.63737893",
"0.6366693",
"0.6341816",
"0.6294904",
"0.6245766",
"0.6226905",
"0.62189823",
"0.6211165",
"0.6211165",
"0.6211165",
"0.6211165",
"0.6211165",
"0.6211165",
"0.6211165",
"0.6211165",
"0.6211165",
"0.6211165",
"0.6211165",
"0.61921924",
"0.61734414",
"0.6171625",
"0.61532587",
"0.61404014",
"0.61249393",
"0.61241543",
"0.61091006",
"0.61005116",
"0.6097704",
"0.60960823",
"0.60794115",
"0.6070927",
"0.5926794",
"0.59216005",
"0.59153336",
"0.591321",
"0.5909998",
"0.59050554",
"0.5902977",
"0.589593",
"0.58701974",
"0.5865839",
"0.5863915",
"0.58597535",
"0.58543307",
"0.58308935",
"0.58092177",
"0.5806872",
"0.57998717",
"0.5794328",
"0.5792563",
"0.57869226",
"0.5781833",
"0.5732389",
"0.5726733",
"0.5720176",
"0.5715202",
"0.5701289",
"0.5699019",
"0.56803274",
"0.5653133",
"0.56428504",
"0.5640063",
"0.5628189",
"0.56173545",
"0.5596577",
"0.5596324",
"0.5588417",
"0.55870456",
"0.5578092",
"0.5575692",
"0.55685973",
"0.556801",
"0.555704",
"0.555238",
"0.5548317",
"0.55367696",
"0.55320394",
"0.55302924",
"0.55016375",
"0.54980016",
"0.5483328",
"0.5480151",
"0.5476524",
"0.5473937"
] | 0.66056275 | 6 |
after_action :verify_authorized GET /mxa_date_history/.json | def date_history
# byebug
@date_history = MxAssessment.select(:meeting_date).distinct.joins(:patient)
.where(patients: {facility: session[:facility]})
.where(patients: {site: mx_assessment_params[:site]})
.order(meeting_date: :desc)
# byebug
# Need to convert the ActiveRecord Relation to an array
# Oracle doesn't present meeting_date as a formatted string
# Need to format meeting_date (can't do that in the @meeting_date relation)
# Can do it in an array
@date_history.to_a.map! {|meeting| meeting.meeting_date.strftime('%F')}
# @date_history.to_a.map! do |meeting|
# unless meeting.meeting_date.blank?
# meeting.meeting_date.strftime('%F')
# # meeting.meeting_date.strftime('%m/%d/%Y')
# end
# end
respond_to do |format|
format.json {render json: @date_history}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history\n command = AccountHistory.call(@current_user)\n if command.success?\n @history = command.result\n render 'history.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end",
"def fetch_history\n service_response = Economy::Transaction::FetchHistory.new(params).perform\n render_api_response(service_response)\n end",
"def history_added; end",
"def account_history\n get('account/history')\n end",
"def api_audit\n # authorize! :api_audit, Vehicle.new\n vehicle = Vehicle.find_by_id(params[:id])\n # filter params\n days = params[:days] || \"21\"\n type = params[:type] || \"\"\n # aquacadets\n gon.notes = []\n if vehicle.present?\n gon.notes = vehicle.api_audit_notes\n .note_of_sub_type(type)\n .past_x_days(days)\n .reverse\n gon.parameters = { \"days\" => days, \"type\" => type }\n # Only needed on first load\n if request.format.html?\n gon.path = \"/vehicles/#{vehicle.id}/api-audit\"\n gon.recordName = vehicle.make_model_description\n gon.uid = vehicle.lot_num\n end\n end\n\n respond_to do |format|\n format.html { render \"shared/api_audit.html.erb\" }\n format.json { render json: { notes: gon.notes.as_json, parameters: gon.parameters } }\n end\n end",
"def history\n rest.get stats_path(:history) do |response|\n response_handler response\n end\n end",
"def dashboard\n __log_activity\n __debug_route\n opt = url_parameters\n fast = opt.key?(:fast) ? true?(opt[:fast]) : Rails.env.test?\n @item, @preferences, @history = get_account_details(fast: fast)\n response.status =\n case flash.now[:alert]\n when '', nil then 200 # OK\n when /already signed in/ then 403 # Forbidden\n else 401 # Unauthorized\n end\n respond_to do |format|\n format.html\n format.json { render_json show_values }\n format.xml { render_xml show_values(nil, as: :array) }\n end\n end",
"def show\n render json: @history\n end",
"def index\n render json: filter(@current_user), status: :ok if @current_user\n render json: { message: 'expired' }, status: :not_found if !@current_user\n end",
"def usd_base_json\n if @last_check.nil? || Time.now.to_i - @last_check.to_i > 30 * 60\n oxr_latest_uri = URI.parse(\"https://openexchangerates.org/api/latest.json?app_id=#{OXR_APP_ID}\")\n oxr_response = Net::HTTP.get_response(oxr_latest_uri)\n @json_storage = JSON.parse(oxr_response.body)\n @last_check = Time.now\n end\n @json_storage\nend",
"def history\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def dashboard\n @event = Event.find(params[:id]) || not_found\n @event_activity_logs = @event.event_activity_logs.paginate(:page => params[:page]).order('created_at desc')\n @lookup_event_sequences = LookupEventSequence.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def core_indicator_events\n start = Time.now\n\n # action is in app controller\n\t\tjson = get_core_indicator_events\n\n respond_to do |format|\n format.json { render json: json}\n end\n\t\tlogger.debug \"@ time to render core indicator events json: #{Time.now-start} seconds\"\n end",
"def redirection_history; end",
"def attendance_result\n history_id = params[\"history_id\"]\n Net::HTTP.get(URI.parse(\"#{ENV['PY_SERVER_URL']}/image_matching/history/#{history_id}\"))\n history_student = HistoryStudent.where(history_id: history_id)\n render json: history_student\n end",
"def history \n @anchoring = Anchoring.find(params[:id])\n\n respond_to do |format|\n format.html # history.html.erb\n format.json { render json: @anchoring }\n end\n end",
"def get_history(page_token = nil); end",
"def after_token_authentication\n end",
"def after_token_authentication\n end",
"def index\n @events = User.find_by(auth_token:request.headers['AuthorizationToken'].to_s).events.upcoming.order(:start)\n\n render json: @events \n end",
"def historical_url\n URI.join(OER_HISTORICAL_URL, \"#{date}.json\")\n end",
"def tracking_history\n buyer = user_valid_for_viewing?('Buyer')\n if !buyer.nil?\n events = Events::Track.where(buyer_id: buyer.id).order(\"created_at desc\")\n results = events.map do |event|\n {\n udprn: event.udprn,\n hash_str: event.hash_str,\n type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],\n created_at: event.created_at,\n tracking_id: event.id\n }\n end\n render json: results, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def show\n @event = EventDecorator.decorate(Event.find params[:id])\n @event_charges = EventChargeDecorator.decorate(@event.charges)\n @event_audits = {\n new: @event.owned_audits.where([\"created_at >= ?\", current_user.last_sign_in_at]),\n old: @event.owned_audits.where([\"created_at < ?\", current_user.last_sign_in_at])\n } if @event.owned_audits.present?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index \n# authorize_staff unless api_request?\n \n conditions = api_request? ? {locale: params[:language] || I18n.locale} : {original_id: nil}\n if api_request? && params.has_key?(:language) && params[:language] == \"all\"\n @fundamental_announcements = Fundamental::Announcement.order(\"created_at DESC\")\n else \n @fundamental_announcements = Fundamental::Announcement.where(conditions).order(\"created_at DESC\")\n end\n\n last_modified = nil\n @fundamental_announcements.each do |announcement|\n last_modified = announcement.updated_at if last_modified.nil? || last_modified < announcement.updated_at\n end\n \n render_not_modified_or(last_modified) do\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_announcements, methods: [ :author_name ]}\n end\n end\n end",
"def index\n @daily_logs = current_user.daily_logs.order(\"updated_at DESC\")\n render json: @daily_logs, each_serializer: Rest::DailyLogSerializer\n end",
"def payment_history\n check_history_permissions\n @back_button_url = determinate_back_link_url\n rescue BaseApi::Error400Exception\n return redirect_to payment_history_path unless page_number == 1\n end",
"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 fetch_detail\n service_response = Economy::Transaction::FetchHistory.new(params).perform\n render_api_response(service_response)\n end",
"def report\n @service = Service.find(params[:id])\n \n if !checkService(@service)\n redirect_to services_path, alert: \"You do not have the privileges required to view this service.\"\n else\n @date = Hash.new\n @date[\"start\"] = DateTime.now - 5.months\n @date[\"end\"] = DateTime.now\n @date[\"step\"] = \"Months\"\n \n respond_to do |format|\n format.html # report.html.erb\n format.json { render json: @service }\n end\n end\n end",
"def show\n render json: @service_history\n end",
"def index\n if params[:date]\n @year = params[:date][:year]\n @month = params[:date][:month]\n @time = Time.new(@year,@month)\n @date = @time.to_date\n if @date.year == 2030\n @future = true\n end\n else\n @date = Date.today - 1.month\n @time = @date.to_time\n end\n @clients = Client.order( \"name asc\").all\n @links = @clients.map { |client| client.create_link(@time) }\n #@links = client.create_link(Time.new(2012,07))\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n params.delete(:date)\n end",
"def after_remembered; end",
"def after_custom_authentication; end",
"def index\n @history_data = HistoryDatum.all\n end",
"def history(params = {})\n params.select! { |key, _value| @api.history_config[:allowed_params].include? key }\n\n response = self.class.get(@api.history_config[:url],\n :query => { :auth_token => @token }.merge(params),\n :headers => @api.headers\n )\n\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n response.body\n end",
"def index\n # HACK - deleting older logs\n\n #Added in cronjob\n # NotificationLog.delete_old_logs\n\n if current_user.is? :super_admin\n @notification_logs = NotificationLog.order(\"date DESC\")\n else\n @notification_logs = current_user.notification_logs.where(\"date > ? AND disabled = ?\", (Time.zone.now - 1.month.from_now), false).order(\"date DESC\").all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notification_logs }\n end\n end",
"def history\r\n\r\n end",
"def index\n redirect_to :action => :on_now\n end",
"def index\n #Does nothing really... (Except create log)\n\n render json: \"success\"\n end",
"def post_to_historical(data_hash, title_number)\n\n response = rest_post_call($HISTORIAN_URL + '/' + title_number, data_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed to create the historical data: \" + response.body\n end\n\n return response.body\nend",
"def show\n# authorize_staff unless api_request?\n\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n \n last_modified = @fundamental_announcement.updated_at\n\n render_not_modified_or(last_modified) do\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamental_announcement, methods: [ :author_name ] }\n end\n end\n end",
"def check_history_permissions\n if allow_view_payment_history?\n assign_paginated_history\n elsif allow_make_payments?\n assign_paginated_history(user_payments: true)\n else\n Rails.logger.warn('Access Denied. Redirects to :not_found page')\n redirect_to not_found_path\n end\n end",
"def index\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects'))\n @activities = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}\n end\n end",
"def log_history\n logger.info('[]' + request.method + \"\\t\" + request.fullpath + \"\\t\" + request.remote_ip + \"\\t\" + Time.now.strftime('%Y-%m-%d %H:%M:%S'))\n end",
"def getjson\n sha = params[:data]\n history = History.find_or_initialize_by({:sha => sha})\n if !history.new_record?\n render :json => history.json.to_json\n else\n raise ActionController::RoutingError.new('Not Found')\n end\n end",
"def history; end",
"def history; end",
"def history; end",
"def show\n authorize @daily_timesheet\n set_return_to\n @return_to = get_return_to_or_default daily_timesheets_url\n end",
"def new\n authorize! :create, ClothingLog\n @clothing_log = current_account.clothing_logs.new\n @clothing_log.date = Time.now\n respond_with @clothing_log\n end",
"def history_data\n @id = params[:id]\n @item_history = []\n @item_name = @item_names[@id.to_i]\n json_str = Net::HTTP.get(URI.parse(\"http://#{THINGSPEAK_SERVER}/channels/#{OT_CHANNEL}/feed.json?results=200\")) \n parsed_hash = ActiveSupport::JSON.decode(json_str)\n parsed_hash[\"feeds\"].each do |e|\n if e[\"field1\"] == @id\n item = {}\n t = Time.strptime(e[\"created_at\"], \"%FT%T%z\")\n item[\"time\"] = t.strftime(\"%b %d, %Y %H:%M:%S\")\n item[\"curr_loc\"] = e[\"field4\"]\n @item_history.push(item)\n end\n end\n\n render :template => \"static/history_data\", :formats => [:json], :handlers => \"haml\", :layout => false\n end",
"def after_request\n end",
"def wallet_history\n get 'walletHistory'\n end",
"def audit\n render :json=>@generic_file.audit\n end",
"def history\n # How do I make a specific person's history page load?\n current_user# Calls the current_user method in application_controller\n # which returns @current_user\n end",
"def after_hash_token_authentication\n end",
"def index\n authorize! :index, Schedule, :message => \"Sorry - You do not have permission to view this - If you need access - #{view_context.link_to('Let us know', root_path)}\".html_safe\n\n @schedules = Schedule.last(3).reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schedules }\n end\n end",
"def history\n respond_to do |format|\n format.js {\n @protocol_id = params[:protocol_id]\n }\n format.json {\n @oncore_records = OncoreRecord.where(protocol_id: params[:protocol_id])\n }\n end\n end",
"def index\n if params[:date]\n @date = params[:date]\n #crear cookie para guardar el valor de fecha cuando cambia de pagina\n cookies[:date] = { :value => @date, :expires => 1.hour.from_now }\n elsif cookies[:date] != nil\n @date = cookies[:date]\n else\n @date = Date.today.strftime(\"%d/%m/%Y\")\n end\n date2 = @date.split('/')\n @format_date = date2[2]+'-'+date2[1]+'-'+date2[0]\n @order_lists = OrderList.where(:fecha => @format_date)\n\n @regimes = Regime.get_names_hash\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def request_from_catalog\n @details_name = @params[\"details_name\"]\n @has_data = Settings.has_user_data\n @data = Settings.getSavedData\n \n #reset date. otherwise it's being shown all the time, once it's been set \n $choosed['1'] = nil\n \n render :action => :request_from_catalog\n end",
"def history\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n \n @audits=Kaminari.paginate_array(@purchase_requisition.audits.sort_by{|e| -e.id}).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchase_requisitions }\n end \n\n end",
"def index\n @news_logs = NewsLog.order(:created_at => \"DESC\").page params[:page]\n authorize @news_logs\n end",
"def history_added=(_arg0); end",
"def home\n Rails.logger.info \"in: #{params[:controller]} : #{params[:action]} for user: \" + current_duser.id.to_s\n #displayed_series is used to show an editable table of the data in the chart. \n #@displayed_series = DuserMetric.for_duser(current_duser.id).where(\"occur_dttm > ?\", @chart_mgr.the_date ).order(occur_dttm: :asc)\n @displayed_series = DuserMetric.for_duser(current_duser.id).order(occur_dttm: :asc)\n # respond_with (@displayed_series)\n # render :home if stale?(@displayed_series)\n respond_to do |format|\n format.html {render :home , locals:{displayed_series: @displayed_series}}\n end\n\n end",
"def get_all_history(title_number)\n\n response = rest_get_call($HISTORIAN_URL + '/' + title_number +'?versions=list')\n\n if (response.code != '200') then\n raise \"Failed to retrieve list of historical data: \" + response.body\n end\n\n return JSON.parse(response.body)\nend",
"def after_remembered\n end",
"def dashboard\n if signed_in?\n \t @provider = current_provider\n else\n redirect_to root_url\n end\n \n @pending_appointments = @provider.appointments.where(\"accepted = 0\").where(['time_start >= ?', DateTime.now]).order(\"time_start asc\")\n @confirmed_appointments = @provider.appointments.where(\"accepted = 1\").where(['time_start >= ?', DateTime.now]).order(\"time_start asc\")\n @past_appointments = @provider.appointments.where(['time_start < ?', DateTime.now]).order(\"time_start desc\")\n @denied_appointments = @provider.appointments.where(\"accepted = 2\").where(['time_start >= ?', DateTime.now]).order(\"time_start desc\")\n \n require 'date'\n end",
"def logbook_hours_by_month\n # Calls the charts controller to get the results and load the chart\n # asynchronously\n line_chart logbook_hours_by_month_charts_path(:id => params[:id]), library: {\n title: {text: 'Hours by Month', x: -20},\n tooltip: {\n enabled: false,\n },\n yAxis: {\n title: {\n text: 'Hours flown'\n }\n }\n }\n end",
"def index\n @sales_tax_exemption_customer_histories = SalesTaxExemptionCustomerHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_tax_exemption_customer_histories }\n end\n end",
"def after_request\n end",
"def show\n # base url of the remote data\n # append the 'id' to this to generate the remote url\n baseUrl = 'https://api.gojimo.net/api/v4/'\n\n # request the meta data from the remote server and\n # extract the time its data was last updated\n meta = open(\"#{baseUrl}#{params[:id]}\").meta\n update_at = meta[\"last-modified\"].to_date\n\n # request new data when the local data timestamp pre dates the remote data\n requires_refresh = params[:update_at].blank? || update_at > params[:update_at].to_date\n\n # request the remote data if it is newer than the local copy\n data = open(\"#{baseUrl}#{params[:id]}\").read if requires_refresh\n # parse any data since we are going to add the data to an object which is then converted to json\n data = JSON.parse(data) unless data.blank?\n\n # return any data together with timestamps and a flag to show whetjer new data was retrieved\n render json: {new_data: requires_refresh, data: data, update_at: update_at.strftime('%a %d %b %Y'), check_at: Time.now.strftime('%H:%M %a %d %b %Y')}\n\n end",
"def index\n @kondate_histories = KondateHistory.all\n end",
"def index\n @settlement_histories = Settlement::History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settlement_histories }\n end\n end",
"def create\n @admin_history = Admin::History.new(admin_history_params)\n\n respond_to do |format|\n if @admin_history.save\n format.html { redirect_to admin_histories_path, notice: '新增歷史成功' }\n format.json { render :show, status: :created, location: @admin_history }\n else\n format.html { render :new }\n format.json { render json: @admin_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def full_history_1\n # --- \"Full History by date\" tab: ---\n @tab_title = I18n.t('radiography.full_history_by_date')\n\n # Retrieve swimmer results and gets DAO structure to show them\n # Could limit date range with optional parameters\n sc = SwimmerCareer.new( @swimmer )\n sc.retrieve_data\n @swimmer_career = sc.set_swimmer_career_dao\n @max_updated_at = @swimmer_career.updated_at\n end",
"def enter_botgarden_action_date(data_set)\n action_date = data_set[BOTGARDENCurrentLocationData::ACTION_DATE.name]\n if action_date\n logger.debug \"Entering accession date '#{action_date}'\"\n enter_simple_date(botgarden_acton_date_input_locator, action_date)\n end\n end",
"def index\n @molpay_transaction_histories = MolpayTransactionHistory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @molpay_transaction_histories }\n end\n end",
"def index\n @user = User.find(current_user.id)\n @history_logs = @user.history_logs\n end",
"def index\n @logs = @goal.logs.order('log_date DESC')\n @log = Log.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end",
"def index\n\t\tauthorize! :index, HistorialEstadoPresupuesto\n @historial_estado_presupuestos = HistorialEstadoPresupuesto.all\n end",
"def history\n render_success Offer.where(assignment: @assignment).order(\n created_at: :desc\n )\n end",
"def state_events(state)\n api_return = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?stateCode=' + state + '&apikey=' + $ticket_master_api_key)\n JSON.parse(api_return)\nend",
"def index\n getProfile\n @availabilities = @therapist.get_availabilities\n @rec_Availabilities = @therapist.get_recuring_availabilities(2000,1)\n respond_to do |format|\n format.html { redirect_to availabitity_index, notice: \"Appointment declined.\"}\n format.json { render :status => 200, :json => { action: :index,\n availabilities: @availabilities,\n rec_availabilities: @rec_Availabilities,\n user: @user, therapist: @therapist}}\n end\n end",
"def check_active_period\n render json: @active_period\n end",
"def new\n if current_user.is_not_member?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @location_history = LocationHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_history }\n end\n end",
"def client_redirect_auth\n\t\t# Since the :restrict_access method is called whenever this method is called, that will take care of unauthenticated users (will return a 404 before this method is even run)\n\t\tapi_key = ApiKey.find_by_access_token(params[:access_token])\n\t\tusr = User.find(api_key.user_id)\n\t\trole = usr.role\n\t\ttimeUntilExp = ''\n\n\t\tmsg = \"UNAUTHORIZED\"\n\t\tif params[:authorize]\n\t\t\tif params[:role] == usr.role\n\t\t\t\t# Roles match and user is authorized\n\t\t\t\tmsg = \"AUTHORIZED\"\n\t\t\tend\n\t\telse\n\t\t\t# User is authenticated (logged in) but is not authorized\n\t\t\tmsg = \"AUTHENTICATED\"\n\t\tend\n\n\t\tif api_key\n\t\t\tputs \"WHY DOESNT THIS WORK? #{distance_of_time_in_words(Time.now, api_key.expires_at)}\"\n\t\t\tputs \"SECONDS #{((api_key.expires_at - Time.now).seconds).round}\"\n\t\t\ttimeUntilExp = ((api_key.expires_at - Time.now).seconds).round\n\t\tend\n\t\trespond_to do |format|\n \t\tformat.json { render :json => { :msg => msg, :role => role, :timeUntilExp => timeUntilExp } } \t\t\n \t\tend\n\tend",
"def index\n render json: {time: Time.now}\n end",
"def XXX_deleted_20150502_test_homepage_is_claim_page_for_now\n get '/'\n assert last_response.ok?\n assert_match /claim your prize/, last_response.body\nend",
"def index \n misses = Miss.all.order(created_at: :desc)\n render json: misses \n end",
"def index\n # With sample events\n # events = EventAnalysis::SAMPLE_EVENTS2\n # @analysis_results = EventAnalysis.new(current_user.sources.first, events).analyze\n\n events = current_user.fetch_next_week_events\n @analysis_results = current_user.analyze_events(events)\n \n respond_to do |format|\n format.html{ render layout: params[:type] != \"ajax\" }\n format.json{ render json: EventDatatable.new(view_context, current_user, events) }\n end\n end",
"def set_kondate_history\n @kondate_history = KondateHistory.find(params[:id])\n end",
"def index\n if current_admin.present?\n @clients = Client.all\n @client = Client.new\n\n #Total Visits\n @visits = Visit.all\n @temp = @visits.group_by { |t| t.created_at.beginning_of_month } \n respond_to do |format|\n \t\tformat.html # index.html.erb\n \t\tformat.json { render json: @clients }\n \tend\n else\n redirect_to new_admin_session_path and return\n end \n end",
"def list_expired\n if params[:count] && params[:count].to_i\n render status: 200,\n json: Event.where('end_date < ? AND archived = ?', Time.now, false).order('start_date desc').limit(params[:count].to_i).as_json(include: { event_type: {}, briefing:{ include: { starting_system: {}, ending_system: {}, operational_leader: { methods: [:full_name] }, escort_leader: { methods: [:full_name] }, communications_designee: { methods: [:full_name] }, reporting_designee: { methods: [:full_name] } }}, debriefing: {}, awards: { methods: [:image_url]}, attendences: { include: { character: { methods: [:full_name] }, attendence_type: { } }} }, methods: [:start_date_ms, :end_date_ms, :is_expired])\n else\n render status: 200,\n json: Event.where('end_date < ? AND archived = ?', Time.now, false).order('start_date desc').as_json(include: { event_type: {}, briefing:{ include: { starting_system: {}, ending_system: {}, operational_leader: { methods: [:full_name] }, escort_leader: { methods: [:full_name] }, communications_designee: { methods: [:full_name] }, reporting_designee: { methods: [:full_name] } }}, debriefing: {}, awards: { methods: [:image_url]}, attendences: { include: { character: { methods: [:full_name] }, attendence_type: { } }} }, methods: [:start_date_ms, :end_date_ms, :is_expired])\n end\n end",
"def show\n if current_user.is_not_member?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @location_history = LocationHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_history }\n end\n end",
"def district_events\n start = Time.now\n\n # action is in app controller\n\t\tjson = get_district_events\n\n respond_to do |format|\n format.json { render json: json}\n end\n\t\tlogger.debug \"@ time to render district events json: #{Time.now-start} seconds\"\n end",
"def get_service_history\n with_monitoring do\n edipi_present!\n response = perform(:post, identity_path, VAProfile::Models::ServiceHistory.in_json)\n\n ServiceHistoryResponse.from(@current_user, response)\n end\n rescue Common::Client::Errors::ClientError => e\n if e.status == 404\n log_exception_to_sentry(\n e,\n { edipi: @user.edipi },\n { va_profile: :service_history_not_found },\n :warning\n )\n\n return ServiceHistoryResponse.new(404, episodes: nil)\n elsif e.status >= 400 && e.status < 500\n return ServiceHistoryResponse.new(e.status, episodes: nil)\n end\n\n handle_error(e)\n rescue => e\n handle_error(e)\n end",
"def index\n\tredirect_to new_availability_calendar_path\n end",
"def dashboard; end",
"def index\n @registeredUsers = Admin.getRegisteredUsers\n @loggedInLastWeek = Admin.getLoginActivity 1.week.ago\n @loggedInLastMonth = Admin.getLoginActivity 1.month.ago\n @recentlyRegistered = Admin.getRecentlyRegistered\n end",
"def history(params)\n Client.current.get(\"#{resource_url}/candles\", params)\n end"
] | [
"0.6291958",
"0.6020541",
"0.595228",
"0.59460473",
"0.59315926",
"0.59167576",
"0.5862205",
"0.5737237",
"0.5718228",
"0.5671029",
"0.5650537",
"0.56387687",
"0.56368124",
"0.5621231",
"0.5591315",
"0.55881345",
"0.5580779",
"0.55762136",
"0.55762136",
"0.5571356",
"0.55466664",
"0.5540661",
"0.5526722",
"0.5524075",
"0.55224025",
"0.5518132",
"0.55135494",
"0.5506889",
"0.55030936",
"0.54941463",
"0.5493965",
"0.5493933",
"0.54865575",
"0.5482271",
"0.54748154",
"0.5465146",
"0.54536587",
"0.54454195",
"0.5436995",
"0.5426928",
"0.5424982",
"0.54225796",
"0.5421913",
"0.54216427",
"0.54214555",
"0.5418132",
"0.5418132",
"0.5418132",
"0.541279",
"0.5403856",
"0.54035276",
"0.5398805",
"0.53972346",
"0.53896654",
"0.5377186",
"0.5374878",
"0.5372126",
"0.5368523",
"0.53640753",
"0.53637075",
"0.53626734",
"0.5358542",
"0.53523785",
"0.5349803",
"0.53479135",
"0.53450483",
"0.5343475",
"0.5343132",
"0.53358006",
"0.53326005",
"0.53307796",
"0.53144467",
"0.5314144",
"0.5312479",
"0.53109604",
"0.5309301",
"0.5299939",
"0.52993613",
"0.52968264",
"0.52960795",
"0.52953255",
"0.52952635",
"0.52907753",
"0.5290672",
"0.52773863",
"0.52639556",
"0.52625453",
"0.5259955",
"0.52576905",
"0.52552134",
"0.5250729",
"0.5245958",
"0.52425843",
"0.5237097",
"0.5235618",
"0.52318424",
"0.5224117",
"0.5223384",
"0.5219037",
"0.521755"
] | 0.5615621 | 14 |
GET /mx_assessments GET /mx_assessments.json | def index
@mx_assessments = MxAssessment.all
authorize MxAssessment
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @skill_assessments = SkillAssessment.all\n end",
"def index\n @assessments = Assessment.all\n end",
"def index\n @assessments = Assessment.all\n end",
"def index\n @assessments = @location.assessments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assessments }\n end\n end",
"def index\n @fullassessments = Fullassessment.all\n end",
"def index\n @risk_assessments = RiskAssessment.all\n end",
"def index\n per_page=10\n if current_user.is?\"EA\"\n @assessments = Content.assessment_types.default_order.page(params[:page]).per(per_page)\n else\n #@assessments = current_user.assessments.page(params[:page]).per(per_page)\n\n #commented above line due to new func implementation of publish now and publish later\n #need to get the assessments based on publisher_id of asset table and also assessments through test configurations groups\n all_assessment_ids = (current_user.assessments.map(&:id) + Asset.get_assessments_by_publisher_id(current_user.id).map(&:archive_id)).uniq\n @assessments = Content.where(:id=>all_assessment_ids).default_order.page(params[:page]).per(per_page)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessments }\n end\n end",
"def set_mx_assessment\n @mx_assessment = MxAssessment.find(params[:id])\n end",
"def index\n @assessments = Assessment\n .where(course:@course)\n end",
"def index\n @assessments = Assessment\n .where(course:@course)\n end",
"def assessments(sort_param: \"createdAt\", sort_order: \"desc\")\n params = init_params\n params[:sort] = sort_param\n params[:sort_order] = sort_order\n\n request_url = UrlGenerator.url_for('assessments')\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n assessments = []\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n assessments << res[\"assessments\"]\n while !res[\"paging\"][\"next\"].nil? do\n res = self.get res[\"paging\"][\"next\"]\n if res[\"status\"] == \"SUCCESS\"\n assessments << res[\"assessments\"]\n else\n return error_response_for(res)\n end\n end\n else\n return error_response_for(res)\n end\n\n return {\"status\"=> \"SUCCESS\", \"assessments\"=> assessments.flatten}\n end",
"def index\n @pain_assessment = current_business.pain_assessments.order(created_at: :desc).paginate(:page => params[:page])\n end",
"def get_assessments(id, params = {})\n get \"/api/v1/projects/#{id}/participants\", params\n end",
"def assessment(assessment_id, options = {})\n Hashie::Mash.new get(\"/assessments/#{assessment_id}\", options)\n end",
"def show\n @curriculum_assessment = current_user.curriculumAssessments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curriculum_assessment }\n end\n end",
"def available_assessments\n # define this later\n end",
"def index\n @page = (params[:page] ? params[:page] : 1)\n @assessments = Assessment.filter_by_published(user_signed_in?).search(params).page(@page)\n authorize! :read, Assessment\n\n if params[:country_id].blank?\n @countries = Country.for_assessments @assessments\n else\n @countries = Country.find_all_by_id(params[:country_id])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessments }\n end\n end",
"def assessments_levels_chart_data\n data = ::Api::Charts::MQAssessment.new(\n @mq_assessment,\n enable_beta_mq_assessments: @company.show_beta_mq_assessments\n ).assessments_levels_data\n\n render json: data.chart_json\n end",
"def assessments\n self.all_assessments.joins(:test_configurations).where('test_configurations.group_id IN(?)',get_groups).group('contents.id')\n end",
"def get_assessments(study_id, instrument_id, ursi: nil)\n act = AssessmentsDownloadAction.new(self)\n act.get(study_id, instrument_id, ursi)\n end",
"def index\n @disc_assessments = DiscAssessment.all\n end",
"def index\n @post_fall_assessment = current_business.post_fall_assessments.order(created_at: :desc).paginate(:page => params[:page])\n end",
"def index\n @assessment_practice_tests = AssessmentPracticeTest.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_practice_tests }\n end\n end",
"def show\n @latest_assessment = @assessments.first\n \n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def index\n @student_goal_evaluations = StudentGoalEvaluation.all\n end",
"def assessment assessment_id\n params = init_params\n request_url = UrlGenerator.url_for(\"assessments\", assessment_id)\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end",
"def index\n @exam_managements = ExamManagement.all\n end",
"def assessments\n frm.link(:text=>\"Assessments\").click\n AssessmentsList.new(@browser)\n end",
"def assessments\n frm.link(:text=>\"Assessments\").click\n AssessmentsList.new(@browser)\n end",
"def index\n @assessments = Assessment.order(:number_assesment).page (params[:page])\n \n end",
"def show\n @assessment = Assessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end",
"def index\n @analyst_scores = AnalystScore.all\n end",
"def create\n @mx_assessment = MxAssessment.new(mx_assessment_params)\n # byebug\n\n respond_to do |format|\n if @mx_assessment.save\n # format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @mx_assessment }\n format.json {head :no_content}\n else\n # format.html { render action: 'new' }\n format.json { render json: @mx_assessment.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @assessment_infos = assessment_info.all\nend",
"def index\n respond_to do |format|\n format.html\n format.json {render json: AssessmentsDatatable.new(view_context)}\n end\n end",
"def index\n @assessment_criterion_details = AssessmentCriterionDetail.all\n end",
"def index\n @assessment_courses = AssessmentCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessment_courses }\n end\n end",
"def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end",
"def show\n @assessments = Assessment.find(params[:id])\n\n @remoteScore = @assessments.remoteOneValue + @assessments.remoteTwoValue + @assessments.remoteThreeValue + @assessments.remoteFourValue + @assessments.remoteFiveValue;\n\n @strategyScore = @assessments.strategyOneValue + @assessments.strategyTwoValue + @assessments.strategyThreeValue + @assessments.strategyFourValue + @assessments.strategyFiveValue + @assessments.strategySixValue;\n\n @totalScore = @assessments.remoteOneValue + @assessments.remoteTwoValue + @assessments.remoteThreeValue + @assessments.remoteFourValue + @assessments.remoteFiveValue + @assessments.strategyOneValue + @assessments.strategyTwoValue + @assessments.strategyThreeValue + @assessments.strategyFourValue + @assessments.strategyFiveValue + @assessments.strategySixValue;\n end",
"def index\n if params[:category_id]\n @category = Category.find(params[:category_id])\n @assessments = @category.assessments.confirmed.\n select(\"id, title, author, year\").\n order(\"LOWER(title) ASC, year DESC\").all\n end\n end",
"def index\n @score_evaluations = ScoreEvaluation.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @score_evaluations }\n end\n end",
"def assess\n if request.xhr?\n @resource = Resource.find(params[:resource_id])\n @assessment_sections = Assessment.find_by_key('resource').\n assessment_sections.order(:index)\n render partial: 'assess_form', locals: { action: :assess }\n else\n render status: 406, plain: 'Not Acceptable'\n end\n end",
"def index\n @exam_sets = ExamSet.all\n end",
"def index\n @assessment_olympiads = AssessmentOlympiad.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_olympiads }\n end\n end",
"def show\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_practice_test }\n end\n end",
"def mx_assessment_params\n # params[:mx_assessment]\n params.require(:mx_assessment).permit(:danger_yn, :drugs_last_changed, \n :drugs_not_why, :drugs_change_why, :psychsoc_last_changed,\n :psychsoc_not_why, :psychsoc_change_why, :meeting_date, :patient_id,\n :pre_date_yesno, :pre_date_no_why, :pre_date, :updated_by,\n :site, :new_date, :date_history)\n end",
"def create_employees_assessments\n assessmens = Assessment.active.map{|e| {assessment_id: e.id, employee_id: id}}\n # Creates an array like [{employee_id: 1}, {employee_id: 3}]\n EmployeeAssessment.create(assessmens)\n end",
"def schedules_for_assessment assessment_id\n params = init_params\n request_url = UrlGenerator.url_for(\"assessments\", \"#{assessment_id}/schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end",
"def show\n @calculated_data_assessment = CalculatedDataAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calculated_data_assessment }\n end\n end",
"def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end",
"def index\n @api_v1_outcomes = Api::V1::Outcome.all\n end",
"def create_employees_assessments\n begin\n emplos = Employee.can_be_assessed.map{|e| {employee_id: e.id}}\n # Creates an array like [{employee_id: 1}, {employee_id: 3}]\n EmployeeAssessment.create(emplos) do |f|\n f.assessment_id = id\n end\n rescue\n p $!.bactrace\n end\n end",
"def index\n @examquestions = Examquestion.all\n end",
"def index\n @exam_marks = ExamMark.all\n end",
"def index\n @exam_subjects = ExamSubject.all\n end",
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student.evaluations.find(params[:eval_id])\n\t\trender json: @evaluation\n\tend",
"def all_assessments\n teacher_class_rooms = case self.type\n when 'Teacher'\n self.teacher_class_rooms\n when 'CenterAdmin'\n self.center.class_rooms\n when 'InstituteAdmin'\n self.institution.class_rooms\n else\n []\n end\n content_ids = teacher_class_rooms.map(&:content_id)\n Content.where('board_id IN (?) or content_year_id IN (?) or subject_id IN (?)',content_ids,content_ids,content_ids).assessment_types\n end",
"def index\n @assessment_insti_tests = AssessmentInstiTest.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_insti_tests }\n end\n end",
"def emissions_chart_data\n data = ::Api::Charts::CPAssessment.new(@cp_assessment, 'regional').emissions_data\n\n render json: data.chart_json\n end",
"def index\n @simulation_answers = SimulationAnswer.all\n end",
"def show\n @assessment = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end",
"def emissions_chart_data\n data = ::Api::Charts::CPAssessment.new(@cp_assessment, params[:view]).emissions_data\n\n render json: data.chart_json\n end",
"def show\n @assessment_olympiad = AssessmentOlympiad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_olympiad }\n end\n end",
"def parse_assessments\n # Assessments elements are E15 and E16. There would be just one E15 and\n # many E16 elements. Sort E16 element clusters by time E16_03, and the\n # first one would be Initial Assessment. The single E15 element is always\n # part of the initial assessment, so it will need to be combined with the\n # earliest E16.\n e15_clusters = parse_cluster('E15')\n e15_initial_assessment = e15_clusters.shift if e15_clusters\n\n e16_clusters = parse_clusters('E16_00_0')\n if e16_clusters\n e16_clusters = e16_clusters.sort_by { |c| Time.parse(c.sub_element('03')) rescue Time.now }\n e16_initial_assessment = e16_clusters.shift\n end\n\n initial_assessment_node = Nokogiri::XML::Node.new(\"E15_E16\", xml_doc)\n initial_assessment_node.add_child e15_initial_assessment.xml_doc.root if e15_initial_assessment\n initial_assessment_node.add_child e16_initial_assessment.xml_doc.root if e16_initial_assessment\n\n initial_assessment = Nemsis::Parser.new(initial_assessment_node.to_s)\n\n assessments = [initial_assessment, e16_clusters].flatten\n\n assessments\n end",
"def index\n @exam_students = ExamStudent.all\n end",
"def index\n @assessment_end_chapter_quizzes = AssessmentEndChapterQuiz.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_end_chapter_quizzes }\n end\n end",
"def index\n @thesis_examinations = ThesisExamination.all\n end",
"def index\n @exam_results = ExamResult.order(:week_s => :desc).first(200)\n @exam_results_all = ExamResult.all\n\n @exam_results_weeks = ExamResult.count(:week_s)\n @exams_results_exams = ExamResult.sum(:taken)\n end",
"def index\n @measures = current_user.account.measures.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @measures }\n end\n end",
"def show\n @exam_result = Xmt::Test::ExamResult.find(params[:id])\n @total_marks = @exam_result.question_scores.sum(:marks)\n end",
"def index\n @issue_skills = IssueSkill.all\n render json: @issue_skills\n end",
"def index\n @decisions = Decision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decisions }\n end\n end",
"def index\n @skillsets = Skillset.all\n end",
"def index\n @skillsets = Skillset.all\n end",
"def assessment\n @assessment\n end",
"def index\n @analysis_responses = AnalysisResponse.all\n end",
"def index\n render status: :ok, json: @test_guide_scenario_sas\n end",
"def index\n @emissions = Emission.all\n end",
"def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end",
"def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end",
"def index\n @actual_answers = ActualAnswer.all\n end",
"def get_exam_schedules(course_id)\r\n relative_url = Path::COURSES_EXAMSCHEDULES % [course_id]\r\n get(relative_url)\r\n end",
"def index\n render json: Assignment.all\n end",
"def index\n \n @evaluation = Evaluation.find_by(user_id: params[:user_id], study_case_id: params[:study_case_id])\n\n if @evaluation.present?\n render :show\n else\n render json: nil\n end\n \n end",
"def destroy\n @mx_assessment.destroy\n respond_to do |format|\n format.html { redirect_to mx_assessments_url }\n format.json { head :no_content }\n end\n end",
"def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end",
"def index\n @assign_stages = AssignStage.all\n render json: @assign_stages\n end",
"def index\n @test_subject_evaluations = @test_subject.test_subject_evaluations.find(:all, :order => 'evaluated_on DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_subject_evaluations }\n end\n end",
"def index\n @exams = Exam.all\n end",
"def view\n @assignment = Assignment.find(params[:id])\n @questions = Hash.new\n questionnaires = @assignment.questionnaires\n questionnaires.each {\n |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n }\n\n @scores = @assignment.get_scores(@questions)\n end",
"def index\n r = @api.get_attendances\n response = JSON.parse(r.body)\n if r.code == 200\n @attendances = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n # @attendances = Attendance.all\n end",
"def index\n @course_evaluations = CourseEvaluation.all\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def index\n @assumptions = Assumption.all\n end",
"def update\n respond_to do |format|\n if @mx_assessment.update(mx_assessment_params)\n format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mx_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @interview_decisions = InterviewDecision.all\n end",
"def get_evaluations\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_evaluations'\n\tend",
"def show\r\n @evaluation = Evaluation.find(params[:id])\r\n @responses = Response.find_all_by_Evaluation_id params[:id]\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @evaluation }\r\n end\r\n end",
"def show\n @score_evaluation = ScoreEvaluation.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @score_evaluation }\n end\n end",
"def index\n @medical_tests = MedicalTest.all\n end"
] | [
"0.7234074",
"0.7187159",
"0.7187159",
"0.6977998",
"0.6959771",
"0.6768774",
"0.65989125",
"0.64246756",
"0.6417867",
"0.6417867",
"0.63915986",
"0.63785046",
"0.6277545",
"0.6273252",
"0.62647027",
"0.62633705",
"0.6233844",
"0.6231452",
"0.6217758",
"0.61547345",
"0.6142831",
"0.61001486",
"0.6093897",
"0.6093368",
"0.6068598",
"0.6065467",
"0.6021599",
"0.6009658",
"0.6009658",
"0.6008193",
"0.5997614",
"0.59912103",
"0.5982982",
"0.5958588",
"0.59565455",
"0.59516793",
"0.59470326",
"0.5938737",
"0.59252137",
"0.59251946",
"0.5916661",
"0.59143156",
"0.5895359",
"0.58797044",
"0.5858119",
"0.58324695",
"0.5831158",
"0.58171666",
"0.5773028",
"0.5760087",
"0.57211316",
"0.5704434",
"0.56844467",
"0.56831527",
"0.567706",
"0.5671195",
"0.56563985",
"0.5655369",
"0.56288767",
"0.56283236",
"0.5624746",
"0.5622279",
"0.5606807",
"0.5574062",
"0.557304",
"0.55599314",
"0.55555195",
"0.55542797",
"0.5541983",
"0.55375886",
"0.553524",
"0.552599",
"0.5519287",
"0.5519287",
"0.5518539",
"0.5515915",
"0.55024564",
"0.55018413",
"0.5500083",
"0.5498952",
"0.54988134",
"0.5494342",
"0.5486764",
"0.5483991",
"0.5479022",
"0.54703945",
"0.5459593",
"0.5458849",
"0.5451244",
"0.5447223",
"0.54417825",
"0.5437822",
"0.54372066",
"0.54348904",
"0.5434509",
"0.54287946",
"0.5428507",
"0.54242903",
"0.54241216",
"0.54127854"
] | 0.68061316 | 5 |
GET /mx_assessments/1 GET /mx_assessments/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @skill_assessments = SkillAssessment.all\n end",
"def index\n @assessments = Assessment.all\n end",
"def index\n @assessments = Assessment.all\n end",
"def index\n @assessments = @location.assessments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assessments }\n end\n end",
"def index\n @fullassessments = Fullassessment.all\n end",
"def show\n @latest_assessment = @assessments.first\n \n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def index\n @risk_assessments = RiskAssessment.all\n end",
"def index\n @mx_assessments = MxAssessment.all\n authorize MxAssessment \n end",
"def show\n @curriculum_assessment = current_user.curriculumAssessments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curriculum_assessment }\n end\n end",
"def show\n @assessment = Assessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end",
"def index\n per_page=10\n if current_user.is?\"EA\"\n @assessments = Content.assessment_types.default_order.page(params[:page]).per(per_page)\n else\n #@assessments = current_user.assessments.page(params[:page]).per(per_page)\n\n #commented above line due to new func implementation of publish now and publish later\n #need to get the assessments based on publisher_id of asset table and also assessments through test configurations groups\n all_assessment_ids = (current_user.assessments.map(&:id) + Asset.get_assessments_by_publisher_id(current_user.id).map(&:archive_id)).uniq\n @assessments = Content.where(:id=>all_assessment_ids).default_order.page(params[:page]).per(per_page)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessments }\n end\n end",
"def set_mx_assessment\n @mx_assessment = MxAssessment.find(params[:id])\n end",
"def index\n @pain_assessment = current_business.pain_assessments.order(created_at: :desc).paginate(:page => params[:page])\n end",
"def assessment(assessment_id, options = {})\n Hashie::Mash.new get(\"/assessments/#{assessment_id}\", options)\n end",
"def assessment assessment_id\n params = init_params\n request_url = UrlGenerator.url_for(\"assessments\", assessment_id)\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end",
"def index\n @assessments = Assessment\n .where(course:@course)\n end",
"def index\n @assessments = Assessment\n .where(course:@course)\n end",
"def show\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_practice_test }\n end\n end",
"def index\n @page = (params[:page] ? params[:page] : 1)\n @assessments = Assessment.filter_by_published(user_signed_in?).search(params).page(@page)\n authorize! :read, Assessment\n\n if params[:country_id].blank?\n @countries = Country.for_assessments @assessments\n else\n @countries = Country.find_all_by_id(params[:country_id])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessments }\n end\n end",
"def show\n @calculated_data_assessment = CalculatedDataAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calculated_data_assessment }\n end\n end",
"def show\n @assessment = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end",
"def index\n @assessment_practice_tests = AssessmentPracticeTest.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_practice_tests }\n end\n end",
"def show\n @assessment_olympiad = AssessmentOlympiad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_olympiad }\n end\n end",
"def create\n @mx_assessment = MxAssessment.new(mx_assessment_params)\n # byebug\n\n respond_to do |format|\n if @mx_assessment.save\n # format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @mx_assessment }\n format.json {head :no_content}\n else\n # format.html { render action: 'new' }\n format.json { render json: @mx_assessment.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def assessments(sort_param: \"createdAt\", sort_order: \"desc\")\n params = init_params\n params[:sort] = sort_param\n params[:sort_order] = sort_order\n\n request_url = UrlGenerator.url_for('assessments')\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n assessments = []\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n assessments << res[\"assessments\"]\n while !res[\"paging\"][\"next\"].nil? do\n res = self.get res[\"paging\"][\"next\"]\n if res[\"status\"] == \"SUCCESS\"\n assessments << res[\"assessments\"]\n else\n return error_response_for(res)\n end\n end\n else\n return error_response_for(res)\n end\n\n return {\"status\"=> \"SUCCESS\", \"assessments\"=> assessments.flatten}\n end",
"def index\n @disc_assessments = DiscAssessment.all\n end",
"def index\n @assessment_infos = assessment_info.all\nend",
"def get_assessments(id, params = {})\n get \"/api/v1/projects/#{id}/participants\", params\n end",
"def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end",
"def index\n @assessment_criterion_details = AssessmentCriterionDetail.all\n end",
"def index\n @assessment_olympiads = AssessmentOlympiad.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_olympiads }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json {render json: AssessmentsDatatable.new(view_context)}\n end\n end",
"def index\n @assessment_courses = AssessmentCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessment_courses }\n end\n end",
"def index\n @exam_managements = ExamManagement.all\n end",
"def get_assessments(study_id, instrument_id, ursi: nil)\n act = AssessmentsDownloadAction.new(self)\n act.get(study_id, instrument_id, ursi)\n end",
"def index\n @exam_sets = ExamSet.all\n end",
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student.evaluations.find(params[:eval_id])\n\t\trender json: @evaluation\n\tend",
"def index\n @student_goal_evaluations = StudentGoalEvaluation.all\n end",
"def index\n if params[:category_id]\n @category = Category.find(params[:category_id])\n @assessments = @category.assessments.confirmed.\n select(\"id, title, author, year\").\n order(\"LOWER(title) ASC, year DESC\").all\n end\n end",
"def index\n @assessments = Assessment.order(:number_assesment).page (params[:page])\n \n end",
"def index\n @post_fall_assessment = current_business.post_fall_assessments.order(created_at: :desc).paginate(:page => params[:page])\n end",
"def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end",
"def index\n @api_v1_outcomes = Api::V1::Outcome.all\n end",
"def show\n @assessment_insti_test = AssessmentInstiTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_insti_test }\n end\n end",
"def available_assessments\n # define this later\n end",
"def index\n @assessment_insti_tests = AssessmentInstiTest.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_insti_tests }\n end\n end",
"def index\n @analyst_scores = AnalystScore.all\n end",
"def show\n @my_exam = MyExam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_exam }\n end\n end",
"def show\n @evaluation_result = EvaluationResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluation_result }\n end\n end",
"def show\n @assessments = Assessment.find(params[:id])\n\n @remoteScore = @assessments.remoteOneValue + @assessments.remoteTwoValue + @assessments.remoteThreeValue + @assessments.remoteFourValue + @assessments.remoteFiveValue;\n\n @strategyScore = @assessments.strategyOneValue + @assessments.strategyTwoValue + @assessments.strategyThreeValue + @assessments.strategyFourValue + @assessments.strategyFiveValue + @assessments.strategySixValue;\n\n @totalScore = @assessments.remoteOneValue + @assessments.remoteTwoValue + @assessments.remoteThreeValue + @assessments.remoteFourValue + @assessments.remoteFiveValue + @assessments.strategyOneValue + @assessments.strategyTwoValue + @assessments.strategyThreeValue + @assessments.strategyFourValue + @assessments.strategyFiveValue + @assessments.strategySixValue;\n end",
"def index\n render json: Assignment.all\n end",
"def assess\n if request.xhr?\n @resource = Resource.find(params[:resource_id])\n @assessment_sections = Assessment.find_by_key('resource').\n assessment_sections.order(:index)\n render partial: 'assess_form', locals: { action: :assess }\n else\n render status: 406, plain: 'Not Acceptable'\n end\n end",
"def assessments\n self.all_assessments.joins(:test_configurations).where('test_configurations.group_id IN(?)',get_groups).group('contents.id')\n end",
"def show\n @assessment_course = AssessmentCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment_course }\n end\n end",
"def assessments\n frm.link(:text=>\"Assessments\").click\n AssessmentsList.new(@browser)\n end",
"def assessments\n frm.link(:text=>\"Assessments\").click\n AssessmentsList.new(@browser)\n end",
"def show\n @assessment = Assessment.find(params[:id])\n authorize! :read, @assessment\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end",
"def show\r\n @evaluation = Evaluation.find(params[:id])\r\n @responses = Response.find_all_by_Evaluation_id params[:id]\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @evaluation }\r\n end\r\n end",
"def show\n @score_evaluation = ScoreEvaluation.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @score_evaluation }\n end\n end",
"def show\n @evaluationstatus = Evaluationstatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluationstatus }\n end\n end",
"def index\n @score_evaluations = ScoreEvaluation.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @score_evaluations }\n end\n end",
"def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end",
"def show\n @essay = Essay.find(params[:id])\n @assignment = Assignment.find(params[:assignment_id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @essay }\n end\n end",
"def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end",
"def show\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_evaluation }\n end\n end",
"def index\n @examquestions = Examquestion.all\n end",
"def index\n @exam_subjects = ExamSubject.all\n end",
"def get_assessment(id)\n Assessment.where(patient_id: current_resource_owner.viewable_patients).find_by(id: id)\n end",
"def show\n @analyst = Analyst.find(params[:id])\n\n render json: @analyst\n end",
"def index\n \n @evaluation = Evaluation.find_by(user_id: params[:user_id], study_case_id: params[:study_case_id])\n\n if @evaluation.present?\n render :show\n else\n render json: nil\n end\n \n end",
"def show\n @annual_stat = AnnualStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annual_stat }\n end\n end",
"def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end",
"def show\n @test_subject_evaluation = @test_subject.test_subject_evaluations.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_subject_evaluation }\n end\n end",
"def assessments_levels_chart_data\n data = ::Api::Charts::MQAssessment.new(\n @mq_assessment,\n enable_beta_mq_assessments: @company.show_beta_mq_assessments\n ).assessments_levels_data\n\n render json: data.chart_json\n end",
"def index\n @analysis_responses = AnalysisResponse.all\n end",
"def index\n @exam_marks = ExamMark.all\n end",
"def mx_assessment_params\n # params[:mx_assessment]\n params.require(:mx_assessment).permit(:danger_yn, :drugs_last_changed, \n :drugs_not_why, :drugs_change_why, :psychsoc_last_changed,\n :psychsoc_not_why, :psychsoc_change_why, :meeting_date, :patient_id,\n :pre_date_yesno, :pre_date_no_why, :pre_date, :updated_by,\n :site, :new_date, :date_history)\n end",
"def schedules_for_assessment assessment_id\n params = init_params\n request_url = UrlGenerator.url_for(\"assessments\", \"#{assessment_id}/schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end",
"def index\n render status: :ok, json: @test_guide_scenario_sas\n end",
"def show\n @skill_set = SkillSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill_set }\n end\n end",
"def index\n @issue_skills = IssueSkill.all\n render json: @issue_skills\n end",
"def index\n @assessment_end_chapter_quizzes = AssessmentEndChapterQuiz.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_end_chapter_quizzes }\n end\n end",
"def index\n @survey_value_sets = SurveyValueSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_value_sets }\n end\n end",
"def index\n @assumptions = Assumption.all\n end",
"def new\n @curriculum_assessment = CurriculumAssessment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curriculum_assessment }\n end\n end",
"def set_skill_assessment\n @skill_assessment = SkillAssessment.find(params[:id])\n end",
"def show\n @team_schedule = Schedule.all.where(laxid: params[:laxid]).last[:games]\n ap @team_schedule\n respond_to do |format|\n format.json{render json: @team_schedule}\n end\n end",
"def update\n respond_to do |format|\n if @mx_assessment.update(mx_assessment_params)\n format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mx_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @manual_subjects = Manual::Subject.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @manual_subjects }\n end\n end",
"def index\n @decisions = Decision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decisions }\n end\n end",
"def index\n @exam_students = ExamStudent.all\n end",
"def index\n @skillsets = Skillset.all\n end",
"def index\n @skillsets = Skillset.all\n end",
"def index\n @assignments = Assignment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assignments }\n end\n end",
"def index\n @first_exams = FirstExam.all\n end",
"def assessment\n @assessment\n end",
"def destroy\n @mx_assessment.destroy\n respond_to do |format|\n format.html { redirect_to mx_assessments_url }\n format.json { head :no_content }\n end\n end",
"def show\n @evaluation_criterium = EvaluationCriterium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluation_criterium }\n end\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def index\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_disciplines = MatrixDiscipline.where(:matrix_id => @matrix.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @matrix_disciplines }\n end\n end",
"def attendance_result\n history_id = params[\"history_id\"]\n Net::HTTP.get(URI.parse(\"#{ENV['PY_SERVER_URL']}/image_matching/history/#{history_id}\"))\n history_student = HistoryStudent.where(history_id: history_id)\n render json: history_student\n end"
] | [
"0.71665937",
"0.71493727",
"0.71493727",
"0.6896379",
"0.6874451",
"0.6737587",
"0.6736547",
"0.67287564",
"0.6728345",
"0.658677",
"0.6525294",
"0.648196",
"0.64300686",
"0.63860124",
"0.63679343",
"0.63441086",
"0.63441086",
"0.63422674",
"0.62719035",
"0.6270778",
"0.6252289",
"0.6219309",
"0.61954635",
"0.61898386",
"0.61784357",
"0.6162258",
"0.61578333",
"0.61343604",
"0.6119075",
"0.60972536",
"0.60959363",
"0.60951835",
"0.60886216",
"0.60657656",
"0.60538137",
"0.60502607",
"0.60157",
"0.6003431",
"0.5978879",
"0.5968283",
"0.59623367",
"0.5957892",
"0.59560806",
"0.59308714",
"0.5919875",
"0.59063536",
"0.59038997",
"0.5893302",
"0.58790034",
"0.5876618",
"0.5872516",
"0.5864127",
"0.5857999",
"0.5852504",
"0.5845773",
"0.5845773",
"0.58259255",
"0.5814381",
"0.58142823",
"0.5812868",
"0.5810688",
"0.5808348",
"0.5806773",
"0.58036023",
"0.5785102",
"0.57705456",
"0.5768587",
"0.576619",
"0.57639056",
"0.5763673",
"0.57602614",
"0.5742876",
"0.5742119",
"0.5740462",
"0.5727198",
"0.57140106",
"0.5702338",
"0.570223",
"0.56896603",
"0.5689254",
"0.5676958",
"0.5676583",
"0.56735057",
"0.56710374",
"0.5670923",
"0.56663865",
"0.5661066",
"0.565777",
"0.56436354",
"0.56380945",
"0.5634617",
"0.56337416",
"0.56337416",
"0.56279695",
"0.56266856",
"0.56221944",
"0.5613571",
"0.56099075",
"0.56059045",
"0.5600337",
"0.5596206"
] | 0.0 | -1 |
POST /mx_assessments POST /mx_assessments.json | def create
@mx_assessment = MxAssessment.new(mx_assessment_params)
# byebug
respond_to do |format|
if @mx_assessment.save
# format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully created.' }
# format.json { render action: 'show', status: :created, location: @mx_assessment }
format.json {head :no_content}
else
# format.html { render action: 'new' }
format.json { render json: @mx_assessment.errors.full_messages, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n @assessment = Assessment.new(assessment_params)\n respond_to do |format|\n if @assessment.save\n format.html { redirect_to @assessment, notice: 'YASASSSS.' }\n format.json { render :show, status: :created, location: @assessment }\n else\n format.html { render :new }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_employees_assessments\n assessmens = Assessment.active.map{|e| {assessment_id: e.id, employee_id: id}}\n # Creates an array like [{employee_id: 1}, {employee_id: 3}]\n EmployeeAssessment.create(assessmens)\n end",
"def create_employees_assessments\n begin\n emplos = Employee.can_be_assessed.map{|e| {employee_id: e.id}}\n # Creates an array like [{employee_id: 1}, {employee_id: 3}]\n EmployeeAssessment.create(emplos) do |f|\n f.assessment_id = id\n end\n rescue\n p $!.bactrace\n end\n end",
"def create\n @assessment = Assessment.new(params[:assessment])\n\n respond_to do |format|\n if @assessment.save\n format.html { redirect_to @assessment, notice: 'Assessment was successfully created.' }\n format.json { render json: @assessment, status: :created, location: @assessment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assessment = Assessment.new(assessment_params)\n\n respond_to do |format|\n if @assessment.save\n format.html { redirect_to @assessment, notice: 'Assessment was successfully created.' }\n format.json { render :show, status: :created, location: @assessment }\n else\n format.html { render :new }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assessment = Assessment.new(assessment_params)\n\n respond_to do |format|\n if @assessment.save\n format.html { redirect_to @assessment, notice: 'Assessment was successfully created.' }\n format.json { render :show, status: :created, location: @assessment }\n else\n format.html { render :new }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n assessment = current_enrollment ? current_enrollment.assessments.baseline.last : nil\n if assessment.nil? || assessment.created_at < 1.month.ago\n logger.info \"Creating a new baseline assessment\"\n assessment = BaselineAssessment.create(enrollment_uuid:current_enrollment ? current_enrollment.uuid : nil)\n else\n logger.info \"Found an existing assessment\"\n end\n\n params[:answers].each do |question_uuid, answer|\n next if answer == \"\" # bypass enpty answers\n\n check = Check.find_by_uuid(question_uuid)\n throw \"you must provide the uuid of the question (aka check)\" unless check\n\n assessment.responses.create!(check_uuid:check.uuid, value:answer)\n end\n\n # The assessment is created now, but may not have an enrollment. If not, we add the assessment uuid to the session\n # so that it can be attached to the user later on.\n if assessment.enrollment.nil?\n log \"I have a newly-created baseline assessment, but no user, so I'm storing the assessment's uuid in session for later use.\"\n store_baseline_assessment_in_session(assessment)\n end\n\n # track the event\n curr_ai = current_action_item(BaselineAssessment::COMPONENT_TYPE)\n if assessment.complete?\n track_event(curr_ai||current_enrollment||current_lead, \"completed_baseline_assessment\", target:assessment, points:BASELINE_ASSESSMENT_POINTS)\n redirect_to baseline_assessment_path(assessment)\n elsif curr_ai||current_enrollment\n track_event(curr_ai||current_enrollment||current_lead, assessment.mini_complete? ? :user_or_lead_completed_mini_baseline_assessment : :user_or_lead_answered_baseline_assessment_questions, target:assessment)\n redirect_to action_plan_index_path\n else # no user, go to registration\n redirect_to registration_path\n end\n end",
"def create\n @assessment = nil?\n unless params[:test].nil?\n test = params[:test].to_i\n if Test.find(test)\n @assessment = @group.assessments.build(:test_id => test)\n @assessment.save\n end\n end\n @assessments = Assessment.all\n render :index\n end",
"def create\n @pain_assessment = current_business.pain_assessments.new(pain_assessment_params)\n @pain_assessment.author_id = current_user.id\n\n respond_to do |format|\n if @pain_assessment.save\n format.html { redirect_to app_pain_assessments_path, notice: 'PainAssessment was successfully created.' }\n format.json { render :show, status: :created, location: @pain_assessment }\n else\n format.html { render :new }\n format.json { render json: @pain_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @skill_assessments = SkillAssessment.all\n end",
"def mx_assessment_params\n # params[:mx_assessment]\n params.require(:mx_assessment).permit(:danger_yn, :drugs_last_changed, \n :drugs_not_why, :drugs_change_why, :psychsoc_last_changed,\n :psychsoc_not_why, :psychsoc_change_why, :meeting_date, :patient_id,\n :pre_date_yesno, :pre_date_no_why, :pre_date, :updated_by,\n :site, :new_date, :date_history)\n end",
"def index\n @assessments = Assessment.all\n end",
"def index\n @assessments = Assessment.all\n end",
"def create\n @annual_summary_report = AnnualSummaryReport.new(annual_summary_report_params)\n\n #create default questions\n questions = Question.all\n @annual_summary_report.user_id = current_user.id\n @annual_summary_report.status = 1\n\n respond_to do |format|\n if @annual_summary_report.save\n for question in questions\n answer = Answer.new\n answer.question = question.question\n answer.question_id = question.id\n answer.answer = '';\n answer.section_id = question.section_id\n answer.annual_summary_report_id = @annual_summary_report.id\n answer.save\n end\n\n format.html { redirect_to @annual_summary_report }\n format.json { render :show, status: :created, location: @annual_summary_report }\n else\n format.html { render :new }\n format.json { render json: @annual_summary_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@curriculum_assessment = CurriculumAssessment.create(params[:curriculum_assessments])\n \n @dop = Dop.find(params[:curriculum_assessment][:dop_id])\n @item = Item.find(params[:curriculum_assessment][:item_id])\n @curriculum_assessment = CurriculumAssessment.create(item: @item, dop: @dop)\n\n\n respond_to do |format|\n if @curriculum_assessment.save\n format.html { redirect_to @curriculum_assessment, notice: 'Curriculum assessment was successfully created.' }\n format.json { render json: @curriculum_assessment, status: :created, location: @curriculum_assessment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curriculum_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def available_assessments\n # define this later\n end",
"def create_assessment\n @assessment = Assessment.find(params[:id])\n end",
"def create\n @exam_set = ExamSet.new(exam_set_params)\n\n respond_to do |format|\n if @exam_set.save\n format.html { redirect_to @exam_set, notice: 'Exam set was successfully created.' }\n format.json { render :show, status: :created, location: @exam_set }\n else\n format.html { render :new }\n format.json { render json: @exam_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @risk_assessment = RiskAssessment.new(risk_assessment_params)\n\n respond_to do |format|\n if @risk_assessment.save\n format.html { redirect_to @risk_assessment, notice: 'Risk assessment was successfully created.' }\n format.json { render :show, status: :created, location: @risk_assessment }\n else\n format.html { render :new }\n format.json { render json: @risk_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @fullassessments = Fullassessment.all\n end",
"def create\n rendered_time, referer, user = tracking_info\n assessment_result = user.assessment_results.create!(\n assessment_id: params[:assessment_id],\n eid: params[:eid],\n src_url: params[:src_url],\n external_user_id: params[:external_user_id],\n identifier: params['identifier'],\n rendered_datestamp: rendered_time,\n referer: referer,\n ip_address: request.ip,\n session_status: 'initial')\n\n assessment_result.keyword_list.add(params[:keywords], parse: true) if params[:keywords]\n assessment_result.objective_list.add(params[:objectives], parse: true) if params[:objectives]\n assessment_result.save! if params[:objectives] || params[:keywords]\n respond_with(:api, assessment_result)\n end",
"def create\n @assessment = Assessment.new(assessment_params)\n\n respond_to do |format|\n if @assessment.save\n format.html { redirect_to [@course, @assessment], notice: 'Assessment was successfully created.' }\n format.json { render :show, status: :created, location: @assessment }\n else\n format.html { render :new }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end",
"def set_mx_assessment\n @mx_assessment = MxAssessment.find(params[:id])\n end",
"def create\n @assessment = Assessment.new(assessment_params)\n \n respond_to do |format|\n if @assessment.save\n @assessment.assign_exercises_to_students(params[:number_of_versions]) \n format.html { redirect_to [@course, @assessment], notice: 'Assessment was successfully created.' }\n format.json { render :show, status: :created, location: @assessment }\n else\n format.html { render :new }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calculated_data_assessment = CalculatedDataAssessment.new(params[:calculated_data_assessment])\n\n respond_to do |format|\n if @calculated_data_assessment.save\n format.html { redirect_to @calculated_data_assessment, notice: 'Calculated data assessment was successfully created.' }\n format.json { render json: @calculated_data_assessment, status: :created, location: @calculated_data_assessment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calculated_data_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assessments\n frm.link(:text=>\"Assessments\").click\n AssessmentsList.new(@browser)\n end",
"def assessments\n frm.link(:text=>\"Assessments\").click\n AssessmentsList.new(@browser)\n end",
"def answer\n @assessment = Assessment.new(assessment_params)\n @assessment.user_id = current_user.id\n if @assessment.save\n @assessment.update_attributes(check_user_answer)\n render json: @assessment.as_json(only: [:question_id, :user_option, :is_correct,:is_skipped]), status: :created\n else\n render json: @assessment.errors, status: :unprocessable_entity\n end\n end",
"def create\r\n @evaluation = Evaluation.new(params[:evaluation])\r\n @answers = @evaluation.responses\r\n\r\n respond_to do |format|\r\n if @evaluation.save && @answers.each{|a| a.save }.all?\r\n format.html { redirect_to(@evaluation, :notice => 'Evaluation was successfully created.') }\r\n format.xml { render :xml => @evaluation, :status => :created, :location => @evaluation }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @evaluation.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n student_answers_hash = assessment_info_params[:student_answers]\n student_answers = student_answers_hash.collect { |s| StudentAnswer.new( s)}\n\n assessment_info_map = assessment_info_params.except(:student_answers)\n\n\n\n assessment_info_map[:student_answers] = student_answers\n\n @assessment_info = AssessmentInfo.new( assessment_info_map )\n @assessment_info.student_user_id = current_user.id\n\n\n\n\n\n respond_to do |format|\n correct_count = 0\n if @assessment_info.save\n\n @assessment_info.student_answers.each do |student_answer|\n\n sa = StudentAnswer.find(student_answer.id)\n\n if sa.question.question_type == 0\n if sa.answer_choice_id == sa.question.question_answers.first.choice_id\n sa.correct = true\n correct_count = correct_count + 1\n else\n sa.correct = false\n end\n sa.save!\n elsif student_answer.question.question_type == 1\n if student_answer.answer_text == student_answer.question.answer\n sa.correct = true\n correct_count = correct_count + 1\n else\n sa.correct = false\n end\n sa.save!\n end\n\n end\n\n @assessment_info.result = correct_count.to_d/@assessment_info.student_answers.count*100\n #if result less than passing grade set the concept as incomplete\n @learned_concept = LearnedConcept.find_by(concept_id: @assessment_info.assessment.concept_id)\n if !@learned_concept\n\n @learned_concept = LearnedConcept.new\n @learned_concept.concept_id = @assessment_info.assessment.concept.id\n @learned_concept.learned_course_id = @assessment_info.assessment.concept.course_id\n end\n if @assessment_info.result < @assessment_info.assessment.min_passing_grade\n @learned_concept.completed = false\n else\n @learned_concept.completed = true\n end\n @learned_concept.save\n @assessment_info.save\n format.html { redirect_to @assessment_info, notice: 'assessment was submitted.' }\n format.json { render :show, status: :created, location: @assessment_info }\n else\n format.html { render :new }\n format.json { render json: @assessment_info.errors, status: :unprocessable_entity }\n end\n end\nend",
"def create\n @fullassessment = Fullassessment.new(fullassessment_params)\n respond_to do |format|\n if @fullassessment.save\n format.json { render json: @fullassessment }\n else\n format.html { render :new }\n format.json { render json: @fullassessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_fall_assessment = current_business.post_fall_assessments.new(post_fall_assessment_params)\n @post_fall_assessment.author_id = current_user.id\n\n respond_to do |format|\n if @post_fall_assessment.save\n format.html { redirect_to app_post_fall_assessments_path, notice: 'PostFallAssessment was successfully created.' }\n format.json { render :show, status: :created, location: @post_fall_assessment }\n else\n format.html { render :new }\n format.json { render json: @post_fall_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_assessment\n @assessment = Assessment.find(params[:id])\n @assessment.description = params[:assessment_description]\n @assessment.user_id = current_user.id\n @assessment.tenant_id = current_user.tenant_id\n @assessment.time_bound = \"time_bound\"\n @assessment.test_pattern_id = 1\n @assessment.save\n redirect_to(\"/structure_components/create_structure/#{@assessment.id}\")\n end",
"def create\n @assessment = Assessment.new(params[:assessment])\n subject = Subject.find(params[:assessment][:subject_id]) rescue nil\n @assessment.board_id = subject.try(:board).try(:id)\n @assessment.content_year_id = subject.try(:content_year).try(:id)\n respond_to do |format|\n if @assessment.save\n @assessment.test_configurations.first.update_attribute(:uri,@assessment.uri) if !@assessment.test_configurations.empty?\n #if @assessment.status == 1\n est = current_user.center.est\n Content.send_message_to_est(est,current_user,@assessment)\n #end\n format.html { redirect_to @assessment, notice: 'Assessment was successfully created.' }\n format.json { render json: @assessment, status: :created, location: @assessment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @risk_assessments = RiskAssessment.all\n end",
"def assess\n if request.xhr?\n @resource = Resource.find(params[:resource_id])\n @assessment_sections = Assessment.find_by_key('resource').\n assessment_sections.order(:index)\n render partial: 'assess_form', locals: { action: :assess }\n else\n render status: 406, plain: 'Not Acceptable'\n end\n end",
"def new\n @assessment = Assessment.new\n @assessment.build_asset\n @assessment.test_configurations.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assessment }\n end\n end",
"def assess\n @latest_assessment = @task.assessments.find_or_initialize_by_assessed_on(Time.now.to_date)\n @latest_assessment.attributes = params[:latest_assessment]\n if @latest_assessment.save\n respond_to do |format|\n format.html do\n flash[:notice] = 'Task progress was recorded.'\n flash[:highlight_dom_id] = dom_id(@latest_assessment)\n redirect_to task_path(@task)\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'show' }\n end\n end\n end",
"def index\n @assessments = @location.assessments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assessments }\n end\n end",
"def index\n @mx_assessments = MxAssessment.all\n authorize MxAssessment \n end",
"def create\n @student_goal_evaluation = StudentGoalEvaluation.new(student_goal_evaluation_params)\n\n respond_to do |format|\n if @student_goal_evaluation.save\n format.html { redirect_to root_path, notice: 'Evalueringen er gemt.' }\n format.json { render :show, status: :created, location: @student_goal_evaluation }\n else\n format.html { render :new }\n format.json { render json: @student_goal_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assessment = @department.assessments.build(assessment_params)\n authorize! :create, @assessment\n respond_to do |format|\n if @assessment.save\n flash[:notice] = \"Aspek Penilaian berhasil ditambahkan, #{undo_link(@assessments)}\"\n format.js\n else\n format.js { render action: 'new' }\n end\n end\n end",
"def pain_assessment_params\n params.require(:pain_assessment).permit(:date, :business_id, :author_id, :resident_id)\n end",
"def create\n @simulation_answer = SimulationAnswer.new(simulation_answer_params)\n\n respond_to do |format|\n if @simulation_answer.save\n format.html { redirect_to @simulation_answer, notice: 'Simulation answer was successfully created.' }\n format.json { render :show, status: :created, location: @simulation_answer }\n else\n format.html { render :new }\n format.json { render json: @simulation_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assessment_params\n params.require(:assessment).permit(:user_id, :closed, :max_level, item_attributes: [:behavior_id, :user_tick, :manager_tick, :final_tick])\n end",
"def assessment_params\n params.require(:assessment).permit(:number_assesment, :state_id, :location, :inhabited, :habitant, :client_id, :owner_id, :start_date, \n :end_date, \n properties_attributes:[:id, :debt_taxation, :antiquity, :expropriation, :sill, :facilities, :name])\n end",
"def save\n filename = Time.now.strftime(\"measures-%Y-%m-%d-%H%M%S.json\")\n dirname = \"goals/measures\"\n hash = { \"objective\" => @name}\n @outcomes.each {|o|\n hash.store(\"outcome\", o.name)\n hash.store(\"scale\", \"#{o.scale.class.name}.rb\")\n hash.store(\"baseline\", o.baseline)\n hash.store(\"baseline date\", o.baseline_date)\n hash.store(\"target\", o.target)\n hash.store(\"target date\", o.target_date)\n hash.store(\"measure\", o.last_measure.value)\n hash.store(\"measure date\", Time.now.strftime(\"%b %-d, %Y\"))\n }\n\n if !File.exists? dirname\n FileUtils.mkdir_p dirname\n end\n\n File.open(\"#{dirname}/#{filename}\",\"a\") do |f|\n f.write(JSON.pretty_generate(hash))\n f.write(\"\\n\")\n end\n end",
"def assessments(sort_param: \"createdAt\", sort_order: \"desc\")\n params = init_params\n params[:sort] = sort_param\n params[:sort_order] = sort_order\n\n request_url = UrlGenerator.url_for('assessments')\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n assessments = []\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n assessments << res[\"assessments\"]\n while !res[\"paging\"][\"next\"].nil? do\n res = self.get res[\"paging\"][\"next\"]\n if res[\"status\"] == \"SUCCESS\"\n assessments << res[\"assessments\"]\n else\n return error_response_for(res)\n end\n end\n else\n return error_response_for(res)\n end\n\n return {\"status\"=> \"SUCCESS\", \"assessments\"=> assessments.flatten}\n end",
"def create\n @exam_group = ExamGroup.shod(params[:exam_group_id])\n @batch = @exam_group.batch\n @subjects = @batch.subjects.where(no_exams: false)\n @exam = @exam_group.exams.new(params_exam)\n exam_create\n end",
"def create\n\n @exam = Exam.new(exam_params)\n result=@exam.save\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if result\n format.html { redirect_to @exam, notice: \"已成功建立考试“#{@exam.name}.”\" }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n params[:assessment] = {}\n params[:assessment][:completed_assignment_id] = params[:completed_assignment_id]\n params[:assessment][:grader_id] = params[:grader_id]\n params[:assessment][:student_id] = params[:student_id]\n\n @assessment = Assessment.new(params[:assessment])\n @assessment.save\n \n @completed_assignment = CompletedAssignment.find(params[:assessment][:completed_assignment_id])\n @assignment = @completed_assignment.assignment\n\n @objectives_results = []\n @assignment.objectives.each { |objective |\n @ob = ObjectiveResult.new\n @ob.assessment_id = @assessment.id\n @ob.student_id = @completed_assignment.user_id\n @ob.objective_id = objective.id\n @ob.mastery_category_id = objective.mastery_category_id\n @ob.save\n @objectives_results.push(@ob)\n }\n\n redirect_to :action => \"edit\", :id => @assessment.id\n end",
"def create\n course = Course.find(params[:course_id])\n student = Student.find_by(dni: params[:student_id])\n @enroll = Enroll.new( student: student, course: course)\n TestCourse.of(course).each do |tc|\n Score.create( student: student, test_id: tc.test_id, value: -2)\n end\n \n respond_to do |format|\n if @enroll.save\n format.html { redirect_to course_enrolls_path(course), notice: 'Enroll was successfully created.' }\n format.json { render :show, status: :created, location: course_enrolls_path(course) }\n else\n format.html { render :new }\n format.json { render json: @enroll.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assessment_params\n params.require(:assessment).permit(:aspect, :percentage, :category)\n end",
"def create\n @exam_management = ExamManagement.new(exam_management_params)\n\n respond_to do |format|\n if @exam_management.save\n format.html { redirect_to @exam_management, notice: 'Exam management was successfully created.' }\n format.json { render :show, status: :created, location: @exam_management }\n else\n format.html { render :new }\n format.json { render json: @exam_management.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assessment_params\n params.fetch(:assessment).permit(:remoteOneValue,:remoteTwoValue,:remoteThreeValue, :remoteFourValue, :remoteFiveValue, :strategyOneValue, :strategyTwoValue, :strategyThreeValue, :strategyFourValue, :strategyFiveValue, :strategySixValue, :name, :email)\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n if @evaluation.save\n render :show, status: :created\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def create\n @api_v1_outcome = Api::V1::Outcome.new(api_v1_outcome_params)\n\n respond_to do |format|\n if @api_v1_outcome.save\n format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_outcome }\n else\n format.html { render :new }\n format.json { render json: @api_v1_outcome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_exam = MyExam.new(params[:my_exam])\n\n respond_to do |format|\n if @my_exam.save\n format.html { redirect_to @my_exam, notice: 'My exam was successfully created.' }\n format.json { render json: @my_exam, status: :created, location: @my_exam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @analyst_score = AnalystScore.new(analyst_score_params)\n\n respond_to do |format|\n if @analyst_score.save\n format.html { redirect_to @analyst_score, notice: 'Analyst score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @analyst_score }\n else\n format.html { render action: 'new' }\n format.json { render json: @analyst_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(params[:exam])\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render json: @exam, status: :created, location: @exam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assessment_params\n params.require(:assessment).permit(:story_id, :duplicate, :importance, :valence, :match_value_id, :match_strength, :value_violation, :value_violated_id, :comments, :restrict_comments)\n end",
"def create\n @examquestion = Examquestion.new(examquestion_params)\n\n respond_to do |format|\n if @examquestion.save\n format.html { redirect_to @examquestion, notice: 'Examquestion was successfully created.' }\n format.json { render action: 'show', status: :created, location: @examquestion }\n else\n format.html { render action: 'new' }\n format.json { render json: @examquestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @submission = Submission.new(:student_id => current_student.id, :assignment_id => params[:assignment_id])\n\n respond_to do |format|\n if @submission.save\n @assignment = @submission.assignment\n @assignment.questions.each do |question| \n answer = SubmittedAnswer.new(:submission_id => @submission.id, :question_id => question.id)\n answer.save\n end\n format.html { redirect_to edit_submission_path(@submission), notice: 'Submission was successfully created.' }\n format.json { render json: @submission, status: :created, location: @submission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_pain_assessment\n @pain_assessment = current_business.pain_assessments.find(params[:id])\n end",
"def index\n @pain_assessment = current_business.pain_assessments.order(created_at: :desc).paginate(:page => params[:page])\n end",
"def assessment_params\n params.require(:assessment).permit(:question_id, :user_option)\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assessment.user = current_user\n @assessment.account = current_account\n @assessment.save!\n @assessment.assessment_settings.create(settings_params)\n\n respond_with(:api, @assessment)\n end",
"def create\n @assessment = Assessment.new(params[:assessment])\n authorize! :create, @assessment\n @assessment.last_editor = current_user\n\n respond_to do |format|\n if @assessment.save\n format.html { redirect_to @assessment, notice: 'Assessment was successfully created.' }\n format.json { render json: @assessment, status: :created, location: @assessment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assessments_levels_chart_data\n data = ::Api::Charts::MQAssessment.new(\n @mq_assessment,\n enable_beta_mq_assessments: @company.show_beta_mq_assessments\n ).assessments_levels_data\n\n render json: data.chart_json\n end",
"def create\n @exam = Exam.new(exam_params)\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exam }\n else\n format.html { render action: 'new' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_exam\n @date = Date.today\n @exam_group = ExamGroup.shod(params[:format])\n @exam_group.update(is_published: true)\n @exam_group.exams.each(&:create_exam_event)\n @batch = @exam_group.batch\n @exam_groups ||= @batch.exam_groups.all\n end",
"def destroy\n @mx_assessment.destroy\n respond_to do |format|\n format.html { redirect_to mx_assessments_url }\n format.json { head :no_content }\n end\n end",
"def create\n monthly_slip(params)\n # secure valid input\n return render json: { msg: \"input valid number\" } unless @annual_salary > 0\n @timestamp = DateTime.now\n slip = Slip.new({\n \"time_stamp\" => @timestamp,\n \"annual_salary\" => @annual_salary,\n \"employee_name\" => @employee_name,\n \"monthly_income_tax\" => @monthly_income_tax,\n })\n if slip.save\n render json: { status: \"SUCCESS\", message: \"Saved Infotmation\", data: slip }, status: :ok\n else\n render json: { status: \"ERROR\", message: \"Information not saved\", data: slip.errors }, status: :unprocessable_entity\n end\n end",
"def create\n if current_user.has_role? :admin\n @evaluation = Evaluation.new(evaluation_params)\n else\n @practice = Practice.find(session[:practice_id])\n @evaluation = Evaluation.new(evaluation_params)\n @evaluation.lesson_id = session[:lesson_id]\n @evaluation.user_id = current_user.id\n @evaluation.practice_id = @practice.id\n @evaluation.title = @practice.title\n @evaluation.material = @practice.material\n @evaluation.question = @practice.question\n @evaluation.answer = @practice.answer\n @evaluation.practice_score ||= @practice.score\n if session[:papertest_id]\n @papertest = Papertest.find(session[:papertest_id])\n if Time.now < @papertest.end_at\n @evaluation.end_at = @papertest.end_at\n @evaluation.papertest_id = @papertest.id\n else\n session[:papertest_id] = nil\n redirect_to paper_url(@papertest.paper_id), notice: \"考试已结束!\"\n return\n end\n end\n end\n respond_to do |format|\n if @evaluation.save\n if @practice.answer.gsub(/(<(\\w|\\/)+[^>]*>|\\s)/, \"\") == @evaluation.your_answer.gsub(/(<(\\w|\\/)+[^>]*>|\\s)/, \"\") # 如果答对了\n @justice = Justice.create!(\n user_id: 1,\n evaluation_user_id: @evaluation.user_id,\n practice_id: @evaluation.practice_id,\n\t evaluation_id: @evaluation.id,\n\t score: @evaluation.practice_score, # 得到满分\n\t p_score: @evaluation.practice_score,\n remark: \"完全正确!\",\n )\n @evaluation.update(score: @evaluation.practice_score)\n end\n format.html { redirect_to @evaluation, notice: '答案提交成功' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @random_exam = RandomExam.new(random_exam_params)\n\n respond_to do |format|\n if @random_exam.save\n format.html { redirect_to @random_exam, notice: 'Random exam was successfully created.' }\n format.json { render :show, status: :created, location: @random_exam }\n else\n format.html { render :new }\n format.json { render json: @random_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_skill_assessment\n @skill_assessment = SkillAssessment.find(params[:id])\n end",
"def create\n #raise params.inspect\n @evaluation_result = EvaluationResult.new(params[:evaluation_result])\n @evaluation_result.appointment_id = params[:appoint_id].to_i\n\n if params[:commit].to_s == \"Gravar Rascunho\"\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Em Avaliacao\")\n app.appointment_status = s\n app.save\n else\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Realizada\")\n app.appointment_status = s\n app.save\n end\n\n respond_to do |format|\n if @evaluation_result.save\n if params[:commit].to_s == \"Gravar Rascunho\"\n format.html { redirect_to appointments_path, notice: 'Resultados da avaliacao guardados com sucesso.' }\n else\n format.html { redirect_to \"http://teste93.di.uminho.pt:8000/reporting?report=Avaliacao&Appointment_Id=#{params[:appoint_id].to_s}\", notice: 'Resultados da avaliacao guardados com sucesso.' }\n end\n format.json { render json: @evaluation_result, status: :created, location: @evaluation_result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @evaluation_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def skill_assessment_params\n params.require(:skill_assessment).permit(:user_id, :analytical_problem_solving_score, :conflict_management_score, :continuous_learning_score, :creativity_score, :customer_service_score, :decision_making_score, :diplomacy_score, :empathy_score, :employee_development_score, :flexibility_score, :futuristic_thinking_score, :goal_orientation_score, :interpersonal_skills_score, :leadership_score, :management_score, :negotiation_score, :personal_effectiveness_score, :persuasion_score, :planning_score, :presenting_score, :self_management_score, :teamwork_score, :written_communication_score)\n end",
"def index\n per_page=10\n if current_user.is?\"EA\"\n @assessments = Content.assessment_types.default_order.page(params[:page]).per(per_page)\n else\n #@assessments = current_user.assessments.page(params[:page]).per(per_page)\n\n #commented above line due to new func implementation of publish now and publish later\n #need to get the assessments based on publisher_id of asset table and also assessments through test configurations groups\n all_assessment_ids = (current_user.assessments.map(&:id) + Asset.get_assessments_by_publisher_id(current_user.id).map(&:archive_id)).uniq\n @assessments = Content.where(:id=>all_assessment_ids).default_order.page(params[:page]).per(per_page)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessments }\n end\n end",
"def build_exam_set\n @scores = new_collection\n @total_max = 0\n @total_score = 0\n @overrided_subjects = assessment_group.override_assessment_marks.find_all_by_course_id(batch.course_id).collect(&:subject_code)\n process_scores\n \n Models::ExamSet.new(\n :obj_id => assessment_group.id,\n :name => assessment_group.display_name,\n :scores => @scores,\n :aggregates => process_aggregates,\n :term_name => term_name(assessment_group),\n :term_exam => assessment_group.is_final_term,\n :group_exam => is_assessment_group?,\n :planner_exam => (assessment_group.is_final_term and (assessment_group.parent_type == 'AssessmentPlan')),\n :attendance_report => process_attendance,\n :planner_name => assessment_plan.name,\n :scoring_type => AssessmentGroup::SCORE[assessment_group.scoring_type],\n :show_percentage => (assessment_group.is_final_term && assessment_group.show_percentage?),\n :maximum_mark => assessment_group.maximum_marks,\n :hide_marks => assessment_group.hide_marks,\n :consider_skills => assessment_group.consider_skills\n )\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n @evaluation.group_id = params[:group_id]\n @evaluation.student_id = current_student.id\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to student_dashboard_path, notice: 'Evaluation was successfully created.' }\n format.json { render :show, status: :created, location: student_dashboard_path }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evaluations = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assessment_olympiad = AssessmentOlympiad.new(params[:assessment_olympiad])\n respond_to do |format|\n if@assessment_olympiad.save\n #if@assessment_olympiad.rb.status == 1\n Content.send_message_to_est(false,current_user,@assessment_olympiad)\n #end\n format.html { redirect_to@assessment_olympiad, notice: 'AssessmentOlympiad was successfully created.' }\n format.json { render json:@assessment_olympiad, status: :created, location:@assessment_olympiad }\n else\n format.html { render action: \"new\" }\n format.json { render json:@assessment_olympiad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exam = Exam.new(exam_params)\n @exam.patient = @patient\n\n if @exam.save\n render json: @exam, include: [:point_po, :point_or, :point_n, :point_a], methods: :maxillary_depth_angle, status: :created\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end",
"def set_assessment\n @client = Client.find(params[:client_id])\n @assessment = @client.assessments.find(params[:id])\n end",
"def assessment_params\n params[:assessment]\n end",
"def post_fall_assessment_params\n params.require(:post_fall_assessment).permit(:date, :business_id, :author_id, :resident_id)\n end",
"def create\n @skill_assessment = SkillAssessment.new(skill_assessment_params)\n @skill_assessment.save\n session[:skill_assessment_id] = @skill_assessment.id\n\n respond_to do |format|\n if @skill_assessment.save\n if session[:assessment_sequence] && current_user\n disc = DiscAssessment.find(session[:disc_assessment_id])\n disc.update_attributes(:user_id => current_user.id)\n current_user.assign_discs_to_user\n \n value = ValueAssessment.find(session[:value_assessment_id])\n value.update_attributes(:user_id => current_user.id)\n current_user.assign_values_to_user \n \n skill = SkillAssessment.find(session[:skill_assessment_id])\n skill.update_attributes(:user_id => current_user.id)\n current_user.assign_skills_to_user\n\n session[:assessment_sequence] = \"false\"\n session[:disc_assessment_id] = nil\n session[:skill_assessment_id] = nil\n session[:value_assessment_id] = nil\n end\n \n #probably need to send them over to some dashboard instead of the skill view.\n format.html { redirect_to pages_user_dashboard_path, notice: 'Skill assessment was successfully created.' }\n format.json { render :show, status: :created, location: @skill_assessment }\n else\n format.html { render :new }\n format.json { render json: @skill_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n newEssay = params[:essay]\n newEssay[:assignment_id] = params[:assignment_id]\n @essay = Essay.new(newEssay)\n \n respond_to do |format|\n if @essay.save\n format.html { redirect_to assignment_essay_url(@essay.assignment_id, @essay.id), notice: 'Essay was successfully created.' }\n format.json { render json: @essay, status: :created, location: @essay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @essay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer_set = AnswerSet.new(params[:answer_set])\n @answer_set.user = current_user\n @answer_set.cohort = current_user.cohort\n \n respond_to do |format|\n if @answer_set.save\n format.html { redirect_to root_path, notice: 'Your current mood has been recorded. Thank you.' }\n format.json { render json: @answer_set, status: :created, location: @answer_set }\n else\n format.html { render \"pages/home\" }\n format.json { render json: @answer_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts evaluation_params\n @evaluation = Evaluation.new(evaluation_params)\n #De aca en adelante es para lograr insertar datos en la tabla intermedia \n #La Tabla intermedia se la evaluation_question\n respond_to do |format|\n puts \"Entre al respond\"\n if @evaluation.save\n puts \"Pude guardarlo\"\n evaluation = Evaluation.last\n evaluation.update(course_id: params[:course_id])\n evaluation_id = evaluation.id\n question_ids = params[:questions]\n question_ids.each do |question_id|\n EvaluationQuestion.create(question_id: question_id, evaluation_id: evaluation_id)\n end\n format.html { redirect_to @evaluation, notice: 'La evaluación fue creada con éxito' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n @question = Question.all\n @courses = Course.all\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @calculated_data_assessment = CalculatedDataAssessment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calculated_data_assessment }\n end\n end",
"def create\n #raise params.inspect\n\n wmsPhase = session[\"wms_phase\"].to_f\n total = 0\n \n #number of answers\n if wmsPhase == 1 \n total = 21\n else\n total = 16\n end\n\n #correct answers\n correct = params[:hiddenResult][0].to_f\n #wrong answers\n wrong = total-correct\n\n @wm = WmsResult.new(params[:wms_result])\n @wm.correct_items = correct\n @wm.wrong_items = wrong\n @wm.phase = wmsPhase\n appoint_id = session[\"current_appointment\"].to_f\n if(!appoint_id.blank?)\n ev_test = EvaluationTest.find_by_name(\"wms\")\n app = AppointmentPlan.where(:appointment_id => appoint_id, :evaluation_test_id => ev_test.id)\n @wm.appointment_plan_id = app.first.id \n end\n\n respond_to do |format|\n if @wm.save\n if wmsPhase == 1\n format.html { redirect_to new_wms_result_path, notice: 'WMS II - Sequencia Letra-Numero guardada com sucesso.' }\n else\n session[\"wms_phase\"] = nil\n if session[\"test_sequence\"].blank?\n appID = session[\"current_appointment\"]\n session[\"current_appointment\"] = nil\n format.html { redirect_to :controller => \"evaluation_results\", :action => \"new\" , :appID => appID}\n else\n format.html { redirect_to appointment_plans_path, notice: 'WMS II - Sequencia Espacial Direta guardada com sucesso.' }\n end\n end\n format.json { render json: @wm, status: :created, location: @wm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse_assessments\n # Assessments elements are E15 and E16. There would be just one E15 and\n # many E16 elements. Sort E16 element clusters by time E16_03, and the\n # first one would be Initial Assessment. The single E15 element is always\n # part of the initial assessment, so it will need to be combined with the\n # earliest E16.\n e15_clusters = parse_cluster('E15')\n e15_initial_assessment = e15_clusters.shift if e15_clusters\n\n e16_clusters = parse_clusters('E16_00_0')\n if e16_clusters\n e16_clusters = e16_clusters.sort_by { |c| Time.parse(c.sub_element('03')) rescue Time.now }\n e16_initial_assessment = e16_clusters.shift\n end\n\n initial_assessment_node = Nokogiri::XML::Node.new(\"E15_E16\", xml_doc)\n initial_assessment_node.add_child e15_initial_assessment.xml_doc.root if e15_initial_assessment\n initial_assessment_node.add_child e16_initial_assessment.xml_doc.root if e16_initial_assessment\n\n initial_assessment = Nemsis::Parser.new(initial_assessment_node.to_s)\n\n assessments = [initial_assessment, e16_clusters].flatten\n\n assessments\n end",
"def update\n respond_to do |format|\n if @mx_assessment.update(mx_assessment_params)\n format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mx_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @post_fall_assessment = current_business.post_fall_assessments.order(created_at: :desc).paginate(:page => params[:page])\n end"
] | [
"0.654014",
"0.65046763",
"0.6496168",
"0.64294016",
"0.64194286",
"0.64194286",
"0.64124846",
"0.63261026",
"0.63075066",
"0.630401",
"0.62905586",
"0.62109745",
"0.62109745",
"0.6176865",
"0.6148356",
"0.6141864",
"0.61344635",
"0.60541433",
"0.60263157",
"0.6018596",
"0.60100496",
"0.60091037",
"0.60015166",
"0.5995793",
"0.59806925",
"0.5963364",
"0.5918793",
"0.5918793",
"0.59126335",
"0.58813274",
"0.58775735",
"0.5864869",
"0.5852719",
"0.58476055",
"0.58442533",
"0.5840024",
"0.5833766",
"0.5816536",
"0.58109707",
"0.5802424",
"0.5798219",
"0.5780142",
"0.5767116",
"0.5719291",
"0.5718312",
"0.5715179",
"0.5699496",
"0.5690521",
"0.56858563",
"0.5671718",
"0.56673306",
"0.56637466",
"0.5657498",
"0.5649878",
"0.5643251",
"0.56319934",
"0.5619062",
"0.56073713",
"0.56005204",
"0.55854577",
"0.55658615",
"0.55583227",
"0.55583227",
"0.5553592",
"0.55510384",
"0.5536903",
"0.55188733",
"0.55174863",
"0.5514592",
"0.5512062",
"0.5510036",
"0.55085915",
"0.55070263",
"0.5503037",
"0.55027735",
"0.55009013",
"0.54942876",
"0.5491065",
"0.54909045",
"0.5482838",
"0.5480157",
"0.54783434",
"0.54696494",
"0.5458259",
"0.5456628",
"0.5450853",
"0.5450481",
"0.545032",
"0.54441154",
"0.54417044",
"0.5435826",
"0.5423824",
"0.54175866",
"0.5417368",
"0.54100704",
"0.54095024",
"0.54008734",
"0.54004145",
"0.53832626",
"0.5381621"
] | 0.6864484 | 0 |
PATCH/PUT /mx_assessments/1 PATCH/PUT /mx_assessments/1.json | def update
respond_to do |format|
if @mx_assessment.update(mx_assessment_params)
format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @mx_assessment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @assessment = Assessment.find(params[:id])\n\n respond_to do |format|\n if @assessment.update_attributes(params[:assessment])\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assessment.update(assessment_params)\n format.html { redirect_to @assessment, notice: 'Assessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment }\n else\n format.html { render :edit }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assessment.update(assessment_params)\n format.html { redirect_to @assessment, notice: 'Assessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment }\n else\n format.html { render :edit }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @skill_assessment.update(skill_assessment_params)\n format.html { redirect_to @skill_assessment, notice: 'Skill assessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @skill_assessment }\n else\n format.html { render :edit }\n format.json { render json: @skill_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_set.update(exam_set_params)\n format.html { redirect_to @exam_set, notice: 'Exam set was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_set }\n else\n format.html { render :edit }\n format.json { render json: @exam_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calculated_data_assessment = CalculatedDataAssessment.find(params[:id])\n\n respond_to do |format|\n if @calculated_data_assessment.update_attributes(params[:calculated_data_assessment])\n format.html { redirect_to @calculated_data_assessment, notice: 'Calculated data assessment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calculated_data_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to exams_path, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_exam = MyExam.find(params[:id])\n\n respond_to do |format|\n if @my_exam.update_attributes(params[:my_exam])\n format.html { redirect_to @my_exam, notice: 'My exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assessment.update(assessment_params)\n format.html { redirect_to [@course, @assessment], notice: 'Attempt was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment }\n else\n format.html { render :edit }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assessment.update(assessment_params)\n format.html { redirect_to [@course, @assessment], notice: 'Attempt was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment }\n else\n format.html { render :edit }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render nothing: true\n# respond_to do |format|\n# if @assessment.update(assessment_params)\n# format.html { redirect_to @assessment, notice: 'Assessment was successfully updated.' }\n# format.json { render :show, status: :ok, location: @assessment }\n# else\n# format.html { render :edit }\n# format.json { render json: @assessment.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def update\n @curriculum_assessment = CurriculumAssessment.find(params[:id])\n\n respond_to do |format|\n if @curriculum_assessment.update_attributes(params[:curriculum_assessment])\n format.html { redirect_to @curriculum_assessment, notice: 'Curriculum assessment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curriculum_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_subject_evaluation = @test_subject.test_subject_evaluations.find(params[:id])\n\n #Check if symptoms and past_medical is empty\n if !params.has_key?(:symptoms)\n @test_subject_evaluation.symptoms = []\n end\n if !params.has_key?(:past_medical)\n @test_subject_evaluation.past_medical = []\n end\n\n respond_to do |format|\n if @test_subject_evaluation.update_attributes(params[:test_subject_evaluation])\n flash[:notice] = \"#{TestSubject.title} Evaluation was successfully updated.\"\n format.html { redirect_to(test_subject_test_subject_evaluation_url(@test_subject, @test_subject_evaluation)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_subject_evaluation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_outcome.update(api_v1_outcome_params)\n format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_outcome }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_outcome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @risk_assessment.update(risk_assessment_params)\n format.html { redirect_to @risk_assessment, notice: 'Risk assessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @risk_assessment }\n else\n format.html { render :edit }\n format.json { render json: @risk_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pain_assessment.author_id = current_user.id\n\n respond_to do |format|\n if @pain_assessment.update(pain_assessment_params)\n format.html { redirect_to app_pain_assessments_path, notice: 'PainAssessment was successfully updated.' }\n format.json { render :show, status: :ok, location: @pain_assessment }\n else\n format.html { render :edit }\n format.json { render json: @pain_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assessment_info.update(assessment_info_params)\n format.html { redirect_to edit_concept_url(@assessment_info.concept_id), notice: 'assessment_info was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment_info }\n else\n format.html { render :edit }\n format.json { render json: @assessment_info.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n respond_to do |format|\n if @examquestion.update(examquestion_params)\n format.html { redirect_to @examquestion, notice: 'Examquestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @examquestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to course_exams_url(@exam.course_id), notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assessment = Assessment.find(params[:id])\n authorize! :update, @assessment\n @assessment.last_editor = current_user\n\n respond_to do |format|\n if @assessment.update_attributes(params[:assessment])\n format.html { redirect_to @assessment, notice: 'Assessment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @analyst = Analyst.find(params[:id])\n\n if @analyst.update(params[:analyst])\n head :no_content\n else\n render json: @analyst.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def update\n @assessment = Content.find(params[:id])\n if current_user.role.id == 7\n params[:assessment][:status] = 6\n end\n respond_to do |format|\n if @assessment.update_attributes(params[:assessment])\n if @assessment.status == 6\n Content.send_message_to_est(current_user.center.est,current_user,@assessment)\n end\n format.html { redirect_to @assessment, notice: 'Assessment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assessment_course = AssessmentCourse.find(params[:id])\n\n respond_to do |format|\n if @assessment_course.update_attributes(params[:assessment_course])\n format.html { redirect_to @assessment_course, notice: 'Assessment course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assessment_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @first_exam.update(first_exam_params)\n format.html { redirect_to @first_exam, notice: 'First exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @first_exam }\n else\n format.html { render :edit }\n format.json { render json: @first_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_assessment.update_attributes(params[:chiropractic_assessment])\n format.html { redirect_to @chiropractic_assessment, notice: 'Chiropractic assessment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n params[:assessment] = {} if !params[:assessment]\n @assessment = Assessment.find(params[:id])\n respond_to do |format| # Update is restricted to the following 4 fields\n if @assessment.update_attributes({:grade => params[:assessment][:grade], :comment_header => params[:assessment][:comment_header], \n :comment_text => params[:assessment][:comment_text], :published => params[:assessment][:published]})\n flash[:notice] = 'Assessment was successfully updated.'\n format.html { redirect_to(@assessment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @assessment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_subject.update(exam_subject_params)\n format.html { redirect_to @exam_subject, notice: 'Exam subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_subject }\n else\n format.html { render :edit }\n format.json { render json: @exam_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #raise params.inspect\n @evaluation_result = EvaluationResult.find(params[:id])\n\n if params[:commit].to_s == \"Gravar Rascunho\"\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Em Avaliacao\")\n app.appointment_status = s\n app.save\n else\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Realizada\")\n app.appointment_status = s\n app.save\n end\n\n respond_to do |format|\n if @evaluation_result.update_attributes(params[:evaluation_result])\n if params[:commit].to_s == \"Gravar Rascunho\"\n format.html { redirect_to appointments_path, notice: 'Resultados da avaliacao guardados com sucesso.' }\n else\n format.html { redirect_to \"http://localhost:8000/reporting?report=Avaliacao&Appointment_Id=#{params[:appoint_id].to_s}\", notice: 'Resultados da avaliacao guardados com sucesso.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluation_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @assertion.update(assertion_params)\n format.html { redirect_to @assertion, notice: 'Assertion was successfully updated.' }\n format.json { render :show, status: :ok, location: @assertion }\n else\n format.html { render :edit }\n format.json { render json: @assertion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @skill_set = SkillSet.find(params[:id])\n\n respond_to do |format|\n if @skill_set.update_attributes(params[:skill_set])\n format.html { redirect_to @skill_set, notice: 'Skill set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @skill_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_mx_assessment\n @mx_assessment = MxAssessment.find(params[:id])\n end",
"def update\n @research_appointment = ResearchAppointment.find(params[:id])\n\n respond_to do |format|\n if @research_appointment.update_attributes(params[:research_appointment])\n format.html { redirect_to @research_appointment, notice: 'Research appointment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @research_appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @physician.update(survey_params)\n head :no_content\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end",
"def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_management.update(exam_management_params)\n format.html { redirect_to @exam_management, notice: 'Exam management was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_management }\n else\n format.html { render :edit }\n format.json { render json: @exam_management.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @test_guide_scenario_sa.update(test_guide_scenario_sa_params)\n render status: :ok, json: @test_guide_scenario_sa\n else\n self.send(:edit)\n end\n end",
"def update\n @assessment = @department.assessments.find(params[:id])\n respond_to do |format|\n if @assessment.update(assessment_params)\n flash[:notice] = \"Aspek Penilaian berhasil diubah, #{undo_link(@assessments)}\"\n format.js\n else\n format.js { render action: 'edit' }\n end\n end\n end",
"def update\n @assignment = Assignment.find(params[:assignment_id])\n @essay = Essay.find(params[:id])\n \n respond_to do |format|\n if @essay.update_attributes(params[:essay])\n format.html { redirect_to assignment_essay_url(@essay.assignment_id, @essay.id), notice: 'Essay was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @essay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @skill = Skill.find(params[:id])\n\n if @skill.update(skill_params)\n head :no_content\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n respond_to do |format|\n if @rand_exam.update(rand_exam_params)\n @rand_exam.cache_paper_reset\n format.html { redirect_to xmt_test_exams_path, notice: '编辑成功.' }\n format.json { render :show, status: :ok, location: @rand_exam }\n else\n format.html { render :edit }\n format.json { render json: @rand_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @random_exam.update(random_exam_params)\n format.html { redirect_to @random_exam, notice: 'Random exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @random_exam }\n else\n format.html { render :edit }\n format.json { render json: @random_exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.json { render json: @workflow, :layout => false }\n else\n #format.json { render json: @workflow.errors, status: :unprocessable_entity, :layout => false }\n end\n end\n end",
"def update\n update_init(@written_exam)\n respond_to do |format|\n if @written_exam.update(written_exam_params)\n format.html { redirect_to @written_exam, notice: 'Written exam was successfully updated.' }\n format.json { render :show, status: :ok, location: @written_exam }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def update\n respond_to do |format|\n if @farm_practice_typology.update(farm_practice_typology_params)\n format.html { redirect_to @farm_practice_typology, notice: 'Farm practice typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @farm_practice_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam_option = ExamOption.find(params[:id])\n\n respond_to do |format|\n if @exam_option.update_attributes(params[:exam_option])\n format.html { redirect_to @exam_option, notice: 'Exam option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_requirement = EventRequirement.find(params[:id])\n\n if @event_requirement.update(event_requirement_params)\n head :no_content\n else\n render json: @event_requirement.errors, status: :unprocessable_entity\n end\n end",
"def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @assert = Assert.find(params[:id])\n\n respond_to do |format|\n if @assert.update_attributes(params[:assert])\n format.html { redirect_to @assert, notice: 'Assert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_appointment = TestAppointment.find(params[:id])\n\n respond_to do |format|\n if @test_appointment.update_attributes(params[:test_appointment])\n format.html { redirect_to @test_appointment, notice: 'Test appointment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_student.update(exam_student_params)\n format.html { redirect_to @exam_student, notice: 'Exam student was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_student }\n else\n format.html { render :edit }\n format.json { render json: @exam_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @exam\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_setting.update(exam_setting_params)\n format.html { redirect_to exam_settings_path, notice: 'Exam setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_setting }\n else\n format.html { render :edit }\n format.json { render json: @exam_setting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_mark.update(exam_mark_params)\n format.html { redirect_to @exam_mark, notice: 'Exam mark was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_mark }\n else\n format.html { render :edit }\n format.json { render json: @exam_mark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_skill_assessment\n @skill_assessment = SkillAssessment.find(params[:id])\n end",
"def update\n @outcome_analysis = OutcomeAnalysis.find(params[:id])\n\n respond_to do |format|\n if @outcome_analysis.update_attributes(params[:outcome_analysis])\n format.html { redirect_to(@outcome_analysis, :notice => 'Outcome analysis was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @outcome_analysis.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @education_service_provided_typology.update(education_service_provided_typology_params)\n format.html { redirect_to @education_service_provided_typology, notice: 'Education service provided typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @education_service_provided_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assert = Assert.find(params[:id])\n\n respond_to do |format|\n if @assert.update_attributes(params[:assert])\n format.html { redirect_to @assert, notice: 'Assert was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @question_localized = QuestionLocalized.find(params[:id])\n\n respond_to do |format|\n if @question_localized.update_attributes(params[:question_localized])\n flash[:notice] = 'QuestionLocalized was successfully updated.'\n format.html { redirect_to(@question_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_localized.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @s = Script.find(params[:script_id], :include => [:questions])\n @interview = Interview.find(params[:id])\n\n if @interview.update_attributes(interview_params)\n render :text => 'Interview Saved'\n else\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end",
"def update\n @admin_skill = Admin::Skill.find(params[:id])\n\n if @admin_skill.update(admin_skill_params)\n head :no_content\n else\n render json: @admin_skill.errors, status: :unprocessable_entity\n end\n end",
"def update\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @introexam.update(introexam_params)\n format.html { redirect_to @introexam, notice: 'Introexam was successfully updated.' }\n format.json { render :show, status: :ok, location: @introexam }\n else\n format.html { render :edit }\n format.json { render json: @introexam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admission.update_attributes(admission_params)\n end",
"def update\n respond_to do |format|\n if @skillset.update(skillset_params)\n format.html { redirect_to @skillset, notice: 'Skillset was successfully updated.' }\n format.json { render :show, status: :ok, location: @skillset }\n else\n format.html { render :edit }\n format.json { render json: @skillset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #debugger\n if @enrollment.update(update_params)\n head :no_content\n else\n render json: @enrollment.errors, status: :unprocessable_entity\n end\n end",
"def update\n @survey_choice = Survey::Choice.find(params[:id])\n\n respond_to do |format|\n if @survey_choice.update_attributes(params[:survey_choice])\n format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_choice.errors, status: :unprocessable_entity }\n5 end\n end\n end",
"def update\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n if @exercise_set.update_attributes(params[:exercise_set])\n format.html { redirect_to @exercise_set.workout, notice: 'Exercise set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questionset.update(questionset_params)\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionset }\n else\n format.html { render :edit }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n flash[:notice] = 'Exam was successfully updated.'\n format.html { redirect_to(@exam) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exam.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @analyst_score.update(analyst_score_params)\n format.html { redirect_to @analyst_score, notice: 'Analyst score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @analyst_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render_json_auto @survey.update_logic_control_rule(params[:id].to_i, params[:logic]) and return\n end",
"def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end",
"def update\n respond_to do |format|\n if @thesis_examination.update(thesis_examination_params)\n format.html { redirect_to @thesis_examination, notice: 'Thesis examination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thesis_examination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @studentset = Studentset.find(params[:id])\n\n respond_to do |format|\n if @studentset.update_attributes(params[:studentset])\n format.html { redirect_to @studentset, notice: 'Studentset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @studentset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless @edit_or_delete_right\n redirect_to exams_url,notice:\"您无权修改别人编写的考试\"\n end\n parsed_param=exam_params\n @exam.questions.delete_all\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if @exam.update(parsed_param)\n format.html { redirect_to @exam, notice: \"已成功更新考试“#{@exam.name}.”\" }\n format.json { render :show, status: :ok, location: @exam }\n else\n format.html { render :edit }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to quiz_path(@question.subsection_id), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n base_params = subject_params.select {|k,v| k != \"discipline\"}\n base_params.each_pair do |property,value|\n @subject.send(property+'=',value)if @subject.respond_to?(property+'=')\n end\n @subject.discipline= Discipline.find(subject_params[:discipline][:id])\n if @subject.save\n set_subject\n #respond_with @subject\n render json: @subject, status: :ok\n else\n ##render json: @subject.errors, status: :unprocessable_entity\n respond_with @subject.errors, status: :unprocessable_entity\n end\n end",
"def update\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n if current_user.role.id == 7\n params[:assessment_practice_test][:status] = 6\n end\n respond_to do |format|\n if@assessment_practice_test.update_attributes(params[:assessment_practice_test])\n format.html { redirect_to@assessment_practice_test, notice: 'AssessmentPracticeTest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@assessment_practice_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n # workflow_attributes = workflow_params\n # step_definitions_attributes = workflow_attributes.delete(\"step_definitions\")\n\n # StepDefinition.updateStepDefinitions(step_definitions_attributes)\n\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to root_url, notice: 'Survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_assessment\n @client = Client.find(params[:client_id])\n @assessment = @client.assessments.find(params[:id])\n end",
"def update\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n if @student_major.update_attributes(student_major_params)\n format.html { redirect_to @student_major, notice: 'Student major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_set = TestSet.find(params[:id])\n permitted_to! :update, @test_set.problem\n respond_to do |format|\n if @test_set.update_attributes(permitted_params)\n format.html { redirect_to @test_set, :notice => 'Test set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.6719616",
"0.6617438",
"0.6617438",
"0.65201426",
"0.6473369",
"0.6460596",
"0.6320895",
"0.63081264",
"0.6291418",
"0.62753546",
"0.62753546",
"0.6273983",
"0.62729067",
"0.6255384",
"0.6230215",
"0.6220069",
"0.62059736",
"0.61603636",
"0.61448586",
"0.613961",
"0.61267924",
"0.61266834",
"0.6116698",
"0.6106853",
"0.60982794",
"0.60982794",
"0.60982794",
"0.60982794",
"0.60884136",
"0.607233",
"0.60631186",
"0.6063068",
"0.6058822",
"0.60550505",
"0.60491544",
"0.6045317",
"0.6026245",
"0.6021655",
"0.6020408",
"0.60043585",
"0.59959704",
"0.59919786",
"0.59911555",
"0.59854496",
"0.5974338",
"0.59610647",
"0.59610426",
"0.59421426",
"0.5930051",
"0.5929593",
"0.5919352",
"0.58992696",
"0.58991617",
"0.5896732",
"0.58943224",
"0.5892635",
"0.5881448",
"0.587231",
"0.5855694",
"0.584683",
"0.58414024",
"0.5836294",
"0.58351916",
"0.5835108",
"0.58347493",
"0.58320713",
"0.5830284",
"0.5828462",
"0.5825394",
"0.5824871",
"0.5824203",
"0.5812397",
"0.5805912",
"0.5803462",
"0.58016807",
"0.5795912",
"0.5792341",
"0.5791754",
"0.579026",
"0.5784364",
"0.57828414",
"0.57809764",
"0.5775122",
"0.57714784",
"0.5770924",
"0.57688457",
"0.57687074",
"0.57671547",
"0.57632",
"0.57610714",
"0.5759933",
"0.57534075",
"0.5753016",
"0.57440984",
"0.5736881",
"0.5734916",
"0.5734704",
"0.5732907",
"0.57303625",
"0.57300746"
] | 0.7248259 | 0 |
DELETE /mx_assessments/1 DELETE /mx_assessments/1.json | def destroy
@mx_assessment.destroy
respond_to do |format|
format.html { redirect_to mx_assessments_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @assessment = Assessment.find(params[:id])\n @assessment.destroy\n \n respond_to do |format|\n format.html { redirect_to(assessments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calculated_data_assessment = CalculatedDataAssessment.find(params[:id])\n @calculated_data_assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to calculated_data_assessments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to assessments_url, notice: 'Assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to assessments_url, notice: 'Assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to assessments_url, notice: 'Assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curriculum_assessment = CurriculumAssessment.find(params[:id])\n @curriculum_assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to curriculum_assessments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment = Content.find(params[:id])\n @assessment.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to assessments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @assessment = @department.assessments.find(params[:id])\n @assessment.destroy\n respond_to do |format|\n flash[:notice] = \"Aspek Penilaian berhasil dihapus, #{undo_link(@assessments)}\"\n format.html { redirect_to assessments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment = Assessment.find(params[:id])\n authorize! :destroy, @assessment\n\n @assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to assessments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n @chiropractic_assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to chiropractic_assessments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @skill_assessment.destroy\n respond_to do |format|\n format.html { redirect_to skill_assessments_url, notice: 'Skill assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment = Assessment.find(params[:id])\n @assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to course_assessments_url(@course), notice: 'Attempt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to course_assessments_url(@course), notice: 'Attempt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_set.destroy\n respond_to do |format|\n format.html { redirect_to exam_sets_url, notice: 'Exam set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pain_assessment.destroy\n respond_to do |format|\n format.html { redirect_to app_pain_assessments_path, notice: 'PainAssessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment_criterion_detail.destroy\n respond_to do |format|\n format.html { redirect_to assessment_criterion_details_url, notice: 'Assessment criterion detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fullassessment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @risk_assessment.destroy\n respond_to do |format|\n format.html { redirect_to risk_assessments_url, notice: 'Risk assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assertion.destroy\n respond_to do |format|\n format.html { redirect_to assertions_url, notice: 'Assertion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @disc_assessment.destroy\n respond_to do |format|\n format.html { redirect_to disc_assessments_url, notice: 'Disc assessment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thesis_examination.destroy\n respond_to do |format|\n format.html { redirect_to thesis_examinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_category = ExamCategory.find(params[:id])\n @exam_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_outcome.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_outcomes_url, notice: 'Outcome was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment_olympiad = AssessmentOlympiad.find(params[:id])\n @assessment_olympiad.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to assessment_olympiads_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @examination = Examination.find(params[:id])\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to examinations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n render_json_auto @survey.delete_logic_control_rule(params[:id].to_i) and return\n end",
"def destroy\n @essay = Essay.find(params[:id])\n @essay.destroy\n\n respond_to do |format|\n format.html { redirect_to assignment_essays_path(params[:assignment_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @first_exam.destroy\n respond_to do |format|\n format.html { redirect_to first_exams_url, notice: 'First exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assumption.destroy\n respond_to do |format|\n format.html { redirect_to assumptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to course_exams_url(@exam.course_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_management.destroy\n respond_to do |format|\n format.html { redirect_to exam_managements_url, notice: 'Exam management was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @random_exam.destroy\n respond_to do |format|\n format.html { redirect_to random_exams_url, notice: 'Random exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n @assessment_practice_test.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to AssessmentPracticeTest_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @exam_option = ExamOption.find(params[:id])\n @exam_option.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_options_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @analyst_score.destroy\n respond_to do |format|\n format.html { redirect_to analyst_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_goal_evaluation.destroy\n respond_to do |format|\n format.html { redirect_to student_goal_evaluations_url, notice: 'Evalueringen er slettet.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @analysis = Analysis.find(params[:id])\n @analysis.destroy\n\n respond_to do |format|\n format.html { redirect_to analyses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment_insti_test = AssessmentInstiTest.find(params[:id])\n @assessment_insti_test.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to assessment_insti_test_url }\n format.json { head :ok }\n end\n end",
"def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end",
"def destroy\n @assessment_info.destroy\n respond_to do |format|\n format.html { redirect_to edit_concept_url(@assessment_info.concept_id), notice: 'assessment_info was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @exam_subject.destroy\n respond_to do |format|\n format.html { redirect_to exam_subjects_url, notice: 'Exam subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_student.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Odjavili ste ispit.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to patient_url(@patient), notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assessment.destroy\n respond_to do |format|\n format.html { redirect_to user_group_path(@user, @group) }\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 @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to @examination.project }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @introexam.destroy\n respond_to do |format|\n format.html { redirect_to introexams_url, notice: 'Introexam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farm_practice_typology.destroy\n respond_to do |format|\n format.html { redirect_to farm_practice_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n#status_url(Status.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:user_id => current_user)\n #@protocol = user_id.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:question_id => @title_questions).first.string_value\n p= ResponseSet.where(:access_code => params[:id])\n p.first.destroy\n \n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_service_provided_typology.destroy\n respond_to do |format|\n format.html { redirect_to education_service_provided_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weekly_expectation = WeeklyExpectation.find(params[:id])\n @weekly_expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to weekly_expectations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @analysis.destroy\n respond_to do |format|\n format.html { redirect_to analyses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admintreatmentmechanical.destroy\n respond_to do |format|\n format.html { redirect_to admintreatmentmechanicals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answer_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_question_item = SurveyQuestionItem.find(params[:id])\n @survey_question_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_question_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_set = ExerciseSet.find(params[:id])\n @exercise_set.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @skillset.destroy\n respond_to do |format|\n format.html { redirect_to skillsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t\t\n\t\t\t\tTestimony.find(params[:id]).destroy\n\n\t\t\t\trender json: nil,status: 200\n\t\t\t\n\t\t\tend",
"def destroy\n @skillset.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Skillset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteAssignment\n @assignment = Assignment.find(params[:assignment_id])\n @assignment.destroy\n respond_to do |format|\n format.html {redirect_to add_objective_to_student_path, notice: 'Assignment was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n \n end",
"def destroy\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n @disciplines_study.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to disciplines_studies_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_setting.destroy\n respond_to do |format|\n format.html { redirect_to exam_settings_url, notice: 'Exam setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_test = StudentTest.find(params[:id])\n @student_test.destroy\n\n respond_to do |format|\n format.html { redirect_to student_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @goldmeasure.destroy\n respond_to do |format|\n format.html { redirect_to goldmeasures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim_sequence = GoSlimSequence.find(params[:id])\n @go_slim_sequence.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slim_sequences_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medical_test.destroy\n respond_to do |format|\n format.html { redirect_to medical_tests_url, notice: 'Medical test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_set = QuestionSet.find(params[:id])\n @question_set.destroy\n\n respond_to do |format|\n format.html { redirect_to question_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stage_drymass = StageDrymass.find(params[:id])\n @stage_drymass.destroy\n\n respond_to do |format|\n format.html { redirect_to stage_drymasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @studentset = Studentset.find(params[:id])\n @studentset.destroy\n\n respond_to do |format|\n format.html { redirect_to studentsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_check.destroy\n respond_to do |format|\n format.html { redirect_to inventory_checks_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7253281",
"0.7213956",
"0.72096723",
"0.72096723",
"0.72096723",
"0.7161355",
"0.7115042",
"0.71034145",
"0.7083008",
"0.70772076",
"0.7067445",
"0.7062281",
"0.70368093",
"0.70368093",
"0.6972591",
"0.69507694",
"0.693111",
"0.69080406",
"0.6896912",
"0.6860689",
"0.6858754",
"0.6831068",
"0.68137723",
"0.68129015",
"0.677915",
"0.6775822",
"0.67680067",
"0.67131174",
"0.6692406",
"0.6683383",
"0.6682554",
"0.66732365",
"0.6665183",
"0.6663091",
"0.6661983",
"0.6648997",
"0.6645792",
"0.6643288",
"0.66337323",
"0.66315484",
"0.66291463",
"0.6627594",
"0.6624465",
"0.66223377",
"0.66223377",
"0.66223377",
"0.66184735",
"0.66000724",
"0.65944517",
"0.6584371",
"0.657905",
"0.65749186",
"0.6550618",
"0.6548249",
"0.65395683",
"0.653836",
"0.65324",
"0.65300965",
"0.65209776",
"0.6520022",
"0.6519793",
"0.6519455",
"0.65147954",
"0.6512507",
"0.65033674",
"0.6501121",
"0.6500283",
"0.6499431",
"0.6499133",
"0.6499133",
"0.6491714",
"0.6489204",
"0.6488455",
"0.6485436",
"0.64793116",
"0.64780396",
"0.64779705",
"0.6470163",
"0.6462197",
"0.64581925",
"0.6457594",
"0.6455958",
"0.645464",
"0.6449009",
"0.64405817",
"0.64404696",
"0.6440188",
"0.6440188",
"0.64398515",
"0.6438207",
"0.6437625",
"0.6429695",
"0.6428626",
"0.64275897",
"0.64212847",
"0.64212847",
"0.64212847",
"0.64212847",
"0.64212847",
"0.6416692"
] | 0.7893751 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_mx_assessment
@mx_assessment = MxAssessment.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def mx_assessment_params
# params[:mx_assessment]
params.require(:mx_assessment).permit(:danger_yn, :drugs_last_changed,
:drugs_not_why, :drugs_change_why, :psychsoc_last_changed,
:psychsoc_not_why, :psychsoc_change_why, :meeting_date, :patient_id,
:pre_date_yesno, :pre_date_no_why, :pre_date, :updated_by,
:site, :new_date, :date_history)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
Adds a new plane to the game by adding it to list of planes | def add_plane()
planes << Plane.new(
gen_location,
0,
width,
height,
gen_speed(),
true
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_plane(plane)\n @planes << plane\n end",
"def add_section_plane(plane)\n end",
"def add new_planet\n @planets << new_planet\n end",
"def add_planet(planet_to_add)\n @planets << planet_to_add\n end",
"def has_plane(plane)\n @planes.include?(plane)\n end",
"def add_planet(planet)\n @planet << planet\n end",
"def setup_add_plane\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 3\n file = @acts[1]\n sox = @acts[2] # Scroll X\n soy = @acts[3] # Scroll Y \n z = (@acts[4] ? Graphics.height + 10 : 4)\n dur = @acts[5] || 2\n opac = @acts[6] || 255\n get_spriteset.battle_plane.set(file,sox,soy,z,dur,opac)\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def create_battle_planes\n @battle_plane = Battle_Plane.new(@viewport1)\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(new_planet)\n @planets << new_planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets << planet\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n @planets.push(planet)\n end",
"def add_planet(planet)\n\t\t@planets << planet\n\tend",
"def create\n @plane = Plane.new(params[:plane])\n\n respond_to do |format|\n if @plane.save\n format.html { redirect_to @plane, notice: 'Plane was successfully created.' }\n format.json { render json: @plane, status: :created, location: @plane }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plane.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_new_planet(new_planet)\n @planets.push(new_planet)\n end",
"def add_planets\n get_list_of_planets.each {|planet| Planet.new(planet)} \n end",
"def initilize land_planes=[] #collection of planes\n\t\t@land_planes = land_planes\n\tend",
"def planet_add(planet)\n @planets.push(planet)\n return @planets\n end",
"def planet_add(planet)\n @planets.push(planet)\n return @planets\n end",
"def add_planet(new_planet)\n return @planets << new_planet\n end",
"def add_planet_object(new_planet_object)\n @planets_collection.push(new_planet_object)\n end",
"def landing (plane)\n\t\tfail 'This plane has already landed' if plane.flying? == false\n\t\tfail 'The airport is full. No landings are possible.' if full?\n\t\tplane = plane.landed?\n\t\t@planes << plane\n\t\tputs 'Your flight has landed'\n\n\tend",
"def add_planet(new_planet)\n @planets.push(new_planet)\n return @planets\n end",
"def add_planet(planet_obj)#parameter\n @planets_list.push(planet_obj)#push method with argument of \"planet_object\"\n puts \"You just added the planet #{planet_obj.name} to the #{\"Juice Box Solar System\"}.\" #what is planet_obj here? hwhere is it pointing?\n end",
"def allow_landing(plane)\n\t\traise \"This Airport is full\" if full?\n\t\traise \"This flight cannot land due to weather conditions\" if weather_stormy?\n\t\t# check your language, landed sounds like a question rather than a command\n\t\t# what about \"land!\" ?\n\t\tplane.landed!\n\t\t@planes << plane\n\tend",
"def acquire_new_plane(aircrafttype)\n home_airport = self.home_airport_game\n param_array = [aircrafttype,self,home_airport]\n new_plane = PlaneCreator.new(param_array).manufacture\n finalize_acquisition_and_save(new_plane)\n end",
"def add_player()\n @players.push(players)\n end",
"def add_planet\n planet = Planet.new(get_planet_name, get_planet_distance, get_planet_rotation, get_planet_moons)\n return planet\nend",
"def add_planet(planet)\n # planets = @planets.map { |i| i.name.downcase }\n if @planets.include?(planet.name.downcase)\n raise ArgumentError.new(\"Planet already exists. A solar system cannot have duplicate planets\")\n end\n @planets.push(planet)\n end",
"def add_planets(planets)\n planets.each do |planet|\n @planets.push(planet)\n end\n end",
"def addBackgroundPlane(sprites,planename,background,viewport=nil)\n sprites[planename]=AnimatedPlane.new(viewport)\n bitmapName=pbResolveBitmap(\"Graphics/Pictures/#{background}\")\n if bitmapName==nil\n # Plane should exist in any case\n sprites[planename].bitmap=nil\n sprites[planename].visible=false\n else\n sprites[planename].setBitmap(bitmapName)\n for spr in sprites.values\n if spr.is_a?(Window)\n spr.windowskin=nil\n end\n end\n end\nend",
"def add_player(new_player)\n @players << new_player\n end",
"def add_planet(new_planet)\n new = 0\n @array_of_planets.each do |each_planet|\n if each_planet.name == new_planet.name\n new += 1\n end\n end\n if new == 0\n @array_of_planets << new_planet\n else\n puts \"That planet is already in the solar system!\"\n end\n end",
"def add_game game\n @game_objects.push game\n update_record game\n end",
"def addBackgroundOrColoredPlane(sprites,planename,background,color,viewport=nil)\n bitmapName=pbResolveBitmap(\"Graphics/Pictures/#{background}\")\n if bitmapName==nil\n # Plane should exist in any case\n sprites[planename]=ColoredPlane.new(color,@viewport)\n else\n sprites[planename]=AnimatedPlane.new(viewport)\n sprites[planename].setBitmap(bitmapName)\n for spr in sprites.values\n if spr.is_a?(Window)\n spr.windowskin=nil\n end\n end\n end\nend",
"def add_new_player(new_player)\n players.push(new_player)\n end",
"def plane\n end",
"def add_new_player(new_player)\n @players.push(new_player)\n end",
"def initialize (capacity=DEFAULT_CAPACITY)\n\tplane = Plane.new\n\t@planes = [] \n\t@capacity = capacity\n\tend",
"def add_new_player(new_player)\n @players.push(new_player)\nend",
"def all_planes\n self.planes.collect do |plane_obj|\n plane_obj.update_status_and_location\n end\n end",
"def plane_params\n params.require(:plane).permit(:name, :model, :year, :description, :matricula, :status)\n end",
"def add_player(id)\n\t\t@players[id]=Player.new\n\tend",
"def add_planet_object(new_planet_object)\n @solar_system.push(new_planet_object)\n end",
"def zone_add(zone,member)\n obj_add(zone,Zone,member)\n end",
"def add_planets(planet)\n @planets << planet\n return @planets\n end",
"def add_planet_by_name(name)\n planet = get_space_body_by_name(name)[0]\n Planet.new(planet)\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_points(*@vertices[0..2])\n end",
"def add_player_to_players(player)\n players.push(player)\n end",
"def new\n @plane = Plane.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plane }\n end\n end",
"def add_planet\n\t\tputs \"Would you like to add a planet? Enter Y/N\".colorize(:blue)\n\t\tanswer = gets.chomp.downcase\n\t\tif answer == \"y\"\n\t\t\tputs \"Great! Please enter the name of planet.\"\n\t\t\tname = gets.chomp\n\t\t\tputs \"Now enter the diameter of your planet.\"\n\t\t\tdiameter = gets.chomp\n\t\t\tputs \"What is the mass of your new planet?\"\n\t\t\tmass = gets.chomp\n\t\t\tputs \"How many moons?\"\n\t\t\tmoons = gets.chomp\n\t\t\tputs \"Is there life on your planet? Please enter \\\"Y\\\" or \\\"N\\\".\"\n\t\t\tlife = gets.chomp.downcase\n\t\t\t\tif life == \"y\"\n\t\t\t\t\tlife = true\n\t\t\t\telse \n\t\t\t\t\tlife = false\n\t\t\t\tend\n\t\t\tputs \"Finally, what is the solar rotation of your planet?\"\n\t\t\trotation = gets.chomp\n\t\t\t@new_planet = Planet.new(name: name, diameter: diameter, mass: mass, moons: moons, life: life, rotation: rotation)\n\t\t\t@planets.push(new_planet)\n\t\t\tputs \"Great! #{name} is born!\".colorize(:blue)\n\t\telse\n\t\t\tputs \"Fine. I didn't want your planets anyway.\".colorize(:blue)\n\t\tend\n\tend",
"def add_list_of_planets(list_of_planets)\n list_of_planets.each do |planet|\n @planets.push(planet)\n end\n end",
"def add_tab(*args)\n tabs << args\n end",
"def add_member_to_card\n @trello.add_commander_to_card(find_member, @card)\n end",
"def create\n @airplane = Airplane.new(params[:airplane])\n\n respond_to do |format|\n if @airplane.save\n format.html { redirect_to @airplane, :notice => 'Airplane was successfully created.' }\n format.json { render :json => @airplane, :status => :created, :location => @airplane }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @airplane.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_point(player)\n end",
"def add_card(card)\n raise \"invalid placement!\" unless valid_placement?(card)\n @store << card\n end",
"def add(o)\n really_added = false\n oh = o.hash\n unless @hash.key?(oh)\n really_added = true\n @hash[oh] = o\n @plans << o\n end\n really_added \n end",
"def add_player(player)\n @players[@players.count + 1] = player\n end",
"def add_player player\n p = player_by_id(player.id)\n if !p\n @players << player\n elsif p.name != player.name\n p.name = player.name\n end\n end",
"def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end",
"def add_player(player_name)\n player = Player.new(player_name)\n $players << player\n end",
"def new_planet(planet)\n @planets[planet.name] = planet\n end",
"def add_card(card)\n \t@cards << card\n end",
"def add_player(name)\n @players.push(name)\n end",
"def create\n @typeairplane = Typeairplane.new(typeairplane_params)\n\n respond_to do |format|\n if @typeairplane.save\n format.html { redirect_to @typeairplane, notice: 'Typeairplane was successfully created.' }\n format.json { render :show, status: :created, location: @typeairplane }\n else\n format.html { render :new }\n format.json { render json: @typeairplane.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_card(card)\n @cards << card\n end",
"def add_card(card)\n @cards << card\n end",
"def add_player(player_name)\n player = Player.new(player_name, 3)\n @players.push(player)\n end",
"def add card\n @cards.push card\n end",
"def add card\r\n @card_list.add card\r\n end",
"def is_on_plane?(plane)\n plane.substitute(self) == 0\n end",
"def add_layer\n puts \"made it to PL add layer\"\n Layer.create(:name => @new_table_name, :table_name => @new_table_name, :geometric_column_name => \"the_geom\")\n end",
"def add_card(new_card)\n cards.push(new_card)\n end",
"def addPoint( x, y) \n point = PVector.new(x, y)\n @points.push(point)\n end",
"def take_off (plane)\n\t\tfail 'This plane has already departed' if plane.flying? == true\n\t\tplane = plane.departed?\n\t\t@planes[@planes.size - 1] = true\n\t\t@planes.delete(true)\n\t\tputs 'Your flight has departed'\n\tend",
"def add_card(new_card)\n self.cards.append(new_card)\n end",
"def add card\n @card_list.add card\n end",
"def add card\n @card_list.add card\n end",
"def add card\n @card_list.add card\n end",
"def add(object)\n @objects << object\n end",
"def create\n @plane_picture = PlanePicture.new(plane_picture_params)\n\n respond_to do |format|\n if @plane_picture.save\n format.html { redirect_to @plane_picture, notice: 'Plane picture was successfully created.' }\n format.json { render :show, status: :created, location: @plane_picture }\n else\n format.html { render :new }\n format.json { render json: @plane_picture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_zone!(name)\n zone = add_zone(name)\n zone.save!\n zone\n end",
"def add_player(name)\n\t\t@Player << name\n\t\tend",
"def add_player(name)\n\t\t@Player << name\n\t\tend",
"def addPiece(piece)\n @pieces[@pieces.count] = piece\n end",
"def add_layer_object( object )\n layers.push( object )\n end",
"def add_wagon(wagon)\n @wagon_list << wagon if speed.zero? && wagon.type == type\n end",
"def distance_to_plane(plane)\n end",
"def add_card(card)\n @cards.push(card)\n end"
] | [
"0.86730474",
"0.70779675",
"0.665445",
"0.6471242",
"0.6463104",
"0.6445174",
"0.6429574",
"0.6427971",
"0.6399423",
"0.63953304",
"0.63953304",
"0.63953304",
"0.63953304",
"0.6339624",
"0.6339624",
"0.6339624",
"0.6339624",
"0.6339624",
"0.63251245",
"0.63251245",
"0.63251245",
"0.63251245",
"0.6314696",
"0.6262072",
"0.6225003",
"0.61874557",
"0.6131137",
"0.61146975",
"0.61146975",
"0.6054732",
"0.6033115",
"0.5995749",
"0.5993657",
"0.5988511",
"0.5935166",
"0.58827984",
"0.58470595",
"0.57982755",
"0.5790383",
"0.5732002",
"0.57246727",
"0.567317",
"0.5669325",
"0.56445813",
"0.5626399",
"0.56207657",
"0.5605762",
"0.5543772",
"0.5535389",
"0.5533644",
"0.55117667",
"0.5508731",
"0.5490712",
"0.54564893",
"0.54550874",
"0.5453797",
"0.5449564",
"0.5421594",
"0.5419888",
"0.5417883",
"0.5417799",
"0.5403991",
"0.53728855",
"0.533055",
"0.53113043",
"0.52895296",
"0.52656317",
"0.52654725",
"0.52406615",
"0.5239663",
"0.52281207",
"0.52054715",
"0.5191036",
"0.5181639",
"0.51720554",
"0.5171316",
"0.5167265",
"0.5167265",
"0.51655006",
"0.51552105",
"0.5147767",
"0.5141314",
"0.5141294",
"0.5127841",
"0.51272666",
"0.51199824",
"0.5109054",
"0.510347",
"0.510347",
"0.510347",
"0.5099122",
"0.50991005",
"0.50937706",
"0.50873655",
"0.50873655",
"0.5082913",
"0.5078498",
"0.50769854",
"0.50733227",
"0.50564075"
] | 0.8479238 | 1 |
Generates a random speed for a plane | def gen_speed
rand + 15.0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_turn deg\n rand(deg) - (deg/2)\n end",
"def change_speed\n @statistics[:speed_changes] += 1\n # pick a coordination to change speed for\n @changed_coord = @coordinations.rand\n @previous_speed = @current_speed[@changed_coord]\n @current_speed[@changed_coord] = @previous_speed + SPEED_CHANGE_OPTIONS.rand\n delta_eval(@changed_coord)\n end",
"def random\n CYCLE * rand\nend",
"def rand_direction\n rand*2-1\n end",
"def random_angle\n 360 * rand\n end",
"def initialize(distance, diameter)\n @distance = distance\n @diameter = diameter\n @theta = 0\n @orbit_speed = rand(-0.01 .. 0.01) \n end",
"def random_typhoon_generator\n\n #Normal Typhoon\n r = rand(50) #Currently: 1/50 chance\n if (r%49 == 0)\n sz = rand(3)\n sX = rand(40-12) + 12\n sY = rand(12-1) + 1\n dX = rand(10-3) + 3\n dY = rand(2-1) + 1\n typhoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n addObject(typhoon1)\n end\n #Strong Typhoon\n r = rand(90) #Currently: 1/90 chance\n if (r%89 == 0)\n sz = 3\n sX = rand(46-12) + 12\n sY = rand(12-1) + 1\n dX = rand(11-3) + 3\n dY = rand(2-1) + 1\n typhoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n addObject(typhoon1)\n end\n end",
"def random_typhoon_generator\n\t\t\n\t\t#Normal Typhoon\n\t\tr = rand(50) #Currently: 1/50 chance\n\t\tif(r%49 == 0)\n\t\tsz = rand(3)\n\t\tsX = rand(40-12) + 12\n\t\tsY = rand(12-1) + 1\n\t\tdX = rand(10-3) + 3\n\t\tdY = rand(2-1) + 1\n\t\ttyphoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n\t\taddObject(typhoon1)\n\t\tend\n\t\t#Strong Typhoon\n\t\tr = rand(90) #Currently: 1/90 chance\n\t\tif(r%89 == 0)\n\t\tsz = 3\n\t\tsX = rand(46-12) + 12\n\t\tsY = rand(12-1) + 1\n\t\tdX = rand(11-3) + 3\n\t\tdY = rand(2-1) + 1\n\t\ttyphoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n\t\taddObject(typhoon1)\n\t\tend\n\tend",
"def set_rand()\n rdm = Random.new()\n @step = rdm.rand(1..10) * 100\n @rate = rdm.rand(1.2..3.0) \n end",
"def generate\n #create random number generator\n rng = Random.new\n @points = Array.new\n\n #num_points times, make random value in ranges \n @num_points.times do\n @points << [rng.rand(@x_lims), rng.rand(@y_lims)]\n end\n end",
"def rand_point()\n \n end",
"def random_restart\n @controllers.each{|sc| @current_offset[sc] = rand(@current_cycle_time || sc.cycle_time)}\n if @change_probability[:speed].nonzero?\n @coordinations.each do |coord|\n @current_speed[coord] = coord.default_speed + SPEED_CHANGE_OPTIONS_WITH_ZERO.rand\n end\n end\n full_evaluation # all coordinations change, must do full reevaluation\n end",
"def rand\n return @location + @scale * rand_std_ratio_method\n end",
"def run\n @speed = 5\n end",
"def random\n 1 + (10 * rand(0))\n end",
"def move_type_random\r\n case rand(6)\r\n when 0..3 then move_random\r\n when 4 then move_forward\r\n when 5 then @stop_count = 0\r\n end\r\n end",
"def real_move_speed\r\n @move_speed + (dash? ? 1 : 0)\r\n end",
"def effect\r\n particle_count = rand(15) + 50\r\n particle_count.times.collect do\r\n # inherit speed from asteroid, and add random velocity\r\n particle_speed = rand * 10 - 5\r\n life = rand(60) + 120\r\n random_speed = speed_delta(rand * 360, particle_speed)\r\n random_speed.y *= 0.5\r\n speed = random_speed + @speed\r\n # create a new single particle\r\n Effect.new @window, life , @vector, speed\r\n end\r\n end",
"def move_type_random\n case rand(6)\n when 0 then move_random\n when 1 then move_random\n when 2 then move_forward\n when 3 then move_forward\n when 4 then move_forward\n when 5 then @stop_count = 0\n end\n end",
"def rand_point()\n len= Math.sqrt(rand)*@r;\n deg= rand*2*Math::PI;\n x= @x+len*Math.cos(deg);\n y= @y+len*Math.sin(deg);\n [x, y]\n end",
"def move(type = :unknown)\n\t\tmovement = rand(MOVEMENT_AMOUNTS[type])\n\t\t@distance += movement\n\t\tmovement.abs\n\tend",
"def direction_with_smoothing_fuzz\n @direction + rand*smoothing - smoothing/2\n end",
"def speed\n 4\n end",
"def move_type_random\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Random\n move_random\n when 4 # 1 step forward\n move_forward\n when 5 # Temporary stop\n @stop_count = 0\n end\n end",
"def move_type_random\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Random\n move_random\n when 4 # 1 step forward\n move_forward\n when 5 # Temporary stop\n @stop_count = 0\n end\n end",
"def add_plane()\n planes << Plane.new(\n gen_location,\n 0,\n width,\n height,\n gen_speed(),\n true\n )\n end",
"def random_float\n rand * rand(10)\n end",
"def random_movement(distance, delay)\n @movement_options[:moving] = true\n # Random direction\n dir = %w(up down left right)[rand(4)]\n # Move between 0 and 2 steps\n steps = rand(3)\n steps.times do\n turn(dir.intern)\n step(distance)\n end\n sleep delay\n @movement_options[:moving] = false\n end",
"def next\n Time.now + @min + Random.rand(@max - @min)\n end",
"def get_random floor, ceiling\n rand(floor..ceiling)\nend",
"def random\n new(one.random())\n end",
"def first_turn(pokemon1, pokemon2)\n if pokemon1.base_stats[:speed] > pokemon2.base_stats[:speed]\n 1\n elsif pokemon1.base_stats[:speed] == pokemon2.base_stats[:speed]\n rand(1..2)\n else\n 2\n end\n end",
"def roll\n rand(1..@sides)\n end",
"def real_move_speed\r\r\n return @move_speed + (dash? ? 1 + ($game_variables[11]/100) + @dash_speed_bonus : 0)\r\r\n end",
"def random_duration\n min_duration + rand(max_duration - min_duration + 1)\n end",
"def random_coord(min, max)\n rand * (max-min) + min\nend",
"def speed\n end",
"def initialize(freq = DEFAULT_UPDATE_FREQUENCY, clip = DEFAULT_CLIPPING_PLANE)\n @clipping_plane = clip\n @dxs = rand(20) - 10 # X-axis movement per wall second.\n @dys = rand(20) - 10 # Y-axis movement per wall second.\n @dzs = rand(200) * 2 # Z-axis movement per wall second.\n set_random_position\n \n super(freq) # We have to do this last since a +Thread+ will be created that needs our instance variables instantiated.\n end",
"def spawn(random, length, values)\n Individual.new(Array.new(length) { random.rand(values) })\nend",
"def gen_moon(method_map)\n text = \"//#{method_map[\"class\"]} function: #{method_map[\"name\"]}\nvar #{method_map[\"indexed_name\"]} = new Celestial({\n name: \\\"#{method_map[\"indexed_name\"]}\\\",\n geometry: new THREE.SphereGeometry(#{method_map[\"radius\"]+0.01}, 8, 8),\n material: new THREE.MeshLambertMaterial({emissive: 0x888888, color: 0xbb8800, map: planet_texture}),\n origin: #{method_map[\"class\"]},\n orbitradx: #{(Random.rand(2) == 0)? \"\" : \"-\"}#{method_map[\"orbit\"]}, \n orbitrady: #{(Random.rand(2) == 0)? \"\" : \"-\"}#{method_map[\"orbit\"]}, \n #{(Random.rand(2) == 0)? \"ysin: false\" : \"xsin:false\"},\n rotx: 0.01, \n roty: 0.01, \n rotz: 0.01,\n tfactor: #{2 + Random.rand * 2}});\ncelestials[celestials.length] = #{method_map[\"indexed_name\"]};\\n\\n\"\n return text\nend",
"def random_cost\n rand(1..10)\nend",
"def uniform(a, b)\n a + rand()*(b-a)\nend",
"def randomize_directions(directions)\n directions.shuffle\n end",
"def generateFirepower()\n return (rand(2.0..4.0))\nend",
"def gen_planet(class_map)\n class_map[\"colour\"] = PLANET_COLOURS[class_map[\"type\"].downcase]\n text = \"//#{class_map[\"package\"]} class: #{class_map[\"name\"]}\n#{class_map[\"indexed_name\"]}.setValues({\n name: \\\"#{class_map[\"indexed_name\"]}\\\",\n geometry: new THREE.SphereGeometry(#{class_map[\"radius\"]+0.01}, 10, 10),\n material: new THREE.MeshLambertMaterial({emissive: 0x888888, color: #{class_map[\"colour\"]}, map: planet_texture}),\n origin: #{class_map[\"package\"]}, \n orbitradx: #{(Random.rand(2) == 0)? \"\" : \"-\"}#{class_map[\"orbit\"]}, \n orbitrady: #{(Random.rand(2) == 0)? \"\" : \"-\"}#{class_map[\"orbit\"]}, \n #{(Random.rand(2) == 0)? \"ysin: false\" : \"xsin:false\"},\n rotx: 0.01, \n roty: 0.01, \n rotz: 0.01,\n tfactor: #{1 + Random.rand}});\ncelestials[celestials.length] = #{class_map[\"indexed_name\"]};\\n\\n\"\n return text\nend",
"def generate()\n\t\t# first generate at least one star\n\t\t\n\t\tcx = centerX\n\t\tcy = centerY\n\t\tstarPos = randomLocation(cx, cy, SolarSystemRadius)\n\t\tstar = generateNewCelestialBody(starPos[0], starPos[1], 'star')\n\t\t\n\t\t# possibly another star\n\t\tif rand < ProbabilitySecondStar\n\t\t\tstarPos2 = randomDistantPosition\n\t\t\tstar2 = generateNewCelestialBody(starPos2[0], starPos2[1], 'star')\n\t\tend\n\t\t\n\t\tnumPlanets = Random.rand(MedianNumPlanets-NumPlanetsVariation...MedianNumPlanets+NumPlanetsVariation)\n\t\tnumPlanets.times do\n\t\t\tplanetPos = randomDistantPosition\n\t\t\tplanet = generateNewCelestialBody(planetPos[0], planetPos[1], 'planet')\n\t\tend\n\tend",
"def start\n @speed = 10\n end",
"def random_point\n while true\n x = rand(0...@p)\n yy = (x**3 + @a*x + @b) % @p\n y = yy.sqrtmod(@p)\n if y\n if rand(2) == 0\n return [x, y]\n else\n return [x, @p-y]\n end\n end\n end\n end",
"def setSpeed(value)\r\n @speed = value\r\n end",
"def initialize w\n self.w = w\n\n self.x, self.y = rand(w.w), rand(w.h)\n self.a = 0.0\n self.ga = 0.0\n self.m = 0.0\n end",
"def initialize\n @offset = rand(0...BOUNDARY)\n end",
"def roll\n rand(sides)+1\n end",
"def random_weapon\n weapons = [\"sword\",\"bow and arrow\",\"laser gun\",\"Jungle Sword\",\"Lunar Cue\",\"Crimson Blaster\",\"Quake Hammer\",\"Drive Vortex\",\"Drive Defender\",\" Road Blaster\",\"Turbo Axe\",\"Rocket Blaster \"]\n weapon = weapons[rand(weapons.length)]\nend",
"def get_wheel_reward\r\n\t\t\t\t\t\t\t\treturn rand(@wheel.length)\r\n\t\t\t\t\t\tend",
"def random_point_change\n if (@count % 2 == 0)\n @random_points = rand(100)\n else\n @random_points = @random_points\n end\n end",
"def jet_accelerate\n @speed = get_speed * 2\n end",
"def random(*args); end",
"def getSpeed _obj, _args\n \"_obj getSpeed _args;\" \n end",
"def initialize(x, y, args)\n speed_values = args.state.speed_values\n @x_vel = speed_values[rand(speed_values.length)]\n @y_vel = speed_values[rand(speed_values.length)]\n @truex = x - @x_vel\n @truey = y - @y_vel\n @w = 10\n @h = 10\n @x = x - (@w / 2)\n @y = y - (@h / 2)\n @r = 255\n @g = 255\n @b = 255\n @a = 2558\n @path = 'sprites/black.png'\n args.outputs.static_sprites << self\n end",
"def speed_of_spread\n if @population_density >= 200\n speed = 0.5\n else @population_density < 200\n multiplier = (@population_density/50).floor\n speed = 2.5 - (multiplier * 0.5)\n end\n end",
"def plane\n end",
"def speed_of_spread #in months\n speed = case @population_density\n when (0..49) then 2.5\n when (50..99) then 2 \n when (100..149) then 1.5 \n when (150..199) then 1\n else 0.5\n end\n end",
"def target_angular_speed\n 360 * BOT_MAX_SPEED / (2 * Math::PI * target_distance)\n end",
"def get_random()\n \n end",
"def get_random()\n \n end",
"def speed\n @rp.speed\n end",
"def normal_speed(speed,takeoff_speed)\n return speed/takeoff_speed\nend",
"def random\n Run.offset(rand(Run.count)).first || Run.new(id: 0)\n end",
"def set_speed(input_speed)\n @speed = input_speed * MULTIPLIER\n end",
"def time_rand from = 0.0, to = Time.now\n Time.at(from + rand * (to.to_f - from.to_f))\nend",
"def time_rand from = 0.0, to = Time.now\n Time.at(from + rand * (to.to_f - from.to_f))\nend",
"def get_random_shape\n shapes = [@t, @h_line, @v_line, @l, @square]\n shapes.sample\n end",
"def create_child\n Walker.new(x, y, direction + 2*rand(2) - 1)\n end",
"def get_random_orientation\n rand(0..3)\n end",
"def simulate_roll(min = 1, max = 5)\n rand(max)\nend",
"def random_y\n Random.new.rand((0.0)..(max_y))\n end",
"def generate_random_vector(param)\r\n random_vector = Array.new(@length) { Array.new(@teams) { rand } } # Generate matrix of random values\r\n random_vector.each do |x|\r\n x.each do |y|\r\n # If the value is higher than the\r\n # threshold, put the specified probability there\r\n y = y > param[0] ? param[1] : 0\r\n end\r\n end\r\n random_vector\r\n end",
"def door_num\n\t\treturn rand(3)\n\tend",
"def belllcurve(y)\n x = 0\n y.times do\n x += rand(0..1)\n end\n x\nend",
"def belllcurve(y)\n x = 0\n y.times do\n x += rand(0..1)\n end\n x\nend",
"def rand\n Kernel.rand(self)\n end",
"def testrandom\n zplay \"e 0..11\"\n sleep 0.5\n zplay \"e (0..11)~\"\n sleep 0.5\n zplay \"e ( (100,1000) :3)<r>\"\n sleep 0.5\n zplay \"e (0..2)<m>\"\n sleep 0.5\n zplay \"e (0..6)?\"\n sleep 0.5\n zplay \"e (0..6)?2\"\n sleep 0.5\n zplay \"e (0..6)~2*2\"\n sleep 0.5\n zplay \"e ((0,6))+1*2/3%7\"\n sleep 0.5\n zplay \"e (w q q e e)<>((1000,4000))\"\n sleep 0.5\n zplay \"e (w q q e e e)<>(0..8)\"\n sleep 0.5\n zplay \"e (w q q e e e)<>(0..8)~\"\n sleep 0.5\n zplay \"q (q e e)<>(: 100..1000 :3)?5$\"\n sleep 0.5\n zplay \"(q e e)<>(: 100..1000 :3)?5&\"\n sleep 0.5\n zplay \"(e q e)<>(: 0..4 :4)~2+1*3\"\n\nend",
"def setup_stats\r\n randomnums = Random.new\r\n $strength += randomnums.rand(1...100)\r\n $wealth += randomnums.rand(1...100)\r\nend",
"def walk\n @speed = 2\n end",
"def mine_real(random)\n if @max_real.zero?\n 0\n else\n real = random.rand(@max_real + 1)\n real\n end\n end",
"def random\n rand - rand\nend",
"def initialize\n srand\n end",
"def simulate_roll(min = 1, max = 7)\n rand(max) + min\nend",
"def speed_of_light\n Constants.ratio(1, -1)\n end",
"def next_move_time\n delay = random.rand.clamp(1, 7)\n Time.current.to_f + delay\n end",
"def randomizer\n self.level * (rand(10))\n end",
"def setup_castle\r\n randomnums = Random.new\r\n zero_out\r\n treasures_allot\r\n terrors_allot\r\n set_at_room(4,6, 100 + randomnums.rand(1...100))\r\n set_at_room(16,6, 100 + randomnums.rand(1...100))\r\nend",
"def roll\n return rand(@sides) + 1 ## roll_value = rand(@sides) + 1\n end",
"def roll\n return rand(@sides) + 1 ## roll_value = rand(@sides) + 1\n end",
"def speed=(value)\n\t\t\t@speed = value\n\t\tend",
"def rand(max=0) end",
"def next_duration\n @durations.empty? ? rand(20) : @durations.shift\n end",
"def generate_random_attribute_rule( size )\n r = []\n size.times { r << rand.round }\n r\nend",
"def generate_random_attribute_rule( size )\n r = []\n size.times { r << rand.round }\n r\nend",
"def walk\n @speed = @speed + (0.2 * @legs)\n end"
] | [
"0.6065477",
"0.6058937",
"0.59434384",
"0.59357816",
"0.58834004",
"0.5849826",
"0.5834848",
"0.5790825",
"0.57825524",
"0.5653183",
"0.56463933",
"0.55252355",
"0.5501923",
"0.54777956",
"0.5468474",
"0.54295284",
"0.54108036",
"0.5394586",
"0.538887",
"0.5371247",
"0.5365508",
"0.5350106",
"0.5343364",
"0.5321276",
"0.5293313",
"0.52906233",
"0.5289238",
"0.5288675",
"0.52844447",
"0.52419764",
"0.52415735",
"0.523447",
"0.52322733",
"0.52303433",
"0.5225288",
"0.52189636",
"0.52168316",
"0.5209076",
"0.52003676",
"0.519892",
"0.5197631",
"0.5191217",
"0.51832646",
"0.51812065",
"0.5175965",
"0.51633006",
"0.51530147",
"0.5140676",
"0.513848",
"0.5126704",
"0.51259655",
"0.51193404",
"0.5113115",
"0.5111769",
"0.508302",
"0.5073424",
"0.5071854",
"0.50700504",
"0.50617194",
"0.5059566",
"0.50586736",
"0.5051419",
"0.50469375",
"0.5043954",
"0.5043954",
"0.5043111",
"0.5038936",
"0.5038064",
"0.5034351",
"0.50236845",
"0.50236845",
"0.50213474",
"0.50166285",
"0.5011327",
"0.5003988",
"0.4998247",
"0.4992739",
"0.4991285",
"0.49805382",
"0.49805382",
"0.4979645",
"0.4978922",
"0.49660134",
"0.49640992",
"0.4963895",
"0.49600458",
"0.49591944",
"0.49486208",
"0.49469122",
"0.4943763",
"0.49387965",
"0.49319834",
"0.49313426",
"0.49313426",
"0.493112",
"0.49257588",
"0.49248612",
"0.4924053",
"0.4924053",
"0.4920601"
] | 0.72153455 | 0 |
Checks to see if you can place a plane so that this x coordinate does not collide horizontally with any plane | def can_place(position)
planes.none? do |plane|
plane.wings.in_horizontal_range(BoundingBox.new(position, position + width, 0, 0))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on_plane?(plane)\n plane.substitute(self) == 0\n end",
"def validation(x, y)\n if(x >= plane[0].length || x < 0)\n puts \"invalid start or end point on across direction\"\n return false\n end\n if(y >= plane.length || y < 0)\n puts \"invalid start or end point on down direction\"\n return false\n end\n return true\n end",
"def can_place? x, y\n x >= 0 and x < @max_x and y >= 0 and y < @max_y and !object_at?(x, y)\n end",
"def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end",
"def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end",
"def has_plane(plane)\n @planes.include?(plane)\n end",
"def valid?(x, y)\n x >= 0 && x < MAX_WIDTH && y >= 0 && y < MAX_HEIGHT\n end",
"def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end",
"def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end",
"def valid_place?(x_position, y_position)\n x_position.between?(0, @dimension) &&\n y_position.between?(0, @dimension)\n end",
"def valid_placement?\n\t\t@table.placed_on_table?(@x, @y) && @robot.vectors.include?(@robot_direction)\n\tend",
"def direction_valid?(x, y)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # checks if coordinates are valid\n return (x >= 0 && x < width * pix && y >= 0 && y < height * pix)\n end",
"def self_valid?(x, y)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # checks if coordinates are valid\n return (x >= 0 && x < width * pix - pix + 1 && y >= 0 && y < height * pix - pix + 1)\n end",
"def is_plane\n\t\t@angle == 0 || @angle == 180\n\tend",
"def contains_point(x,y,z)\n behind = true\n @planes.each{|p|\n behind = (0 >= p.distance_to_point(x,y,z))\n break if not behind\n }\n return behind\n end",
"def on_plane?(plane)\n end",
"def has_point(x, y)\n is_negative = (x < 0 or y < 0)\n is_greater_than_dimensions = (x > @width or y > @height)\n\n if is_negative or is_greater_than_dimensions\n result = false\n puts \"[#{x},#{y}] is Outside of Grid, Robot will ignore command\"\n else\n result = true\n end\n\n return result;\n end",
"def check_valid_position(xcoord, ycoord)\n\tif xcoord >= GRID_SIZE || xcoord < 0\n\t\treturn false\n\telsif ycoord >= GRID_SIZE || ycoord < 0\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def valid_board_coordinates?(x, y)\n x >= 0 && y >= 0 && x < 3 && y < 3\n end",
"def position_valid?(x, y)\n position_within_bounds?(x, y) && position_free?(x, y)\n end",
"def can_i_move?(x, y)\n x, y = x.to_i, y.to_i\n ( x >= 0 && x <= dimension.width ) && ( y >= 0 && y <= dimension.height )\n end",
"def check_grid_coordinates(x, y)\n (x >= 0) && (x < @height) && (y >= 0) && (y < @width)\n end",
"def can_place_wall?(wall)\n\t\treturn false if @walls.size >= $wall_max\n\t\twall.all_points.each{|point| return false if occupied?(point[:x], point[:y]) }\n\t\ttrue\n\tend",
"def is_out_of_boundary?(point)\n point.x < 0 || point.y < 0 || point.x >= @dimension || point.y >= @dimension\n end",
"def valid?(x, y)\n return (x >= 0 and x < width and y >= 0 and y < height)\n end",
"def legal(coords)\n row_dist = (@row - coords[0]).abs\n col_dist = (@column - coords[1]).abs\n if row_dist > 1 || col_dist > 1\n return false\n elsif check\n puts \"cant move into check\"\n return false\n else\n return occupied?(coords)\n end\n end",
"def land_ok?(x, y, d)\r\r\n if @type == :airship\r\r\n return false unless $game_map.airship_land_ok_rect?(x, y, collision_rect)\r\r\n return false unless $game_map.events_xy_rect(x, y, collision_rect).empty?\r\r\n else\r\r\n x2 = $game_map.round_x_with_direction(x, d)\r\r\n y2 = $game_map.round_y_with_direction(y, d)\r\r\n return false unless $game_map.valid_rect?(x2, y2, collision_rect)\r\r\n return false unless $game_map.passable_rect?(x2, y2, reverse_dir(d), collision_rect)\r\r\n return false if collide_with_characters?(x2, y2)\r\r\n end\r\r\n return true\r\r\n end",
"def valid_placement?(ship, ship_coordinates)\n ((ship_coordinate_letters(ship, ship_coordinates).count == 1 &&\n neighbor_comparison?(ship, ship_coordinates)) ||\n (ship_coordinate_numbers(ship, ship_coordinates).count == 1 &&\n neighbor_comparison?(ship, ship_coordinates))) &&\n occupied_coordinate_check?(ship, ship_coordinates) == true\n end",
"def valid_placement?(ship, coords)\n size_check(ship, coords) && cons_check(coords) && ship_check(coords)\n end",
"def is_move_allowed(to_x,to_y) #Checks to see if the move is allowed based on the pieces 'rule'\n allowed=false\n \n x_diff=(to_x-@x).abs\n y_diff=(to_y-@y).abs\n \n if x_diff <=1 && y_diff <=1\n allowed= true\n end\n if x==to_x && y==to_y\n allowed = false\n end\n\n return allowed\n end",
"def has_planes?\t\t\n\t\t!@planes.empty?\n\tend",
"def check_space (potential_x_pos, potential_y_pos, battlefield)\r\n whitespace = [[0,1], [1,0], [0,-1], [-1,0], [1,1], [-1,1], [1,-1], [-1, -1]]\r\n if potential_x_pos > 0 && potential_x_pos < 11 && potential_y_pos > 0 && potential_y_pos < 11 && battlefield[potential_x_pos][potential_y_pos] == 0\r\n for i in 0..7\r\n check_x_position = potential_x_pos + whitespace[i][0];\r\n check_y_position = potential_y_pos + whitespace[i][1];\r\n if check_x_position > 0 && check_x_position < 11 && check_y_position > 0 && check_y_position < 11 && battlefield[check_x_position][check_y_position] == 1\r\n return false\r\n end\r\n end\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def collide_with_vehicles?(x, y)\r\r\n $game_map.boat.pos_rect_nt?(x, y, collision_rect) || $game_map.ship.pos_rect_nt?(x, y, collision_rect)\r\r\n end",
"def on_the_table?\n !!(x && y && facing)\n end",
"def collide_point?(x,y)\n nself = normalize()\n x.between?(nself.left,nself.right) && y.between?(nself.top,nself.bottom)\n end",
"def out_of_bounds?(x, y)\n x < 0 || y < 0 || x > @width - 1 || y > @height - 1\n end",
"def position_is_valid?(position)\r\n position.x < @col &&\r\n position.y < @row &&\r\n position.x >= 0 &&\r\n position.y >= 0\r\n end",
"def restricted?(x, y)\n out_of_bounds?(x, y) || @image.color(x, y) == 0\n end",
"def placed?\n x != nil && y != nil && orientation != nil\n end",
"def collide_with_vehicles?(x, y)\r\n $game_map.boat.pos_nt?(x, y) || $game_map.ship.pos_nt?(x, y)\r\n end",
"def valid_placement?(x, y)\n if (0..@height).include?(x) && (0..(@width-1)).include?(y)\n return true\n else\n return false\n end\n end",
"def on_table?(x,y)\n (0 <= x && x < GRID_X) && (0 <= y && y < GRID_Y)\n end",
"def move_valid?(x, y)\n (0...@width).cover?(x) && (0...@height).cover?(y) && !@visited[x][y]\n end",
"def rover_in_bounds?(coordinate_x, coordinate_y)\n coordinate_x <= boundary_x && coordinate_y <= boundary_y && coordinate_x >= 0 && coordinate_y >= 0\n end",
"def position_is_valid?(position)\n position.x < @length &&\n position.y < @width &&\n position.x >= 0 &&\n position.y >= 0\n end",
"def out_of_bounds?(x, y)\n x >= (Game::Width - Game::Padding) || x <= (0 + Game::Padding) || y >= (Game::Height - Game::Padding) || y <= (0 + Game::Padding)\n end",
"def collide_with_characters?(x, y)\r\n collide_with_events?(x, y) || collide_with_vehicles?(x, y)\r\n end",
"def valid_position?(x, y)\n !negative_positions?(x, y) && positions_inside_table?(x, y)\n end",
"def valid_position?(x, y)\n !!(x && y && x > 0 && y > 0 && x <= 8 && y <= 8)\n end",
"def can_be_placed?(x, y)\n return false unless (0..(rows - 1)).include?(x)\n return false unless (0..(columns - 1)).include?(y)\n\n true\n end",
"def is_in_limits? coordinate\n\t\t((coordinate[0][0] < @width) && (coordinate[0][1] < @height) && (coordinate[1][0] < @width) && (coordinate[1][1] < @height))\n\tend",
"def valid?\n @x.is_a?(Integer) &&\n @y.is_a?(Integer) &&\n orientation_set?\n end",
"def safe_position?(x, y)\n x >= 0 &&\n x <= @max_x &&\n y >= 0 &&\n y <= @max_y &&\n !@registered_positions.include?([x, y])\n end",
"def collide_with_player_characters?(x, y)\r\r\n normal_priority? && $game_player.collide_rect?(x, y, collision_rect)\r\r\n end",
"def safe_position?(x, y)\n x >= 0 &&\n x <= 4 &&\n y >= 0 &&\n y <= 4\n end",
"def collide_with_vehicles?(x, y)\r\r\n (@vehicle_type != :boat && $game_map.boat.pos_rect_nt?(x, y, collision_rect)) || (@vehicle_type != :ship && $game_map.ship.pos_rect_nt?(x, y, collision_rect))\r\r\n end",
"def pos?(x, y)\n (width.include?(x) && height.include?(y)) ||\n occupied_spaces.include?([x, y])\n end",
"def horizontalCollision?(bx, by, dx, dy)\n sx = dx - bx #p4.x - p3.x\n sy = dy - by #p4.y - p3.y\n\n #left\n coor = intersection(@x, @y, 0, @height, bx, by, sx, sy)\n return coor if coor.is_a?(Array)\n\n #right\n return intersection(@x+@width, @y, 0, @height, bx, by, sx, sy)\n end",
"def in_bounds?(x, y)\n x >= 0 && x < @grid_width && y >= 0 && y < @grid_height\n end",
"def valid_location(x, y)\n return (x >= 0) && (x < Settings.get_horizontal_size) && (y >= 0) && (y < Settings.get_vertical_size)\n end",
"def valid?\n sides.none?{|side| side <= 0} && legal?\n end",
"def move_valid?(x, y)\n (0...@columns).cover?(x) && (0...@rows).cover?(y) && !@visited[x][y]\n end",
"def is_safe_place?(x, y)\n x.between?(0, @width) and y.between?(0, @height)\n end",
"def is_accessible?(x, y)\n cell = @matrix[x, y]\n cell.type != Cell::TYPES[:wall]\n end",
"def collision_wireframe_visible?\n @debug_collision\n end",
"def collision_wireframe_visible?\n @debug_collision\n end",
"def hit_me? x, y\n if @orientation == 0\n if x != @rowStart || (y < @colStart && y > @colEnd)\n return false\n end\n elsif @orientation == 1\n if y != @colStart || ( x < @rowStart && x > @rowEnd)\n return false\n end\n end\n\n shrink_ship\n return true\n end",
"def is_wall(coords)\n !is_space(coords)\n end",
"def legal_placement?\n @sides.each{|side| return false if side.bug != false && side.bug.color? != self.color? }\n return true\n end",
"def check_horizontal(x_target, y_target)\n #left to right\n if coordinate_x < x_target\n (coordinate_x+1..x_target-1).each do |x|\n return true if is_occupied?(x, y_target)\n end\n return false\n end\n #righ to left\n if x_target < coordinate_x\n (x_target+1..coordinate_x-1).each do |x|\n return true if is_occupied?(x, y_target)\n end\n return false\n end\n end",
"def airship_land_ok_rect?(x, y, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n return false unless check_passage(x2, y2, 0x0800) && check_passage(x2, y2, 0x0f)\r\r\n return false unless check_passage(x2, y3, 0x0800) && check_passage(x2, y3, 0x0f)\r\r\n return false unless check_passage(x3, y2, 0x0800) && check_passage(x3, y2, 0x0f)\r\r\n return check_passage(x3, y3, 0x0800) && check_passage(x3, y3, 0x0f)\r\r\n end",
"def valid_coordinates?(x, y)\n (1..board_width).include?(x.to_i + 1) &&\n (1..board_height).include?(y.to_i + 1)\n end",
"def is_valid_move x,y\n return false unless (0..3) === x\n return false unless (0..3) === y\n return @field[x][y].player == 0\n end",
"def valid?(coordinates) ##this will need to check if the placement of coorindates is valid, sequential in row/number\n\t\thorizontal_valid?(coordinates) || vertical_valid?(coordinates)\n\tend",
"def piece_in_space?(x, y)\n pieces.where(position_x: x, position_y: y).any? ? true : false\n end",
"def move_valid?(x, y)\n coordinate_valid?(x, y) && !@visited[y][x]\n end",
"def move_valid?(x, y)\n coordinate_valid?(x, y) && !@visited[y][x]\n end",
"def no_forward_obstruction?(x_des, y_des)\n pieces_in_row = game.pieces.where(x_position: x_des)\n pieces_in_column = game.pieces.where(y_position: y_des) \n move_type(x_des, y_des) == 'vertical' &&\n pieces_in_column.where('y_position > ? AND y_position < ?',\n [self.y_position, y_des.to_i].min,\n [self.y_position, y_des.to_i].max).empty?\n end",
"def at_boundary?\n\t\tif @location.x == 0 || @location.x == @dimension-1 || @location.y == 0 || @location.y == @dimension-1\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def over_bound?(x, y)\n if (x != @x || y != @y) && $game_map.valid?(x, y)\n max_w = $game_map.max_width ; max_h = $game_map.max_height\n screen_x = $game_map.adjust_x(x) * 32 + 16\n screen_y = $game_map.adjust_y(y) * 32 + 32\n sx = (screen_x / 32).to_i; sy = (screen_y / 32).to_i\n if sx.between?(0 - out_offset, max_w + out_offset) && \n sy.between?(0 - out_offset, max_h + out_offset)\n \n return false\n end # sx, sy\n end # xy != @xy && map_valid\n return true\n end",
"def is_inbounds?(x, y)\n true unless y > @maze.max.size-1 or y < 0 or x > @maze.size-1 or x < 0\n end",
"def solid?(game_map, x, y)\r\n # puts \"X: \" + x.to_s + \" Y: \" + y.to_s # for debuging\r\n if(x < 0 || x > 240) # dosen't allow player to go out of side walls\r\n return true\r\n end\r\n\r\n if(y<0 ||game_map.tiles[y / 20][x / 20]==0)\r\n return false\r\n else \r\n return true\r\n end\r\n\r\nend",
"def ship_passable_rect?(x, y, rect)\r\r\n x2 = x + (rect.x / 32.0)\r\r\n y2 = y + (rect.y / 32.0)\r\r\n x3 = x2 + (rect.width / 32.0)\r\r\n y3 = y2 + (rect.height / 32.0)\r\r\n return false unless check_passage(x2, y2, 0x0400)\r\r\n return false unless check_passage(x2, y3, 0x0400)\r\r\n return false unless check_passage(x3, y2, 0x0400)\r\r\n return check_passage(x3, y3, 0x0400)\r\r\n end",
"def validate!\n [x, y, z].each { |c| return false if c == '' or c.nil? }\n sorted = [x.abs, y.abs, z.abs].sort\n if EXTRA_VALIDATION\n if x.abs >= 100 or y.abs >= 100 or z.abs >= 100\n self.problems << \"Invalid coordinate: at least one dimension >= 100.\"\n end\n if sorted[0] == 0 and sorted[1] == 0\n self.problems << \"At least two dimensions have value == 0; coordinate may not be real.\"\n end\n elsif x.abs >= 100 or y.abs >= 100 or z.abs >= 100 or sorted[0] == 0 and sorted[1] == 0\n return false\n end\n self\n end",
"def oor?(x, y=0, z=0)\n return true if x < 0 || y < 0 || z < 0\n return true if xsize <= x\n return true if ysize <= y if ysize > 0\n return true if zsize <= z if zsize > 0\n return false\n end",
"def can_move_to?(x, y)\n old_x = @object.x\n old_y = @object.y\n @object.move(x, y)\n\n unless @object_pool.world.can_move_to?(x, y)\n terrain = @object_pool.world.world[y][x]\n @object.stats.add_message(\"Bump into a #{terrain.id} #{terrain.symbol} (#{@object.x}, #{@object.y})\")\n return false\n end\n\n @object_pool.same_point_objects(@object.x, @object.y, @object).each do |obj|\n case obj\n when Character\n obj.on_collision(@object)\n return false\n when Item\n break if @object.input.is_a?(AiInput)\n\n obj.on_collision(@object)\n end\n end\n\n true\n ensure\n @object.move(old_x, old_y)\n end",
"def inbounds?(point)\n return false if point.x < 0\n return false if point.x >= @grid_width\n return false if point.y < 0\n return false if point.y >= @grid_height\n return true\n end",
"def can_place?(piece_variant, x, y)\n if(x+1 < piece_variant.width || y > @height - piece_variant.height)\n false\n else\n piece_variant.width.times do |wIdx|\n col = x - piece_variant.width + wIdx + 1\n piece_variant.height.times do |hIdx|\n return false if(@grid[col][y + hIdx] != 0 && piece_variant.configuration[wIdx][hIdx] != 0)\n end\n end\n true\n end\n end",
"def out_of_bounds?\n (0..@grid_size[0]).cover?(@coordinates[0]) &&\n (0..@grid_size[1]).cover?(@coordinates[1])\n end",
"def valid_coordinates?(x_coord, y_coord)\n (0..width).include?(x_coord) && (0..height).include?(y_coord)\n end",
"def is_safe(x, y, sol)\n return true if x >= 0 && x < 8 && y >= 0 && y < 8 && sol[x][y] == -1\n return false\nend",
"def pass_boundary_check?(coordinate)\n coordinate.each do |c|\n if c.is_i?\n if c < 0\n return false\n elsif c > @map.my_matrix.length-1\n return false\n elsif c > @map.my_matrix[0].length-1\n return false\n end\n end\n end\n true\n end",
"def victory?\n self.grid.flatten.select {|space| !space.mine }.\n all? {|space| space.visible }\n end",
"def collides?(other)\n !(\n @pos.x + width <= other.pos.x ||\n @pos.x >= other.pos.x + other.width ||\n @pos.y + height <= other.pos.y ||\n @pos.y >= other.pos.y + other.height\n )\n end",
"def collide(block)\n return (block.x == @x && block.y == @y)\n end",
"def outofBounds\n\t\tif @x > @window.width || @y > @window.height || @x < 0 || @y < 0 then\n\t\t\treturn true\n\t\tend\n\t\treturn false\n\tend",
"def valid_move?(x, y)\n return false if is_obstructed?(x, y)\n diagonal_move_left?(x, y) || diagonal_move_right?(x,y)\n \n end",
"def authorized?(letter, word, x, y)\n (0...self.size).member?(x) && (0...self.size).member?(y) && (@grid[x][y] == nil) &&\n @words.include?(word) && (/#{letter}/ =~ word)\n end",
"def attacking_horizontal?\n false\n end",
"def passable?(current_node)\r\n x = current_node.x\r\n y = current_node.y\r\n return (x >= 0 and x < WIDTH and y >= 0 and y < HEIGHT)\r\n end"
] | [
"0.70268404",
"0.6974505",
"0.68442583",
"0.66286796",
"0.66286796",
"0.662766",
"0.66256654",
"0.66153944",
"0.66153944",
"0.6595292",
"0.6530098",
"0.6432006",
"0.6413732",
"0.6376075",
"0.6351212",
"0.63475037",
"0.63427645",
"0.63180256",
"0.6294594",
"0.62927276",
"0.62880045",
"0.6286125",
"0.6228058",
"0.622684",
"0.6224221",
"0.6176169",
"0.6172934",
"0.61681634",
"0.61649585",
"0.6146649",
"0.61451083",
"0.61367637",
"0.6133836",
"0.6131367",
"0.6129595",
"0.61286813",
"0.6128214",
"0.61218715",
"0.6120093",
"0.6117559",
"0.61122674",
"0.61067224",
"0.61029327",
"0.6099834",
"0.6090946",
"0.6077943",
"0.6076932",
"0.60715014",
"0.6065185",
"0.60591304",
"0.6056048",
"0.60501647",
"0.60403824",
"0.60320956",
"0.60310835",
"0.6023805",
"0.6021621",
"0.6007346",
"0.6006456",
"0.60052645",
"0.59973",
"0.59915274",
"0.5980925",
"0.5978832",
"0.5974927",
"0.5974927",
"0.59702915",
"0.5966001",
"0.59635407",
"0.59584314",
"0.59568226",
"0.59435886",
"0.5942258",
"0.59369767",
"0.5916227",
"0.5908435",
"0.5908435",
"0.59079427",
"0.59051156",
"0.59042114",
"0.5903809",
"0.5903616",
"0.58790827",
"0.58711255",
"0.58653045",
"0.586481",
"0.58634824",
"0.5845395",
"0.58336455",
"0.58240014",
"0.579355",
"0.57925856",
"0.5792556",
"0.5791826",
"0.5790545",
"0.57876444",
"0.5787467",
"0.57820636",
"0.5778069",
"0.5762978"
] | 0.7207581 | 0 |
Generates a valid x position in a horizontal range that is not occupied by a current plane | def gen_location
while true do
position = rand(Avoid::SCREEN_W - height)
return position if can_place(position)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_x\n grid_width = @window.current_map.width\n half_x = WIDTH / 2 - GRID / 2\n @x = [[@player.x - half_x, 0].max, grid_width * GRID - WIDTH].min\n end",
"def min_x\n @pos.x\n end",
"def offset_x_position(offset)\n offset = offset % 32\n return if offset <= 0\n \n change = 1.0 / 32.0 * offset\n @x = @x.floor + change\n end",
"def left_cell_x_at(x); x / WIDTH; end",
"def x\n rect.x\n end",
"def check_horizontal(x_target, y_target)\n #left to right\n if coordinate_x < x_target\n (coordinate_x+1..x_target-1).each do |x|\n return true if is_occupied?(x, y_target)\n end\n return false\n end\n #righ to left\n if x_target < coordinate_x\n (x_target+1..coordinate_x-1).each do |x|\n return true if is_occupied?(x, y_target)\n end\n return false\n end\n end",
"def bound_x (x)\n if x == @world.width\n return 0\n elsif x == -1\n return (@world.width - 1)\n else\n return x\n end\n end",
"def safe_position?(x, y)\n x >= 0 &&\n x <= 4 &&\n y >= 0 &&\n y <= 4\n end",
"def right_cell_x_at(x); (x + WIDTH - 1) / WIDTH; end",
"def x\n OFFSET_FROM_LEFT + (coordinates.x * 700).to_i\n end",
"def screen_x\n # Return after calculating x-coordinate by order of members in party\n if self.index != nil\n return self.index * 160 + 80\n else\n return 0\n end\n end",
"def gridMin_x\n\t\treturn @iGridMin_x\n\tend",
"def x\n position.x if position\n end",
"def x\n position.x if position\n end",
"def xRange(max)\n (@x > 0 ? @x - 1 : @x)..(@x < max - 1 ? @x + 1 : @x) \n end",
"def get_available_positions\n\t\tpositions = []\n\t\tfor i in (1..9) do\n\t\t\tx = ((i - 0.1) / 3).truncate\n\t\t\ty = (i - 1) % 3\n\t\t\tif self.is_valid?(x, y)\n\t\t\t\tpositions.push(i)\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn positions\n\tend",
"def rel_x\n return x - Graphics.width/2\n end",
"def rel_x\n return x - Graphics.width/2\n end",
"def grab_x_loc\n rand 100\n end",
"def exposion_range_without_wall(pos)\n\t\trange = Set.new\n\t\t@template.each do |orig_pos|\n\t\t\ttrans_pos = Array.new(orig_pos)\n\t\t\ttrans_pos.row += pos.row\n\t\t\ttrans_pos.col += pos.col\n\t\t\tif (0...n).cover?(trans_pos.row) and (0...m).cover?(trans_pos.col)\n\t\t\t\trange << trans_pos\n\t\t\tend\n\t\tend\n\t\treturn range\n\tend",
"def left_cell_x(x = @x); self.class.left_cell_x_at(x); end",
"def next_x\n if state.dx < 0 # if the player moves left\n return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left)\n else\n return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right)\n end\n end",
"def valid_position?(x, y)\n !!(x && y && x > 0 && y > 0 && x <= 8 && y <= 8)\n end",
"def space(x,y)\n return nil if x < 0\n return nil if y < 0\n return nil if x >= @width\n return nil if y >= @height\n @grid[y][x]\n end",
"def original_x\n ActorPos[index][0] || 0 rescue 0\n end",
"def safe_position?(x, y)\n x >= 0 &&\n x <= @max_x &&\n y >= 0 &&\n y <= @max_y &&\n !@registered_positions.include?([x, y])\n end",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)\n return x\n end",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)\n return x\n end",
"def left\n @x_min\n end",
"def screen_x\n if $game_temp.enemies_position[self.index] != nil\n return $game_temp.enemies_position[self.index][0]\n else\n return $data_troops[@troop_id].members[@member_index].x + Enemy_Position_AdjustX\n end \n end",
"def flip_range_x(points); points.collect{ |v| Vertex.new(v.x, -v.y)}; end",
"def screen_x\n x = (@real_x - $game_map.display_x + 3) / 4\n return x\n end",
"def x_offset; end",
"def get_state_x(rect)\n return rect.x + rect.width / 2\n end",
"def get_state_x(rect)\n rect.x + rect.width / 2\n end",
"def adjust_x(x)\n if loop_horizontal? and x < @display_x - @margin_x\n return x - @display_x + @map.width * 256\n else\n return x - @display_x\n end\n end",
"def identity_x\r\n new_point = identity\r\n new_point.y = 0\r\n return new_point\r\n end",
"def check_range(x, y)\n !(x < 1 || y < 1 || x > width || y > height)\n end",
"def position_is_valid?(position)\r\n position.x < @col &&\r\n position.y < @row &&\r\n position.x >= 0 &&\r\n position.y >= 0\r\n end",
"def x\n @position.x\n end",
"def move_x\n return if @x_vel.zero?\n new_x = @x + @x_vel\n impacts = @space.entities_overlapping(new_x, @y).delete(self)\n if impacts.empty?\n @x = new_x\n return\n end\n @x = if @x_vel > 0 # moving right\n # X position of leftmost candidate(s)\n impact_at_x = impacts.collect(&:x).min\n impacts.delete_if {|e| e.x > impact_at_x }\n impact_at_x - WIDTH\n else # moving left\n # X position of rightmost candidate(s)\n impact_at_x = impacts.collect(&:x).max\n impacts.delete_if {|e| e.x < impact_at_x }\n impact_at_x + WIDTH\n end\n @x_vel = 0\n impacts.each {|other| other.impacted_by(self) }\n end",
"def validate_xy(x, y)\n (x >= 0 && y >= 0) && (x <= @size - 1 && y <= @size - 1)\n end",
"def random_x_coordinate\n (rand(0..(@column_count)-1).to_i)\n end",
"def min_x\n c2f_x(0)\n end",
"def gets_x_axis\n\t\t@a = gets.chomp.to_i\n\t\tif (@a < @board_size_min) || (@a >@board_size_max)\n\t\t\tputs \"sorry you went outside of the range #{@board_size_min} and #{@board_size_max}\"\n\t\t\tputs \"try again\"\n\t\t\tgets_x_axis\n\t\tend\n\tend",
"def lower_left\n @lower_left ||= world.point(x_min, y_min)\n end",
"def validation(x, y)\n if(x >= plane[0].length || x < 0)\n puts \"invalid start or end point on across direction\"\n return false\n end\n if(y >= plane.length || y < 0)\n puts \"invalid start or end point on down direction\"\n return false\n end\n return true\n end",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)+16\n return x\n end",
"def valid_location(x, y)\n return (x >= 0) && (x < Settings.get_horizontal_size) && (y >= 0) && (y < Settings.get_vertical_size)\n end",
"def minpos\n v, opts = min x: true, y: true\n x = opts[\"x\"]\n y = opts[\"y\"]\n [v, x, y]\n end",
"def screen_x\n @page ? super + @page.adjusted_xy[0] : super\n end",
"def x_points\n points = [[], []]\n (0...height).each do |y|\n (0...width).each do |x|\n if (array[y][x]).nonzero? && (x - 1 < 0 || (array[y][x - 1]).zero?)\n points[0] << Point.new(x - 1, y) + @position\n end\n\n if (array[y][x]).nonzero? && (x + 1 >= length || (array[y][x + 1]).zero?)\n points[1] << Point.new(x + 1, y) + @position\n end\n end\n end\n\n points\n end",
"def no_x_move?(x_des)\n (x_des.to_i - x_position) == 0\n end",
"def check_valid_position(xcoord, ycoord)\n\tif xcoord >= GRID_SIZE || xcoord < 0\n\t\treturn false\n\telsif ycoord >= GRID_SIZE || ycoord < 0\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def sel_left\n [sel_x, pos_x].min\n end",
"def pixel_x; @x / PIXEL_WIDTH; end",
"def pixel_x; @x / PIXEL_WIDTH; end",
"def x_coord(num)\n x = num%65536\n x -= 65536 if x > 32768\n x\nend",
"def normalizeX x, maxX\n step = 8.to_f / maxX\n nx = -4 + x * step\n #puts nx\n nx\n end",
"def screen_x\n return @sx - ((@index+1)*@speed_x)\n end",
"def generate_random_x\n max_x = @radius\n random_range(-max_x, max_x)\n end",
"def palm_x\n palmPosition[0] if palmPosition\n end",
"def xMax\n @origin_x + length\n end",
"def incrementX\n @currentPos.x += 1\n if @currentPos.x > @grid.maxX\n @currentPos.x = @grid.minX\n end\n end",
"def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end",
"def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end",
"def validate_pos(x, y)\n return x.between?(0, @size_x - 1) && y.between?(0, @size_y - 1)\n end",
"def get_horiz_beam_rect(x, y)\n beam_ul = [@hub_spacing/2 + @hub_spacing*x, (@hub_spacing/2 + @hub_spacing*y) - @hub_dia/2, 0]\n beam_lr = [@hub_spacing/2 + @hub_spacing*(x+1), (@hub_spacing/2 + @hub_spacing*y) + @hub_dia/2, 0]\n [beam_ul, beam_lr]\n end",
"def validate_current_position_boundaries\n if (@initial_position.nil? || row_pos_invalid? || col_pos_invalid?) \n puts \"\\nPlease enter valid chess piece position. Eg: -position a1\"\n puts \"Please type one of these positions\"\n puts valid_boundaries\n @is_valid = false\n end\n end",
"def place_horizontal(symbol, length)\n\t\tx = Random.rand(10 - length)\n\t\ty = Random.rand(10)\n\t\tcoords = []\n\t\t(0..length-1).each do |offset|\n\t\t\tx_offset = x + offset\n\t\t\tif !@grid[x_offset][y].nil?\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\tcoords << [x_offset, y]\n\t\t\tend\n\t\tend\n\t\tcoords.each do |c|\n\t\t\t@grid[c[0]][c[1]] = symbol\n\t\tend\n\t\treturn true\n\tend",
"def set_horizontal_ship(y, x_min, x_max)\n (x_min...x_max).each { |x| self.positions.find { |p| p.x == x && p.y == y }.water = false }\n end",
"def move_x\n return if doomed?\n return if @x_vel.zero?\n new_x = @x + @x_vel\n impacts = entities_obstructing(new_x, @y)\n if impacts.empty?\n @x = new_x\n return\n end\n @x = if @x_vel > 0 # moving right\n # X position of leftmost candidate(s)\n impact_at_x = impacts.collect(&:x).min\n impacts.delete_if {|e| e.x > impact_at_x }\n impact_at_x - WIDTH\n else # moving left\n # X position of rightmost candidate(s)\n impact_at_x = impacts.collect(&:x).max\n impacts.delete_if {|e| e.x < impact_at_x }\n impact_at_x + WIDTH\n end\n i_hit(impacts, @x_vel.abs)\n self.x_vel = 0\n end",
"def logical_pos(x, y)\n [\n (x / @tile_width).floor,\n (y / @tile_height).floor\n ]\n end",
"def position(val)\n @inside = true\n return val if (low..high).cover? val\n @inside = false\n return constrain(val, low, high)\n end",
"def check_grid_coordinates(x, y)\n (x >= 0) && (x < @height) && (y >= 0) && (y < @width)\n end",
"def invalid_inputs\n puts \"Invalid input! Your positions must have x and y coordinates \"\\\n \"between 0 and 7.\"\n end",
"def actual_x_position\n return adjust_x_to_zoom(@actual_x + set_adjust[0])\n end",
"def xTile(x,y)\r\n return (x>@x1 and x<@x2 and y>@y1 and y<@y2)\r\n end",
"def position_is_valid?(position)\n position.x < @length &&\n position.y < @width &&\n position.x >= 0 &&\n position.y >= 0\n end",
"def screen_origin_x\n @cr[0] & 0x7f\n end",
"def horizontalXY(horizontal, index)\n {\n 'x' => index.to_i,\n 'y' => horizontal.to_i\n }\n end",
"def create_starting_positions\n\t\t[Point.new(BOARD_WIDTH/4, BOARD_HEIGHT/4),\n \t\tPoint.new(3 * BOARD_WIDTH/4, 3 * BOARD_HEIGHT/4),\n\t\tPoint.new(3 * BOARD_WIDTH/4, BOARD_HEIGHT/4),\n\t\tPoint.new(BOARD_WIDTH/4, 3 * BOARD_HEIGHT/4)]\n\tend",
"def screen_x\n return $data_troops[@troop_id].members[@member_index].x + Enemy_Position_AdjustX\n end",
"def lower_right\n @lower_right ||= world.point(x_max, y_min)\n end",
"def potential_positions\n (0...@all_rotations.size).map do |rot_index|\n shape = @all_rotations[rot_index]\n extent = horiz_extent(shape)\n (0-extent[0]...@board.num_columns-extent[1]).map do |x|\n [x, lowest_fit(shape, x), rot_index]\n end\n end.reduce(:+)\n end",
"def valid?(x, y)\n x >= 0 && x < MAX_WIDTH && y >= 0 && y < MAX_HEIGHT\n end",
"def horizontal_move?(x_position, x, y_position, y)\n x_position != x && y_position == y\n end",
"def invalid_cell?(pos)\n pos[0] < 0 || pos[1] < 0 || pos[0] > MAXX || pos[1] > MAXY\n end",
"def view_x\n return 0 if @viewport.nil? || @view_x.nil?\n return @view_x\n end",
"def validate(x_coordinate, y_coordinate)\n if x_coordinate >= 0 && x_coordinate < maze.length && y_coordinate >= 0 && y_coordinate < maze[0].length\n [x_coordinate, y_coordinate]\n else\n nil\n end\n end",
"def pixel_x_at(x)\n\t\t(block_size * x) + @x_offset + block_size\n\tend",
"def paddle_x\n @cr[8]\n end",
"def valid_board_coordinates?(x, y)\n x >= 0 && y >= 0 && x < 3 && y < 3\n end",
"def screen_x\r\n ret = ((@real_x - self.map.display_x) / Game_Map::X_SUBPIXELS).round\r\n ret += @width * Game_Map::TILE_WIDTH / 2\r\n return ret\r\n end",
"def reflect_horizontal\n v[:x] = -v[:x]\n end",
"def starting_position\n if n.even?\n Position.new(0,0)\n else\n Position.new(square_root - 1, square_root - 1)\n end\n end",
"def valid_place?(x_position, y_position)\n x_position.between?(0, @dimension) &&\n y_position.between?(0, @dimension)\n end",
"def natural_rect(logical_x, logical_y, x_range, y_range)\n [\n logical_x * @tile_width,\n logical_y * @tile_width,\n x_range * @tile_width,\n y_range * @tile_width\n ]\n end",
"def human_x_pos\n '%.2f' % points_to_human(x_pos) unless x_pos.nil?\n end",
"def absolute_point_to_grid(point)\n if point.x < min_x || point.x >= max_x || point.y < min_y || point.y >= max_y\n return nil\n end\n Point.new(((point.x - @pos.x) / @cellsize).to_i, ((point.y - @pos.y) / @cellsize).to_i)\n end",
"def set_left_start_point\n @leading_x = 0\n @leading_y = find_left_entry\n end"
] | [
"0.65302503",
"0.6438389",
"0.617358",
"0.61369115",
"0.60945225",
"0.6033597",
"0.60318613",
"0.602145",
"0.5991849",
"0.59504527",
"0.5944953",
"0.59413266",
"0.5935162",
"0.5935162",
"0.5918214",
"0.5910962",
"0.5910678",
"0.5910678",
"0.58813125",
"0.58670485",
"0.5847589",
"0.5828304",
"0.58109725",
"0.5804245",
"0.5783384",
"0.5780572",
"0.57745826",
"0.57745826",
"0.5761232",
"0.5753719",
"0.5751897",
"0.57508767",
"0.5748106",
"0.57442826",
"0.57345366",
"0.5729982",
"0.57265705",
"0.57181764",
"0.5712338",
"0.57101256",
"0.57020295",
"0.5693258",
"0.5691835",
"0.56913227",
"0.56879145",
"0.56816906",
"0.5673777",
"0.566049",
"0.56516814",
"0.5645138",
"0.5639457",
"0.5634176",
"0.56207633",
"0.5614581",
"0.5612636",
"0.55980617",
"0.55980617",
"0.55979353",
"0.55885047",
"0.5565356",
"0.55408436",
"0.553914",
"0.5531493",
"0.5520744",
"0.55139023",
"0.55139023",
"0.5501661",
"0.5496102",
"0.5494769",
"0.548179",
"0.54775625",
"0.54775554",
"0.5469314",
"0.5467749",
"0.5463471",
"0.5461822",
"0.5459183",
"0.5455368",
"0.5454295",
"0.54520994",
"0.5442537",
"0.54270995",
"0.5426935",
"0.54213053",
"0.54176754",
"0.5397563",
"0.53964806",
"0.5391241",
"0.5390361",
"0.5390241",
"0.5386312",
"0.53805596",
"0.5374784",
"0.53692335",
"0.53656715",
"0.53585213",
"0.535034",
"0.53499395",
"0.53482693",
"0.53477824",
"0.5346334"
] | 0.0 | -1 |
Slow default method to parse timestamps | def convert_timestamp(value, capture_definition)
DateTime.parse(value).strftime('%Y%m%d%H%M%S').to_i unless value.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_timestamps\n super\n @updated = updated.to_i if updated.is_a? String\n @updated = Time.at(updated) if updated\n end",
"def timestamp_parse(_timestamp)\n _undefined\n end",
"def parse_timestamps\n self.keys.each do |key|\n self[key].map! do |timestamp| \n timestamp.is_a?(Time) ? timestamp : Time.parse(timestamp)\n end\n end\n end",
"def parse_timestamps\n @created = created.to_i if created.is_a? String\n @created = Time.at(created) if created\n end",
"def test_timestamp_valid\n parser = Parser::new\n timestamp = \"1518893687.562508000\"\n assert_equal([1518893687, 562508000], parser.parse_timestamp(timestamp))\n end",
"def message_timestamps(messages)\n messages\n .map { |message| message.match(TIMESTAMP_REGEX)[0] }\n .compact\n .map { |timestamp| DateTime.parse(timestamp) }\nend",
"def post_process_datetime( val )\n\t\t\treturn Time.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def timeparse time\n tt ||= Time.rfc2822(time) rescue nil\n tt ||= Time.iso8601(time) rescue nil\n tt ||= Time.strptime(time, \"%Y-%m-%d %T %z\") rescue nil\n\n if !tt\n if $base_time\n begin\n # base_time has been set so try parsing a relative time\n # todo: I should be a lot stricter about parsing invalid times\n\n # work with \"Jan 7\" as well as \"7 Jan\"\n if time[/^\\s*([A-Za-z]+\\s*[0-9]+):/] # split \"Jan 7: \" off front and use it as base time\n nt = Time.parse($1, $base_time)\n nt = Time.new(nt.year+1, nt.month, nt.day, nt.hour, nt.min, nt.sec, nt.utc_offset) if $base_time.to_date.to_time > nt\n time = $'\n $base_time = nt\n end\n\n tt = Time.parse(time, $base_time) # try a relative time\n tt += 86400 if $base_time > tt # if base_time is 11:30 and tt is 00:00, tt needs to be bumped to the following day\n tt = Time.new(tt.year+1, tt.month, tt.day, tt.hour, tt.min, tt.sec, tt.utc_offset) if $base_time > tt\n log \"parsing #{time} against #{$base_time} and got #{tt}\"\n rescue\n $stderr.puts \"Time could not be parsed: '#{time}'\"\n raise\n end\n else\n raise \"the first time in the file must be rfc or iso: #{time}\"\n end\n end\n\n $base_time = tt\n\n raise \"Invalid time #{time}\" if tt.nil?\n time_floor(tt, 30); # magic value\nend",
"def parse_srt_times(times)\n times =~ /^([0-9:,]+) --> ([0-9:,]+)/ # May have trailing data.\n [$1, $2].map {|t| parse_srt_time(t) }\n end",
"def extract_ts(chunks)\n ts = chunks[fmt.index('t')]\n return parse_time(ts) if valid_timestamp?(ts)\n rescue TypeError\n Time.now.utc.to_i\n end",
"def parse_time(file_time_struct)\n wtime_to_time(make_uint64(file_time_struct[:dw_low_date_time],\n file_time_struct[:dw_high_date_time]))\n end",
"def handle_ts\n handle_at\n handle_in\n @time_special = @tokens[@index].get_tag(TimeSpecial).type\n @index += 1\n @precision = :time_special\n end",
"def load_timestamp(fname)\n stamps = []\n File.open(fname).read().each_line do |line|\n parsed = line.strip().split() \n stamps << [parsed[2].to_f, parsed[3].to_f, parsed[4].to_f, parsed[5].to_f, parsed[6].to_f]\n end\n return stamps\nend",
"def time_parsing str\n Time.parse(str) if str && str != \"<null>\"\n end",
"def create_time_parser\n if @time_key_format\n begin\n # Strptime doesn't support all formats, but for those it does it's\n # blazingly fast.\n strptime = Strptime.new(@time_key_format)\n Proc.new { |value|\n value = convert_numeric_time_into_string(value, @time_key_format) if value.is_a?(Numeric)\n strptime.exec(value).to_datetime\n }\n rescue\n # Can happen if Strptime doesn't recognize the format; or\n # if strptime couldn't be required (because it's not installed -- it's\n # ruby 2 only)\n Proc.new { |value|\n value = convert_numeric_time_into_string(value, @time_key_format) if value.is_a?(Numeric)\n DateTime.strptime(value, @time_key_format)\n }\n end\n else\n Proc.new { |value|\n value = convert_numeric_time_into_string(value) if value.is_a?(Numeric)\n DateTime.parse(value)\n }\n end\n end",
"def parse_time\n s0 = @scanner.pos\n if match_str('(') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n s3 = parse_ms\n if s3 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n if match_str('/') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n s5 = parse_hms\n s5 = parse_ms(with_hour: true) if s5 == :failed\n if s5 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n match_spaces\n if match_str(')') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = { 'now' => s3, 'total' => s5 }\n end\n end\n end\n end\n end\n s0\n end",
"def create_time_parser\n if @time_key_format\n begin\n # Strptime doesn't support all formats, but for those it does it's\n # blazingly fast.\n strptime = Strptime.new(@time_key_format)\n Proc.new { |value| strptime.exec(value).to_datetime }\n rescue\n # Can happen if Strptime doesn't recognize the format; or\n # if strptime couldn't be required (because it's not installed -- it's\n # ruby 2 only)\n Proc.new { |value| DateTime.strptime(value, @time_key_format) }\n end\n else\n Proc.new { |value| DateTime.parse(value) }\n end\n end",
"def parse_date(str) \n Time.at(str[/([0-9]+)-([0-9]+)/,1].to_i/1000)\n end",
"def parse_time(row)\n raw_time = row[1]\n if raw_time\n time = \"#{raw_time[0..4]}#{raw_time[-2..-1].downcase!}\"\n\n # remove leading 0\n time = time[1..-1] if time[0] === '0'\n time\n else\n nil\n end\nend",
"def parse_timestamp(unix_timestamp)\n d = Time.at(unix_timestamp.to_i)\n d.strftime(\"%l:%M:%S %p, %-m-%e-%Y\")\n end",
"def to_smart_time(form = :utc)\n# 1) Research parsedate to see how it's parsing\n# 2) Refacter the parse to insert the current values from the top down,\n# as they don't exist. Ignore seconds completely unless given by the string.\n ::Time.send(\"#{form}_time\", *ParseDate.parsedate(self)[0..5].map {|arg| arg || 0})\n end",
"def validate_timestamp(obj)\n if !obj[:timestamp].nil?\n if obj[:timestamp].match(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d{3}/)\n return true\n end\n end\n false\nend",
"def fast_string_to_time(string)\n if string =~ Format::ISO_DATETIME\n microsec = ($7.to_f * 1_000_000).to_i\n res = new_time $1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, microsec\n res\n end\n end",
"def parse_times(str)\n \tstr.delete(' ')\n \ttimes = []\n \tsuccess = true\n \tstr.split(',').each do |t|\n \t pt = parse_time(t)\n \t if pt\n \t \ttimes << pt\n \t else\n \t \traise \"unable to parse time #{t}\"\n \t \tsuccess = false\n \t \tbreak\n \t end\n \tend\n end",
"def test_valid_timestamp\n billcoin = BillCoin::new\n parser = Minitest::Mock.new('Parser')\n def parser.parse_timestamp timestamp\n timestamp.split('.').map! {|x| Integer(x)}\n end\n refute billcoin.verify_valid_timestamp('1518893687.562508000', '1518893687.562508100', 0, parser)\n end",
"def validate_and_parsetime(value)\n return unless value\n Time.iso8601(value).getutc.to_i\n rescue ArgumentError => e\n logger.error \"Couldn't parse time from '#{value}'\"\n nil\n end",
"def parse(tz_string); end",
"def parse_start_date(y, m, d, t)\n Time.strptime([y, m, d, t, 'UTC'].join(' '), START_DATE).to_i * 1_000\n end",
"def parse_time_data input\n while line = input.gets\n line.chomp!\n @line_no += 1\n\n if line =~ /^[\\#;]/\n # ignore comment lines\n elsif line =~ /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{2}|\\d{4})$/\n # mm/dd/yy or mm/dd/yyyy\n handle_new_day($1, $2, $3)\n elsif line =~ /^([0-9.:]+)\\s*[-]\\s*([0-9.]+)\\s+(\\S+.*)/\n # t1 - t2 description for example:\n # 7.1-13.6 Mantis issues OR (for Jordan :)\n # 7:30-10 Mantis issues\n handle_new_entry($1, $2, $3)\n elsif line.strip.empty?\n # ignore blank lines\n else\n raise \"parse error - invalid line\"\n end\n end\n rescue Exception => e\n puts \"line #{@line_no}: #{e.message}\"\n end",
"def parse_srt_time(time)\n time =~ /^(\\d+):(\\d+):(\\d+),(\\d{3})$/\n hh, mm, ss, ms = [$1, $2, $3, $4].map(&:to_i)\n hh*3600 + mm*60 + ss + ms/1000.0\n end",
"def parse_time(time)\n time = \"0#{time}\" if time.match(/^\\d:\\d\\d/)\n time = time.gsub(/u/, '') if utime?\n time = time.gsub(/s/, '') if stime?\n\n time\n end",
"def parse_time_stamp(doc,debug,file)\n year = -1;\n month = -1;\n date = -1;\n hour = -1;\n minutes = -1;\n sec = 0;\n zone = '+00:00';\n\n list = doc.xpath(\"//div[@class='container']/div/div/div/div\");\n\n for i in 0..list.size-1\n div = list[i]\n\n if (debug > 0) then\n file.printf(\"------------- //div \\n\");\n file.puts(div);\n end\n\n word = div.text.split()\n if ((word[0] == 'Last') and (word[1] == 'updated:')) then\n month = get_month(word[2]);\n date = word[3].split(',')[0].to_i;\n year = word[4].split(',')[0].to_i;\n hour = word[5].split(':')[0].to_i;\n minutes = word[5].split(':')[1].to_i;\n if (word[6] != \"GMT\") then\n printf(\"ERROR: undefined zone : %s\\n\",word[6]);\n end\n end\n end\n \n file.puts(\"-------------------- //end of divisions\") if (debug > 0);\n\n return DateTime.new(year,month,date,hour,minutes,0,zone);\n end",
"def parse_time\n time_str = @request[FTIME].sub(REGEX_TIME_FIX) { \"#{$1} #{$2}\" }\n Time.parse(time_str) rescue nil\n end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def parse\n line = @io.gets until md = /\\ATime before run:\\s+(?<time>.*)\\Z/.match(line)\n return unless md\n @db.date_time ||= DateTime.parse(md[:time])\n super\n @db[\"lparstat_out\"] = @db[\"lparstat_sum\"]\n end",
"def validate_and_parsetime(value)\n return unless value\n Time.iso8601(value).getutc.to_i\n rescue ArgumentError => e\n logger.error \"Couldn't parse time from '#{value}'\"\n nil\n end",
"def parse_date(input, msg = T.unsafe(nil)); end",
"def string_to_time(string)\n super(handle_date_parse_input(string))\n end",
"def timestamps\n @timestamps ||= bytes[T_BYTES].each_slice(4).map do |t_bytes|\n ByteArray.to_i(t_bytes)\n end.reject{ |t| t == 0 }\n end",
"def create_timestamp(line)\n\t\tTime.strptime(line[1], '%Q')\n\tend",
"def fast_string_to_time(string)\n return unless string =~ Format::ISO_DATETIME\n microsec = (Regexp.last_match[7].to_r * 1_000_000).to_i\n new_time(Regexp.last_match[1].to_i,\n Regexp.last_match[2].to_i,\n Regexp.last_match[3].to_i,\n Regexp.last_match[4].to_i,\n Regexp.last_match[5].to_i,\n Regexp.last_match[6].to_i,\n microsec\n )\n end",
"def local_datetime_parse(arg)\n arg.nil? ? nil : DateTime.parse(Time.parse(arg.to_s).localtime.to_s)\n end",
"def timestamp\n @timestamp ||= Time.parse(self['timestamp'])\n end",
"def parse_time(tt)\n tt = tt.force_encoding('utf-8')\n MONTHS.map{|k,v|\n tt.gsub!(/ #{k}/i, \" #{v.downcase}\")\n }\n case tt\n when /Demain.*/\n t = Time.parse(tt)+60*60*24\n else\n t = Time.parse(tt)\n end\n return t\nend",
"def add_dynamic_timestamp(text)\nend",
"def a_timestamp\n proc { |t| t.to_s =~ /^\\d{10}$/ }\n end",
"def timestamp\n @timestamp ||= Time.parse(@origdate)\n end",
"def get_timestamp(string)\n DateTime.parse(string).to_i\n end",
"def starttime; Time.parse(@starttime_str); end",
"def convert_for_timestamp_shape(arg)\n return nil if arg.nil?\n\n time_value = case arg\n when Time\n arg\n when Date, DateTime\n arg.to_time\n when Integer, Float\n Time.at(arg)\n else\n Time.parse(arg.to_s)\n end\n time_value.utc.iso8601\n end",
"def parse_ms(with_hour: false)\n s0 = @scanner.pos\n s1 = match_digits!\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n elsif match_str(':') != :failed\n s3 = match_digits!\n if s3 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n m = s1.join.to_i\n s = s3.join.to_i\n if with_hour\n h = m / 60\n m = m % 60\n s0 = { 'h' => h, 'm' => m, 's' => s }\n else\n s0 = { 'm' => m, 's' => s }\n end\n end\n else\n @scanner.pos = s0\n s0 = :failed\n end\n s0\n end",
"def time_parse(time)\n Time.find_zone(\"UTC\").parse(time)\n end",
"def parseTimeStampsRecording(doc, eventName, recordingStart, recordingStop, real_end_time)\n # Parse timestamps for Recording\n doc.xpath(\"//event[@eventname='#{eventName}']\").each do |item|\n if item.at_xpath(\"status\").content == \"true\"\n recordingStart.push(item.at_xpath(\"timestampUTC\").content.to_i)\n else\n recordingStop.push(item.at_xpath(\"timestampUTC\").content.to_i)\n end\n end\n\n if recordingStart.length > recordingStop.length\n recordingStop.push(real_end_time)\n end\n\n return recordingStart, recordingStop\nend",
"def parse_time(string)\n parts = string.split(\":\").map(&:to_f)\n parts = [0] + parts if parts.length == 2\n hours, minutes, seconds = parts\n seconds = hours * 3600 + minutes * 60 + seconds\n seconds.to_i\n end",
"def convert tag, val\n return val unless val.kind_of?(String)\n case tag\n when 'partofset', 'track'\n return val\n end\n case val\n when REGEXP_TIMESTAMP\n year, month, day, hour, minute = $~.captures[0,5].map {|cap| cap.to_i}\n if month == 0 || day == 0\n return nil\n end\n second = $6.to_f\n zone = $7\n zone = '+00:00' if zone == 'Z'\n begin\n Time.new(year, month, day, hour, minute, second, zone)\n rescue ArgumentError\n val\n end\n when REGEXP_RATIONAL\n return val if $2.to_i == 0\n Rational($1, $2)\n else\n val\n end\n end",
"def parse(time_string)\n Time.at(\"#{time_string[0,10]}.#{time_string[10,13]}\".to_f)\n end",
"def test_timestamp_invalid_format\n parser = Parser::new\n timestamp = \"15188.93687-562508000\"\n assert_raises SystemExit do\n parser.parse_timestamp timestamp\n end\n end",
"def parse_time(time)\n result = Struct.new(:days, :hours, :minutes).new\n time = time.to_i\n result.days = time / 86_400\n time = time % 84_600\n result.hours = time / 3_600\n time %= 3_600\n result.minutes = time / 60\n result\nend",
"def to_seconds(timestamp)\n hours = timestamp[0].to_i * 60 * 60\n minutes = timestamp[1].to_i * 60\n hours + minutes + timestamp[2].to_i\nend",
"def test_parse_to_utc_returns_nil_on_obviously_invalid_input_it_used_to_swallow\n pend 'Time.parse_to_utc validation failure, see https://github.com/3scale/apisonator/pull/167#issuecomment-597586622' do\n assert_nil Time.parse_to_utc('201210garbage201210')\n end\n end",
"def datetime_parse(value)\n dt = translate(value)&.to_datetime&.strftime\n datetime_clean(dt) if dt\n rescue\n nil\n end",
"def parse(value)\n unless value.is_a?(String)\n raise TimeParseError, \"value must be string: #{value}\"\n end\n\n if @cache1_key == value\n return @cache1_time\n elsif @cache2_key == value\n return @cache2_time\n else\n begin\n time = @parse.call(value)\n rescue => e\n raise TimeParseError, \"invalid time format: value = #{value}, error_class = #{e.class.name}, error = #{e.message}\"\n end\n @cache1_key = @cache2_key\n @cache1_time = @cache2_time\n @cache2_key = value\n @cache2_time = time\n return time\n end\n end",
"def processed_at\n @processed_at ||= begin\n groups = *mapping_for(:processed_at).match(/(\\d{2})\\/(\\d{2})\\/(\\d{4}) ([\\d:]+)/sm)\n Time.parse(\"#{groups[3]}-#{groups[2]}-#{groups[1]} #{groups[4]}\")\n end\n end",
"def test_timestamp_invalid_types\n parser = Parser::new\n timestamp = \"1518893687.twenty\"\n assert_raises SystemExit do\n parser.parse_timestamp timestamp\n end\n end",
"def rfc3339(*args)\n #This is a stub, used for indexing\n end",
"def strptime(str=\"-4712-01-01T00:00:00+00:00\", fmt='%FT%T%z', sg=nil)\n super(str, fmt)\n end",
"def parse_times( times )\n case times\n when /^\\s*any\\b/i\n Hour.new(\"12 AM\")..Hour.new(\"11 PM\")\n when /^\\s*before (\\d+ [AP]M)\\b/i\n Hour.new(\"12 AM\")..Hour.new($1)\n when /^\\s*after (\\d+ [AP]M)\\b/i\n Hour.new($1)..Hour.new(\"11 PM\")\n when /^\\s*(\\d+ [AP]M) to (\\d+ [AP]M)\\b/i\n Hour.new($1)..Hour.new($2)\n when /^\\s*not available\\b/i\n nil\n else\n raise \"Unexpected availability format.\"\n end\n end",
"def parse_timestamp(time_string, time_zone)\n time_string.slice!(0)\n time_zone.chomp(\"]\")\n Time.strptime(time_string.concat(time_zone), \"%d/%b/%Y:%T%z\")\n end",
"def timestamp(time)\n date = @file[/(\\w+ \\d+, \\d+)/]\n ASF::Board::TIMEZONE.parse(\"#{date} #{time}\").to_i * 1000\n end",
"def time_for_string(time)\n time = time.scan(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/)[0].sub(' ','T')\n Time.xmlschema(time)\n end",
"def read_time fn=nil\n time = read_single_line(fn)\n if time.size == 2 # vector of two integers\n time.map { |t| t.to_i }\n else # single number\n single = time.first\n single =~ float_re ? single.to_f : single.to_i\n [single, nil]\n end\n end",
"def process_stamp(stamp_string)\n # Server gives us miliseconds, which we drop before converting.\n stamp_val = stamp_string.to_i() / 1000\n utc_time = Time.at(stamp_val).utc().to_datetime()\n return utc_time\n end",
"def use_timestamps\n return if @timestamps\n\n @messages = @messages.map do |message|\n {\n messages: message,\n timestamp: nil\n }\n end\n @timestamps = true\n end",
"def last_parse\n datetime_from(\"sf:last_parse\")\n end",
"def parse_time(str)\n seconds = 0\n str.scan(/\\d+ *[Dd]/).each { |m| seconds += (m.to_i * 24 * 60 * 60) }\n str.scan(/\\d+ *[Hh]/).each { |m| seconds += (m.to_i * 60 * 60) }\n str.scan(/\\d+ *[Mm]/).each { |m| seconds += (m.to_i * 60) }\n str.scan(/\\d+ *[Ss]/).each { |m| seconds += (m.to_i) }\n seconds\n end",
"def apply_validations_for_timestamp\n apply_validations_for_datetime\n end",
"def timestamp_from_filename(filename)\n # First, check if we can find the file name matching a timestamp\n parts = File.split(filename)\n parts = parts[-1].split('-')\n timestamp = parts[0]\n if not TIMESTAMP_REGEX.match(timestamp)\n return\n end\n\n # Great, then fix the formatting...\n timestamp[4] = '-'\n timestamp[7] = '-'\n timestamp[13] = ':'\n timestamp[16] = ':'\n\n return Time.parse(timestamp)\nend",
"def strptime_format\n #'%Y-%m-%dT%H:%M:%S.%L'\n \"%Y-%m-%dT%H:%M:%SZ\"\n end",
"def time\n Time.parse(@timestamp)\n end",
"def test_earlier_timestamp\n billcoin = BillCoin::new\n parser = Minitest::Mock.new('Parser')\n def parser.parse_timestamp timestamp\n timestamp.split('.').map! {|x| Integer(x)}\n end\n assert_raises SystemExit do\n billcoin.verify_valid_timestamp('1518893688.562508000', '1518893687.562508100', 0, parser)\n end\n end",
"def extract_time(value)\n mash = if value.respond_to?(:to_mash)\n value.to_mash\n else\n DataMapper::Ext::Hash.to_mash(value)\n end\n\n now = ::Time.now\n\n [ :year, :month, :day, :hour, :min, :sec ].map do |segment|\n typecast_to_numeric(mash.fetch(segment, now.send(segment)), :to_i)\n end\n end",
"def transform(raw_data)\n if self.content =~ /\\A(---.*?)---(.*)/m\n self.attributes = YAML.load($1).symbolize_keys\n self.content = $2\n\n [:created_at, :updated_at].each do |field|\n attr = self.attributes[field]\n self.attributes[field] = Time.parse(attr) if attr\n end\n end\n end",
"def test_datetime2_truncate_usec_on_assigment_precision_0\n time = Time.parse('2018-12-31T23:59:21.341867')\n record = DateTime2Types.new(my_datetime_alt: time)\n\n assert_equal 23, record.my_datetime_alt.hour\n assert_equal 59, record.my_datetime_alt.min\n assert_equal 21, record.my_datetime_alt.sec\n assert_equal 0, record.my_datetime_alt.usec\n assert_equal 0, record.my_datetime_alt.nsec\n end",
"def fetch_date_time(response)\n\tbegin\t\t\t\n\t\tdate_time_val = response.string_between_markers(\"tweet-timestamp\",\"\\\\u003E\").strip\n\t\tdate_time_val = date_time_val.string_between_markers(\"js-permalink js-nav\\\\\\\" title=\\\\\\\"\",\"\\\\\\\"\")\n\t\tif date_time_val != nil and date_time_val.to_s != \"\"\n\t\t\tset_date_time(date_time_val)\t\t\n\t\t\tLogWriter.debug(\"date_time:\"+date_time_val)\t\n\t\t\treturn date_time_val\n\t\telse\t\t\t\n\t\t\tLogWriter.debug(\"date_time: UNKNOWN\")\n\t\t\treturn \"UNKNOWN\"\n\t\tend\n\trescue Exception => e#do not log the exception, since data time parsing breaks often.\n\t\t#LogWriter.error(\"DATE TIME PARSING EXCEPTION\"+e.to_s)#given that this often breaks, it is better to throw this more specific error message\n\t\treturn \"UNKNOWN\"\n\tend\n\tend",
"def get_timestamp(*params); raise('Stub or mock required.') end",
"def parsed_created_at\n DateTime.parse(created_at) if created_at\n end",
"def normalizeTimestamp(timestamp)\n if timestamp == '0000-00-00 00:00:00' || timestamp == '0000-00-00T00:00:00+00:00'\n timestamp = '1983-10-29T03:16:00+00:00'\n end\n timestamp\n end",
"def datetime_timestamp\n return Date.parse(self.date).to_time\n end",
"def to_timestamp(string)\n Time.parse(string).strftime(\"%s\")\nend",
"def parse_timeline\n\nend",
"def typecast_time(datetime) #:nodoc:\n datetime.sub!(%r|^(\\w{2})/(\\w{3})/(\\w{4})|, '\\2 \\1 \\3')\n datetime.sub!(':', ' ')\n Time.parse(datetime)\n end",
"def parseTimeStamps(doc, eventName, resultArray, filePath)\n doc.xpath(\"//event[@eventname='#{eventName}']\").each do |item|\n newItem = Hash.new\n newItem[\"filename\"] = item.at_xpath(\"filename\").content.split('/').last\n newItem[\"timestamp\"] = item.at_xpath(\"timestampUTC\").content.to_i\n newItem[\"filepath\"] = filePath\n if !File.exists?(File.join(newItem[\"filepath\"], newItem[\"filename\"]))\n next\n end\n resultArray.push(newItem)\n end\n\n return resultArray\nend",
"def convert_ntp_line(line)\n line_array = line.split(' ')\n days = line_array[0]\n secs = line_array[1]\n human_timestamp = ntp_epoch_start.add_days(days).add_secs(secs)\n format(human_timestamp, line_array, 2)\nend",
"def _get_timestamp_or_duration\n return [nil, nil] unless @buffer\n\n now, now_dup = _init_now_then\n @_mode = nil\n @buffer.each do |time_unit, time_value|\n now_dup = _apply(time_unit, time_value, now, now_dup)\n end\n return [nil, diff_in_seconds(now, now_dup)] if @_mode.nil?\n\n [now_dup.to_i, nil]\n end",
"def time_at(index, delta=0)\n Time.parse(@lines[index + delta])\n end",
"def parse_event_line(s)\n minute, word_1, word_2 = s.scan(/.+ ..:(..)\\] (\\S+) (\\S+)/).flatten\n [minute.to_i, word_1, word_2]\n end",
"def start_time_input_parser\n\tparams[:micropost][:time] = parse_start_time(params[:micropost][:time])\n end"
] | [
"0.7502079",
"0.742153",
"0.72573483",
"0.70370096",
"0.6761853",
"0.6658598",
"0.6471365",
"0.64357877",
"0.6415363",
"0.6398729",
"0.6227673",
"0.6217726",
"0.607338",
"0.60728997",
"0.6045323",
"0.6025335",
"0.59877765",
"0.5899995",
"0.5894549",
"0.58751416",
"0.58545876",
"0.58213824",
"0.581362",
"0.5809503",
"0.5799966",
"0.579169",
"0.57893085",
"0.5781204",
"0.5763083",
"0.5753332",
"0.5745695",
"0.572944",
"0.57281023",
"0.5724745",
"0.5724745",
"0.5724745",
"0.5724745",
"0.57010114",
"0.570043",
"0.568559",
"0.5684204",
"0.5672583",
"0.56517476",
"0.5647095",
"0.56434613",
"0.5634993",
"0.56315565",
"0.5628254",
"0.5625243",
"0.5615771",
"0.559923",
"0.5592447",
"0.55895615",
"0.55857754",
"0.5585403",
"0.55666226",
"0.555639",
"0.5549542",
"0.5528006",
"0.5527456",
"0.55148065",
"0.5513656",
"0.5512513",
"0.5512104",
"0.5511011",
"0.5507628",
"0.5498707",
"0.54891396",
"0.54748404",
"0.54586333",
"0.54541886",
"0.54423404",
"0.5440421",
"0.54399407",
"0.5437967",
"0.5437951",
"0.542656",
"0.5409962",
"0.5406112",
"0.5402987",
"0.54027814",
"0.5402316",
"0.5398441",
"0.53962266",
"0.5388084",
"0.53813887",
"0.5377328",
"0.5372832",
"0.53713965",
"0.5369391",
"0.53682566",
"0.5360908",
"0.53601044",
"0.53552276",
"0.53542805",
"0.5353309",
"0.5349264",
"0.5344331",
"0.5336891",
"0.53365356"
] | 0.5542741 | 58 |
Initializes a new Request object. It will apply the the provided FileFormat module to this instance. | def initialize(file_format)
@lines = []
@attributes = {}
register_file_format(file_format)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize request\n @request = request\n loader = Loader.new\n @files = request.proto_file.map do |fd|\n loader.load_file fd, request.file_to_generate.include?(fd.name)\n end\n @services = @files.flat_map(&:services)\n @messages = @files.flat_map(&:messages)\n @enums = @files.flat_map(&:enums)\n end",
"def initialize request\n @path = request.path.split('/').slice(1, 100) || []\n @original = @path.dup\n @request = request\n\n set_variables\n set_domain request\n set_format\n end",
"def initialize request\n loader = Loader.new\n @files = request.proto_file.map do |fd|\n loader.load_file fd, request.file_to_generate.include?(fd.name)\n end\n @services = @files.flat_map(&:services)\n @messages = @files.flat_map(&:messages)\n @enums = @files.flat_map(&:enums)\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.fileAssessmentRequest\"\n end",
"def initialize(format, options = {})\n @options = options\n @file_format = format\n end",
"def initialize(initial_params = {})\n raise \"Cannot directly instantiate a #{self.class}.\" if\n self.class == Request\n @params = initial_params\n end",
"def new\n @request = Request.new\n end",
"def initialize(request)\n @params = {}\n @params.merge! request.class.query_parse(request.params[\"QUERY_STRING\"])\n \n # Check to see if a form was submitted and fill in the form values\n if request.is_multipart?\n @params.merge! request.split_multipart\n end #if\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.emailFileAssessmentRequest\"\n end",
"def initialize(params = {})\n file = params.delete(:file)\n super\n if file\n self.filename = sanitize_filename(file.original_filename)\n self.content_type = file.content_type\n self.file_contents = file.read\n self.file_size = file.size\n end\n end",
"def initialize(file_name)\n @file_name = file_name\n @file_hash = file_hash(file_name)\n @params = Hash.new\n end",
"def initialize(params = {})\n @file = params.delete(:file)\n super\n if @file\n self.filename = sanitize_filename(@file.original_filename)\n self.content_type = @file.content_type\n self.file_contents = @file.read\n end\n end",
"def initialize(request)\n @logger = ::Logger.new(STDOUT)\n @logger.level = Logger::DEBUG\n @request = request\n create_headers\n create_body\n end",
"def initialize(request)\n @request = request\n end",
"def initialize(filename_or_io, content_type, upload_as_filename = nil)\n @file_part = Faraday::FilePart.new(filename_or_io, content_type, upload_as_filename)\n end",
"def initialize f\n unless f.instance_of? IO\n f = File.new(f)\n end\n @source = f\n @elements = []\n parse_header f\n parse_body f\n end",
"def build_request(format, hash = {})\n context_object = OpenURL::ContextObject.new\n context_object.referent.set_format(format) if format\n \n hash.each_pair do |key, value| \n context_object.referent.set_metadata(key.to_s, value.to_s)\n end\n \n rft = Referent.create_by_context_object(context_object)\n \n req = Request.new\n req.referent = rft\n req.save!\n \n return req\n end",
"def initialize(params = {})\n @file = params.delete(:filecontents)\n super\n if @file\n self.filename = sanitize_filename(@file.original_filename)\n self.filetype = @file.content_type\n self.filecontents = @file.read\n end\n end",
"def initialize(model, request)\n @model = model\n @request = request\n end",
"def request\n @request ||= HTTPI::Request.new\n @request.url = document\n @request\n end",
"def initialize(io, options = {})\n @io = io\n @format = options[:format] || FILE_FORMATS.first\n \n raise ArgumentError, \"Invalid format option provided #{options[:format]}\" unless FILE_FORMATS.include?(format)\n end",
"def initialize(body: \"\", debug: false, headers: {}, request:)\n @body = body\n @debug = debug\n @headers = headers\n @request = request\n @requested_url = request.path\n end",
"def initialize\n @isRequest = nil\t# true, false and nil\n @httpVersion = 'HTTP/1.1'\n @bodyType = nil\n @bodyCharset = nil\n @bodySize = nil\n @bodyDate = nil\n @headerItem = []\n @chunked = false\n @responseStatusCode = nil\n @reasonPhrase = nil\n @requestMethod = nil\n @requestUri = nil\n @requestQueryUri = nil\n @requestViaProxy = false\n end",
"def initialize(spec, request)\n @spec = spec\n @request = request\n end",
"def create_new_http_request\n # Create a new HTTP request instance\n request_spec = @data[:request][:instance]\n http_class = \"Net::HTTP::#{request_spec.verb._camelize}\"\n http_request = http_class._constantize::new(request_spec.path)\n # Set the request body\n if request_spec.is_io?\n http_request.body_stream = request_spec.body\n else\n http_request.body = request_spec.body\n end\n # Copy headers\n request_spec.headers.each { |header, value| http_request[header] = value }\n # Save the new request\n request_spec.raw = http_request\n # Set user-agent\n if @data[:options].has_key?(:connection_user_agent)\n http_request['user-agent'] ||= @data[:options][:connection_user_agent]\n end\n http_request\n end",
"def set_file_format\n @file_format = FileFormat.find(params[:id])\n end",
"def initialize(input_file, content_type, current_user, opts, log_method)\n @created_refs = []\n @input_file = input_file\n @file_content_type = content_type\n @opts = opts\n @current_user = current_user\n @report_out = []\n @report = BulkImportReport.new\n @start_position\n @need_to_move = false\n @log_method = log_method\n @is_xslx = @file_content_type == \"xlsx\"\n @is_csv = @file_content_type == \"csv\"\n @validate_only = opts[:validate]\n end",
"def initialize(file_name, initial_data = {})\n @file_name = file_name\n super initial_data\n end",
"def initialize(request, params)\n @request = request\n @params = params\n end",
"def initialize(params, user, appeal = nil, mail_package = nil)\n @params = params.slice(:veteran_file_number, :document_type, :document_subject, :document_name, :file, :application)\n @user = user\n @appeal = appeal\n @mail_package = mail_package\n end",
"def initialize(request)\n @req = request\n @version = @req[:version]\n @session = parse_session unless @type == :audio_player\n @context = parse_context unless @req[:context].nil?\n @id = nil\n @timestamp = nil\n @locale = nil\n parse_base_params(@req[:request])\n end",
"def initialize(options = {})\n @options = options\n @request_options = {}\n end",
"def initialize(params)\n if params[:url]\n @input = {type: :url, value: params[:url][:url]}\n @sample_name = params[:url][:name]\n elsif params[:image]\n @input = {type: :text, value: process_image(params[:image])}\n @sample_name = params[:sample][:name]\n elsif params[:tweet]\n @input = {type: :text, value: fetch_tweets(params[:tweet][:content])}\n @sample_name = params[:tweet][:name]\n elsif params[:file]\n parsed_file = Yomu.new params[:file].tempfile\n @input = {type: :text, value: parsed_file.text}\n @sample_name = params[:file].original_filename\n else\n @input = {type: :text, value: params[:sample][:content]}\n @sample_name = params[:sample][:name]\n end\n end",
"def new\n @request = Request.new\n respond_with(@request)\n end",
"def initialize(object, file)\n super(object, file)\n @parameters = object.parameters.map { |parameter| Parameter.new(parameter) }\n end",
"def initialize(data, current_file: nil, **options)\n begin\n current_file ||= Download.open_each(data, unzip: FILE_PATTERNS, downcase: true, tmpdir: options[:tmpdir]).first\n rescue Unzip::PathNotFound\n raise ImportError, INVALID_ARCHIVE\n end\n\n case ::File.extname(current_file.path.downcase)\n when '.kml'\n __setobj__(KMLFile.new(current_file, **options))\n when '.shp'\n __setobj__(Shapefile.new(current_file, **options))\n when '.json', '.geojson'\n __setobj__(ESRIGeoJSON.new(current_file.path, **options))\n else\n raise ImportError, \"Could not import file. \" + SUPPORTED_FORMATS\n end\n end",
"def initialize(input_file)\n\t\tsuper(input_file)\n\t\t\n\tend",
"def create_request(path)\n Fron::Request.new \"#{@rest_options.url}/#{path}\", 'Content-Type' => 'application/json'\n end",
"def create_request(path)\n Fron::Request.new \"#{@rest_options.url}/#{path}\", 'Content-Type' => 'application/json'\n end",
"def initialize\n @output = VersionedFiles.format_options['output']\n @fm_mods = VersionedFiles.frontmatter\n end",
"def build_net_http_request request\n\n # Net::HTTP adds a content-type header automatically unless its set\n # and this messes with request signature signing. Also, it expects\n # all header values to be strings (it call strip on them).\n headers = { 'content-type' => '' }\n request.headers.each_pair do |key,value|\n headers[key] = value.to_s\n end\n\n request_class = case request.http_method\n when 'GET' then Net::HTTP::Get\n when 'PUT' then Net::HTTP::Put\n when 'POST' then Net::HTTP::Post\n when 'HEAD' then Net::HTTP::Head\n when 'DELETE' then Net::HTTP::Delete\n else raise \"unsupported http method: #{request.http_method}\"\n end\n\n net_http_req = request_class.new(request.uri, headers)\n net_http_req.body = request.body\n net_http_req\n\n end",
"def initialize(params={})\n @url = params[:url]\n @content = params[:content]\n @content_type = params[:content_type] || (@content ? guess_content_type : nil)\n @url_file_path = nil\n @directory_path = nil\n @filename = nil\n end",
"def initialize file_path\n\t\t\t@file_path = file_path\n\t\t\t@meta = {}\n\t\tend",
"def initialize(options)\n initialize_options(options)\n initialize_headers\n http_request\n end",
"def initialize(request, response, body = nil)\n @request = request\n @response = response\n @body = body\n end",
"def request\n @request ||= Request.new(::Minfraud::HTTPService.configuration)\n end",
"def initialize(base_uri, options={})\n @base_uri = base_uri\n @uri_parts = []\n @headers = options[:headers] || {}\n @params = options[:params] || {}\n @extension = options[:extension]\n end",
"def initialize uri = nil, response = nil, body_io = nil, code = nil\n @uri = uri\n @body_io = body_io\n @code = code\n\n @full_path = false unless defined? @full_path\n\n fill_header response\n extract_filename\n\n yield self if block_given?\n end",
"def initialize(id, file_name, file_data, file_type)\n @id = id\n @file_name = file_name\n @file_data = file_data\n @file_type = file_type\n end",
"def initialize(filename_or_io, content_type, filename = nil, opts = {})\n io = filename_or_io\n local_path = \"\"\n if io.respond_to? :read\n # in Ruby 1.9.2, StringIOs no longer respond to path\n # (since they respond to :length, so we don't need their local path, see parts.rb:41)\n local_path = filename_or_io.respond_to?(:path) ? filename_or_io.path : \"local.path\"\n else\n io = File.open(filename_or_io)\n local_path = filename_or_io\n end\n filename ||= local_path\n\n @content_type = content_type\n @original_filename = File.basename(filename)\n @local_path = local_path\n @io = io\n @opts = opts\n end",
"def initialize(pdf_file_path, params = {})\n params.merge!(DEFAULTS)\n @options = OpenStruct.new(params)\n @pdf_file_path = pdf_file_path\n self.class.base_uri DopisOnlineClient.base_uri\n end",
"def initialize(input_file)\n @input_file = input_file\n @source = File.new(input_file)\n end",
"def initialize(_request, _output)\n super\n @env = request.env\n @input = request.input\n end",
"def init_request(opts)\n raise ArgumentError, \":uri is for backwards compatibilty and conflicts with :request\" \\\n if opts[:request] && opts[:uri]\n\n # For backwards compatibilty\n if opts[:uri]\n HTTP::Request.new(:uri => opts[:uri], :verb => :get)\n else\n opts.fetch(:request)\n end\n end",
"def initialize(input_file_name, include_path)\n @input_file_name = input_file_name\n @include_path = include_path\n @options = nil\n end",
"def initialize(attr = nil, &block)\n __debug_items(binding)\n attr = attr.fields if attr.is_a?(Upload)\n attr = attr.merge(initializing: true).except!(:reset) if attr.is_a?(Hash)\n super(attr, &block)\n __debug_items(leader: 'new UPLOAD') { self }\n end",
"def initialize\n @format = 'json'\n @scheme = 'https'\n @host = 'api.taxamo.com'\n @base_path = ''\n @user_agent = \"ruby-swagger\"\n @inject_format = true\n @force_ending_format = false\n @camelize_params = false\n end",
"def initialize(request:, response: nil)\n @request = request\n @response = response\n end",
"def initialize(hash, from, path, args)\n @hash = hash\n @from = from\n @path = path\n begin\n @format = path.match(/\\.([A-z]+)$/).to_a[1].to_sym\n rescue\n @format = nil\n end\n @args = args\n end",
"def initialize(request=nil) \n\t# if is not wrapped in a transaction then we'll wrap it to make unified handling of the request\t\n\tif !check_transaction(request)\t\t\n\t\treq_hash = HashWithIndifferentAccess.new\n\t\treq_hash[:transaction] = HashWithIndifferentAccess.new\n\t\treq_hash[:transaction][:transactionNum] = -1 \t\t\t\t\n\t\treq_list = Array.new\n\t\treq_list << request\n\t\treq_hash[:transaction][:operations] = req_list\n\t\t@request = req_hash\n\telse\n\t\t@request = request\n\tend\t \n end",
"def new\n #@request = Request.new\n end",
"def initialize file, in_opts={}\n opts = in_opts.to_hwia :name, :cache, :content_type, :inline, :disposition, :content\n opts.disposition ||= opts.inline.class == TrueClass ? 'inline' : 'attachment'\n opts.cache = true if opts.cache.nil?\n\n file = file.to_s if file.class == Pathname\n file = 'public/%s' % file unless file[0, 1] == '/'\n\n @ext = file.include?('.') ? file.split('.').last.to_sym : nil\n @file = file\n @opts = opts\n end",
"def initialize(file_path)\n @file_path = file_path\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(*args)\n @options = {\n :access_level => 'public-read',\n :file_mapping => nil,\n :object => nil\n }\n @options.update(args.extract_options!)\n @options.stringify_keys!\n\n @raw_file = args.first\n @config = configuration\n @connection = Uv::Storage::Connection.new(self.config)\n @object = @options['object']\n\n debug \"Initializing new Uv::Storage::File\"\n debug \"Args First is a: #{args.first.class.to_s}\"\n debug \"Config loaded: #{config.present?}\"\n debug \"Connection loaded: #{connection.present?}\"\n debug \"Object given: #{object.present?}\"\n debug \"Raw File given: #{@raw_file.present?}\"\n debug \"Options given: #{options.present?}\"\n debug \"Identifier given: #{options['identifier'].present?}\"\n\n validate_object(@object) if @object.present?\n end",
"def request_parser\n return @_request_parser if @_request_parser\n\n klass = parser_class(stringy_media_type)\n raise Errors::InternalError, \"Parser for #{stringy_media_type} is not available\" unless klass\n\n @_request_parser = klass.new(model: server_model, media_type: stringy_media_type)\n end",
"def create\n\t\t@request = Request.new( update_request_params )\n\n\t\trespond_to do |format|\n\t\t\tif @request.save\n\t\t\t\tformat.json { render json: @request, status: :created }\t\t\t\t\n\t\t\telse\n\t\t\t\tformat.json { render json: @request.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def process_file\n instance_variable_get(:@fields).keys.each do |locale|\n request = Request.new(\n client,\n process_url(locale),\n {},\n nil,\n version: sys[:version]\n )\n request.put\n end\n sys[:version] += 1\n self\n end",
"def initialize(params = {})\n @multipart_params = []\n push_params(params)\n end",
"def initialize(record_file)\n @record_file = record_file\n end",
"def initialize(raw_response, req, ignore_signature_check = false)\n @raw_response, @request = raw_response, req\n parse ignore_signature_check\n end",
"def initialize(request, data={}) #:nodoc:\n @request, @data = request, data\n @code, @message = data[:code] || FX_OK, data[:message]\n end",
"def initialize(request, response)\n @request = request\n @response = response\n end",
"def generate_request(request)\n\n\t\t\trequest_uri = request[:uri].request_uri\n\n\t\t\tcase request[:method]\n\t\t\twhen :get\n\t\t\t\treq = Net::HTTP::Get.new request_uri\n\t\t\twhen :post\n\t\t\t\treq = Net::HTTP::Post.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :put\n\t\t\t\treq = Net::HTTP::Put.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :patch\n\t\t\t\treq = Net::HTTP::Patch.new request_uri, {'Content-Type' => \"application/json\"}\n\t\t\t\treq.body = request[:body]\n\t\t\t\treq\n\t\t\twhen :delete\n\t\t\t\treq = Net::HTTP::Delete.new request_uri\n\t\t\tend\n\t\tend",
"def build_request(method)\n Request.create(method) do |req|\n req.params = self.params.dup\n req.headers = self.headers.dup\n req.options = self.options\n yield(req) if block_given?\n end\n end",
"def initialize(request, client = Pusher)\n @client = client\n # For Rack::Request and ActionDispatch::Request\n if request.respond_to?(:env) && request.respond_to?(:content_type)\n @key = request.env['HTTP_X_PUSHER_KEY']\n @signature = request.env[\"HTTP_X_PUSHER_SIGNATURE\"]\n @content_type = request.content_type\n\n request.body.rewind\n @body = request.body.read\n request.body.rewind\n else\n @key, @signature, @body = request.values_at(:key, :signature, :body)\n @content_type = request[:content_type] || 'application/json'\n end\n end",
"def initialize(file)\n @file = file\n\n case ext = File.extname(file)\n when '.till', '.til'\n fname = file.chomp(ext)\n else\n fname = file\n end\n\n #@format = File.extname(fname)\n @location = File.dirname(File.expand_path(file))\n\n text = File.read(file).rstrip\n\n # front matter indicator\n if text =~ /\\A---/\n text = text.sub(/---.*?\\n/, '')\n meta, body = *text.split(/^---/)\n else\n meta = nil\n body = text\n end\n\n @content = body\n\n fm = meta ? YAML.load(meta) : {}\n\n self.filters = fm['filter'] || ['erb']\n\n self.format = fm['format'] || File.extname(fname)\n\n if fm['output']\n self.output = fm['output']\n else\n self.output = fname #.chomp(extension) #+ DEFAULT_CONVERSIONS[filters.last]\n end\n\n\n\n #@context = Context.new(@location) # prime context/scope\n end",
"def initialize(file)\n @file = file\n @file_reader = FILE_READER.new(@file)\n @byte_stream = BYTE_STREAM.new\n @pdf_stamper = PDF_STAMPER.new @file_reader, @byte_stream, 0, true\n @form_fields = @pdf_stamper.getAcroFields\n @xfa = @form_fields.getXfa\n end",
"def initialize(path, format=:markdown)\n raise ArgumentError, \"File [#{path}] does not exist!\" unless File.exists?(path)\n raise ArgumentError, \"File required!\" unless File.file?(path)\n @path = path\n @format = detect_format(path)\n @content = \"\"\n end",
"def initialize session, file_name, length, num_chunks, chunk_length, hash, host_uri\n\t\t\t\t@session = session\n\t\t\t\t@file_name = file_name\n\t\t\t\t@length = length\n\t\t\t\t@num_chunks = num_chunks\n\t\t\t\t@chunk_length = chunk_length\n\t\t\t\t@hash = hash\n\t\t\t\t@host_uri = host_uri\n\t\t\tend",
"def initialize(options = {})\n super\n @http_post_format = options[:http_post_format]\n end",
"def initialize(request_url, params, client, options = {})\n if params.is_a?(String)\n @string_params = params\n @hash_params = Hash.from_url_params(params)\n else\n unless options.kind_of?(Hash)\n options = {}\n end\n options[:skip_param_keys] ||= []\n #this is a bit of helpful sugar for rails framework users\n options[:skip_param_keys] |= ['action','controller']\n\n if params.respond_to?(:reject)\n params.reject! {|key, val| options[:skip_param_keys].include?(key) }\n else\n params = {}\n end\n @hash_params = params\n @string_params = InboundRequest.get_http_params(@hash_params)\n end\n #puts \"Params are: #{params.inspect}\"\n @request_url = request_url\n @client = client\n @supplied_signature = @hash_params[self.class::SIGNATURE_KEY]\n @allow_sigv1 = options[:allow_sigv1] || false\n end",
"def initialize(resource, request_env)\n @object = resource\n @request_env = request_env\n end",
"def initialize(request, **_options)\n @request = request\n @params = request.query_parameters\n end",
"def request\n OpenStruct.new\n end",
"def build_request\n case action\n when 'charge'\n self.class.include Requests::ChargeRequest\n validate_charge_params!\n @request = build_charge_request\n when 'refund'\n self.class.include Requests::RefundRequest\n validate_refund_params!\n @request = build_refund_request\n when 'payment_status'\n self.class.include Requests::PaymentStatusRequest\n validate_payment_status_params!\n @request = build_payment_status_request\n when 'create_card_token'\n self.class.include Requests::CreateCardTokenRequest\n validate_card_token_params!\n @request = build_create_card_token_request\n when 'list_tokens'\n self.class.include Requests::ListTokensRequest\n validate_list_tokens_params!\n @request = build_list_tokens_request\n when 'delete_token'\n self.class.include Requests::DeleteTokenRequest\n validate_delete_token_params!\n @request = build_delete_token_request\n end\n # rubocop:enable Metrics/AbcSize\n # rubocop:enable Metrics/MethodLength\n end",
"def initialize(data, format = nil)\n @data = data.respond_to?(:read) ? data : StringIO.new(data.to_s)\n #@format = DateFormat.new(format || guess_date_format || 'dd/mm/yyyy')\n @format = DateFormat.new('mm/dd\\'yy')\n read_header\n raise(UnrecognizedData, \"Provided data doesn't seems to represent a QIF file\") unless @header\n raise(UnknownAccountType, \"Unknown account type. Should be one of followings :\\n#{SUPPORTED_ACCOUNTS.keys.inspect}\") unless SUPPORTED_ACCOUNTS.keys.collect(&:downcase).include? @header.downcase\n reset\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(rt)\n @parameters = []\n\n formatter = rt.path.build_formatter\n parts = []\n matcher = []\n\n # Yes, this is a hack. Yes, it will probably break. No, it's not 'temporary'.\n internal = formatter.instance_variable_get :@parts\n internal.each do |part|\n if part.is_a? String\n parts << part\n matcher << part\n elsif part.is_a? ActionDispatch::Journey::Format::Parameter\n parts << \":#{part.name}\"\n @parameters << part.name\n matcher << if rt.requirements[part.name.to_sym]\n rt.requirements[part.name.to_sym]\n else\n '[^/]+'\n end\n elsif part.is_a? ActionDispatch::Journey::Format\n matcher << '(?:\\.[^/]+)?'\n end\n end\n\n @path = parts.join\n @url_details = rt.requirements\n @verb = rt.verb\n @request_line = \"#{@verb} #{@path}\"\n @regex = Regexp.new \"^#{matcher.join}$\"\n end",
"def initialize(file)\n @file = file\n end",
"def initialize(request_info, connection = nil)\n @request_info = request_info\n @connection = connection\n @finished_read = false\n end",
"def initialize(init_via = nil)\n super(init_via)\n\n # Validate that required fields are present, at least - if we've downloaded it from a url\n parse_error! unless location\n end",
"def fa_request(fn, name, *_)\n ix = convert_integer(fn, \"!File number\")\n @files[ix] = {name: name.sub(/^\\*/,''), path: get_file_name(name), number: ix}\n end",
"def initialize(input_file)\n\t\tsuper(input_file)\n\n\t\t@subject_uris = []\n\n\t\t@batch.record_filter = ->(record) {\n\t\t\n\t\t return false unless record.class.record_type == 'subject'\n\t\t\n\t\t return true unless record['jsonmodel_type'] == 'subject' \n\t\t \n\t\t other = @batch.working_area.find {|rec| rec['jsonmodel_type'] == 'subject'}\n\n\t\t if other\n\t\t\trecord.to_hash(:raw).each do |k, v|\n\t\t\t if k == 'authority_id' then other[k] = \" \" end\n\t\t\t\tif k == 'source' then other[k] = \"import\" end #add source\n\t\t\t\tnext if k == 'jsonmodel_type'\n\t\t\t\tnext if k == 'name_order'\n\t\t\t\tnext if k == 'source'\n\t\t\t\tnext if k == 'external_ids'\n\t\t\t\tnext if k == 'uri'\n\t\t\t\tnext unless other[k].is_a? String \n\t\t\t\tnext if record[k].eql?(other[k]) \n\t\t\t\tother[k] << \"#{v}\"\n\t\t\tend\n\t\t\t\n\t\t\tother['terms'][0]['term'] = other['terms'][0][:term].chomp(\".\") #remove period\n\t\t\t\t\n\t\t\tfalse\n\t\t else\n\t\t\t@subject_uris << record['uri']\n\t\t\ttrue\n\t\t end\n\t\t \n\t\t}\n\t end",
"def initialize(options = {})\n @file = options[:file]\n @text = options[:text]\n @url = options[:url]\n end",
"def initialize(object, file)\n super(object, file)\n @name = object.name\n @parent_class = object.parent_class\n end",
"def create_modified_emf(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end"
] | [
"0.653213",
"0.64824104",
"0.64722526",
"0.6420625",
"0.63006014",
"0.6044487",
"0.60231537",
"0.60041815",
"0.6000828",
"0.59933305",
"0.59850824",
"0.5964369",
"0.592677",
"0.59205765",
"0.5905416",
"0.5888999",
"0.5816779",
"0.58095914",
"0.5792755",
"0.5728092",
"0.571404",
"0.5696302",
"0.56874335",
"0.5673394",
"0.5651061",
"0.55699813",
"0.5543505",
"0.55374837",
"0.5524164",
"0.5520337",
"0.5516905",
"0.54893893",
"0.5481629",
"0.54804295",
"0.5477221",
"0.5476202",
"0.54752386",
"0.54638267",
"0.54638267",
"0.54576695",
"0.54410684",
"0.5438037",
"0.5437673",
"0.5437528",
"0.54170585",
"0.5408523",
"0.54080474",
"0.54013526",
"0.5396501",
"0.53948635",
"0.5393",
"0.5382844",
"0.5373762",
"0.53655756",
"0.536333",
"0.5355256",
"0.53519905",
"0.5342753",
"0.5331449",
"0.5325468",
"0.5316891",
"0.53099084",
"0.5306339",
"0.53032994",
"0.53032994",
"0.5303287",
"0.53015435",
"0.5300579",
"0.5296802",
"0.52830076",
"0.5281124",
"0.5281029",
"0.5277226",
"0.52768666",
"0.52708143",
"0.5266148",
"0.5265157",
"0.5264001",
"0.52601093",
"0.52593815",
"0.5243905",
"0.52421033",
"0.5238633",
"0.5233305",
"0.5233003",
"0.5229371",
"0.522475",
"0.52204037",
"0.52110857",
"0.52110857",
"0.52110857",
"0.52101755",
"0.52062035",
"0.51952827",
"0.51902056",
"0.5186036",
"0.51802605",
"0.51798195",
"0.5179503",
"0.5174693"
] | 0.60909516 | 5 |
Adds another line to the request. The line should be provides as a hash of the fields parsed from the line. | def add_parsed_line (parsed_line)
value_hash = parsed_line[:line_definition].convert_captured_values(parsed_line[:captures], self)
value_hash[:line_type] = parsed_line[:line_definition].name
value_hash[:lineno] = parsed_line[:lineno]
add_line_hash(value_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_line(line)\n @lines << line\n line\n end",
"def add_line(line)\n @entries << line\n end",
"def add_line(line)\n\t\t@lines << line\n\tend",
"def add(context, line)\n\t\t\t@lines << @line.new(context, line)\n\t\tend",
"def append_line(line)\n @entries.last.line << line\n end",
"def append_line(line)\n @lines.push(line)\n @current = false\n @current_pos = 0\n end",
"def add_line_item_from_string(input_line)\n parsed_line = /(?<quantity>\\d+) (?<item>.+) at (?<price>\\d*\\.\\d{2})?/.match(input_line)\n new_line_item = LineItem.new(parsed_line['quantity'],parsed_line['item'],parsed_line['price'])\n @line_items << new_line_item\n end",
"def add_line(line)\n @text_lines << line.upcase_trim\n end",
"def <<(line)\n @extra << line\n end",
"def <<(line)\n line.blank? ? (@lines << line) : (self[line.key] = line) ; self\n end",
"def add_line(line)\n unless @parsing\n if line =~ /^(---|\\+\\+\\+) (.*)$/\n self.file_name = $2\n elsif line =~ /^@@ (\\+|\\-)(\\d+)(,\\d+)? (\\+|\\-)(\\d+)(,\\d+)? @@/\n @line_num_l = $2.to_i\n @line_num_r = $5.to_i\n @parsing = true\n end\n else\n if %r{^[^\\+\\-\\s@\\\\]}.match?(line)\n @parsing = false\n return false\n elsif line =~ /^@@ (\\+|\\-)(\\d+)(,\\d+)? (\\+|\\-)(\\d+)(,\\d+)? @@/\n @line_num_l = $2.to_i\n @line_num_r = $5.to_i\n else\n parse_line(line, @type)\n end\n end\n return true\n end",
"def add_line(line)\n @tip.string_content += line.slice(@offset, line.length) + '\\n'\n end",
"def addline(line, order)\n\t\t#steps.create(installation_id: self, line_id: line.id, order: order)\n\t\tactive_steps.create(line_id: line.id, order: order)\n\tend",
"def add_location(path, line); end",
"def line(&block)\n attributes[:lines] << Line.build(&block)\n end",
"def add_line_details(line_doc)\n id = parse_xml(line_doc/'id') if (line_doc/'id').first\n line = bank_transaction_lines.find_or_build(id) if line_doc.name == 'bank_transaction_line'\n if line\n line.apply_attributes(line_doc) \n line.fill_default_detail_values\n self.max_serial_no = line.serial_no = (self.max_serial_no.to_i + 1).to_s if line.new_record?\n end\n line\n end",
"def line_params\n params.require(:line).permit(:name, :description, :user_id, :board_id)\n end",
"def line=(line)\n @parsed_rules.line = line if @parsed_rules\n super\n end",
"def setLine (line)\n @line = line\n end",
"def collect_order_line(shop_id, order_id, order_line)\n request(:post, \"shops/#{shop_id}/orders/#{order_id}/order_lines\", body: order_line).tap do |response|\n raise InvalidResponse, response.body unless response.status == 201\n end\n end",
"def line_params\r\n params.require(:line).permit(:name)\r\n end",
"def update!(**args)\n @line = args[:line] if args.key?(:line)\n end",
"def append_new_line(new_line)\n # Append 'line' into position 'line_number'\n puts ' append_new_line ...' if $verbose > 1\n @lines << new_line\n @line_count += 1\n end",
"def line_params\n params.require(:line).permit(:next_node_id, :description)\n end",
"def line=(line)\r\n members.each {|m| m.line = line}\r\n @line = line\r\n end",
"def add_line_item(line_item)\n raise(TypeError) unless line_item.is_a?(LineItem)\n @line_items << line_item if line_item.validate\n end",
"def line_params\n params.require(:inspection_line).permit(:id, :inspection_id, :line_id)\n end",
"def dup_adding_state(line)\n self.class.new(queue, codec, path).add_state(line)\n end",
"def push_line(timestamp, logline)\n lines << [timestamp, logline]\n stats[logline.method] += 1\n stats[:requests] += 1\n end",
"def line_params\n params.require(:line).permit(:buyer, :description, :unit_price, :quantity, :total, :address, :supplier, :attchment_id)\n params[\"line\"][\"total\"] = (params[\"line\"][\"unit_price\"].to_f * params[\"line\"][\"quantity\"].to_f).to_s\n params.require(:line).permit(:buyer, :description, :unit_price, :quantity, :total, :address, :supplier, :attchment_id)\n end",
"def line_one=(line_one)\n @line_one = line_one\n end",
"def add(station, line)\n # add station to line\n l = @lines.fetch(line) do\n @lines[line] = line\n end\n\n l.stations << station unless l.stations.include?(station)\n\n # add line to station\n s = @stations.fetch(station) do\n @stations[station] = station\n end\n\n s.lines << l unless s.lines.include?(l)\n end",
"def line\n\t\t\t@line.set(buffer.line.start, buffer.line.end)\n\t\tend",
"def line_params\n params.require(:line).permit(:user_id, :verb_id, :start_time, \n :note, :object, :people, :photo, :place, :price, :url)\n end",
"def add_line_to_file file_path,line\n return \"echo #{line} >> #{file_path}\"\n end",
"def <<(line)\n if line.kind_of?(IniParse::Lines::Section)\n raise IniParse::LineNotAllowed,\n \"You can't add a Section to an OptionCollection.\"\n end\n\n if line.blank? || (! has_key?(line.key))\n super # Adding a new option, comment or blank line.\n else\n self[line.key] = [self[line.key], line].flatten\n end\n\n self\n end",
"def add_line(point1, point2)\n end",
"def insert_from_line( line )\n begin\n row = line.chomp.parse_csv\n @cached << record( row )\n rescue\n print '#'\n end\n\n flush_inserts if @cached.size >= CACHE_SIZE\n end",
"def add(entry, lines)\n # this assumes that entry is unique\n @entries << entry\n @entries_with_lines[entry] = lines\n @lines += lines\n self\n end",
"def set_line\n @line = Line.find(params[:id])\n end",
"def set_line\n @line = Line.find(params[:id])\n end",
"def set_line\n @line = Line.find(params[:id])\n end",
"def append_to_block(line)\n @block_buffer = (@block_buffer || '') + line\n end",
"def append_line\n File.open(path, 'w') do |fh|\n lines.each do |l|\n fh.puts(l)\n end\n fh.puts line\n end\n end",
"def handle_add_line_to_values(line, values, open_tags)\n line.match(OPEN_TAG)\n open_tags.each do |t|\n next if t == $1\n if values[t] == nil\n values[t] = line\n else\n values[t] += line\n end\n end\n return values\n end",
"def insert_line\n\t\t@first = params[:placement]['first'].to_f\n\t\t@second = params[:placement]['second'].to_f\n\t\t@new_order_number = @first + ( @second - @first ) / 2\n\t\t@lyric_id = params[:lyric_id]\n\t\t@lyric_line = LyricLine.new lyric_id: @lyric_id, order_number: @new_order_number\n\t\t@new = true\n\tend",
"def add_line\n @layout.add_widget(HLine.new)\n end",
"def add(product, qty)\n l = LineItem.new\n l.set_from_product(product, qty)\n @lines << l\n end",
"def set_line\r\n @line = Line.find_by_id(params[:id])\r\n end",
"def add_to_line_item(line_item, variant, quantity, currency=nil, shipment=nil, price=nil)\n if line_item\n line_item.target_shipment = shipment\n line_item.quantity += quantity.to_i\n line_item.currency = currency unless currency.nil?\n line_item.save\n else\n line_item = order.line_items.new(quantity: quantity, variant: variant)\n # line_item = Spree::LineItem.new(quantity: quantity)\n line_item.target_shipment = shipment\n line_item.variant = variant\n if currency\n line_item.currency = currency unless currency.nil?\n line_item.price = price || variant.price_in(currency).amount\n else\n line_item.price = price || variant.price\n end\n # order.line_items << line_item\n # line_item\n end\n \n line_item.save\n order.reload\n line_item\n end",
"def enter_line(line)\n handle_fiber(line.chomp)\n end",
"def process_line(line)\n\n # get the details from each line\n elements = line.split(';').each { |e| e.strip! }\n name = elements[0]\n address = elements[1]\n phone = elements[2]\n fax = elements[3]\n email = elements[4]\n \n # get the postcode from the address\n temp = address.split(',').each { |e| e.strip! }\n postcode = temp.last\n \n # remove the period\n if (postcode.end_with?(\".\"))\n postcode = postcode[0..-2]\n end\n \n #lookup the latitude and longitude from the postcode\n point = PostCodeLookup.new(postcode.sub(/ /, '')).lookup\n location = LibraryLocation.new($bcc_library, name, address, point)\n\n @@address_list << location\n end",
"def clothing_line_params\n params.require(:clothing_line).permit(:name, :tag_line, :description, :user_id)\n end",
"def line_params\n params.require(:line).permit(:name, :diversion_rate)\n end",
"def lineitem_params\n params.require(:lineitem).permit(:line_part, :line_order, :line_name, :line_price, :line_notes)\n end",
"def on_method_add_block(begin_line, end_line)\n if begin_line && end_line\n @begins_to_ends[begin_line] = end_line\n end\n end",
"def update\n\t\told_lyric = LyricLine.find params[:id]\n\t\ttext = params[:lyric_line][:text]\n\t\tp text\n\t\tif text.length < 1 || text == old_lyric.text || !/\\w/.match(text)\n\t\t\t# don't save, add line back\n\t\t\t@placeholder = 'please enter a line'\n\t\t\tdump_line old_lyric\t\n\t\telse\n\t\t\tlyric_line = LyricLine.new params[:lyric_line]\n\t\t\tlyric_line.version_number = get_next_version( lyric_line )\n\t\t\tlyric_line.save\n\t\t\t@first = params[:first]\n\t\t\tdump_line lyric_line\n\t\tend\n\tend",
"def process_line(line)\n @line = line\n if line =~ /^=/ then\n process_heading_line(line)\n elsif (listtype = special_list_line_type(line)) then\n special_list_line(listtype, line)\n elsif line =~ /^\\s*:/ then\n special_list_continuation_line(line)\n else\n @interp.normal_line(line)\n end\n end",
"def add_line_item(args=nil)\n line_item = Wheretocard::LineItem.new(args)\n line_items << line_item\n return line_item\n end",
"def line_params\n params.require(:procedure_line).permit(:id, :procedure_id, :line_id)\n end",
"def add(*args)\n clear_line\n super(*args)\n end",
"def ensure_line_appended_to_file(path, line)\n remove_line_from_file(path, line)\n append_line_to_file(path, line)\n end",
"def send_line (line)\n send_data line.to_s\n end",
"def applied_line_params\n params.require(:applied_line).permit(:code)\n end",
"def parse_line(line)\n target, operator, *commande = line.split(' ')\n self[target] = [] if self[target].nil?\n self[target] << [operator == '+=', Proc.new {|repository| eval(commande.join(' ')) }]\n end",
"def add_line(line_index, str, align = 0, outlinesize = Text::Util::DEFAULT_OUTLINE_SIZE, type: Text, color: nil, dx: 0)\n sprite_stack.add_line(line_index, str, align, outlinesize, type: type, color: color, dx: dx)\n end",
"def process_line(line) \n array = line.split(\" \")\n price = array.last\n item = array[0..-3].join(\" \")\n @item_hash[item] = price\n self.calculate_tax(item, price)\n end",
"def link_line_item(line_item)\n self.spree_line_item_id = line_item.id\n self.save!\n end",
"def mg_request(*_)\n next_line = get_line\n exit if next_line == /^\\*+$/\n self.merge_string = next_line||''\n end",
"def add_line_to_file(file, line)\n File.open(file, \"a\") {|f| f.puts(\"#{line}\")}\n end",
"def line &block\n receive_line_callbacks << block\n end",
"def fill_hash_record_from_line(column_names, headers, line)\n hash_record = {}\n fields = line.split(@sep)\n\n fields.each_with_index do |field, field_id|\n hash_record[headers[field_id]] = field if column_names.include?(headers[field_id])\n end\n\n hash_record\n end",
"def process(time_stamp, line)\n @entries << Entry.new(time_stamp, line)\n end",
"def handle_add_line_to_value(line, t, values)\n if values[t] == nil\n values[t] = Generator.new(line)\n else\n values[t].append_value(line)\n end\n return values\n end",
"def parse_line(line)\n results = LineRegexp.match(line)\n if results \n @elements[:line] = results[-1]\n results[-1] # remaining line \n else\n @elements[:line] = line\n line \n end\n end",
"def line_detail_params\n params.require(:line_detail).permit(:title, :description, :line_id, :country_id)\n end",
"def order_line_params\n params.require(:order_line).permit(:order_id, :product_id, :quantity, :value, :status)\n end",
"def set_req_ord_line\n @req_ord_line = ReqOrdLine.find(params[:id])\n end",
"def add_line_item_to_order( variant )\n duplicate_line_item = line_item_exists?( variant )\n duplicate_line_item.quantity += 1 and return duplicate_line_item if duplicate_line_item\n\n line_items.build :name => variant.good.name, \n :price => variant.price, \n :options => variant.option_values_to_s,\n :sku => variant.sku\n end",
"def set_line\n @line = Line.find(params[:id])\n @node = @line.node\n @diagram = @node.diagram\n head :forbidden unless @line.user_id == current_user.id\n end",
"def add_comment_line line\n @strings << line\n end",
"def original_line; end",
"def process_line(_line)\n raise NotImplementedError\n end",
"def parse(line)\n @io.rewind\n @io.truncate(0)\n @io << line\n @io.rewind\n @csv.shift\n end",
"def line\n @line ||= Line.get(@attrs['Line'])\n end",
"def as_line\n [id, legal_name, name, email, form].join(':')\n end",
"def parse_line(line)\n ln, fn, mi, sex, fav_color, dob = line.split(' | ')\n LineParser.to_h(fn, ln, mi, sex, fav_color, parse_dob(dob))\n end",
"def process_line(line)\n line = line.chomp\n if line.match(/^Add /)\n @credit_cards << CreditCard.create(parse_credit_card_line(line))\n elsif line.match(/^Charge /)\n charge = parse_charge_line(line)\n if cc = CreditCard.first(:person => charge[:person])\n cc.charge(charge[:amount])\n end\n elsif line.match(/^Credit /)\n credit = parse_credit_line(line)\n if cc = CreditCard.first(:person => credit[:person])\n cc.credit(credit[:amount])\n end\n end\n end",
"def update\n respond_to do |format|\n if @line.update(line_params)\n format.html { redirect_to @line, notice: \"Line was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_line(x, y, label=\"data #{@dataxy.length + 1}\")\n @dataxy << [label, x, y]\n end",
"def create\n @line = Line.new(line_params)\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to @line, notice: \"Line was successfully created.\" }\n format.json { render :show, status: :created, location: @line }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def network_line_params\n params.require( :network_line ).permit( :code, :label, :seqno, :location_code_id, :note )\n end",
"def new_line\n @source_lines << []\n end",
"def ll_request(*args)\n self.line_length = convert_expression(self.line_length, args, \"Line length\")\n end",
"def add_error(line)\n add_value(line, \"error\")\n end",
"def submit_line\n line = self.line\n return unless line\n\n self.read_only = true\n\n change_cursor do |c|\n c.move_position Qt::TextCursor::End\n c.merge_char_format ANSIToQt::Styles[:clear]\n c.insert_text \"\\n\"\n end\n\n enter_line(line)\n end",
"def phone_line_params\n params.require(:phone_line).permit(:number, :SIM_key)\n end",
"def <<(line)\n add(UnorderedListItem.new(line))\n end",
"def parse_body(line)\n return :break if @length&.zero?\n\n if @transfer_encoding == \"chunked\"\n parse_body_chunked(line)\n else\n puts \"Http2: Adding #{line.to_s.bytesize} to the body.\" if @debug\n @response.body << line\n @http2.on_content_call(@args, line)\n return :break if @response.content_length && @response.body.length >= @response.content_length # rubocop:disable Style/RedundantReturn\n end\n end",
"def add_line_item(params)\r\n # Creates line items counter necessary for prefix.\r\n @LINE_ITEMS = 0 if !@LINE_ITEMS \r\n @LINE_ITEMS += 1 # VALUE REQUIRED IN:\r\n prefix = \"LV3_ITEM#{@LINE_ITEMS}_\" # USA | CANADA\r\n @PARAM_HASH[prefix + 'UNIT_COST'] = params[:unit_cost] # * *\r\n @PARAM_HASH[prefix + 'QUANTITY'] = params[:quantity] # * *\r\n @PARAM_HASH[prefix + 'ITEM_SKU'] = params[:item_sku] || '' # *\r\n @PARAM_HASH[prefix + 'ITEM_DESCRIPTOR'] = params[:descriptor] || '' # * *\r\n @PARAM_HASH[prefix + 'COMMODITY_CODE'] = params[:commodity_code] || '' # * *\r\n @PARAM_HASH[prefix + 'PRODUCT_CODE'] = params[:product_code] || '' # * \r\n @PARAM_HASH[prefix + 'MEASURE_UNITS'] = params[:measure_units] || '' # * *\r\n @PARAM_HASH[prefix + 'ITEM_DISCOUNT'] = params[:item_discount] || '' # *\r\n @PARAM_HASH[prefix + 'TAX_RATE'] = params[:tax_rate] || '' # * \r\n @PARAM_HASH[prefix + 'GOODS_TAX_RATE'] = params[:goods_tax_rate] || '' # *\r\n @PARAM_HASH[prefix + 'TAX_AMOUNT'] = params[:tax_amount] || '' # * \r\n @PARAM_HASH[prefix + 'GOODS_TAX_AMOUNT'] = params[:goods_tax_amount] || '' # *\r\n @PARAM_HASH[prefix + 'CITY_TAX_RATE'] = params[:city_tax_rate] || '' #\r\n @PARAM_HASH[prefix + 'CITY_TAX_AMOUNT'] = params[:city_tax_amount] || '' #\r\n @PARAM_HASH[prefix + 'COUNTY_TAX_RATE'] = params[:county_tax_rate] || '' #\r\n @PARAM_HASH[prefix + 'COUNTY_TAX_AMOUNT'] = params[:county_tax_amount] || '' #\r\n @PARAM_HASH[prefix + 'STATE_TAX_RATE'] = params[:state_tax_rate] || '' #\r\n @PARAM_HASH[prefix + 'STATE_TAX_AMOUNT'] = params[:state_tax_amount] || '' #\r\n @PARAM_HASH[prefix + 'CUST_SKU'] = params[:cust_sku] || '' #\r\n @PARAM_HASH[prefix + 'CUST_PO'] = params[:cust_po] || '' #\r\n @PARAM_HASH[prefix + 'SUPPLEMENTAL_DATA'] = params[:supplemental_data] || '' #\r\n @PARAM_HASH[prefix + 'GL_ACCOUNT_NUMBER'] = params[:gl_account_number] || '' #\r\n @PARAM_HASH[prefix + 'DIVISION_NUMBER'] = params[:division_number] || '' #\r\n @PARAM_HASH[prefix + 'PO_LINE_NUMBER'] = params[:po_line_number] || '' #\r\n @PARAM_HASH[prefix + 'LINE_ITEM_TOTAL'] = params[:line_item_total] || '' # * \r\n end"
] | [
"0.7293698",
"0.72569835",
"0.7010378",
"0.6998087",
"0.69378567",
"0.65400636",
"0.65014666",
"0.6469612",
"0.64541084",
"0.6437858",
"0.6375269",
"0.6327599",
"0.62233853",
"0.6197437",
"0.61816984",
"0.6145997",
"0.6134345",
"0.6134159",
"0.61280876",
"0.61050147",
"0.6056929",
"0.6034831",
"0.60249835",
"0.60152936",
"0.60137784",
"0.59914416",
"0.59904313",
"0.5983919",
"0.5973287",
"0.5918737",
"0.59002596",
"0.59000087",
"0.5874558",
"0.5859999",
"0.58545053",
"0.5835609",
"0.5833541",
"0.5824673",
"0.582319",
"0.5804906",
"0.5804906",
"0.5804906",
"0.5803073",
"0.57641065",
"0.57613873",
"0.57347906",
"0.57241803",
"0.5720814",
"0.5710251",
"0.5703442",
"0.56816095",
"0.56654006",
"0.56591505",
"0.5640845",
"0.5619044",
"0.56083107",
"0.5602213",
"0.5593702",
"0.55873364",
"0.5586474",
"0.55839694",
"0.557564",
"0.5571349",
"0.55643183",
"0.555878",
"0.5553703",
"0.55353415",
"0.55352354",
"0.5531849",
"0.5526153",
"0.55197465",
"0.55153584",
"0.55131423",
"0.55065155",
"0.55007744",
"0.5496393",
"0.5494299",
"0.5480069",
"0.5464474",
"0.54621947",
"0.545924",
"0.54561996",
"0.5442829",
"0.5437761",
"0.54318714",
"0.5430864",
"0.54298717",
"0.5424303",
"0.5418611",
"0.54174644",
"0.5412918",
"0.5412415",
"0.54049766",
"0.5401779",
"0.53953004",
"0.5390298",
"0.5381538",
"0.5374003",
"0.5358845",
"0.5357651"
] | 0.7030503 | 2 |
Checks whether the given line type was parsed from the log file for this request | def has_line_type?(line_type)
return true if @lines.length == 1 && @lines[0][:line_type] == line_type.to_sym
@lines.detect { |l| l[:line_type] == line_type.to_sym }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_line?(line)\n end",
"def parse_line(line)\n catch :line_parsed do\n UNDERSTOOD_ROWS.each do |record_type|\n if line.start_with?(record_type)\n send \"parse_#{record_type.downcase}_line\", line.chomp\n throw :line_parsed\n end\n end\n\n if line[0].eql?('/')\n parse_comment_line line.chomp\n throw :line_parsed\n end\n\n logger.error \"Can't understand line: #{line.chomp.inspect}\"\n end\n end",
"def potential_line?(filename, lineno); end",
"def valid?(line)\n true\n end",
"def check_line(filename, line_number, line_content)\n\t\tend",
"def line_type(line)\n\n\t# Examples:\n\t# BRAN (looking down): I promise.\n\t# THE HOUND: It’s not hunting if you pay for it.\n\t# TYRION: The greatest in the land. My spear never misses.\n\t# SEPTA MORDANE (to SANSA): Fine work, as always. Well done.\n\n\tif line =~ /^([\\(\\)\\w\\s]*?)\\:(.*?)$/\n\t\treturn :character_line\n\tend\n\n\treturn :exposition\nend",
"def type_check(activity, line_num, file_read)\n if contains_keyword(activity)\n handle_keywords(activity, line_num, file_read)\n elsif check_variables(activity)\n handle_variables(activity, line_num)\n elsif integer?(activity[0])\n 3\n else\n puts \"Line #{line_num}: unknown keyword #{activity[0]}\"\n -4\n end\n end",
"def assert_parse_ok(type, line)\n assert_nothing_raised do\n assert parser_with_mocks(type).send(\"parse_#{type}\", line)\n end\n end",
"def hasline?(line)\n\t\tlines.include?(line)\n\tend",
"def definition_line?(line)\n terms = line.split(' ')\n is_definition = terms.include?('class') || terms.include?('module')\n error_definition = line.include?('Error') || line.include?('Exception')\n is_definition && !error_definition\n end",
"def handle_text_line(line, record)\n line =~ record.match ? {:record_type => record.name, :line => line} : nil\n end",
"def parse_line(line)\n raise Puppet::DevError, \"No record types defined; cannot parse lines\" unless records?\n\n @record_order.each do |record|\n # These are basically either text or record lines.\n method = \"handle_#{record.type}_line\"\n if respond_to?(method)\n if result = send(method, line, record)\n record.send(:post_parse, result) if record.respond_to?(:post_parse)\n return result\n end\n else\n raise Puppet::DevError,\n \"Somehow got invalid line type #{record.type}\"\n end\n end\n\n nil\n end",
"def match?(line)\n return false unless self.to_regexp.match(line.value)\n true\n end",
"def add_line(line)\n unless @parsing\n if line =~ /^(---|\\+\\+\\+) (.*)$/\n self.file_name = $2\n elsif line =~ /^@@ (\\+|\\-)(\\d+)(,\\d+)? (\\+|\\-)(\\d+)(,\\d+)? @@/\n @line_num_l = $2.to_i\n @line_num_r = $5.to_i\n @parsing = true\n end\n else\n if %r{^[^\\+\\-\\s@\\\\]}.match?(line)\n @parsing = false\n return false\n elsif line =~ /^@@ (\\+|\\-)(\\d+)(,\\d+)? (\\+|\\-)(\\d+)(,\\d+)? @@/\n @line_num_l = $2.to_i\n @line_num_r = $5.to_i\n else\n parse_line(line, @type)\n end\n end\n return true\n end",
"def irrelevant_line?(source_line); end",
"def check_for_the_message (line) \n File.readlines(get_system_log).grep(line).any? \n end",
"def process_line(line)\n if @state.include?(:data)\n process_data_line(line)\n elsif @state.include?(:auth_plain_incomplete)\n process_auth_plain_line(line)\n elsif @state.include?(:auth_login_incomplete)\n process_auth_login_line(line)\n else\n process_command_line(line)\n end\n !@state.include?(:quit) # return true unless QUIT is given\n end",
"def class_line?(line)\n line.include?('class') && !line.include?('func') && !line.include?('//') && !line.include?('protocol') && !line.include?('\"')\n end",
"def timing_line?\n\t\tif @value =~ /\\d{2}:\\d{2}:\\d{2},\\d{3}\\s-->\\s\\d{2}:\\d{2}:\\d{2},\\d{3}/\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def is_entry?(line)\n begin\n is_entry!(line)\n return true\n rescue InvalidDigestEntry\n return false\n end\n end",
"def should_parse?(line)\n stripped = line.strip\n (!stripped.empty?) && (!stripped.start_with?('#'))\n end",
"def process_line( line )\n if line =~ /\\*#{@action}\\*/\n changed\n log = @log_class.new( line ) \n notify_observers( log )\n end\n end",
"def get_type\n \"line\"\n end",
"def line?\n !export? && !alias?\n end",
"def line_filter(line)\n entry_pattern.match(line)\n end",
"def checkLine\r\n\t\tif(@Line == \"\" || @Line == nil || @Line == \"\\n\" || @Line == \"\\r\\n\")\r\n\t\t\tnextLine\r\n\t\tend\r\n\tend",
"def parse(line)\n raise EntryFileError, \"Do not know how to parse the entries in #{File.basename(@data_file)}!\"\n end",
"def line_import?(ln)\r\n return false unless check_import\r\n\r\n ln = ln.strip\r\n words = ln.split(\" \")\r\n is_kword = settings.import_kwords.include?(words[0])\r\n return false unless is_kword\r\n\r\n head << ln unless head.include?(ln) || local_import?(ln, words)\r\n true\r\n end",
"def matches_command_type?(command_type)\n raise \"No command type was specified.\" if command_type.nil?\n return !(@line =~ /\\A#{command_type} /).nil?\n end",
"def should_ignore_log_message(line)\n if not @ignorable_messages.select { |regex| regex.match(line) }.empty?\n return true\n end\n\n if @valgrind\n if not @valgrind_ignorable_messages.select { |regex| regex.match(line) }.empty?\n return true\n end\n end\n return matches_expected_logged?(line)\n end",
"def handle(line)\n parsed = parse(line)\n return unless parsed\n\n handle_parsed(parsed)\n end",
"def special_list_line_type(line)\n case line\n when /^\\s*TODO:/ then :TODO\n when /^\\s*DONE:/ then :DONE\n when /^\\s*FUTURE:/ then :FUTURE\n else nil\n end\n end",
"def process_line(line)\n @line = line\n if line =~ /^=/ then\n process_heading_line(line)\n elsif (listtype = special_list_line_type(line)) then\n special_list_line(listtype, line)\n elsif line =~ /^\\s*:/ then\n special_list_continuation_line(line)\n else\n @interp.normal_line(line)\n end\n end",
"def log_line_parse(line, options={})\n options={\n :link_to_url => nil, #url /browse/server/#chatroom/00000000\n }.update options\n if line =~ /^---/\n \"\" #strip log open/close stuff. \n else\n date = line[0..7] #ignore 00:00:00\n hx = Digest::MD5.hexdigest(date)\n line = line[8..-1]\n type = case line\n when /^ * [^ ]+ /\n :action_line\n when /^<.[^>]+>/\n :message_line\n when /^-!-/\n case line\n when /now known as/\n :nick_change_line\n when /has (joined|left|quit)/\n :join_part_quit_line\n when /^-!- mode\\//\n :mode_change_line\n end\n end\n type = :unknown_line unless type\n date_line = '<span class=\"line-date\">'\n date_line << \"<a href=\\\"#{options[:link_to_url]}##{hx}\\\">\" if options[:link_to_url]\n date_line << date\n date_line << '</a>' if options[:link_to_url]\n date_line << '</span>'\n%s{<span class=\"line-date\">#{date}</span>}\n<<-END\n <div class=\"#{type}\"><a name=\"#{hx}\">\n #{date_line}\n <span class=\"line-body\">\n #{send(type, line)}\n </span>\n </a></div>\nEND\n end\nend",
"def is_http_header? line\n line.split(':').length == 2\n end",
"def valid?\n begin\n self.class.from_line( to_s )\n rescue ArgumentError, RuntimeError\n false\n else\n true\n end\n\n end",
"def check_run_type(file_line)\n if !file_line.nil?\n command = file_line\n else\n print '> '\n command = gets\n end\n command.split\n end",
"def checklogs(entry)\r\n @data_logs.each do |line|\r\n if line =~ /#{entry}/\r\n @log.debug \"Checklogs found:\\\"#{line}\\\"\"\r\n return true\r\n end\r\n #p line \r\n end\r\n return false\r\n end",
"def parse_type(lines)\n tokens = lines.shift.split\n if tokens.size != 3 || tokens[0] != 'type' || tokens[1] != '=' || tokens[2] !~ /\\w+/\n raise \"Invalid type specification '#{str}'\"\n end\n type = tokens[2]\n raise \"Invalid project type '#{type}'\" if !ProjectType::valid? type\n @type = type\n end",
"def matches_logfile?(path); end",
"def process_line(line)\n return true if line.empty?\n\n chunks = line.split(SPLIT_PATTERN, fmt.length)\n enough_fields?(line) # can raise exception\n\n point = { path: extract_path(chunks),\n value: extract_value(chunks) }\n\n tags = line_tags(chunks)\n\n point.tap do |p|\n p[:tags] = tags unless tags.empty?\n p[:ts] = extract_ts(chunks) if fmt.include?('t')\n p[:source] = extract_source(chunks) if fmt.include?('s')\n p[:interval] = options[:interval] || 'm' if fmt.include?('d')\n end\n end",
"def check_line(file_name, line_number, line_content)\n\t\tif (line_content.length > LONG_LINE_LENGTH) then\n\t\t\tadd_note(MsfLint::Note::WARNING, \"Line exceeding #{LONG_LINE_LENGTH.to_s} bytes\", line_number) \n\t\tend\n\tend",
"def irrelevant_line?(source_line)\n source_line.blank? || !count_comments? && comment_line?(source_line)\n end",
"def looks_like_json? line\n !!(line =~ /^\\s*\\{/)\n end",
"def log_message_matching_type(message_type, log_message)\n match_data = /^\\s+#{message_type}\\s+(.*)/.match(log_message)\n if match_data\n json_info = match_data[1]\n\n parsed_data = JSON.parse(json_info)\n parsed_data if parsed_data.has_key?('headers') && parsed_data.has_key?('body')\n end\nend",
"def check_line(file_name, line_number, line_content)\n\t\tif (line_content.length > LONG_LINE_LENGTH) then\n\t\t\tadd_note(LintWorm::Note::WARNING, \"Line exceeding #{LONG_LINE_LENGTH.to_s} bytes\", line_number) \n\t\tend\n\tend",
"def test_text_line\n comment = \"# this is a comment\"\n\n # Make sure it fails if no regex is passed\n assert_raise(ArgumentError) do\n @parser.text_line :comment\n end\n\n # define a text matching comment record\n assert_nothing_raised do\n @parser.text_line :comment, :match => /^#/\n end\n\n # Make sure it matches\n assert_nothing_raised do\n\n assert_equal(\n {:record_type => :comment, :line => comment},\n\n @parser.parse_line(comment))\n end\n\n # But not something else\n assert_nothing_raised do\n assert_nil(@parser.parse_line(\"some other text\"))\n end\n\n # Now define another type and make sure we get the right one back\n assert_nothing_raised do\n @parser.text_line :blank, :match => /^\\s*$/\n end\n\n # The comment should still match\n assert_nothing_raised do\n\n assert_equal(\n {:record_type => :comment, :line => comment},\n\n @parser.parse_line(comment))\n end\n\n # As should our new line type\n assert_nothing_raised do\n\n assert_equal(\n {:record_type => :blank, :line => \"\"},\n\n @parser.parse_line(\"\"))\n end\n\n end",
"def match?(ast)\n source_line == ast.line\n end",
"def detected?(line)\n\t\t\tdmesg_timestamp = DmesgTimestamp.new(line)\n\t\t\tif dmesg_timestamp.valid?\n\t\t\t\tif @large_dmesg_timestamps.size < 3 || @large_dmesg_timestamps.any? {|large_dmesg_timestamp| large_dmesg_timestamp <= dmesg_timestamp}\n\t\t\t\t\t@large_dmesg_timestamps.push(dmesg_timestamp)\n\t\t\t\t\t@large_dmesg_timestamps = @large_dmesg_timestamps.drop(1) if @large_dmesg_timestamps.count > 3\n\n\t\t\t\t\t@small_dmesg_timestamps.clear\n\t\t\t\telse\n\t\t\t\t\t@small_dmesg_timestamps.push(dmesg_timestamp)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@small_dmesg_timestamps.count >= 3\n\t\tend",
"def comment_line?(line_source); end",
"def comment_line?(line_source); end",
"def valid_line_for line, regexp\n @has_id_col = nil\n @line_id = nil\n return nil unless line_match = line.match(regexp)\n return nil if @options[:id] &&\n has_id_col?(line_match) &&\n @options[:id] != line_id(line_match)\n line_match\n end",
"def process_line(_line)\n raise NotImplementedError\n end",
"def is_orig_word_line(line)\n line.match(@orig_word_regex)\n end",
"def is_entry?(line)\n begin\n is_entry!(line)\n return true\n rescue InvalidPasswdEntry\n return false\n end\n end",
"def parse_and_validate_line(line)\n\n entry = parse_entry(line)\n return entry unless entry.parse_ok?\n\n valid_chain=is_valid_hash(entry)\n @invalid += 1 if valid_chain === false\n @num += 1\n\n entry\n end",
"def parse_ok?\n return false if @severity.nil? || @severity.length != 1\n return false if @fields.nil? || @fields.length < ChainLog::Formatter::NUM_FIELDS\n true\n end",
"def check_line(line, line_number)\n line_words = self.class.word_splitter(line)\n line_words.each do |word|\n word_is_right, spell_checked_word = check_word(word, line_number)\n next if word_is_right.is_a?(TrueClass)\n @incorrect_words << spell_checked_word\n end\n end",
"def parse_line(line)\n case line\n when /^SF:(.+)/\n @current_filename = $~[1].gsub(/^\\.\\//, '')\n source_files[@current_filename] = []\n when /^DA:(\\d+),(\\d+)/\n line_no = $~[1]\n covered = $~[2]\n source_files[@current_filename] << [line_no.to_i, covered.to_i]\n when /^(BRF|BRH):(\\d+)/\n # branches found/hit; no-op\n when /^BRDA:(\\d+),(\\d+),(\\d+),(-|\\d+)/\n line_no = $~[1]\n block_no = $~[2]\n branch_no = $~[3]\n covered = ($~[4] == '-' ? '0' : $~[4])\n source_files[@current_filename] << [line_no.to_i, block_no.to_i, branch_no.to_i, covered.to_i]\n when /^end_of_record$/, /^$/\n @current_filename = nil\n else\n raise LcovParseError, \"could not recognise '#{line}' as valid LCOV\"\n end\n end",
"def valid_file\n @file.present? && @file.content_type == 'text/csv'\n end",
"def receive_valid_lines_from_file\n File.readlines(FILE_NAME).select { |line| line.downcase.include?('post') }\nend",
"def types(file, line, col); end",
"def types(file, line, col); end",
"def applicable?(line)\n uncolored_line = color.uncolor(line.chomp)\n case selector\n when String\n uncolored_line.include?(selector)\n when Regexp\n selector.match(uncolored_line)\n when Symbol\n SPECIAL_SELECTORS[selector].match(uncolored_line)\n else\n false\n end\n end",
"def comment_line?(line_source)\n /^\\s*#/.match?(line_source)\n end",
"def header_line_rate?\n !additional_headers.nil? && additional_headers.include?(:line)\n end",
"def valid?(line_token)\n\t\tline_token[0] == 'VOTE' && line_token[1].scan(/\\D/).empty? && line_token[2].scan(/^Campaign:[a-zA-Z]+/).any? && line_token[3].scan(/^Validity:(during|pre|post)/) && line_token[4].scan(/^Choice:[a-zA-Z]+/).any?\n\tend",
"def get_line_types\n @lines.line_types\n end",
"def is_multiline?(line) # ' '[0] == 32\n line && line.length > 1 && line[-1] == MULTILINE_CHAR_VALUE && line[-2] == 32\n end",
"def valid?\n raise 'ChangelogLine subclass must implement the valid? method'\n end",
"def process_line line\n if looks_like_json?(line)\n process_line_of_json_in_new_pipe(line)\n else\n process_line_of_tsv_in_this_pipe(line)\n end\n end",
"def line_exists?(line_index)\n line_index >= 0 && line_index < total_lines\n end",
"def run( lines )\r\n # Check if this rule already evaluated to true\r\n return if self.result == true\r\n # Check if input is empty\r\n return if self.pattern == \"\"\r\n\r\n if lines.kind_of?(String)\r\n self.result = check_string( lines )\r\n elsif lines.kind_of?(Array)\r\n self.result = check_array( lines )\r\n else\r\n puts \"#{self.class}:run: Received invalid input of type: #{lines.class}\"\r\n return false\r\n end\r\n\r\n puts \"#{self.result.to_s.upcase}: #{self.class}: #{self.pattern}\" if @@DEBUG == true\r\n end",
"def parse_line(line)\n results = LineRegexp.match(line)\n if results \n @elements[:line] = results[-1]\n results[-1] # remaining line \n else\n @elements[:line] = line\n line \n end\n end",
"def has_lines?\n @lines.any?\n end",
"def parse_logline(line) \n line.strip!\n split_line = line.split(/\\|/)\n addr = split_line[0].split(',').last.strip\n\n unless (addr =~ /[\\s|\\-]+/) \n @dns_map.synchronize do\n addr = @dns_map[addr] if @dns_map.include? addr\n end\n details = {}\n details[:upstream_response_time] = split_line[1].split(',').last.strip.to_f\n details[:time_local] = DateTime.strptime(split_line[2], '%d/%b/%Y:%H:%M:%S %Z')\n details[:status] = split_line[3].to_i\n details[:request_length] = split_line[4].to_i\n details[:body_bytes_sent] = split_line[5].to_i\n\n\n @log_entries.synchronize do\n @log_entries[addr] << details\n end\n end \n end",
"def is_method_start_line?(line)\n split_line = line.split(/\\ /)\n result = false\n if split_line.length == 2\n if split_line.last[-1] == \"(\"\n result = true\n end\n end\n result\nend",
"def should_accumulate_output?(line)\n\n # Special case: Preserve line breaks in block code mode.\n return false if preserve_whitespace?\n\n # Special case: Multiple blank lines get accumulated.\n return true if line.paragraph_type == :blank and @output_type == :blank\n \n # Currently only \"paragraphs\" get accumulated with previous output.\n return false unless line.paragraph_type == :paragraph\n if ((@output_type == :ordered_list) or\n (@output_type == :definition_list) or\n (@output_type == :unordered_list)) then\n\n # If the previous output type was a list item, then we only put a paragraph in it\n # if its indent level is greater than the list indent level.\n\n return false unless line.indent > @list_indent_stack.last\n end\n\n # Only accumulate paragraphs with lists & paragraphs.\n return false unless\n ((@output_type == :paragraph) or\n (@output_type == :ordered_list) or\n (@output_type == :definition_list) or\n (@output_type == :unordered_list))\n true\n end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def lines?\n @lines\n end",
"def isLineEmpty(theLine)\n\n\treturn theLine[:text].empty? && theLine[:comment].empty?\nend",
"def valid_record?\n status = (config['BATCH']['record_type']? parse(config['BATCH']['record_type'] ) != 'INV' : true)\n return status\n end",
"def enough_fields?(line)\n ncols = line.split(SPLIT_PATTERN).length\n return true if fmt.include?('T') && ncols >= fmt.length\n return true if ncols == fmt.length\n\n raise(WavefrontCli::Exception::UnparseableInput,\n format('Expected %<expected>s fields, got %<got>s',\n expected: fmt.length,\n got: ncols))\n end",
"def whichLine(stop)\n\tif lines[\"n\"].include? 'Times'\n\t\t# puts \"yes\"\n\telse\n\t\t# puts \"no\"\n\tend\nend",
"def is_entry!(line)\n raise InvalidDigestEntry, \"line commented out\" if line =~ /\\A#/\n parts = line.strip.split(\":\")\n raise InvalidDigestEntry, \"line must be of the format username:realm:md5checksum\" if parts.size != 3\n raise InvalidDigestEntry, \"md5 checksum is not 32 characters long\" if parts.last.size != 32\n raise InvalidDigestEntry, \"md5 checksum has invalid characters\" if parts.last !~ /\\A[[:xdigit:]]{32}\\Z/\n return parts\n end",
"def multiline_kspawn? line\n if @kspawn_multiline\n @kspawn[:text] << line\n if line.include?(\"~\")\n @kspawn_multiline = false\n # However nothing but whitespace can follow that tilde!\n validate_tilde(\n line: line,\n line_number: @current_line,\n present: false\n )\n end\n true\n else\n false\n end\n # Returning true skips the rest of the parse method for this line\n end",
"def emit? line\n MATCHER.match line\n end",
"def parse_line(lineno)\n @native_text[lineno] = @content_type_handler.parse_line( @list[lineno]) \n end",
"def error_line(logs)\n logs.select { |line| line.downcase =~ /.*error.*/ }\nend",
"def should_be_final_class_line?(line)\n class_line?(line) && !line.include?('final') && !line.include?('open')\n end",
"def multi_line?\n @buffer.is_a?(Array)\n end",
"def line_regex\n @line_regex ||= /\\<(\\d+)\\>(1) (\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(?:\\.\\d+)?\\+00:00) ([a-z0-9\\-\\_\\.]+) ([a-z0-9\\.-]+) ([a-z0-9\\-\\_\\.]+) (\\-) (.*)$/\n end",
"def parse line\n normalize(@lexer.tokenize(line)).select { |t| t.is_a? String }\n end",
"def is_csv_file?(file_content_type)\n file_content_type == \"text/plain\"\n end",
"def validate\n @lines.select! do |line|\n line.include?(\"The configuration is\") || # success\n line.include?(\"Error: \") # error\n end\n end",
"def verify_comment(line) \n end",
"def check?(token_type)\n return false if at_end?\n return peek.type == token_type\n end",
"def validate_import_file(data)\n\t\tbegin\n\t\t\timport_filetype_detect(data)\n\t\trescue DBImportError\n\t\t\treturn false\n\t\tend\n\t\treturn true\n\tend",
"def feed(line, labelhash)\n @skip = line.empty? || (line =~ /^\\;(-)\\1*$/)\n\n # this goes first\n is_done? line\n return if @done || @skip\n\n is_name? line\n is_flags? line\n is_tags? line\n is_stack? line\n is_vocab? line\n is_code? line,labelhash\n\n # this goes last\n is_desc? line\n end",
"def postprocess_print(send, type, line)\n if type == \"syntaxchecksuccess\"\n return syntax_check_success(send, line)\n\n elsif type == \"syntaxcheckfail\"\n return syntax_check_fail(send, line)\n\n elsif type == \"augmentsuccess\"\n return augment_success(send, line)\n\n elsif type == \"augmentfail\"\n return augment_fail(send, line)\n\n elsif type == \"executeoutput\"\n return execute_output(send, line)\n\n elsif type == \"executeerror\"\n return execute_error(send, line)\n end\n end"
] | [
"0.6875566",
"0.6819655",
"0.6388828",
"0.6379881",
"0.6297805",
"0.6271115",
"0.6238997",
"0.6210488",
"0.62095916",
"0.6170423",
"0.61668384",
"0.6092322",
"0.60567945",
"0.60485834",
"0.60405564",
"0.6032809",
"0.60096717",
"0.5962498",
"0.59406424",
"0.59359866",
"0.59309846",
"0.5924356",
"0.58337176",
"0.5820209",
"0.5805861",
"0.5777543",
"0.5773647",
"0.577227",
"0.57466793",
"0.5718069",
"0.56886476",
"0.5662201",
"0.56509715",
"0.56436294",
"0.56399757",
"0.5587972",
"0.5568127",
"0.5532619",
"0.5515697",
"0.5496033",
"0.54843473",
"0.547911",
"0.54738307",
"0.54606897",
"0.5458272",
"0.5448348",
"0.5440601",
"0.54379386",
"0.5425469",
"0.54244214",
"0.54244214",
"0.5402151",
"0.54007745",
"0.53872603",
"0.53614765",
"0.53574455",
"0.53407806",
"0.533842",
"0.53247595",
"0.52987754",
"0.5293097",
"0.5292878",
"0.5292878",
"0.5280423",
"0.52725685",
"0.5254021",
"0.52510417",
"0.524161",
"0.52333254",
"0.52204734",
"0.5218646",
"0.5217448",
"0.52130526",
"0.521006",
"0.5209743",
"0.5204892",
"0.5201383",
"0.5196216",
"0.51830596",
"0.5173774",
"0.51710427",
"0.5170266",
"0.5164475",
"0.5161253",
"0.51462483",
"0.5143213",
"0.51422393",
"0.5141094",
"0.5138784",
"0.5130261",
"0.5124675",
"0.51029223",
"0.5096695",
"0.50960755",
"0.50826174",
"0.5059918",
"0.50553197",
"0.5053418",
"0.5047902",
"0.50457275"
] | 0.78390855 | 0 |
Returns the value that was captured for the "field" of this request. This function will return the first value that was captured if the field was captured in multiple lines | def first(field)
@attributes[field]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_field_value(value)\r\n value\r\n end",
"def capture_value(line)\n value = line.dup\n [@cell_mapping['capture']].flatten.each do |pattern|\n if matchdata = value.to_s.match(pattern)\n value = matchdata[1]\n else\n value = nil\n end\n end\n value.nil? ? value : value.strip\n end",
"def get_field_value(field)\n field_values = get_fields(field)\n return nil if field_values.blank?\n if field_values.first.delegation_field.multiple\n field_values.map(&:to_value)\n else\n field_values.first.to_value\n end\n end",
"def getVal(line)\n # value must not include space !!\n # eg. \"-parm value\" -> match value only \n\treturn line.match(/(^.+[ ]+)([^ ]+)/)[2]\nend",
"def field_value(field_name, specification_hash, line)\n field_name = field_name.to_s\n content_ar = line.split('')\n value_str = ''\n if !specification_hash.keys.include? field_name \n raise InvalidAttrName, \"The specified attr name was not found in the specification hash.\"\n else\n range = specification_hash[field_name]\n range.each do |n|\n value_str.concat content_ar[n]\n end\n value_str.strip\n end\n end",
"def first_subfield_value(tag)\n sf = @field.subfields.select { |sf| sf.code == tag}\n return '' if sf.empty?\n sf.first.value\n end",
"def seperate_request_line()\n\t\t@stream.split(\"\\n\", 2)[0]\n\tend",
"def [](field_name)\n f = field(field_name)\n f && f.value\n end",
"def fetch_field\n return nil if @field_index >= @fields.length\n ret = @fields[@field_index]\n @field_index += 1\n ret\n end",
"def extract_single_value(row, field)\n values = extract_values(row, field)\n return nil unless values.count.positive?\n\n values.first\n end",
"def field_value\n if check_version_of(\"mail\", \"> 2.7.0\")\n %w(unparsed_value)\n elsif check_version_of(\"mail\", \"= 2.7.0\")\n %w(instance_variable_get @unparsed_value)\n elsif check_version_of(\"mail\", \"< 2.7.0\")\n %w(instance_variable_get @value)\n end\n end",
"def value\n attributes['FieldValue']\n end",
"def each_field\n data['eachField']\n end",
"def subfield_value(field, subfield)\n sub = field.subfields.find {|s| s.code == subfield}\n if sub.nil?\n return nil\n end\n sub.value\nend",
"def get_response_field(field, target)\n return unless @response\n return @response[field] if target == 'header'\n return @response.body if field.nil? || field.empty?\n json = JSON.load(@response.body) rescue nil\n res = nil\n if json\n res = json_field(json, field)\n else\n doc = REXML::Document.new(@response.body)\n elem = doc.elements[field]\n res = elem.get_text.to_s if elem\n end\n res\n end",
"def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend",
"def val_for key\n split(\"\\n\").grep(\n key.is_a?(Regexp) ? key : /(^|^[^\\w]*\\s+)#{Regexp.escape(key)}\\b/\n ).map {|l|\n l.sub(/^[^\\w]*\\s+/, '').\n sub(key.is_a?(Regexp) ? key : /^#{Regexp.escape(key)}\\b\\s*[:=]?/, '').\n sub(/[;,]\\s*$/, '').\n strip\n }.first || ''\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 fields\n @fields ||= @raw_message[1]\n end",
"def extract_field(header, val, processed)\n return if val.blank?\n case header\n when 'type', 'accession_number', 'id', 'status', 'ark', 'call_number', 'preservation_level', 'visibility'\n # single valued fields\n processed[header.to_sym] = val\n when /^(created|issued|date_copyrighted|date_valid)_(.*)$/\n key = \"#{Regexp.last_match(1)}_attributes\".to_sym\n # TODO: this only handles one date of each type\n processed[key] ||= [{}]\n update_date(processed[key].first, Regexp.last_match(2), val)\n when 'collection_id'\n processed[:collections] ||= []\n processed[:collections] << { id: val }\n else\n last_entry = Array(processed[header.to_sym]).last\n if last_entry.is_a?(Hash) && !last_entry[:name]\n update_typed_field(header, val, processed)\n else\n extract_multi_value_field(header, val, processed)\n end\n end\n end",
"def field_content\n value\n end",
"def field\n @field ||= quoted_field(field_name)\n end",
"def parse_single_field(html, field, params) \n # run the gross filter which leaves us with a subtring\n\n # set to nil to start\n instance_variable_set(\"@#{field}\",nil)\n \n gross = html[params[:gross]]\n \n return if gross.nil?\n \n #log_field(field, gross)\n \n # run the fine search\n fine = gross.scan(params[:fine])\n \n result = fine.map do |item|\n # check if the element is an array. If an array, it means that it contains \n # a capture group and we'll need to use the first element. \n val = item.is_a?(Array) ? item[0] : item\n \n #strip those pesky newlines and convert tabs to spaces\n tmp = val.delete(\"\\n\").gsub(/\\t/,\" \").squeeze(\" \").strip\n \n #run whatever filter was passed in\n tmp = params[:filter].call(tmp) unless params[:filter].nil? \n tmp\n end\n\n PatentAgent.dlog \"PTO: <:#{field}>\", result\n\n # if the name ends in s, store as an array, otherwise\n # convert to a string (first element of array) \n item = field.match(/s$/) ? result : result[0].to_s\n instance_variable_set(\"@#{field}\",item)\n item\n\n rescue ParseError => e\n PatentAgent.log \"PTO\", \"Field <:#{field}> not found}\"\n end",
"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 get_field_value(data, field_name)\n data[field_name]['__content__'] if data[field_name]\n end",
"def get_subfield( tag_and_subfield )\r\n tag, subfield = tag_and_subfield.split( /\\s*\\$/ )\r\n subfields = get_subfields( tag )\r\n subfields.values.flatten.each do |sf|\r\n return sf if sf.match( /^\\$#{subfield}/ ) \r\n end\r\n ''\r\n end",
"def get_field(request)\n data, _status_code, _headers = get_field_with_http_info(request)\n request_token if _status_code == 401\n data\n end",
"def read_field\n end",
"def get_string(field)\n field['stringValue']\n end",
"def name\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = 'name'\").first.value\n end",
"def line_one\n return @line_one\n end",
"def imprint_value(field)\n imprint_subfields = field.subfields.select { |sf| sf.value if sf.code =~ /[abcefg]/ }\n imprint_subfields.compact.map { |sf| sf.value.strip }.join(' ').strip\n end",
"def get_ipmi_field(channel, match)\n ouput = %x{ipmitool lan print #{channel}}.split(\"\\n\")\n line = ouput.detect{ |x| x.start_with?(match) }\n value = line.split(':', 2)[1].strip\n value.empty? && nil || value\n end",
"def general_field(name)\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end",
"def line\n lines.first\n end",
"def line_one\n @line_one\n end",
"def field_value(name, field)\n placement_collection[name].collect{|entry| entry[field]}\n end",
"def fetch\n if raw\n values = Array.wrap(super)\n (field =~ /_[a-z]$/) ? values : values.first\n else\n super\n end\n end",
"def get_field(field_name)\n\t\tend",
"def effective_field field\n each do |container|\n return container.value.send(field) unless container.empty?\n end\n nil\n end",
"def parse_values(field)\n if field =~ /^\\w+: (#{match_values})$/\n $1.scan(/(#{match_value})(?:,|$|\\])/).inject([]) do |m, match|\n m << match[0]\n end\n #TODO GC 02/26/2010 - What to do if it does not match the values pattern?\n end\n end",
"def field(l_name)\n fields.find{|fld| fld.l_name == l_name}\n end",
"def get_field_value(label)\n field_detect(label)\n element = @field.all(:css, 'div[class*=\"clearfix data-column\"]').first\n element.all(:css, 'span[class^=\"read edit\"]').each do |entry|\n entry.text\n end\n end",
"def get_variable(row, field)\n val = row.instance_variable_get(\"@#{field}\")\n val.nil? ? '' : val\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 on(field)\n self[field].to_a.first\n end",
"def on(field)\n self[field].to_a.first\n end",
"def find_field(expected_key = nil, &block)\n if block_given?\n each_field do |key, field|\n return field if block.call(key, field)\n end\n else\n each_field do |key, field|\n return field if expected_key == key\n end\n end\n nil\n end",
"def value_at(request, request_pty=false)\n values_at(request, request_pty, 1)[0]\n end",
"def field(var)\n fields.detect { |f| f.var == var }\n end",
"def field(tag)\n return @fields.select{|f| f.tag == tag}\n end",
"def get_field(key,field)\n request :get, \"#{path_prefix}records/#{ue key}?field=#{ue field}\", :accept_404=>true, :force_encoding => \"ASCII-8BIT\", :raw_response => true\n end",
"def get_fields(payload)\n payload['fields']\n end",
"def pid\n @fields.first\n end",
"def field key\n @fields.get key\n end",
"def parse_field(html, field)\n parse_single_field(html, field, FIELDS[field])\n end",
"def fetch_field\n <<-CODE\n t1 = stack_pop();\n t2 = stack_pop();\n stack_push(NTH_FIELD(t2, N2I(t1)));\n CODE\n end",
"def get_string_value(field_name)\n\t\tend",
"def field_value(field)\n @object.respond_to?(field) ? @object.send(field) : ''\n end",
"def value\n @header.input.value.to_s.strip\n end",
"def method_field(name)\n self.method_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end",
"def condition_field\n @rule_details.conditions[0].field\n end",
"def get_value_from(message_field)\n return if message_field.nil?\n\n message_field.public_send(*field_value)\n end",
"def field(issue, field)\n res = \"\"\n issue = issue[\"data\"] if issue.has_key?(\"data\")\n if %w{issuetype status assignee reporter project}.include?(field)\n res = issue[\"fields\"][field][\"name\"] unless issue[\"fields\"][field].nil?\n elsif %w{duedate created updated}.include?(field)\n res = format_date(issue[\"fields\"][field]).strftime(\"%m/%d/%Y\") unless issue[\"fields\"][field].nil?\n else\n res = issue[\"fields\"][field] unless issue[\"fields\"][field].nil?\n end\n res\n end",
"def extract_multi_value_field(header, val, processed, key = nil)\n key ||= header.to_sym\n processed[key] ||= []\n val = val.strip\n # Workaround for https://jira.duraspace.org/browse/FCREPO-2038\n val.delete!(\"\\r\")\n processed[key] << (looks_like_uri?(val) && Image.controlled_properties.include?(header.to_sym) ? RDF::URI(val) : val)\n end",
"def get_value(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_for_item(self)\n end",
"def get(field)\n @headers[field] || EMPTY\n end",
"def getFieldValue( name , formName = \"\" , frameName = \"\" )\n # returns the current value of the field\n \n fname = getFunctionName()\n log fname + ' Starting. getting value for field with name: ' + name if $debuglevel >=0\n\n begin # if there are 2 elements with the same name, we get an exception - so we need a different version of this method\n\n container = getObjectContainer( name , formName , frameName )\n\n o = nil\n v = \"\"\n container.all.each do |c|\n next unless o == nil\n begin\n if c.name.to_s == name \n #log 'Hack:: found the object. '\n o = c\n end\n rescue\n # probably no name\n end\n end\n if o != nil\n v = o.value.to_s\n else\n v = nil\n end\n\n rescue => e\n showException(e)\n v = nil \n end \n return v\n \n end",
"def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a&.send(e) }\n rescue NoMethodError\n ''\n end",
"def parser_received(line)\n\t\tif line.include? MailHeader.received\n @count=@count+1\n # fields=line.split(MailHeader.key_separator)\n if line.length>1\n @received_value=@received_value+line\n end #end fields.length\n else\n if line.include? MailHeader.key_separator\n if received_value.start_with? MailHeader.received\n #get the received value\n # puts @received_value\n end\n @received_value=\"\"\n else\n @received_value=@received_value+line\n end\n end #end line include?\n\n # parser the received from the mail header\n if received_value.include? MailHeader.smtp_code_550 or received_value.include? MailHeader.smtp_code_551 or received_value.include? MailHeader.smtp_code_553 or received_value.include? MailHeader.smtp_code_554\n mail_header_output.correct_email_format=MailHeader.unknown\n elsif received_value.include? MailHeader.smtp_code_552\n #the address is correct\n end\n\tend",
"def field (key)\n\n return self.yattributes[key.to_s] if self.yattributes\n\n fields.find_by_fkey(key.to_s)\n end",
"def get_field_config\n fields = @screen.get_screen_config['fields'].select do |field|\n field['name'] == @name\n end\n\n unless fields.size == 1\n raise \"Invalid results when looking for field '#{@name}'\"\n end\n\n fields[0]\n end",
"def field_value\n opts = selected_options\n opts.count == 1 ? opts.first.text : opts.map(&:text)\n end",
"def handle_record_line(line, record)\n ret = nil\n if record.respond_to?(:process)\n if ret = record.send(:process, line.dup)\n unless ret.is_a?(Hash)\n raise Puppet::DevError,\n \"Process record type #{record.name} returned non-hash\"\n end\n else\n return nil\n end\n elsif regex = record.match\n # In this case, we try to match the whole line and then use the\n # match captures to get our fields.\n if match = regex.match(line)\n fields = []\n ret = {}\n record.fields.zip(match.captures).each do |field, value|\n if value == record.absent\n ret[field] = :absent\n else\n ret[field] = value\n end\n end\n else\n nil\n end\n else\n ret = {}\n sep = record.separator\n\n # String \"helpfully\" replaces ' ' with /\\s+/ in splitting, so we\n # have to work around it.\n if sep == \" \"\n sep = / /\n end\n line_fields = line.split(sep)\n record.fields.each do |param|\n value = line_fields.shift\n if value and value != record.absent\n ret[param] = value\n else\n ret[param] = :absent\n end\n end\n\n if record.rollup and ! line_fields.empty?\n last_field = record.fields[-1]\n val = ([ret[last_field]] + line_fields).join(record.joiner)\n ret[last_field] = val\n end\n end\n\n if ret\n ret[:record_type] = record.name\n return ret\n else\n return nil\n end\n end",
"def line\n\t\treturn @file_data[@current_line]\n\tend",
"def get_field(key)\n @form_fields.getField key.to_s\n end",
"def get_value_from_combined_key(key, field)\n index = BlacklightBrowseNearby::Engine.config.combined_key_pattern.split(delimiter).map{|p|p.strip}.index(field)\n key.split(delimiter)[index].strip\n end",
"def value\n @value ||= extract_value\n end",
"def value(line)\r\n line.split(\" \")[1].to_i\r\nend",
"def getFieldFromText(text)\n if text.nil?\n return nil\n end\n\n ERROR_FIELD_REGEXES.each do |regex|\n field_match = text.match(regex)\n if !field_match.nil?\n field = field_match[1]\n\n if ERROR_FIELDS.keys.include? field\n return ERROR_FIELDS[field]\n end\n return field\n end\n end\n\n return nil\n end",
"def get(field)\n # Get the first/only row as a Hash.\n result = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{@id}\").first\n\n # Return only the value for the key of the field we're seeking.\n return result[field]\n end",
"def imported_field_value(field)\n resource.try(field) || resource.try(:primary_imported_metadata)&.[](field) || parent_resource&.try(field) || parent_resource&.try(:primary_imported_metadata)&.[](field)\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 field(key)\n pdf_field(key).getValueAsString\n rescue NoMethodError\n raise \"unknown key name `#{key}'\"\n end",
"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 [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end",
"def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end",
"def current_value\n get_value_from_combined_key(combined_key, value_field)\n end",
"def get_line\n @lines.shift\n end",
"def get_return_value exp, env = nil\n process_method exp, env\n value = make_return_value\n value.original_line = exp.line\n value\n end",
"def last_for_value\n self.form_field_value.queries.last\n end",
"def getvalue\n @text1\n end",
"def get(field)\n self.class.get(field, @data)\n end",
"def getLine\r\n\t\treturn @Line\r\n\tend",
"def field_value field, options = {}\n field_values(field, options)\n end",
"def text_value\n if full_key.ends_with?('index_id')\n field_value\n elsif full_key.index('index_id')\n path = json_form.element_path_for_object(full_key.split('index_id/').last)\n v = path.reduce(field_value) { |a, e| a.fetch(e, {}) }\n # empty fields sometimes show up as {},\n # when we really want them to be ''\n v == {} ? '' : v\n else\n element_value\n end\n end",
"def val_for key\n split(\"\\n\").val_for(key)\n end",
"def field(name); end",
"def extract_custom_field_value(custom_field_value)\n if custom_field_value.present? && custom_field_value.is_a?(Hash) && custom_field_value.has_key?(:name)\n custom_field_value = custom_field_value[:name]\n end\n\n if custom_field_value.present? && custom_field_value.is_a?(NetSuite::Records::CustomRecordRef)\n custom_field_value = custom_field_value.attributes[:name]\n end\n\n custom_field_value\n end",
"def field_query(field, value)\n \"_query_:\\\"{!field f=#{field}}#{value}\\\"\"\n end"
] | [
"0.63388157",
"0.63243747",
"0.6122165",
"0.6010617",
"0.5935572",
"0.5683793",
"0.56731313",
"0.56578517",
"0.56104916",
"0.5606676",
"0.55306125",
"0.55060524",
"0.5485236",
"0.5479053",
"0.5476118",
"0.54255545",
"0.54047143",
"0.54030895",
"0.5377338",
"0.5360969",
"0.535999",
"0.5359493",
"0.5358487",
"0.5353802",
"0.5326099",
"0.5318177",
"0.53035563",
"0.52923906",
"0.5235041",
"0.52326506",
"0.5228933",
"0.5191234",
"0.5188191",
"0.5166167",
"0.51428264",
"0.5137414",
"0.5135987",
"0.51353985",
"0.5120043",
"0.5117842",
"0.51146567",
"0.5109978",
"0.51095575",
"0.5107381",
"0.5106508",
"0.51030284",
"0.51030284",
"0.51028156",
"0.50985044",
"0.5093253",
"0.509277",
"0.50880337",
"0.5087847",
"0.50840235",
"0.5075679",
"0.50669813",
"0.50628084",
"0.5055992",
"0.5055802",
"0.5054213",
"0.5049028",
"0.50462407",
"0.50447404",
"0.50304466",
"0.50223416",
"0.5017015",
"0.501174",
"0.5006783",
"0.4979542",
"0.49672246",
"0.49608773",
"0.49582323",
"0.49563435",
"0.4950818",
"0.4948266",
"0.49469748",
"0.4945446",
"0.49452165",
"0.49269992",
"0.49264282",
"0.49125102",
"0.49103436",
"0.49102846",
"0.49067575",
"0.49014828",
"0.4897414",
"0.4897414",
"0.48917848",
"0.48826128",
"0.4878774",
"0.48753658",
"0.48728746",
"0.48702744",
"0.48384356",
"0.48360014",
"0.48358342",
"0.48305228",
"0.48301464",
"0.48256856",
"0.48011732"
] | 0.5145488 | 34 |
Returns an array of all the "field" values that were captured for this request | def every(field)
@lines.inject([]) { |result, fields| result << fields[field] if fields.has_key?(field); result }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_fields\n @fields.values\n end",
"def fields\n raw['fields']\n end",
"def all_fields\n fields.values\n end",
"def values\n fields.map { |f| f.value }\n end",
"def fields\n []\n end",
"def fields\n @fields.keys\n end",
"def fields\n @fields.keys\n end",
"def fields\n @fields ||= []\n end",
"def fields\n @fields ||= []\n end",
"def fields\n @fields\n end",
"def fields\n @fields\n end",
"def get_fields(payload)\n payload['fields']\n end",
"def fields\n @fields\n end",
"def contractor_request_all_fields\n ContractorRequest.fields\n end",
"def labor_request_all_fields\n LaborRequest.fields\n end",
"def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end",
"def fields\n FIELDS\n end",
"def fields\n FIELDS\n end",
"def values\n request.values.flatten\n end",
"def get_field_list\n return make_request(\"#{self.endpoint}/list/fields\")\n end",
"def fetch_fields\n @fields\n end",
"def fields\r\n @hash.keys\r\n end",
"def fields\n FIELDS\n end",
"def field_names\r\n return @field_names\r\n end",
"def staff_request_all_fields\n StaffRequest.fields\n end",
"def fields\n @fields ||= @raw_message[1]\n end",
"def fields\n @fields ||= @stats.keys.select{ |k| k != RECORDS_LISTING_KEY}.flatten.uniq\n end",
"def fields\n if frozen?\n Array(@gapi.fields).map { |f| Field.from_gapi(f).freeze }.freeze\n else\n Array(@gapi.fields).map { |f| Field.from_gapi f }\n end\n end",
"def fields\n all_fields\n end",
"def [] field\n f = self.get(field)\n return nil if (f == nil)\n return f.values.to_a\n end",
"def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end",
"def values\n iterator = @form_fields.keySet.iterator\n set = []\n set << field(iterator.next.toString) while iterator.hasNext\n set\n end",
"def response_fields\n return '*' if invalid_param('response_fields')\n\n @params['response_fields'].join(', ')\n end",
"def field_names\n fields.keys\n end",
"def fields\n [*lookup]\n end",
"def all_fields\n found_fields = Array.new\n self.fields.each do |field|\n found_fields << field\n found_fields = found_fields + field.all_fields if field.type == 'ObjectField'\n end\n found_fields\n end",
"def get_fields\n # Initialize fields to return with empty array in order to include all\n fields = []\n delete_fields = []\n query_params = request.query_parameters\n if query_params.has_key? 'fields'\n fields = query_params['fields'].downcase.split(',')\n fields.each do |field|\n delete_fields << field unless (AppData.column_names.include?(field) || (field == 'review'))\n end\n end\n return fields - delete_fields\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n @fields ||= {}\n end",
"def fields\n self.class.fields(true)\n end",
"def fields\n injectors = @injectors || @propagators\n injectors.flat_map(&fields).uniq\n end",
"def values_array\n @_field_path.map{ |field_| @_values[field_.name] }\n end",
"def each_field\n data['eachField']\n end",
"def fields\n @locations.map(&:field).uniq\n end",
"def extract_values(records, field)\n summarize_field(records, field).keys\nend",
"def values\n record && record.to_hash(fields)\n end",
"def values\n @fields.map { |field_name, field| field.values.map(&:to_s) }.transpose\n end",
"def fields; end",
"def fields; end",
"def fields; end",
"def result_fields\n @fields ||= result_meta.collect { |m| m.name }\n end",
"def to_a; @fields end",
"def fields\n @_fields ||= {}\n end",
"def field_extras\r\n return @field_extras\r\n end",
"def to_a\n @fields.collect { |field|\n [ field.name, field.value ]\n }\n end",
"def fields\n preview_json['fields']\n end",
"def field_ids\n @fields.keys\n end",
"def field_values\n fieldset.get_values_using_fsa(self)\n end",
"def signature_fields\n parsed {\n @signature_fields\n }\n end",
"def get_entered_fields\n @entered_fields = get_used_fields_only(@contact_form_field)\n @entered_fields\n end",
"def info_hash\n @fields\n end",
"def jsonapi_fields\n return {} unless params[:fields].respond_to?(:each_pair)\n\n if defined?(ActiveSupport::HashWithIndifferentAccess)\n extracted = ActiveSupport::HashWithIndifferentAccess.new\n else\n extracted = Hash.new\n end\n\n params[:fields].each do |k, v|\n extracted[k] = v.to_s.split(',').map(&:strip).compact\n end\n\n extracted\n end",
"def get_fields\n return (\n _get_specific_action_config(:action_fields, :fields)&.map(&:to_s) ||\n self.get_model&.column_names ||\n []\n )\n end",
"def _get_values\n _fields_map = get_flexi_fields_map\n\n @attributes.map do |k, v|\n field = _fields_map[k]\n raise \"Field - #{k} not defined\" if field.nil?\n VALUE.new(:field => field, value: self.send(:\"#{k}\"))\n end\n end",
"def fields\n form = @stamper.getAcroFields\n form.getFields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = form.getField(name)\n end\n end",
"def fields\n self.find('ns:field', :ns => self.class.registered_ns).map do |field|\n Field.new(field)\n end\n end",
"def fetch_fields\n @result.fetch_fields\n end",
"def form_fields\n params\n end",
"def fields; h.fields; end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def fields\n self.class.fields\n end",
"def on_fields\n unless @on_fields\n @on_fields = collect(&:on_field).map(&:to_sym)\n end\n return @on_fields\n end",
"def fields\n a = attributes.keys.to_a\n a.delete_if { | e | e =~ /^id$/ }\n end",
"def fields_from_model model\n workers_from_model(model).map{ |worker| Array(worker[:fields]) }.flatten\n end",
"def fields\n schema.fields\n end",
"def _field_assignments\n result = []\n @fields.each do |field|\n field_type = field.type.type_sym # Record, Union, Enum, Array or Map\n schema_base_type = _schema_base_class(field.type)\n field_base_type = _field_type(schema_base_type)\n method_argument = %i(array map).include?(field_type) ? 'values' : 'value'\n is_schema_class = %i(record enum).include?(schema_base_type.type_sym)\n\n field_initialization = method_argument\n\n if is_schema_class\n field_initialization = \"#{field_base_type}.initialize_from_value(value)\"\n end\n\n result << {\n field: field,\n field_type: field_type,\n is_schema_class: is_schema_class,\n method_argument: method_argument,\n deimos_type: deimos_field_type(field),\n field_initialization: field_initialization\n }\n end\n\n result\n end",
"def fields\n return @fields if @fields\n @file.rewind\n @fields = @file.gets.split(@separator).map &:strip\n end",
"def fields\n iterator = @form_fields.keySet.iterator\n map = {}\n while iterator.hasNext\n key = iterator.next.toString\n map[key.to_sym] = field(key)\n end\n map\n end",
"def parse_values(field)\n if field =~ /^\\w+: (#{match_values})$/\n $1.scan(/(#{match_value})(?:,|$|\\])/).inject([]) do |m, match|\n m << match[0]\n end\n #TODO GC 02/26/2010 - What to do if it does not match the values pattern?\n end\n end",
"def field_names\n jso.field_names\n end",
"def field_requireds\r\n return @field_requireds\r\n end",
"def fields\n klass.members.map(&:to_sym)\n end",
"def values_for_fields(fields)\n result = {}\n for f in fields\n result[f] = @times.map{|r| r[f] or raise \"Missing field: #{r}\"}\n end\n return result\n end",
"def staff_request_fields\n staff_request_all_fields - %i[nonop_source justification review_comment created_at updated_at]\n end",
"def get_fields(request)\n data, _status_code, _headers = get_fields_with_http_info(request)\n request_token if _status_code == 401\n data\n end",
"def changed_fields\n items = @resource.changed_from_previous_curated\n return ['none'] unless items.present?\n\n items\n end",
"def field_names\n internal_format.keys\n end",
"def fields\n schema.fields\n end",
"def fields\n schema.fields\n end",
"def fields\n schema.fields\n end",
"def field_names\n @_field_path.map{ |field_| field_.name }\n end",
"def fields\n DatasetService.get_fields dataset_id, api_table_name\n end",
"def contractor_request_fields\n contractor_request_all_fields - %i[nonop_source justification review_comment created_at updated_at]\n end",
"def get_fields(type)\n @instrumented_field_map[type.graphql_name]\n end",
"def get_fields(type)\n @instrumented_field_map[type.name]\n end"
] | [
"0.7208588",
"0.7194795",
"0.7139729",
"0.7124164",
"0.70785457",
"0.7053813",
"0.7053813",
"0.69502896",
"0.6927054",
"0.69231707",
"0.69231707",
"0.68249375",
"0.6796875",
"0.67787254",
"0.6765378",
"0.67451906",
"0.6731101",
"0.67275864",
"0.67081785",
"0.667635",
"0.6667414",
"0.66576374",
"0.66530377",
"0.6651883",
"0.6613471",
"0.6549525",
"0.6539592",
"0.65259534",
"0.65258545",
"0.6523745",
"0.6483181",
"0.6469196",
"0.6463566",
"0.6455277",
"0.64181566",
"0.64112604",
"0.63887644",
"0.6386415",
"0.6386415",
"0.6386415",
"0.6386415",
"0.6386415",
"0.6366006",
"0.6361365",
"0.63364804",
"0.63174236",
"0.62954164",
"0.629504",
"0.6292935",
"0.6285925",
"0.6248325",
"0.6248325",
"0.6248325",
"0.6247536",
"0.62430865",
"0.62429816",
"0.6226546",
"0.6161688",
"0.6159649",
"0.61095864",
"0.61067307",
"0.6100665",
"0.6087779",
"0.60828876",
"0.60693645",
"0.6046915",
"0.6038984",
"0.6034786",
"0.6032187",
"0.60282737",
"0.6023643",
"0.6016692",
"0.60132915",
"0.6002691",
"0.6002691",
"0.6002691",
"0.6002691",
"0.5992555",
"0.59925437",
"0.5972049",
"0.59651065",
"0.59634924",
"0.5953249",
"0.59530985",
"0.5943341",
"0.5940592",
"0.59383",
"0.5929128",
"0.5924336",
"0.59186643",
"0.5917088",
"0.5914771",
"0.5908991",
"0.59035",
"0.59035",
"0.59035",
"0.5901444",
"0.5891036",
"0.58887506",
"0.58854425",
"0.5871005"
] | 0.0 | -1 |
Returns true if this request does not yet contain any parsed lines. This should only occur during parsing. An empty request should never be sent to the aggregators | def empty?
@lines.length == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty()\n @requests.empty?\n end",
"def empty?\n @line_items.empty?\n end",
"def empty?\n line_items.length == 0\n end",
"def empty?\n @source_lines.empty?\n end",
"def empty?\n line.empty?\n end",
"def buffer_empty?\n @line_no.zero? || @pos > @line.length - 1\n end",
"def response_incomplete?\n content_for_scanner.strip == \"\"\n end",
"def blank?\n raw_response.blank? || total < 1\n end",
"def empty?\n body.nil? || ( body.respond_to?(:size) && body.size == 0 )\n end",
"def empty?\n @mutex.synchronize do\n return @traces.empty?\n end\n end",
"def empty?\n load # make sure we have determined the number of fetched records\n\n @number_of_records.zero?\n end",
"def hasRequest?\n !requests.empty?\n end",
"def request_valid?(data)\n ln = 0\n data.each_line {|l|\n ln += 1\n }\n if ln > 1\n return true\n else\n puts \"\\e[1;31mCatch GET's without header information / Other \\e[0m\\ \"\n return false # Due to single GET Requests to no headers \n end\n end",
"def is_requesting?\n @lock.synchronize { !@batch.empty? }\n end",
"def empty?\n no_headers.empty? rescue true\n end",
"def empty?\n self.responses.empty?\n end",
"def empty?(response); end",
"def empty?\n @traces.empty?\n end",
"def has_lines?\n @lines.any?\n end",
"def done_request_line?\n [:headers, :body_identity, :body_chunked, :body_chunked_tail, :done].include?(@state)\n end",
"def check_for_empty_batch?\n batch.empty?\n end",
"def empty?\n content.stream.filtered_stream == (@tare_content_stream ||= InitialPageContent) && document.page_number > 0\n end",
"def empty?\n @statements.empty?\n end",
"def empty?\n @buffer.empty? && stream_is_done?\n end",
"def empty?\n data.empty?\n end",
"def empty?\n data.empty?\n end",
"def empty?\n @buffers.values.all?(&:empty?)\n end",
"def empty?\n return false\n end",
"def isLineEmpty(theLine)\n\n\treturn theLine[:text].empty? && theLine[:comment].empty?\nend",
"def empty?\n @records.empty?\n end",
"def empty?\n return false if (@identifiers.length > 0) or @reference[\"format\"] or @reference[\"location\"] or @metadata.length > 0 or @format or @private_data\n true\n end",
"def empty?\n return (@indexes.empty? and @segments_metadata.empty?)\n end",
"def blank?\n !!processed_content.match(/\\A(^\\s+$)*\\z/)\n end",
"def end?\r\n\t\tif(@allLines.empty?)\r\n\t\t\treturn true\r\n\t\telse\r\n\t\t\treturn false\r\n\t\tend\r\n\tend",
"def empty?\n entries.empty?\n end",
"def empty?\n @stream.eof and @tokens.empty?\n end",
"def empty?\n @data.rows_count <= 0\n end",
"def empty?\n entries.empty?\n end",
"def empty?\n entries.empty?\n end",
"def no_request?\n if self.submission\n return false\n else\n return true\n end\n end",
"def empty?\n return txactions.empty?\n end",
"def empty?()\n return true if @state == RedXmlResource::STATE_EMPTY\n return false\n end",
"def empty?\n return true unless @all\n @all.empty?\n end",
"def empty?\n content.empty?\n end",
"def fresh_line?\n @content.empty? || @content[-1].eql?(NL)\n end",
"def empty?\n self.results.empty?\n end",
"def empty?\n @data.empty?\n end",
"def empty?\n @data.empty?\n end",
"def empty?\n record_count == 0\n end",
"def empty?\n total_pages.zero?\n end",
"def incomplete?\n !complete? && status != 'unknown'\n end",
"def valid?(output)\n output.any? { |line| line =~ /^END RequestId:/ }\n end",
"def has_pending_requests?\n received_requests.pending.any?\n end",
"def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end",
"def has_no_readings?\n readings.size.eql?(0)\n end",
"def negotiate_lines_added\n @estimate.line_items.each do |line_item|\n unless line_item.negotiate_lines.empty?\n return true if line_item.negotiate_lines.last.line_item_id_changed?\n end\n # return true\n #end\n end\n end",
"def empty?\n @output.empty?\n end",
"def processing?\n self.result_payload(true).has_key?('started_at') && !self.result_payload(true).has_key?('finished_at')\n end",
"def empty?\n @start == nil\n end",
"def empty?\n self.count == 0\n end",
"def empty?\n self.count == 0\n end",
"def empty_parser?\n delegated_parser.empty_parser?\n end",
"def ensure_not_referenced_by_any_line_items\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items Present')\n return false\n end\n end",
"def empty?\n rules.empty?\n end",
"def empty?\n @fragments.empty?\n end",
"def empty?\n false\n end",
"def empty?\n @iterator.nil?\n end",
"def empty?\n true\n end",
"def empty?\n true\n end",
"def empty?\n\t\tmust_be_in_synchronize_block\n\t\treturn @collection.empty?\n\tend",
"def empty?\n RECORDS.each do |name, _|\n return false unless @records[name].empty?\n end\n true\n end",
"def empty?\n serialize.empty?\n end",
"def commit_msg_empty?(commit_msg_file)\n File.open(commit_msg_file, 'r') do |f|\n f.readlines.each do |line|\n strip_line = line.strip\n return false if (!strip_line.empty? && !strip_line.start_with?('#'))\n end\n end\n true\nend",
"def empty?\n qr_responses.blank? && sip_responses.blank?\n end",
"def empty?\n count == 0\n end",
"def empty?\n count == 0\n end",
"def empty?\n return self.length == 0\n end",
"def empty?\n count <= 0\n end",
"def empty?\n @rules.empty?\n end",
"def final_chunk?\n ::HttpParser.http_body_is_final(self) > 0\n end",
"def empty?\n @messages.empty?\n end",
"def empty?\n @messages.empty?\n end",
"def parsed?\n @raw.nil?\n end",
"def malformed_request?\n from_json\n @coffee.nil? || @order.nil?\n end",
"def empty()\n return true if @head.nil?\n false\n end",
"def ensure_not_referenced_by_any_line_item \n if readings.count.zero? \n return true \n else \n errors[:base] << \"Readings present\" \n return false \n end \n end",
"def empty?\n return @records.empty? if loaded?\n\n if limit_value == 0\n true\n else\n # FIXME: This count is not compatible with #select('authors.*') or other select narrows\n c = count\n c.respond_to?(:zero?) ? c.zero? : c.empty?\n end\n end",
"def non_empty_http_response?(http)\n http.response.present?\n end",
"def empty?\n @messages.empty?\n end",
"def empty?\n @head.nil?\n end",
"def empty?\n\t\t@head.nil?\n\tend",
"def empty?\n @content.empty?\n end",
"def empty?\n @queued.empty?\n end",
"def emptied?(xpath)\n node = @document.at_xpath(xpath)\n node.children.all? { |ch|\n @component_xpaths.include?(ch.path) ||\n (ch.text? && ch.content.strip.empty?)\n }\n end",
"def requests?\n return requests.any?\n end",
"def request_empty_page\n @posts.empty? && request.env[\"HTTP_X_REQUESTED_WITH\"] != \"XMLHttpRequest\"\n end",
"def empty?\n @json_data['pledges'].empty?\n end",
"def empty?\n @items.count == 0\n end",
"def empty?\n filter.empty?\n end",
"def content_empty?\n return false if behaves_like_io?(@content) && @content.read.empty?\n return true if @content.class == String && @content.empty?\n\n false\n end"
] | [
"0.7498818",
"0.69157696",
"0.68651533",
"0.67668355",
"0.6691595",
"0.6544075",
"0.65219074",
"0.64844424",
"0.6444782",
"0.6407104",
"0.6389373",
"0.63448536",
"0.6321745",
"0.6304365",
"0.6221054",
"0.6199897",
"0.6190072",
"0.61874676",
"0.61542505",
"0.61519974",
"0.611515",
"0.61143374",
"0.6101444",
"0.60967875",
"0.60890126",
"0.60890126",
"0.60734856",
"0.6071659",
"0.60642946",
"0.60489434",
"0.6042948",
"0.6031506",
"0.6027329",
"0.60241956",
"0.6023808",
"0.60139513",
"0.59964055",
"0.59914094",
"0.59914094",
"0.59893525",
"0.59873223",
"0.5983928",
"0.5956771",
"0.59494305",
"0.5938887",
"0.59368557",
"0.59343576",
"0.59343576",
"0.59174955",
"0.5916278",
"0.59080094",
"0.58989406",
"0.589683",
"0.58878255",
"0.5886315",
"0.58833176",
"0.58725154",
"0.58669883",
"0.5864445",
"0.5858564",
"0.5858564",
"0.5858444",
"0.5858297",
"0.585671",
"0.5856514",
"0.5839976",
"0.58353895",
"0.5826006",
"0.5826006",
"0.5824477",
"0.5815779",
"0.57963645",
"0.57944095",
"0.57869226",
"0.57861793",
"0.57861793",
"0.578505",
"0.5778341",
"0.57767713",
"0.5775834",
"0.5772743",
"0.5772743",
"0.57606995",
"0.5758832",
"0.57544404",
"0.57485443",
"0.5746653",
"0.57432324",
"0.5742653",
"0.57420146",
"0.5741851",
"0.5739463",
"0.57319075",
"0.57300043",
"0.5726071",
"0.572164",
"0.57209754",
"0.571957",
"0.5714696",
"0.57145566"
] | 0.6955177 | 1 |
Checks whether this request is completed. A completed request contains both a parsed header line and a parsed footer line. Not that calling this function in single line mode will always return false. | def completed?
header_found, footer_found = false, false
@lines.each do |line|
line_def = file_format.line_definitions[line[:line_type]]
header_found = true if line_def.header
footer_found = true if line_def.footer
end
header_found && footer_found
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def done_request_line?\n [:headers, :body_identity, :body_chunked, :body_chunked_tail, :done].include?(@state)\n end",
"def completed?\n\t\t\treturn request_status == REQUEST_STATUS['completed']\n\t\tend",
"def finished?\n\t\t\t\t@finished && @body.length >= @headers['CONTENT_LENGTH']\n\t\t\tend",
"def complete?\n completed_at && response\n end",
"def done_headers?\n [:body_identity, :body_chunked, :body_chunked_tail, :done].include?(@state)\n end",
"def complete?\n status_code == 'OK'\n end",
"def completed?\n return @complete\n end",
"def completed?\n return @complete\n end",
"def is_finished\n\t\tif self.completed_at \n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def response_incomplete?\n content_for_scanner.strip == \"\"\n end",
"def multi_response_completed?\n @multi_buffer.nil?\n end",
"def complete?\n status == \"Completed\"\n end",
"def finished?\n super && response_received?\n end",
"def finished?\n super && response_received?\n end",
"def finished?\n @status[:description] == :finished\n end",
"def complete?\n @complete\n end",
"def complete?\n @complete\n end",
"def complete?\n return state == \"complete\"\n end",
"def finished?\n FINAL_STATUSES.include?(transaction_status) || status == COMPLETED\n end",
"def complete?\n true\n end",
"def complete?\n true\n end",
"def completed?(str)\n str, @prelude = @prelude + str, \"\" unless @prelude.empty?\n add_lines(str)\n return unless @state == :body && @body.bytesize >= @content_length\n @prelude = bslice(@body, @content_length..-1)\n @body = bslice(@body, 0..@content_length)\n @state = :init\n end",
"def completed?\n @state.to_s =~ /finished|aborted|failed/\n end",
"def finished?\n\t\t\tif @finished.nil? then\n\t\t\t\tfalse\n\t\t\telse\n\t\t\t\t@finished\n\t\t\tend\n\t\tend",
"def complete?\r\n @is_complete\r\n end",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def finished?\n if self.status == self.statuses[\"Finished\"]\n return true\n end\n return false\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def finished?\n @finished\n end",
"def final_chunk?\n ::HttpParser.http_body_is_final(self) > 0\n end",
"def finished?\n\t\tif @finished.nil? then\n\t\t\tfalse\n\t\telse\n\t\t\t@finished\n\t\tend\n\tend",
"def ready?\n self.result_payload(true).has_key?('finished_at')\n end",
"def completed?\n self.status == STATUS_COMPLETED\n end",
"def finished?\n return false unless self.started?\n return true if self.finished\n return ( self.finished_at.time <= Time.now )\n end",
"def finished?\n return false unless self.started?\n return true if self.finished\n return ( self.finished_at.time <= Time.now )\n end",
"def complete?\n params[\"x_response_code\"] == '1'\n end",
"def complete?\n\tstatus == \"Completed\"\n end",
"def finished?\n !!@finished\n end",
"def incomplete?\n !complete? && status != 'unknown'\n end",
"def done_body?\n done?\n end",
"def complete?\n false\n end",
"def completed?\n !self.finished_at.nil?\n end",
"def complete?\n !incomplete?\n end",
"def complete?\n !incomplete?\n end",
"def complete?\n %w[success failure exception].include?(status)\n end",
"def completed?\n completed == '1'\n end",
"def complete?\n params[\"x_response_code\"] == '1'\n end",
"def finished?\n\n end",
"def completed?\n return true unless @state == PENDING_STATE\n @lock.lock\n begin\n @state != PENDING_STATE\n ensure\n @lock.unlock\n end\n end",
"def finished?\n attributes['isFinished']\n end",
"def finished?\n @end_time != nil\n end",
"def completed?\n @completed\n end",
"def response?\n done? && !error?\n end",
"def finished?\n self.completed? || self.failed?\n end",
"def completed?\n @completed\n end",
"def marked_as_complete?\n get[state.to_s] and get[state.to_s].to_sym == :complete\n end",
"def finished?()\n #This is a stub, used for indexing\n end",
"def completed?\n job_completed?\n end",
"def complete?\n finished? || cancelled? || failed? || job_failed? || timeout?\n end",
"def complete?\n result? || error?\n end",
"def completed?\n attributes['percentDone'] >= 1\n end",
"def processing?\n self.result_payload(true).has_key?('started_at') && !self.result_payload(true).has_key?('finished_at')\n end",
"def completed?\n status.completed?\n end",
"def finished?\r\n @finished ||= false\r\n end",
"def finished?\n true unless self.finished_on.nil?\n end",
"def incomplete?\n !@complete\n end",
"def finished?\n FINISHED_STATUSES.include? status or tasks_are_finished?\n end",
"def completed?\n @progress != 'PENDING'\n end",
"def finished?\n finished_at.present? && retried_good_job_id.nil?\n end",
"def valid?(output)\n output.any? { |line| line =~ /^END RequestId:/ }\n end",
"def incomplete?\n @completed_at.nil?\n end",
"def incomplete?\n @completed_at.nil?\n end",
"def pedia_complete?\n return status == COMPLETE\n end",
"def finished?\n @__status == TaskStatus::COMPLETED ||\n @__status == TaskStatus::FAULTED ||\n @__status == TaskStatus::CANCELED\n end",
"def completed?\n @__status == TaskStatus::COMPLETED\n end",
"def complete?\n end",
"def completed?\n !!completed\n end",
"def definition_finished?\n @definition_finished\n end",
"def complete?\n !instrument_end_date.blank? && !instrument_end_time.blank? && instrument_status.to_s == \"Complete\"\n end",
"def finished?\n ['success', 'failed'].include? status\n end",
"def completed?\n return @completed\n end",
"def finished?\n @state == STATE_FINISHED\n end",
"def finished?\n\tfinished_on.present? \n\tend",
"def completed?\n !@time_started.nil? && !@time_completed.nil?\n end",
"def complete?\n status == \"verified\"\n end",
"def finished?\n failed? or successful? or skipped?\n end",
"def finished?\n @finished == true\n end",
"def finished\n if (start?) and (end?)\n return true\n else\n return false\n end\n end",
"def completed?\n \t\tlatest_transaction.completed? unless transactions.empty?\n \tend",
"def crawling_complete?\n @completed\n end",
"def complete?\n complete == true\n end",
"def incomplete?\r\n !complete?\r\n end",
"def complete?\n return nil unless ivsat_table\n line = ivsat_table.split(\"\\n\").find{|l| l.include? 'INFO: Sequence completeness:' }\n line && !line.include?('partial')\n end",
"def complete?()\n if (self.order_in_lines.length == 0)\n return false\n end\n self.order_in_lines.each do | line |\n if (line.qty < line.qty_in)\n return false\n end\n end\n return true\n end",
"def completed?\n !completed_at.blank?\n end",
"def request_valid?(data)\n ln = 0\n data.each_line {|l|\n ln += 1\n }\n if ln > 1\n return true\n else\n puts \"\\e[1;31mCatch GET's without header information / Other \\e[0m\\ \"\n return false # Due to single GET Requests to no headers \n end\n end",
"def complete?\n true\n end"
] | [
"0.7583645",
"0.7405685",
"0.7369098",
"0.7331768",
"0.718461",
"0.68619204",
"0.67938167",
"0.67938167",
"0.67217165",
"0.6713927",
"0.67137545",
"0.6632473",
"0.66208047",
"0.66208047",
"0.6591405",
"0.6553439",
"0.6548661",
"0.6536518",
"0.65295464",
"0.65285605",
"0.65165687",
"0.65125704",
"0.65047026",
"0.65001047",
"0.64999104",
"0.6496628",
"0.6496628",
"0.64551294",
"0.6454401",
"0.6454401",
"0.6454401",
"0.6454401",
"0.64425606",
"0.6411088",
"0.64104056",
"0.6401379",
"0.63826066",
"0.63826066",
"0.63799614",
"0.63794804",
"0.6378424",
"0.6377979",
"0.637505",
"0.6367885",
"0.63598186",
"0.6359775",
"0.6359775",
"0.6347753",
"0.6347252",
"0.63458705",
"0.63342696",
"0.63319427",
"0.6319056",
"0.62859166",
"0.628262",
"0.6263626",
"0.6263014",
"0.6254552",
"0.624858",
"0.6242888",
"0.6216201",
"0.620446",
"0.62012064",
"0.61988735",
"0.61931247",
"0.61921734",
"0.61860186",
"0.6183143",
"0.6181342",
"0.6180562",
"0.61776155",
"0.6168911",
"0.61671793",
"0.6140297",
"0.6140297",
"0.61374944",
"0.61319864",
"0.6131125",
"0.61291534",
"0.6123386",
"0.61201656",
"0.6114831",
"0.6105702",
"0.6079273",
"0.6076311",
"0.60760796",
"0.6072377",
"0.6068451",
"0.60659134",
"0.605743",
"0.6055794",
"0.6053505",
"0.60520434",
"0.6048136",
"0.6043703",
"0.6043483",
"0.604199",
"0.6038249",
"0.6035383",
"0.60206515"
] | 0.7873064 | 0 |
This function is called before a Requests is yielded. | def validate
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before\n poller.before_request { |stats| yield(stats) }\n end",
"def before_request(&block)\n @before_request = block if block\n @before_request || proc { |a| a }\n end",
"def before_request\n end",
"def before_queue(urls)\n # stub\n end",
"def before(&block)\n handle(0, &block)\n end",
"def setup(&block)\n before(:each, &block)\n end",
"def set_request; end",
"def before_fork\n yield @resqued\n end",
"def on_pre_request( request )\n end",
"def require_requests_and_mock\n requests.each do |request|\n require_item(request, @request_path)\n if service::Mock.method_defined?(request.last)\n mocked_requests << request.last\n else\n service::Mock.module_eval <<-EOS, __FILE__, __LINE__\n def #{request.last}(*args)\n Fog::Mock.not_implemented\n end\n EOS\n end\n end\n end",
"def wrap_request\n outer_most = !request_info\n\n self.request_info = {} if outer_most\n yield\n ensure\n self.request_info = nil if outer_most\n end",
"def set_request_start\n @request_started_at = Time.now\n @used_auth_by_token = true\n end",
"def consider_all_requests_local; end",
"def consider_all_requests_local; end",
"def before(&block)\n @before << block\n end",
"def setup\n if @request.present?\n @request.env['HTTP_ACCEPT'] = 'application/json'\n @request.headers['x-api-key'] = 'some_api_key'\n end\n ActiveSupport::Cache::FileStore.any_instance.stubs(:read).returns(\"anandsai_auth\")\n end",
"def before_processing\n end",
"def each_request(options = {}, &block) # :yields: request\n return true\n end",
"def wait_before_new_request\n return unless @last_request # this is the first request\n diff = Time.now - @last_request\n if diff < SECONDS_BEFORE_NEW_REQUEST\n sleep(SECONDS_BEFORE_NEW_REQUEST - diff)\n end\n end",
"def before\n end",
"def before\n # Check if cache is enabled in this route\n return unless cache?\n\n # Generate the cache key\n k = key(params)\n\n # Check the current key exists in the cache\n return unless store.exist?(k)\n\n # Get to the response it\n res = MultiJson.load store.read(k)\n\n # Return in the Rack Formatt\n [res['status'], res['headers'], res['body']]\n end",
"def after_request\n end",
"def test_on_async_requests\n controller = new_controller\n fake_request controller, '/path1', '/referrer', xhr?: true\n assert_equal nil, controller.session['previous_paths']\n end",
"def consider_all_requests_local=(_arg0); end",
"def consider_all_requests_local=(_arg0); end",
"def before\n\t\t\ttrue\n\t\tend",
"def conditional_requests; end",
"def conditional_requests; end",
"def each_request(&block)\n\t\trequests.each do |request|\n\t\t\tblock.call(request)\n\t\tend\n\tend",
"def each_request(&block)\n\t\trequests.each do |request|\n\t\t\tblock.call(request)\n\t\tend\n\tend",
"def on_pre_request( request ); end",
"def before\n end",
"def test_referrer_on_async_requests\n controller = new_controller\n fake_request controller, '/path1', nil, xhr?: true\n assert_equal nil, controller.session['_referer']\n end",
"def before\n @before\n end",
"def on_request( &block )\n @on_request = block\n end",
"def after_request\n end",
"def before_call\n executor.before_consume\n end",
"def pre_process\n Goliath::Connection::AsyncResponse\n end",
"def make_requests requests, pager\n requests.each do |request|\n \n @current_request = request\n # setup the request with the fields required to page\n pager.page(request) do |raw_response|\n # yield up response to the run() method, retrieve and return the response for the pager\n response = yield raw_response\n end\n end\n end",
"def before_run; end",
"def before() ; end",
"def hook_pending_request(request) #THREAD_LOCAL_ACCESS\n wrapped_request, wrapped_response = wrap_request(request)\n state = TingYun::Agent::TransactionState.tl_get\n t0 = Time.now.to_f\n node = TingYun::Agent::CrossAppTracing.start_trace(state, t0, wrapped_request)\n\n unless request._ty_instrumented\n install_header_callback( request, wrapped_response )\n install_completion_callback( request, t0, node, wrapped_request, wrapped_response )\n request._ty_instrumented = true\n end\n rescue => err\n TingYun::Agent.logger.error(\"Untrapped exception\", err)\n end",
"def conditional_requests=(_arg0); end",
"def pre_connect(request); end",
"def pending_response_requests; end",
"def before_GET(req)\n if !req.params['next'].nil? then req.session['next'] = req.params['next'] end\n if !req.session['dealer_id'].nil?\n send_to_next(req) || send_to_admin(req)\n else\n super\n end\n end",
"def before; end",
"def before() nil ; end",
"def before_each\n super if defined?(super)\n end",
"def before_dispatch(env); end",
"def add_request_if_new\n last_request = session.requests.last\n maybe_next_request = yield(last_request)\n session.requests << maybe_next_request unless (\n maybe_next_request.nil? or maybe_next_request.equal?(last_request)\n )\n self\n end",
"def before(&block)\n rules.add('@document:before', Sawtooth::Rules::CallRule.new(:start => block)) if block_given?\n end",
"def on_launch_request\n if authorized? && request_type.launch? && block_given?\n @response = yield user\n end\n end",
"def before_each(&block)\n @before_each_blocks << block\n end",
"def before(&block)\n block ? @before = block : @before\n end",
"def setup\n @response ||= {}\n end",
"def request_phase\n super\n end",
"def request_phase\n super\n end",
"def state_initial\n @request = ServerSide::HTTP::Request.new(self)\n @response_sent = false\n set_state(:state_request_line)\n end",
"def set_request_start\n # byepassing to active admin's own\n # authentication process\n return true if request_from_admin?\n\n super\n end",
"def before_setup\n # do nothing by default\n end",
"def before\n endpoint = env['api.endpoint']\n logger = options[:logger] || Logger.new($stdout)\n\n return unless throttle_options = endpoint.route_setting(:throttle)\n\n limit, period = find_limit_and_period(throttle_options)\n\n check_limit_and_period(limit, period)\n\n limit = limit.call(env) if limit.is_a?(Proc)\n return true if limit.negative?\n\n user_value = find_user_value(options) || \"ip:#{env['REMOTE_ADDR']}\"\n rate_key = generate_rate_key(endpoint, user_value)\n\n begin\n redis = options[:cache]\n redis.ping\n\n current = redis.get(rate_key).to_i\n\n if !current.nil? && current >= limit\n endpoint.error!('Too Many Requests', 429)\n else\n redis.multi do\n redis.set(rate_key, COUNTER_START, nx: true, ex: period.to_i)\n redis.incr(rate_key)\n end\n end\n rescue StandardError => e\n logger.warn(e.message)\n end\n end",
"def head_request(request_data = {}, errback = DEFAULT_ERROR, &blk)\n req = create_test_request(request_data).head(request_data)\n hookup_request_callbacks(req, errback, &blk)\n end",
"def before_run(&block)\n @before_run_block = block\n end",
"def before_stream\n end",
"def setup_before_each_scenario(url)\n $tracer.trace(\"PowerUpRewardsDSL : #{__method__}, Line : #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n # Some of the stuff in this method would be a more natural fit in the after(:each) but\n # we can't use after(:each) for browser-based clean up at this time because it iterferes\n # with the automatic snapshots.\n ensure_only_one_browser_window_open\n open(url)\n\n end",
"def before &block\n @before_blocks ||= []\n @before_blocks << block if block\n end",
"def will_verify_before\n return 'No block' unless block_given?\n\n yield\nend",
"def setup\n yield self\n self\n end",
"def blocklisted_response; end",
"def after_request(&block)\n @after_request << block\n end",
"def queue_front(request)\n request.hydra = self\n queued_requests.unshift request\n end",
"def before(&proc)\n @before = proc if proc\n @before\n end",
"def test_callbacks_are_not_installed_again_if_they_have_already_been_installed\n multi = Curl::Multi.new\n request = MiniTest::Mock.new\n segment = MiniTest::Mock.new\n segment.expect :add_request_headers, nil, [MiniTest::Mock]\n request.expect :_nr_instrumented, true\n def multi.wrap_request(req)\n wrapped_request = MiniTest::Mock.new\n wrapped_request.expect :type, nil\n wrapped_request.expect :uri, nil\n wrapped_request.expect :method, nil\n [wrapped_request, nil]\n end\n NewRelic::Agent::Tracer.stub :start_external_request_segment, segment do\n multi.hook_pending_request(request)\n end\n request.verify\n segment.verify\n end",
"def request_phase\n # Stash the account into the session so that we\n # can trieve it during the callback.\n session['omniauth.zendesk.account'] = fetch_zendesk_account\n\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here?\n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end",
"def before_send(&block)\n @before_send = block if block_given?\n @before_send\n end",
"def call(request, _next)\n @block ? @block.call(request, _next) : _next.call\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def page request\n logger.info \"Pager starting:\"\n # page all other pages as long as they're required\n response = false\n has_run = false\n while true\n # prepare the request, allowing the first run even if no setup if provided\n setup, fields = read_fields_and_setup(response)\n break if has_run && @continue == false\n \n request.setup(setup)\n request.fields.merge!(fields)\n response = yield request.run\n \n has_run = true\n end\n \n logger.info \"Pager finished.\"\n end",
"def before_setup; end",
"def setup\n yield self\n self\n end",
"def list_requests\n # stub\n end",
"def set_request_start_time\n @request_start_time = Time.now\n end",
"def before_proc(&block)\n @before_proc = block\n end",
"def before(refname)\n yield if block_given?\n call(refname)\n end",
"def on_request( &block )\n @preprocessor = block\n end",
"def request(&_)\n if block_given?\n @request ||= Request.new\n yield @request\n end\n @request\n end",
"def action(request, response, &block)\n if request.force? \n @log.info \"QueueHandler: Forced request - yielding \\n\"\n yield request, response\n else\n response.status = 202\n response.message = \"Processing. Please retry your request shortly\"\n @queue.add request.url({:force => true })\n end\n end",
"def on_ignored_request\n end",
"def request_setup()\n Proc.new do |request|\n request.headers[:authorization] = basic_auth_header\n request.headers[:content_type] = 'application/json; charset=UTF-8'\n request.headers[:accept] = 'application/json; charset=UTF-8'\n end\n end",
"def pre_block\n end",
"def pre_block\n end",
"def child_pre_trace\n old_child_pre_trace = @child_pre_trace\n @child_pre_trace = proc {\n yield\n old_child_pre_trace.call if old_child_pre_trace\n }\n end",
"def perform_request\n returned = nil\n @requests ||= 0\n @requests += 1\n @request_time ||= 0\n @request_time += Benchmark.realtime { returned = yield }\n returned\n ensure\n @handlers.each { |handler| handler.call(@requests, @request_time) }\n end",
"def on_request &b\n @request_proc = b\n self\n end",
"def prepare\n reset\n\n yield self if block_given?\n\n # Since the OAuth flow is performed by the browser, we'll need to boot\n # the Sinatra app instead of just stubbing the app with WebMock...\n boot_once\n\n OmniAuth::Strategies::Icalia.instances.each do |strategy|\n strategy.options.client_options.tap do |options|\n options.site = url\n options.token_url = \"#{url}/oauth/token\"\n options.authorize_url = \"#{url}/oauth/authorize\"\n end\n end\n end",
"def defer\n yield\n end",
"def process_response_before_caching(response, opts)\n response\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end"
] | [
"0.7552005",
"0.6526417",
"0.6260017",
"0.6249787",
"0.62194806",
"0.5947611",
"0.59454757",
"0.59316033",
"0.59105045",
"0.58970404",
"0.58942175",
"0.5886568",
"0.5847973",
"0.5847973",
"0.58447766",
"0.5841522",
"0.58263516",
"0.582436",
"0.5821998",
"0.58150476",
"0.5790879",
"0.5773317",
"0.577231",
"0.57709956",
"0.57709956",
"0.57668626",
"0.5757107",
"0.5757107",
"0.57566875",
"0.57566875",
"0.57494015",
"0.57481474",
"0.5742987",
"0.57275105",
"0.5726723",
"0.57188535",
"0.57154584",
"0.57029533",
"0.5689443",
"0.5677852",
"0.56748176",
"0.5673849",
"0.5652933",
"0.56503457",
"0.5634848",
"0.56231815",
"0.5610756",
"0.5606208",
"0.55979",
"0.559418",
"0.5592073",
"0.5567852",
"0.55651546",
"0.5557779",
"0.555381",
"0.554917",
"0.5541134",
"0.5541134",
"0.55315",
"0.552887",
"0.55211574",
"0.55204356",
"0.5479252",
"0.54783565",
"0.5477879",
"0.54772925",
"0.5472488",
"0.54722756",
"0.5470619",
"0.5458015",
"0.5457566",
"0.545044",
"0.5448763",
"0.544595",
"0.54457074",
"0.5443627",
"0.5442195",
"0.54348344",
"0.54348344",
"0.5425668",
"0.5423802",
"0.5422912",
"0.5422013",
"0.542119",
"0.5412716",
"0.54119563",
"0.5409959",
"0.5408928",
"0.5407304",
"0.5387224",
"0.53869784",
"0.5384402",
"0.5384402",
"0.53834003",
"0.5377563",
"0.53761655",
"0.53748256",
"0.5353326",
"0.53485113",
"0.53414905",
"0.53414905"
] | 0.0 | -1 |
Returns the first timestamp encountered in a request. | def timestamp
first(:timestamp)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_timestamp\n request_time.strftime(\"%Y%m%dT%H%M%SZ\")\n end",
"def get_request_timestamp\n\t\treturn @transport.get_path(\"meta\",\"datetime\")\n\tend",
"def request_timestamp\n auth_info[\"date\"] || \"\"\n end",
"def request_time\n @request_time ||= Time.now.utc\n end",
"def request_datestamp\n request_time.strftime(\"%Y%m%d\")\n end",
"def timestamp\n @timestamp ||= Time.now.xs_datetime\n end",
"def get_start_time()\n return process_stamp(@start_time)\n end",
"def timestamp\n params['TIMESTAMP']\n end",
"def locate_timestamp\n return nil unless headers\n\n header = HEADERS.find { |candidate| headers[candidate] }\n if header\n data = headers[header]\n data.to_s.gsub(/(t=|\\.)/, '')\n else\n nil\n end\n end",
"def earliest(key, min)\n _request_id, time = @store.zrangebyscore(key, \"(#{min}\", '+inf', withscores: true, limit: [0, 1]).first\n time\n end",
"def first_seen_date_time\n return @first_seen_date_time\n end",
"def first_seen_date_time\n return @first_seen_date_time\n end",
"def time()\n return _request([\n 'time',\n '0'\n ])[0]\n end",
"def last_timestamp\n lines.last.first\n rescue\n 0\n end",
"def request_timestamp(cli,request)\n\t\tprint_status(\"#{cli.peerhost} - #{current_time} - [HTTP GET] - #{request.uri}\")\n\tend",
"def timestamp\n Time.at((attributes[:timestamp] || Time.now).to_i)\n end",
"def requested_time\n val = params[:requested_time]\n val.present? ? Time.at(val.to_i) : Time.current\n end",
"def timestamp\n memoized_info[:local_timestamp]\n end",
"def timestamp\n #data[\"timestamp\"] as? TimeInterval ?? 0\n timestamp = data[\"timestamp\"]\n timestamp.to_i || 0\n end",
"def timestamp\n @timestamp ||= Time.parse(self['timestamp'])\n end",
"def timestamp\n _timestamp.as_time\n end",
"def timestamp\n _timestamp.as_time\n end",
"def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end",
"def get_earliest_timestamp\n @timestamp = (@raw_image_files.sort_by { |i| i.timestamp }).first.timestamp\n end",
"def request_start_time_from_header(header_string)\n Float(header_string.strip[2..-1])\n end",
"def timestamp\n nil\n end",
"def earliest_restorable_time\n data[:earliest_restorable_time]\n end",
"def retrieve_start_timestamp(experiment)\n if timestamp = get(experiment.handle.to_s, 'started_at')\n Time.parse(timestamp)\n end\n end",
"def time\n\t\tresponse = self.request( :time )\n\t\treturn nil if response.empty?\n\t\treturn Time.at( response.first[:time].to_i )\n\tend",
"def received_at\n params['TIMESTAMP']\n end",
"def started_at\n # from TAI to Unix\n @started_at ||= @raw ? Time.at((@raw[0] << 32) + @raw[1] - 4611686018427387914) : nil\n end",
"def time()\n return self._request([\n 'time',\n '0'\n ])[0]\n end",
"def earliest_backtrack_time\n data[:earliest_backtrack_time]\n end",
"def realtime_timestamp\n return nil unless @ctx.key?(:realtime_ts)\n @realtime_timestamp ||= Time.at(0, @ctx[:realtime_ts])\n end",
"def timestamp\n self[:timestamp]\n end",
"def received_at\n request_datetime\n end",
"def reqn\n t = Time.now\n msec = t.to_f.to_s.match(/\\.(\\d\\d)/)[1] rescue '00'\n t.strftime('%Y%m%d%H%M%S') + msec\n end",
"def timestamp\n Time.now.utc.to_i\n end",
"def time\n @time ||= Time.at( timestamp / 1_000_000.0 )\n end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def set_request_start_time\n @request_start_time = Time.now\n end",
"def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end",
"def timestamp\n @timestamp ||= Time.parse(@origdate)\n end",
"def timestamp\n Time.at((self.tsh << 32 | self.tsl) * ts_resol)\n end",
"def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend",
"def get_sent_at_exp(req_full=true)\n\n return self.get_timestamp_exp(req_full, :sent_at)\n end",
"def earliest_incomplete_timestamp\n res = incomplete_recipients.first\n\n return unless res\n\n res.created_at\n end",
"def timestamp\n Time.at((self[:tsh].to_i << 32 | self[:tsl].to_i) * ts_resol)\n end",
"def last_timestamp(event)\n event[:lastTimestamp] || event.dig(:metadata, :creationTimestamp)\n end",
"def timestamp(now)\n (now - @start_time) * 1000\n end",
"def time_from_header(t)\n Time.httpdate(t).to_i if t\n rescue ArgumentError\n end",
"def timestamp\n time = Time.now.getutc\n\n secs = time.to_i\n millis = time.nsec/1000000\n\n return @last if @millis == millis && @secs == secs\n\n unless secs == @secs\n @secs = secs\n @date = time.strftime('%Y-%m-%d %H:%M:%S.')\n end\n\n @millis = millis\n @last = @date + \"00#{millis}\"[-3..-1]\n end",
"def last_written_at\n entry = read(1).first\n entry.time if entry\n end",
"def min() time[1] end",
"def last_request_id\n @last_response && @last_response.body.to_s[%r{<requestId>(.+?)</requestId>}] && $1\n end",
"def seconds_since_seen\n Time.now - (last_seen || Time.at(0))\n end",
"def timestamp\n TimeStamp.new\n end",
"def timestamp\n\t\tTime.now.to_i\n\tend",
"def monotonic_timestamp\n return nil unless @ctx.key?(:monotonic_ts)\n @monotonic_timestamp ||= Time.at(0, @ctx[:monotonic_ts].first)\n end",
"def extract_ts(chunks)\n ts = chunks[fmt.index('t')]\n return parse_time(ts) if valid_timestamp?(ts)\n rescue TypeError\n Time.now.utc.to_i\n end",
"def current_timestamp\n Time.now.to_i\n end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def first_login_at\n @attributes[:first_login_at]\n end",
"def timestamp(unit = :float_second)\n Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)\n end",
"def timestamp\n @timestamp ||= @attributes['timestamp'] ? Time.zone.at(@attributes['timestamp']) : nil\n end",
"def timestamp\n @timestamp ||= @attributes['timestamp'] ? Time.zone.at(@attributes['timestamp']) : nil\n end",
"def timestamp\n begin\n max=model.max(:updated_at)\n #rescue PG::Error => err\n rescue => err\n # puts \" error was #{err}\"\n # if we get an error, just assume we need to update the table\n return Rake::EARLY\n end\n # this is embarassing, but rake doesn't have a way to say\n # that this thing is more recently updated than anything else\n max.nil? ? Time.parse('Dec 31, 9999') : max\n end",
"def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end",
"def timestamp\n Time.now.to_i.to_s\n end",
"def time\n reply.documents[0][TIME]\n end",
"def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end",
"def local_start_at\n Timestamp.new(@timestamp_value, 0, @offset.utc_total_offset)\n end",
"def get_time()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('system', 'getTime', 'bigint', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def time_stamp()\n return get INIT_TIME_STAMP_NAME\n end",
"def timestamp\n Time.now.to_s\n end",
"def current_timestamp\n @c_tstmp ||= current_time.to_i\n end",
"def get_creation_timestamp(path)\n nil\n end",
"def timestamp\n return nil if grpc.nil?\n Convert.timestamp_to_time grpc.read_timestamp\n end",
"def time_min; Time.now.min; end",
"def last_request\n raise Error, 'No request yet. Request a page first.' unless @last_request\n @last_request\n end",
"def last_seen_at() ; info_time(:last_seen) ; end",
"def get_last_oplog_timestamp\n cur = retry_until_ok do\n @oplog_coll.find({}, :sort => [\"$natural\", :desc], :limit => 1)\n end\n\n cur.next[\"ts\"]\n end",
"def next_fetch\n datetime_from(\"sf:next_fetch\")\n end",
"def last_entry_time\n last_entry = db.last_entry_temp.flatten.first\n last_entry ? Time.at(last_entry) : nil\n end",
"def current_timestamp\n Time.now.strftime \"%Y%m%dT%H:%M:%S\"\n end",
"def get_timestamp(*params); raise('Stub or mock required.') end",
"def start_time\n # API results are in milliseconds since the unix epoch\n epoch_msec = raw_result.fetch('time')\n epoch_sec = epoch_msec / 1000\n\n Time.at(epoch_sec).ctime\n end",
"def start_time\n @internal_data.start_time\n end",
"def time\n Time.parse(@timestamp)\n end",
"def compute_timestamp(logline)\n timestamp = logline.hour * 3600 + logline.minute * 60 + logline.second\n # assume we just advanced to the next day in case we got a lower timestamp than last one\n timestamp += LogLine::Resolution * offset\n if timestamp < last_timestamp\n self.offset = offset + 1\n timestamp += LogLine::Resolution\n end\n timestamp\n end",
"def started_at\n Time.parse @gapi.start_time\n rescue StandardError\n nil\n end",
"def current_timestamp\n @c_tstamp ||= current_time.to_f\n end"
] | [
"0.7072777",
"0.6811562",
"0.6744703",
"0.65663624",
"0.62786555",
"0.62054044",
"0.6166322",
"0.6142026",
"0.61248314",
"0.61132866",
"0.60757315",
"0.60757315",
"0.60719293",
"0.60616124",
"0.6020519",
"0.6011151",
"0.601103",
"0.60090405",
"0.6008894",
"0.6004444",
"0.59796447",
"0.59594333",
"0.59449816",
"0.59425247",
"0.5940714",
"0.593567",
"0.59185266",
"0.59114075",
"0.58641297",
"0.58398217",
"0.58093506",
"0.57988983",
"0.5788905",
"0.5786404",
"0.57844347",
"0.5773401",
"0.5762832",
"0.5749698",
"0.57239735",
"0.57160074",
"0.57160074",
"0.57160074",
"0.57160074",
"0.57132727",
"0.5701839",
"0.5698106",
"0.5686399",
"0.5663118",
"0.5659515",
"0.5643757",
"0.56382364",
"0.56275105",
"0.560785",
"0.55991405",
"0.559446",
"0.55812407",
"0.5570754",
"0.5570096",
"0.5569782",
"0.5564528",
"0.5550359",
"0.55453116",
"0.553882",
"0.5504044",
"0.54978245",
"0.54978245",
"0.54978245",
"0.54978245",
"0.54978245",
"0.54978245",
"0.5495142",
"0.5490801",
"0.54884505",
"0.54884505",
"0.5484166",
"0.5481742",
"0.54765844",
"0.54650795",
"0.5450691",
"0.5444106",
"0.5442869",
"0.5441388",
"0.54408944",
"0.54388833",
"0.5435424",
"0.5435071",
"0.5426833",
"0.5426061",
"0.5423794",
"0.5421973",
"0.5421804",
"0.5416786",
"0.5402619",
"0.5402495",
"0.5383678",
"0.53737694",
"0.5370405",
"0.53676873",
"0.53670996",
"0.53661454"
] | 0.7083804 | 0 |
Creates a client for the backlog.jp XMLRPC API | def new(space, username, password)
@base = Backlogjp::Base.new(space, username, password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xmlrpc_client\n @xmlrpc_client ||= XMLRPC::Client.new2(\"https://api.webfaction.com/\", nil, 5)\n end",
"def _client\n @client ||= XMLRPC::Client.new(@uri.host, @uri.path, @uri.port, nil, nil, nil, nil, @uri.port == 443, @timeout)\n end",
"def create_client!\n Chef::ApiClient::Registration.new(node_name, client_path, http_api: rest).run\n end",
"def initialize(*args)\n @client ||= Betaface::REST::Client.new(*args) \n end",
"def gardener_xmlrpc\n Log.logger.info(\"Starting gardener XML RPC call\")\n #unless (@env_set)\n # raise \"You have not set the gardener env properly\"\n #end\n return XMLRPC::Client.new2(self.gardener_api_url)\n end",
"def api_client(request_id = new_req_id)\n configure_blueprint\n\n api_client = BlueprintClient::ApiClient.new\n api_client.default_headers = {\n 'X-Request-Id' => request_id,\n 'User-Agent' => \"talis-ruby-client/#{Talis::VERSION} \"\\\n \"ruby/#{RUBY_VERSION}\"\n }\n\n BlueprintClient::HierarchyApi.new(api_client)\n end",
"def client\n @client ||= client_for_host(brine_root_url || 'http://localhost:8080',\n logging: ENV['BRINE_LOG_HTTP'])\n end",
"def init_client; end",
"def initialize_client\n secret = Settings['xml_rpc'] ? Settings.xml_rpc['secret'] : nil\n endpoint = Settings['xml_rpc'] ? Settings.xml_rpc['endpoint'] : nil\n fail ArgumentError, \"#{endpoint} is not a valid URL.\" if endpoint && !uri?(endpoint)\n\n @client = OpenNebula::Client.new(secret, endpoint)\n end",
"def _client\n @client ||= XMLRPCClient.new(@uri.host, @uri.path, @uri.port, nil, nil, nil, nil, @uri.scheme == 'https' ? @ssl_verify : false, @timeout)\n end",
"def start_client\n @client = Client.new(@configure.apis)\n @client.run\n end",
"def new_client(username , password)\n @client = Octokit::Client.new(:login => username, :password => password)\nend",
"def create_clients\n @haproxy = rpcclient('haproxy')\n @site = rpcclient('site')\n @service = rpcclient('service')\n @rpcutil = rpcclient('rpcutil')\n # Disable to progress bar to clean up output a little\n [@haproxy, @site, @service, @rpcutil].each do |client|\n client.progress = false\n end\nend",
"def client; end",
"def client; end",
"def initialize\n # URL and TIMEOUT_SECONDS are defined in\n # config/initializers/movies_service_client_config.rb\n @client = ActionWebService::Client::XmlRpc.new(\n MoviesApi, \n ENDPOINT_URL, \n {:handler_name => 'movies_service', :timeout => TIMEOUT_SECONDS}\n )\n end",
"def new_client\n Savon.client(\n wsdl: @wsdl,\n endpoint: @endpoint,\n convert_request_keys_to: :none,\n soap_version: 1,\n pretty_print_xml: true,\n filters: [:password],\n logger: @soap_logger,\n log_level: @soap_log_level,\n log: @soap_log\n )\n end",
"def api\n # Don't cache instance for now because of a ruby marshaling bug present\n # in MRI 1.9.3 (Bug #7627) that causes instance variables to be\n # marshaled even when explicitly specifying #marshal_dump.\n Octokit::Client.new(:login => login, :access_token => token)\n end",
"def client\n @client ||= Client.new(config[:credentials], config[:end_point])\n end",
"def new\n build_client\n end",
"def client\n @client.push()\n end",
"def client\n end",
"def client\n @client = Faceberry::Client.new(options) unless defined?(@client) && @client.cache_key == options.hash\n @client\n end",
"def client\n puts \"creating client\"\n @client ||= Vineyard::Client.new(options) #unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def new_api\n load_config\n require 'extensions/metasploit/extension.rb'\n @api = BeEF::Extension::Metasploit::RpcClient.instance\n @api.unit_test_init()\n end",
"def start\n @scheme_registry = create_scheme_registry\n @connection_manager = create_connection_manager\n\n @client = create_http_client\n end",
"def client\n @client = Wayback::Client.new(options) unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"def initialize(**options)\n @api_client = PayPoint::Blue::API.new(**options)\n super\n end",
"def rpc(options={})\n options[:client_id] ||= @client_id if @client_id\n @rpc ||= Rpc.new(self)\n end",
"def client\n @client ||= Client.new\n end",
"def create_client\n\nend",
"def client\n @client = Gluby::Client.instance unless @client\n @client\n end",
"def create_client(name, facebook_id, twitter_handle)\n puts name, facebook_id, twitter_handle\n # Point the HTTP POST method at the clients endpoint of Klipfolio's API.\n response = self.class.post(\"https://app.klipfolio.com/api/1.0/clients\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n \"name\": name,\n \"description\": \"\",\n \"seats\": 5,\n \"status\": \"active\"\n }.to_json)\n puts response.body\n puts \"Client was successfully created.\" if response.success?\n\n # Extract the new client's ID from the HTTP response so that it can be passed to the update_features & update_resources methods.\n client_id = response[\"meta\"][\"location\"]\n client_id.slice!(\"/clients/\")\n p client_id\n\n update_resources(client_id)\n update_features(client_id)\n update_company_properties(client_id, facebook_id, twitter_handle)\n create_group(client_id)\n share_dashboard(client_id)\n end",
"def start_client(host = T.unsafe(nil), port = T.unsafe(nil)); end",
"def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(RequesterServer)\n s.run_till_terminated\nend",
"def establish\n @proxy = XMLRPC::Client.new(@hostname, '/RPC2', @port).proxy(@proxy_name)\n end",
"def new\n\t\t@client = Client.new\n\tend",
"def client(\n name,\n method: nil,\n url: nil,\n status_callback_event: nil,\n status_callback_method: nil,\n status_callback: nil,\n **keyword_args\n )\n append(Client.new(\n name,\n method: method,\n url: url,\n status_callback_event: status_callback_event,\n status_callback_method: status_callback_method,\n status_callback: status_callback,\n **keyword_args\n ))\n end",
"def client \n @client ||= Savon::Client.new do\n wsdl.document = self.endpoint\n end\n end",
"def setup_http_client\n if data_collector_token.nil?\n Chef::ServerAPI.new(data_collector_server_url, validate_utf8: false)\n else\n Chef::HTTP::SimpleJSON.new(data_collector_server_url, validate_utf8: false)\n end\n end",
"def initialize(username, password, api_key) \n @username = username\n @password = password\n @api_key = api_key\n @client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :debug, pretty_print_xml: true)\n #@client = Savon.client(wsdl: BULLHORN_WSDL, log_level: :warn, pretty_print_xml: true)\n end",
"def client\n @client ||= Client.new(configuration)\n end",
"def initialize\n @xmlrpc = ::XMLRPC::Marshal.new\n end",
"def api\n # Instantiate an instance of Gibbon with the API key provided to this adapter.\n # We only work with the lists api here, so namespace into that.\n Gibbon::Request.new(api_key: @campaignable_api_key)\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/dataproc/v1beta2/jobs_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.endpoint = @config.endpoint\n end\n\n @job_controller_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Dataproc::V1beta2::JobController::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def get_xmlrpc_server(env=nil)\n\n require 'yaml'\n require 'xmlrpc/client'\n\n unless @@ms_xmlrpc_server\n http_config = get_remote_credentials(env)\n @@ms_xmlrpc_server = XMLRPC::Client.new(http_config['server_name'], '/remote/api', http_config['server_port'], nil, nil, http_config['http_user'], http_config['http_pass'])\n end\n\n @@ms_xmlrpc_server\n end",
"def api_client\n @api_client ||= WildFly::ApiClient.new\n end",
"def http\n @http ||= HTTPClient.new(\n agent_name: \"CPRClient/#{CPRClient::VERSION}\",\n default_header: { 'Content-Type' => 'text/xml' }\n )\n end",
"def app\n API.new(ledger: ledger)\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/maps/fleetengine/v1/trip_api_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @trip_service_stub = ::Gapic::ServiceStub.new(\n ::Maps::Fleetengine::V1::TripService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def create_client\n @client = if @opts[:servers]\n Monga::Clients::ReplicaSetClient.new(@opts)\n else\n Monga::Clients::SingleInstanceClient.new(@opts)\n end\n end",
"def client\n @client ||= Utils::Box::Client.new\n end",
"def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(CalculadoraServer)\n s.run_till_terminated\nend",
"def orchestrate_client\n client\n end",
"def fork\n Prefab::Client.new(@options)\n end",
"def open\n @soap_client ||= SOAP::WSDLDriverFactory.new(\"https://#{@host}:#{@port}/QBXMLRemote?wsdl\").create_rpc_driver\n @ticket = @soap_client.OpenConnectionAndBeginSession(@user, @password, '', @application_name, '', @mode)\n return @ticket\n end",
"def websocket_client\n @websocket_client ||= Faye::WebSocket::Client.new(rtm_start.websocket_url)\n end",
"def client_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/clients.json\",\n body: client_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/pubsublite/v1/admin_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.endpoint = @config.endpoint\n end\n\n @admin_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::PubSubLite::V1::AdminService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def branch(...)\n ApplicationClient.new(...)\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def initialize\n @j_del = org.vertx.java.platform.impl.JRubyVerticleFactory.vertx.createNetClient\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/channel/v1/service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @cloud_channel_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Channel::V1::CloudChannelService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize(host, port, service)\n @rpc = RpcClient.new(host, port)\n @service = service\n end",
"def fitbit_client\n # On authorization, we stored the user's credentials in the database\n # now, whenever we like, we can call this method anywhere\n\n client = FitbitAPI::Client.new(\n client_id: ENV[\"FITBIT_ID\"],\n client_secret: ENV[\"FITBIT_SECRET\"],\n access_token: self.fitbit_access_token,\n refresh_token: self.fitbit_refresh_token,\n expires_at: self.fitbit_expires_at,\n user_id: self.fitbit_user_id\n )\n\n return client\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/apigateway/v1/apigateway_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @api_gateway_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::ApiGateway::V1::ApiGatewayService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize(user, password, server=\"www.livejournal.com\")\n @client = XMLRPC::Client.new server, \"/interface/xmlrpc\"\n @user = user\n @password = MD5.md5(password).to_s\n @paramhash = { \"username\" => user,\n \"auth_method\" => \"challenge\",\n \"ver\" => 1 }\n @restful_ish_client = Net::HTTP.new(\"www.livejournal.com\")\n @restful_ish_client_headers = { \n \"User-Agent\" => \"RubyLJ\",\n \"Content-Type\" => \"text/xml; charset=UTF-8\",\n \"Connection\" => \"keep-alive\"\n }\n @comment_cache_dir = \"db/ljcomments\"\n @comment_cache = File.join(@comment_cache_dir, \"allcomments.xml\")\n end",
"def initialize(user, password, application_name, host=\"192.168.0.8\", port=3790, mode='multiUser')\n @user = user\n @password = password\n @application_name = application_name\n @host = host\n @port = port\n @mode = mode\n @ticket = nil\n @soap_client = nil \n end",
"def create_client_of_cybozu\n cybozu = Cybozu.find(1) \n CybozuApi::Client.new(cybozu.url, cybozu.login_id, cybozu.password)\n end",
"def client\n @client ||= Savon::Client.new do\n wsdl.endpoint = Kraut.endpoint\n wsdl.namespace = \"urn:SecurityServer\"\n end\n end",
"def client\n @client\n end",
"def client\n @client\n end",
"def client\n @client\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/monitoring/v3/uptime_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @uptime_check_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Monitoring::V3::UptimeCheckService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def main\n stub = Topicrpc::Collection::Stub.new('localhost:50051', :this_channel_is_insecure)\n message = stub.get_feature(::Topicrpc::TopicRequest.new(topic_id: 1))\n p message.inspect\nend",
"def client\n shell.client\n end",
"def api\n @api ||= Octokit::Client.new(:login => login, :oauth_token => token)\n end",
"def initialize\n @client = Savon.client(wsdl: Twinfield::WSDLS[:session])\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"garbage/garbage_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @garbage_service_stub = ::Gapic::ServiceStub.new(\n ::So::Much::Trash::GarbageService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initiate_xmlrpc_session\n begin\n response = xmlrpc_client.call(\"login\", @settings[\"webfaction_user\"], @settings[\"webfaction_password\"])\n id = response.first\n rescue XMLRPC::FaultException, Timeout::Error => e\n raise \"Error during connection. Please try again later.\"\n end\n id \n end",
"def create_api_instance\n facturama_user='prueba'\n facturama_password='pruebas2011'\n is_development = true # true = Modo de pruebas / sandbox, false = Modo de Producción (Timbrado real)\n\n\n #Creacion de una instancia de FacturamaApi\n Facturama::FacturamaApiWeb.new(facturama_user,facturama_password,is_development)\n end",
"def new_websocket_client(client)\n\n msg \"connecting to: %s:%s\" % [@target_host, @target_port]\n tsock = TCPSocket.open(@target_host, @target_port)\n\n if @verbose then puts @@Traffic_legend end\n\n begin\n do_proxy(client, tsock)\n rescue\n tsock.shutdown(Socket::SHUT_RDWR)\n tsock.close\n raise\n end\n end",
"def createClient(subdomain, username, password, identifier, header)\n\tpayload = {client: {\n name: 'Ruby HTTP Request',\n identifier: identifier\n }\n }\n\turi = URI.parse(\"https://\"+subdomain+\".zendesk.com/api/v2/oauth/clients.json\")\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\thttp.use_ssl = true\n\trequest = Net::HTTP::Post.new(uri.request_uri, header)\n\trequest.basic_auth(username, password)\n\trequest.body = payload.to_json\n\tresponse = http.request(request)\n\tdata = JSON.parse(response.body)\n\tputs \"Creating OAuth Client \" + identifier\n\tputs data\n\treturn data[\"client\"][\"id\"]\nend",
"def rpc\n @rpc ||= begin\n params = {path: '/RPC2'}\n if ctl_is_inet?\n params.update(host: @ctl_bind_host, port: @ctl_bind_port)\n else\n params[:host] = ctl_listen\n end\n params[:user] = ctl_username if ctl_username\n params[:password] = ctl_password if ctl_password\n client = PoiseSupervisor::Utils::RpcClient.new_from_hash(params)\n client.proxy('supervisor')\n end\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/ads/google_ads/v3/services/mutate_job_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n credentials ||= Credentials.default scope: @config.scope\n if credentials.is_a?(String) || credentials.is_a?(Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.endpoint = @config.endpoint\n end\n\n @mutate_job_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Ads::GoogleAds::V3::Services::MutateJobService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def client\n self.class.client\n end",
"def client\n self.class.client\n end",
"def client\n @client ||= self.class.client\n end",
"def create(args = nil)\n # Connects to the xmpp-client that is used for sending xmpp-messages\n @send_client = connect(@@send_client_info)\n \n # Connect to xmpp-client that is used for receiving messages that are then turn into http-requests\n @receive_client = connect(@@receive_client_info)\n runMessageReceiver\n \n # Ensures that xmpp-server has node: home/host/<host>/<node_account>/contexts\n XmppHelper::createContextGeneralNode\n\n end",
"def client\n @client ||= Contentful::Client.new(\n access_token: options.access_token,\n space: options.space,\n dynamic_entries: :auto,\n api_url: options.api_url\n )\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/netapp/v1/cloud_netapp_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @location_client = Google::Cloud::Location::Locations::Client.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @net_app_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::NetApp::V1::NetApp::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def initialize(ip, secret)\n @ip = ip\n @secret = secret\n \n @conn = SOAP::RPC::Driver.new(\"https://#{@ip}:17443\")\n @conn.add_method(\"set_parameters\", \"djinn_locations\", \"database_credentials\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps\", \"app_names\", \"secret\")\n @conn.add_method(\"set_apps_to_restart\", \"apps_to_restart\", \"secret\")\n @conn.add_method(\"status\", \"secret\")\n @conn.add_method(\"get_stats\", \"secret\")\n @conn.add_method(\"update\", \"app_names\", \"secret\")\n @conn.add_method(\"stop_app\", \"app_name\", \"secret\") \n @conn.add_method(\"get_all_public_ips\", \"secret\")\n @conn.add_method(\"is_done_loading\", \"secret\")\n @conn.add_method(\"is_done_initializing\", \"secret\")\n @conn.add_method(\"add_role\", \"new_role\", \"secret\")\n @conn.add_method(\"remove_role\", \"old_role\", \"secret\")\n @conn.add_method(\"get_queues_in_use\", \"secret\")\n @conn.add_method(\"add_appserver_to_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"remove_appserver_from_haproxy\", \"app_id\", \"ip\", \"port\",\n \"secret\")\n @conn.add_method(\"add_appserver_process\", \"app_id\", \"secret\")\n @conn.add_method(\"remove_appserver_process\", \"app_id\", \"port\", \"secret\")\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/dialogflow/v2beta1/participant_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @participants_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Dialogflow::V2beta1::Participants::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def client(group, version)\n # Return the client immediately if it has been created before:\n key = group + '/' + version\n client = @clients[key]\n return client if client\n\n # Determine the API path:\n if group == CORE_GROUP\n path = '/api'\n else\n path = '/apis/' + group\n end\n\n # Create the client and save it:\n url = URI::Generic.build(\n scheme: 'https',\n host: @host,\n port: @port,\n path: path\n )\n client = Kubeclient::Client.new(\n url.to_s,\n version,\n @opts\n )\n @clients[key] = client\n\n # Return the client:\n client\n end",
"def jira_client\n options = {\n :username => @username,\n :password => @password,\n :site => @url,\n :context_path => \"\",\n :auth_type => :basic,\n :use_ssl => true\n }\n JIRA::Client.new(options)\n end",
"def client\n @client ||= VAHealthcareMessaging::Client.new(config: MHV_CONFIG, session: { user_id: correlation_id })\n end",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend",
"def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend"
] | [
"0.7462144",
"0.6633916",
"0.6228647",
"0.6228523",
"0.61985",
"0.6182229",
"0.6090183",
"0.60566425",
"0.5897246",
"0.58641696",
"0.5862251",
"0.58438987",
"0.57994854",
"0.57649505",
"0.57649505",
"0.5760801",
"0.5751104",
"0.573898",
"0.5724729",
"0.55873513",
"0.5577965",
"0.55637604",
"0.5535071",
"0.5530972",
"0.55279195",
"0.55279195",
"0.55279195",
"0.55004764",
"0.54986966",
"0.5483675",
"0.5480472",
"0.5479653",
"0.5476658",
"0.5475687",
"0.5474552",
"0.54586",
"0.5444779",
"0.5436162",
"0.5431559",
"0.54287565",
"0.54271567",
"0.54200804",
"0.54195493",
"0.5405352",
"0.5403467",
"0.5383132",
"0.5373351",
"0.5371933",
"0.53672826",
"0.5354306",
"0.5351345",
"0.53272337",
"0.53233534",
"0.5323038",
"0.5319762",
"0.53141856",
"0.53128874",
"0.5306758",
"0.5305294",
"0.53035825",
"0.5302717",
"0.53014123",
"0.5300952",
"0.52843386",
"0.52674794",
"0.5262526",
"0.5262261",
"0.5261216",
"0.52609974",
"0.5258655",
"0.52549404",
"0.5248547",
"0.5247978",
"0.5244065",
"0.5244065",
"0.5244065",
"0.52409244",
"0.52403265",
"0.52370036",
"0.52365637",
"0.52363104",
"0.5235912",
"0.52337646",
"0.52289444",
"0.52252305",
"0.52220637",
"0.5219431",
"0.5207423",
"0.5199274",
"0.5199274",
"0.51980704",
"0.5190769",
"0.51901937",
"0.5188685",
"0.51824296",
"0.5180363",
"0.5177893",
"0.51682454",
"0.5167789",
"0.5167613",
"0.5167613"
] | 0.0 | -1 |
get 5 random queries, across the given object types | def get_random_quick_queries(types)
allTypes = types.collect {|type| type.get_quick_queries}.flatten
prng = Random.new
random_qq = allTypes.sort {|item1, item2| prng.rand(-1 .. 1) }.slice(0, 5)
random_qq.collect {|qq| render_quick_query(qq)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomise\n @random_articles = Article.limit(5).order(\"RANDOM()\")\n @random_users = User.limit(5).order(\"RANDOM()\")\n @random_diarys = Diary.limit(5).order(\"RANDOM()\")\n @random_groups = Group.limit(5).order(\"RANDOM()\")\n end",
"def random_query\n # Use a fake query\n # TODO: better random queries\n 'query ' + (rand*5000).to_i.to_s\nend",
"def find_mru_entity_types(entity_type, login, amount = 10, already_chosen_ids=[])\n klass = Inflector.constantize(entity_type.entity_type.to_s.camelize)\n \n #This is the case where we have no previously chosen objects,e.g. expressions of a manifestation\n if already_chosen_ids.blank?\n @mru_frbr_objects = klass.find(:all, :limit => amount, \n #Not useful due to batch upload user :conditions => [\"updated_by = ?\", login.login_id],\n :order => 'updated_at desc'\n )\n \n #we need to append a not in clause\n else\n thing_id = entity_type.entity_type + \"_id\"\n @mru_frbr_objects = klass.find(:all, :limit => amount, \n :conditions => [\"#{thing_id} not in (?)\", already_chosen_ids],\n :order => 'updated_at desc'\n )\n end\n \n end",
"def random_objects_with_max(max, model_type)\n number_of_objects = Random.rand(1..max)\n objects = []\n number_of_objects.times do |index|\n objects[index] = create(model_type)\n end\n objects\nend",
"def generate_objects!\n if custom_query?\n results = eval(custom_query)\n else\n objects = any? ? [] : starting_objects.clone\n objects_to_delete = []\n puts \"Evaluating #{starting_objects.size} objects and #{conditions.size} condition(s)...\"\n for obj in starting_objects\n # print \"\\n #{obj.id}: \"\n for condition in conditions\n # print \" [C#{condition.id}:\"\n if condition.passes?(obj)\n # print \"PASS]\"\n objects << obj and break if any?\n else\n # print \"FAIL]\"\n objects_to_delete << obj and break if all?\n end\n end\n end\n results = objects - objects_to_delete\n unless result_variant.blank?\n results = results.collect{|r| r.instance_eval(result_variant)}.flatten\n end\n end\n update_object_ids(results)\n update_attribute(:objects_generated_at, Time.now)\n update_attribute(:objects_count, self.object_ids.values.flatten.uniq.size)\n results\n end",
"def get_all_sobjects(type)\n case type\n when 'Account'\n records = @client.materialize(type).query(\"Agents__c != ''\")\n when 'ccrmbasic__Email__c'\n records = @client.materialize(type).query(\"ccrmbasic__Contact__c != ''\")\n else\n records = @client.materialize(type).all\n end\n sobjects = records.dup.to_a\n while records.next_page?\n sobjects += records.next_page\n records = records.next_page\n end\n sobjects\n end",
"def object_query_generator(data)\n # query header\n query = \"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n PREFIX owl: <http://www.w3.org/2002/07/owl#>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n PREFIX : <http://www.semanticweb.org/simon/ontologies/2016/1/medienprojekt#>\n \n SELECT *\n {\"\n \n # combine the parameters with the query\n data.each {\n |hash| if hash.has_key?(:predicate)\n # its possible to have predicate and object parameters \n query = query << \"?name \" << hash[:predicate] << \" :\" << hash[:object] << \" .\\n\"\n else\n # or just an object parameter\n query = query << \"?name ?predicate :\" << hash[:object] << \" .\\n\"\n end\n }\n\n # query footer\n query = query << \" }\\nLIMIT 400\"\n # return the resulting query\n return query\n end",
"def suggested(n = 4)\n # TODO : Commented out because this request is extremely slow and makes page render twice.\n # return(Spree::Product.random_marketplace(n)) if self.get_type.nil?\n # \n # kolors = self.colors_hash\n # color1, color2 = kolors[:primary], kolors[:secondary]\n # \n # ret = []\n # ret.concat(color1.products.presentable.randomize.limit(n * 5)) unless color1.nil?\n # ret.concat(color2.products.presentable.randomize.limit(n * 5)) unless color2.nil?\n # ret = ret.sort_by { rand }\n # ret.concat(Spree::Product.random_marketplace(n))\n # ret.reject! {|product| product.get_type == self.get_type }\n # ret.delete(self)\n # ret.uniq!\n # ret.first(n)\n \n Spree::Product.active.with_image.randomize.limit(n)\n end",
"def random_hugs\n huglist_sample = []\n 5.times { huglist_sample.push(Huglist.all.sample[:id]) }\n return huglist_sample.uniq\nend",
"def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend",
"def query_methods(result_type); end",
"def get_all_objects(class_name, count)\n per_page = 1000\n objects = []\n times = [(count/per_page.to_f).ceil, 10].min\n 0.upto(times) do |offset|\n query = Parse::Query.new(class_name)\n query.limit = per_page\n query.skip = offset * per_page\n objects << query.get\n end\n objects.flatten(1)\n end",
"def pick_class(model_class)\n\t\tmodel_class.all.sample\n\tend",
"def populate_items\n return if @items.size >= 15\n\n type = rand\n if type < 0.010\n @items.push(Goody.new(:apple))\n elsif type < 0.040\n @items.push(Goody.new(:merde))\n end\n end",
"def recommend_new_songs\nselected =Song.all.select do |song|\n song.genre == self.favorite_genre\nend\nselected.sample(5)\n\n end",
"def sample_question\n get_all_from_database.sample\n end",
"def typical_users(n=1,randomize=true)\n ids = items.flat_map {|item|\n item.subscriber_ids\n }.reduce(Hash.new(0)) { |h,id|\n h[id] += 1\n h\n }\n .sort_by{|k,v| v}.reverse\n .take(2*n)\n .sample(n)\n .map(&:first)\n\n User.any_in(id: ids)\n end",
"def index\n #code to produce 9 random records pulled from http://blog.endpoint.com/2016/05/randomized-queries-in-ruby-on-rails.html?m=1\n desired_records = 9\n count= desired_records * 3\n offset = rand([School.count - count, 1].max)\n set = School.limit(count).offset(offset).pluck(:id)\n @schools = School.includes(:reviews).find(set.sample(desired_records)).paginate(page: params[:page], per_page:10)#includes uses eager loading to solve the N + ! queries problem, reducing number of\n\n\n end",
"def all\n list = []\n page = 1\n fetch_all = true\n\n if @query.has_key?(:page)\n page = @query[:page]\n fetch_all = false\n end\n \n while true\n response = RestClient.get(@type.Resource, @query)\n data = response['data'] \n if !data.nil? && data.any?\n data.each {|item| list << @type.from_json(item)}\n \n if !fetch_all\n break\n else\n @query.merge!(page: page += 1)\n end\n else\n break\n end\n end\n\n return list\n end",
"def relation_objects_perform\n # Build the relation depending on the various options (query methods).\n relation = AllTypesObject.all\n # Extract and apply query methods.\n relation = apply_query_methods(relation, params)\n\n # Perform the query\n case params[:method]\n when \"first\", \"last\", \"take\"\n amount = params[:amount].to_i if params[:amount].present?\n @results = relation.send(params[:method], *amount)\n when \"to_a\", \"all\", \"load\", \"reload\", \"first!\", \"last!\", \"take!\"\n @results = relation.send(params[:method])\n when \"select\"\n @results = relation.send(params[:method]) { true } # Select with a block acts as a finder method. The block simply returns true to not futher limit the results.\n when \"find\"\n case params[:option]\n when \"sub_method\"\n if FIND_SUB_METHODS.include?(params[:sub_method])\n @results = relation.send(params[:method], params[:sub_method].to_sym)\n else\n flash[:alert] = \"Unknown sub method selected\" unless running?\n end\n when \"single_id\"\n @results = relation.send(params[:method], params[:id])\n when \"id_list\"\n @results = relation.send(params[:method], *params[:id])\n when \"id_array\"\n @results = relation.send(params[:method], params[:id])\n end\n when \"find_by\", \"find_by!\"\n conditions = build_conditions('joined', 'list', params[:conditions]).first || [nil]\n @results = relation.send(params[:method], *conditions)\n when \"find_or_initialize_by\", \"find_or_create_by\", \"find_or_create_by!\"\n conditions = build_conditions('joined', 'hash', params[:conditions]).flatten.first || {}\n attributes = params[:attributes].reject { |k,v| v.blank? }\n if attributes.present?\n @results = relation.send(params[:method], conditions) { |object| object.attributes = attributes }\n else\n @results = relation.send(params[:method], conditions)\n end\n when \"dynamic_find_by\", \"dynamic_find_by!\"\n # Check if the attribute name is allowed to prevent errors.\n return redirect_to read_test_relation_objects_form_path(params[:method], params[:option]), :alert => \"Selected attribute is not a valid attribute of AllTypesObject!\" unless AllTypesObject.column_names.include?(params[:attribute])\n method = \"find_by_#{params[:attribute]}\" + (params[:method] == \"dynamic_find_by!\" ? \"!\" : \"\")\n @results = relation.send(method, params[:value])\n when \"find_each\", \"find_in_batches\"\n @results = []\n options = {}\n options[:start] = params[:start].to_i if params[:start].present?\n options[:batch_size] = params[:batch_size].to_i if params[:batch_size].present?\n relation.send(params[:method], options) { |results| @results << results }\n when \"first_or_initialize\", \"first_or_create\", \"first_or_create!\"\n @results = relation.send(params[:method], params[:attributes].presence)\n else\n raise \"Unknown method '#{params[:method]}'\"\n end\n\n # Wrap the result(s) in array and flatten (since the template expects an array of results)\n @all_types_objects = (@results.present? ? [@results].flatten : nil)\n\n @includes = (relation.eager_load_values + relation.includes_values + relation.preload_values).uniq\n\n respond_with(@all_types_objects)\n end",
"def random_products_by_product_type(n=8)\n skope = presentable.randomize.limit(n)\n \n (ActiveSupport::OrderedHash.new).tap do |hasz|\n taxon_names.each do |taxon_name|\n taxon = Spree::Taxon.find_by_name(taxon_name)\n hasz[taxon] = skope.in_taxon(taxon) unless taxon.nil?\n end\n end\n end",
"def all\n # Grab first five matching users\n @users = User.where(\"LOWER(name) LIKE ?\", \"%#{@query}%\").limit(5)\n\n # Grab first five matching groups\n @groups = Group.where.not(privacy: :secret_group)\n .where(\"LOWER(name) LIKE ?\", \"%#{@query}%\").limit(5)\n\n # Sort the users and groups together\n @users_and_groups = (@users + @groups).sort_by { |item| SearchScore.name(item.name, @query) }\n end",
"def seed_clients\n 10.times do |n|\n Client.create!({\n sex: %w(male female other).sample,\n year_of_birth: [*1950..2004].sample,\n cell_phone: fake_cell_phone,\n category_ids: [1, 2, 3, 4].sample\n })\n end\nend",
"def santa_creator(number_of_santas)\n example_genders = [\"agender\", \"female\", \"bigender\", \"male\", \"female\", \"gender fluid\", \"N/A\"]\n example_ethnicities = [\"black\", \"Latino\", \"white\", \"Japanese-African\", \"prefer not to say\", \"Mystical Creature (unicorn)\", \"N/A\"]\n number_of_santas.times do\n santa_instance = Santa.new(example_genders.sample, example_ethnicities. sample)\n p santa_instance.gender\n p santa_instance.age\n p santa_instance.ethnicity\n p santa_instance.reindeer_ranking\n end\nend",
"def mock_types(extra=[])\n types = extra.concat(fixture_cartridges)\n ActiveResource::HttpMock.respond_to(false) do |mock|\n mock.get '/broker/rest/cartridges.json', anonymous_json_header, types.to_json\n end\n types = CartridgeType.cached.all\n assert types.length > 0\n assert Rails.cache.read(CartridgeType.cached.send(:cache_key_for, :find_every))\n types\n end",
"def random_skills(skills, count)\n Skill.where(name: skills.sample(count))\nend",
"def run_population_trials(num_trials=1000000)\n result = []\n\n cards = create_deck_of_cards\n\n num_trials.times do\n idx = rand(cards.size).to_i\n result << is_type_diamond(cards[idx])\n end\n\n stats = OpenStruct.new \n stats.prob_of_success = result.mean\n stats.std_dev = result.std_dev\n return stats\nend",
"def random(count: nil, collections: nil, featured: nil, user: nil, query: nil, orientation: nil)\n Unsplash.configuration.logger.warn \"You cannot combine 'collections' and 'query' parameters. 'query' will be ignored.\" if collections && query\n\n params = {\n collections: (collections && collections.join(\",\")),\n featured: featured,\n username: user,\n query: query,\n orientation: orientation\n }.select { |k,v| v }\n if count\n params[:count] = count\n photos = parse_list connection.get(\"/photos/random/\", params).body\n photos.map { |photo|\n photo.user = Unsplash::User.new photo[:user]\n photo\n }\n else\n photo = Unsplash::Photo.new JSON.parse(connection.get(\"/photos/random\", params).body)\n photo.user = Unsplash::User.new photo.user\n photo\n end\n end",
"def randomize_records\n puts \"Due to the API throughput limitations, this may take some time...\\n\"\n\n execute_customer_record_create(10)\n\n execute_sales_order_create(25)\n\n execute_invoice_create(25)\n\n # 25.times do |t|\n # execute_payment_create(25)\n # end\n\n puts \"\\nFinished creating bulk records!\"\n exit\n end",
"def all_objects\n objects = {\n \"Strawberries\" => get_strawberries,\n \"Mushrooms\" => get_mushrooms,\n \"Monsters\" => get_monsters,\n \"Persons\" => get_persons\n }\n end",
"def index\n @city_names = ClockCity.all.pluck(:name)\n @brand_names = ClockBrand.all.pluck(:name)\n @hotels = ClockHotel.where(id: (1..1000).to_a.sample(18)).select(:id,:name,:shop_time,:price,:room_hour).to_a\n @rand_hotels = BkCnHotel.where(\"id > ? and status = 2\", rand(1940)).limit(10).select(:url_path_md5, :hotel_name, :address, :images)\n end",
"def random_friends\n query = \"\n (SELECT companies.* FROM companies as companies \n JOIN company_relationships as destinies \n ON (companies.id = destinies.company_origin_id and confirmed=true) \n JOIN layouts as layouts\n ON (companies.id = layouts.company_id)\n WHERE (destinies.company_destiny_id=#{self.id.to_s}))\"\n query << \" \n UNION (SELECT companies.* \n FROM companies as companies \n JOIN company_relationships as origins \n ON (companies.id = origins.company_destiny_id and confirmed=true) \n JOIN layouts as layouts\n ON (companies.id = layouts.company_id)\n WHERE (origins.company_origin_id=#{self.id.to_s}))\"\n query << \" order by rand()\"\n Company.paginate_by_sql(query, :page => 1, :per_page => 6)\n end",
"def get_objects(data,*moredata)\n parms = legacy_getparms(data,moredata)\n # def get_objects(objecttype, get, exactget, regexget, exclude, andget, includes=nil, login=nil, password_callback=PasswordCallback)\n objecttype = parms[:objecttype]\n get = parms[:get]\n exactget = parms[:exactget]\n regexget = parms[:regexget]\n exclude = parms[:exclude]\n andget = parms[:andget]\n includes = parms[:includes]\n login = parms[:login]\n password_callback = parms[:password_callback]\n # PS-704 - node_groups controller when format.xml, includes some custom model methods that create a lot of querying joins, so this is\n # a way to 'override' it on cli side - the server will look for that param to skip these def methods when it renders. webparams = {:nodefmeth => 1}\n webparams = parms[:webparams]\n #\n # Package up the search parameters in the format the server expects\n #\n metaget = []\n if get\n get.each_pair do |key,values|\n if key == 'enable_aliases' && values == 1\n metaget << \"#{key}=#{values}\"\n elsif values.length > 1\n values.each do |value|\n metaget << \"#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if exactget\n exactget.each_pair do |key,values|\n if key == 'enable_aliases' && values == 1\n metaget << \"#{key}=#{values}\"\n elsif values.length > 1\n values.each do |value|\n metaget << \"exact_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"exact_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if regexget\n regexget.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"regex_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"regex_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if exclude\n exclude.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"exclude_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"exclude_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if andget\n andget.each_pair do |key,values|\n if values.length > 1\n values.each do |value|\n metaget << \"and_#{key}[]=#{CGI.escape(value)}\"\n end\n else\n # This isn't strictly necessary, specifying a single value via\n # 'key[]=[value]' would work fine, but this makes for a cleaner URL\n # and slightly reduced processing on the backend\n metaget << \"and_#{key}=#{CGI.escape(values[0])}\"\n end\n end\n end\n if includes\n # includes = ['status', 'rack:datacenter']\n # maps to\n # include[status]=&include[rack]=datacenter\n includes.each do |inc|\n incstring = ''\n if inc.include?(':')\n incparts = inc.split(':')\n lastpart = incparts.pop\n incstring = 'include'\n incparts.each { |part| incstring << \"[#{part}]\" }\n incstring << \"=#{lastpart}\"\n else\n incstring = \"include[#{inc}]=\"\n end\n metaget << incstring\n end\n end\n if webparams && webparams.kind_of?(Hash)\n webparams.each_pair{|k,v| metaget << \"#{k}=#{v}\"}\n end\n\n querystring = metaget.join('&')\n\n #\n # Send the query to the server\n #\n\n if parms[:format] == 'json'\n if HAS_JSON_GEM\n uri = URI::join(@server, \"#{objecttype}.json?#{querystring}\")\n else\n warn \"Warning: Cannot use json format because json gem is not installed. Using xml format instead.\"\n parms[:format] = 'xml'\n uri = URI::join(@server, \"#{objecttype}.xml?#{querystring}\")\n end\n else\n uri = URI::join(@server, \"#{objecttype}.xml?#{querystring}\")\n end\n\n req = Net::HTTP::Get.new(uri.request_uri)\n warn \"GET URL: #{uri}\" if (@debug)\n response = send_request(req, uri, login, password_callback)\n while response.kind_of?(Net::HTTPMovedPermanently)\n uri = URI.parse(response['Location'])\n req = Net::HTTP::Get.new(uri.request_uri)\n response = send_request(req, uri, login, password_callback)\n end\n if !response.kind_of?(Net::HTTPOK)\n puts response.body\n response.error!\n end\n\n if parms[:format] == 'json'\n results = JSON.parse(response.body)\n else\n #\n # Parse the XML data from the server\n # This tries to render the XML into the best possible representation\n # as a Perl hash. It may need to evolve over time.\n puts response.body if (@debug)\n results_xml = REXML::Document.new(response.body)\n results = {}\n if results_xml.root.elements[\"/#{objecttype}\"]\n results_xml.root.elements[\"/#{objecttype}\"].each do |elem|\n # For some reason Elements[] is returning things other than elements,\n # like text nodes\n next if elem.node_type != :element\n data = xml_to_ruby(elem)\n name = data['name'] || data['id']\n if !results[name].nil?\n warn \"Duplicate entries for #{name}. Only one will be shown.\"\n end\n results[name] = data\n end\n end\n end\n\n #puts results.inspect if (@debug)\n puts YAML.dump(results) if (@debug)\n results\n end",
"def random_items(items)\r\n\t\trandom_items = Document.has_photos.find(:all, :limit => items, :order => \"RAND()\")\r\n\tend",
"def random_item(category)\n if category == 'best-bets'\n # Sample a random Best Bet type from a static list\n ['webofscience', 'googlescholar', 'ieee', 'pubmed', 'morningstar', 'wgsn', 'standards', 'dissertation', 'refworks', 'ibis', 'proquest',\n 'psychinfo', 'sciencemagazine', 'sciencedirect', 'petition', 'compendex', 'jstor', 'software', 'naturejournal'].sample\n elsif category == 'doi-trap'\n # Sample a random DOI from a static list\n ['10.1080/10510974.2013.797483', '10.1111/j.1468-2958.1996.tb00379.x', 'http://dx.doi.org/10.1063/1.2741534', 'DOI: 10.1007/BF02887151',\n '10.1039/C4RA16247A', '10.1002/sce.3730670213', 'DOI: 10.1007/s40596-014-0241-5', '10.1080/15348423.2012.697437',\n 'http://dx.doi.org/10.3168/jds.S0022-0302(86)80552-5', 'DOI: 10.1023/A:1005204727421', '10.1039/C3TA00019B', 'doi:10.1038/leu.2016.163',\n 'DOI: 10.1007/s10853-013-7374-x', 'doi: 10.1016/0167-2738(91)90233-2', 'doi: 10.1179/000705992798268927', '10.1038/nphys3794',\n 'doi: 10.1149/1.1393288', '10.1080/1554480X.2014.926052', '10.1002/adma.201506234', '10.1080/00958972.2016.1176158'].sample\n elsif category == 'result-types'\n # Use a defined searcher for found types\n (QuickSearch::Engine::APP_CONFIG['searchers']).sample.dasherize\n elsif category == 'more-options'\n # Use a result number for more-options\n ['result-1', 'result-2', 'result-3', 'result-4'].sample\n elsif category == 'spelling-suggestion'\n # Use a fake string\n 'spelling suggestion ' + (rand*200).to_i.to_s\n else\n # Use one of the typical options for a searcher click (or anything else we haven't handled above)\n ['heading', 'result-1', 'result-2', 'result-3', 'see-all-results', 'no-results', 'error'].sample\n end \nend",
"def generateproblems\n # First problem is unique\n # rand(0..1) picks a random problem from type 0 or 1\n # , 0) is the first problem\n types(rand(0..1), 0)\n (1..8).each do |i|\n types(rand(1..9), i)\n end\n types(10, 9)\n (10..18).each do |i|\n types(rand(1..9), i)\n end\n end",
"def gen_query(item, qtype = :document, o = {})\n o[:length] ||= 3\n case qtype\n when :document\n begin\n query = item.get_index().lm.p.sample_pdist(o[:length]).join(' ')\n rescue Exception => e\n error \"Error in query generation\", e\n return nil\n end \n end\n search_result = @ss.search_by_keyword(query, :doc_only=>true, :page=>1, :per_page=>100)\n return nil if !search_result || !search_result[0]\n tgt_item = choose_position(search_result, item.id)\n History.create(:htype=>'query', :basetime=>Time.now, :item_id=>tgt_item, :src_item_id=>item.id, :user_id=>@user_id,\n :game_id=>@game_id, :metadata=>{:query=>query, :rank=>get_search_rank(search_result, item.id)})\n end",
"def db_queries_table__samples\n [\n \"table1\",\n \"table2\"\n ]\n end",
"def generate_types\n\n puts \"Making Type API calls\"\n\n @pokeapi.get_all_types\n\n puts \"Populating database with types\"\n\n PokemonType.destroy_all\n TypeRelationship.destroy_all\n\n all_types = @pokeapi.types\n\n (1..TYPES).each do |x|\n PokemonType.create(name: all_types[x][:name] )\n end\n\n puts \"Populating type_relationships with default normal effectiveness\"\n\n (1..TYPES).each do |attack|\n (1..TYPES).each do |defend|\n relation_checker = false\n relations_hash = all_types[attack][:damage_relations]\n\n if relations_hash['no_damage_to'][0]\n if relations_hash['no_damage_to'].any? { |relation| relation[\"name\"] == all_types[defend][:name] }\n TypeRelationship.create(attack_type_id: attack, defend_type_id: defend, effectiveness: \"no_damage\" )\n relation_checker = true\n end\n end\n\n if relations_hash['half_damage_to'][0]\n\n if relations_hash['half_damage_to'].any? { |relation| relation[\"name\"] == all_types[defend][:name] }\n TypeRelationship.create(attack_type_id: attack, defend_type_id: defend, effectiveness: \"half_damage\" )\n relation_checker = true\n end\n end\n\n if relations_hash['double_damage_to'][0]\n if relations_hash['double_damage_to'].any? { |relation| relation[\"name\"] == all_types[defend][:name] }\n TypeRelationship.create(attack_type_id: attack, defend_type_id: defend, effectiveness: \"double_damage\" )\n relation_checker = true\n end\n end\n TypeRelationship.create(attack_type_id: attack, defend_type_id: defend, effectiveness: \"normal\" ) if relation_checker == false\n\n end\n end\nend",
"def get_random(limit)\n pids = []\n if limit == nil || limit.to_i==0\n limit = 50\n end\n\n # this is the object returned \n rec_results = {}\n\n## we want some suggestions\n## we get one from each series and then randomise those\n## gives better results than pure random\n\n si = 767 #distinct series\n arr = limit.times.map{ rand(si) } \n arr = arr.sort_by{ rand }.slice(0...12)\n st = arr.join(\",\")\n\n suggestions = []\n q0 = \"select distinct series_crid from just_series where id in (#{st})\"\n puts q0\n arr = []\n results3 = query(q0)\n results3.each do |r3|\n p = r3[0]\n arr.push(\"'#{p}'\")\n end\n txt = arr.join(\",\")\n\n q = \"select pids.* from pids,series where series.pid=pids.pid and series.series_crid in (#{txt}) group by series_crid\"\n\n puts q\n results4 = query(q)\n results4.each do |r4|\n sugg = {}\n ddtt = r4[6]\n crid = r4[3]\n pid = r4[4]\n pids.push(pid)\n desc = r4[5]\n prog1 = r4[1].to_s\n chan = r4[8]\n ct = r4[9].to_s\n st = r4[10].to_s\n\n text_date = process_date(ddtt)\n\n if(ddtt)\n sugg[\"date_time\"] = ddtt\n end\n if(text_date)\n sugg[\"text_date\"] = text_date\n end\n if(chan)\n sugg[\"channel\"] = chan\n end\n\n sugg[\"core_title\"] = ct.strip\n sugg[\"series_title\"] = st.strip\n sugg[\"pid\"] = pid\n sugg[\"description\"] = desc\n img = \"http://dev.notu.be/2011/04/danbri/crawler/images/#{pid}_512_288.jpg\"\n\n sugg[\"image\"] = img\n\n suggestions.push(sugg)\n\n end\n rec_results[\"suggestions\"]=suggestions\n rec_results[\"title\"]=\"Shuffled\"\n\n return rec_results,pids\nend",
"def get_trending_objects klass, options = {}\n options = options.reverse_merge(default_options)\n\n data = request_object.object_type.trending.send(klass).page(options[:page]).limit(options[:limit]).get\n return [] if data[\"trending\"].blank?\n return klass.classify.constantize.where(id: data[\"trending\"].map { |d| d[\"external_id\"] }) if options[:load]\n data[\"trending\"].map { |d| { type: d[\"object_type\"], id: d[\"external_id\"] } }\n end",
"def playing_with(num=10)\n return [] if not page_id or page_id==0\n \nsql = <<-SQL\n select terms.*\n from terms, matches matches1,matches matches2 \n where terms.id=matches2.term_id \n and matches2.page_id=matches1.page_id \n and matches1.date_for_sorting = matches2.date_for_sorting\n and matches1.id=#{id}\n and matches2.id<>#{id}\n and matches2.status='notified'\n group by terms.text\n limit #{num}\n SQL\n terms = Term.find_by_sql(sql) \n Term.uniques(terms)\n end",
"def getUsers( num_users = nil )\n\n #get all users\n users = (@min_user..@max_user).to_a\n \n #limit if necessary\n if num_users\n users = users.sample( num_users )\n end\n \n #return\n users\n \n end",
"def scaffold_get_objects(options)\n optionshash = {}\n data = self.all\n if options[:conditions]\n conditions = options[:conditions]\n if conditions && Array === conditions && conditions.length > 0\n if String === conditions[0]\n data = data.all(:conditions => conditions)\n else\n conditions.each do |cond|\n next if cond.nil?\n data = case cond\n when Hash, String then data.all(:conditions => [cond.gsub(\"NULL\",\"?\"),nil])\n when Array then \n if cond.length==1\n data.all(:conditions => [cond[0].gsub(\"NULL\",\"?\"),nil])\n else\n data.all(:conditions => cond)\n end\n when Proc then data.all(&cond)\n end\n end\n end\n end\n end\n slice = nil\n if options[:limit]\n startpos = options[:offset] || 0\n endpos = options[:limit]\n slice = [startpos,endpos]\n end\n # TODO includes break SQL generation\n # optionshash[:links] = options[:include] if options[:include]\n # optionshash[:links] = [optionshash[:links]] unless optionshash[:links].is_a?(Array)\n if options[:order] then\n optionshash[:order] = get_ordering_options(options[:order])\n end\n if slice then\n q = data.all(optionshash).slice(*slice)\n else\n q = data.all(optionshash)\n end\n #p repository.adapter.send(\"select_statement\",q.query)\n q.to_a\n end",
"def scan_for_distinct_bests\n team_distinct_best = RecordX4dDAO.new(@team, RecordType.find_by(code: 'TTB'))\n # Cycle between set genders, pools, events and distinct categories\n @gender_types.each do |gender_type|\n @pool_types.each do |pool_type|\n @event_types.each do |event_type|\n @distinct_categories.each do |category_type|\n record = get_team_best_individual_result(gender_type, pool_type, event_type, category_type.code)\n team_distinct_best.add_record(record) if record\n end\n end\n end\n end\n team_distinct_best\n end",
"def index\n @first = Item.includes(:user).order('created_at DESC').first(8).shuffle\n @categories = Category.includes(:items).where(ancestry: nil).shuffle.first(4)\n # @ladies = Item.where(category_id: 1..199).shuffle #.order('created_at DESC')\n # @mens = Item.where(category_id: 200..345).shuffle #.order('created_at DESC')\n # @home_appliances = Item.where(category_id: 898..983).shuffle #.order('created_at DESC')\n # @interiors = Item.where(category_id: 481..624).shuffle #.order('created_at DESC')\n end",
"def generate_results\n Result.destroy_all\n\n puts 'Generating results'\n\n (MULTIPLIER * 3).times do\n user_id = User.all.sample.id\n question_id = Question.all.sample.id\n result = ['true', 'false'].sample\n Result.create(user_id: user_id, question_id: question_id, result: result)\n end\nend",
"def collect_objects\n results = []\n begin\n object_ids.each do |model_name, ids|\n results << model_name.to_s.constantize.find(ids)\n end\n results.flatten\n # rescue ActiveRecord::RecordNotFound\n # generate_objects!\n # collect_objects\n end\n end",
"def similar_methods(limit, sample_size)\n # TO_DO implement as non-gsl dependent\n # logger.info \"Similar Methods running for: #{self[:name]}\"\n # startTime = Time.now\n\n # methodsList = DesignMethod.where(\"design_methods.id != ?\", self[:id])\n # .order(\"RANDOM()\")\n # .limit(limit)\n\n # comparator = Corpus.new\n # comparingMethod = Document_Attach.new(self)\n # comparator << comparingMethod\n\n # methodsList.each do |dm|\n # comparator << Document_Attach.new(dm)\n # end\n\n # result = comparator.similar_documents(comparingMethod).sort {|tuple1, tuple2| tuple2[1] <=> tuple1[1] }\n # result = result.map {|tuple| tuple[0].obj}\n # result = result [1..sample_size]\n\n # endTime = Time.now\n # elapsed_time = endTime - startTime\n # logger.info \"Similar Methods took #{elapsed_time}s to query #{limit} random sample from db.\"\n # return result\n return []\n end",
"def santa_automater(i)\n example_genders = [\"agender\", \"female\", \"bigender\", \"male\", \"female\", \"gender fluid\", \"N/A\"]\n example_ethnicities = [\"black\", \"Latino\", \"white\", \"Japanese-African\", \"prefer not to say\", \"Mystical Creature (unicorn)\", \"N/A\"]\n i.times do\n Santa.new(example_genders.sample, example_ethnicities.sample)\n end\nend",
"def top\n if [:class, :type].any? { |p| params[p].blank? }\n render :nothing => true, :status => :bad_request and return\n end\n\n unless %(user band mband).include?(params[:class]) &&\n %(friend admirer instrument cool).include?(params[:type])\n render :nothing => true, :staus => :bad_request and return\n end\n\n model = (params[:class] == 'mband') ? Mband : User\n method, partial = {\n 'friend' => ['find_friendliest', 'most_friends'],\n 'admirer' => ['find_most_admired', 'most_admirers'],\n 'instrument' => ['find_most_instruments', 'most_instruments'],\n 'cool' => ['find_coolest', 'coolest']\n }.fetch(params[:type])\n\n method += '_band_or_deejays' if params[:class] == 'band'\n render :nothing => true, :status => :bad_request and return unless model.respond_to? method\n\n partial = model.name.downcase.pluralize + '/' + partial\n object = model.send(method, :limit => 10).sort_by{rand}.first # ugh. heavy.\n\n render :nothing => true, :status => :ok and return unless object\n render :partial => partial, :object => object\n end",
"def create_phone_number\n numbers = []\n amount_of_numbers = rand(0..3)\n amount_of_numbers.times do\n kind_of_number = ['phone_number', 'cell_phone'].sample\n numbers << Faker::PhoneNumber.send(kind_of_number)\n end\n numbers\nend",
"def fetch_all\n klass_name = Starwars.const_get(name.split('::').last).const_get('RESOURCE_NAME')\n object = Starwars.const_get(\"#{klass_name.capitalize}\").new(url: \"#{Starwars::Base::BASE_URL}/#{klass_name}/\")\n Starwars::Request.new(resource: object, uri: object.url, params: {}).perform_request\n end",
"def recommendations_for(klass, options = {})\n defaults = { :count => 10 }\n options = defaults.merge options\n \n return [] if likes_for(klass).count + dislikes_for(klass).count == 0 || Recommendable.redis.zcard(predictions_set_for(klass)) == 0\n \n recommendations = []\n i = 0\n until recommendations.size == options[:count]\n prediction = Recommendable.redis.zrevrange(predictions_set_for(klass), i, i).first\n return recommendations unless prediction # User might not have enough recommendations to return\n \n object = klass.to_s.classify.constantize.find(prediction.split(\":\")[1])\n recommendations << object\n i += 1\n end\n \n return recommendations\n end",
"def index\n @items1 = Item.find(Item.pluck(:id).shuffle[0..2])\n @items2 = Item.find(Item.pluck(:id).shuffle[0..2])\n @items3 = Item.find(Item.pluck(:id).shuffle[0..2])\n @items4 = Item.find(Item.pluck(:id).shuffle[0..2])\n end",
"def take(num=1)\n if num > 1\n rows = connection.execute <<-SQL\n SELECT #{columns.join \",\"} FROM #{table}\n ORDER BY random()\n LIMIT #{num};\n SQL\n\n rows_to_array(rows)\n else\n take_one\n end\n end",
"def collect_objects\n results = []\n generate_objects! if object_ids.nil?\n begin\n object_ids.each do |model_name, ids|\n results << model_name.to_s.constantize.find(ids)\n end\n results.flatten\n rescue ActiveRecord::RecordNotFound\n generate_objects!\n collect_objects\n end\n end",
"def loop_it(users, trait)\n users.each do |user|\n users.each do |boozer|\n rand_num = rand(1..100)\n Rating.create(value: rand_num, rater_id: user.id, ratee_id: boozer.id, trait_id: trait.id)\n end\n end\nend",
"def make_microposts\n # Generate 50 posts for 6 users. Use Faker to generate some content for the Microposts.\n 50.times do\n User.all(:limit => 6).each do |user|\n user.microposts.create!(:content => Faker::Lorem.sentence(5))\n end\n end\nend",
"def random\n db = ActiveRecord::Base.connection.adapter_name\n if db == 'MySQL'\n find(:first, :order => 'rand()')\n elsif db == 'PostgreSQL'\n find(:first, :order => 'random()') # not efficient because pg fetches all records\n else\n raise \"Getting a random is not supported for #{db}\"\n end\n end",
"def select_customes\n customes = []\n 2.times { customes << CUSTOMES[rand(CUSTOMES.length)] }\n customes\nend",
"def factory(klass, how_many = reps)\n how_many.times.collect { klass.generate }\n end",
"def seed_users\n 10.times do\n \tu = User.create(name:Faker::Name.name, email:Faker::Internet.free_email, password:\"testing\")\t \n\t\t 5.times do\n\t\t \t\ts = Survey.create(name: Faker::Company.bs)\n\t\t \t\tu.created_surveys << s\n\t\t \t\t\t6.times do\n\t\t\t\t \t\tquestion_text = Faker::Lorem.sentence + \"?\"\n\t\t\t\t \t\tq = Question.create(text: question_text)\n\t\t\t\t \t\t\t\t# each q has 4 choices\n\t\t\t\t \t\t\t4.times do\n\t\t\t\t \t\t\t\tc = Choice.create(choice: Faker::Company.bs)\n\t\t\t\t \t\t\t\tq.choices << c\n\t\t\t\t \t\t\tend\n\t\t\t\t \t\ts.questions << q\n\t\t\t\t \tend\n\t\t \tend\n end\nend",
"def populate_var_pool(obj, type)\n case type\n when 'merchant'\n @merchants << obj\n when 'settlement_bank_account'\n @bank_accounts << obj\n when 'iso'\n @isos << obj\n when 'agent'\n @agents << obj\n when 'email'\n @emails << obj\n end \n end",
"def random_user\n\t\tUser.find([*1..40].sample)\n\tend",
"def pick\n @gommis_count = Gommi.count\n @gommis = Gommi.offset(rand(Gommi.count)).first\nend",
"def random_type; end",
"def index\n @tales = Tale.search(params[:search])\n @random_tale = @tales.sample\n end",
"def type\n %w[taxi PHV].sample\n end",
"def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = QUIZ.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end",
"def get_sample\n if @options.blank?\n model.order('RAND()').first\n else\n if @options.has_key?(\"id\")\n find @options[\"id\"]\n elsif @options.has_key?(\"conditions\")\n model.order('RAND()').where(@options[\"conditions\"]).first\n end\n end\n end",
"def random(tg,faulty,replacements,n)\n get_mappings(faulty,replacements).sample\nend",
"def each_query\n 1.upto(nqueries) do |n|\n yield(query(n))\n end\n end",
"def query\n # Make the request\n results = @client.posts(@url, :type => \"photo\", :limit => 5)\n i = 0\n\n # if there were no results, return 0 which will give an error in game.rb\n if results.empty?\n return 0\n elsif (results.size != 2) and (results[\"posts\"].size == 5) # results will have a size of two if there was an error with the tumblr API, also need 5 pictures\n @imageArray = Array.new(5)\n begin\n \t@imageArray[i] = results[\"posts\"][i][\"photos\"][0][\"alt_sizes\"][1][\"url\"].sub(/_[4-5]00/, '_250') # regular expression will select pictures 250px wide\n \ti += 1\n end while i < 5\n return @imageArray.size\n else\n return results.size\n end\n end",
"def db_queries_where__samples\n db_queries_operate__samples.map { |e| [e] }\n end",
"def recommendations(options = {})\n defaults = { :count => 10 }\n options = defaults.merge options\n return [] if likes.count + dislikes.count == 0\n\n unioned_predictions = \"#{self.class}:#{id}:predictions\"\n Recommendable.redis.zunionstore unioned_predictions, Recommendable.recommendable_classes.map {|klass| predictions_set_for(klass)}\n \n recommendations = Recommendable.redis.zrevrange(unioned_predictions, 0, options[:count]).map do |object|\n klass, id = object.split(\":\")\n klass.constantize.find(id)\n end\n \n Recommendable.redis.del(unioned_predictions) and return recommendations\n end",
"def run()\n if @type.nil?\n output_available_query_types\n else\n output_query_results\n end\n end",
"def get_sample_user\n user = case params[:type]\n when \"registered\"; User.registered.sample\n when \"pending\"; User.pending.sample\n when \"active\"; Participation.active.sample.user\n when \"unregistered\"; User.initialized.sample\n else User.order(\"RAND()\").first\n end\n render :json => user.attributes_for_app\n end",
"def random_from_class(class_name)\n klass_string = class_name.to_s.classify\n ids = Rails.cache.fetch(klass_string, expires_in: 1.minutes) do\n klass_string.constantize.ids\n end\n\n ids.sample\n end",
"def index\n @jokes = Joke.offset(rand(Joke.count)).first\n @random_joke = Joke.all.shuffle\n @random_quote = Quote.all.shuffle\n @quotes = Quote.offset(rand(Quote.count)).first\n end",
"def fetch_and_randomize_photos(pages)\n futures = (1..pages).map { |page| fetch_photos_future(page) }\n futures.map(&:value).flatten.compact.shuffle\n end",
"def all_rows_for(type, request)\n all_dataset_for(type, request).all\n end",
"def objects(options={})\n select_from_hash_array(TRANSACTION_METHODS, :type, {}, options).map {|t| new(t)}\n end",
"def objects(options={})\n select_from_hash_array(TRANSACTION_METHODS, :type, {}, options).map {|t| new(t)}\n end",
"def all_as_objects\n table_name = self.to_s.pluralize\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n \n results_as_objects << self.new(result_hash)\n \n end\n \n return results_as_objects\n \n end",
"def generate_literal_statistics(type = nil, count = 10000)\n unless type\n type = get_all_classes\n end\n\n type = [type] unless type.is_a?(Array)\n\n type.each_with_index { |entity_type, index|\n all_properties = {}\n puts \"#{__method__} - start process entity type: #{entity_type} [#{(index / type.size.to_f).round(2)}]\" if @console_output\n entity_type = entity_type.to_s.to_sym\n\n get_best_ranked_resources(entity_type, count).each { |resource, _|\n properties = @query.get_all_predicates_by_subject(resource.to_s, true).map { |solution_prop|\n solution_prop[:property].to_s\n } || []\n\n properties.uniq.each { |prop|\n next if Predicate.unimportant?(prop)\n all_properties[entity_type] ||= {}\n all_properties[entity_type][prop] ||= 0\n all_properties[entity_type][prop] += 1\n }\n\n }\n\n update_global_statistic(all_properties)\n }\n end",
"def get_all_trophies\n gold = get_type_trophies(\"gold\")\n silver = get_type_trophies(\"silver\")\n bronze = get_type_trophies(\"bronze\")\n tin = get_type_trophies(\"tin\")\n trophies = {'gold' => gold, 'silver' => silver, 'bronze' => bronze, 'tin' => tin }\n return trophies\n end",
"def query_all(args = {})\n query(args.merge(select: \"DISTINCT #{model.table_name}.*\"))\n end",
"def generate_questions\n Question.destroy_all\n\n puts 'Generating photo questions'\n MULTIPLIER.times do\n Question.make_photo_question\n end\n\n puts 'Generating type questions'\n MULTIPLIER.times do\n Question.make_type_question\n end\nend",
"def select\n @type = params[:type]\n @hosts = Host.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"host\"\n @apps = App.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"app\"\n @sites = Site.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"site\"\n @devices = Device.all :select => \"id, name\" , :conditions => { :tenant_id => current_user.tenant_id } if @type == \"device\"\n end",
"def ten_random\n @verbs = Verb.order(\"RANDOM()\").limit(10)\n render json: @verbs\n end",
"def all(query); end",
"def retrieve\n if [:area, :start_date, :end_date, :guests].all? { |k| criteria[k].blank? }\n retrieve_random\n else\n retrive_by_criteria\n end\n end",
"def generate_query_list\n print_step 'Generating query list'\n\n raise WordsEmpty if @words.blank?\n\n level = 1\n queries = []\n\n while queries.count < (@options[:number] * 10)\n queries += @words.combination(level).to_a.map { |each| each.join(' ') }\n queries = queries.uniq\n level += 1\n end\n\n @queries = queries\n\n self\n end",
"def collect_multiples\n (1..@limit).select{|num| num%3 == 0 || num%5 == 0}\n end",
"def test_users_searches\n do_users_all\n do_simple_query\n do_tag_query\n do_profile_query\n end",
"def all(*types); end",
"def injection_perform\n # Perform the query\n case params[:method]\n when \"order\"\n @all_types_objects = AllTypesObject.order(params[:value])\n when \"where\"\n @all_types_objects = AllTypesObject.where(\"string_col = '#{params[:value]}'\")\n else\n raise \"Unknown method '#{params[:method]}'\"\n end\n\n respond_with(@all_types_objects)\n end",
"def instances(return_type)\n return nil unless(active_rdf? && is_iri?)\n qry = ActiveRDF::Query.new(URI).distinct.select(:s)\n qry.where(:s, RDF.type, self)\n qry.execute\n end",
"def get_most_radlibs_created(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end"
] | [
"0.6367781",
"0.618718",
"0.60722196",
"0.60241425",
"0.5811108",
"0.58072484",
"0.5799148",
"0.5714554",
"0.55627275",
"0.549999",
"0.5492699",
"0.5452822",
"0.5447545",
"0.54319924",
"0.5385281",
"0.5382581",
"0.53622556",
"0.5306837",
"0.52943057",
"0.52907974",
"0.52776664",
"0.5258554",
"0.5238717",
"0.52368176",
"0.5236083",
"0.5231007",
"0.5226667",
"0.5174413",
"0.5173713",
"0.51603395",
"0.51524854",
"0.5144702",
"0.5140743",
"0.5133095",
"0.51239693",
"0.51221645",
"0.51199824",
"0.5119584",
"0.5115802",
"0.509216",
"0.50914246",
"0.50828445",
"0.50772464",
"0.5070659",
"0.50661796",
"0.506344",
"0.50565296",
"0.50350887",
"0.5032623",
"0.5011468",
"0.500035",
"0.4996783",
"0.49853578",
"0.49847507",
"0.49791217",
"0.49739343",
"0.4961547",
"0.4948971",
"0.4946385",
"0.49460086",
"0.49433625",
"0.4939211",
"0.493702",
"0.49338034",
"0.49308738",
"0.4929004",
"0.49288264",
"0.49241066",
"0.49042562",
"0.4897419",
"0.4897095",
"0.48964998",
"0.48960406",
"0.48861793",
"0.4885176",
"0.48744977",
"0.48710942",
"0.4869446",
"0.4868355",
"0.4865207",
"0.48647532",
"0.48625386",
"0.48522672",
"0.48522672",
"0.48521915",
"0.48511505",
"0.4850452",
"0.48458213",
"0.48391002",
"0.48338014",
"0.48331505",
"0.4832005",
"0.48295024",
"0.48270723",
"0.48247322",
"0.48211145",
"0.48206496",
"0.48202398",
"0.48185247",
"0.4816399"
] | 0.7528349 | 0 |
runs the following 2 methods and returns their value | def virus_effects
predicted_deaths
speed_of_spread
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calls; end",
"def calls; end",
"def two_method(x,y,z)\n\t\tx + y + z\nend",
"def method_and_value; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def call() end",
"def second_method\n\tputs \"This is my second method\"\n\t\"Hello\" #Ruby methods returns the last value automatically\n\t#if you want to return more than one vlaue, you need an explicit return statement\nend",
"def call1\n call2 # => 222\n call3 # => 333\nend",
"def two\n end",
"def method2() end",
"def operations; end",
"def operations; end",
"def call1\n call2 # => 222\n call3 # => 333\nend",
"def result_of_checking; end",
"def getTwo\n\n\t2\nend",
"def methods() end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def value\n @method.call\n end",
"def method1 a,b\n\tputs a\n\tputs b\nend",
"def result()\n end",
"def method_one; end",
"def operation; end",
"def first_method(num_1, num_2)\n puts num_1 + num_2\nend",
"def call1\n call2\n call3\nend",
"def invoke; end",
"def call(*) end",
"def call(*) end",
"def calculated; end",
"def test_Method_InstanceMethods_call\n\t\tm = 12.method(\"+\")\n\t\tassert_equal(15, m.call(3))\n\t\tassert_equal(32, m.call(20))\n\tend",
"def returns; end",
"def op; end",
"def calculator(num1, num2)\n\treturn num1 + num2, num1 - num2, num1 * num2, num1 / num2\nend",
"def chained_call(*methods)\n raise \"Not implemented yet.\"\n end",
"def step_two()\r\nend",
"def method1; end",
"def get_actual\n end",
"def meth_three\n\treturn 1, 2, 3\nend",
"def print_me_2\n \"I'm printing the return value!!!\"\nend",
"def evaluate\n\n end",
"def return_play(arg1, arg2)\n return arg1 + arg2\nend",
"def run\n\tprint_header\n\tfirst_num = get_num('first')\n\top = operator\n\tsecond_num = get_num('second')\n\tputs first_num.public_send(op, second_num)\nend",
"def addition1(num1, num2)\n\tprint \"addition1 gets call: \"\n\treturn num1 + num2\nend",
"def return_value; end",
"def result\n\n end",
"def method_one\n end",
"def method_one\n end",
"def call\n\n\tend",
"def call\n\n\tend",
"def execute(x1, x2)\r\n # Somatório (NET)\r\n @net = net(x1, x2)\r\n\r\n # Função de Ativação\r\n return 1 if (@net >= 0) \r\n\r\n return 0;\r\n end",
"def _perform(args); end",
"def runs; end",
"def result?; end",
"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 add_two_numbers(num1, num2)\n puts \"OK, I'm solving your math problem!\"\n # if return is not in method, the method\n # will return the last expression. here puts ...\n return num1 + num2\n\n # could be dropped for\n # num1 + num2 only, as that will be the last\n # operation the method runs.\nend",
"def total(a,b)\r\n return (a+b)\r\nend",
"def results=(_arg0); end",
"def results=(_arg0); end",
"def invoking\n end",
"def run_two_procs(a,b)\n a.call\n b.call\nend",
"def stest_method_1(test); end",
"def duas1(action)\n action.call\n action.call\nend",
"def run_two_procs(a, b)\n a.call # .call is used to run the proc (block of code)\n b.call\nend",
"def my_method(a,b)\n return a*b\n a + b\nend",
"def method\n \"result\"\nend",
"def method\n \"result\"\nend",
"def perform(*args); end",
"def run(results)\n if(use_multiple?(results))\n results = run_multiple(results)\n else\n results = run_single(results)\n end\n return results\n end",
"def result\n end",
"def perform()\n 2 + 2\n end",
"def addition(a, b) \n return a + b\nend",
"def run() end",
"def sum a, b\n return a + b\nend",
"def calls_by_method_name; end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def step_result; end",
"def sum_two(x, y)\n x + y\nend",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end"
] | [
"0.67209035",
"0.67209035",
"0.65410423",
"0.64683217",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.62614053",
"0.62250125",
"0.61975706",
"0.61823815",
"0.6171286",
"0.61435926",
"0.61435926",
"0.61424434",
"0.61103845",
"0.60934925",
"0.60735893",
"0.60346013",
"0.60346013",
"0.60346013",
"0.60346013",
"0.60346013",
"0.60346013",
"0.60346013",
"0.60346013",
"0.6011023",
"0.5979932",
"0.59492916",
"0.59174633",
"0.59154326",
"0.590137",
"0.5882875",
"0.58664274",
"0.5863613",
"0.5863613",
"0.5863208",
"0.5827139",
"0.58179736",
"0.5781304",
"0.5780361",
"0.5772693",
"0.5769269",
"0.57625586",
"0.57606083",
"0.5743333",
"0.572864",
"0.5714688",
"0.5708916",
"0.5702248",
"0.570062",
"0.56996727",
"0.56943035",
"0.5693845",
"0.5693845",
"0.5678709",
"0.5678709",
"0.5668234",
"0.5645652",
"0.56341696",
"0.5631216",
"0.5628286",
"0.56280607",
"0.561343",
"0.5602395",
"0.5602395",
"0.5599667",
"0.55910724",
"0.55881834",
"0.55872077",
"0.5584834",
"0.55813706",
"0.55774945",
"0.55774945",
"0.5577333",
"0.5550783",
"0.5539206",
"0.5533773",
"0.5526224",
"0.5523188",
"0.5520592",
"0.5515092",
"0.55124074",
"0.55092466",
"0.5501667",
"0.54985255",
"0.54985255",
"0.54985255",
"0.54985255",
"0.54985255",
"0.54985255",
"0.54985255",
"0.54985255",
"0.54985255",
"0.54985255",
"0.54985255"
] | 0.0 | -1 |
GET /bags or /bags.json | def index
@bags = Bag.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get('tags')\n end",
"def index\n tags = Tag.all\n render json: tags, status: :ok\n end",
"def index\n @tags = Tag.order('name')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def index\n @hastags = Hastag.all\n end",
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def index\n unless params[:tag].blank?\n @recipes = current_user.recipes.tagged_with(params[:tag]).order(\"created_at desc\").page(params[:page]).per(10)\n else\n @recipes = current_user.recipes.order(\"created_at desc\").page(params[:page]).per(10) \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end",
"def index\n case\n when params[:tag]\n @books = Book.tagged_with(params[:tag], :on => :tags, :any => true)\n when params[:author]\n @books = Book.tagged_with(params[:author], :on => :authors, :any => true)\n when params[:translator]\n @books = Book.tagged_with(params[:translator], :on => :translators, :any => true)\n else\n @books = Book.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def tags(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Tags\", params: params)\n end",
"def get_all(path)\n path = Pathname.new(path)\n @bags.map { |bag| bag.get(path, do_raise: false) }.compact\n end",
"def index\n @tags = Tag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tags }\n end\n end",
"def tags\n _get(\"/query/image/tags\") { |json| json }\n end",
"def index\n @tagged_items = TaggedItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tagged_items }\n end\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end",
"def index\n @tags = Tag.order(\"tagtext ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def tag(id, params = {})\n get \"tags/#{id}\", {query: params}\n end",
"def index\n return render_json_for_api(Tag.map) if params[:map] == \"true\" && api_call?\n @tags_with_counts = Tag.\n joins(:vulnerabilities).\n group(\"tags.id\").\n select(\"tags.name\",\n \"tags.shortname\",\n \"tags.color\",\n \"tags.icon\",\n \"tags.id\",\n \"tags.family\",\n 'count(*) AS num_vulns').\n having('count(*) > 1')\n\n @tags = Tag.order(name: :asc).\n select(\"\n *,\n substring(tags.description from 0 for 240) || '...' as short_desc\n \")\n @articleTags = ArticleTag.joins(:article).distinct(:article_id).select(:title, :blurb, :art)\n if @tags == nil\n flash[:error] = \"Error: Tag not found\"\n redirect_to controller: 'tags', :action => 'index'\n else\n render_json_for_api(@tags)\n end\n end",
"def index # This is what we'll need if we want our url/tags page to exist\n @tags = Tag.all\n end",
"def index\n\t\t# Check for optional limit parameter.\n\t\tif params[:limit].nil?\n\t\t\tparams[:limit] = params[:default][:limit]\n\t\tend\n\n\t\t# GET /api/v1/tags\n\t\t@tags = Tag.paginate(:page => params[:page], :per_page => params[:limit])\n\n\t\t# GET api/v1/resources/:resource_id/tags\n\t\t# Return all tags used by a specific resource.\n\t\tif params[:resource_id]\n\t\t\t@tags = Resource.find_by(id: params[:resource_id]).tags.paginate(:page => params[:page])\n\t\tend\n\tend",
"def index\n @tags = Tag.used.clone #This is a Hash with keys(tags) ordered from most used to least\n respond_with @taglist\n end",
"def remote_node_bags\n bags = []\n bag_query = { admin_node: remote_node.namespace }\n local_client.bags(bag_query) do |response|\n bags << response.body if response.success?\n end\n bags.flatten\n end",
"def index\n if params[:tag]\n @global_goals = GlobalGoal.tagged_with(params[:tag])\n else\n @global_goals = GlobalGoal.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @global_goals }\n end\n end",
"def index # p \"TagsController.index: params=#{params.inspect}\"\n # p \"params['example_id']=#{params['example_id']}, params[:example_id]=#{params[:example_id]}\"\n if (params[:example_id])\n @tags = Tag.where(\"example_id=?\", params[:example_id])\n else\n @tags = Tag.all\n end\n\n p \"@tags=#{@tags.inspect}\"\n\n respond_to do |format|\n format.html {}\n format.json {render :json => @tags }\n end\n end",
"def tag\n @favors = Favor.tagged_with(params[:tag], :order => @order)\n @tag = params[:tag]\n\n respond_to do |format|\n format.html # tag.html.erb\n format.json { render json: @favors }\n end\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Node.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Node.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def index\n @tags = Tag.all\n render :index, status: 200\n end",
"def index\n\n@tags = Tag.all\n\nrespond_to do |format|\n format.html #index.html.erb\n format.json { render json: @tags }\nend\nend",
"def index\n if tag_name = params[:tagname]\n @items = Item.find_tagged_with(tag_name, current_user).sort\n @page_header = \"Listing items with tag: \" + tag_name\n else\n @items = current_user.items.order(\"number\")\n @page_header = \"Listing all items\"\n end \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end \n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def tags\n @tags = User.tag_counts_on(:tags, :conditions => \"name LIKE '\" + (params[:query] || \"\") + \"%'\").limit(50).order('count desc')\n respond_to do |format|\n format.html # tags.html.erb\n format.json { render json: @tags }\n format.xml { render xml: @tags }\n end\n end",
"def index\n @posttags = Posttag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posttags }\n end\n end",
"def index\n @asset = Asset.find(params[:asset_id])\n @tags = @asset.tags\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tags }\n end\n end",
"def index\n @tags = Tag.where(:parent_id => nil).order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def index\n tags_list = []\n @user.tags.find_each do |tag|\n tags_list << tag_as_hash(tag, false)\n end\n\n render :status => 200,\n :json => {\n status: 200,\n tags: tags_list\n }\n end",
"def get\n\t\tformat = getFormat(params)\n\n\t\tquery_text =\"\nselect * from tags \nwhere tag_normalized like '#{cleanTag(params[:tag])}%'\"\n\n\t\tresults = Tag.find_by_sql(query_text)\n\n\t\ttags = results.inject([]) {|res, tag|\n\t\t\tres << \n\t\t\t\t{\n\t\t\t\t\t:tag_value => tag.tag_value, \n\t\t\t\t\t:tag_normalized => tag.tag_normalized, \n\t\t\t\t\t:id => tag.id}\n\t\t\t\t}\n\n\t\trender format.to_sym => tags\n\tend",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\nend",
"def index\n item_id = params[:item_id].to_i\n all_tags = (item_id > 0) ? Tag.joins(:tagged_items).where(tagged_items: {item_id: item_id}) : Tag.all\n return json_response([]) unless newest_tag = all_tags.sort_by(&:updated_at).last\n Rails.logger.info \"newest_tag is #{newest_tag.inspect}\"\n render_if_stale(all_tags, last_modified: newest_tag.updated_at.utc, etag: newest_tag) do |tag_presenters|\n tag_presenters.map(&:hash)\n end\n # explicitly setting the Cache-Control response header to public and max-age, to make the response cachable by proxy caches\n expires_in caching_time, public: true\n end",
"def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def taglist\n @tags = Note.tag_counts.map {|tag| tag.name}\n\n respond_to do |format|\n format.json { render json: @tags }\n end\n end",
"def index\n @bagtypes = Bagtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bagtypes }\n end\n end",
"def tag\n # Whats the last tag we are asking for? (the rest don't matter I don't think..)\n requested_tag = params[:tag].split(\"/\").last\n tag = Taxonomy.find_by_seo_url requested_tag\n\n if tag.present?\n @tag = tag\n @posts = get_posts tag.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end",
"def index\n\n # TODO: Refactor this!!!\n sort_function = (params[:sort] == 'name' ? :name : :count)\n\n @tags = Factoid.tag_counts.sort_by {|tag| tag.send(sort_function)}.reverse\n\n if params[:direction] == 'desc'\n @tags.reverse!\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def tag\n tag = params[:tag]\n @articles = Article.by_tags.startkey([tag]).endkey([tag, {}]).descending.limit(10)\n Rails.logger.info \"articles length: #{@articles.length}\"\n\n respond_to do |format|\n format.html { render :action => :index }\n format.json { render json: @articles }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts, :include => :tags }\n end\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end",
"def index\n @tags = Tag.all#.search(params[:query])\n end",
"def index\n if params[:tag]\n @snippets = Snippet.where(:tag => params[:tag]).all\n else\n @snippets = Snippet.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snippets }\n end\n end",
"def index\n authorize Tag\n @tags = Tag.order(name: :asc).page params[:page]\n end",
"def test_get_tags\n post '/repos', {:name => GIT_REPO}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"rune@runemadsen.com\", :message => \"My First Commit\"}\n sha = JSON.parse(last_response.body)[\"commit_sha\"]\n post \"/repos/#{GIT_REPO}.git/tags\", {:tag => \"version1\", :message => \"hello\", :sha => sha, :type => \"commit\", :user => \"Rune Madsen\", :email => \"rune@runemadsen.com\"}\n get \"/repos/#{GIT_REPO}.git/tags\"\n end",
"def index\n @kbs = Kb.search(params[:q]).page(params[:page]).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kbs }\n end\n end",
"def all\n response= handle_errors{ self.class.get('/get')}\n response[\"tags\"][\"tag\"].collect do |tag| \n t= Rubycious::Tag.new(tag)\n end\n end",
"def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baskets }\n end\n end",
"def tags(client)\n client.get(\"#{PATH}/tags\")\n end",
"def index\n @recommend_recommend_ptags = Recommend::RecommendPtag.paginate(:page => params[:page])\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), recommend_recommend_ptags_path\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recommend_recommend_ptags }\n end\n end",
"def deli_tags(uri, id)\n begin\n md5 = Digest::MD5.hexdigest(uri)\n target = \"http://badges.del.icio.us/feeds/json/url/data?hash=#{md5}\"\n json = open(target).read\n deli = JSON.load(json)[0]\n tags = \"\"\n if deli['top_tags'].class == Hash then\n all_tags = deli['top_tags'].sort_by {|k,v| v}.reverse.map{|i|i[0]}\n if all_tags.size > 8 then\n all_tags = all_tags.first(8) << '...'\n end\n tags = '(' << all_tags.join(', ') << ')'\n end\n if deli['total_posts'].to_i > 0 then\n response = \"#{id}: (deli) #{deli['total_posts']} links, tagged #{tags}\"\n $q_meta.enq response\n end\n rescue\n puts \"problem fetching deli for #{uri}\"\n end\nend",
"def index\n tags = Array.wrap params.permit(:tags)[:tags]\n @clips = @allclips = Clip.where(session_id: session.id)\n @clips = @allclips.tagged_with(tags, any: true) if tags.any?\n @available_tags = Clip.available_tags_for(session.id)\n end",
"def index\n @tags ||= Tag.paging(params[:page])\n respond_with(@tags)\n end",
"def get_all_tags\n print \"Fetching tags...\\r\" if @options[:verbose]\n\n check_github_response { github_fetch_tags }\n end",
"def show\n get_status\n @tag = Tag.find(params[:id])\n taggings = Tagging.where(:tag_id => params[:id])\n\n post_ids = []\n taggings.each do |tagging|\n post_ids << tagging.post_id\n end\n post_ids.compact!\n\n @posts = Post.where(:id => post_ids).order('created_at DESC').page(params[:page]).per(5)\n @labels = [\"<span class=\\\"label\\\">\",\"<span class=\\\"label label-success\\\">\",\"<span class=\\\"label label-warning\\\">\",\"<span class=\\\"label label-important\\\">\",\"<span class=\\\"label label-info\\\">\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def index\n @bands = Band.all \n\t@tags = Store.find_by_sql(\"select DISTINCT tag from stores\")\n\t@stores = Store.find(:all, :order => \"created_at desc\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stores }\n end\n end",
"def index\n @tag_identities = Identity.all\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), tag_identities_path\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tag_identities }\n end\n end",
"def index\n if params[:tag]\n @posts = Post.tagged_with(params[:tag]).includes(:tags)\n elsif params[:category]\n @posts = Post.includes(:tags).where(category: params[:category])\n else\n #@posts = Post.all\n @posts = Post.includes(:tags)\n end\n respond_with @posts, methods: [:tag_list, :tag_ary]\n end",
"def top_tags()\n get(:standard, {:method => \"tag.getTopTags\"})\n end",
"def index\n @comics = Comic.order(\"#{sort_column} #{sort_direction}\").paginate(:page => params[:page], :per_page => params[:page_size]||10)\n \n if params[:tag]\n @comics = @comics.tagged_with(params[:tag])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comics }\n end\n end",
"def index\n @comics = Comic.order(\"#{sort_column} #{sort_direction}\").paginate(:page => params[:page], :per_page => params[:page_size]||10)\n \n if params[:tag]\n @comics = @comics.tagged_with(params[:tag])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comics }\n end\n end",
"def index\n @climb_tags = ClimbTag.all\n end",
"def index\n @search = params[:tag]\n tags = Tag.select('aa_id').where(\"tag LIKE ?\", \"%#{@search}%\").order('updated_at desc')\n @asciiArts = Aa.page(params[:page]).per(50).where(id: tags).order(\"updated_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Video.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Video.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def tags\n return head :unauthorized unless current_user\n @tags = current_user.owned_tags.where(\"name like ?\", \"%#{params[:tag]}%\").\n page(params[:page]).per(20)\n if @tags.empty?\n @tags = [current_user.owned_tags.new(name: I18n.t('record.tag_list.no_tags'))]\n end\n respond_with(@tags)\n end",
"def index\n @taggables = Taggable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @taggables }\n end\n end",
"def index\n @tags, @tags_attached = TagService.list(current_user.id)\n end",
"def get(path)\n path = Pathname.new(path)\n @bags.lazy.map { |bag| bag.get(path, do_raise: false) }.find { |page| page }\n end",
"def index\n if params[:floor_id]\n data = {Image: [{id: params[:floor_id], Tags: Tag.find_by(floor: params[:floor_id])}]}\n else\n data = Tag.all\n end\n render json: data\n end",
"def index\n @taggings = Tagging.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tagging }\n end\n end",
"def show\n # @bookmark_tag = BookmarkTag.find(params[:id])\n\n @tag = Tag.find_by_name(params[:id]) \n @bookmark_tag = @tag.bookmarks\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookmark_tag }\n end\n end",
"def bundles\n get('tags/bundles/all', 'bundle')\n get('tags/bundles/all', 'bundle').inject({}) do |ret, e|\n ret[e['name']] = e['tags'].split(/\\s/)\n ret\n end\n end",
"def index\n conditions = { :client_id => @client.id }\n if params[\"tags\"]\n conditions.merge!({:tags => params[\"tags\"]})\n end\n\n @collections = Collection.where(conditions).order('updated_at DESC')\n @collections.reject! { |item| ! item.read?(@user, @client) }\n\n entries = Array.new\n if @collections\n @collections.each do |item|\n entries << item.info_hash(@user, @client)\n end\n end\n render_json :entry => entries and return\n end",
"def index\n @all = Tag.all\n render json: @all.collect{|tag| tag.strip}\n end",
"def show\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagg }\n end\n end",
"def index\n @tags = @tags.uniq\n respond_with(@tags)\n end",
"def show\r\n render json: Tag.find(params[:id])\r\n end",
"def index\n @taggings = Tagging.all\n end",
"def show\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tags_of_novel }\n end\n end",
"def index\n #@tags = Tag.all\n end",
"def get_tags_on_word(word, *args)\n http_method = :get\n path = '/word/{word}/tags'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n @tagname = params[:id].to_s\n @tags = Tag.name_is(@tagname).descend_by_updated_at.reject {|r| !r.tagable.read_allowed?(current_user) }.paginate(\n :page => params[:page], :per_page => POSTINGS_PER_PAGE)\n @tagables = @tags.map { |t| \n t.tagable\n }.sort { |b,a| a.updated_at <=> b.updated_at }\n end",
"def show\n @tagging = Tagging.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagging }\n end\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def index\r\n @features = Feature.order(:name).page(params[:page]).per(5) #配置kaminari到参数,每页几个数据\r\n @tags = Tag.all\r\n respond_to do |format|\r\n format.html # No_index.html.erb\r\n format.json { render json: @features }\r\n end\r\n\r\n end",
"def tags\n query = params[:q]\n if query[-1,1] == \" \"\n query = query.gsub(\" \", \"\")\n Tag.find_or_create_by_name(query)\n end\n\n #Do the search in memory for better performance\n\n @tags = ActsAsTaggableOn::Tag.all\n @tags = @tags.select { |v| v.name =~ /#{query}/i }\n respond_to do |format|\n format.json{ render :json => @tags.map(&:attributes) }\n end\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def member_bags(member_id, options = {page_size: 25}, &block)\n paginate_each \"/member/#{member_id}/bags/\", options, options[:page_size], &block\n end",
"def databags(api_url)\n @databags = Berkshelf::Source.new(api_url)\n end",
"def index\n @tags = Tag.find(:all, :order => \"name ASC\")\n # Sort into buckets by last reference in blogs\n @tags24 = []\n @tags72 = []\n @tagsweek = []\n @tagsrest = []\n\n @tags.each do |tag|\n stamp = 2.weeks.ago\n tag.blogs.each do |blog|\n # Find latest blog stamp\n created = blog.created_at.localtime\n stamp = created if (stamp < created)\n end\n if stamp > 24.hours.ago\n @tags24 << tag\n elsif stamp > 72.hours.ago\n @tags72 << tag\n elsif stamp > 1.week.ago\n @tagsweek << tag\n else\n @tagsrest << tag\n end\n end\n if @tags24.length > 0\n js_response = @tags24.inject(\"Recent tags: \") { |s, t| s + '<a href=\"' + tag_url(t) + '\">'+ t.name + '</a> ' } + \n '<p> </p>'\n else\n js_response = ''\n end\n\n respond_with(@tags) do |format|\n format.js { render :text => js_response, :layout => false }\n format.mobile { render :template => \"tags/index.html.erb\" }\n format.xml { render :xml => @tags }\n end\n end",
"def show\n @api_tag = Api::Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_tag }\n end\n end",
"def index\n @tags = Tag.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tags }\n end\n end",
"def index\n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb @hub.name, hub_path(@hub)\n add_breadcrumb 'Groups', hub_groups_path(@hub)\n append_title \"#{@hub.name} Groups\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @groups }\n end\n end",
"def my_bets\n @bets = Bet.where('owner = ? AND status != ? AND status != ?', params[:id], \"won\", \"lost\").to_a\n @bets.sort! {|x,y| x.id <=> y.id }\n render 'my-bets.json.jbuilder'\n end"
] | [
"0.63053185",
"0.6177401",
"0.61300296",
"0.610373",
"0.6095084",
"0.60931844",
"0.59739834",
"0.596978",
"0.59689313",
"0.59642494",
"0.5946389",
"0.59460473",
"0.5932101",
"0.59275085",
"0.58966583",
"0.58965844",
"0.5892065",
"0.58845395",
"0.5884357",
"0.5875273",
"0.585647",
"0.58524024",
"0.58459496",
"0.5820014",
"0.58175534",
"0.5793377",
"0.57844687",
"0.5756098",
"0.5738238",
"0.57319343",
"0.57317024",
"0.57315177",
"0.56796795",
"0.56767035",
"0.56765056",
"0.56712085",
"0.56621885",
"0.56440204",
"0.56350964",
"0.56337065",
"0.5621076",
"0.5619931",
"0.56143564",
"0.5613447",
"0.5601062",
"0.56000984",
"0.55878514",
"0.5586286",
"0.55774546",
"0.5575249",
"0.5570915",
"0.5565194",
"0.55634266",
"0.55527484",
"0.55526364",
"0.55464506",
"0.553991",
"0.5538298",
"0.55142576",
"0.551283",
"0.55107623",
"0.5497077",
"0.5492946",
"0.54923564",
"0.5481095",
"0.5481095",
"0.5478874",
"0.5478047",
"0.5475035",
"0.54614735",
"0.5460516",
"0.54596853",
"0.54570574",
"0.5453682",
"0.5452305",
"0.5446514",
"0.54462564",
"0.5439419",
"0.5437302",
"0.5436936",
"0.5435176",
"0.5431498",
"0.54305804",
"0.5427547",
"0.5421804",
"0.5414205",
"0.54133147",
"0.54095006",
"0.54064256",
"0.54018724",
"0.53977275",
"0.53956014",
"0.5389108",
"0.5382716",
"0.5378987",
"0.5378885",
"0.5378787",
"0.53774023",
"0.53754354",
"0.5374205"
] | 0.6613092 | 0 |
GET /bags/1 or /bags/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bags = Bag.all\n end",
"def index\n tags = Tag.all\n render json: tags, status: :ok\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def index\n @tags = Tag.order('name')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def tag(id, params = {})\n get \"tags/#{id}\", {query: params}\n end",
"def tags\n get('tags')\n end",
"def get_all(path)\n path = Pathname.new(path)\n @bags.map { |bag| bag.get(path, do_raise: false) }.compact\n end",
"def get(path)\n path = Pathname.new(path)\n @bags.lazy.map { |bag| bag.get(path, do_raise: false) }.find { |page| page }\n end",
"def index # p \"TagsController.index: params=#{params.inspect}\"\n # p \"params['example_id']=#{params['example_id']}, params[:example_id]=#{params[:example_id]}\"\n if (params[:example_id])\n @tags = Tag.where(\"example_id=?\", params[:example_id])\n else\n @tags = Tag.all\n end\n\n p \"@tags=#{@tags.inspect}\"\n\n respond_to do |format|\n format.html {}\n format.json {render :json => @tags }\n end\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def index\n @tags = Tag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tags }\n end\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end",
"def show\r\n render json: Tag.find(params[:id])\r\n end",
"def index\n @bagtypes = Bagtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bagtypes }\n end\n end",
"def show\n @tagging = Tagging.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagging }\n end\n end",
"def tags\n _get(\"/query/image/tags\") { |json| json }\n end",
"def index\n unless params[:tag].blank?\n @recipes = current_user.recipes.tagged_with(params[:tag]).order(\"created_at desc\").page(params[:page]).per(10)\n else\n @recipes = current_user.recipes.order(\"created_at desc\").page(params[:page]).per(10) \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end",
"def index\n @tagged_items = TaggedItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tagged_items }\n end\n end",
"def index\n item_id = params[:item_id].to_i\n all_tags = (item_id > 0) ? Tag.joins(:tagged_items).where(tagged_items: {item_id: item_id}) : Tag.all\n return json_response([]) unless newest_tag = all_tags.sort_by(&:updated_at).last\n Rails.logger.info \"newest_tag is #{newest_tag.inspect}\"\n render_if_stale(all_tags, last_modified: newest_tag.updated_at.utc, etag: newest_tag) do |tag_presenters|\n tag_presenters.map(&:hash)\n end\n # explicitly setting the Cache-Control response header to public and max-age, to make the response cachable by proxy caches\n expires_in caching_time, public: true\n end",
"def show\n @api_tag = Api::Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_tag }\n end\n end",
"def index\n return render_json_for_api(Tag.map) if params[:map] == \"true\" && api_call?\n @tags_with_counts = Tag.\n joins(:vulnerabilities).\n group(\"tags.id\").\n select(\"tags.name\",\n \"tags.shortname\",\n \"tags.color\",\n \"tags.icon\",\n \"tags.id\",\n \"tags.family\",\n 'count(*) AS num_vulns').\n having('count(*) > 1')\n\n @tags = Tag.order(name: :asc).\n select(\"\n *,\n substring(tags.description from 0 for 240) || '...' as short_desc\n \")\n @articleTags = ArticleTag.joins(:article).distinct(:article_id).select(:title, :blurb, :art)\n if @tags == nil\n flash[:error] = \"Error: Tag not found\"\n redirect_to controller: 'tags', :action => 'index'\n else\n render_json_for_api(@tags)\n end\n end",
"def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baskets }\n end\n end",
"def show\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagg }\n end\n end",
"def tag\n @favors = Favor.tagged_with(params[:tag], :order => @order)\n @tag = params[:tag]\n\n respond_to do |format|\n format.html # tag.html.erb\n format.json { render json: @favors }\n end\n end",
"def show\n @bagtype = Bagtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bagtype }\n end\n end",
"def index\n @hastags = Hastag.all\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\nend",
"def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def tags(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Tags\", params: params)\n end",
"def index\n @asset = Asset.find(params[:asset_id])\n @tags = @asset.tags\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tags }\n end\n end",
"def index\n @tags = Tag.all\n render :index, status: 200\n end",
"def index\n case\n when params[:tag]\n @books = Book.tagged_with(params[:tag], :on => :tags, :any => true)\n when params[:author]\n @books = Book.tagged_with(params[:author], :on => :authors, :any => true)\n when params[:translator]\n @books = Book.tagged_with(params[:translator], :on => :translators, :any => true)\n else\n @books = Book.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def show\n @tag = Tag.find(params[:id])\n render json: JSON.parse(@tag.to_json)\n end",
"def show\n # @bookmark_tag = BookmarkTag.find(params[:id])\n\n @tag = Tag.find_by_name(params[:id]) \n @bookmark_tag = @tag.bookmarks\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookmark_tag }\n end\n end",
"def show\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tags_of_novel }\n end\n end",
"def index\n\n@tags = Tag.all\n\nrespond_to do |format|\n format.html #index.html.erb\n format.json { render json: @tags }\nend\nend",
"def show\n get_status\n @tag = Tag.find(params[:id])\n taggings = Tagging.where(:tag_id => params[:id])\n\n post_ids = []\n taggings.each do |tagging|\n post_ids << tagging.post_id\n end\n post_ids.compact!\n\n @posts = Post.where(:id => post_ids).order('created_at DESC').page(params[:page]).per(5)\n @labels = [\"<span class=\\\"label\\\">\",\"<span class=\\\"label label-success\\\">\",\"<span class=\\\"label label-warning\\\">\",\"<span class=\\\"label label-important\\\">\",\"<span class=\\\"label label-info\\\">\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def index\n @tags = Tag.order(\"tagtext ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def index\n\t\t# Check for optional limit parameter.\n\t\tif params[:limit].nil?\n\t\t\tparams[:limit] = params[:default][:limit]\n\t\tend\n\n\t\t# GET /api/v1/tags\n\t\t@tags = Tag.paginate(:page => params[:page], :per_page => params[:limit])\n\n\t\t# GET api/v1/resources/:resource_id/tags\n\t\t# Return all tags used by a specific resource.\n\t\tif params[:resource_id]\n\t\t\t@tags = Resource.find_by(id: params[:resource_id]).tags.paginate(:page => params[:page])\n\t\tend\n\tend",
"def index\n if params[:tag]\n @global_goals = GlobalGoal.tagged_with(params[:tag])\n else\n @global_goals = GlobalGoal.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @global_goals }\n end\n end",
"def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def show\n tag = Tag.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n render :status => 200,\n :json => tag_as_hash(tag).merge({\n status: 200,\n # TODO csrf\n })\n end",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def get\n\t\tformat = getFormat(params)\n\n\t\tquery_text =\"\nselect * from tags \nwhere tag_normalized like '#{cleanTag(params[:tag])}%'\"\n\n\t\tresults = Tag.find_by_sql(query_text)\n\n\t\ttags = results.inject([]) {|res, tag|\n\t\t\tres << \n\t\t\t\t{\n\t\t\t\t\t:tag_value => tag.tag_value, \n\t\t\t\t\t:tag_normalized => tag.tag_normalized, \n\t\t\t\t\t:id => tag.id}\n\t\t\t\t}\n\n\t\trender format.to_sym => tags\n\tend",
"def show\n @label = Label.find_by_id(params[:id])\n if @label.nil?\n @label = Label.find_by_name(params[:id])\n end\n\n @repos = Repo.tagged_with(@label.name, on: :labels).order(\"watchers DESC\")\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @label }\n end\n end",
"def test_get_tags\n post '/repos', {:name => GIT_REPO}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"rune@runemadsen.com\", :message => \"My First Commit\"}\n sha = JSON.parse(last_response.body)[\"commit_sha\"]\n post \"/repos/#{GIT_REPO}.git/tags\", {:tag => \"version1\", :message => \"hello\", :sha => sha, :type => \"commit\", :user => \"Rune Madsen\", :email => \"rune@runemadsen.com\"}\n get \"/repos/#{GIT_REPO}.git/tags\"\n end",
"def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tag }\n end\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def index\n if params[:floor_id]\n data = {Image: [{id: params[:floor_id], Tags: Tag.find_by(floor: params[:floor_id])}]}\n else\n data = Tag.all\n end\n render json: data\n end",
"def index\n @tags = Tag.where(:parent_id => nil).order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def show\n tagging = Tagging.find(params[:id])\n tag = tagging.tag\n render json: {status: 'SUCCESS', message:'Loaded tagging', data:tagging, tag:tag},status: :ok\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @posttags = Posttag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posttags }\n end\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def get_bucket_tagging(bucket_name)\n unless bucket_name\n raise ArgumentError.new('bucket_name is required')\n end\n request({\n :expects => 200,\n :headers => {},\n :bucket_name => bucket_name,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::Parsers::AWS::Storage::GetBucketTagging.new,\n :query => {'tagging' => nil}\n })\n end",
"def tag\n # Whats the last tag we are asking for? (the rest don't matter I don't think..)\n requested_tag = params[:tag].split(\"/\").last\n tag = Taxonomy.find_by_seo_url requested_tag\n\n if tag.present?\n @tag = tag\n @posts = get_posts tag.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end",
"def bundles\n get('tags/bundles/all', 'bundle')\n get('tags/bundles/all', 'bundle').inject({}) do |ret, e|\n ret[e['name']] = e['tags'].split(/\\s/)\n ret\n end\n end",
"def show\n @tag = Tag.find(params[:id])\n if !@tag.nil?\n render json: @tag, status: :ok\n else\n render json: @tag.errors, status: :not_found\n end\n end",
"def index # This is what we'll need if we want our url/tags page to exist\n @tags = Tag.all\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Node.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Node.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def index\n @tags = Tag.used.clone #This is a Hash with keys(tags) ordered from most used to least\n respond_with @taglist\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def json_index_bundles\n\n @bundles = Bundle.where(\"active = 'y'\").order(:id)\n respond_to do |format|\n format.json { render json: @bundles.as_json()\n\n }\n end\n\n end",
"def index\n\n #@bundles = Bundle.paginate(page: params[:page], :per_page => 10)\n #@bundles = Bundle.paginate(page: params[:page]).order('id')\n\n @bundles = Bundle.order('id').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bundles }\n end\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def deli_tags(uri, id)\n begin\n md5 = Digest::MD5.hexdigest(uri)\n target = \"http://badges.del.icio.us/feeds/json/url/data?hash=#{md5}\"\n json = open(target).read\n deli = JSON.load(json)[0]\n tags = \"\"\n if deli['top_tags'].class == Hash then\n all_tags = deli['top_tags'].sort_by {|k,v| v}.reverse.map{|i|i[0]}\n if all_tags.size > 8 then\n all_tags = all_tags.first(8) << '...'\n end\n tags = '(' << all_tags.join(', ') << ')'\n end\n if deli['total_posts'].to_i > 0 then\n response = \"#{id}: (deli) #{deli['total_posts']} links, tagged #{tags}\"\n $q_meta.enq response\n end\n rescue\n puts \"problem fetching deli for #{uri}\"\n end\nend",
"def birds\n @birds = Api::V1::Bird.all\n @serializer = ActiveModel::ArraySerializer\n\n #if regularity is not defined get all birds\n if params[:regularity].blank?\n render json: {\n status: 200,\n message: \"OK\",\n totalCount: @birds.count,\n birds: @serializer.new(@birds, each_serializer: Api::V1::BirdSerializer) \n }\n \n \n #if regularity is defined get birds based on regularity\n else\n @regularity = params[:regularity].split(\",\")\n @birds = @birds.where(regularity: @regularity)\n render json: \n { \n status: 200,\n message: \"OK\",\n totalCount: @birds.count,\n birds: @serializer.new(@birds, each_serializer: Api::V1::BirdSerializer) \n }\n end\n end",
"def index\n if params[:tag]\n @snippets = Snippet.where(:tag => params[:tag]).all\n else\n @snippets = Snippet.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snippets }\n end\n end",
"def show\n @tagged_item = TaggedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagged_item }\n end\n end",
"def my_bets\n @bets = Bet.where('owner = ? AND status != ? AND status != ?', params[:id], \"won\", \"lost\").to_a\n @bets.sort! {|x,y| x.id <=> y.id }\n render 'my-bets.json.jbuilder'\n end",
"def index\n if tag_name = params[:tagname]\n @items = Item.find_tagged_with(tag_name, current_user).sort\n @page_header = \"Listing items with tag: \" + tag_name\n else\n @items = current_user.items.order(\"number\")\n @page_header = \"Listing all items\"\n end \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end \n end",
"def index\n @tag_identities = Identity.all\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), tag_identities_path\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tag_identities }\n end\n end",
"def index_bundle_selection\n @bundles = Bundle.order(:id).all\n\n respond_to do |format|\n format.html # index_bundle_selection.html.erb\n format.json { render json: @bundles }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => Item.joins(:tag).where('tag_id = ?', params[:tag])}\n end\n\n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def index\n @kbs = Kb.search(params[:q]).page(params[:page]).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kbs }\n end\n end",
"def show\n @sugar_bag = SugarBag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sugar_bag }\n end\n end",
"def show\n @tag = Tag.where(:name => params[:id]).first\n if @tag.blank? \n render_404\n return\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def taglist\n @tags = Note.tag_counts.map {|tag| tag.name}\n\n respond_to do |format|\n format.json { render json: @tags }\n end\n end",
"def index\n pet_type = PetType.find(params[:pet_type_id])\n @pet_breeds = pet_type.pet_breeds.select { | match | match.published }\n\n respond_to do | format |\n format.html #index.html.erb\n format.json { render json: @pet_breeds }\n end\n end",
"def tags\n @tags = User.tag_counts_on(:tags, :conditions => \"name LIKE '\" + (params[:query] || \"\") + \"%'\").limit(50).order('count desc')\n respond_to do |format|\n format.html # tags.html.erb\n format.json { render json: @tags }\n format.xml { render xml: @tags }\n end\n end",
"def show\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrack }\n end\n end",
"def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end",
"def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baggage }\n end\n end",
"def index\n @bands = Band.all \n\t@tags = Store.find_by_sql(\"select DISTINCT tag from stores\")\n\t@stores = Store.find(:all, :order => \"created_at desc\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stores }\n end\n end",
"def remote_node_bags\n bags = []\n bag_query = { admin_node: remote_node.namespace }\n local_client.bags(bag_query) do |response|\n bags << response.body if response.success?\n end\n bags.flatten\n end",
"def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end",
"def index\n @taggings = Tagging.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tagging }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def show\n @title = t('view.tags.show_title')\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def index\n @tags ||= Tag.paging(params[:page])\n respond_with(@tags)\n end",
"def index\n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb @hub.name, hub_path(@hub)\n add_breadcrumb 'Groups', hub_groups_path(@hub)\n append_title \"#{@hub.name} Groups\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @groups }\n end\n end",
"def tags(client)\n client.get(\"#{PATH}/tags\")\n end"
] | [
"0.63323045",
"0.5891597",
"0.58796716",
"0.5815884",
"0.57915324",
"0.5790761",
"0.5789947",
"0.5762983",
"0.574759",
"0.5707848",
"0.5707356",
"0.5702348",
"0.5657731",
"0.565458",
"0.56509966",
"0.56311566",
"0.5617011",
"0.5615453",
"0.5602909",
"0.5602243",
"0.55983514",
"0.55741733",
"0.5573557",
"0.5549265",
"0.55464244",
"0.5541827",
"0.55402476",
"0.55275846",
"0.55157137",
"0.551306",
"0.55083513",
"0.54994404",
"0.54969275",
"0.5491046",
"0.5488665",
"0.5485955",
"0.54749405",
"0.54704136",
"0.5469053",
"0.54664606",
"0.5466405",
"0.5458954",
"0.5458954",
"0.5458954",
"0.5458954",
"0.5449135",
"0.54204404",
"0.5418838",
"0.5418684",
"0.541801",
"0.5413578",
"0.5408929",
"0.5401458",
"0.53987646",
"0.5395288",
"0.5384553",
"0.5377739",
"0.53772914",
"0.53690135",
"0.53667784",
"0.53527075",
"0.53506184",
"0.53471303",
"0.53469384",
"0.5344739",
"0.5344474",
"0.53433186",
"0.5335302",
"0.5333801",
"0.53288335",
"0.5324525",
"0.5323156",
"0.5306031",
"0.52970034",
"0.5295548",
"0.5293407",
"0.5292483",
"0.5287162",
"0.5284356",
"0.5282933",
"0.52815384",
"0.5279034",
"0.52769244",
"0.52732277",
"0.5268814",
"0.52649444",
"0.5264867",
"0.5263542",
"0.52622944",
"0.5262289",
"0.52564687",
"0.5255361",
"0.52538663",
"0.52470756",
"0.5244104",
"0.5239671",
"0.52360326",
"0.5222386",
"0.5206596",
"0.52057344",
"0.5201147"
] | 0.0 | -1 |
POST /bags or /bags.json | def create
#if user is not logged in, store all the attributes under its own session cookies.
if current_user.nil?
p = Product.find(session[:tmp_cart_pid])
pv_id = p.product_variants.find_by(size: params[:size], color: params[:color]).id
session[:tmp_cart_vid] = pv_id
session[:tmp_quantity] = bag_params[:quantity]
redirect_to signin_path
else
bag_params1 = bag_params
pr = Product.find(bag_params1[:product_id])
bag_params1[:product_variant_id] = pr.product_variants.find_by(size: params[:size], color: params[:color]).id
@bag = Bag.new(bag_params1)
respond_to do |format|
if @bag.save
#Add popularity when successfully added to cart
product = Product.find(bag_params1[:product_id])
product.popularity += 1
product.save
format.html { redirect_to pr, notice: "Item added to cart!" }
format.json { render :show, status: :created, location: pr }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @bag.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def create\n params[:tag_names].split(',').each do |name|\n @tag = Tag.find_or_create_by_name name.strip\n @tagging = Tagging.new(params[:tagging])\n @tagging.tag = @tag\n @tags_saved = @tagging.save\n end\n \n respond_to do |format|\n if @tags_saved\n format.html { redirect_to @tagging.taggable, notice: 'Tagged.' }\n format.json { render json: @tagging, status: :created, location: @tagging }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end",
"def create\n create_tags = params[:create_tags]\n\t@good = Good.new(params[:good])\n\t\n\tif @good.save\n\t\tif create_tags == '1'\n\t\t\tvalues = params[:good][:name].split(':')\n\t\t\tname = values[values.size-1]\n\t\t\tlasttag = values.size-2\n\t\t\tfor i in 0..lasttag\n\t\t\t\ttag_name = values[i]\n\t\t\t\ttag = Tag.find_or_create_by_name(tag_name)\n\t\t\t\ttag.save\n\t\t\t\tgt = GoodsTag.new(:tag=>tag,:good=>@good)\n\t\t\t\tgt.save\n\t\t\tend\n\t\tend\n\t respond_to do |format|\n\t\t\tformat.html { redirect_to :action=>\"index\" }\n\t\t\tformat.json { render :json => @good, :status => :created, :location => @good }\n\t\tend\n else\n\t\trespond_to do |format|\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.json { render :json => @good.errors, :status => :unprocessable_entity }\n\t\tend\n end\n end",
"def create\n @blog = Blog.create(blog_params)\n params[:tags][:tag_id].each do |p|\n @tagging = Tagging.create(tag_id: p.to_i, blog_id: @blog.id)\n end\n respond_to do |format|\n\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n\n end\nend",
"def test_get_tags\n post '/repos', {:name => GIT_REPO}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"rune@runemadsen.com\", :message => \"My First Commit\"}\n sha = JSON.parse(last_response.body)[\"commit_sha\"]\n post \"/repos/#{GIT_REPO}.git/tags\", {:tag => \"version1\", :message => \"hello\", :sha => sha, :type => \"commit\", :user => \"Rune Madsen\", :email => \"rune@runemadsen.com\"}\n get \"/repos/#{GIT_REPO}.git/tags\"\n end",
"def create\n @post = Post.new(params[:post])\n\n if params['tag_field'] != nil\n tags_array = params['tag_field'].split(\",\")\n tags_array.each do |tag|\n @post.tags << Tag.find_or_create_by_etiqueta_and_post_id(tag.strip, @post.id)\n end\n end\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n # special case for multiple tags\n tags = params[\"_json\"]\n if (tags.class.name == 'Array')\n Tag.delete_all\n puts \"this is an array\"\n success = true\n @tag = nil \n tags.each do |tag_hash|\n puts \"params are going from #{tag_hash} to #{tag_in_array_params(tag_hash)}\"\n @tag = Tag.new(tag_in_array_params(tag_hash))\n success &= @tag.save \n break unless success\n end\n respond_to do |format|\n if success\n format.json { render action: 'show', status: :created, location: @tag }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n return \n else \n puts \"class is #{tags.class}\"\n end\n \n @tag = Tag.new(tag_params)\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tag }\n else\n format.html { render action: 'new' }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tag\n @favors = Favor.tagged_with(params[:tag], :order => @order)\n @tag = params[:tag]\n\n respond_to do |format|\n format.html # tag.html.erb\n format.json { render json: @favors }\n end\n end",
"def add_tag\n url = Url.find_by(id: params[:id])\n tag = Tag.find_by(name: params[:tag])\n if tag\n ## TODO: handle tag with url in backend\n # if not url.tags.where(:tag_id => tag.id).any?\n # url.tags << tag\n # end\n url.tags << tag\n else\n tag = Tag.new(name: params[:tag])\n url.tags << tag\n end\n render json: {code: 200, tags: url.tags}\n end",
"def post_params\n params.require(:post).permit(:body, {tag_ids: []}, {tag_list: []})\n end",
"def create\n @tag = Tag.new(tag_params)\n if @tag.save\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end",
"def create\n #...\n params[:cat].permit(...:tag_ids: []) #allow tag_ids and expect it to be an Array\n end",
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end",
"def create\n if params[:buzz_tag].present?\n tag = Tag.where(:id => params[:buzz_tag]).first\n @buzz_tag = BuzzTag.add_buzz_tag(@buzz, tag.id)\n end\n end",
"def add_new_tag\n puts \"******* add_new_tag *******\"\n puts \" ** params: #{params.inspect}\"\n\n @post_id = params[:post_id]\n\n # == create brand new tag; add to Tags\n if params[:new_tag] != \"new\"\n\n # == check if tag already exists\n check_tag = Tag.where(tag_name: params[:new_tag])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n # == create new tag if not existing and assign to post\n if check_tag.length == 0\n @tag = Tag.create(tag_name: params[:new_tag], tag_rank: 0)\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: @tag[:id])\n puts \" ** NEW TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n\n # == assign existing tag if selected from select box (not \"ng\")\n if params[:tag_id] != \"ng\"\n\n # == check if tag already assigned to post\n check_tag = PostTag.where(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n if check_tag.length == 0\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** EXISTING TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n @post_tags = PostTag.where(post_id: params[:post_id])\n @post_tag_ids = @post_tags.map{|pt| pt.tag_id }\n @post_no_tags = Tag.where(\"id NOT IN (?)\", @post_tag_ids)\n @tags = Tag.where(id: @post_tag_ids)\n render json: { tags: @tags, post_no_tags: @post_no_tags, post_id: @post_id}\n end",
"def create\r\n @tag = Tag.new(tag_params)\r\n\r\n if @tag.save\r\n render json: @tag\r\n else\r\n render json: { error: \"Tag creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def tag_set(id, tags)\n wf_event_id?(id)\n tags = Array(tags)\n tags.each { |t| wf_string?(t) }\n api.post([id, 'tag'].uri_concat, tags, 'application/json')\n end",
"def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end",
"def tag_params\n params.require(:tag).permit(:name, tag_task_id: [])\n end",
"def create\n @shout = Shout.new(params[:shout])\n\n# params[:tags].split(\" \").each do |tag_word|\n# \t @shout.tags.build(:tag_word => tag_word)\n# \tend\n\t\n respond_to do |format|\n if @shout.save\n format.html { redirect_to @shout, notice: 'Shout was successfully created.' }\n format.json { render json: @shout, status: :created, location: @shout }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_params\n # params.permit(:content, :color, taggings_attributes: [:id, :tag])\n params.permit(:content, :color, tag_ids: [], asset_ids: [])\n end",
"def tag_params\n params.fetch(:tag, {}).permit(:name, tag_ids: [])\n end",
"def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end",
"def post_v1_tags_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagApi.post_v1_tags ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling TagApi.post_v1_tags\"\n end\n # resource path\n local_var_path = '/v1/tags'\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(body)\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SetTagsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagApi#post_v1_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n\n new_tags = params[:tags].split(',')\n\n new_tags.each do |stag|\n @event.tags.create(tag: stag)\n end\n\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag dodany do bazy tagów' }\n format.json { render json: @tag, status: :created, location: @tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new\n @post.title = params[:title]\n @post.body = params[:body]\n @post.user = current_user if current_user\n @tags = params[:tags].split(',') unless params[:tags].blank?\n\n respond_to do |format|\n\n Post.transaction do\n if @post.save\n create_tags(@post, @tags)\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end",
"def create\n @post = Post.create(post_params)\n @post.tag_list=(params[:tag_list])\n respond_with @post\n end",
"def create\n @api_tag = Api::Tag.new(params[:api_tag])\n\n respond_to do |format|\n if @api_tag.save\n format.html { redirect_to @api_tag, notice: 'Tag was successfully created.' }\n format.json { render json: @api_tag, status: :created, location: @api_tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @api_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_tags_to_resource(d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddTagsToResource'\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\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? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :proxy_id\n\t\t\targs[:query]['proxyId'] = optional[:proxy_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :tag_1_key\n\t\t\targs[:query]['Tag.1.key'] = optional[:tag_1_key]\n\t\tend\n\t\tif optional.key? :tag_1_value\n\t\t\targs[:query]['Tag.1.value'] = optional[:tag_1_value]\n\t\tend\n\t\tif optional.key? :tag_2_key\n\t\t\targs[:query]['Tag.2.key'] = optional[:tag_2_key]\n\t\tend\n\t\tif optional.key? :tag_2_value\n\t\t\targs[:query]['Tag.2.value'] = optional[:tag_2_value]\n\t\tend\n\t\tif optional.key? :tag_3_key\n\t\t\targs[:query]['Tag.3.key'] = optional[:tag_3_key]\n\t\tend\n\t\tif optional.key? :tag_3_value\n\t\t\targs[:query]['Tag.3.value'] = optional[:tag_3_value]\n\t\tend\n\t\tif optional.key? :tag_4_key\n\t\t\targs[:query]['Tag.4.key'] = optional[:tag_4_key]\n\t\tend\n\t\tif optional.key? :tag_4_value\n\t\t\targs[:query]['Tag.4.value'] = optional[:tag_4_value]\n\t\tend\n\t\tif optional.key? :tag_5_key\n\t\t\targs[:query]['Tag.5.key'] = optional[:tag_5_key]\n\t\tend\n\t\tif optional.key? :tag_5_value\n\t\t\targs[:query]['Tag.5.value'] = optional[:tag_5_value]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n if params[\"theme\"].eql? \"Existing Tags\"\n @temp = Tagg.find(params[:tagg][:id])\n params[:tagg][:name] = @temp.name\n end\n\n @tagg = Tagg.new(params[:tagg])\n @tagg.post_id = params[\"post_id\"]\n @post = Post.find(params[\"post_id\"])\n\n\n respond_to do |format|\n @arr = Tagg.where( \"post_id = ? AND name = ?\", params[\"post_id\"], params[:tagg][:name] )\n if @arr.empty?\n if @tagg.save\n format.html { redirect_to @post, notice: 'Tag was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagg.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @post, notice: 'Tag already exists.' }\n format.json { render json: @post, status: :created, location: @post }\n end\n end\n end",
"def create\n params[:tag][:name].downcase!\n params[:tag][:name] = params[:tag][:name].gsub(/[^a-z0-9]+/,'-')\n\n \n @find = Tag.find(:first, :conditions => \"name = '#{params[:tag][:name]}'\")\n if @find.nil?\n @tag = Tag.new(params[:tag])\n @tag_link = @tag.tag_links.build(params[:tag_link])\n @tag.save\n render :json => {:msg => \"Created and added #{@tag.name} to list of tags\",:tag=>@tag.name}\n else\n @link_find = TagLink.find(:first, :conditions => {:tag_id => @find.id, :taggable_type => params[:tag_link][:taggable_type],:taggable_id => params[:tag_link][:taggable_id]})\n if @link_find.nil?\n @tag_link = @find.tag_links.build(params[:tag_link])\n @find.save\n render :json => {:msg=>\"Added #{@find.name} to list of tags\",:tag=>@find.name}\n else\n render :json => {:msg=>\"This object is already tagged with #{@find.name}\",:tag=>@find.name}\n end\n end\n end",
"def post_v1_tags(body, opts = {})\n data, _status_code, _headers = post_v1_tags_with_http_info(body, opts)\n data\n end",
"def post_tag_params\n params.require(:post_tag).permit(:post_id, :tag)\n end",
"def create\n #@tag = params[:post][:tags_attributes]\n\n # shanghai-zhou(105703655) 10:31:32 写的另一种方法\n # tags = ['he', 'll', 'o']\n # @tags = tags.map do |t|\n # if Tag.find_by_name(t).blank?\n # Tag.create(:name=>t)\n # end\n # Tag.find_by_name t\n # end\n # @post.tags = @tags\n # @post.save\n\n @tagarr = params[:post][:tags_attributes][\"0\"][:name].split(\" \")\n @tag = {}\n @tagarr.each_with_index do |tag,i|\n #@tagarr.each do |tag|\n @tag[i] = {:name => tag}\n end\n\n @postreset = params[:post]\n @postreset[\"tags_attributes\"] = @tag\n @post = Post.new(@postreset)\n \n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def auto_tag!\n tags = self.body.scan(/(?<=#)\\S+/).map{ |ts| J::Tag.find_or_create_by(name: ts) }\n self.tags = tags\n end",
"def create\n @taggable = current_user.taggables.new(params[:taggable], :user_id => current_user.id)\n \n respond_to do |format|\n if @taggable.save\n # if the DB commit was successful then try to tag faces.\n logger.debug(@taggable.photo.path)\n faceArray = findFaces(@taggable.photo.path(:editable))\n \n faceArray.each do |rect|\n @tag = @taggable.tags.new(:upperLeftX => rect[0],\n :upperLeftY => rect[1],\n :lowerRightX => rect[2],\n :lowerRightY => rect[3],\n :person => \"Random Person\")\n @tag.save\n end\n\n format.html { redirect_to \"/tagging/#{@taggable.id}\", notice: 'Taggable was successfully created.' }\n format.json { render json: @taggable, status: :created, location: @taggable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taggable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bags = Bag.all\n end",
"def create\n @bookmark = Bookmark.new(bookmark_params)\n\n tags = bookmark_params[:tags].split(\",\")\n tags.each do |tag|\n if Tag.where(:tagname => tag.strip.gsub(' ', '-').downcase).size == 0\n @tag = Tag.new\n @tag.tagname = tag.strip.gsub(' ','-').downcase\n @bookmark.tags << @tag\n else\n @bookmark.tags << Tag.where(:tagname => tag.strip.gsub(' ', '-').downcase).first\n end\n end\n\n respond_to do |format|\n if @bookmark.save\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bookmark }\n else\n format.html { render action: 'new' }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posttag = Posttag.new(params[:posttag])\n\n respond_to do |format|\n if @posttag.save\n format.html { redirect_to @posttag, :notice => 'Posttag was successfully created.' }\n format.json { render :json => @posttag, :status => :created, :location => @posttag }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @posttag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Node.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Node.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def write_build_data_bags(path)\n ## write data bags to build (must be fed as arg)\n new_resource.data_bags.each_pair do |bag, items|\n r = Chef::Resource::Directory.new(::File.join(path, bag), run_context)\n r.recursive(true)\n r.run_action(:create)\n\n items.each do |item|\n r = Chef::Resource::File.new(::File.join(path, bag, \"#{item}.json\"), run_context)\n r.sensitive(true)\n r.content(Chef::DataBagItem.load(bag, item).to_json)\n r.run_action(:create)\n end\n end\n end",
"def create\n tag = Tag.new(params.permit(:name))\n \n if tag.save\n render json: tag, status: :created\n else\n render json: tag.errors, status: :unprocessable_entity\n end\n end",
"def submit_databag(run_status, env)\n # TODO: too expensive to load them. all we want to do is to check if databag exists\n #begin\n # Chef::DataBag.load(\"jenkins\")\n #rescue Net::HTTPServerException => e\n # if e.response.code==\"404\"\n # bag = Chef::DataBag.new\n # bag.name \"jenkins\"\n # bag.save\n # end\n #end\n\n i = Chef::DataBagItem.new\n i.data_bag(\"jenkins\") # set the name\n\n id = run_status.node.name + '_' + run_status.end_time.strftime(\"%Y%m%d-%H%M%S\")\n\n i.raw_data = env\n i.save id\n end",
"def post_params\n if params[\"post\"][\"tags\"].class == Array\n params[\"post\"][\"tags\"] = params[\"post\"][\"tags\"].join(',')\n end\n params.require(:post).permit(:sub_id, :title, :body, :tags, :created_at, :updated_at)\n end",
"def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end",
"def tag_params\n params.require(:tag).permit(:post_id, :sharer,:user_id)\n end",
"def add_tag(tag)\n @api.post(\"#{@api.path}/List/#{@id}/Tag\", body: tag)\n end",
"def create\n name_normalized = ActsAsTaggableOn::Tag.normalize(params['name'])\n\n if name_normalized.nil? || name_normalized.empty?\n render :nothing => true, :status => 403\n else\n @tag = ActsAsTaggableOn::Tag.find_or_create_by_name(name_normalized)\n @tag_following = current_user.tag_followings.new(:tag_id => @tag.id)\n\n if @tag_following.save\n render :json => @tag.to_json, :status => 201\n else\n render :nothing => true, :status => 403\n end\n end\n end",
"def create_new_tags\n if params[:listing][:tag_ids].present?\n params[:listing][:tag_ids].map! do |tag_id|\n if Tag.exists? tag_id\n tag_id\n else\n new_tag = Tag.create(name: tag_id.downcase)\n new_tag.id\n end\n end\n end\n end",
"def create\n\n respond_to do |format|\n @asset_tag = AssetTag.new(asset_tag_params)\n puts @asset_tag.inspect\n\n if @asset_tag.save(validate: false)\n format.html { redirect_to @asset_tag, notice: 'Asset tag was successfully created.' }\n format.json { render :show, status: :created, location: @asset_tag }\n AssetTag.reindex\n else\n format.html { render :new }\n format.json { render json: @asset_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @report = Report.new(report_params)\n tags = params['tags'].split(',')\n\n respond_to do |format|\n if @report.save\n tags.each do |tag|\n @tag = Tag.new(name: tag, report_id: @report.id)\n @tag.save\n end\n format.html { redirect_to posts_path(code: Code.first.code) }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postEntityTag( entity_id, tag, language)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tag'] = tag\n params['language'] = language\n return doCurl(\"post\",\"/entity/tag\",params)\n end",
"def add_tag\n tag = Tag.where(:name => params[:query])\n @answer = Answer.find(params[:answer_id])\n\n if tag.count > 0\n @answer.tags << tag.first\n @answer.rejected_tags.delete(tag.first.id.to_s)\n @answer.save!\n\n @answer.schedule_process_propagate\n\n @available_tags = @answer.available_tags\n render :info_answer\n else\n @tag = Tag.new\n @tag.name = params[:query]\n render :new_tag\n end\n end",
"def add_tag_to_word(word, *args)\n http_method = :post\n path = '/word/{word}/tag'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def create\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to tags_url, :notice => 'Tag was successfully created.' }\n format.json { render :json => @tag, :status => :created, :location => @tag }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tag = Tag.new(params[:tag])\n\n if @tag.save\n render json: JSON.parse(@tag.to_json)\n else\n render json: JSON.parse(@tag.errors.to_json)\n end\n end",
"def create\n #Refactor maybe is this the best way to associate a post with the current user?\n @post = current_user.posts.build(post_params.slice(:content, :user_id, :asset))\n #@post.tag_list = @post.extract_tags\n @post.build_tags(params[:tag_list])\n\n if @post.save\n render json: @post, status: :created\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def item_params\n params.require(:data).require(:attributes).permit(:link, tags: [])\n end",
"def create\n @tag = Tag.new(tag_params)\n render json: @tag.errors unless @tag.save\n end",
"def create\n @tag = Tag.new(tag_params)\n lastId = Tag.maximum('id')\n @tag.id = lastId === nil ? 1 : lastId + 1\n respond_to do |format|\n if @tag.save\n format.json { render :show, status: :created, location: @tag }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_recipe_request(version, auth_headers, data = {})\n post \"/api/recipes\", params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }.merge(auth_headers)\nend",
"def test_tagged_request_for_no_tags\n login_as(:quentin)\n post :tagged, {:tags=>nil}\n assert_response :success\n assert_nil assigns(:tag)\n assert_equal [], assigns(:selected_tags)\n assert_equal Hash[], assigns(:remove_tag_links)\n assert_equal Hash['Good'=>'Good', 'Bad'=>'Bad', 'Ugly'=>'Ugly', 'Question'=>'Question', 'Crazy sugar'=>'Crazy sugar', 'Pretty'=>'Pretty'], assigns(:add_tag_links)\n assert_equal 4, assigns(:samples).size\n end",
"def create_tags\n\tend",
"def tag_params\n params.permit(:body, :post_id)\n .merge(post_id: params[:post_id])\n end",
"def toggle_tags\n puts \"\\n\\n******* toggle_tags *******\"\n\n # == get post_id and tag_id from combined :ids string (e.g. 1_4)\n ids = params[:ids].split(\"_\")\n @post_id = ids[0]\n tag_id = ids[1]\n\n # == check post for selected tag\n @post_tag = PostTag.where(post_id: @post_id, tag_id: tag_id).first\n\n # == remove previously assigned tag\n if @post_tag\n puts \"******* HAS TAG (delete tag) *******\"\n @post_tag.destroy\n @post_tags = PostTag.where(post_id: @post_id)\n @post_tag_ids = @post_tags.map{|pt| pt.tag_id }\n puts \"@post_tag_ids: \", @post_tag_ids\n if @post_tag_ids.length == 0\n @post_no_tags = Tag.all\n else\n @post_no_tags = Tag.where(\"id NOT IN (?)\", @post_tag_ids)\n end\n puts \"@post_no_tags: \", @post_no_tags\n @tags = Tag.where(id: @post_tag_ids)\n render json: { tags: @tags, post_no_tags: @post_no_tags, post_id: @post_id}\n end\n end",
"def climb_tag_params\n params.fetch(:climb_tag, {})\n end",
"def create\n @quotetags = Quotetags.new(params[:quotetags])\n\n respond_to do |format|\n if @quotetags.save\n flash[:notice] = 'Quotetags was successfully created.'\n format.html { redirect_to(@quotetags) }\n format.xml { render :xml => @quotetags, :status => :created, :location => @quotetags }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quotetags.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n params[:product][:tag_ids] = Array.new\n params[:tags].split(\",\").each do |tag|\n tag_detail = Tag.where(\"title = ?\",tag).first\n if tag_detail.present?\n params[:product][:tag_ids] << tag_detail.id\n else\n new_tag = Tag.new(:title=>tag)\n new_tag.save\n params[:product][:tag_ids] << new_tag.id\n end\n end\n \n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tag = Tag.new(\n name: params[:name],\n )\n if @tag.save\n render json: {message: 'Tag created successfully'}, status: :created\n else\n render json: {errors: user.errors.full_messages}, status: :bad_request\n end\n end",
"def create\n @climb_tag = ClimbTag.new(climb_tag_params)\n\n respond_to do |format|\n if @climb_tag.save\n format.html { redirect_to @climb_tag, notice: 'Climb tag was successfully created.' }\n format.json { render :show, status: :created, location: @climb_tag }\n else\n format.html { render :new }\n format.json { render json: @climb_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gtag_params\n params.require(:gtag).permit(:tag_uid, :banned, :customer_id, :redeemed, :ticket_type_id)\n end",
"def build_tags \n # First flush all tags so a duplicate record doesn't occur\n Tag.delete(@question.tags)\n\n tobuild = params[:tags]\n tobuild.each do |category|\n Tag.create(question_id: @question.id, category: category)\n end unless tobuild.nil?\n end",
"def create\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, :notice => 'Tag was successfully created.' }\n format.json { render :json => @tag, :status => :created, :location => @tag }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n params[:tag][:tag_set_id] ||= params[:tag_set_id]\n @tag = Tag.create(params[:tag])\n respond_to do |format|\n format.js\n end\n end",
"def update\n if @building.update(update_params)\n if t = params.permit(:tags)[:tags]\n tag_names = t.split(\", \")\n tags = [Tag.create_with(name: \"building\").find_or_create_by(name: \"building\")]\n for n in tag_names\n tags += [Tag.create_with(name: n).find_or_create_by(name: n)]\n end\n @building.tags = tags\n end\n @notice = \"Updated successfully.\"\n render :file => \"#{Rails.root}/public/success\", :layout => false\n else\n @notice = \"Update failed.\"\n render :file => \"#{Rails.root}/public/error\", :layout => false\n end\n end",
"def create\n @post = Post.new(post_params.except(:tags))\n tags = post_params[:tags].split(',')\n @post.user = current_user\n\n respond_to do |format|\n if @post.save\n @post.add_tags_with_check(tags)\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.tag_list = params[:tags]\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def submit(verb, data)\n start do |connection|\n request = http verb\n request.body = data\n connection.request request\n end\n end",
"def tag_params\r\n params.require(:tag).permit(:tag, :task_id)\r\n end",
"def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end",
"def post_params\n params.require(:book).permit(:author_name, :name, :content, :image, :tag_list, :tag, { tag_ids: [] }, :tag_ids)\n end",
"def post data\n commit data\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def tag_params\n params.require(:tag).permit(:tag)\n end",
"def create\n #tags are sent to the controller as a string array\n #we'll create our own way to find the Tag objects\n tags = equipment_params[:tags]\n\n tags_object_collection = []\n\n tags.each do |tag|\n if tag == ''\n next\n end\n\n tag_obj = Tag.find(tag)\n\n if tag_obj != nil\n tags_object_collection.push(tag_obj)\n end\n end\n\n new_equipment_params = equipment_params.except(:tags)\n\n @equipment = Equipment.new(new_equipment_params)\n @equipment.tags = tags_object_collection\n\n respond_to do |format|\n if @equipment.save\n format.html { redirect_to equipment_index_path, notice: 'Equipment was successfully created.' }\n format.json { render json: @equipment, status: :created, location: @equipment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tag = Tag.new(tag_params)\n\n if @tag.save\n render :nothing => true, :status => :ok\n else\n render :nothing => true, :status => :unprocessable_entity\n end\n end",
"def create\n begin\n if params[:paper_id]\n # Create a tag for the paper\n paper = Paper.find(params[:paper_id])\n # Authenticate\n club_id = paper.club_id\n else\n club_id = params[:club_id]\n end\n # Authenticate\n club = can_access_club?(club_id)\n # Tag name is lowercase\n name = params[:name].downcase\n # Find or create the tag for the club\n new_tag = Tag.find_or_create_by_club_id_and_name( club_id, \n params[:name] )\n if params[:paper_id]\n new_collection = Collection.find_or_create_by_paper_id_and_tag_id(\n paper.id, new_tag.id)\n end\n render :json => new_tag \n rescue ActiveRecord::RecordNotFound\n error \"Can't access the club or the paper\"\n end\n end",
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def tag_params\n params.require(:tag).permit(:tagname)\n end",
"def submitTag(tagID, tagScanDate)\n\n\ttsdISO = tagScanDate.iso8601\n\t$count += 1\n\tputs \"-----> Submitted tag tagID: \" + tagID + \" tagScanDate: \" + tagScanDate.strftime(\"%I:%M:%S%p %m/%d/%y\")\n\n\tif($postDestination != nil)\n\t\trequest = Net::HTTP::Post.new($uri.request_uri)\n\t\trequest['x-access-token'] = $token\n\n\t\t#request.to_hash['x-access-token'] # => Array\n\t\t#puts \"Headers: #{request.to_hash.inspect}\"\n\n\t\trequest.set_form_data({\"tagID\" => tagID, \"tagScanDate\" => tsdISO, \"tagPatient\" => $patientName})\n\t\n\t\tresponse = $http.request(request)\n\t\tmy_hash = JSON.parse(response.body)\n\t\treturn my_hash\n\telse return \"Posted to console\"\n\tend\n\n\t#pp my_hash\n\t\nend",
"def add_tagging_with_params(p = {})\n wish_item = WishItem.find(p[:id])\n tag = Tag.find_or_create_by_name(p[:name])\n\n # Create entry in tagging join table\n tagging = WishTagging.new(wish_item_id: wish_item.id,\n tag_id: tag.id)\n\n if tagging.save\n respond_to do |format|\n format.html {\n return true\n }\n format.json {\n return true\n }\n end\n else\n respond_to do |format|\n format.html {\n return false\n }\n format.json {\n return false\n }\n end\n end\n end",
"def beef_params\n params.require(:beef).permit(:name, { :category_ids=> [] })\n end",
"def remote_node_bags\n bags = []\n bag_query = { admin_node: remote_node.namespace }\n local_client.bags(bag_query) do |response|\n bags << response.body if response.success?\n end\n bags.flatten\n end",
"def create\n get_status\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag was successfully created.' }\n format.json { render json: @tag, status: :created, location: @tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_tags(post)\n tags_text = params[:post][:tags]\n tag_array = tags_text.split(',')\n tag_array.each do |tag|\n tag_with_context = tag.split('/');\n post.set_tag_list_on(tag_with_context[0].strip, tag_with_context[1].strip)\n end\n return post\n end",
"def create\n @tagged_item = TaggedItem.new(params[:tagged_item])\n\n respond_to do |format|\n if @tagged_item.save\n format.html { redirect_to @tagged_item, notice: 'Tagged item was successfully created.' }\n format.json { render json: @tagged_item, status: :created, location: @tagged_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagged_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enqueue_tag(tag,items)\n\t\titems = Array(items)\n\t\tpending = @pending_tagging[tag] += items\n\t\tflush\n\tend"
] | [
"0.6810579",
"0.5950155",
"0.59243083",
"0.5796079",
"0.57092917",
"0.5705225",
"0.5701296",
"0.56931865",
"0.56667936",
"0.56315726",
"0.562981",
"0.5626319",
"0.56239784",
"0.5600851",
"0.5597046",
"0.5584708",
"0.555226",
"0.5521655",
"0.5519388",
"0.5472271",
"0.54682374",
"0.5424064",
"0.5423784",
"0.5405449",
"0.5404375",
"0.5375778",
"0.5371671",
"0.5364304",
"0.5364217",
"0.53637075",
"0.53570616",
"0.5335317",
"0.5333636",
"0.533273",
"0.53309125",
"0.52991605",
"0.52916884",
"0.5291408",
"0.52825636",
"0.52804625",
"0.5279783",
"0.5271162",
"0.5266825",
"0.52610946",
"0.5257754",
"0.52508",
"0.5248837",
"0.5246047",
"0.5245365",
"0.5232287",
"0.5221842",
"0.52112424",
"0.5207202",
"0.52054536",
"0.52019936",
"0.5195771",
"0.5195451",
"0.5188435",
"0.5186783",
"0.51862264",
"0.51853585",
"0.51844776",
"0.51833487",
"0.51784754",
"0.5176933",
"0.51744586",
"0.51714236",
"0.51711124",
"0.51693696",
"0.51686007",
"0.51676404",
"0.5165685",
"0.51578337",
"0.51552594",
"0.5143021",
"0.5142176",
"0.51421666",
"0.5138813",
"0.5126301",
"0.5123341",
"0.5114474",
"0.5110255",
"0.5108644",
"0.5104448",
"0.5104247",
"0.5101631",
"0.5097431",
"0.50934744",
"0.5089317",
"0.5087582",
"0.50868255",
"0.5079571",
"0.5079351",
"0.5077607",
"0.5076919",
"0.50760484",
"0.5071816",
"0.506814",
"0.5066582",
"0.50657696",
"0.50620514"
] | 0.0 | -1 |
PATCH/PUT /bags/1 or /bags/1.json | def update
respond_to do |format|
if @bag.update(bag_params)
format.html { redirect_to @bag, notice: "Bag was successfully updated." }
format.json { render :show, status: :ok, location: @bag }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @bag.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end",
"def update\n if @tag.update(tag_params)\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end",
"def update\n @api_tag = Api::Tag.find(params[:id])\n\n respond_to do |format|\n if @api_tag.update_attributes(params[:api_tag])\n format.html { redirect_to @api_tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: @tag.errors unless @tag.update(tag_params)\n end",
"def update\n tag = Tag.find_by_id(params[:id])\n if tag.update(params.permit(:name))\n render json: tag, status: :ok\n else\n respond_with tag.errors, status: :unprocessable_entity\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n if @tag.update_attributes(params[:tag])\n render json: JSON.parse(@tag.to_json)\n else\n render json: JSON.parse(@tag.errors.to_json)\n end\n end",
"def update\n respond_to do |format|\n if @climb_tag.update(climb_tag_params)\n format.html { redirect_to @climb_tag, notice: 'Climb tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @climb_tag }\n else\n format.html { render :edit }\n format.json { render json: @climb_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_and_respond(@tag, tag_params)\n end",
"def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end",
"def update\n @bagtype = Bagtype.find(params[:id])\n\n respond_to do |format|\n if @bagtype.update_attributes(params[:bagtype])\n format.html { redirect_to @bagtype, notice: 'Bagtype was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bagtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n respond_to do |format|\n if @tag.update(tag_params)\n format.json { render :show, status: :ok, location: @tag }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @building.update(update_params)\n if t = params.permit(:tags)[:tags]\n tag_names = t.split(\", \")\n tags = [Tag.create_with(name: \"building\").find_or_create_by(name: \"building\")]\n for n in tag_names\n tags += [Tag.create_with(name: n).find_or_create_by(name: n)]\n end\n @building.tags = tags\n end\n @notice = \"Updated successfully.\"\n render :file => \"#{Rails.root}/public/success\", :layout => false\n else\n @notice = \"Update failed.\"\n render :file => \"#{Rails.root}/public/error\", :layout => false\n end\n end",
"def update\n # creates tag objects for photos\n tag_array = tag_params['tags'].split(',').each do |x|\n x.strip!\n end\n tag_array.each do |x| \n if Tag.find_by(name: x)\n @tag = Tag.find_by(name: x)\n else\n @tag = Tag.create(name: x)\n end\n Tagging.create(photo_id: @photo.id, tag_id: @tag.id)\n end\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sugar_bag = SugarBag.find(params[:id])\n\n respond_to do |format|\n if @sugar_bag.update_attributes(params[:sugar_bag])\n format.html { redirect_to @sugar_bag, notice: 'Sugar bag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sugar_bag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(options: {}, **data)\n\n refresh_with(parse(client.put(\"/tags/#{gid}\", body: data, options: options)).first)\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @joke = Joke.find(params[:id])\n\n respond_to do |format|\n str_tags = params[:joke][:tags].split(',')\n @tags = str_tags.map {|tag_name|\n Tag.find_or_create_by_name(tag_name)\n }\n @joke.tags = @tags\n \n if @joke.update_attributes(params[:joke].except(:tags))\n format.html { redirect_to @joke, :notice => 'Joke was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @joke.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n if @brag.update_attributes(params[:brag])\n format.html { redirect_to @brag, notice: 'Brag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n if @barrack.update_attributes(params[:barrack])\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n get_status\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(group, tags)\n body = {:tags => tags}.to_json\n url = build_url(group)\n response = rest_patch(url, body)\n response.return!\n end",
"def update\n if @app && @tag\n @tag.update(tag_params)\n if @tag.valid?\n head :no_content\n else\n head :bad_request\n end\n else\n head :not_found\n end\n end",
"def update\n @taggable = current_user.taggables.find(params[:id])\n\n respond_to do |format|\n logger.debug(params)\n if @taggable.update_attributes(params[:taggable])\n format.html { redirect_to @taggable, notice: 'Taggable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taggable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, :notice => 'Tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tagging.update(tagging_params)\n format.html { redirect_to @tagging, notice: 'Tagging was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tagging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to tags_url, :notice => 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n @basket = Basket.find(params[:id])\n\n respond_to do |format|\n if @basket.update_attributes(params[:basket])\n format.html { redirect_to @basket, notice: 'Basket was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag zaktualizowany' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n \n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag editada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @belt.update(belt_params)\n format.html { redirect_to @belt, notice: 'Belt was successfully updated.' }\n format.json { render :show, status: :ok, location: @belt }\n else\n format.html { render :edit }\n format.json { render json: @belt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bucket_bloc.update(bucket_bloc_params)\n format.html { redirect_to @bucket_bloc, notice: 'Bucket bloc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bucket_bloc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n #@recipe.ingredients = params[:recipe_ingredients].map {|k, v|\n #ingredient = @recipe.ingredients.find(k) || @recipe.ingredients.build\n #ingredient.update_attributes(:item => Food.find(v[:item_id]), :quantity => v[:quantity]) unless v[:item_id].blank?\n #ingredient\n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n if @baggage.update_attributes(params[:baggage])\n format.html { redirect_to @baggage, notice: 'Baggage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @baggage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @organization\n @organization.tag_list.add @tags\n if @organization.save\n render :json => @organization.reload.tags\n else\n error!(:invalid_resource, @organization.errors, \"Tags have not been saved\")\n end\n end",
"def update\n respond_to do |format|\n if @boost.update(boost_params)\n format.html { redirect_to @boost, notice: 'Boost was successfully updated.' }\n format.json { render :show, status: :ok, location: @boost }\n else\n format.html { render :edit }\n format.json { render json: @boost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:post][:tag_ids] ||= []\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to [@post.user, @post], notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n if @tagg.update_attributes(params[:tagg])\n format.html { redirect_to @tagg, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tagg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image_tags = ActsAsTaggableOn::Tag.all\n\n tag_list = params[:image][:tag_list]\n @image.tag_list = tag_list.keys.select{|t| tag_list[t] == \"1\"}\n\n\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: \"Image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:brigade_project][:tags] = Tag.create_tags_from_string(params[:brigade_project][:tags])\n @brigade_project = BrigadeProject.find(params[:id])\n respond_to do |format|\n if @brigade_project.update_attributes(params[:brigade_project])\n brigade = Brigade.find(@brigade_project.brigade_id)\n format.html { redirect_to brigade, notice: \"Project was successfully updated.\" }\n format.json { render json: @brigade_project, status: :updated, location: @brigade_project }\n else\n render_failed_modification(format, 'edit', @brigade_project.errors)\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n @tagarr = params[:post][\"tags_attributes\"][\"0\"][:name].split(\" \")\n puts @tagarr\n @tag = {}\n @tagarr.each_with_index do |tag,i|\n @tag[i] = {:name =>tag}\n end\n\n @tagreset = params[:post]\n @tagreset[\"tags_attributes\"] ={}\n @tagreset[\"tags_attributes\"] = @tag\n @post.tags=[]\n #puts @tagreset\n #render :layout => false\n respond_to do |format|\n if @post.update_attributes(@tagreset)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bundle = Bundle.find(params[:id])\n\n\n respond_to do |format|\n params[:bundle][:category] = params[:bundle][:category].strip.downcase\n params[:bundle][:style] = params[:bundle][:style].strip.downcase\n params[:bundle][:color] = params[:bundle][:color].strip.downcase\n params[:bundle][:brand] = params[:bundle][:brand].strip.downcase\n params[:bundle][:make] = params[:bundle][:make].strip.downcase\n params[:bundle][:location] = params[:bundle][:location].strip.downcase\n\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end",
"def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end",
"def update\n respond_to do |format|\n if @abucket.update_attributes(params[:abucket])\n flash[:notice] = 'Bucket was successfully updated.'\n format.html { redirect_to(account_abuckets_path(@account)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @abucket.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n if @bb.update_attributes(params[:bb])\n format.html { redirect_to @bb, notice: 'Bb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asset = Asset.find(params[:asset_id])\n @tag = @asset.tags.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to(asset_manager_asset_tags_path(@tag.asset_id), :notice => 'Tag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update_tag_with_http_info(tag_id, tag_body_update, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TagsApi.update_tag ...\"\n end\n # verify the required parameter 'tag_id' is set\n fail ArgumentError, \"Missing the required parameter 'tag_id' when calling TagsApi.update_tag\" if tag_id.nil?\n # verify the required parameter 'tag_body_update' is set\n fail ArgumentError, \"Missing the required parameter 'tag_body_update' when calling TagsApi.update_tag\" if tag_body_update.nil?\n # resource path\n local_var_path = \"/tags/{tagId}\".sub('{format}','json').sub('{' + 'tagId' + '}', tag_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(tag_body_update)\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 => 'TagEntry')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagsApi#update_tag\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @entry = FeedEntry.find(params[:id])\n\n tags = params['tags' + params[:id]]\n\n respond_to do |format|\n if FeedEntry.add_tag(@entry, tags)\n format.html {render action: 'index'}\n format.json {head :no_content}\n else\n format.html {render action: 'index'}\n format.json {render json: @entry.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n params.permit(:tag_list)\n\n respond_to do |format|\n if @job.update(job_params)\n\n tag_names = params[:job][:tag_list].split(/,\\s+/)\n tag_names.each { |name|\n tag = Tag.find_or_create_by(name: name.strip)\n JobTag.find_or_create_by(:job_id => @job.id, :tag_id => tag.id)\n }\n\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(params)\n # TODO: API expects both priority and branchcode to update branch, bug in Koha module C4::Reserves::ModReserve\n raise ArgumentError, \"need both priority and branchcode params!\" unless params[:priority] && params[:branchcode]\n headers = {\n 'Cookie' => @context[:koha_rest_api_cookie],\n 'Content-Type' => 'application/json'\n }\n http = Net::HTTP.new(\"xkoha\", 8081)\n uri = URI(\"#{intranet(:koha_rest_api)}holds/#{params[:reserve_id]}\")\n res = http.put(uri, params.to_json, headers)\n expect(res.code).to eq(\"200\"), \"got unexpected #{res.code} when updating reserve.\\nResponse body: #{res.body}\"\n res.body\n end",
"def update\n @task.tags.each { |t| t.delete}\n\n respond_to do |format|\n if @task.update(task_params)\n create_multiple_tags(task_params[\"tag\"], @task.id)\n\n format.html { redirect_to @task.list, 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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @tagged_item = TaggedItem.find(params[:id])\n\n respond_to do |format|\n if @tagged_item.update_attributes(params[:tagged_item])\n format.html { redirect_to tagged_items_url, notice: 'Tagged item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tagged_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post.update_attributes(post_params)\n @post.tag_list=(params[:tag_list])\n respond_with @post\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @brave_burst.update(brave_burst_params)\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"def update\n @tagging = @object\n tag = @tagging.tag\n return unless filter_perms(@auth,tag,['updater'])\n taggable = @tagging.taggable\n return unless filter_perms(@auth,taggable,['updater'])\n\n respond_to do |format|\n if @tagging.update_attributes(params[:tagging])\n flash[:notice] = 'Tagging was successfully updated.'\n format.html { redirect_to tagging_url(@tagging) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tagging.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @has_tag.update(has_tag_params)\n format.html { redirect_to @has_tag, notice: 'Has tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @has_tag }\n else\n format.html { render :edit }\n format.json { render json: @has_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @posttag = Posttag.find(params[:id])\n\n respond_to do |format|\n if @posttag.update_attributes(params[:posttag])\n format.html { redirect_to @posttag, :notice => 'Posttag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @posttag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tag.name = tag_params[:name]\n @tag.style = tag_params[:style]\n\n if @tag.save\n render :nothing => true, :status => :ok\n else\n render :nothing => true, :status => :unprocessable_entity\n end\n end",
"def update\n authorize @ticket\n @ticket.tag_list.add @tags\n if @ticket.save\n render :json => @ticket.reload.tags\n else\n error!(:invalid_resource, @ticket.errors, \"Tags have not been saved\")\n end\n end",
"def update\n @bid = @swarm_request.bids.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to(swarm_request_bid_url(:id => @bid.to_param, :swarm_request_id => @swarm_request.to_param), :notice => 'Bid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bid.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lob = Lob.find(params[:id])\n\n if @lob.update(lob_params)\n head :no_content\n else\n render json: @lob.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @boook.update(boook_params)\n format.html { redirect_to @boook, notice: 'Boook was successfully updated.' }\n format.json { render :show, status: :ok, location: @boook }\n else\n format.html { render :edit }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @used_bike = UsedBike.find(params[:id])\n\n if @used_bike.update(used_bike_params)\n adding_images(params)\n head :no_content\n else\n render json: @used_bike.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @tag_one.update(tag_one_params)\n format.html { redirect_to @tag_one, notice: 'Tag one was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag_one }\n else\n format.html { render :edit }\n format.json { render json: @tag_one.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bike_rack.update(bike_rack_params)\n flash[:success] = 'Bike rack was successfully updated.'\n format.html { redirect_to @bike_rack }\n format.json { render :show, status: :ok, location: @bike_rack }\n else\n flash[:danger] = 'There was a problem editing Bike rack.'\n format.html { render :edit }\n format.json { render json: @bike_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @entity_tag = EntityTag.find(params[:id])\n\n respond_to do |format|\n if @entity_tag.update_attributes(params[:entity_tag])\n format.html { redirect_to @entity_tag, notice: 'Entity tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dog_breed_group.update(dog_breed_group_params)\n format.html { redirect_to dog_breed_groups_url, notice: 'Dog breed group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dog_breed_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: t('.updated') }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tagging = Tagging.find(params[:id])\n\n respond_to do |format|\n if @tagging.update_attributes(params[:tagging])\n flash[:notice] = 'Tagging was successfully updated.'\n format.html { redirect_to(@tagging.package) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tagging.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bike = Bike.find(params[:id])\n @bike.compare_vehicles = params[:bike][:compare_vehicles]\n\n if @bike.update(bike_params)\n audit(@bike, current_user)\n render json: @bike, status: :ok #serializer: Web::V1::BikeSerializer\n else\n render json: @bike.errors, status: :unprocessable_entity\n end\n end",
"def update\n @bookmark_tag = BookmarkTag.find(params[:id])\n\n respond_to do |format|\n if @bookmark_tag.update_attributes(params[:bookmark_tag])\n format.html { redirect_to @bookmark_tag, notice: 'Bookmark tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookmark_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = [{ 'op' => operation, 'path' => path, 'value' => value }]\n patch_options = { 'If-Match' => @data['eTag'] }\n response = @client.rest_patch(@data['uri'], patch_options.merge('body' => body), @api_version)\n @client.response_handler(response)\n end",
"def update\n @batch = Batch.find(params[:id])\n\n respond_to do |format|\n if @batch.update_attributes(params[:batch])\n format.html { redirect_to @batch, notice: 'Batch was successfully updated.' }\n format.json { respond_with_bip(@batch) }\n else\n format.html { redirect_to @batch }\n format.json { respond_with_bip(@batch) }\n end\n end\n end",
"def update\n if @bid.update(bid_params)\n head :no_content\n else\n render json: @bid.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @biotop.update(biotop_params)\n format.html { redirect_to @biotop, notice: 'Biotop was successfully updated.' }\n format.json { render :show, status: :ok, location: @biotop }\n else\n format.html { render :edit }\n format.json { render json: @biotop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @branch = Branch.friendly.find(params[:id])\n respond_to do |format|\n if @branch.update(branch_params)\n format.html { redirect_to @branch, notice: 'Branch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bin.assign_attributes bin_params\n\n respond_to do |format|\n if save_bin @bin\n format.html { redirect_to @bin, notice: 'Bin was successfully updated.' }\n format.json { render json: { ok: true, bin: @bin } }\n else\n Rails.logger.error \"Failed to update bin #{params[:id]}\"\n format.html { render :edit }\n format.json { render json: {\n # Respond with the current state of the bin in the database\n ok: false, errors: @bin.errors.full_messages, bin: Bin.find_by(id: params[:id]) }\n }\n end\n end\n end",
"def update\r\n @bcat1 = Bcat1.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @bcat1.update_attributes(params[:bcat1])\r\n flash[:notice] = 'Bcat1 was successfully updated.'\r\n format.html { redirect_to(@bcat1) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @bcat1.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_gist\n @gist[\"list.json\"] = JSON.pretty_generate @things\n @gists.save @gist\n end",
"def batch_change_inventory(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/inventory/changes/batch-create',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end"
] | [
"0.61274207",
"0.6017179",
"0.59048915",
"0.5899882",
"0.58843267",
"0.5847221",
"0.58233",
"0.5808703",
"0.5754309",
"0.5722494",
"0.5717098",
"0.570668",
"0.57023704",
"0.5686537",
"0.5686192",
"0.56398284",
"0.5601541",
"0.5575022",
"0.5536931",
"0.55300653",
"0.5521425",
"0.55188686",
"0.55114144",
"0.5507922",
"0.54979604",
"0.5489121",
"0.5486641",
"0.54718715",
"0.5451801",
"0.5451469",
"0.54501265",
"0.54458",
"0.5440106",
"0.5432996",
"0.54303294",
"0.5426266",
"0.5425343",
"0.5405356",
"0.54015076",
"0.54015076",
"0.5389487",
"0.5387398",
"0.5385073",
"0.53810924",
"0.5374051",
"0.5373067",
"0.5372946",
"0.53674245",
"0.53548753",
"0.535337",
"0.53470516",
"0.53470516",
"0.53432566",
"0.5343198",
"0.53415316",
"0.53411573",
"0.5338444",
"0.533786",
"0.5337794",
"0.5319253",
"0.5318799",
"0.5317379",
"0.5313863",
"0.53101385",
"0.53101385",
"0.53028417",
"0.53006744",
"0.52996916",
"0.52975",
"0.52931625",
"0.529026",
"0.5287819",
"0.52747196",
"0.5271976",
"0.52681357",
"0.5268112",
"0.5263113",
"0.52493966",
"0.52474296",
"0.5240502",
"0.52342135",
"0.52339166",
"0.5230428",
"0.5228548",
"0.5224836",
"0.5217709",
"0.5216101",
"0.52151245",
"0.5214984",
"0.52144784",
"0.5208385",
"0.52000356",
"0.5194616",
"0.51906496",
"0.5189665",
"0.518958",
"0.51852775",
"0.51834375",
"0.5183402",
"0.5183373"
] | 0.60528153 | 1 |
DELETE /bags/1 or /bags/1.json | def destroy
@bag.destroy
respond_to do |format|
format.html { redirect_to bags_url, notice: "Bag was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sugar_bag = SugarBag.find(params[:id])\n @sugar_bag.destroy\n\n respond_to do |format|\n format.html { redirect_to sugar_bags_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n\n client.delete(\"/tags/#{gid}\") && true\n end",
"def destroy\n BuzzTag.where(:buzz_id => params[:buzz_id], :tag_id => params[:tag_id]).first.destroy\n end",
"def delete(tag)\n api_client.tags.multi_delete(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end",
"def delete_tag tag\n delete \"tag/#{tag}\"\n end",
"def destroy\n @msshipbag = Msshipbag.find(params[:id])\n @msshipbag.destroy\n\n respond_to do |format|\n format.html { redirect_to(msshipbags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @hastags = Hastag.where(:photo_id => @photo.id)\n @hastags.destroy_all\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to '/home', notice: 'You have deleted the picture' }\n format.json { head :no_content }\n end\n end",
"def deleteEntityTag( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/tag\",params)\n end",
"def destroy\n begin\n breed = Tagger.tagged_klass.constantize.find(params[:id])\n breed.destroy\n render json: { message: \"Deleted successfully\" }\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end",
"def destroy\n @bagtype = Bagtype.find(params[:id])\n @bagtype.destroy\n\n respond_to do |format|\n format.html { redirect_to bagtypes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @climb_tag.destroy\n respond_to do |format|\n format.html { redirect_to climb_tags_url, notice: 'Climb tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_tag = Api::Tag.find(params[:id])\n @api_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to api_tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @b = B.find(params[:id])\n @b.destroy\n\n respond_to do |format|\n format.html { redirect_to bs_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_tags(name); end",
"def destroy\n @tagg = Tagg.find(params[:id])\n @tagg.destroy\n\n respond_to do |format|\n format.html { redirect_to taggs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tagging.destroy\n respond_to do |format|\n format.html { redirect_to taggings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tagged_item = TaggedItem.find(params[:id])\n @tagged_item.destroy\n\n respond_to do |format|\n format.html { redirect_to all_items_tagged_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t b = Blog.find(params[:id])\n\t b.taggings.each do |t|\n\t\t if (t.tag.taggings.count == 1)\n\t\t\t t.tag.destroy\n\t\t end\n\t end\n Blog.find(params[:id]).destroy\n flash[:sucess] = \"Blog deleted.\"\n redirect_to life_index_path\n end",
"def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to taggings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @taggable = current_user.taggables.find(params[:id])\n\n #destroy each tag in the taggable\n @taggable.tags.each do |tag|\n tag.destroy\n end\n\n @taggable.destroy\n\n respond_to do |format|\n format.html { redirect_to taggables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bb = Bb.find(params[:id])\n @bb.destroy\n\n respond_to do |format|\n format.html { redirect_to bbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_tag = AssetTag.find(params[:id])\n @asset_tag.destroy\n render json: {}\n \n end",
"def destroy\n get_status\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dog_breed_group.destroy\n respond_to do |format|\n format.html { redirect_to dog_breed_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quotetags = Quotetags.find(params[:id])\n @quotetags.destroy\n\n respond_to do |format|\n format.html { redirect_to(quotetags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @baggage = Baggage.find(params[:id])\n @baggage.destroy\n\n respond_to do |format|\n format.html { redirect_to baggages_url }\n format.json { head :no_content }\n end\n end",
"def remove_tag\n @asset = Asset.find(params[:id])\n tag_to_remove = params[:tag]\n \n @asset.tags = @asset.tags.select{|tag| tag.name != tag_to_remove}\n \n respond_to do |format|\n if @asset.save\n format.html { redirect_to(assets_url, :notice => 'Tag was successfully removed from asset.') }\n format.json { render :json => @asset }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tag_delete(id, tag)\n wf_event_id?(id)\n wf_string?(tag)\n api.delete([id, 'tag', tag].uri_concat)\n end",
"def destroy\n @tags_of_novel = TagsOfNovel.find(params[:id])\n @tags_of_novel.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_of_novels_url }\n format.json { head :no_content }\n end\n end",
"def delete_bundle(bundle)\n args = [\"bundle=#{u(bundle)}\"]\n get('tags/bundles/delete?' << args.join('&'))\n nil\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n \n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n\n end",
"def deleteCookbookDetailTag\n @cookbook = Cookbook.find_by_id(params[:cookbook_id])\n \n Cookbooktag.delete_all([\"cookbook_id = ? AND tag_id = ?\", params[:cookbook_id], params[:tags_id]])\n @cookbookTags = getCBTags(@cookbook)\n render :partial => \"cookbook_details_tags\"\n \n end",
"def destroy\n @bl = Bl.find(params[:id])\n @bl.destroy\n\n respond_to do |format|\n format.html { redirect_to bls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Asset.find(params[:asset_id])\n @tag = @asset.tags.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(asset_manager_asset_tags_path(@asset)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @taggable.destroy\n\n respond_to do |format|\n format.html { redirect_to(taggables_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hastag.destroy\n respond_to do |format|\n format.html { redirect_to hastags_url, notice: 'Hastag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n render json: JSON.parse({msg:\"success\"}.to_json)\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_segment_badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @barrack = Barrack.find(params[:id])\n @barrack.destroy\n\n respond_to do |format|\n format.html { redirect_to barracks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @basket = Basket.find(params[:id])\n @basket.destroy\n\n respond_to do |format|\n format.html { redirect_to baskets_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bread.destroy\n respond_to do |format|\n format.html { redirect_to breads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bdig = Bdig.find(params[:id])\n @bdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdigs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tag = Tag.find(params[:id])\n respond_to do |format|\n if @tag.destroy\n format.json { render json: {:id => @tag.id}, status: :ok }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @apk_bin = ApkBin.find(params[:id])\n @apk_bin.destroy\n\n respond_to do |format|\n format.html { redirect_to apk_bins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bookmark_tag = BookmarkTag.find(params[:id])\n @bookmark_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to bookmark_tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_taggings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @boost.destroy\n respond_to do |format|\n format.html { redirect_to boosts_url, notice: 'Boost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @posttag = Posttag.find(params[:id])\n @posttag.destroy\n\n respond_to do |format|\n format.html { redirect_to posttags_url }\n format.json { head :no_content }\n end\n end",
"def tags_delete(tag)\n params = prepare_tags_delete_param(tag)\n response = request(API_PATH_TAGS_DELETE, params)\n parse_and_eval_execution_response(response.body)\n end",
"def destroy\n @tag = Tag.find(params[:id])\n\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(badges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bodega.destroy\n respond_to do |format|\n format.html { redirect_to bodegas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bemap = Bemap.find(params[:id])\n @bemap.destroy\n\n respond_to do |format|\n format.html { redirect_to bemaps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tag_collection = TagCollection.find(params[:id])\n @tag_collection.destroy\n render json: {}\n \n end",
"def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to(taggings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to bowls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @branch = @repository.branches.where(:name => params[:branch_name]).first!\n @branch.destroy\n\n respond_to do |format|\n format.html { redirect_to(branches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bicicletum.destroy\n respond_to do |format|\n format.html { redirect_to bicicleta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_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\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n\n end",
"def remove_tag\n @kyu_entry.tag_list.remove(params[:tag])\n @kyu_entry.save\n render json: true\n end",
"def destroy\n @bike = Bike.find(params[:id])\n @bike.destroy\n\n respond_to do |format|\n format.html { redirect_to bikes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grep_multi.destroy\n respond_to do |format|\n format.html { redirect_to grep_multis_url, notice: 'Grep multi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def bucket_delete_object(key)\n http.delete(\"/#{key}\", bucket: bucket, key: key)\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @branch = @repository.branches.where(name: params[:branch_name]).first!\n @branch.destroy\n\n respond_to do |format|\n format.html { redirect_to(branches_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n validate_presence_of :name\n wrapper.delete_tag(@name) || raise(OperationFailed)\n end",
"def destroy\n @admin_album_tag.destroy\n respond_to do |format|\n format.html { redirect_to admin_album_tags_url, notice: \"#{t 'activerecord.successful.messages.album_tag_deleted'}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kb = Kb.find(params[:id])\n @kb.destroy\n\n respond_to do |format|\n format.html { redirect_to kbs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bb.destroy\n respond_to do |format|\n format.html { redirect_to bbs_url, notice: 'Bb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tag.destroy\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bob = Bob.find(params[:id])\n @bob.destroy\n\n respond_to do |format|\n format.html { redirect_to bobs_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 delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n @Bouquets = Bouquet.find(params[:id])\n @Bouquets.destroy\n\n respond_to do |format|\n format.html { redirect_to bouquets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Branch.friendly.find(params[:id]).destroy\n flash[:success] = \"Branch deleted.\"\n redirect_to admintools_url\n end",
"def destroy\n @bbhk.destroy\n respond_to do |format|\n format.html { redirect_to bbhks_url }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_tag = ActivityTag.find(params[:id])\n @activity_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tag_ref.destroy\n respond_to do |format|\n format.html { redirect_to tag_refs_url, notice: 'Usunięto Tag z artykułu.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.6856207",
"0.66041327",
"0.6498331",
"0.63567746",
"0.6343161",
"0.62770903",
"0.6260935",
"0.6246118",
"0.62445426",
"0.6229056",
"0.6189771",
"0.6187286",
"0.6186752",
"0.6114031",
"0.6108551",
"0.6102239",
"0.60974306",
"0.60656595",
"0.6064457",
"0.60632217",
"0.60608166",
"0.6057116",
"0.60501",
"0.60418355",
"0.6022042",
"0.5993368",
"0.5986055",
"0.59817165",
"0.5970374",
"0.5969716",
"0.5968795",
"0.5959335",
"0.59587264",
"0.5954973",
"0.59480256",
"0.59436566",
"0.5942219",
"0.5931727",
"0.59214467",
"0.5921139",
"0.5916176",
"0.59158874",
"0.5913585",
"0.5913221",
"0.59090924",
"0.5905983",
"0.59038144",
"0.5897364",
"0.5884601",
"0.58842266",
"0.5871164",
"0.585789",
"0.585789",
"0.585789",
"0.5856328",
"0.58558667",
"0.584838",
"0.58466953",
"0.5843576",
"0.58373696",
"0.5832274",
"0.5829373",
"0.5819325",
"0.5818834",
"0.5818676",
"0.58146983",
"0.5813506",
"0.5803665",
"0.58007103",
"0.58007044",
"0.57998097",
"0.57977134",
"0.57947946",
"0.57940763",
"0.579051",
"0.5787829",
"0.5787116",
"0.5780673",
"0.5779981",
"0.57761323",
"0.5775952",
"0.5773309",
"0.57706386",
"0.57677037",
"0.57569426",
"0.5755383",
"0.5755383",
"0.57542324",
"0.5747607",
"0.5746375",
"0.57450765",
"0.5743387",
"0.574065",
"0.574055",
"0.57394475",
"0.573783",
"0.573709",
"0.5736994",
"0.5736888",
"0.57353425"
] | 0.6671587 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_bag
@bag = Bag.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] | 0.0 | -1 |
Only allow a list of trusted parameters through. | def bag_params
params.require(:bag).permit(:user_id, :quantity, :product_id, :product_variant_id, :purchased)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] | 0.0 | -1 |
Set the `sinatra.commonlogger` variable to `true` in the Rack environment before passing the request to lowwer middlewares and the app. This ensures that any `::Rack::CommonLogger` instances (as well as all `::Sinatra::CommonLogger` instances) in the same middleware stack will become silent and not log anything. This is required, so that a single request is not logged multiple times even in the face of the default Rack middleware stack. | def on_request(env)
env['sinatra.commonlogger'] = true
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(env, *args)\n unless env['sinatra.commonlogger'.freeze] &&\n env['rackstash.logger'.freeze].is_a?(::Rackstash::Logger)\n super\n end\n end",
"def global_request_logging\n http_request_header_keys = request.headers.env.keys.select { |header_name| header_name.match('^HTTP.*') }\n http_request_headers = request.headers.select { |header_name, header_value| http_request_header_keys.index(header_name) }\n\n logger.debug \"[ApplicationController] Processing with params #{params.inspect}\"\n if request.body.respond_to?(:string)\n logger.debug \"[ApplicationController] Processing with body #{request.body.string.inspect}\" unless request.body.string.blank?\n elsif request.body.respond_to?(:read) && request.body.respond_to?(:rewind)\n request.body.rewind\n logger.debug \"[ApplicationController] Processing with body #{request.body.read.inspect}\"\n end\n\n # Run Warden if not already done, to avoid incomplete log entries after authN fail\n authenticate!\n\n begin\n yield\n ensure\n logger.debug \"[ApplicationController] Responding with headers #{response.headers.inspect}\"\n logger.debug \"[ApplicationController] Responding with body #{response.body.inspect}\" unless response.body.blank?\n end\n end",
"def install\n Rack::CommonLogger.class_eval do\n\n alias_method :original_log, :log\n\n def log(env, status, header, began_at)\n logger = @logger || env['rack.errors']\n\n blob = {\n :length => header['Content-Length'] || 0,\n :code => status.to_s[0 .. 3],\n :version => env['HTTP_VERSION'],\n :method => env['REQUEST_METHOD'],\n :duration => (Time.now - began_at),\n :query => env[\"QUERY_STRING\"],\n :path => env['PATH_INFO'],\n :remote_addr => env['REMOTE_ADDR'],\n :user => env['REMOTE_USER'],\n :user_agent => env['HTTP_USER_AGENT'],\n :timestamp => Time.now.utc.iso8601\n }\n\n # If there's an X-Forwarded-For header split it up into a\n # list of machine-readable IPs.\n blob[:forwarded_for] = env['HTTP_X_FORWARDED_FOR'].split(',') if env['HTTP_X_FORWARDED_FOR']\n\n if logger\n logger.write({:type => 'request',\n :event => blob}.to_json)\n logger.write(\"\\n\")\n end\n end\n end\n end",
"def enable_logging(logger = Logger.new(STDOUT), log_level: Logger::DEBUG)\n stack.after 'request.factory', 'request.logger', AsyncRequestLogger.new(logger, log_level: log_level)\n stack.before 'response.factory', 'response.logger', AsyncResponseLogger.new(logger, log_level: log_level)\n self\n end",
"def _roda_before_05__common_logger\n @_request_timer = CommonLogger.start_timer\n end",
"def setup_common\n options[:log].each do |spec|\n mod, level, file = spec.split(\":\")\n app.log_setup(mod, level, file)\n end\n\n if options[:debug]\n app.public_logs = true\n app.filter_backtraces = false\n require \"roby/app/debug\"\n end\n\n nil\n end",
"def call env\n env[\"rack.logger\"] = logger\n trace_id = extract_trace_id(env)\n logger.add_trace_id trace_id\n\n begin\n @app.call env\n ensure\n logger.delete_trace_id\n end\n end",
"def log\n env['rack.logger']\nend",
"def global_request_logging \n http_request_header_keys = request.headers.keys.select{|header_name| header_name.match(\"^HTTP.*\")}\n http_request_headers = request.headers.select{|header_name, header_value| http_request_header_keys.index(header_name)}\n logger.info \"Received #{request.method.inspect} to #{request.url.inspect} from #{request.remote_ip.inspect}. Processing with headers #{http_request_headers.inspect} and params #{params.inspect}\"\n begin \n yield \n ensure \n logger.info \"Responding with #{response.status.inspect} => #{response.body.inspect}\"\n end \n end",
"def use_logger(value)\n @global_logger = value\n end",
"def access_logger\n Rails.application.config.another_logger.info(\"#{request.method} '#{request.path}' #{request.version} from: #{request.remote_ip}\")\n end",
"def disable_logging\n stack.remove 'request.logger'\n stack.remove 'response.logger'\n self\n end",
"def call(env)\n request = ActionDispatch::Request.new(env)\n Rails.logger.inject_request(request)\n @app.call(env)\n ensure\n ActiveSupport::LogSubscriber.flush_all!\n end",
"def with_logger\n if env = manifest.environment\n old_logger = env.logger\n env.logger = @logger\n end\n yield\n ensure\n env.logger = old_logger if env\n end",
"def _roda_after_90__common_logger(result)\n super if result && _common_log_request?(result)\n end",
"def configure_logger!\n if config[:debug] || !ENV[\"DEBUG\"].to_s.empty?\n Bogo::Logger.logger.level = :debug\n else\n Bogo::Logger.logger.level = config.fetch(:log, :fatal)\n end\n end",
"def enable_logging\n initialize_logger\n end",
"def logger\n if request.respond_to? :logger\n request.logger\n else\n Logger.new(STDOUT)\n end\n end",
"def app_logger(**tags)\n logger_tags =\n { url: request.url,\n ip: request.ip,\n user_id: current_user.id,\n params: params.to_unsafe_h }.merge(tags)\n\n Helli::Logger.new(logger_tags)\n end",
"def silence_action_dispatch_debug_exceptions_logger\n require 'loga/ext/rails/rack/debug_exceptions.rb'\n end",
"def call(env)\n do_log = env['HTTP_X_FIRELOGGER']\n if do_log\n env['firelogger'] = @logger = Logger.new\n\n began_at = Time.now\n status, header, body = @app.call(env)\n header = Utils::HeaderHash.new(header)\n\n id = rand(0xffffffff)\n @logger.encode.each_with_index do |chunk, i|\n header[\"FireLogger-#{id}-#{i}\"] = chunk\n end\n\n [status, header, body]\n else\n @app.call env\n end\n end",
"def logger\n @logger ||= Logger.new(File.join(Rails.root, 'log', 'meta_request.log'))\n end",
"def setup_logger(logger = nil)\n # If a logger is specified we replace the existing.\n @logger = logger\n\n # Otherwise we create a new one.\n logger = Logger.new(STDOUT)\n logger.level = Logger::DEBUG\n @logger ||= logger\n end",
"def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end",
"def start_logger\n if config && config[:log] == \"file\" && config.log_file_path\n start_file_logger(config.log_file_path)\n else\n start_stdout_logger\n end\n\n logger.level =\n if config\n config.log_level\n else\n Appsignal::Config::DEFAULT_LOG_LEVEL\n end\n logger << @in_memory_log.string if @in_memory_log\n end",
"def logger\n initialize_logger unless @logger\n @logger\n end",
"def call(env)\n env['rack.logger'] = logger\n Routes.call(env)\n end",
"def call(env)\n env['rack.logger'] = logger\n Routes.call(env)\n end",
"def process_with_silent_log(method_name, *args)\n if logger\n @old_logger_level = logger.level\n if Rails.version >= '3.2'\n silence do\n process_without_silent_log(method_name, *args)\n end\n else\n logger.silence do\n process_without_silent_log(method_name, *args)\n end\n end\n else\n process_without_silent_log(method_name, *args)\n end\n end",
"def log_request\n ServerRequestLog.create! default_log_hash\n end",
"def silence_rails_rack_logger\n case Rails::VERSION::MAJOR\n when 3 then require 'loga/ext/rails/rack/logger3.rb'\n when 4..7 then require 'loga/ext/rails/rack/logger.rb'\n else\n raise Loga::ConfigurationError,\n \"Rails #{Rails::VERSION::MAJOR} is unsupported\"\n end\n end",
"def determine_loggers\n if defined?(::Rails) && ::Rails.logger\n self.logger = ::Rails.logger\n else\n require 'logger'\n self.logger = ::Logger.new($stdout)\n log_level = ::ENV.fetch('LOG_LEVEL', 'info').to_s.upcase\n begin\n logger.level = ::Logger::Severity.const_get(log_level)\n rescue NameError => _e\n logger.level = ::Logger::Severity::INFO\n end\n end\n self.grpc_logger = logger if grpc_logger.nil?\n end",
"def disable_logger_noise\n StraightServer::Config.logmaster = { 'log_level' => 'INFO', 'file' => 'straight.log' }\n @initializer.create_logger\n expect(StraightServer.logger).to receive(:info).and_return ''\n end",
"def logger=(logger); end",
"def logger=(logger); end",
"def set_logger\n logger = CarrotRpc::ServerRunner::Logger.configured\n CarrotRpc.configuration.logger = logger\n\n logger\n end",
"def log_request_begin(logger, env)\n # Assuming remote addresses are IPv4, make them all align to the same width\n remote_addr = env['HTTP_X_FORWARDED_FOR'] || env[\"REMOTE_ADDR\"] || \"-\"\n remote_addr = remote_addr.ljust(15)\n\n # Log the fact that a query string was present, but do not log its contents\n # because it may have sensitive data.\n if (query = env[\"QUERY_STRING\"]) && !query.empty?\n query_info = '?...'\n else\n query_info = ''\n end\n\n # Session\n if env['global_session']\n cookie = env['global_session']\n info = [ env['global_session'].id,\n cookie.keys.map{|k| %{\"#{k}\"=>\"#{cookie[k]}\"} }.join(', ') ]\n sess = %Q{Session ID: %s Session Data: {%s}} % info\n else\n sess = \"\"\n end\n\n shard_info = 'Shard: ' + (env['HTTP_X_SHARD'] || 'default').to_s + ';'\n\n params = [\n env[\"REQUEST_METHOD\"],\n env[\"PATH_INFO\"],\n query_info,\n remote_addr,\n sess,\n shard_info,\n env[\"rack.request_uuid\"] || ''\n ]\n\n logger.info %Q{Processing %s \"%s%s\" (for %s) %s %s Request ID: %s} % params\n end",
"def set_logger(logger)\n LOGGER.set_logger(logger)\n end",
"def call(env)\n logger(env)\n end",
"def use_logger(logger)\n @logger = logger\n end",
"def use_logger(logger)\n @logger = logger\n end",
"def silence_omniauth\n previous_logger = OmniAuth.config.logger\n OmniAuth.config.logger = Logger.new(\"/dev/null\")\n yield\n ensure\n OmniAuth.config.logger = previous_logger\n end",
"def log=(logger); end",
"def enable_logging(communicator_logger)\n raise ArgumentError, 'communicator_logger is required' unless communicator_logger\n\n @communicator_logger = communicator_logger\n end",
"def enable_logging(communicator_logger)\n @session.connection.enable_logging(communicator_logger)\n end",
"def configure_logging\n Chef::Log.logger = AuditLogger.new(sensitive_inputs)\n Chef::Log.logger.level = Log.level_from_sym(Log.level)\n end",
"def silence_logging\n Rails.logger.silence do\n yield\n end\n end",
"def configure_logging\n @logger = Logging.logger[self]\n end",
"def logger\n @app.logger\n end",
"def set_up_logging\n\n if @parameters[:log_to_file] then\n\n @logger = Logger.new(@parameters[:log_to_file])\n\n else\n\n @logger = Logger.new(STDOUT)\n\n end\n\n if @parameters[:log_detailed_messages] then\n \n @logger.sev_threshold = Logger::DEBUG\n\n else\n\n @logger.sev_threshold = Logger::INFO\n\n end\n\n end",
"def setup_middleware middleware_stack\n where = OpenCensus::Trace.configure.middleware_placement\n case where\n when Class\n middleware_stack.insert_before where, RackMiddleware\n when :begin\n middleware_stack.unshift RackMiddleware\n else\n middleware_stack.use RackMiddleware\n end\n end",
"def logger=(logger)\n @logger = logger || @logger\n end",
"def log_request\n # REQUEST_LOG.info( {\n # time: Time.now.to_s,\n # ip: request.remote_ip,\n # path: request.path,\n # site: request.host,\n # user_agent: request.user_agent,\n # params: (request.request_parameters.blank? ? request.query_parameters : request.request_parameters),\n # device: sub_group_type,\n # referer_header: referer,\n # current_page_header: current_page,\n # landing_url_header: land_url,\n # visitor_id_header: request.env['HTTP_VISITOR_ID'],\n # session_id_header: request.env['HTTP_SESSION_ID'],\n # visitor_id: visitor_id,\n # session_id: session_id,\n # params: params\n # } )\n end",
"def with_logger\n yield\n end",
"def log_request_response(exception = nil)\n super(exception) if exception.present?\n end",
"def setup\n self.logger.reopen(File.open(File.join(Lokii::Config.root, Lokii::Config.log), \"a\")) if daemon? && self.logger\n self.logger ||= ::Logger.new(File.join(Lokii::Config.root, Lokii::Config.log))\n end",
"def logger=(logger)\n Restfulness.logger = logger\n end",
"def use_logger(logger)\n adapter.logger = logger\n end",
"def set_up_global_logger(verbose = 0)\n case verbose\n when -1\n console_log_level = :error\n when 0\n console_log_level = :notice\n when 1\n console_log_level = :info\n when 2\n console_log_level = :debug\n else\n console_log_level = :trace # developer debug\n end\n logger.levels(console_log_level)\n end",
"def init_logging\n app_name = ENV[\"APP_NAME\"] || \"calcentral\"\n format = PatternFormatter.new(:pattern => \"[%d] [%l] [CalCentral] %m\")\n\n Rails.logger = Log4r::Logger.new(app_name)\n Rails.logger.level = DEBUG\n Rails.logger.outputters = init_file_loggers(app_name, format)\n\n stdout = Outputter.stdout #controlled by Settings.logger.level\n stdout.formatter = format\n # level has to be set in the logger initializer, after Settings const is initialized.\n # see initializers/logging.rb\n Rails.logger.outputters << stdout\n end",
"def reset_singleton_logger!\n @@singleton_logger = nil\n end",
"def reset_logger!\n Thread.current[:merb_logger] = nil\n end",
"def logger=(logr); @logger = logr end",
"def logger=(logger)\n logger.debug \"lumber preventing set of logger for #{self} to #{logger}, use #lumber_logger= if you really want it set\"\n end",
"def logger=(other)\n config.logger = other\n end",
"def reset_own_logger\n self.logger = nil\n end",
"def logger\n @logger ||= set_logger\n end",
"def set_webistrano_logger(config)\n config.set :logger, logger\n end",
"def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end",
"def middleware\n mw = Hash.new { |e, m| e[m] = [] }\n mw[\"deployment\"].concat([::Rack::ContentLength, ::Rack::CommonLogger])\n mw[\"development\"].concat(mw[\"deployment\"] + [::Rack::ShowExceptions, ::Rack::Lint])\n require 'hanami/assets/static'\n mw[\"development\"].push(::Hanami::Assets::Static)\n mw\n end",
"def set_logger(logger)\n @logger = logger\n end",
"def set_thread_request\n LogUtils.request = request\n end",
"def mute_logger\n zk_log = Zookeeper::Logger.wrapped_logger\n\n orig_level, zk_log.level = zk_log.level, ::Logger::FATAL\n orig_zk_level, Zookeeper.debug_level = Zookeeper.debug_level, Zookeeper::Constants::ZOO_LOG_LEVEL_ERROR\n yield\n ensure\n zk_log.level = orig_zk_level\n end",
"def logger=(logger)\n @log = logger\n @log.progname = @appname\n @log.level = @level\n end",
"def configure_logging\n Backdat::Log.init(Backdat::Config[:log_location])\n if ( Backdat::Config[:log_location] != STDOUT ) && STDOUT.tty? &&\n ( !Backdat::Config[:daemonize] )\n stdout_logger = Logger.new(STDOUT)\n STDOUT.sync = true\n stdout_logger.formatter = Backdat::Log.logger.formatter\n Backdat::Log.loggers << stdout_logger\n end\n Backdat::Log.level = Backdat::Config[:log_level]\n end",
"def setup_logging(log_path)\n log_path ||= '/dev/null'\n $stdin.reopen '/dev/null'\n $stdout.reopen(log_path, 'a')\n $stderr.reopen $stdout\n $stdout.sync = true\n end",
"def silent_webrick\n return {} if not defined? WEBrick or Environment.aloud\n null = System::WINDOWS ? 'NUL' : '/dev/null'\n {:AccessLog => [], :Logger => WEBrick::Log::new(null, 7)}\n end",
"def request_log(request); end",
"def logger\n @master_logger\n end",
"def call(env)\n # Set the trace context (e.g. distributed tracing)\n if configuration[:distributed_tracing] && tracer.provider.context.trace_id.nil?\n context = HTTPPropagator.extract(env)\n tracer.provider.context = context if context.trace_id\n end\n\n tracer.trace(\n Ext::SPAN_REQUEST,\n service: configuration[:service_name],\n span_type: Datadog::Ext::HTTP::TYPE_INBOUND,\n # this is kept nil until we set a correct one (either in the route or with a fallback in the ensure below)\n # the nil signals that there's no good one yet and is also seen by profiler, when sampling the resource\n resource: nil,\n ) do |span|\n begin\n Sinatra::Env.set_datadog_span(env, @app_instance, span)\n\n response = @app.call(env)\n ensure\n Sinatra::Env.request_header_tags(env, configuration[:headers][:request]).each do |name, value|\n span.set_tag(name, value) if span.get_tag(name).nil?\n end\n\n request = ::Sinatra::Request.new(env)\n span.set_tag(Datadog::Ext::HTTP::URL, request.path)\n span.set_tag(Datadog::Ext::HTTP::METHOD, request.request_method)\n span.set_tag(Ext::TAG_SCRIPT_NAME, request.script_name) if request.script_name && !request.script_name.empty?\n\n span.set_tag(Ext::TAG_APP_NAME, @app_instance.settings.name)\n\n # If this app handled the request, then Contrib::Sinatra::Tracer OR Contrib::Sinatra::Base set the\n # resource; if no resource was set, let's use a fallback\n span.resource = env['REQUEST_METHOD'] if span.resource.nil?\n\n # TODO: This backfills the non-matching Sinatra app with a \"#{method} #{path}\"\n # TODO: resource name. This shouldn't be the case, as that app has never handled\n # TODO: the response with that resource.\n # TODO: We should replace this backfill code with a clear `resource` that signals\n # TODO: that this Sinatra span was *not* responsible for processing the current request.\n rack_request_span = env[Datadog::Contrib::Rack::TraceMiddleware::RACK_REQUEST_SPAN]\n span.resource = rack_request_span.resource if rack_request_span && rack_request_span.resource\n\n if response\n if (status = response[0])\n sinatra_response = ::Sinatra::Response.new([], status) # Build object to use status code helpers\n\n span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, sinatra_response.status)\n span.set_error(env['sinatra.error']) if sinatra_response.server_error?\n end\n\n if (headers = response[1])\n Sinatra::Headers.response_header_tags(headers, configuration[:headers][:response]).each do |name, value|\n span.set_tag(name, value) if span.get_tag(name).nil?\n end\n end\n end\n\n # Set analytics sample rate\n Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?\n\n # Measure service stats\n Contrib::Analytics.set_measured(span)\n end\n end\n end",
"def enable_logging(opts)\n opts[:AccessLog] = []\n level = WEBrick::Log.const_get(opts[:BridgetownOptions][\"verbose\"] ? :DEBUG : :WARN)\n opts[:Logger] = WEBrick::Log.new($stdout, level)\n end",
"def _roda_after_90__common_logger(result)\n return unless result && result[0] && result[1]\n\n env = @_request.env\n\n qs = env[\"QUERY_STRING\"]\n query_string = \"?#{ qs }\" unless qs.empty?\n\n length = result[1][\"Content-Length\"]\n length = \"\" if length == \"0\"\n\n LOGGER.request \"#{ env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_ADDR'] || '-' } - \\\"#{ env['REQUEST_METHOD'] } #{ env['SCRIPT_NAME'] }#{ env['PATH_INFO'] }#{ query_string } #{ env['HTTP_VERSION'] }\\\" #{ result[0] } #{ length }\\n\"\n end",
"def silence\n old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger\n yield\n ensure\n logger.level = old_logger_level if logger\n end",
"def configure_logging\n if env[:lager]\n env[:lager][:handlers] = {\n :lager_console_backend => :info,\n :lager_file_backend => [\n Tuple[(log + \"error.log\").expand_path.to_s, :error],\n Tuple[(log + \"console.log\").expand_path.to_s, :info]\n ]\n }\n env[:lager][:crash_log] = (log + \"crash.log\").to_s\n else\n # TODO: Need a better way to detect this, the defaults point\n # to 1.0-style configs. Maybe there should be some kind of\n # detection routine.\n # Use sasl error logger for 0.14.\n env[:riak_err] ||= {\n :term_max_size => 65536,\n :fmt_max_bytes => 65536\n }\n env[:sasl] = {\n :sasl_error_logger => Tuple[:file, (log + \"sasl-error.log\").expand_path.to_s],\n :errlog_type => :error,\n :error_logger_mf_dir => (log + \"sasl\").expand_path.to_s,\n :error_logger_mf_maxbytes => 10485760,\n :error_logger_mf_maxfiles => 5\n }\n end\n vm['-env ERL_CRASH_DUMP'] = (log + 'erl_crash.dump').to_s\n end",
"def default_logger\n self.logger = Logger.new(STDERR)\n\n if settings.service.debug_mode || $DEBUG\n logger.level = Logger::DEBUG\n else\n logger.level = Logger::INFO\n end\n\n logger\n end",
"def default_logger\n self.logger = Logger.new(STDERR)\n\n if settings.service.debug_mode || $DEBUG\n logger.level = Logger::DEBUG\n else\n logger.level = Logger::INFO\n end\n\n logger\n end",
"def logger=(v)\n @@logger = v\n end",
"def silence\n old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger\n yield\n ensure\n logger.level = old_logger_level if logger\n end",
"def on_request(env)\n logger.tagged(*tags) do\n logger.info { formatter.request(env) }\n logger.debug { formatter.request_body(env) }\n end\n end",
"def log_message(env, message)\n if env['rack.logger']\n env['rack.logger'].info(message)\n end\n end",
"def reset_logging\n\t\tRoninShell.reset_logger\n\tend",
"def logger\n params[:secure] ? nil : super\n end",
"def logger=(logger)\n @@logger = logger\n end",
"def logger=(logger)\n @@logger = logger\n end",
"def setup_logger\n @logger.auto_flushing = true \n end",
"def logger\n self[RACK_LOGGER]\n end",
"def attach_to(logger)\n logger.extend ActiveSupport::Logger.broadcast(ActiveSupport::Logger.new(self))\n end",
"def logger\n Rails.logger ||= ::Logger.new(STDOUT)\n @logger ||= Rails.logger\n end",
"def log= logger\n @log = logger\n end",
"def log= logger\n @log = logger\n end"
] | [
"0.71634567",
"0.64025956",
"0.62781805",
"0.625233",
"0.6141523",
"0.6118943",
"0.60816574",
"0.60214525",
"0.5861565",
"0.5838742",
"0.5827042",
"0.55783504",
"0.55778646",
"0.5565248",
"0.55591977",
"0.55004793",
"0.5494461",
"0.54341733",
"0.5421853",
"0.5365102",
"0.5357124",
"0.53399515",
"0.53361195",
"0.5326264",
"0.5312857",
"0.52879786",
"0.5270591",
"0.5270591",
"0.52688754",
"0.5264312",
"0.5252217",
"0.52085197",
"0.5205554",
"0.5191076",
"0.5191076",
"0.5188257",
"0.51880264",
"0.5174731",
"0.51679075",
"0.5167402",
"0.5167402",
"0.51668125",
"0.5166791",
"0.51549035",
"0.51388586",
"0.5136775",
"0.5136612",
"0.51318765",
"0.51259947",
"0.5119046",
"0.51116186",
"0.5110138",
"0.5106096",
"0.5099156",
"0.5097488",
"0.5046372",
"0.50158274",
"0.50125337",
"0.50111496",
"0.500363",
"0.4999969",
"0.4983547",
"0.4979066",
"0.4974857",
"0.4973957",
"0.4963827",
"0.4946852",
"0.4931923",
"0.49192476",
"0.49161574",
"0.49155104",
"0.49153683",
"0.49152303",
"0.4912178",
"0.4888243",
"0.4887251",
"0.48793042",
"0.48776758",
"0.48741534",
"0.4868291",
"0.48561496",
"0.48463002",
"0.48462817",
"0.4837342",
"0.48371553",
"0.48371553",
"0.48287892",
"0.48236927",
"0.48189402",
"0.48097825",
"0.480932",
"0.48093072",
"0.4807808",
"0.4807808",
"0.48077464",
"0.48038417",
"0.48015532",
"0.48012003",
"0.47994158",
"0.47994158"
] | 0.8096271 | 0 |
Count the number of passing cars on the road. full description: | def solution(a)
cars_going_east = [0]
a.each do |direction|
next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last
cars_going_east << next_counter
end
passings = 0
a.each_with_index do |direction, index|
passings += cars_going_east[index] if direction == 1
end
return -1 if passings > 1000000000
passings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def car_count\n self.cars.length\n end",
"def trip_count()\n self.trips().length()\n end",
"def get_wheel_count \n \t Car_wheel #Return number of wheels\n end",
"def show_cars_count\n puts \"cars count: #{cars.size}\"\n end",
"def number_of_rides(drivers)\n driver_list = []\n drivers.each do |driver|\n result = 0\n driver[:trips].each do |trip|\n details = trip[:details]\n result += details.length\n end\n driver_list << { driver_id: driver[:driver_id], count: result }\n end\n return driver_list\nend",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def show_cars_count\n puts \"cars count: #{self.cars.size}\"\n end",
"def trip_count\n trips.count\n end",
"def vehicle_count(req)\n @vehicle_count ||= vehicle_dao.count(dealership(req))\n end",
"def trip_count\n trips.length\nend",
"def trip_count\n self.trips.length\n end",
"def trip_count\n self.trips.length\n end",
"def trip_count\n trips.count\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def count \n trips.length\n end",
"def trip_count\n return self.trips.length\n end",
"def num_of_rides(driver_rides)\n return driver_rides.length\nend",
"def trip_count\n self.trips.size\n end",
"def count_occurrences(vehicles)\n occurences = {}\n\n vehicles.each do |vehicle|\n occurences[vehicle] = vehicles.count(vehicle)\n end\n\n occurences.each do |vehicle, count|\n puts \"#{vehicle} => #{count}\"\n end\nend",
"def trip_count\n self.trips.count\n end",
"def driver_ride_count(driver_id, rides)\n driver_rides = rides.select { |ride| ride [:driver_id] == driver_id }\n total_num_rides_for_driver = driver_rides.length\n puts \"Problem 1: #{driver_id}: #{total_num_rides_for_driver} rides\"\nend",
"def num_of_rides(trips)\n return trips.map do |driver, trip|\n \"Driver #{driver} made #{trip.length} rides\"\n end\nend",
"def get_num_rides(rides)\n return rides.length\nend",
"def count; end",
"def count; end",
"def count; end",
"def count_routes(n)\n\n\treturn 0\nend",
"def door_count; end",
"def count_distance(departure, arrival, sub)\n\tdeparture_line = get_station_line(sub, departure)\n\tarrival_line = get_station_line(sub, arrival)\n\n\tif departure_line.to_s == 'red_line'\n\t\tdistance_first = (get_station_no(sub, departure) - 2).abs\n\telse \n\t\tdistance_first = (get_station_no(sub, departure) - 3).abs\n\tend\n\t\n\tif arrival_line.to_s == 'red_line'\n\t\tdistance_second = (get_station_no(sub, arrival) - 2).abs\n\telse \n\t\tdistance_second = (get_station_no(sub, arrival) - 3).abs\n\tend\n\treturn distance_first + distance_second\n\nend",
"def find_res_count\n res_count = 0\n self.listings.each do |listing|\n res_count += listing.reservations.where(:status => \"accepted\").count\n end\n return res_count\n end",
"def count_road_networks(cities:)\n result = cities\n result % 663_224_321\nend",
"def count_occurrences(vehicles)\n occurrences = Hash.new(0)\n vehicles.each { |vehicle| occurrences[vehicle] += 1 }\n occurrences.each { |key, value| puts \"#{key} => #{value}\" }\nend",
"def dir_count(route, dir)\n route.count(dir)\nend",
"def route_count\n @routes.size\n end",
"def find_total_rides(rides)\n length = rides.length\n return length\nend",
"def route_count\n\t\treturn 0 if self.gis_region.nil?\n\t\tself.gis_region.geom2.size\n\tend",
"def total_active_vehicles\n @object.vehicles\n .where(make: @object, deleted_at: nil)\n .count\n end",
"def espacios_disponibles_carros\n Space.where(sp_state: false, sp_type: 'CARRO').count\n end",
"def numbers_of_planes\n\t\t@landed_planes.count \n\tend",
"def count\n end",
"def count\n end",
"def count_occurrences(vehicles)\n occur_count = Hash.new(0)\n vehicles.each { |str| occur_count[str.to_sym] += 1 }\n occur_count.each { |vehicle, count| puts \"#{vehicle} => #{count}\" }\nend",
"def count_occurrences(vehicles)\n vehicles.each_with_object(Hash.new(0)) do |vehicle, memo|\n memo[vehicle] += 1\n end\nend",
"def river_count\n return @fishes.count\nend",
"def count\n @count\n end",
"def get_driver_total_rides(drivers, driver_id)\n num_of_rides = drivers[driver_id].length\nend",
"def driver_ride_count(rides)\n ride_count = Hash.new{|hash, key| hash[key] = 0}\n\n rides.each do |ride|\n ride_count[ride[:driver_id]] += 1\n end\n\n return ride_count\nend",
"def head_count\n clients.map(&:headOfHousehold?).count(true)\n end",
"def flight_segment_tally\n all_flights.length\n end",
"def count_places\n COUNT_PLACES\n end",
"def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end",
"def robot_counter\n\n\tend",
"def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def num_lights\n\t\t\t@lights.length\n\t\tend",
"def count\n Jhead.call(\"-c\", @match, @pattern).split(\"\\n\").size\n end",
"def traversal_9\n num_occurances = 0\n Perpetuity[Address].all.to_a.each do |address|\n num_occurances += 1 if address.city.downcase.split('').first == address.city.downcase.split('').last\n end\n return num_occurances\nend",
"def ride_numbers(rideshare)\n# itirate through the values to find the number of rides for each driver\n rideshare.each do |driver, value|\n puts \"Driver #{driver} has given #{value.length} rides.\"\n end\nend",
"def total_orbit_count(orbit_map)\n count = 0\n orbit_map.each{|satellite, _|\n central_objects = orbit_count(orbit_map, satellite)\n # puts \"Satellite %s orbits %d objects\" % [satellite, central_objects]\n count += central_objects\n }\n count\nend",
"def count\n @count ||= 0\n @count += 1\n end",
"def count_listings\n listings.count\n end",
"def number_of_distinctions(login=nil)\n count_by_frbr(login, :receives, :how_many_distinction_instances?) \n end",
"def number_of_distinctions(login=nil)\n count_by_frbr(login, :receives, :how_many_distinction_instances?) \n end",
"def number_of_distinctions(login=nil)\n count_by_frbr(login, :receives, :how_many_distinction_instances?) \n end",
"def count\n @count ||= begin\n Grim.processor.count(@path)\n end\n end",
"def lots_count\t\t\n lots.count\n end",
"def food_count()\nreturn @stomach.count()\nend",
"def count_occ(usages_list)\n count = 0\n usages_list.each do |k,v|\n if k['location']['type'] == 'pipeline'\n count += 1\n end\n end\n return count\nend",
"def total_flights\n approved_flights.count\n end",
"def gpx_airport_count(gpx, airport_to_find)\n airports = Hash.from_xml(gpx).dig(\"gpx\", \"wpt\")\n count = airports.select{|a| a[\"description\"] == airport_to_find.city}.size\n end",
"def count_occurrences(vehicles)\n occurences = {}\n uniq_vehicles = Array.new(vehicles.uniq)\n\n uniq_vehicles.each do |vehicle|\n occurences[vehicle] = vehicles.count(vehicle)\n end\n occurences.each { |k, v| puts \"#{k} => #{v}\"}\nend",
"def count\n # implement in subclasses\n end",
"def count_reservations\n reservations.count\n end",
"def num_ships\n @grid.reduce(0) { |acc, el| acc + el.count(:S) }\n end",
"def total_paths(initial_s)\n reachable_stops(initial_s).count\n end",
"def count_passing\n return self.passing_tests.size\n end",
"def count_occurrences(vehicles)\n unique_vehicles = vehicles.uniq\n\n unique_vehicles.each do |vehicle|\n puts \"#{vehicle} => #{vehicles.count(vehicle)}\"\n end\nend",
"def hit_count()\n #This is a stub, used for indexing\n end",
"def count\n filtered = apply_criteria(@data)\n filtered.count\n end",
"def count\n\t\t\t\t# CPU count can change during the program runtime\n\t\t\t\tcpuinfo.count { |x| x.start_with?('processor') }\n\t\t\tend",
"def count_passing\n return self.passing_products.size\n end",
"def output_number_of_rides_per_driver(list_of_drivers = DRIVERS_INFO)\n list_of_drivers.each do |driver|\n puts \"Driver #{driver[:driver_id]} has given #{driver[:ride_info].length} rides.\"\n end\nend",
"def number_of_passengers\n @passengers.length\n end",
"def orbit_count(orbit_map, satellite)\n count = 0\n while satellite = orbit_map[satellite]\n count += 1\n end\n count\nend",
"def getNumCycles()\n return @numCycles\n end",
"def counting\n puts \"hard to do right\"\n end",
"def how_many_on_bus\n return @passengers.length\n end",
"def count_rulings(card)\n ruling_arr = scryfall.rulings(card['id']) \n \"(#{ruling_arr.length})\"\n end",
"def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend",
"def get_total_rides_per_driver(ride_data)\n number_of_rides = {}\n # access driver's IDs to be used as keys in hash \"ride_info\", then\n # access the cost of each ride per driver, to be the corresponding value\n ride_data.length.times do |driver_index|\n driver_id = ride_data[driver_index][:driver_id]\n rides = ride_data[driver_index][:rides].length\n number_of_rides[driver_id] = rides\n end\n return number_of_rides\nend",
"def counts\r\n @counts\r\n end",
"def average_flight_length\n\n sum = 0\n count = 0\n @query.get_graph.each_key do |city|\n route_dict = get_outgoing_routes(city)\n route_dict.each do |dest, dist|\n sum+=dist\n count+=1\n end\n end\n\n return sum/count\n\n end",
"def count\n number_of_trees + number_of_networks\n end",
"def count\n all.count\n end",
"def cc_count\n stats = self.association_stats\n stats['cc_conditions'] + stats['cc_loops'] + stats['cc_questions'] +\n stats['cc_sequences'] + stats['cc_statements']\n end",
"def kml_airport_count(kml, airport_to_find)\n airports = Hash.from_xml(kml).dig(\"kml\", \"Document\", \"Folder\").find{|f| f[\"name\"] == \"Airports\"}.dig(\"Placemark\")\n count = airports.select{|a| a[\"description\"] == airport_to_find.city}.size\n end"
] | [
"0.6860512",
"0.67320716",
"0.6729416",
"0.66576576",
"0.6645416",
"0.6618986",
"0.6618986",
"0.6618986",
"0.66113347",
"0.65965235",
"0.658764",
"0.6580772",
"0.6579321",
"0.6579321",
"0.6559062",
"0.65560126",
"0.65517515",
"0.65498126",
"0.65323883",
"0.6523612",
"0.6517517",
"0.65105104",
"0.6499743",
"0.64705384",
"0.64207536",
"0.64182377",
"0.6409782",
"0.6409782",
"0.6409782",
"0.638451",
"0.6379056",
"0.63622606",
"0.6345383",
"0.63451105",
"0.6336718",
"0.63287807",
"0.629381",
"0.62837833",
"0.6269876",
"0.6261458",
"0.6207867",
"0.6187065",
"0.61831254",
"0.61831254",
"0.615362",
"0.6152082",
"0.61312884",
"0.61194366",
"0.61067617",
"0.6103798",
"0.6089038",
"0.6076964",
"0.60671526",
"0.6065034",
"0.6061582",
"0.6049682",
"0.60337806",
"0.60337806",
"0.60337806",
"0.6025045",
"0.5995929",
"0.5990318",
"0.59894896",
"0.59892166",
"0.5983854",
"0.5978461",
"0.59747624",
"0.59747624",
"0.59747624",
"0.5973249",
"0.596877",
"0.5952873",
"0.5951041",
"0.5950854",
"0.5949285",
"0.5919952",
"0.5918424",
"0.59155416",
"0.5915078",
"0.5907641",
"0.5903815",
"0.59030014",
"0.5902776",
"0.58964616",
"0.58949095",
"0.5888414",
"0.5884593",
"0.58803475",
"0.58758515",
"0.5871714",
"0.58700806",
"0.5868311",
"0.5866502",
"0.5859846",
"0.5855605",
"0.5852174",
"0.5841626",
"0.5830799",
"0.5829031",
"0.5826893",
"0.5826587"
] | 0.0 | -1 |
Get details for a template property type Permissions Needed: ANY | def get_template_property_type(type, opts = {})
data, _status_code, _headers = get_template_property_type_with_http_info(type, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_template\n {}.tap do |access_properties|\n ACCESS_FIELDS.filter { |field, _cocina_field| changed?(field) }.each do |field, cocina_field|\n val = public_send(field)\n access_properties[cocina_field] = val.is_a?(String) ? val.presence : val # allow boolean false\n end\n end\n end",
"def index\n @allowed = false\n if check_permissions?(session[:user_type], \"create_property\")\n @allowed = true\n end\n @properties = Property.all\n end",
"def get_template_property_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TemplatesPropertiesApi.get_template_property_types ...\"\n end\n # resource path\n local_var_path = \"/templates/properties\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<PropertyFieldListResource>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesPropertiesApi#get_template_property_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def permissions\n attribute_prop(5)\n end",
"def text_permission\n return unless @user.loa3?\n\n dig_out('permissions', 'permission_type', VAProfile::Models::Permission::TEXT)\n end",
"def details(type, template_uuid)\n response = @client.get(\"editor/#{type}/templates/#{template_uuid}\")\n verify response,\n forbidden: 'You do not have permission to open the template',\n not_found: 'Template does not exist',\n internal_server_error: 'Internal server error occurred.'\n end",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def show\n @product_template = ProductTemplate.find(params[:id])\n @keys = @product_template.properties.keys\n @values = @product_template.properties.values\n end",
"def index\n @properties = Property.all\n authorize @properties\n end",
"def restapi_permission\n @attributes[:restapi_permission]\n end",
"def permission\n return @children['permission'][:value]\n end",
"def show\n @contact = Contact.find(params[:contact_id])\n @property = Property.find(params[:id])\n authorize @property\n end",
"def get_template_property_type_with_http_info(type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TemplatesPropertiesApi.get_template_property_type ...\"\n end\n # verify the required parameter 'type' is set\n if @api_client.config.client_side_validation && type.nil?\n fail ArgumentError, \"Missing the required parameter 'type' when calling TemplatesPropertiesApi.get_template_property_type\"\n end\n # resource path\n local_var_path = \"/templates/properties/{type}\".sub('{' + 'type' + '}', type.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PropertyFieldListResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesPropertiesApi#get_template_property_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def authorize_can_read_issuable!\n action = [:read_, params[:template_type]].join\n\n authorize_action!(action)\n end",
"def permissions?\n proprieties[:permissions]\n end",
"def get_properties()\n resp = conn.get('/users/'+name+'/props/')\n \n case resp.code.to_i\n when 200\n return JSON.parse(resp.body)\n when 404\n raise RestAuthUserNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( rest )\n end\n end",
"def get_allowed_property_details\n allowed_property_details = []\n selectable_property_details = PropertyDetail.where(:selectable => true)\n selectable_property_details.each do |pd|\n allowed_property_details.push(pd[:msgid])\n end\n\n return allowed_property_details\n end",
"def permissions_info(sco_id, filter = nil)\n res = query(\"permissions-info\", \"acl-id\" => sco_id, \"filter\" => filter)\n\n return res.body\n data = XmlSimple.xml_in(res.body)\n if data['permissions'][0]\n return data['permissions'][0]\n end\n #puts YAML::dump(data)\n# if data[\"sco\"][0]\n# return data[\"sco\"][0]\n# end\n end",
"def get_fields(template); end",
"def role\n permission_type\n end",
"def permissions\n read_attribute(:permissions) || {}\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def index\n properties = current_user.properties\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json(properties)) }\n format.xml { render :xml => properties_to_xml(properties) }\n format.text { render :text => text_not_supported }\n end\n end",
"def index\n authorize_action_for Property, at: current_store\n @properties = current_store.properties\n end",
"def can_modify_templates?\n perms.include? Perm.modify_templates\n end",
"def get_fields(template)\n read(template).fields\n end",
"def typus_template(attribute)\n options = read_model_config['fields']['options']\n if options && options['templates'] && options['templates'][attribute.to_s]\n options['templates'][attribute.to_s]\n end\n end",
"def fields\n properties.keys.map(&:to_sym).reject{ |x| x == :type }\n end",
"def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'template'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Policy Templates:\", :style => :table)\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def get_property( propname )\n resp = conn.get('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property'\n raise RestAuthPropertyNotFound.new( resp )\n else\n raise RestAuthBadResponse.new( resp, \"Received 404 without Resource-Type header\" )\n end\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def solr_field_for(permission_type, permission_category)\n permissions = Hydra.config.permissions[permission_type.to_sym]\n permission_category == 'group' ? permissions.group : permissions.individual\n end",
"def permissions = {}",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def value\n send property.type_field\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def get_item_template\n get_type_template(@source.types)\n end",
"def can_modify_templates?\n self.perms.include? Perm.modify_templates\n end",
"def details(entity)\n details_by_type_and_name(entity.properties[:type], entity.properties[:name])\n end",
"def permissions\n @resource_permissions\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def index\n properties = current_user.properties\n\n if properties.any?\n render status: 200, json: { properties: properties.to_json }\n else\n render status: 404, json: { error: 'You have no properties' }\n end\n end",
"def security_type\n SecurityType.find_by_type self[:type]\n end",
"def provision_attachments_permission\n @attributes[:provision_attachments_permission]\n end",
"def chargeable_profiles\n acl_entries.where(role: [:charge, :edit]).map(&:subject)\n end",
"def attachments_permission\n @attributes[:attachments_permission]\n end",
"def attachments_permission\n @attributes[:attachments_permission]\n end",
"def index\n @contact_properties = @active_org.contact_properties\n\n if current_person.has_role?(:super_admin)\n @contact_properties = ContactProperty.all\n end\n end",
"def permissions\n Roles.type_map[role_type].permissions\n end",
"def permissions\n return @permissions\n end",
"def show\n @permissions = @role.permissions\n end",
"def show?\n user.can_modify_templates? && (phase.template.org_id == user.org_id)\n end",
"def get_restriction_types\n get_restrictions_data['types']\n end",
"def show\n property = Property.by_key(params[:id], nil, current_user.id)\n if property\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json([property])) }\n format.xml { render :xml => properties_to_xml([property]) }\n format.text { render :text => text_not_supported }\n end\n else\n render_error('Not found', 404)\n end\n end",
"def index\n if @property.nil? || @property.user.id != @user.id\n redirect_to properties_path, notice: \"Not Authorized\" \n end\n end",
"def attributes\n permissions.select { |k, v| v.present? }.as_json\n end",
"def permissions\n [\"read_permissions\", \"update_permissions\", \"delete_permissions\"].each do |p|\n perms = self.send(p)\n perm_string = []\n AssetPermission::GROUP.each do |g, v|\n if perms & AssetPermission::GROUP[g] > 0\n perm_string << g\n end\n end\n puts \"#{self.name}: #{p}: #{perm_string.join(',')}\"\n end\n end",
"def protection_type\n @descriptive_detail.protection_type\n end",
"def provision_ftp_permission\n @attributes[:provision_ftp_permission]\n end",
"def properties\n model.properties\n end",
"def ftp_permission\n @attributes[:ftp_permission]\n end",
"def ftp_permission\n @attributes[:ftp_permission]\n end",
"def index\n @properties = ((current_person== current_admin)? Property.all : Property.where(user:current_person)).paginate(:page => params[:page], :per_page => 3)\n\n end",
"def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end",
"def index\n @auth_properties = AuthProperty.all\n end",
"def resourceType\n 'Person'\n end",
"def type\n @props[:type]\n end",
"def show\n authorize_action_for @property, at: current_store\n\n respond_to do |format|\n format.json { render json: @property.product_properties, status: 200 }\n format.html\n end\n end",
"def check_privilege(type)\n\nif type.floor == 1\n\t\"seller\"\n\nelsif type.floor == 2\n\t\"manager\"\n\nelsif type.floor == 3 \n\t\"admin\"\n\nelse \n \t\"user\"\n\n\tend\nend",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def objects_with_permission(type, permission)\n raise Exceptions::NotACanHazObject unless type.respond_to?(:acts_as_canhaz_object)\n permissions = self.permissions.where(:permission => permission.to_s, :type => type.to_s)\n type.in(:id => permissions.collect(&:cobject_id))\n end",
"def get_permissions permissions_ds\n # default to rightsMetadata (like standard Hydra) if permissions_ds isn't set\n permissions_ds = \"rightsMetadata\" if permissions_ds.to_s == \"\"\n (datastreams[permissions_ds].groups.map {|x| {:type=>'group', :access=>x[1], :name=>x[0] }} + \n datastreams[permissions_ds].individuals.map {|x| {:type=>'user', :access=>x[1], :name=>x[0]}})\n\n (datastreams[permissions_ds].groups.map {|x| {:type=>'group', :access=>x[1], :name=>x[0] }} + \n datastreams[permissions_ds].individuals.map {|x| {:type=>'user', :access=>x[1], :name=>x[0]}})\n end",
"def show\n authorize @service_template\n end",
"def check_privilege(type=0)\n # if type is greater than equal to 0, display all types or just the last\n\n if type >= 0\n $user_types[type] || $user_types.last\n else\n $user_types.first\n end\nend",
"def get_resource_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'resource_tpl' }.any? }\n end",
"def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end",
"def customized_properties\n current_resource.info['properties'].select do |_k, v|\n v['is_set'] == true\n end\n end",
"def permission\n Ricer::Irc::Permission.by_permission(self.permissions, authenticated?)\n end",
"def get_additionals\n return Additional.find(:all, :conditions => [\"type_id = ? AND owner = ?\", self.id, 'property'])\n end",
"def show\n @user = User.find(params[:id])\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n @can_edit = can_edit_hash[:has_permission]\n\n #max needs\n @can_see_pref= Permissions.is_at_least_manager(@current_user)\n\n profile_attrs = [:first_name,:last_name, :email,:phone_number]\n @first_name = @user.first_name\n @last_name = @user.last_name\n @email = @user.email\n @phone_number = @user.phone_number\n @role = @user.role\n end",
"def your_project_access_type policy = nil, resource = nil\n unless policy.nil? or resource.nil? or !(policy.sharing_scope == Policy::ALL_SYSMO_USERS)\n unless policy.permissions.empty?\n my_project_ids = if resource.class == Project then [resource.id] else resource.project_ids end\n my_project_perms = policy.permissions.select {|p| p.contributor_type == 'Project' and my_project_ids.include? p.contributor_id}\n access_types = my_project_perms.map(&:access_type)\n return access_types.first if access_types.all?{|acc| acc == access_types.first}\n else\n policy.access_type\n end\n end\n end",
"def extractToolkitPropertyInfo( propertyMacro )\n\n # Extract the property name, type\n property = $propertyStruct.new;\n\n # Split the macro definition by comma and quotes, close bracket and delete any empty segments\n data = propertyMacro.split(/[\\s,\")]/).reject { |s| s.empty? }\n\n if(data[1] == \"PropertyRegistration\")\n\n # Properties defined in Control using PropertyRegistration\n # const PropertyRegistration Control::Impl::PROPERTY_1(typeRegistration, \"styleName\", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty);\n\n # Creates an array of strings that looks like this:\n # const 0\n # PropertyRegistration 1\n # Control::Impl::PROPERTY_1 2\n # typeRegistration 3\n # styleName 4\n # Toolkit::Control::Property::STYLE_NAME 5\n # Property::STRING 6\n # &Control::Impl::SetProperty 7\n # &Control::Impl::GetProperty 8\n #\n\n property.name = data[4]\n\n propertyType = data[6].rpartition(\"::\")\n property.type = propertyType[2]\n\n propertyEnum = data[5].rpartition(\"::\")\n property.enum = propertyEnum[2]\n\n else\n\n # Properties defined in macro DALI_PROPERTY_REGISTRATION or DALI_ANIMATABLE_PROPERTY_REGISTRATION or DALI_CHILD_PROPERTY_REGISTRATION\n # or DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT:\n # DALI_PROPERTY_REGISTRATION(Toolkit, TextLabel, \"multiLine\", BOOLEAN, MULTI_LINE)\n # DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, ImageView, \"pixelArea\", Vector4(0.f, 0.f, 1.f, 1.f), PIXEL_AREA)\n\n # Creates an array of strings that looks like this:\n # DALI_PROPERTY_REGISTRATION( 0\n # Toolkit 1\n # PageTurnView 2\n # pageSize 3\n # VECTOR2 4\n # PAGE_SIZE 5\n #\n\n property.name = data[3]\n\n #puts property.name\n if property.name == \"image\"\n property.name = \"imageMap\"\n end\n\n if( data[0] == \"DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(\" )\n # TODO: Need to work out the property type from the value\n property.type = \"VECTOR4\"\n else\n property.type = data[4]\n end\n\n property.enum = data[data.length-1]\n\n end\n\n # e.g. turn styleName into StyleName\n property.name[0] = property.name[0].capitalize\n\n property.writable = true\n property.animatable = false\n property.constrainInput = false\n property.childProperty = false;\n\n # check to see if it's a child property\n if( data[0] == \"DALI_CHILD_PROPERTY_REGISTRATION(\" )\n #puts(\" #{property.name} is child property \")\n property.childProperty = true;\n end\n if( data[0] == \"DALI_ANIMATABLE_PROPERTY_REGISTRATION(\" )\n #puts(\" #{property.name} is animatable\")\n property.animatable = true;\n end\n\n return property;\nend",
"def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end",
"def getPropertyStatementDisplay(statement, property_uri, property_domain_uri, property_range_uri, property_type, partial_name, property_template_name, property_collated_by_subclass = false)\n \n display_statement_values = \"\"\n # Data property default\n if(statement.has_key?(\"value\") and statement[\"value\"] != nil and statement[\"value\"].gsub(/\\s+/, \"\") != \"\")\n \n Rails.logger.debug(\"Property #{property_uri.inspect} and data PROP and partial not nil #{partial_name.inspect}\")\n display_statement_values= render(partial: partial_name, locals: {statement: statement,\n property_uri: property_uri,\n property_domain_uri: property_domain_uri,\n property_range_uri: property_range_uri,\n property_type: property_type, property_template_name: property_template_name})\n \n \n \n \n end #if statement.has_key\n # if object, we may be in for a different situation\n if(property_type == \"object\" and statement.has_key?(\"allData\")) \n # Print out all the data\n display_statement_values = render(partial: partial_name, locals: {statement: statement,\n property_uri: property_uri,\n property_domain_uri: property_domain_uri,\n property_range_uri: property_range_uri,\n property_type: property_type, property_template_name: property_template_name, property_collated_by_subclass: property_collated_by_subclass})\n \n end\n \n return display_statement_values\n end",
"def index\n @request_properties = current_user.request_property\n end",
"def billing_permission\n @attributes[:billing_permission]\n end",
"def provision_sftp_permission\n @attributes[:provision_sftp_permission]\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def get_by_type(type)\r\n facts2typerule = {:methodcall => [:cant_access, :can_access],\r\n :inheritance => [:cant_extend, :can_extend],\r\n :objcreation => [:cant_create, :can_create]}\r\n\r\n find_all { |x| facts2typerule[type].index(x.type_interaction) != nil }\r\n end",
"def index\n authorize @organization, :show_templates?\n @survey_templates = @organization.survey_templates\n end",
"def person_type\n \"Member\"\n end",
"def fetch_permissions(property_id)\n fetcher = Commands::PropertyPermissionsFetcher.new(credentials)\n fetcher.call(property_id)\n end",
"def detect_properties\n @record.send( :\"#{@column}_content_type=\", `file -bp --mime-type '#{access_path}'`.to_s.strip )\n @record.send( :\"#{@column}_size=\", File.size(access_path) )\n rescue NoMethodError\n nil\n end",
"def read_persons\n read_individual_field = Hydra.config[:permissions][:read][:individual]\n rp = edit_persons | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_individual_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_individual_field,nil))\n logger.debug(\"read_persons: #{rp.inspect}\")\n return rp\n end",
"def typus_template(attribute)\n Typus::Configuration.config[name]['fields']['options']['templates'][attribute.to_s]\n rescue\n nil\n end",
"def path_template\n @attributes[:path_template]\n end",
"def get_template\n @template\n end",
"def access_type\n @access_type\n end"
] | [
"0.6134419",
"0.6087035",
"0.59920925",
"0.59625494",
"0.58938503",
"0.57929164",
"0.5756724",
"0.5756724",
"0.57075584",
"0.5689722",
"0.56670845",
"0.5659848",
"0.5657019",
"0.5616952",
"0.5610074",
"0.5523179",
"0.55164677",
"0.5485348",
"0.5463742",
"0.5445267",
"0.5436665",
"0.54214823",
"0.5410461",
"0.5406278",
"0.5391634",
"0.5388135",
"0.53800493",
"0.53668195",
"0.53629667",
"0.5360954",
"0.5358266",
"0.5348436",
"0.53327566",
"0.5331058",
"0.53128666",
"0.5311891",
"0.5307329",
"0.5295257",
"0.5286327",
"0.52522224",
"0.52508783",
"0.52486056",
"0.52486056",
"0.5244083",
"0.52045447",
"0.52009577",
"0.5198128",
"0.5186375",
"0.5186375",
"0.51833177",
"0.5177191",
"0.51572317",
"0.5144043",
"0.5142979",
"0.5133031",
"0.51312596",
"0.51205397",
"0.51180476",
"0.51084715",
"0.51074463",
"0.5103324",
"0.507828",
"0.5077922",
"0.5077922",
"0.5070892",
"0.5068366",
"0.50683326",
"0.5058408",
"0.5041902",
"0.5040674",
"0.5023702",
"0.50232524",
"0.50163126",
"0.5015779",
"0.5011777",
"0.50115305",
"0.5010349",
"0.5008424",
"0.500661",
"0.4998645",
"0.49965298",
"0.4994893",
"0.4994694",
"0.49861324",
"0.49826252",
"0.49821195",
"0.49787802",
"0.49777153",
"0.4975636",
"0.49754888",
"0.49752384",
"0.49750993",
"0.49737877",
"0.497327",
"0.497076",
"0.49687266",
"0.49534705",
"0.49529332",
"0.49479032",
"0.49453843",
"0.49436307"
] | 0.0 | -1 |
Get details for a template property type Permissions Needed: ANY | def get_template_property_type_with_http_info(type, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: TemplatesPropertiesApi.get_template_property_type ..."
end
# verify the required parameter 'type' is set
if @api_client.config.client_side_validation && type.nil?
fail ArgumentError, "Missing the required parameter 'type' when calling TemplatesPropertiesApi.get_template_property_type"
end
# resource path
local_var_path = "/templates/properties/{type}".sub('{' + 'type' + '}', type.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'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
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 => 'PropertyFieldListResource')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TemplatesPropertiesApi#get_template_property_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_template\n {}.tap do |access_properties|\n ACCESS_FIELDS.filter { |field, _cocina_field| changed?(field) }.each do |field, cocina_field|\n val = public_send(field)\n access_properties[cocina_field] = val.is_a?(String) ? val.presence : val # allow boolean false\n end\n end\n end",
"def index\n @allowed = false\n if check_permissions?(session[:user_type], \"create_property\")\n @allowed = true\n end\n @properties = Property.all\n end",
"def get_template_property_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TemplatesPropertiesApi.get_template_property_types ...\"\n end\n # resource path\n local_var_path = \"/templates/properties\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<PropertyFieldListResource>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesPropertiesApi#get_template_property_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def permissions\n attribute_prop(5)\n end",
"def text_permission\n return unless @user.loa3?\n\n dig_out('permissions', 'permission_type', VAProfile::Models::Permission::TEXT)\n end",
"def details(type, template_uuid)\n response = @client.get(\"editor/#{type}/templates/#{template_uuid}\")\n verify response,\n forbidden: 'You do not have permission to open the template',\n not_found: 'Template does not exist',\n internal_server_error: 'Internal server error occurred.'\n end",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def show\n @product_template = ProductTemplate.find(params[:id])\n @keys = @product_template.properties.keys\n @values = @product_template.properties.values\n end",
"def index\n @properties = Property.all\n authorize @properties\n end",
"def restapi_permission\n @attributes[:restapi_permission]\n end",
"def permission\n return @children['permission'][:value]\n end",
"def show\n @contact = Contact.find(params[:contact_id])\n @property = Property.find(params[:id])\n authorize @property\n end",
"def authorize_can_read_issuable!\n action = [:read_, params[:template_type]].join\n\n authorize_action!(action)\n end",
"def permissions?\n proprieties[:permissions]\n end",
"def get_properties()\n resp = conn.get('/users/'+name+'/props/')\n \n case resp.code.to_i\n when 200\n return JSON.parse(resp.body)\n when 404\n raise RestAuthUserNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( rest )\n end\n end",
"def get_allowed_property_details\n allowed_property_details = []\n selectable_property_details = PropertyDetail.where(:selectable => true)\n selectable_property_details.each do |pd|\n allowed_property_details.push(pd[:msgid])\n end\n\n return allowed_property_details\n end",
"def permissions_info(sco_id, filter = nil)\n res = query(\"permissions-info\", \"acl-id\" => sco_id, \"filter\" => filter)\n\n return res.body\n data = XmlSimple.xml_in(res.body)\n if data['permissions'][0]\n return data['permissions'][0]\n end\n #puts YAML::dump(data)\n# if data[\"sco\"][0]\n# return data[\"sco\"][0]\n# end\n end",
"def get_fields(template); end",
"def role\n permission_type\n end",
"def permissions\n read_attribute(:permissions) || {}\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def index\n properties = current_user.properties\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json(properties)) }\n format.xml { render :xml => properties_to_xml(properties) }\n format.text { render :text => text_not_supported }\n end\n end",
"def index\n authorize_action_for Property, at: current_store\n @properties = current_store.properties\n end",
"def can_modify_templates?\n perms.include? Perm.modify_templates\n end",
"def get_fields(template)\n read(template).fields\n end",
"def typus_template(attribute)\n options = read_model_config['fields']['options']\n if options && options['templates'] && options['templates'][attribute.to_s]\n options['templates'][attribute.to_s]\n end\n end",
"def fields\n properties.keys.map(&:to_sym).reject{ |x| x == :type }\n end",
"def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'template'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Policy Templates:\", :style => :table)\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def get_property( propname )\n resp = conn.get('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property'\n raise RestAuthPropertyNotFound.new( resp )\n else\n raise RestAuthBadResponse.new( resp, \"Received 404 without Resource-Type header\" )\n end\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def solr_field_for(permission_type, permission_category)\n permissions = Hydra.config.permissions[permission_type.to_sym]\n permission_category == 'group' ? permissions.group : permissions.individual\n end",
"def permissions = {}",
"def value\n send property.type_field\n end",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def get_item_template\n get_type_template(@source.types)\n end",
"def can_modify_templates?\n self.perms.include? Perm.modify_templates\n end",
"def details(entity)\n details_by_type_and_name(entity.properties[:type], entity.properties[:name])\n end",
"def permissions\n @resource_permissions\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def index\n properties = current_user.properties\n\n if properties.any?\n render status: 200, json: { properties: properties.to_json }\n else\n render status: 404, json: { error: 'You have no properties' }\n end\n end",
"def security_type\n SecurityType.find_by_type self[:type]\n end",
"def provision_attachments_permission\n @attributes[:provision_attachments_permission]\n end",
"def chargeable_profiles\n acl_entries.where(role: [:charge, :edit]).map(&:subject)\n end",
"def index\n @contact_properties = @active_org.contact_properties\n\n if current_person.has_role?(:super_admin)\n @contact_properties = ContactProperty.all\n end\n end",
"def attachments_permission\n @attributes[:attachments_permission]\n end",
"def attachments_permission\n @attributes[:attachments_permission]\n end",
"def permissions\n Roles.type_map[role_type].permissions\n end",
"def permissions\n return @permissions\n end",
"def show\n @permissions = @role.permissions\n end",
"def show?\n user.can_modify_templates? && (phase.template.org_id == user.org_id)\n end",
"def show\n property = Property.by_key(params[:id], nil, current_user.id)\n if property\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json([property])) }\n format.xml { render :xml => properties_to_xml([property]) }\n format.text { render :text => text_not_supported }\n end\n else\n render_error('Not found', 404)\n end\n end",
"def get_restriction_types\n get_restrictions_data['types']\n end",
"def index\n if @property.nil? || @property.user.id != @user.id\n redirect_to properties_path, notice: \"Not Authorized\" \n end\n end",
"def attributes\n permissions.select { |k, v| v.present? }.as_json\n end",
"def protection_type\n @descriptive_detail.protection_type\n end",
"def permissions\n [\"read_permissions\", \"update_permissions\", \"delete_permissions\"].each do |p|\n perms = self.send(p)\n perm_string = []\n AssetPermission::GROUP.each do |g, v|\n if perms & AssetPermission::GROUP[g] > 0\n perm_string << g\n end\n end\n puts \"#{self.name}: #{p}: #{perm_string.join(',')}\"\n end\n end",
"def provision_ftp_permission\n @attributes[:provision_ftp_permission]\n end",
"def properties\n model.properties\n end",
"def ftp_permission\n @attributes[:ftp_permission]\n end",
"def ftp_permission\n @attributes[:ftp_permission]\n end",
"def index\n @properties = ((current_person== current_admin)? Property.all : Property.where(user:current_person)).paginate(:page => params[:page], :per_page => 3)\n\n end",
"def index\n @auth_properties = AuthProperty.all\n end",
"def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end",
"def resourceType\n 'Person'\n end",
"def show\n authorize_action_for @property, at: current_store\n\n respond_to do |format|\n format.json { render json: @property.product_properties, status: 200 }\n format.html\n end\n end",
"def type\n @props[:type]\n end",
"def check_privilege(type)\n\nif type.floor == 1\n\t\"seller\"\n\nelsif type.floor == 2\n\t\"manager\"\n\nelsif type.floor == 3 \n\t\"admin\"\n\nelse \n \t\"user\"\n\n\tend\nend",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def objects_with_permission(type, permission)\n raise Exceptions::NotACanHazObject unless type.respond_to?(:acts_as_canhaz_object)\n permissions = self.permissions.where(:permission => permission.to_s, :type => type.to_s)\n type.in(:id => permissions.collect(&:cobject_id))\n end",
"def get_permissions permissions_ds\n # default to rightsMetadata (like standard Hydra) if permissions_ds isn't set\n permissions_ds = \"rightsMetadata\" if permissions_ds.to_s == \"\"\n (datastreams[permissions_ds].groups.map {|x| {:type=>'group', :access=>x[1], :name=>x[0] }} + \n datastreams[permissions_ds].individuals.map {|x| {:type=>'user', :access=>x[1], :name=>x[0]}})\n\n (datastreams[permissions_ds].groups.map {|x| {:type=>'group', :access=>x[1], :name=>x[0] }} + \n datastreams[permissions_ds].individuals.map {|x| {:type=>'user', :access=>x[1], :name=>x[0]}})\n end",
"def check_privilege(type=0)\n # if type is greater than equal to 0, display all types or just the last\n\n if type >= 0\n $user_types[type] || $user_types.last\n else\n $user_types.first\n end\nend",
"def get_resource_templates\n @model.get.mixins.select { |mixin| mixin.related.select { |rel| rel.end_with? 'resource_tpl' }.any? }\n end",
"def show\n authorize @service_template\n end",
"def customized_properties\n current_resource.info['properties'].select do |_k, v|\n v['is_set'] == true\n end\n end",
"def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end",
"def get_additionals\n return Additional.find(:all, :conditions => [\"type_id = ? AND owner = ?\", self.id, 'property'])\n end",
"def permission\n Ricer::Irc::Permission.by_permission(self.permissions, authenticated?)\n end",
"def show\n @user = User.find(params[:id])\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n @can_edit = can_edit_hash[:has_permission]\n\n #max needs\n @can_see_pref= Permissions.is_at_least_manager(@current_user)\n\n profile_attrs = [:first_name,:last_name, :email,:phone_number]\n @first_name = @user.first_name\n @last_name = @user.last_name\n @email = @user.email\n @phone_number = @user.phone_number\n @role = @user.role\n end",
"def your_project_access_type policy = nil, resource = nil\n unless policy.nil? or resource.nil? or !(policy.sharing_scope == Policy::ALL_SYSMO_USERS)\n unless policy.permissions.empty?\n my_project_ids = if resource.class == Project then [resource.id] else resource.project_ids end\n my_project_perms = policy.permissions.select {|p| p.contributor_type == 'Project' and my_project_ids.include? p.contributor_id}\n access_types = my_project_perms.map(&:access_type)\n return access_types.first if access_types.all?{|acc| acc == access_types.first}\n else\n policy.access_type\n end\n end\n end",
"def extractToolkitPropertyInfo( propertyMacro )\n\n # Extract the property name, type\n property = $propertyStruct.new;\n\n # Split the macro definition by comma and quotes, close bracket and delete any empty segments\n data = propertyMacro.split(/[\\s,\")]/).reject { |s| s.empty? }\n\n if(data[1] == \"PropertyRegistration\")\n\n # Properties defined in Control using PropertyRegistration\n # const PropertyRegistration Control::Impl::PROPERTY_1(typeRegistration, \"styleName\", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty);\n\n # Creates an array of strings that looks like this:\n # const 0\n # PropertyRegistration 1\n # Control::Impl::PROPERTY_1 2\n # typeRegistration 3\n # styleName 4\n # Toolkit::Control::Property::STYLE_NAME 5\n # Property::STRING 6\n # &Control::Impl::SetProperty 7\n # &Control::Impl::GetProperty 8\n #\n\n property.name = data[4]\n\n propertyType = data[6].rpartition(\"::\")\n property.type = propertyType[2]\n\n propertyEnum = data[5].rpartition(\"::\")\n property.enum = propertyEnum[2]\n\n else\n\n # Properties defined in macro DALI_PROPERTY_REGISTRATION or DALI_ANIMATABLE_PROPERTY_REGISTRATION or DALI_CHILD_PROPERTY_REGISTRATION\n # or DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT:\n # DALI_PROPERTY_REGISTRATION(Toolkit, TextLabel, \"multiLine\", BOOLEAN, MULTI_LINE)\n # DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, ImageView, \"pixelArea\", Vector4(0.f, 0.f, 1.f, 1.f), PIXEL_AREA)\n\n # Creates an array of strings that looks like this:\n # DALI_PROPERTY_REGISTRATION( 0\n # Toolkit 1\n # PageTurnView 2\n # pageSize 3\n # VECTOR2 4\n # PAGE_SIZE 5\n #\n\n property.name = data[3]\n\n #puts property.name\n if property.name == \"image\"\n property.name = \"imageMap\"\n end\n\n if( data[0] == \"DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(\" )\n # TODO: Need to work out the property type from the value\n property.type = \"VECTOR4\"\n else\n property.type = data[4]\n end\n\n property.enum = data[data.length-1]\n\n end\n\n # e.g. turn styleName into StyleName\n property.name[0] = property.name[0].capitalize\n\n property.writable = true\n property.animatable = false\n property.constrainInput = false\n property.childProperty = false;\n\n # check to see if it's a child property\n if( data[0] == \"DALI_CHILD_PROPERTY_REGISTRATION(\" )\n #puts(\" #{property.name} is child property \")\n property.childProperty = true;\n end\n if( data[0] == \"DALI_ANIMATABLE_PROPERTY_REGISTRATION(\" )\n #puts(\" #{property.name} is animatable\")\n property.animatable = true;\n end\n\n return property;\nend",
"def getPropertyStatementDisplay(statement, property_uri, property_domain_uri, property_range_uri, property_type, partial_name, property_template_name, property_collated_by_subclass = false)\n \n display_statement_values = \"\"\n # Data property default\n if(statement.has_key?(\"value\") and statement[\"value\"] != nil and statement[\"value\"].gsub(/\\s+/, \"\") != \"\")\n \n Rails.logger.debug(\"Property #{property_uri.inspect} and data PROP and partial not nil #{partial_name.inspect}\")\n display_statement_values= render(partial: partial_name, locals: {statement: statement,\n property_uri: property_uri,\n property_domain_uri: property_domain_uri,\n property_range_uri: property_range_uri,\n property_type: property_type, property_template_name: property_template_name})\n \n \n \n \n end #if statement.has_key\n # if object, we may be in for a different situation\n if(property_type == \"object\" and statement.has_key?(\"allData\")) \n # Print out all the data\n display_statement_values = render(partial: partial_name, locals: {statement: statement,\n property_uri: property_uri,\n property_domain_uri: property_domain_uri,\n property_range_uri: property_range_uri,\n property_type: property_type, property_template_name: property_template_name, property_collated_by_subclass: property_collated_by_subclass})\n \n end\n \n return display_statement_values\n end",
"def index\n @request_properties = current_user.request_property\n end",
"def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end",
"def billing_permission\n @attributes[:billing_permission]\n end",
"def get_by_type(type)\r\n facts2typerule = {:methodcall => [:cant_access, :can_access],\r\n :inheritance => [:cant_extend, :can_extend],\r\n :objcreation => [:cant_create, :can_create]}\r\n\r\n find_all { |x| facts2typerule[type].index(x.type_interaction) != nil }\r\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def provision_sftp_permission\n @attributes[:provision_sftp_permission]\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def person_type\n \"Member\"\n end",
"def fetch_permissions(property_id)\n fetcher = Commands::PropertyPermissionsFetcher.new(credentials)\n fetcher.call(property_id)\n end",
"def index\n authorize @organization, :show_templates?\n @survey_templates = @organization.survey_templates\n end",
"def detect_properties\n @record.send( :\"#{@column}_content_type=\", `file -bp --mime-type '#{access_path}'`.to_s.strip )\n @record.send( :\"#{@column}_size=\", File.size(access_path) )\n rescue NoMethodError\n nil\n end",
"def read_persons\n read_individual_field = Hydra.config[:permissions][:read][:individual]\n rp = edit_persons | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_individual_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_individual_field,nil))\n logger.debug(\"read_persons: #{rp.inspect}\")\n return rp\n end",
"def typus_template(attribute)\n Typus::Configuration.config[name]['fields']['options']['templates'][attribute.to_s]\n rescue\n nil\n end",
"def path_template\n @attributes[:path_template]\n end",
"def get_template\n @template\n end",
"def access_type\n @access_type\n end"
] | [
"0.61345625",
"0.6087644",
"0.5993657",
"0.59618616",
"0.58932936",
"0.5791299",
"0.57545334",
"0.57545334",
"0.57087237",
"0.56903917",
"0.5666722",
"0.56589675",
"0.56586355",
"0.56090534",
"0.55225",
"0.55185336",
"0.54879344",
"0.5463464",
"0.54444635",
"0.5435505",
"0.54193753",
"0.5409225",
"0.5406481",
"0.53929555",
"0.5385941",
"0.5379218",
"0.5366872",
"0.5364139",
"0.53592676",
"0.5357168",
"0.5352259",
"0.53325146",
"0.5328526",
"0.5314539",
"0.531225",
"0.5306588",
"0.52947664",
"0.5284142",
"0.52545816",
"0.52491695",
"0.5246771",
"0.5246771",
"0.5244651",
"0.52047783",
"0.519976",
"0.51975733",
"0.51849896",
"0.51849097",
"0.51849097",
"0.5175292",
"0.51551193",
"0.5143471",
"0.5142114",
"0.5134124",
"0.5132021",
"0.51218766",
"0.51164556",
"0.5107656",
"0.51065785",
"0.5102484",
"0.5080301",
"0.5077002",
"0.5077002",
"0.5072639",
"0.5069439",
"0.5066924",
"0.5059321",
"0.5043034",
"0.5042798",
"0.5024184",
"0.5022026",
"0.50137365",
"0.5013357",
"0.50117004",
"0.5010793",
"0.501052",
"0.5008366",
"0.50064236",
"0.49980313",
"0.4997129",
"0.4995625",
"0.49935338",
"0.49889144",
"0.49841514",
"0.49799702",
"0.4979852",
"0.49765944",
"0.49754164",
"0.4975399",
"0.4975264",
"0.49738196",
"0.49736002",
"0.4972004",
"0.49712732",
"0.49700105",
"0.49532455",
"0.4953205",
"0.49472687",
"0.49450558",
"0.49421704"
] | 0.5619775 | 13 |
List template property types Permissions Needed: ANY | def get_template_property_types(opts = {})
data, _status_code, _headers = get_template_property_types_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permissions\n attribute_prop(5)\n end",
"def index\n @allowed = false\n if check_permissions?(session[:user_type], \"create_property\")\n @allowed = true\n end\n @properties = Property.all\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def permissions = {}",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def text_permission\n return unless @user.loa3?\n\n dig_out('permissions', 'permission_type', VAProfile::Models::Permission::TEXT)\n end",
"def property_list(name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n property(name, type, required, description, hash)\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def index\n @properties = Property.all\n authorize @properties\n end",
"def default_entities_for_permission(type, access)\n default_permissions.collect { |p| p[:name] if p[:type] == type and p[:access] == access }.compact\n end",
"def default_entities_for_permission(type, access)\n default_permissions.collect { |p| p[:name] if p[:type] == type and p[:access] == access }.compact\n end",
"def permissions\n Roles.type_map[role_type].permissions\n end",
"def permissions\n [\"read_permissions\", \"update_permissions\", \"delete_permissions\"].each do |p|\n perms = self.send(p)\n perm_string = []\n AssetPermission::GROUP.each do |g, v|\n if perms & AssetPermission::GROUP[g] > 0\n perm_string << g\n end\n end\n puts \"#{self.name}: #{p}: #{perm_string.join(',')}\"\n end\n end",
"def permissions\n read_attribute(:permissions) || {}\n end",
"def selectable_access_types\n [['Unrestricted Access', 'open'], ['Controlled Access', 'restricted'], ['Other', 'closed']]\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def permissions\n\t\tauthorize @user\n\t\t@permissions = []\n\t\tonly_theirs = \"Only theirs\"\n\t\tyes = \"Yes\"\n\t\tno = \"No\"\n\t\tnames = [\"View positions\", \"Create positions\", \"Edit positions\", \"Delete positions\",\n\t\t \"Apply\", \"View applications\", \"Edit applications\", \"Delete applications\",\n\t\t \"Change application submission status\"]\n\t\tadmin_permissions = [yes, yes, yes, yes, yes, \"All\", yes, yes, yes]\n\t\tmod_permissions = [yes, no, yes, no, yes, \"All but incomplete\", only_theirs, only_theirs, yes]\n\t\tuser_permissions = [yes, no, no, no, yes, only_theirs, only_theirs, only_theirs, no]\n\t\tnames.each_with_index do |permission, index|\n\t\t\t@permissions << { name: names[index], admin: admin_permissions[index], mod: mod_permissions[index], user: user_permissions[index]}\n\t\tend\n\n @title = 'Permissions'\n\tend",
"def allowed_types\n\treturn [User]\nend",
"def protect_type( type )\n self.permissions['protected_types'] << type.to_s\n end",
"def index\n authorize TokenPermissionType\n @user = current_user\n @token_types = @user.org.token_permission_types\n end",
"def allowed_types\n [User]\nend",
"def permissions?\n proprieties[:permissions]\n end",
"def attributes\n permissions.select { |k, v| v.present? }.as_json\n end",
"def access_template\n {}.tap do |access_properties|\n ACCESS_FIELDS.filter { |field, _cocina_field| changed?(field) }.each do |field, cocina_field|\n val = public_send(field)\n access_properties[cocina_field] = val.is_a?(String) ? val.presence : val # allow boolean false\n end\n end\n end",
"def get_restriction_types\n get_restrictions_data['types']\n end",
"def can_modify_templates?\n perms.include? Perm.modify_templates\n end",
"def index\n @permission_policies = PermissionPolicy.all\n end",
"def fields\n properties.keys.map(&:to_sym).reject{ |x| x == :type }\n end",
"def apply_superuser_permissions(permission_types)\n []\n end",
"def objects_with_permission(type, permission)\n raise Exceptions::NotACanHazObject unless type.respond_to?(:acts_as_canhaz_object)\n permissions = self.permissions.where(:permission => permission.to_s, :type => type.to_s)\n type.in(:id => permissions.collect(&:cobject_id))\n end",
"def defined_types\n @title = 'Defined Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_defined_type)\n erb(:objects)\nend",
"def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end",
"def index\n @cdg_permission_types = CdgPermissionType.all\n end",
"def custom_permissions\n #Collection Manager Permissions\n #Higher power than edit user...[Dont want edit users to be able to DELETE a COLLECTION??, (Delete a DO?)]\n if current_user.applicable_policy?(SETTING_POLICY_COLLECTION_MANAGER)\n #Marked as being able to :manage_collection\n can :manage_collection_flag, :all\n can :create, [DRI::Batch, DRI::GenericFile]\n end\n\n\n #Admin Permissions\n if current_user.applicable_policy?(SETTING_POLICY_ADMIN)\n can :admin_flag, :all\n #Disabled for now..\n can :manage, :all\n end\n\n #Create_do flag (alias for :edit collection)\n can :create_do, String do |pid|\n test_create(pid)\n end\n\n can :create_do, DRI::Batch do |collection|\n test_create(collection)\n end\n end",
"def index\n authorize_action_for Property, at: current_store\n @properties = current_store.properties\n end",
"def meta_abilities\n User.roles.each do |(k, v)|\n if user.has_role? k\n can \"do_#{k}\".to_sym, :all\n end\n end\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def index\n @permissions = Permission.all\n end",
"def new_types\n return [] unless allow_new_records?\n\n # build our list\n Record.record_types - %w{ SOA NS } - self.permissions['protected_types']\n end",
"def permission_checks(permission)\n keys = []\n\n if permission.action\n # Add '<kind>:<name>:<action>'\n keys << [ permission.kind, permission.name, permission.action ].join(':')\n\n # Add '<kind>:all(:<action>'\n keys << [ permission.kind, 'all', permission.action ].join(':')\n end\n\n # Add '<kind>:<name>'\n keys << [ permission.kind, permission.name ].join(':')\n\n # Add '<kind>:all'\n keys << [ permission.kind, 'all' ].join(':')\n\n # Add 'all'\n keys << 'all'\n\n keys\n end",
"def access_types\n @access_types ||= [ALL_ACCESS].tap do |types|\n types << PUBLIC_ACCESS if public?\n types << PROTECTED_ACCESS if protected?\n types << PRIVATE_ACCESS if private?\n types << DIGITIZED_ACCESS if digitized? && !private?\n end\n end",
"def property_types(property)\n if @vocabulary.properties.has_key?(property)\n @vocabulary.properties[property][:types]\n else\n @vocabulary.properties[:any][:types]\n end\n end",
"def index\n\t\tauthorize! :index, TipoPrivilegio\n @tipo_privilegios = TipoPrivilegio.all\n end",
"def allowed_types\n [Tapir::Entities::User]\nend",
"def admin_permissions\n {\n id: 1,\n appendable_permissions: [\n { permission_type: 'basic' },\n { permission_type: 'admin' }\n ]\n }\n end",
"def get_allowed_property_details\n allowed_property_details = []\n selectable_property_details = PropertyDetail.where(:selectable => true)\n selectable_property_details.each do |pd|\n allowed_property_details.push(pd[:msgid])\n end\n\n return allowed_property_details\n end",
"def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end",
"def can_modify_templates?\n self.perms.include? Perm.modify_templates\n end",
"def authorize_can_read_issuable!\n action = [:read_, params[:template_type]].join\n\n authorize_action!(action)\n end",
"def list_authorized?\n authorized_for?(:crud_type => :read)\n end",
"def list_authorized?\n authorized_for?(:crud_type => :read)\n end",
"def permissions\n return @permissions\n end",
"def permissions\n @resource_permissions\n end",
"def custom_permissions\n can [:file_status, :stage, :unstage], FileSet\n\n if current_user.ingest_from_external_sources?\n end\n\n if current_user.manage_users?\n can [:show, :add_user, :remove_user, :index], Role\n end\n\n if current_user.manage_roles?\n can [:create, :show, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.run_fixity_checks?\n can [:fixity], FileSet\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def restapi_permission\n @attributes[:restapi_permission]\n end",
"def types\n @types ||= profile_types.pluck(:title).join(' / ').html_safe\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def role\n permission_type\n end",
"def implied_perms_for(permissions)\n implied_permissions = []\n permissions.each do |p|\n next if p.class_name.to_sym == :any\n next unless p.target_class_exists?\n p.target_class.sg_priv_to_implied_privs[p.privilege].each do |pi|\n\tp_new = p.dup\n\tp_new.privilege = pi\n\timplied_permissions << p_new\n\tend\n end\n implied_permissions \n end",
"def custom_permissions # rubocop:disable Metrics/CyclomaticComplexity\n can :read, ApplicationPresenter, &:can_read?\n can :read, UsersPresenter, &:can_read?\n can :read, UserPresenter, &:can_read?\n can :read, RolesPresenter, &:can_read?\n can :read, RolePresenter, &:can_read?\n\n can :read, Press\n\n grant_press_analyst_abiltites if press_analyst?\n grant_press_editor_abilities if press_editor?\n grant_press_admin_abilities if platform_admin? || press_admin?\n grant_platform_admin_abilities if platform_admin?\n end",
"def show\n @all_permissions = Permission.all\n end",
"def getPermissions\n perms = []\n perms.push :disseminate if params[:disseminate_perm] == \"on\"\n perms.push :withdraw if params[:withdraw_perm] == \"on\"\n perms.push :peek if params[:peek_perm] == \"on\"\n perms.push :submit if params[:submit_perm] == \"on\"\n perms.push :report if params[:report_perm] == \"on\" \n perms \n end",
"def content_type_denylist\n end",
"def index\n properties = current_user.properties\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json(properties)) }\n format.xml { render :xml => properties_to_xml(properties) }\n format.text { render :text => text_not_supported }\n end\n end",
"def index\n ensure_an_admin_role\n @pricetypes = Pricetype.all\n end",
"def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def show\n @permissions = Permission.all\n end",
"def represented_visibility\n [AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED,\n AccessRight::PERMISSION_TEXT_VALUE_PUBLIC]\n end",
"def model_actions(perms)\n ActiveRecord::Base.descendants.each do |m|\n next unless m.respond_to?(:permission_definition)\n next if m.permission_definition.nil? || m.permission_definition == {}\n perms << PermissionsGenerator.new(m)\n end\n return perms\nend",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def show\n @permissions = @role.permissions\n end",
"def get_template_property_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TemplatesPropertiesApi.get_template_property_types ...\"\n end\n # resource path\n local_var_path = \"/templates/properties\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<PropertyFieldListResource>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesPropertiesApi#get_template_property_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def types_not_permitted\n %w(City Region Country Activity Restaurant Hotel) - [@type]\n end",
"def all\n authorize! :show, PointsEntryType\n load_all_points_entry_types\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def custom_permissions\n discover_permissions\n export_sets_permissions\n batches_permissions\n preservation_events_permissions\n end",
"def all_types\n @mutex.synchronize do\n @types.keys.find_all{ |t_| !t_.is_a?(AnonymousType) }\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n# if current_user.contentadmin?\n# can [:create, :destroy], GwWork\n# can [:create, :destroy], GwEtd\n# end\n end",
"def can_change( record, type = '*' )\n name, type = get_name_and_type_from_param( record, type )\n self.permissions['allowed'] << [ name, type ]\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n\n can [:fa_overview], ActiveFedora::Base\n can [:advanced], ActiveFedora::Base\n can [:streets], ActiveFedora::Base\n can [:pdf_page], ActiveFedora::Base\n can [:pdf_page_metadata], ActiveFedora::Base\n can [:bookreader], ActiveFedora::Base\n can [:imageviewer], ActiveFedora::Base\n can [:streetsviewer], ActiveFedora::Base\n can [:fa_series], ActiveFedora::Base\n can [:audio_transcriptonly], ActiveFedora::Base\n can [:video_transcriptonly], ActiveFedora::Base\n end",
"def members_with_types\n @members_with_types ||= MEMBERS_TYPES\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n # Admin user can create works of all work types\n can :create, curation_concerns_models\n end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def index\n authorize :resquest_type, :index?\n @resquest_types = ResquestType.all\n end",
"def allowed_types\n\t\treturn [EmailAddress, Device, Domain, Organization, User, Location, Service, NetApplication, WebApplication]\n\tend",
"def read_permissions\n can :read, String do |pid|\n Rails.logger.debug(\"[READPERM] Checking from STRING\")\n test_read(pid)\n end\n\n can :read, [DRI::Batch] do |obj|\n Rails.logger.debug(\"[READPERM] Checking from Object\")\n test_read(obj.id)\n end\n\n\n can :read, SolrDocument do |obj|\n Rails.logger.debug(\"[READPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_read(obj.id)\n end\n end",
"def describe\n as_json(only:\n %i[\n type uuid slug name_translations\n name_plural_translations comment default_value primary\n required unique options display_in_list display_in_public_list\n ]\n ).merge(allows_multiple? ? as_json(only: [:multiple]) : {})\n end",
"def permissions(poll_path, polls = read_polls_data)\n poll = Poll.new(poll_path, polls)\n\n permissions = []\n\n permissions.push('vote') unless votes[poll.id]\n permissions.push('delete') if can_delete?(poll)\n permissions.push('reset') if username == 'admin'\n\n permissions\n end",
"def allow_access_by_any_user\n @attributes[:allow_access_by_any_user]\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def index\n @admintreatmentprocesstypes = Admintreatmentprocesstype.all\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n if current_user.admin?\n # Role management\n # don't allow :destroy, :edit, :create\n # - destroy adds a 'delete' button that\n # - could be clicked accidentally\n # - would be very infrequently used (if ever)\n # - implications of edit are unclear for associated actions\n # - create is meaningless without associating actions which happens in code.\n can [:read, :add_user, :remove_user], Role\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end"
] | [
"0.63806385",
"0.6314879",
"0.61872756",
"0.61871046",
"0.6075059",
"0.6075059",
"0.60598046",
"0.6046966",
"0.5999109",
"0.59609485",
"0.58689505",
"0.58689505",
"0.5822305",
"0.58110833",
"0.5792158",
"0.5781621",
"0.5779864",
"0.5779864",
"0.57597864",
"0.57571006",
"0.57347065",
"0.57345533",
"0.5719931",
"0.5709586",
"0.5689968",
"0.56836987",
"0.5641878",
"0.56399226",
"0.56328857",
"0.5631251",
"0.56238997",
"0.5622581",
"0.56054014",
"0.5590273",
"0.558847",
"0.5578862",
"0.5563442",
"0.5562771",
"0.5559654",
"0.55529493",
"0.5537133",
"0.5536617",
"0.55316854",
"0.55091363",
"0.5499438",
"0.54937005",
"0.54915005",
"0.5481972",
"0.54819596",
"0.54793566",
"0.5474546",
"0.5474293",
"0.5474293",
"0.54700226",
"0.54621845",
"0.54576594",
"0.5451344",
"0.5441477",
"0.54413646",
"0.5432413",
"0.5432413",
"0.5429326",
"0.54167134",
"0.541487",
"0.54082155",
"0.54045945",
"0.5396937",
"0.5386737",
"0.5380179",
"0.53680885",
"0.5365271",
"0.53591955",
"0.5358876",
"0.5351133",
"0.5350675",
"0.5346775",
"0.53461474",
"0.53458464",
"0.5341498",
"0.5335818",
"0.53345245",
"0.53302854",
"0.5319474",
"0.5318467",
"0.53177464",
"0.53149885",
"0.53073883",
"0.5306266",
"0.530296",
"0.5301722",
"0.52791643",
"0.5277224",
"0.5273689",
"0.527199",
"0.52681404",
"0.5261826",
"0.52548766",
"0.5239225",
"0.5239225",
"0.52352995",
"0.52305466"
] | 0.0 | -1 |
List template property types Permissions Needed: ANY | def get_template_property_types_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: TemplatesPropertiesApi.get_template_property_types ..."
end
# resource path
local_var_path = "/templates/properties"
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
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 => 'Array<PropertyFieldListResource>')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TemplatesPropertiesApi#get_template_property_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permissions\n attribute_prop(5)\n end",
"def index\n @allowed = false\n if check_permissions?(session[:user_type], \"create_property\")\n @allowed = true\n end\n @properties = Property.all\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def permissions = {}",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def text_permission\n return unless @user.loa3?\n\n dig_out('permissions', 'permission_type', VAProfile::Models::Permission::TEXT)\n end",
"def property_list(name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n property(name, type, required, description, hash)\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def index\n @properties = Property.all\n authorize @properties\n end",
"def default_entities_for_permission(type, access)\n default_permissions.collect { |p| p[:name] if p[:type] == type and p[:access] == access }.compact\n end",
"def default_entities_for_permission(type, access)\n default_permissions.collect { |p| p[:name] if p[:type] == type and p[:access] == access }.compact\n end",
"def permissions\n Roles.type_map[role_type].permissions\n end",
"def permissions\n [\"read_permissions\", \"update_permissions\", \"delete_permissions\"].each do |p|\n perms = self.send(p)\n perm_string = []\n AssetPermission::GROUP.each do |g, v|\n if perms & AssetPermission::GROUP[g] > 0\n perm_string << g\n end\n end\n puts \"#{self.name}: #{p}: #{perm_string.join(',')}\"\n end\n end",
"def permissions\n read_attribute(:permissions) || {}\n end",
"def selectable_access_types\n [['Unrestricted Access', 'open'], ['Controlled Access', 'restricted'], ['Other', 'closed']]\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def permissions\n\t\tauthorize @user\n\t\t@permissions = []\n\t\tonly_theirs = \"Only theirs\"\n\t\tyes = \"Yes\"\n\t\tno = \"No\"\n\t\tnames = [\"View positions\", \"Create positions\", \"Edit positions\", \"Delete positions\",\n\t\t \"Apply\", \"View applications\", \"Edit applications\", \"Delete applications\",\n\t\t \"Change application submission status\"]\n\t\tadmin_permissions = [yes, yes, yes, yes, yes, \"All\", yes, yes, yes]\n\t\tmod_permissions = [yes, no, yes, no, yes, \"All but incomplete\", only_theirs, only_theirs, yes]\n\t\tuser_permissions = [yes, no, no, no, yes, only_theirs, only_theirs, only_theirs, no]\n\t\tnames.each_with_index do |permission, index|\n\t\t\t@permissions << { name: names[index], admin: admin_permissions[index], mod: mod_permissions[index], user: user_permissions[index]}\n\t\tend\n\n @title = 'Permissions'\n\tend",
"def allowed_types\n\treturn [User]\nend",
"def protect_type( type )\n self.permissions['protected_types'] << type.to_s\n end",
"def index\n authorize TokenPermissionType\n @user = current_user\n @token_types = @user.org.token_permission_types\n end",
"def allowed_types\n [User]\nend",
"def permissions?\n proprieties[:permissions]\n end",
"def attributes\n permissions.select { |k, v| v.present? }.as_json\n end",
"def access_template\n {}.tap do |access_properties|\n ACCESS_FIELDS.filter { |field, _cocina_field| changed?(field) }.each do |field, cocina_field|\n val = public_send(field)\n access_properties[cocina_field] = val.is_a?(String) ? val.presence : val # allow boolean false\n end\n end\n end",
"def get_restriction_types\n get_restrictions_data['types']\n end",
"def can_modify_templates?\n perms.include? Perm.modify_templates\n end",
"def index\n @permission_policies = PermissionPolicy.all\n end",
"def fields\n properties.keys.map(&:to_sym).reject{ |x| x == :type }\n end",
"def apply_superuser_permissions(permission_types)\n []\n end",
"def objects_with_permission(type, permission)\n raise Exceptions::NotACanHazObject unless type.respond_to?(:acts_as_canhaz_object)\n permissions = self.permissions.where(:permission => permission.to_s, :type => type.to_s)\n type.in(:id => permissions.collect(&:cobject_id))\n end",
"def defined_types\n @title = 'Defined Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_defined_type)\n erb(:objects)\nend",
"def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end",
"def index\n @cdg_permission_types = CdgPermissionType.all\n end",
"def custom_permissions\n #Collection Manager Permissions\n #Higher power than edit user...[Dont want edit users to be able to DELETE a COLLECTION??, (Delete a DO?)]\n if current_user.applicable_policy?(SETTING_POLICY_COLLECTION_MANAGER)\n #Marked as being able to :manage_collection\n can :manage_collection_flag, :all\n can :create, [DRI::Batch, DRI::GenericFile]\n end\n\n\n #Admin Permissions\n if current_user.applicable_policy?(SETTING_POLICY_ADMIN)\n can :admin_flag, :all\n #Disabled for now..\n can :manage, :all\n end\n\n #Create_do flag (alias for :edit collection)\n can :create_do, String do |pid|\n test_create(pid)\n end\n\n can :create_do, DRI::Batch do |collection|\n test_create(collection)\n end\n end",
"def index\n authorize_action_for Property, at: current_store\n @properties = current_store.properties\n end",
"def meta_abilities\n User.roles.each do |(k, v)|\n if user.has_role? k\n can \"do_#{k}\".to_sym, :all\n end\n end\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def index\n @permissions = Permission.all\n end",
"def new_types\n return [] unless allow_new_records?\n\n # build our list\n Record.record_types - %w{ SOA NS } - self.permissions['protected_types']\n end",
"def permission_checks(permission)\n keys = []\n\n if permission.action\n # Add '<kind>:<name>:<action>'\n keys << [ permission.kind, permission.name, permission.action ].join(':')\n\n # Add '<kind>:all(:<action>'\n keys << [ permission.kind, 'all', permission.action ].join(':')\n end\n\n # Add '<kind>:<name>'\n keys << [ permission.kind, permission.name ].join(':')\n\n # Add '<kind>:all'\n keys << [ permission.kind, 'all' ].join(':')\n\n # Add 'all'\n keys << 'all'\n\n keys\n end",
"def access_types\n @access_types ||= [ALL_ACCESS].tap do |types|\n types << PUBLIC_ACCESS if public?\n types << PROTECTED_ACCESS if protected?\n types << PRIVATE_ACCESS if private?\n types << DIGITIZED_ACCESS if digitized? && !private?\n end\n end",
"def property_types(property)\n if @vocabulary.properties.has_key?(property)\n @vocabulary.properties[property][:types]\n else\n @vocabulary.properties[:any][:types]\n end\n end",
"def index\n\t\tauthorize! :index, TipoPrivilegio\n @tipo_privilegios = TipoPrivilegio.all\n end",
"def allowed_types\n [Tapir::Entities::User]\nend",
"def admin_permissions\n {\n id: 1,\n appendable_permissions: [\n { permission_type: 'basic' },\n { permission_type: 'admin' }\n ]\n }\n end",
"def get_allowed_property_details\n allowed_property_details = []\n selectable_property_details = PropertyDetail.where(:selectable => true)\n selectable_property_details.each do |pd|\n allowed_property_details.push(pd[:msgid])\n end\n\n return allowed_property_details\n end",
"def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end",
"def can_modify_templates?\n self.perms.include? Perm.modify_templates\n end",
"def authorize_can_read_issuable!\n action = [:read_, params[:template_type]].join\n\n authorize_action!(action)\n end",
"def list_authorized?\n authorized_for?(:crud_type => :read)\n end",
"def list_authorized?\n authorized_for?(:crud_type => :read)\n end",
"def permissions\n return @permissions\n end",
"def permissions\n @resource_permissions\n end",
"def custom_permissions\n can [:file_status, :stage, :unstage], FileSet\n\n if current_user.ingest_from_external_sources?\n end\n\n if current_user.manage_users?\n can [:show, :add_user, :remove_user, :index], Role\n end\n\n if current_user.manage_roles?\n can [:create, :show, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.run_fixity_checks?\n can [:fixity], FileSet\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def restapi_permission\n @attributes[:restapi_permission]\n end",
"def types\n @types ||= profile_types.pluck(:title).join(' / ').html_safe\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def list_permissions\n BrickFTP::API::Permission.all\n end",
"def role\n permission_type\n end",
"def implied_perms_for(permissions)\n implied_permissions = []\n permissions.each do |p|\n next if p.class_name.to_sym == :any\n next unless p.target_class_exists?\n p.target_class.sg_priv_to_implied_privs[p.privilege].each do |pi|\n\tp_new = p.dup\n\tp_new.privilege = pi\n\timplied_permissions << p_new\n\tend\n end\n implied_permissions \n end",
"def custom_permissions # rubocop:disable Metrics/CyclomaticComplexity\n can :read, ApplicationPresenter, &:can_read?\n can :read, UsersPresenter, &:can_read?\n can :read, UserPresenter, &:can_read?\n can :read, RolesPresenter, &:can_read?\n can :read, RolePresenter, &:can_read?\n\n can :read, Press\n\n grant_press_analyst_abiltites if press_analyst?\n grant_press_editor_abilities if press_editor?\n grant_press_admin_abilities if platform_admin? || press_admin?\n grant_platform_admin_abilities if platform_admin?\n end",
"def show\n @all_permissions = Permission.all\n end",
"def getPermissions\n perms = []\n perms.push :disseminate if params[:disseminate_perm] == \"on\"\n perms.push :withdraw if params[:withdraw_perm] == \"on\"\n perms.push :peek if params[:peek_perm] == \"on\"\n perms.push :submit if params[:submit_perm] == \"on\"\n perms.push :report if params[:report_perm] == \"on\" \n perms \n end",
"def content_type_denylist\n end",
"def index\n properties = current_user.properties\n respond_to do |format|\n format.json { render :json => jsonp(properties_to_json(properties)) }\n format.xml { render :xml => properties_to_xml(properties) }\n format.text { render :text => text_not_supported }\n end\n end",
"def index\n ensure_an_admin_role\n @pricetypes = Pricetype.all\n end",
"def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def show\n @permissions = Permission.all\n end",
"def represented_visibility\n [AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED,\n AccessRight::PERMISSION_TEXT_VALUE_PUBLIC]\n end",
"def model_actions(perms)\n ActiveRecord::Base.descendants.each do |m|\n next unless m.respond_to?(:permission_definition)\n next if m.permission_definition.nil? || m.permission_definition == {}\n perms << PermissionsGenerator.new(m)\n end\n return perms\nend",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def show\n @permissions = @role.permissions\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def types_not_permitted\n %w(City Region Country Activity Restaurant Hotel) - [@type]\n end",
"def all\n authorize! :show, PointsEntryType\n load_all_points_entry_types\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def custom_permissions\n discover_permissions\n export_sets_permissions\n batches_permissions\n preservation_events_permissions\n end",
"def all_types\n @mutex.synchronize do\n @types.keys.find_all{ |t_| !t_.is_a?(AnonymousType) }\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n# if current_user.contentadmin?\n# can [:create, :destroy], GwWork\n# can [:create, :destroy], GwEtd\n# end\n end",
"def can_change( record, type = '*' )\n name, type = get_name_and_type_from_param( record, type )\n self.permissions['allowed'] << [ name, type ]\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n\n can [:fa_overview], ActiveFedora::Base\n can [:advanced], ActiveFedora::Base\n can [:streets], ActiveFedora::Base\n can [:pdf_page], ActiveFedora::Base\n can [:pdf_page_metadata], ActiveFedora::Base\n can [:bookreader], ActiveFedora::Base\n can [:imageviewer], ActiveFedora::Base\n can [:streetsviewer], ActiveFedora::Base\n can [:fa_series], ActiveFedora::Base\n can [:audio_transcriptonly], ActiveFedora::Base\n can [:video_transcriptonly], ActiveFedora::Base\n end",
"def members_with_types\n @members_with_types ||= MEMBERS_TYPES\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n # Admin user can create works of all work types\n can :create, curation_concerns_models\n end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def index\n authorize :resquest_type, :index?\n @resquest_types = ResquestType.all\n end",
"def allowed_types\n\t\treturn [EmailAddress, Device, Domain, Organization, User, Location, Service, NetApplication, WebApplication]\n\tend",
"def read_permissions\n can :read, String do |pid|\n Rails.logger.debug(\"[READPERM] Checking from STRING\")\n test_read(pid)\n end\n\n can :read, [DRI::Batch] do |obj|\n Rails.logger.debug(\"[READPERM] Checking from Object\")\n test_read(obj.id)\n end\n\n\n can :read, SolrDocument do |obj|\n Rails.logger.debug(\"[READPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_read(obj.id)\n end\n end",
"def describe\n as_json(only:\n %i[\n type uuid slug name_translations\n name_plural_translations comment default_value primary\n required unique options display_in_list display_in_public_list\n ]\n ).merge(allows_multiple? ? as_json(only: [:multiple]) : {})\n end",
"def permissions(poll_path, polls = read_polls_data)\n poll = Poll.new(poll_path, polls)\n\n permissions = []\n\n permissions.push('vote') unless votes[poll.id]\n permissions.push('delete') if can_delete?(poll)\n permissions.push('reset') if username == 'admin'\n\n permissions\n end",
"def allow_access_by_any_user\n @attributes[:allow_access_by_any_user]\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :color_pdf, :pdf, :edit, :browse_everything_files, :structure, :file_manager, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"def index\n @admintreatmentprocesstypes = Admintreatmentprocesstype.all\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n if current_user.admin?\n # Role management\n # don't allow :destroy, :edit, :create\n # - destroy adds a 'delete' button that\n # - could be clicked accidentally\n # - would be very infrequently used (if ever)\n # - implications of edit are unclear for associated actions\n # - create is meaningless without associating actions which happens in code.\n can [:read, :add_user, :remove_user], Role\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end"
] | [
"0.63806385",
"0.6314879",
"0.61872756",
"0.61871046",
"0.6075059",
"0.6075059",
"0.60598046",
"0.6046966",
"0.5999109",
"0.59609485",
"0.58689505",
"0.58689505",
"0.5822305",
"0.58110833",
"0.5792158",
"0.5781621",
"0.5779864",
"0.5779864",
"0.57597864",
"0.57571006",
"0.57347065",
"0.57345533",
"0.5719931",
"0.5709586",
"0.5689968",
"0.56836987",
"0.5641878",
"0.56399226",
"0.56328857",
"0.5631251",
"0.56238997",
"0.5622581",
"0.56054014",
"0.5590273",
"0.558847",
"0.5578862",
"0.5563442",
"0.5562771",
"0.5559654",
"0.55529493",
"0.5537133",
"0.5536617",
"0.55316854",
"0.55091363",
"0.5499438",
"0.54937005",
"0.54915005",
"0.5481972",
"0.54819596",
"0.54793566",
"0.5474546",
"0.5474293",
"0.5474293",
"0.54700226",
"0.54621845",
"0.54576594",
"0.5451344",
"0.5441477",
"0.54413646",
"0.5432413",
"0.5432413",
"0.5429326",
"0.54167134",
"0.541487",
"0.54082155",
"0.54045945",
"0.5396937",
"0.5386737",
"0.5380179",
"0.53680885",
"0.5365271",
"0.53591955",
"0.5358876",
"0.5351133",
"0.5350675",
"0.5346775",
"0.53461474",
"0.5341498",
"0.5335818",
"0.53345245",
"0.53302854",
"0.5319474",
"0.5318467",
"0.53177464",
"0.53149885",
"0.53073883",
"0.5306266",
"0.530296",
"0.5301722",
"0.52791643",
"0.5277224",
"0.5273689",
"0.527199",
"0.52681404",
"0.5261826",
"0.52548766",
"0.5239225",
"0.5239225",
"0.52352995",
"0.52305466"
] | 0.53458464 | 77 |
Partially order the fixed nodes in a graph, so that each has a sequence number which can be compared. If one node must come before another then it will have a lower sequence number. | def partially_order(graph)
# Create a work list of the fixed nodes.
to_sequence = graph.all_nodes.select(&:fixed?)
# Keep going until the work list is empty.
until to_sequence.empty?
node = to_sequence.shift
# We're only interested in the control inputs to the node.
control_input_nodes = node.inputs.control_edges.from_nodes
# Nodes with no control input (such as start but possibly others) have sequence number zero.
if control_input_nodes.empty?
node.props[:sequence] = 0
next
end
# If all control inputs have been given a sequence, we can give this
# node as at least one greater than all of those.
if control_input_nodes.all? { |i| i.props[:sequence] }
node.props[:sequence] = control_input_nodes.map { |i| i.props[:sequence] }.max + 1
next
end
# If all the control inputs haven't been given a sequence number yet
# then put it back on the work list and come back to it later.
to_sequence.push node
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_with_order\n # Identify groups of nodes that can be executed concurrently\n groups = tsort_each.slice_when { |a, b| parents(a) != parents(b) }\n\n # Assign order to each node\n i = 0\n groups.flat_map do |group|\n group_with_order = group.product([i])\n i += group.size\n group_with_order\n end\n end",
"def sort(array_of_nodes, order); end",
"def order\n nodes.length\n end",
"def sequence_nodes(graph)\n # Note that this algorithm is very wasteful! It allocates two sides of a branch\n # the same sequence numbers. This means that to the linear scan values on both\n # sides of the branch and internal to those branches appear to be live at the\n # same time and they won't use the same registers. I think we're supposed to be\n # sequencing one side of the branch at a time, and starting the right side\n # with the max sequence number of the left side.\n\n # Create a worklist of nodes to sequence.\n\n to_sequence = graph.all_nodes\n\n until to_sequence.empty?\n node = to_sequence.shift\n\n # If all this node's inputs have already been sequenced.\n\n if node.inputs.from_nodes.all? { |i| i.props[:register_sequence] }\n # Give this node an sequence number at least one higher than all others.\n input_sequences = node.inputs.from_nodes.map { |i| i.props[:register_sequence] }\n node.props[:register_sequence] = if input_sequences.empty? then 0 else input_sequences.max + 1 end\n next\n end\n\n # Not all inputs were sequenced - put this node back on the list and try again later.\n\n to_sequence.push node\n end\n end",
"def topological_sort(vertices)\n queue = vertices.select { |node| node.in_edges.length == 0 }\n ordered_list = []\n\n degree = {}\n vertices.each { |node| degree[node.value] = node.in_edges.length }\n\n until queue.empty?\n curr_node = queue.pop\n ordered_list << curr_node\n\n curr_node.out_edges .map { |edge| edge.to_vertex }\n .each { |child| degree[child.value] -= 1 }\n\n queue = vertices.select do |node|\n degree[node.value] == 0 && !queue.include?(node) && !ordered_list.include?(node)\n end + queue\n end\n\n return degree.all? { |_, v| v == 0 } ? ordered_list : []\nend",
"def topological_sort\n\t\tcount = size\n\t\t@explored_nodes = Array.new(count, false)\n\t\t@current_label = count\n\t\t@topological_order = Array.new(count, nil)\n\t\tcount.times do |label|\n\t\t\tdfs_topological_order(label) unless @explored_nodes[label]\n\t\tend\n\t\ttopological_order\n\tend",
"def topo_sort(dependencies) # tarjan's algorithm\n dependencies.default = [] # no need for #default_proc because array never gets mutated\n seen = {}\n ordering = []\n dependencies.keys.each do |vertex|\n resolve!(vertex, dependencies, ordering, seen) unless seen[vertex]\n end\n ordering\nend",
"def topological_sort(vertices)\n in_edge_store = {}\n queue = []\n\n vertices.each do |vertex|\n in_edge_store[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n ordered_vertices = []\n until queue.empty?\n current_vertex = queue.shift\n ordered_vertices << current_vertex\n current_vertex.out_edges.each do |edge|\n next_vertex = edge.to_vertex\n in_edge_store[next_vertex] -= 1\n queue << next_vertex if in_edge_store[next_vertex] == 0\n end\n end\n\n ordered_vertices\nend",
"def topo_sort_it(graph)\n discovered = {}\n sorted_list = []\n stack = []\n\n graph.keys.each do |vtx|\n next if discovered[vtx]\n\n stack << [vtx, 0]\n discovered[vtx] = true\n\n while stack != []\n # p stack\n\n top_vtx = stack[-1][0]\n pos = stack[-1][1]\n next_vtx = graph[top_vtx][pos]\n\n if next_vtx\n stack[-1][1] += 1\n stack.push([next_vtx, 0]) unless discovered[next_vtx]\n discovered[next_vtx] = true\n else\n sorted_list << stack.pop.first\n end\n\n end\n end\n\n sorted_list.reverse\nend",
"def topological_sort(vertices)\n\n # # Determine the in-degree of each node.\n # in_degrees = []\n #\n # vertices.each do |vertex|\n # in_degrees.push(vertex.in_edges.length)\n # end\n #\n # # Collect nodes with zero in-degree in a queue.\n # queue = []\n # in_degrees.each_with_index do |degree, idx|\n # queue.push(vertices[idx]) if degree == 0\n # end\n #\n # deletelist = []\n # # While the queue is not empty:\n # while(queue.length != 0)\n # # Pop node u from queue,\n # u = queue.shift()\n # # remove u from the graph,\n # vertices.delete(u)\n # # We maintain a list that records in which order the nodes are removed.\n # deletelist.push(u)\n # u.out_edges.each {|edge| edge.destroy!}\n #\n # # check if there is a new node with in-degree zero (among the neighbors of u)\n # in_degrees = []\n # vertices.each do |vertex|\n # in_degrees.push(vertex.in_edges.length)\n # end\n # # If yes, put that node into the queue.\n # in_degrees.each_with_index do |degree, idx|\n # queue.push(vertices[idx]) if (degree == 0) && (queue.include?(vertices[idx]) == false)\n # end\n # end\n #\n # # If the queue is empty:\n # # if we removed all nodes from the graph, return the list\n # return deletelist if vertices == []\n #\n # # else we return an empty list that indicates that an order is not possible due to a cycle\n # return []\n\n #I tried but I don't understand what the spec is saying\n in_edge_counts = {}\n queue = []\n\n vertices.each do |v|\n in_edge_counts[v] = v.in_edges.count\n queue << v if v.in_edges.empty?\n end\n\n sorted_vertices = []\n\n until queue.empty?\n vertex = queue.shift\n sorted_vertices << vertex\n\n vertex.out_edges.each do |e|\n to_vertex = e.to_vertex\n\n in_edge_counts[to_vertex] -= 1\n queue << to_vertex if in_edge_counts[to_vertex] == 0\n end\n end\n\n sorted_vertices\n\n # The time complexity of this implementation is O(2v + 2e)\n\nend",
"def topological_sort(vertices)\n queue = []\n order = []\n in_edge_count = {}\n\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queeue.shift\n order << current\n\n current.out_edges.each do |edge|\n to_vert = edge.to_vertex\n in_edge_count[to_vert] -= 1\n queue << to_vert if in_edge_count[to_vert] == 0\n end\n\n end\n\n order.length == vertices.length ? order : []\nend",
"def topological_sort(vertices)\n order = []\n explored = Set.new \n\n vertices.each do |vertex|\n dfs!(order, explored, vertex) unless explored.include?(vertex)\n end \n\n order \n\nend",
"def topological_sort(vertices)\n order = []\n explored = Set.new\n\n vertices.each do |vertex|\n dfs!(order, explored, vertex) unless explored.include?(vertex)\n end\n\n order\nend",
"def topological_sort(vertices)\n in_edge_count = {}\n list = []\n queue = []\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n u = queue.shift\n list << u\n u.out_edges.each do |vertex|\n to_vertex = vertex.to_vertex\n in_edge_count[to_vertex] -= 1\n queue << to_vertex if in_edge_count[to_vertex] == 0\n end\n end\n list\nend",
"def topological_sort(vertices)\n sorted = []\n queue = []\n in_edge_counts = {}\n\n vertices.each do |vertex|\n in_edge_counts[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n sorted << current\n\n current.out_edges.each do |edge|\n destination = edge.to_vertex\n in_edge_counts[destination] -= 1\n queue << destination if in_edge_counts[destination] == 0\n end\n end\n sorted\nend",
"def topological_sort(vertices)\n in_edges = {}\n result = []\n queue = vertices.select do |vertex|\n in_edges[vertex] = vertex.in_edges.length\n vertex.in_edges.empty?\n end\n\n until queue.empty?\n vertex = queue.pop\n result.push(vertex)\n vertex.out_edges.map(&:to_vertex).each do |vertex|\n in_edges[vertex] -= 1\n queue.unshift(vertex) if in_edges[vertex] == 0\n end\n end\n in_edges.all?{|vertex,count| count == 0} ? result : []\n\nend",
"def topological_sort(vertices)\n edge_count = {}\n sorted = []\n queue = []\n vertices.each do |vertex|\n edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n current = queue.shift\n sorted << current\n current.out_edges.each do |edge|\n destination = edge.to_vertex\n edge_count[destination] -= 1\n queue << destination if edge_count[destination] == 0\n end\n\n end\n sorted\nend",
"def preorder(node)\n # 1->2->4->5->3->6\n if node\n print node.value.to_s + '->'\n preorder(node.left_child)\n preorder(node.right_child)\n end\n end",
"def topological_sort(vertices)\n order = []\n explored = Set.new\n temp = Set.new\n cycle = false\n vertices.each do |vertex|\n cycle = dfs!(order,explored,vertex,temp,cycle) unless explored.include?(vertex)\n return [] if cycle\n end\n order\nend",
"def topological_sort(vertices)\n order = []\n explored = Set.new\n temp = Set.new\n cycle = false\n\n vertices.each do |vertex|\n cycle = dfs!(order, explored, vertex) unless explored.include?(vertex)\n return [] if cycle\n end\n\n order\nend",
"def k_topological_sort(vertices)\n topological_order = []\n\n degrees = {}\n #count the number of in edges for each vertex O(|V|)\n vertices.each { |vertex| degrees[vertex] = vertex.in_edges.length }\n\n #Select those with no in edges\n queue = degrees.select { |vertex, length| length == 0 }.keys\n\n until queue.empty?\n topological_order.push(queue.pop)\n\n #for each out edge, decrement the to vertexes incoming\n #edge count by one\n vertex.out_edges.each do |edge|\n degrees[edge.to_vertex] -= 1\n\n #If there are no more in edges, add it to the queue!\n if degrees[edge.to_vertex] == 0\n queue.unshift(edge.to_vertex)\n end\n end\n end\n #When there is a cycle, the queue will be empty before each node will\n #have been checked; therefore the results array will equal\n #the vertex array iff there is a topological ordering.\n if topological_order.length == vertices.length\n topological_order\n else\n []\n end\n end",
"def topological_sort(vertices)\n queue = []\n order = []\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n order << current\n\n current.out_edges.dup.each do |edge|\n to_vert = edge.to_vertex\n queue << to_vert if to_vert.in_edges.count <= 1\n edge.destroy!\n end\n end\n\n order.length == vertices.length ? order : []\nend",
"def sort(array_of_nodes, order)\n new_arry = []\n array_of_nodes.each { |node|\n node_idx = []\n np = node.node_type == :attribute ? node.element : node\n while np.parent and np.parent.node_type == :element\n node_idx << np.parent.index( np )\n np = np.parent\n end\n new_arry << [ node_idx.reverse, node ]\n }\n ordered = new_arry.sort_by do |index, node|\n if order == :forward\n index\n else\n -index\n end\n end\n ordered.collect do |_index, node|\n node\n end\n end",
"def topological_sort(vertices)\n \nend",
"def topological_sort(vertices)\n in_edge_counts = {}\n sorted = []\n queue = []\n\n vertices.each do |vertex|\n in_edge_counts[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n sorted << current\n\n current.out_edges.each do |edge|\n in_edge_counts[edge.to_vertex] -= 1\n queue << edge.to_vertex if in_edge_counts[edge.to_vertex] == 0\n end\n\n end\n\n sorted.length == 2 ? [] : sorted\nend",
"def topological_sort(vertices)\n queue = []\n result = []\n count = {}\n vertices.each do |vertex|\n count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n vertex = queue.shift\n result << vertex\n vertex.out_edges.each do |edge|\n to = edge.to_vertex\n count[to] -= 1\n queue << to if count[to] == 0\n end\n end\n if count.values.reduce(:+).zero?\n result\n else\n []\n end\nend",
"def topo_sort_rec_wrap(graph, discovered = {}, sorted_list = [])\n graph.keys.each do |vtx|\n next if discovered[vtx]\n topo_sort_rec(graph, vtx, discovered, sorted_list)\n sorted_list << vtx\n end\n sorted_list.reverse\nend",
"def topological_sort(vertices)\n num_edges = {}\n queue = []\n\n vertices.each do |vertex|\n num_edges[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n\n sorted = []\n\n while queue.length > 0\n vertex = queue.shift\n sorted.push(vertex)\n\n vertex.out_edges.each do |edge|\n to_vertex = edge.to_vertex\n\n num_edges[to_vertex] -= 1\n if num_edges[to_vertex] == 0\n queue.push(to_vertex)\n end\n end\n end\n\n if sorted.length == vertices.length\n sorted\n else\n []\n end\nend",
"def topological_sort(vertices)\n count = {}\n sorted = []\n free_queue = []\n\n vertices.each do |vertex|\n count[vertex.value] = vertex.in_edges.length\n if vertex.in_edges.empty?\n free_queue.unshift(vertex)\n end\n end\n\n until free_queue.empty?\n # debugger\n current = free_queue.pop\n # p free_queue.map{|e|e.value}\n sorted << current\n # p current.out_edges.length\n verts = []\n current.out_edges.each do |edge|\n count[edge.to_vertex.value] -= 1\n # vert = edge.to_vertex\n # verts << vert\n end\n\n\n vertices.each do |vertex|\n free_queue.unshift(vertex) if count[vertex.value] == 0 && sorted.index(vertex).nil?\n end\n\n end\n sorted = sorted.uniq\n return [] if sorted.length != vertices.length\n sorted\nend",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def topological_sort(vertices)\n queue = []\n order = []\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n curr = queue.shift\n neighbors = []\n curr.out_edges.each {|edge| neighbors << edge.to_vertex }\n\n curr.out_edges.each {|edge| edge.destroy!}\n\n neighbors.each do |adj|\n queue << adj unless queue.include?(adj)\n end\n\n vertices.delete(curr)\n order << curr\n end\n\n return [] unless order.uniq.length == order.length\n order\nend",
"def topological_sort(vertices)\n in_edge_count = {}\n queue = []\n visited = {}\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.count\n queue << vertex if vertex.in_edges.empty?\n end\n sorted = []\n\n until queue.empty?\n vertex = queue.pop\n sorted << vertex\n\n vertex.out_edges.each do |edge|\n to_vertex = edge.to_vertex\n in_edge_count[to_vertex] -= 1\n queue << to_vertex if in_edge_count[to_vertex] == 0\n end\n end\n sorted.length == vertices.length ? sorted : []\nend",
"def topological_sort(vertices)\n queue = []\n sorted = []\n # keep track of vertex in_edges count so that\n # it doesnt get prematurely pushed into queue\n count = {}\n\n # find started vertexes\n vertices.each do |vertex|\n queue.push(vertex) if vertex.in_edges.empty?\n count[vertex] = vertex.in_edges.count\n end\n\n until queue.empty?\n vertex = queue.shift\n sorted << vertex\n vertex.out_edges.each do |edge|\n vert = edge.to_vertex\n count[vert] -= 1\n queue.push(vert) if count[vert] == 0\n end\n end\n\n sorted.count == vertices.count ? sorted : []\nend",
"def topological_sort\r\n l = []\r\n @visited = {}\r\n s = @charNodes - @adjGraph.keys\r\n s.each do |node|\r\n visit node, l\r\n end\r\n @sortedAlphabet = l\r\n end",
"def topological_sort(vertices)\n vertex_queue = []\n sorted_queue = []\n\n vertex_count = {}\n\n #vertex queue has vertex which do not have any in_edges\n vertices.each do |vertex|\n vertex_count[vertex] = vertex.in_edges.count\n vertex_queue << vertex if vertex.in_edges.empty?\n end\n\n # while !vertex_queue.empty?\n until vetex_queue.empty?\n new_vertex = vertex_queue.shift\n sorted_queue << new_vertex\n\n new_vertex.out_edges.each do |out|\n to_vertex = out.to_vertex\n\n vertex_count[to_vertex] -= 1\n vertex_queue << to_vertex if vertex_count[to_vertex] == 0\n end\n end\n sorted_queue\nend",
"def topological_sort(vertices)\n # Khan's algorithm\n sorted_arr = []\n queue = Queue.new\n # in_edges = {}\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.enq(vertex)\n end\n end\n\n # vertices.each do |vertex|\n # in_edge_cost = vertex.in_edges.reduce(0) { |sum, edge| sum += edge.cost }\n # in_edges[vertex] = in_edge_cost\n # queue << vertex if in_edge_cost == 0\n # end\n\n until queue.empty?\n u = queue.deq\n sorted_arr << u\n while u.out_edges.length != 0\n current_edge = u.out_edges[0]\n queue.enq(current_edge.to_vertex) if current_edge.to_vertex.in_edges == [current_edge]\n current_edge.destroy!\n end\n u.out_edges = []\n end\n\n # until queue.empty?\n # current = queue.shift\n #\n # current.out_edges.each do |edge|\n # to_vertex = edge.to_vertex\n # in_edges[to_vertex] -= edge.cost\n # queue << to_vertex if in_edges[to_vertex] == 0\n # end\n #\n # sorted arr << current\n # end\n\n if sorted_arr.length != vertices.length\n return []\n # vertices.length == order.length ? order : []\n end\n\n sorted_arr\n\n # Tarjan's algorithm (without cyce catching)\n # order = []\n # explored = Set.new\n #\n # vertices.each do |vertex|\n # dfs!(order, explored, vertex) unless explored.include?(vertex) #depth-first search\n # end\n #\n # order\n\nend",
"def topological_sort(vertices)\n queue = Queue.new\n sorted_arr = []\n in_edges_count = {}\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n in_edges_count[vertex] = vertex.in_edges.length\n end\n\n until queue.empty?\n test_vertex = queue.shift\n\n sorted_arr << test_vertex\n test_vertex.out_edges.each do |edge|\n destination_vertex = edge.to_vertex\n in_edges_count[destination_vertex] -= 1\n queue << destination_vertex if in_edges_count[destination_vertex].zero?\n end\n end\n\n return [] if sorted_arr.length < vertices.length\n sorted_arr\nend",
"def topological_sort(vertices) # Kahn's Algorithm. Queue is breadth first search\n sorted = []\n top_queue = []\n in_edge_count = Hash.new(0)\n vertices.each do |vertex|\n in_edge_count[vertex] = vertex.in_edges.length\n top_queue.unshift(vertex) if vertex.in_edges.empty?\n end\n until top_queue.empty?\n # debugger\n current = top_queue.pop\n sorted << current\n current.out_edges.each do |edge|\n top_queue.unshift(edge.to_vertex) if in_edge_count[edge.to_vertex] <= 1\n in_edge_count[edge.to_vertex] -= 1\n end\n # current.destroy!\n\n end\n if sorted.length == vertices.length\n return sorted\n else\n return []\n end\nend",
"def topological_sort(vertices)\n res = []\n queue = []\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n until queue.empty?\n vertex = queue.shift\n res << vertex\n out_edges = vertex.out_edges.dup\n out_edges.each do |edge|\n queue << edge.to_vertex if edge.to_vertex.in_edges.length == 1\n edge.destroy!\n end\n end\n res\nend",
"def sortFile( filename, numberOfValuesToOutput )\n nodeController = NodeController.new( numberOfValuesToOutput )\n # Load each line into memory and add it to the right place in the nodes \n file = File.open( filename, \"r\" )\n file.each_line do | line |\n nodeController.addValueToNodes( line.to_s.chomp.to_f)\n end\n \n # Write the output nodes to disk bottom-up, but only up to a specified number of values\n outFile = File.new( \"output-#{filename}\", \"w\" )\n node = nodeController.lowestValue\n numberOfValuesToOutput.times do\n # Travel the right nodes upwards from the node with the lowest value found\n outFile.puts node.payload.to_s\n node = node.rightNode\n end\n \nend",
"def topological_sort(vertices)\n sorted = []\n top_nodes_queue = []\n\n vertices.each do |vertix|\n top_nodes_queue.push(vertix) if vertix.in_edges.length == 0\n end\n\n until top_nodes_queue.empty?\n unpopped = top_nodes_queue.shift\n sorted << unpopped\n\n (unpopped.out_edges.length - 1).downto(0).each do |index|\n edge = unpopped.out_edges[index]\n if edge.to_vertex.in_edges.length == 1\n\n top_nodes_queue.push(edge.to_vertex)\n end\n to_vertex = edge.to_vertex\n edge.destroy!\n end\n end\n\n return [] unless vertices.length == sorted.length\n sorted\nend",
"def topological_sort(vertices)\n out_queue = []\n sorted = []\n sorted_hash = {}\n\n until sorted.length == vertices.length \n out_queue = vertices.select do |v| \n v.in_edges.empty? && !sorted_hash.include?(v.value)\n end\n # Break if Cyclic/Disconnected Graph\n return [] if out_queue.empty?\n\n until out_queue.empty?\n vertice = out_queue.shift\n sorted << vertice\n sorted_hash[vertice.value] = true\n vertice.out_edges[0].destroy! until vertice.out_edges.empty?\n end\n end\n\n sorted\nend",
"def tarian_topological_sort(vertices)\n sorted = []\n visited = Set.new\n\n vertices.each do |vertex|\n dfs!(vertex, visited, sorted) unless visited.include?(vertex)\n end\n\n sorted\nend",
"def topological_sort(vertices)\n # visited = Set.new\n # # visited = Array.new(vertices.length, false)\n # cycle = [false]\n # result = []\n #\n # vertices.each do |vertex|\n # unless visited.include?(vertex)\n # visit(vertex, visited, result, cycle)\n # end\n # end\n #\n # if cycle == [true]\n # return []\n # else\n # return result\n # end\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n queue = []\n result = []\n vertices.each do |vert|\n queue << vert if vert.in_edges.empty?\n end\n # byebug\n count = 0\n until queue.empty?\n vertex = queue.pop\n result << vertex\n to_destroy = []\n for i in (0..(vertex.out_edges.length - 1))\n edge = vertex.out_edges[i]\n if edge.to_vertex.in_edges.length == 1\n queue.push(edge.to_vertex)\n end\n to_destroy << edge\n i += 1\n end\n to_destroy.each do |edge|\n edge.destroy!\n end\n count += 1\n end\n result\nend",
"def topological_sort(vertices)\n output = []\n # visited does not record leaf nodes unless there's a loop\n visited = []\n until vertices.empty?\n random_node = vertices[rand(vertices.length)]\n vertices.delete(random_node)\n dfs(random_node, output)\n end\n # if loop\n # if output.length == visited.length\n # return []\n # end\n return [] if output.nil?\n # if not loop\n # visited.each do |node|\n # p node.value\n # end\n output.reverse\nend",
"def topological_sort(vertices)\n queue = []\n list = []\n\n vertices.each do |v|\n if v.in_edges.empty?\n queue << v\n end\n end\n\n\n while queue.length > 0\n curr = queue.shift\n list << curr\n\n (curr.out_edges.length-1).downto(0) do |i|\n if curr.out_edges[i].to_vertex.in_edges.length == 1\n queue << curr.out_edges[i].to_vertex\n end\n curr.out_edges[i].destroy!\n end\n end\n\n vertices.length == list.length ? list : []\nend",
"def topological_sort(vertices)\n result = []\n queue = []\n visited_nodes = 0\n remaining_vert = vertices.dup\n while result.length < vertices.length\n # print 'hey'\n # print remaining_vert.map{|vert| vert.in_edges.length}\n # print remaining_vert.map{|vert| vert.value}\n remaining_vert.each do |vert|\n if vert.in_edges.length == 0\n queue.push(vert)\n new_vert = []\n remaining_vert.each do |vert2|\n new_vert.push(vert2) unless vert2 == vert\n end\n remaining_vert = new_vert\n end\n end\n # print 'hi'\n # print queue.map{|queue| queue.out_edges.length}\n return [] if remaining_vert.length>0 && queue.length == 0\n next_vert = queue.shift()\n next_vert.out_edges.each do |edge|\n edge.destroy!\n end\n result.push(next_vert)\n # print result.map{|queue| queue.out_edges.length}\n visited_nodes+=1\n end\n result\nend",
"def topological_sort(vertices)\n queue = vertices.select { |vertex| vertex.in_edges.empty? }\n sorted_vertices = []\n\n until queue.empty?\n vertex = queue.shift\n vertices.delete(vertex)\n vertex.out_edges.length.times do\n out_edge = vertex.out_edges[0]\n to_vertex = out_edge.to_vertex\n queue.push(to_vertex) if to_vertex.in_edges.length == 1\n out_edge.destroy!\n end\n\n sorted_vertices.push(vertex)\n end\n\n vertices.empty? ? sorted_vertices : []\nend",
"def topsort\n graph = RGL::DirectedAdjacencyGraph.new\n # init vertices\n items = @normal_sources\n items.each {|item| graph.add_vertex(item) }\n # init edges\n items.each do |item|\n item.dependencies.each do |dependency|\n # If we can find items that provide the required dependency...\n # (dependency could be a wildcard as well, hence items)\n dependency_cache[dependency] ||= provides_tree.glob(dependency)\n # ... we draw an edge from every required item to the dependant item\n dependency_cache[dependency].each do |required_item|\n graph.add_edge(required_item, item)\n end\n end\n end\n\n begin\n graph.topsorted_vertices\n rescue RGL::TopsortedGraphHasCycles => e\n output_cycles(graph)\n raise e # fail fast\n end\n end",
"def topological_sort(vertices)\n list = []\n queue = []\n\n queue = enqueue(vertices, queue)\n\n until queue.empty?\n vertex = queue.shift\n list << vertex\n\n new_vertices = vertex.out_edges.map(&:to_vertex)\n out_edges = vertex.out_edges.dup\n\n out_edges.each(&:destroy!)\n vertex.out_edges = []\n\n queue = enqueue(new_vertices, queue)\n end\n\n list.length == vertices.length ? list : []\nend",
"def topological_sort(vertices)\n next_vertex = Queue.new\n result = []\n vertices.each do |vertex|\n next_vertex.push(vertex) if vertex.in_edges.length < 1\n end\n\n while !next_vertex.empty?\n vertex = next_vertex.pop\n vertex.out_edges.each do |edge|\n new_vertex = edge.to_vertex\n next_vertex.push(new_vertex) if new_vertex.in_edges.length <= 1\n end\n vertex.out_edges.each{|edge| edge.destroy!}\n result.push(vertex)\n end\n result\nend",
"def dfs_topological_sort\n # sorted by finished time reversely and collect node names only\n timestamp, = self.depth_first_search\n timestamp.sort {|a,b| b[1][1] <=> a[1][1]}.collect {|x| x.first }\n end",
"def populate_ordering\n\t\tordering = Array.new\n\t\tself.nodes.each do |node|\n\t\t\tordering.push(ObjectPlace.new(\"Node\", node.id))\n\t\t\t#puts \"Node\" + node.id.to_s\n\t\t\tnode.notes.each do |note|\n\t\t\t\tordering.push(ObjectPlace.new(\"Note\", note.id))\n\t\t\t\t#puts \"Note\" + note.id.to_s\n\t\t\tend\n\t\tend\n\t\treturn ordering\n\tend",
"def topological_sort(vertices) # array => # layers of unordered sets (could implement these as subarrays)\n # Kahn's alg. #Coffman-Graham gives deterministic sorting\n #look for vertices w/o @in_edges; add to list\n #look for vertices w/o @in_edges (exclude @in_edges in list)\n #repeat until all vertices in the list\n\n #w/o queue\n list = []\n\n until list.length == vertices.length\n changed = false\n vertices.each do |vertex|\n if !list.include?(vertex) && ( vertex.in_edges.length == 0 ||\n vertex.in_edges.all?{|edge| list.include?(edge.from_vertex)} )\n list.push(vertex)\n changed = true\n end\n end\n\n return [] if !changed\n end\n\n list\n\n # #w/ queue (could also implement by enqueueing out-edges' to-vertices\n # for each node added to list, replacing queue.each w/ until queue.empty?)\n # list = []\n # queue = []\n #\n # full = vertices.length\n #\n # until list.length == full\n # changed = false\n # vertices.each do |vertex|\n # if vertex.in_edges.length == 0 && !list.include?(vertex)\n # queue.push(vertex)\n # end\n # end\n #\n # queue.each do |vertex|\n # vertex.out_edges.each {|edge| edge.destroy!} #causes spec's test to malfunction\n # list.push(queue.shift)\n # changed = true\n # end\n #\n # return [] if !changed\n # end\nend",
"def topological_sort(vertices)\n sorted = []\n top = new Queue() \n graph.vertices.each do |vertex|\n if vertex.in_edges.empty? \n top.enqueue(vertex)\n end \n end \nd\n until top.empty? \n current = top.pop \n sorted << current \n current.out_edges.each do |edge|\n if edge.destination.in_edges.empty? \n top.enqueue(edges)\n end \n end \n graph.delete_edge(edge)\n graph.delete_vertex(current); \n end \n\n \n\nend",
"def findOrdering(neededByHash, leafSet)\n\t\t#this is the stack used to do a DFS\n\t\tpendingStack = Array.new()\n\n\t\t#for each target, this hash will contain an array of it's dependents\n\t\t#that have not yet been visited. The value will be initialized to\n\t\t#the values in neededByHash the first time a target node is visited,\n\t\t#and then decremented one by one as the graph is traversed\n\t\tremainingChildrenHash = Hash.new()\n\n\t\tdef copySetToArray(st)\n\t\t\tnewArr = []\n\t\t\tst.each {|vl| newArr.push(vl)}\n\t\t\treturn newArr\n\t\tend\n\n\t\tpendingStack.concat(leafSet.to_a())\n\t\tpendingStack.each do |trg| \n\t\t\tchildrenSet = neededByHash[trg]\n\t\t\tchildrenArr = copySetToArray(childrenSet)\n\t\t\tremainingChildrenHash[trg] = childrenArr\n\t\tend\n\n\t\t#the output ordering, where every filename is listed after all files\n\t\t#it depends on\n\t\tordering = Array.new()\n\n\t\tuntil(pendingStack.empty?)\n\t\t\t#debug \"\\n\\nfindOrdering:pendingStack: #{arrayString(pendingStack)}\"\n\t\t\tnextTarget = pendingStack.last()\n\t\t\t#debug \"findOrdering:Visiting: #{nextTarget}\"\n\t\t\tif(remainingChildrenHash[nextTarget].empty?)\n\t\t\t\tpendingStack.pop()\n\t\t\t\tordering.unshift(nextTarget)\n\t\t\telse\n\t\t\t\tnextChild = remainingChildrenHash[nextTarget].pop()\n\t\t\t\tunless (remainingChildrenHash.has_key?(nextChild))\n\t\t\t\t\tnextChildsChildrenSet = neededByHash[nextChild]\n\t\t\t\t\tnccArr = copySetToArray(nextChildsChildrenSet)\n\t\t\t\t\tremainingChildrenHash[nextChild] = nccArr\n\t\t\t\t\tpendingStack.push(nextChild)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn ordering\n\t\n\tend",
"def topological_sort(vertices)\n list = []\n sorted = []\n count_set = {}\n\n vertices.each do |vertex|\n count_set[vertex] = vertex.in_edges.count\n list << vertex if vertex.in_edges.empty?\n end\n\n until list.empty?\n vertex = list.shift\n sorted << vertex\n\n vertex.out_edges.each do |edge|\n to = edge.to_vertex\n count_set[to] -= 1\n list << to if count_set[to] == 0\n end\n end\n\n if sorted.length == vertices.length\n sorted\n else\n []\n end\nend",
"def dfs_tree_preorder(start, edges)\n require 'set'\n queue = [[start,nil]]\n visited = Set[start]\n while queue.size > 0\n f,ff = *(queue.pop) \n ts = edges[f].keys.reject{ |t| visited.member?(t) }\n yield(f, ff)\n ts.each{ |t| visited << t; queue << [t,f] }\n end\nend",
"def topological_sort(vertices)\n visited = vertices.map { |v| [v, false] }.to_h\n result = []\n visited.each do |vertex, status|\n begin\n visit(vertex, visited, result) unless status\n rescue\n result = []\n break\n end\n end\n result\nend",
"def find_order_bfs\n queue = []\n @num_courses.times { |v| queue.push(v) if @in_degrees[v].zero? } # 入度为0的全都放入\n\n visited = []\n until queue.empty?\n node_key = queue.shift\n\n visited.unshift(node_key) # 注意顺序\n\n @nodes[node_key]&.each do |neighbor|\n @in_degrees[neighbor] -= 1\n queue.push(neighbor) if @in_degrees[neighbor].zero?\n end\n end\n\n visited.size == @num_courses ? visited : []\n end",
"def install_order(arr)\n vertices = {}\n max = 0 \n arr.each do |tuple|\n vertices[tuple[0]] = Vertex.new(tuple[0]) unless verticles[tuple[0]]\n vertices[tuple[1]] = Vertex.new(tuple[1]) unless verticles[tuple[1]]\n # create an edge for each pair \n\n Edge.new(vertices[tuple[1]], vertices[tuple[0]])\n\n max = tuple.max if tuple.max > max \n end \n\n independent = []\n (1..max).each do |i| \n independent << i unless vertices[i]\n end \n\n independent + topological_sort(vertices.values).map { |v| v.value }\nend",
"def topological_sort(vertices)\n sorted = []\n top = []\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top << vertex\n end\n end\n\n until top.empty?\n vertex = top.shift\n sorted << vertex\n neighbors = vertex.out_edges.map(&:to_vertex)\n\n vertex.disconnect!\n\n neighbors.each do |neighbor|\n if neighbor.in_edges.empty?\n top << neighbor\n end\n end\n end\n\n return sorted if sorted.length == vertices.length\n\n []\nend",
"def topological_sort(vertices)\n sorted, queue = [], []\n\n vertices.each do |vtx|\n queue << vtx if vtx.in_edges.empty?\n end\n\n until queue.empty?\n next_vtx = queue.shift\n sorted << next_vtx\n #enumerable tracks index so destroy throws\n #off the each method\n until next_vtx.out_edges.empty?\n edge = next_vtx.out_edges.first\n dependent = edge.to_vertex\n edge.destroy!\n if dependent.in_edges.empty?\n queue << dependent\n end\n end\n vertices.delete(next_vtx)\n end\n return [] if vertices.count > 0\n sorted\nend",
"def topological_sort(vertices)\n results = []\n queue = []\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue << vertex\n end\n end\n\n until queue.empty?\n current_node = queue.pop\n current_node.out_edges.each do |node|\n node.destroy!\n end\n end\nend",
"def topological_sort(vertices)\n # kahn_sort(vertices)\n tarjan_sort(vertices)\nend",
"def topological_sort(entry, graph_trait = nil)\n topo = []\n worklist = WorkList.new([entry])\n vpcount = Hash.new(0)\n worklist.process { |node|\n topo.push(node)\n succs = graph_trait ? graph_trait.successors(node) : node.successors\n succs.each { |succ|\n vc = (vpcount[succ] += 1)\n preds = graph_trait ? graph_trait.predecessors(succ) : succ.predecessors\n if vc == preds.length\n vpcount.delete(succ)\n worklist.enqueue(succ)\n end\n }\n }\n assert(\"topological_order: not all nodes marked\") { vpcount.empty? }\n topo\n end",
"def topological_sort(vertices)\n return []\nend",
"def topological_sort(vertices)\n sorted = []\n queue = []\n\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current = queue.shift\n sorted << current\n\n current.out_edges.dup.each do |edge|\n next_vertex = edge.to_vertex\n edge.destroy!\n if next_vertex.in_edges.empty?\n queue << next_vertex\n end\n\n end\n end\n\n sorted.count == vertices.count ? sorted : []\nend",
"def solve_prims\n linked, unlinked = [nodes.first], nodes[1..-1].dup\n end",
"def tsort_each_node(&block)\n @dependencies.each_key(&block)\n end",
"def topological_sort(vertices)\n sorted = []\n queue = []\n vertices.each do |v|\n queue << v if v.in_edges.empty?\n end\n until queue.empty?\n u = queue.shift\n until u.out_edges.empty?\n e = u.out_edges.pop\n v = e.to_vertex\n e.destroy!\n queue << v if v.in_edges.empty?\n end\n sorted << u\n vertices.delete(u)\n end\n vertices.empty? ? sorted : []\nend",
"def topological_sort(vertices)\n queue = []\n result = []\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.push(vertex)\n end\n end\n\n until queue.empty?\n vertex = queue.shift\n result << vertex\n\n vertex.out_edges.dup.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue.push(edge.to_vertex) \n end\n edge.destroy!\n end\n end\n \n if vertices.length == result.length\n return result\n else\n return []\n end\nend",
"def topological_sort(graph)\n queue = []\n graph.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n sorted_result = []\n until queue.empty?\n curr_vertex = queue.shift\n curr_vertex.out_edges.reverse_each do |edge|\n edge.destroy!\n end\n sorted_result << curr_vertex\n graph.delete(curr_vertex)\n graph.each do |vertex|\n queue << vertex if vertex.in_edges.empty? && !queue.include?(vertex)\n end\n end\n graph.length.zero? ? sorted_result : []\nend",
"def topological_sort(vertices)\n #Khan's\n sorted = []\n top = []\n has_in_edges = {}\n\n # O(|v|) time\n #take vertex if it has no in-edges\n vertices.each do |vertex|\n has_in_edges[vertex] = vertex.in_edges.length\n if vertex.in_edges.empty?\n top.push(vertex)\n end\n end\n\n # O(|e| set) time\n until top.empty?\n current = top.shift\n sorted.push(current)\n current.out_edges.each do |edge|\n to_vertex = edge.to_vertex\n has_in_edges[to_vertex] -= 1\n if has_in_edges[to_vertex] == 0\n top.push(to_vertex)\n end\n end\n\n end\n\n return sorted if sorted.length == vertices.length\n []\nend",
"def topological_sort(vertices)\n #Kahn's Algorithm\n #queue keeps the nodes that have not been sorted yet\n #whatever is popped off the stack goes to sorted and is done\n queue = []\n sorted = []\n\n #loop through vertices\n vertices.each do |vertex|\n #find vertices with no dependencies and push to queue\n queue << vertex if vertex.in_edges.empty?\n end\n\n #pop off from queue and check the out edges of each\n #after pop, delete the vertex all its out edges\n #push that vertex into the sorted array\n #look at each of the destination nodes and push them onto queue if no in edges\n #do this until the queue is empty\n until queue.empty?\n curr_node = queue.shift\n\n sorted << curr_node\n to_vertices = []\n\n #grabs all the vertices connected to the out edges of the curr_node\n curr_node.out_edges.reverse.each do |out_edge|\n # until curr_node.out_edges.empty?\n\n\n # p out_edge.to_vertex.value\n to_vertices << out_edge.to_vertex\n\n #destroy the edge after using it up\n #destroy not working like how I thought it would, maybe save destroy for after\n\n # out_edge.destroy!\n out_edge.destroy!\n end\n\n #need to check if these vertices are connected to anything after\n #curr_node's out edge deletion\n to_vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n #check all vertices connected by curr_node's out_edges\n #if those\n end\n\n if sorted.length == vertices.length\n return sorted\n else\n return []\n end\n\n \n # easy_read = []\n # sorted.each do |vertex|\n # easy_read << vertex.value\n # end\n # p easy_read\n\n\n\n #Tarjan's Algorithm\nend",
"def topological_sort(vertices)\n queue = fill_queue(vertices)\n result = []\n \n i = 0\n while queue \n vert = queue.pop\n vert.out_edges.map do |edge|\n queue.unshift(edge.to_vertex)\n edge.destroy! \n end\n result << vert\n fill_queue(vertices) if queue.empty? && !(vertices.empty?)\n end\n\n return vertices.empty? ? [] : result\nend",
"def order\n if terminal?\n 0\n elsif self_referential?\n 1\n else\n r = 0\n @rules.each do |rule|\n # Only interested in rule with recursion\n if rule.size > 1\n rule.each do |elem|\n # Only interested in references\n if elem.is_a? String\n b = @klass.defs.find_all {|i| i.name == elem}[0].order + 1\n r = b if b > r # swap if higher\n end\n end\n end\n end\n r\n end\n end",
"def level_order(node)\n return if !node # return if the node is nil\n queue = Queue.new() # create an empty queue\n queue.enqueue(node) # add the node to the queue\n while !queue.is_empty? # loop as long as the queue is not empty\n temporal_node = queue.dequeue # remove an element from the queue and save it as temporal_node\n print temporal_node.value, \" \" # print the value of temporal_node\n # add both the left and right nodes (if they are not nil) to the queue\n queue.enqueue(temporal_node.left_child) if temporal_node.left_child\n queue.enqueue(temporal_node.right_child) if temporal_node.right_child\n end\n end",
"def topological_sort(vertices)\n sorted = []\n top = []\n\n vertices.each do |vertx|\n if vertx.in_edges.empty?\n top << vertx\n end\n end\n\n until top.empty?\n current = top.pop\n sorted << current\n\n edges = current.out_edges.dup\n\n edges.each do |edge|\n\n destination = edge.to_vertex\n\n edge.destroy!\n\n if destination.in_edges.empty?\n top << destination\n end\n\n end\n\n end\n return sorted if sorted.length == vertices.length\n []\nend",
"def tsort_cyclic(graph)\n fag = feedback_arc_graph(graph)\n reduced_graph = subtract_edges_graph(graph, fag)\n GraphHash.from(reduced_graph).tsort\n end",
"def topological_sort(vertices)\n sorted = []\n queue = []\n vertices.each do |vertex|\n queue << vertex if vertex.in_edges.empty?\n end\n\n until queue.empty?\n current_vert = queue.shift\n sorted << current_vert\n current_vert.out_edges.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue << edge.to_vertex\n end\n end\n current_vert.out_edges.each do |edge|\n edge.destroy!\n end\n end\n\n return [] if sorted.length < vertices.length\n sorted\nend",
"def topological_sort\n result_size = 0\n result = Array.new(@vertices.length)\n visited = Set.new\n\n visit = lambda { |v|\n return if visited.include? v\n v.successors.each do |u|\n visit.call u\n end\n visited.add v\n result_size += 1\n result[-result_size] = v\n }\n\n @vertices.each do |v|\n next if visited.include? v\n visit.call v\n end\n\n result\n end",
"def build_nth_order(order)\n each_node_with_connections(order-1) do |node|\n connect :from => node,\n :to => discover_connections(node, order),\n :order => order\n end\n end",
"def topological_sort(&blk)\n processed_nodes = []\n unprocessed_allowable_nodes = (0...self.size).map{|i| yield(self, i).size==0 ? self[i] : nil }.compact\n while unprocessed_allowable_nodes.size > 0\n node = unprocessed_allowable_nodes.pop\n processed_nodes.push node\n new_nodes = []\n self.each.with_index do |node, i|\n next if processed_nodes.include?(node) || unprocessed_allowable_nodes.include?(node)\n dependencies = yield(self, i)\n dependencies.reject! {|j| processed_nodes.include?(self[j])}\n if dependencies.size == 0\n unprocessed_allowable_nodes << node\n end\n end\n end\n raise CyclesInTopologicalSort, \"Can't do topological sort on Array; it has cycles\" \\\n unless processed_nodes.size == self.size\n processed_nodes\n end",
"def topological_sort(vertices)\n sorted = []\n top = []\n \n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top << vertex\n end\n end\n\n until top.empty?\n current = top.pop\n sorted << current\n current.out_edges.each do |edge|\n if edge.to_vertex.in_edges.empty?\n top << edge.to_vertex\n end\n edge.destroy!\n end\n vertices.delete(current)\n end\n sorted\nend",
"def topological_sort_khans(vertices)\n sorted = []\n queue = []\n in_degrees = {}\n\n vertices.each do |vertex|\n queue.unshift(vertex) if vertex.in_count == 0\n in_degrees[vertex] = vertex.in_count\n end\n\n until queue.empty?\n current = queue.pop\n sorted << current\n\n current.out_edges.each do |edge|\n destination = edge.to_vertex\n\n in_degrees[destination] -= 1\n queue.unshift(destination) if in_degrees[destination] == 0\n end\n\n end\n\n sorted\nend",
"def topological_sort(vertices)\n queue = []\n list = []\n vertices.each { |vertex| queue << vertex if vertex.in_edges.empty? }\n\n until queue.empty?\n removal = queue.shift\n list << removal\n\n removal.out_edges.each do |edge|\n outer_vertex = edge.to_vertex\n\n outer_vertex.in_edges.delete(edge)\n\n queue << outer_vertex if outer_vertex.in_edges.empty?\n end\n end\n\n return list if list.length == vertices.length\n\n []\nend",
"def visit(current_node, nodes, list)\n return if %w[permanent temporary].include?(current_node.marked)\n\n current_node.marked = \"temporary\"\n nodes.each { |node| visit(node, nodes, list) if node.from == current_node.to }\n current_node.marked = \"permanent\"\n list.unshift(current_node.from) unless list.include?(current_node.from)\nend",
"def sorted_keys(nodes)\n keys = []\n nodes.each do |n|\n n.cells.each do |c|\n keys << c.key\n end\n end\n keys.uniq.sort { |a, b| a <=> b }\n end",
"def reorder\n sibs = siblings\n return if sibs.empty?\n sibs.each do |s|\n if self.ranking >= s.ranking\n self.move_to_left_of(s) and return\n end\n end\n self.move_to_right_of(sibs.last)\n end",
"def preorder\n nodelets_array = []\n\n preorder_helper(@root, nodelets_array)\n\n return nodelets_array\n end",
"def topological_sort(vertices)\n queue = []\n result = []\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.push(vertex)\n end\n end\n\n until queue.empty?\n vertex = queue.shift\n result << vertex\n\n vertex.out_edges.reverse.each do |edge|\n if edge.to_vertex.in_edges.length == 1\n queue.push(edge.to_vertex)\n end\n edge.destroy!\n end\n end\n\n if vertices.length == result.length\n return result\n else\n return []\n end\nend",
"def sort\n _in_order(@root, @@id_fun) # use Id function\n end",
"def preorder(node)\n visit node \n left = preorder node.left_node if node.left_node \n right = preorder node.right_node if node.right_node\n p left ? left.value : nil \n p right ? right.value : nil\n p node.value\n puts '----'\n node\n end",
"def install_order(arr)\n max = 0\n vertices = {}\n arr.each do |tuple|\n #create the graph\n vertices[touple[0]] = Vertex.new(touple[0]) unless vertices[tuple[0]]\n vertices[tuple[1]] = Vertex.new(tuple[1]) unless vertices[tuple[1]]\n\n #reset max if needed\n max = tuple.max if tuple.max > max\n end\n\n #find the missing packages\n independent = []\n (1..max).each do |i|\n independent << i unless vertices[i]\n end\n #sort the vertices of the graph and add the missing packages\n independent + topolocical_sort(vertices.values).map { |v| v.value }\nend",
"def topological_sort(vertices)\n sorted = []\n top = Queue.new\n vertices.each do |vertex|\n if vertex.in_edges.empty? \n top.enq(vertex)\n end\n end\n\n until top.empty?\n current = top.pop\n sorted << current\n while current.out_edges.length != 0\n edge = current.out_edges[0]\n if edge.to_vertex.in_edges == [edge]\n top.enq(edge.to_vertex)\n end\n edge.destroy!\n end\n\n end\n\n if sorted.length != vertices.length\n return []\n end\n\n sorted\nend",
"def topological_sort(vertices)\n sorted = []\n top = Queue.new\n # collect node with no in edges\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top.enq(vertex)\n vertices.delete(vertex)\n end\n end\n\n # While the queue is not empty\n while !top.empty?\n current = top.pop\n sorted.push(current)\n\n # destroy edges\n counter = current.out_edges.length - 1\n while counter >= 0\n current.out_edges[counter].to_vertex.in_edges.delete(current.out_edges[counter])\n current.out_edges[counter]\n counter -= 1\n end\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top.enq(vertex)\n vertices.delete(vertex)\n end\n end\n end\n\n return [] if !vertices.empty?\n sorted\nend",
"def topology_sort\n topology = []\n permanently_visited = Set.new\n temporary_visited = []\n loop do\n next_task = each_task.find do |task|\n not (permanently_visited.include? task or temporary_visited.include? task)\n end\n return topology unless next_task\n visit(next_task, permanently_visited, temporary_visited).each do |task|\n topology.insert 0, task\n end\n end\n topology\n end",
"def topological_sort(vertices)\n sorted = []\n top_queue = []\n # vertices_hash = {}\n\n # vertices.each { |vertex| vertices_hash[vertex] = true }\n\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n top_queue << vertex\n end\n end\n\n until top_queue.empty?\n current_vertex = top_queue.shift\n sorted << current_vertex\n\n until current_vertex.out_edges.empty?\n edge = current_vertex.out_edges[0]\n neighbor = edge.to_vertex\n edge.destroy!\n\n if neighbor.in_edges.empty?\n top_queue.push(neighbor)\n end\n\n end\n # vertices_hash.delete(current_vertex)\n end\n\n # vertices_hash.empty? ? sorted : []\n # Or\n sorted.length == vertices.length ? sorted : []\nend"
] | [
"0.6771997",
"0.63471776",
"0.62937516",
"0.6250659",
"0.6204097",
"0.61987805",
"0.61019766",
"0.608197",
"0.60374594",
"0.60350305",
"0.5919402",
"0.5908654",
"0.5883148",
"0.5829877",
"0.5822465",
"0.5822389",
"0.5819141",
"0.58055353",
"0.5771118",
"0.5761089",
"0.5752894",
"0.57418984",
"0.5737127",
"0.57201993",
"0.5718338",
"0.57100415",
"0.5689699",
"0.5683537",
"0.56600845",
"0.5659978",
"0.5659978",
"0.5643863",
"0.56413823",
"0.563744",
"0.56313246",
"0.56203765",
"0.5619976",
"0.55829823",
"0.55786324",
"0.55719876",
"0.55684227",
"0.5567918",
"0.55360705",
"0.5531314",
"0.5530523",
"0.55240834",
"0.55150676",
"0.5513381",
"0.5507012",
"0.5504007",
"0.54982",
"0.5491565",
"0.54786515",
"0.54765606",
"0.54722244",
"0.54715735",
"0.54608625",
"0.54569244",
"0.5454647",
"0.5446932",
"0.54393166",
"0.5433454",
"0.5427399",
"0.54268837",
"0.5418368",
"0.54161626",
"0.5413132",
"0.54130894",
"0.5411342",
"0.5408388",
"0.5400397",
"0.5390074",
"0.538653",
"0.5376736",
"0.5373645",
"0.53706753",
"0.53475416",
"0.5344511",
"0.5334987",
"0.5331764",
"0.5322122",
"0.5320718",
"0.5318974",
"0.5317405",
"0.5316154",
"0.53104985",
"0.5308702",
"0.5304723",
"0.5301372",
"0.52981365",
"0.528478",
"0.52828485",
"0.52680445",
"0.5261779",
"0.52545214",
"0.52524203",
"0.52512616",
"0.5246935",
"0.5240441",
"0.52180004"
] | 0.7988911 | 0 |
Globally schedule a graph, meaning to anchor all floating nodes to a fixed node. All fixed nodes are part of a basic block, so globally scheduling also puts all floating nodes into a basic block. | def global_schedule(graph)
# Create a work list of the floating nodes.
to_schedule = graph.all_nodes.select {|n| n.floating? && n.op != :immediate }
# Keep going until the work list is empty.
until to_schedule.empty?
node = to_schedule.shift
# Are we ready to schedule this node?
if ready_to_schedule?(node)
# Find candidates to anchor this node to.
candidates = schedule_candidates(graph, node)
# If there aren't any then we're stuck!
raise 'stuck' if candidates.empty?
# Sort the candidates and take the first one to get the best.
best_candidate = sort_candidates(candidates).first
# Add a global schedule edge.
node.output_to :global_schedule, best_candidate
else
# If we aren't ready to schedule this node, try it again later.
to_schedule.push node
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_schedule(graph)\n # Find all basic blocks and locally schedule them.\n\n graph.all_nodes.each do |node|\n if node.begins_block?\n locally_schedule_block node\n end\n end\n end",
"def locally_schedule_block(first_node)\n # Find all the nodes in this basic block.\n\n in_block = Set.new(nodes_in_block(first_node))\n\n # Back up a second... our first node could be a fixed node, which\n # actually has input values. Such as a branch with a condition.\n # The nodes involved in that condition actually need to come first.\n\n first_node = first_in_block(first_node, in_block)\n\n # Create a work list of nodes to schedule and a set of nodes\n # already scheduled.\n\n to_schedule = in_block.to_a\n scheduled = Set.new\n\n # The first node in the basic block is already scheduled first.\n\n to_schedule.delete first_node\n scheduled.add first_node\n\n # The tail is the last node we scheduled.\n\n tail = first_node\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # We are ready to locally schedule if all inputs that are in this\n # block have themselves already been scheduled.\n\n if node.inputs.from_nodes.all? { |i| !in_block.include?(i) || scheduled.include?(i) }\n # Add a local schedule edge from the previous last node to this one,\n # which then becomes the last node.\n raise if tail.inputs.from_nodes.include? node\n tail.output_to :local_schedule, node\n tail = node\n scheduled.add node\n else\n to_schedule.push node\n end\n end\n end",
"def fixed_anchor(node)\n raise unless globally_scheduled?(node)\n\n if node.fixed?\n # A fixed node is anchored to itself.\n node\n else\n # Otherwise we anchored using an output to another node.\n anchor = node.outputs.with_output_name(:global_schedule).to_nodes.first\n raise unless anchor\n fixed_anchor(anchor)\n end\n end",
"def schedule(&block)\n fiber = pool_fiber\n EM.next_tick { fiber.resume(block) }\n end",
"def schedule(parent: @parent || Task.current)\n @scheduler_task ||=\n parent.async { |task|\n task.annotate(\"scheduling tasks for #{self.class}.\")\n\n while @waiting.any? && !limit_blocking?\n delay = [next_acquire_time - Async::Clock.now, 0].max\n task.sleep(delay) if delay.positive?\n resume_waiting\n end\n\n @scheduler_task = nil\n }\n end",
"def globally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:global_schedule)\n end",
"def update\n # center force (pull nodes to center)\n @nodes.each do |n|\n n.apply_momentum(Force.center_mom(PVector.sub(n.loc, @center)))\n # apply field force (push nodes apart)\n @nodes.each do |n2|\n n.apply_momentum(Force.field_mom(PVector.sub(n.loc, n2.loc))) unless n == n2\n end\n end\n \n # edge forces (pull connected nodes to each other)\n @edges.each do |e|\n e.from.apply_momentum(Force.edge_mom(PVector.sub(e.to.loc, e.from.loc), e.strength))\n end\n \n # move the nodes\n @nodes.each { |n| n.update }\n end",
"def schedule(&blk)\n @reactor.next_tick(blk)\n end",
"def bft(&block)\n queue = Queue.new\n \n # Set all nodes to not enqueued\n self.each do |node|\n node.enqueued = false\n end\n\n queue.push(self) \n self.enqueued = true\n\n while(queue.size > 0)\n # Get next node in the queue\n node = queue.pop\n \n # Pass node off to block\n block.call(node)\n\n # Enqueue all children nodes\n node.child_array.each do |child|\n if !child.enqueued\n queue.push(child)\n child.enqueued = true\n end\n end\n\n end #while\n end",
"def schedule(&block)\n pool_fiber.resume(block)\n end",
"def schedule_candidates(graph, node)\n if node.outputs.size == 1\n # If a node has just one output then that's the only candidate.\n\n [node.outputs.to_nodes.first]\n else\n # Otherwise, consider all the nodes in the graph (yes this is\n # quadratic).\n\n graph.all_nodes.select do |candidate|\n # The start node is never a candidate because we're going to schedule\n # before the candidate, and we can't schedule before the start node.\n\n if ![:start, :immediate].include?(candidate.op)\n # We only consider globally scheduled nodes as candidates.\n\n if globally_scheduled?(candidate)\n # Is there a control-flow path from all the inputs of the node to this candidate?\n\n from_all_inputs = node.inputs.from_nodes.all? { |i| !globally_scheduled?(i) || path_from_to(i, candidate) }\n\n # Is there a control-flow path from this candidate to all the outputs of this node?\n\n to_all_outputs = node.outputs.to_nodes.all? { |o| !globally_scheduled?(o) || path_from_to(candidate, o) }\n\n # Both conditions need to be true for this candidate to be valid.\n\n from_all_inputs && to_all_outputs\n end\n end\n end\n end\n end",
"def schedule_every (freq, params={}, &block)\n\n params = prepare_params(params)\n params[:every] = freq\n\n first_at = params[:first_at]\n first_in = params[:first_in]\n\n #params[:delayed] = true if first_at or first_in\n\n first_at = if first_at\n at_to_f(first_at)\n elsif first_in\n Time.now.to_f + Rufus.duration_to_f(first_in)\n else\n Time.now.to_f + Rufus.duration_to_f(freq) # not triggering immediately\n end\n\n do_schedule_at(first_at, params, &block)\n end",
"def schedule\n # implemented by subclass\n end",
"def fill_first_task\n first_basis = @first_basis || basis_for_initial_task\n return unless first_basis # no initial basis for current task\n dual_task = Tasks::RestrictedDualSimplex.new_without_plan(\n task.task,\n first_basis,\n task.sign_restrictions\n )\n tasks_list << dual_task # add current task to queue\n end",
"def schedule\n run_callbacks :schedule do\n inline_mode ? perform_inline : perform_async\n end\n end",
"def fruchterman_reingold(max_iters=100, width=@width, height=@height, nodeset=@nodes, edgeset=@edges, adjacency=@adjacency)\n puts \"beginning fruchterman_reingold @ \"+Time.now.to_s\n iterations = max_iters\n area = width*height\n k = nodeset.length > 0 ? Math.sqrt(area/nodeset.length) : 1 #multiply this by .75 to slow it down?\n k2 = k**2\n temperature = width/10\n for i in (1..iterations) do\n nodeset.each_value do |v| #calc repulsive forces\n if !v.static\n v.d = Vector[0.0,0.0]\n nodeset.each_value do |u|\n if u!=v\n dist = v.location - u.location\n distlen = dist.r.to_f\n #v.d += distlen != 0.0 ? (dist/distlen)*(k2/distlen) : Vector[(-0.5+rand())*0.1,(-0.5+rand())*0.1]\n if distlen != 0.0\n v.d += (dist/distlen)*(k2/distlen)\n else #at the same spot, so just splut them apart a little this run\n v.d += Vector[0.01,0]\n u.d += Vector[-0.01,0]\n end\n end\n end\n end\n end\n for e in edgeset.values do #calc attractive forces\n #only changes 1/conn (assuming 1 edge each direction)\n # if e.a.id < e.b.id or adjacency[[e.a.id,e.b.id]]+adjacency[[e.b.id,e.a.id]] < 2\n dist = e.a.location - e.b.location\n distlen = dist.r.to_f\n fa = distlen**2/k\n delta = (dist/distlen)*fa\n e.a.d -= delta if !e.a.static\n e.b.d += delta if !e.b.static\n # end\n end\n #puts nodeset\n nodeset.each_value do |v| #move nodes\n #added in attraction to center\n if !v.static\n dist_center = v.location - Vector[width/2, height/2]\n distlen = dist_center.r.to_f\n fa = distlen**2/k\n v.d -= (dist_center/distlen)*fa\n dlen = v.d.r.to_f\n if dlen > 0.0 #if we have a distance to move\n v.location += (v.d/dlen)*[dlen,temperature].min\n nx = [[v.location[0],0].max, width].min #don't let outside of bounds (50px border)\n ny = [[v.location[1],0].max, height].min\n v.location = Vector[nx,ny]\n end\n end\n end\n temperature *= (1 - i/iterations.to_f) #cooling function from http://goo.gl/xcbXR\n #puts \"finished iter \"+i.to_s+\" @ \"+Time.now.to_s\n end\n puts \"finished fruchterman_reingold @ \"+Time.now.to_s\n end",
"def make_blank_graph\n ISSUE_NAMES.each_with_index {|name, i| @nodes[i] = Graph::Node.new(i, name, \"\") unless name.blank? }\n\n #testing\n #@edges[1] = Graph::Edge.new(1, @nodes[0], @nodes[3], MapvisualizationsHelper::INCREASES)\n\n @nodes[START].location = Vector[(@width-200)/2, @height/2] #pull out Menhaden Population and center\n grid_nodes_in_box(@nodes.reject{|k,v| k==START},Vector[@width-200+50, 130],Vector[200, @height-130+50]) #hard-coded starting box\n end",
"def tick\n # memoize number of neighbors for live cells\n # and dead cells with any adjacent live cells\n @live_cells.each { |live_cell| set_num_live_neighbors_at_live_cell(live_cell[0], live_cell[1]) }\n\n # update to next generation\n overwrite_matrix_with_next_generation\n\n # clear memoized values for next generation to determine neighbors\n @num_live_neighbors_by_dead_cells = {}\n @num_live_neighbors_by_live_cells = {}\n end",
"def create_local_graph(block)\n block_flow = dfg.block_flows.fetch(block.id)\n\n # A map of instructions to nodes.\n insn_nodes = {}\n\n # Create a node for each instruction in the block.\n block.each_with_length do |insn, offset|\n node = InsnNode.new(insn, offset)\n insn_nodes[offset] = node\n nodes << node\n end\n\n # The first and last node in the sub-graph, and the last fixed node.\n previous_fixed = nil\n first_fixed = nil\n last_fixed = nil\n\n # The merge node for the phi nodes to attach to.\n merge_node = nil\n\n # If there is more than one predecessor and we have basic block\n # arguments coming in, then we need a merge node for the phi nodes to\n # attach to.\n if block.incoming_blocks.size > 1 && !block_flow.in.empty?\n merge_node = MergeNode.new(id_counter)\n nodes << merge_node\n\n previous_fixed = merge_node\n first_fixed = merge_node\n last_fixed = merge_node\n end\n\n # Connect local control flow (only nodes with side effects.)\n block.each_with_length do |insn, length|\n if insn.side_effects?\n insn_node = insn_nodes[length]\n connect previous_fixed, insn_node, :control if previous_fixed\n previous_fixed = insn_node\n first_fixed ||= insn_node\n last_fixed = insn_node\n end\n end\n\n # Connect basic block arguments.\n inputs = {}\n outputs = {}\n block_flow.in.each do |arg|\n # Each basic block argument gets a phi node. Even if there's only\n # one predecessor! We'll tidy this up later.\n phi = PhiNode.new(id_counter)\n connect(phi, merge_node, :info) if merge_node\n nodes << phi\n inputs[arg] = phi\n\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows[consumer_offset]\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer == arg\n connect(phi, insn_nodes[consumer_offset], :data, input_index)\n end\n end\n end\n\n block_flow.out.each { |out| outputs[out] = phi if out == arg }\n end\n\n # Connect local dataflow from consumers back to producers.\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows.fetch(consumer_offset)\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer.local?\n connect(\n insn_nodes[producer.length],\n insn_nodes[consumer_offset],\n :data,\n input_index\n )\n end\n end\n end\n\n # Connect dataflow from producers that leaves the block.\n block.each_with_length do |_, producer_pc|\n dfg\n .insn_flows\n .fetch(producer_pc)\n .out\n .each do |consumer|\n unless consumer.local?\n # This is an argument to the successor block - not to an\n # instruction here.\n outputs[consumer.name] = insn_nodes[producer_pc]\n end\n end\n end\n\n # A graph with only side-effect free instructions will currently have\n # no fixed nodes! In that case just use the first instruction's node\n # for both first and last. But it's a bug that it'll appear in the\n # control flow path!\n SubGraph.new(\n first_fixed || insn_nodes[block.block_start],\n last_fixed || insn_nodes[block.block_start],\n inputs,\n outputs\n )\n end",
"def schedule(spec)\n @task.schedule = Cloud::Cycler::Schedule.parse(spec)\n end",
"def schedule(program, name, insertions, deletions)\n\t\t@driver.synchronize do\n\t\t\tif (program == \"runtime\") \n\t\t\t task = Driver::Task.new\n\t\t\t task.insertions = insertions\n\t\t\t task.deletions = deletions\n\t\t\t task.program = program\n\t\t\t task.name = name\n#\t\t puts \"XXX Tasking: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n \t\t\t@driver.task(task)\n\t\t\telse\n\t\t\t\ttuple = Tuple.new(clock.current + 1, program, name, insertions, deletions)\n\t\t print \"XXX Scheduling: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n\t\t\t\tschedule.force(tuple)\n\t\t\tend\n\t\t\t# XXXXXXXXXX\n\t\t\t@driver.cond_var.signal\n\t\tend\n\tend",
"def updateTime()\n\tloop {\n $currtime += 0.01\n $flood_trigger += 0.01\n if $flood_trigger >= $update_interval\n $flood_trigger = 0\n Thread.new {\n $mutex.synchronize {\n fillInNodes()\n }\n }\n end\n sleep(0.01)\n\t}\nend",
"def to_block (params, &block)\n\n return block if block\n\n schedulable = params.delete(:schedulable)\n\n return nil unless schedulable\n\n l = lambda do\n schedulable.trigger(params)\n end\n class << l\n attr_accessor :schedulable\n end\n l.schedulable = schedulable\n\n l\n end",
"def ready_to_schedule?(node)\n # Ready to globally schedule\n\n node.outputs.to_nodes.all? do |i|\n globally_scheduled?(i)\n end\n end",
"def schedule_with_state(state, action)\n raise 'action cannot be nil' unless action\n\n schedule_relative_with_state(state, 0, action)\n end",
"def everyNS(nodesSelector, interval = 60, &block)\n ns = NodeSet[nodesSelector]\n if ns == nil\n raise \"Every: Unknown node set '#{nodesSelector}\"\n end\n path = RootNodeSetPath.new(ns)\n Thread.new(path) { |path|\n while true\n Kernel.sleep(interval)\n MObject.debug(\"every\", nodesSelector, \": fires\")\n begin\n if ! (path.call &block)\n break\n end\n rescue Exception => ex\n bt = ex.backtrace.join(\"\\n\\t\")\n MObject.error(\"everyNS\", \"Exception: #{ex} (#{ex.class})\\n\\t#{bt}\")\n end\n end\n MObject.debug(\"every\", nodesSelector, \": finishes\")\n }\n end",
"def reset_schedule\n leader = User.where(:id => self.creator).first\n self.initialize_group_schedule(leader.schedule)\n self.users.each do |user|\n self.update_group_schedule(user.schedule)\n end\n end",
"def reload_schedule!\n @schedule = all_schedules\n end",
"def nodes_in_block(first_node)\n # We're going to do a depth-first search of the graph from the first\n # node, following control flow edges out, and global schedule edges in,\n # and stopping when we find a node that ends a basic block such as a\n # branch.\n\n worklist = [first_node]\n block = Set.new\n\n until worklist.empty?\n node = worklist.pop\n\n if block.add?(node)\n # We need to visit nodes that are anchored to this one.\n\n node.inputs.edges.each do |i|\n if i.input_name == :global_schedule\n worklist.push i.from\n end\n end\n\n # If this node isn't a branch, and it's either the first node or it\n # isn't a merge, visit the nodes that follow it in control flow.\n\n if node.op != :branch && (node == first_node || node.op != :merge)\n node.outputs.edges.each do |o|\n if o.control?\n if !(node.op == :start && o.to.op == :finish)\n worklist.push o.to\n end\n end\n end\n end\n end\n end\n\n block.to_a\n end",
"def aStar(tx = @player.x/@TILESIZE, ty = @player.y/@TILESIZE, x = @x/@TILESIZE, y = @y/@TILESIZE)\n #exit conditions\n if tx > @map.WIDTH or ty > @map.HEIGHT or tx < 0 or ty < 0\n return Node.new(x, y, nil, 0)\n end\n start = Time.now\n evald = Array.new #nodes that have already been evaluated\n queue = [Node.new(x, y, 0)]#the last element is the g value\n until queue.empty?\n #queue.each{ |q| print q.toArray, \"...\"}\n #print \"\\n\" #for debugging\n current = queue[0]#finds the node in queue with the lowest f value\n queue.each do |q|\n current = q if q.f(tx, ty) < current.f(tx, ty)\n end\n evald.push(current)#move current from 'queue' to 'evald'\n queue.delete(current)\n #direction from the second node aka the one after the one the ghost is at\n if current.x == tx and current.y == ty\n current.trim\n return current\n #print \"the ghost is confused\\n\" # for debugging\n end\n @map.getSurrounding(current.x, current.y, false).each{ |n|\n node = Node.toNode(n)\n node.g= current.g + 1\n node.parent= current\n nodeInEvald = false\n evald.each{ |evNode|\n if(evNode.coords == node.coords)\n if(evNode.g > node.g)\n evNode.g = node.g\n evvNode.dir = node.dir\n end\n nodeInEvald = true\n break\n end\n }\n if !nodeInEvald\n queue.push(node) \n end\n }\n #just gives up if it's been trying to find a path for more than 5 seconds\n if Time.now - start > 5\n current.trim\n current.timeOut = true;\n return current\n end\n end\n nil\n end",
"def locally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:local_schedule)\n end",
"def make_constant_schedule(name, temperature)\n s = OpenStudio::Model::ScheduleRuleset.new(@model)\n s.setName(name)\n s.defaultDaySchedule.addValue(OpenStudio::Time.new(\"24:00:00\"), OpenStudio::convert(temperature, \"F\", \"C\").get)\n\ts\n end",
"def reschedule (scheduler)\n to_reschedule(scheduler)\n end",
"def refresh; schedule_update end",
"def define_tasks\n @defines.each { |sym| send( sym ) }\n end",
"def create_graphs\n if(@config[\"Smain\"][\"graphs\"] == \"interval\")\n @childs[\"graph\"] = Process.fork do\n # Ignore HANUP signal\n trap('HUP', 'IGNORE')\n\n # Exit on SIGTERM or SIGKILL\n trap(\"SIGTERM\") { Process.exit!(0) }\n trap(\"SIGKILL\") { Process.exit!(0) }\n\n # Initialize time object\n time = Time.now\n\n # Create graphs in endless loop\n loop do\n # Check if enough time since last update has gone\n if(time <= Time.now)\n # Increment time object with @config['graph_interval'] seconds\n time = Time.now + @config[\"Smain\"]['graph_interval']\n\n # Create graphs for every module\n @config[\"Smain\"]['modules'].each do |modul|\n @modules[modul].graph(\"day\")\n @modules[modul].graph(\"week\")\n @modules[modul].graph(\"month\")\n @modules[modul].graph(\"year\")\n end\n end\n\n # Sleep until next run\n sleep 60\n end\n end\n end\n end",
"def schedule(uri); end",
"def reschedule\n\n return if @stopped\n\n t = OpenWFE::Timer.new\n\n linfo { 'reschedule() initiating...' }\n\n options = { :include_classes => Rufus::Schedulable }\n\n get_expression_storage.find_expressions(options).each do |fexp|\n\n linfo { \"reschedule() for #{fexp.fei.to_s}...\" }\n\n onotify(:reschedule, fexp.fei)\n\n fexp.reschedule(get_scheduler)\n end\n\n linfo { \"reschedule() done. (took #{t.duration} ms)\" }\n end",
"def schedule(time, callback); end",
"def run_while!\n\n before_run\n\n i=1\n\n while yield i do\n\n break if maximum_round? i\n\n before_round i\n\n if i == 1\n # some things are different for the first round, namely nodes with activation = start\n run_first_round!\n else\n run_round!\n end\n\n after_round i\n i+=1\n end\n\n after_run\n\n self\n\n end",
"def set_static_nodes(width=@width, height=@height, nodeset=@nodes)\n nodeset.each_value do |node|\n if node.static == 'center' #using ifthen instead of case so that we can break once we find something\n node.location = Vector[width/2,height/2]\n elsif node.static == 'left'\n node.location = Vector[0,height/2]\n elsif node.static == 'right'\n node.location = Vector[width,height/2]\n elsif node.static == 'top'\n node.location = Vector[width/2,0]\n elsif node.static == 'bottom'\n node.location = Vector[width/2,height]\n elsif node.static == 'top_left'\n node.location = Vector[0,0]\n elsif node.static == 'top_right'\n node.location = Vector[width,0]\n elsif node.static == 'bottom_left'\n node.location = Vector[0,height]\n elsif node.static == 'bottom_right'\n node.location = Vector[width,height]\n elsif node.static == 'stationary' #just leave at location\n end\n #can add other handlers if needed\n end\n end",
"def schedule(restart = true, &new_block)\n @queue << Task.new(new_block, restart) if new_block\n\n return self if @scheduled || !connection # block until connection is obtained\n\n if task = @queue.shift\n @scheduled = task.block\n @need_update = task.restart\n schedule_block task.restart do\n begin\n task.block.call\n ensure\n @scheduled = nil\n schedule\n end\n end\n elsif not @need_update.nil?\n @scheduled = :update!\n schedule_block @need_update do\n begin\n update!\n ensure\n @scheduled = nil\n @need_update = nil\n schedule\n end\n end\n end\n self\n end",
"def schedule_with_state(state, action)\n raise 'action cannot be nil' unless action\n schedule_at_absolute_with_state(state, @clock, action)\n end",
"def initialize\n self.tasks = Array.new\n self.run_queue = Queue.new\n self.schedule\n end",
"def clear_schedule\n bytes = [0] * 15\n schedule(bytes)\n bytes\n end",
"def default_fork_every\n defined?(@@default_fork_every) ? @@default_fork_every : true\n end",
"def planning_simple()\n @free_time = nil\n if(@tasks.size > 0)\n # @timelines[0].add_event(Simple_task.new(2))\n # $time += 1\n @timelines[0].add_event(@tasks.pop)\n end\n nil\n end",
"def schedule_call(&block)\n EM::next_tick(&block)\n end",
"def create_sub_graph(spec_edges, move_dist = nil)\n # declare locals\n time = Time.now\n m = $game_map\n map_width,map_height = m.width, m.height\n MoveUtils.init_ev_passables\n \n if !move_dist\n dist = spec_edges[:move] ||= TactBattleManager::Defaults::Move\n else\n dist = move_dist\n end\n \n x_low = x_high = y_low = y_high = nil\n if @source\n x_low, x_high = [@source.x-dist, 0].max, [@source.x+dist,map_width-1].min\n y_low, y_high = [@source.y-dist, 0].max, [@source.y+dist,map_height-1].min \n else\n x_low, x_high = 0, [dist,map_width-1].min\n y_low, y_high = 0, [dist,map_height-1].min\n end\n \n @jump_time = 0\n @optim_cache = {}\n x_low.upto(x_high).each do |x|\n y_low.upto(y_high).each do |y|\n expand_graph_adj(v=Vertex.new(x,y, m.terrain_tag(x,y)), spec_edges[:pass])\n add_adjacent_jumpables(v.x,v.y,dist,spec_edges)if spec_edges[:jump_length]>0\n end\n end\n self\n end",
"def grifork\n config.prepare_task.run if config.prepare_task\n\n if root.children.size.zero?\n logger.debug(\"#{root} Reached leaf. Nothing to do.\")\n return\n end\n Parallel.map(root.children, config.parallel => root.children.size) do |child|\n logger.info(\"Run locally. localhost => #{child.host}\")\n config.local_task.run(root.host, child.host)\n if child.children.size.zero?\n logger.debug(\"#{child} Reached leaf. Nothing to do.\")\n next\n end\n Grifork::Executor::Grifork.new.run(child)\n end\n\n config.finish_task.run if config.finish_task\n end",
"def toggle_scheduler\n new_scheduler = WaterManager.first.scheduling_option == CRONTAB_SPRINKLE_ALL ? DAEMON_MINUTE_HAND : CRONTAB_SPRINKLE_ALL\n WaterManager.first.update(scheduling_option: new_scheduler)\n end",
"def start(period=nil)\n # Run any startup tasks.\n self.startup_tasks.each { |t| t.run }\n \n # If caller only wants to run for a while, start a thread that will\n # sleep that long, then kill off all the threads. +nil+ is posted to\n # the queue as a signal that the scheduler should stop running.\n if period\n Thread.new do\n Thread.abort_on_exception = true\n sleep period\n self.scheduled_tasks.each {\n |t| t.thread.exit if t.thread && t.thread.alive? }\n self.run_queue << nil\n end\n end\n \n # Schedule all the tasks.\n self.scheduled_tasks.each { |t| t.schedule(self) }\n \n # Run any tasks whose threads have placed the task onto the run \n # queue, until +nil+ is received.\n while (task = self.run_queue.pop) do\n task.run\n end\n \n # Run any shutdown tasks.\n self.shutdown_tasks.each { |t| t.run }\n end",
"def simulate\n simulation_task = self.model.simulation_model.new(arguments.to_hash)\n plan.force_replace(self, simulation_task)\n simulation_task\n end",
"def schedule(scheduler)\n case self.interval\n when :startup, :shutdown\n # ignore it\n else\n self.thread = Thread.new do\n loop do\n sleep self.interval\n scheduler.run_queue << self\n end\n end\n self.thread.abort_on_exception = true\n end\n end",
"def find_initial_task_basis_plan\n kill_one_artificial until status.got_task?\n BasisPlan.new optimal_plan_real_part, real_task_basis\n end",
"def resched\n action('resched')\n end",
"def visit(task, permanently_visited = Set.new, temporary_visited = [], direction: :forward, &block)\n unless block_given?\n return to_enum(method=:visit, task, permanently_visited, temporary_visited, direction: direction)\n end\n if temporary_visited.include? task\n # This node have already been visited in this small iteration and\n # it means that there is a loop.\n temporary_visited << task\n raise Deployment::LoopDetected.new self, 'Loop detected!', temporary_visited\n end\n if permanently_visited.include? task\n # We have already checked this node for loops in\n # its forward dependencies. Skip it.\n return\n end\n # Start a small iteration over this node's forward dependencies\n # add this node to the last iteration visit list and run recursion\n # on the forward dependencies\n temporary_visited << task\n task_method = \"each_#{direction}_dependency\"\n task.send(task_method.to_sym) do |_task|\n visit(_task, permanently_visited, temporary_visited, direction: direction, &block)\n end\n # Small iteration have completed without loops.\n # We add this node to the list of permanently marked nodes and\n # remove in from the temporary marked nodes list.\n permanently_visited.add task\n temporary_visited.delete task\n # Insert this node to the head of topology sort list and return it.\n yield task\n end",
"def schedule_on_main(*args, &blk)\n cb = proc do\n blk.call(*args)\n end\n ::Dispatch::Queue.main.async &cb\n end",
"def clear_schedule!\n rufus_scheduler.stop\n @rufus_scheduler = nil\n rufus_scheduler\n end",
"def schedule_at (at, params={}, &block)\n\n do_schedule_at(\n at,\n prepare_params(params),\n &block)\n end",
"def update_group_schedule(schedule)\n self_days = self.schedule.days\n schedule_days = schedule.days\n \n self_days.each do |self_day|\n day_in_common = false\n schedule_days.each do |schedule_day|\n # if group's schedule and <tt>schedule</tt> both contain the same day\n if self_day.name == schedule_day.name\n self_day.time_blocks.each do |self_block|\n time_block_in_common = false\n schedule_day.time_blocks.each do |schedule_block|\n # if group's schedule and <tt>schedule</tt> both contain the same time_block\n if self_block.chunk_of_time == schedule_block.chunk_of_time\n # flag the day to not be deleted from group's schedule\n # only want to keep the day if there is a time_block in common in that day\n day_in_common = true\n time_block_in_common = true # flag the time_block to not be deleted from group's schedule\n end\n end\n # remove time_block from group's schedule if <tt>schedule</tt> does not have day\n self_block.destroy if !time_block_in_common\n end\n end\n end\n # remove day from group's schedule if <tt>schedule</tt> does not have day\n self_day.destroy if !day_in_common\n end\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 define(&block)\n block.call DSL::GraphDefiner.new(@graph)\n self\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def solve_start(first)\n starting_edge = Edge.new(first,first,0, 0)\n @queue.push(starting_edge)\n solve(first)\n end",
"def reschedule(job, time = T.unsafe(nil)); end",
"def new_graph\n # Clear physics\n physics.clear\n center = TVec2D.new(width / 2, height / 2)\n @clusters = (0..8).map do\n Cluster.new(\n app: self,\n number: rand(3..8),\n diameter: rand(20..100),\n center: center\n )\n end\n #\tAll clusters connect to all clusters\n clusters.each_with_index do |ci, i|\n clusters[i + 1..clusters.size - 1].each do |cj|\n ci.connect(cj)\n end\n end\nend",
"def schedule\n run_callbacks :schedule do\n perform_async\n end\n end",
"def reschedule (scheduler)\n\n @scheduler_job_id = \"#{@fei.wfid}__#{@scheduler_job_id}\"\n\n method, arg0 = if @tab\n [ :schedule, @tab ]\n else\n [ :schedule_every, @every ]\n end\n\n get_scheduler.send(\n method,\n arg0,\n {\n :schedulable => self,\n :job_id => @scheduler_job_id,\n :tags => @scheduler_tags })\n\n #ldebug { \"reschedule() name is '#{@name}'\" }\n ldebug { \"reschedule() job id is '#{@scheduler_job_id}'\" }\n end",
"def setSchedule(schedule)\n\t\t@schedule = schedule\n\tend",
"def run\n schedule_managers\n end",
"def SetUpNodes\n \n @nodes.each do |node|\n\n if node.type==\"R\" or node.type==\"A\" or node.type==\"G\"\n \t\n\tSetMode(node)\n\n\tEnforceChannels(node)\n\t\n\tSetEssid(node) # after this stage, with omf-5.4 the wlan interface is created.\n\t\n\tSetWifiPower(node)\n\n\tSetMtu(node)\n\t\n\tSetIp(node)\n\t\n\tNode(node.id).exec(\"sysctl -w net.ipv4.conf.all.send_redirects=0\")\n \n EnforceRates(node)\n\t\n end\n #final settings\n #self.GetGroupInterface(node, ifn).txqueuelen=\"10\"\n end\n end",
"def test\n puts 'Building Graph for tests...'\n # Simple graph\n #\n # First\n # / \\\n # second third\n # / | | \\\n # fourth fifth goal sixth\n #\n # Construct graph\n first = GraphNode.new 'First'\n second = GraphNode.new 'Second'\n third = GraphNode.new 'Third'\n fourth = GraphNode.new 'Fourth'\n fifth = GraphNode.new 'Fifth'\n sixth = GraphNode.new 'Sixth'\n goal = GraphNode.new 'Goal'\n\n first.connect second\n first.connect third\n\n second.connect first\n second.connect fourth\n second.connect fifth\n\n third.connect first\n third.connect goal\n third.connect sixth\n\n fourth.connect second\n fifth.connect second\n\n goal.connect third\n sixth.connect third\n\n # Perform tests\n puts \"Testing from root node 'First'\"\n puts(bfs(first) { |node| puts ' ' + node })\n\n puts \"Testing from second node 'Second'\"\n puts(bfs(second) { |node| puts ' ' + node })\nend",
"def garbage_collect(force_on = nil)\n if force_on && !force_on.empty?\n ExecutionEngine.info \"GC: adding #{force_on.size} tasks in the force_gc set\"\n mismatching_plan = force_on.find_all do |t|\n if t.plan == self.plan\n plan.force_gc << t\n false\n else\n true\n end\n end\n if !mismatching_plan.empty?\n raise ArgumentError, \"#{mismatching_plan.map { |t| \"#{t}(plan=#{t.plan})\" }.join(\", \")} have been given to #{self}.garbage_collect, but they are not tasks in #{plan}\"\n end\n end\n\n unmark_finished_missions_and_permanent_tasks\n\n # The set of tasks for which we queued stop! at this cycle\n # #finishing? is false until the next event propagation cycle\n finishing = ValueSet.new\n did_something = true\n while did_something\n did_something = false\n\n tasks = plan.unneeded_tasks | plan.force_gc\n local_tasks = plan.local_tasks & tasks\n remote_tasks = tasks - local_tasks\n\n # Remote tasks are simply removed, regardless of other concerns\n for t in remote_tasks\n ExecutionEngine.debug { \"GC: removing the remote task #{t}\" }\n plan.garbage(t)\n end\n\n break if local_tasks.empty?\n\n debug do\n debug \"#{local_tasks.size} tasks are unneeded in this plan\"\n local_tasks.each do |t|\n debug \" #{t} mission=#{plan.mission?(t)} permanent=#{plan.permanent?(t)}\"\n end\n break\n end\n\n if local_tasks.all? { |t| t.pending? || t.finished? }\n local_tasks.each do |t|\n debug { \"GC: #{t} is not running, removed\" }\n plan.garbage(t)\n end\n break\n end\n\n # Mark all root local_tasks as garbage.\n roots = nil\n 2.times do |i|\n roots = local_tasks.dup\n for rel in TaskStructure.relations\n next if !rel.root_relation?\n roots.delete_if do |t|\n t.enum_parent_objects(rel).any? { |p| !p.finished? }\n end\n break if roots.empty?\n end\n\n break if i == 1 || !roots.empty?\n\n # There is a cycle somewhere. Try to break it by removing\n # weak relations within elements of local_tasks\n debug \"cycle found, removing weak relations\"\n\n local_tasks.each do |t|\n for rel in t.sorted_relations\n rel.remove(t) if rel.weak?\n end\n end\n end\n\n (roots.to_value_set - finishing - plan.gc_quarantine).each do |local_task|\n if local_task.pending?\n info \"GC: removing pending task #{local_task}\"\n\n plan.garbage(local_task)\n did_something = true\n elsif local_task.failed_to_start?\n info \"GC: removing task that failed to start #{local_task}\"\n plan.garbage(local_task)\n did_something = true\n elsif local_task.starting?\n # wait for task to be started before killing it\n debug { \"GC: #{local_task} is starting\" }\n elsif local_task.finished?\n debug { \"GC: #{local_task} is not running, removed\" }\n plan.garbage(local_task)\n did_something = true\n elsif !local_task.finishing?\n if local_task.event(:stop).controlable?\n debug { \"GC: queueing #{local_task}/stop\" }\n if !local_task.respond_to?(:stop!)\n fatal \"something fishy: #{local_task}/stop is controlable but there is no #stop! method\"\n plan.quarantine(local_task)\n else\n finishing << local_task\n end\n else\n warn \"GC: ignored #{local_task}, it cannot be stopped\"\n # We don't use Plan#quarantine as it is normal that\n # this task does not get GCed\n plan.gc_quarantine << local_task\n end\n elsif local_task.finishing?\n debug do\n\t\t\t debug \"GC: waiting for #{local_task} to finish\"\n\t\t\t local_task.history.each do |ev|\n\t\t\t debug \"GC: #{ev}\"\n\t\t\t end\n\t\t\t break\n\t\t\tend\n else\n warn \"GC: ignored #{local_task}\"\n end\n end\n end\n\n finishing.each do |task|\n task.stop!\n end\n\n plan.unneeded_events.each do |event|\n plan.garbage(event)\n end\n\n !finishing.empty?\n end",
"def sync\n @cache.flush(true)\n @nodes.sync\n end",
"def add_blocks_to_schedule(time_blocks, schedule, recurring)\n time_blocks.each do |block|\n day_of_week = block.split(\"_\")[0]\n time = block.split(\"_\")[1]\n start_time = Time.utc(\"2011\", nil, nil, time.split(\" - \")[0])\n end_time = Time.utc(\"2011\", nil, nil, time.split(\" - \")[1])\n \n if Day.exists?(day_of_week, schedule.id)\n day = Day.where(:name => day_of_week, :schedule_id => schedule.id).first\n else\n day = Day.new(:name => day_of_week, :schedule_id => schedule.id)\n day.save\n end\n \n if !TimeBlock.exists?(start_time, end_time, day.id, recurring)\n time_block = TimeBlock.new(:start_time => start_time, :end_time => end_time, :day_id => day.id, :recurring => recurring)\n time_block.save\n end\n end\n end",
"def refresh(nodes_to_refresh = seeds)\n refreshed_nodes = []\n seen = {}\n # Set up a recursive lambda function for refreshing a node and it's peers.\n refresh_node = ->(node) do\n unless seen[node]\n seen[node] = true\n # Add the node to the global list of known nodes.\n seeds.push(node) unless seeds.include?(node)\n begin\n node.refresh\n # This node is good, so add it to the list of nodes to return.\n refreshed_nodes.push(node) unless refreshed_nodes.include?(node)\n # Now refresh any newly discovered peer nodes - this will also\n # remove nodes that are not included in the peer list.\n refresh_peers(node, &refresh_node)\n rescue Errors::ConnectionFailure\n # We couldn't connect to the node.\n end\n end\n end\n\n nodes_to_refresh.each(&refresh_node)\n refreshed_nodes\n end",
"def trigger (params)\n\n return if paused?\n\n ldebug { \"trigger() cron : #{@fei.to_debug_s}\" }\n\n #@raw_child.application_context = @application_context\n # done in expool.tlaunch_child()\n\n begin\n\n @counter += 1\n store_itself\n #\n # note : one variant would be to give Time.now.to_f as a sub_id...\n # then no need to store...\n #\n # but it's good to have a counter to keep track of the number of\n # executions\n\n child_fei = get_expression_pool.tlaunch_child(\n self,\n first_expression_child,\n @counter,\n @applied_workitem.dup,\n :register_child => false)\n #\n # register_child is set to false, cron doesn't keep\n # track of its spawned children\n\n rescue\n\n lerror do\n \"trigger() cron caught exception\\n#{OpenWFE::exception_to_s($!)}\"\n end\n end\n end",
"def evaulate_schedule\n 5\n end",
"def eachNode(&block)\n @topo.eachNode(&block) if !@topo.nil?\n end",
"def whenAll(nodesSelector, nodeTest, interval = 5, triggerValue = nil, &block)\n _warn_deprecated_command(\"whenAll\")\n ns = NodeSet[nodesSelector]\n if ns == nil\n raise \"WhenAll: Unknown node set '#{nodesSelector}\"\n end\n Thread.new(ns) { |ns|\n while Experiment.running?\n begin\n # If the NodeSet is ALL (i.e. selector \"*\") and it is empty,\n # then stop the experiment!\n if (ns.to_s == \"*\") && ns.empty?\n info \" \"\n info \" All the groups in your experiment are empty!\"\n info \" Or they do not include any available nodes!\"\n info \" Stopping the Experiment now.\"\n info \" \"\n Experiment.done\n sleep 2 # otherwise this loops again before the experiment stops,\n \t # annoyingly reprinting the above msg\n end\n res = false\n isUp = ns.up?\n #MObject.debug(\"whenAll::internal\", \"Checking \", ns, \" up?: \", isUp)\n if isUp\n res = ns.inject(true) { |flag, node|\n if flag\n match = node.match(nodeTest)\n #match.each{|e| e.write($stdout, 2)}\n if triggerValue == nil\n flag = (match != nil && match.length > 0)\n else\n match.each do |e|\n flag = false if (e.to_s != triggerValue.to_s)\n end\n end\n debug(\"whenAll::internal\", \"Not true for \", node) if !flag\n #p \"FLAG: #{flag}\"\n end\n flag\n }\n end\n if res\n info(\"whenAll\", nodesSelector, \": '\", nodeTest, \"' fires\")\n begin\n RootNodeSetPath.new(ns, nil, nil, block)\n rescue Exception => ex\n bt = ex.backtrace.join(\"\\n\\t\")\n error(\"whenAll\", \"Exception: #{ex} (#{ex.class})\\n\\t#{bt}\")\n end\n # done\n break\n end\n Kernel.sleep(interval)\n rescue Exception => ex\n bt = ex.backtrace.join(\"\\n\\t\")\n puts \"Exception: #{ex} (#{ex.class})\\n\\t#{bt}\"\n end\n end\n }\n end",
"def generate_schedule\n \tschedule = Array.new\n \tqueue = Array.new\n \tcurrent_job = nil\n \tcurrent_job_execution_time = 0\n\n \tfor time in 0...hyper_period\n \t\t# add released tasks to queue\n \t\tqueue += get_released_jobs time\n\n \t\t# give the current job credit for execution in last step\n \t\tcurrent_job_execution_time += 1 unless current_job.nil?\n\n \t\t#check if current task is finished\n \t\tif !!current_job and current_job[:task].worst_case_execution_time == current_job_execution_time\n \t\t\t#task is finished\n \t\t\tcurrent_job = nil\n \t\t\tcurrent_job_execution_time = 0\n \t\tend\n\n \t\t#find a task to execute\n \t\tif current_job.nil?\n \t\t\tcurrent_job = get_highest_priorty_task(queue)\n \t\t\tqueue.delete(current_job)\n \t\tend\n\n \t\t# if we are missing a deadline task set is not schedulable\n \t\tif !!current_job and time >= current_job[:deadline]\n \t\t\treturn nil\n \t\tend\n\n \t\t# add current job to schedule\n \t\tschedule.push(current_job.nil? ? 0 : current_job[:task].id)\n\n \t\t#log whats executing in this slot\n \t\t#puts \"Slot #{time + 1} \" + (current_job.nil? ? \"Idle\" : current_job[:task].name)\n \tend\n\n \t# if queue isn't empty, then return nil\n \treturn nil unless queue.empty?\n\n \t#return schedule\n \tschedule\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def partially_order(graph)\n # Create a work list of the fixed nodes.\n\n to_sequence = graph.all_nodes.select(&:fixed?)\n\n # Keep going until the work list is empty.\n\n until to_sequence.empty?\n node = to_sequence.shift\n\n # We're only interested in the control inputs to the node.\n\n control_input_nodes = node.inputs.control_edges.from_nodes\n\n # Nodes with no control input (such as start but possibly others) have sequence number zero.\n\n if control_input_nodes.empty?\n node.props[:sequence] = 0\n next\n end\n\n # If all control inputs have been given a sequence, we can give this\n # node as at least one greater than all of those.\n\n if control_input_nodes.all? { |i| i.props[:sequence] }\n node.props[:sequence] = control_input_nodes.map { |i| i.props[:sequence] }.max + 1\n next\n end\n\n # If all the control inputs haven't been given a sequence number yet\n # then put it back on the work list and come back to it later.\n\n to_sequence.push node\n end\n end",
"def start\n @schedule_thread = Thread.new do\n begin\n # Continuously loop through the heap for the next scheduled job\n job = nil\n loop do\n unless @heap.empty?\n @mutex.synchronize do\n job = @heap.pop\n @job_set.delete(Digest::SHA1.hexdigest(job.json))\n execute_n_reschedule(job) unless job.nil?\n end\n end\n sleep 0.1\n end\n rescue Exception => e\n STDERR.puts e.message\n STDERR.puts e.backtrace\n end\n end\n end",
"def define\n\t\ttask :foo do\n\t\t\tputs 'foo!'\n\t\tend\n\tend",
"def define\r\n\t\t\ttask :foo do\r\n\t\t\t\tputs 'foo!'\r\n\t\t\tend\r\n\t\tend",
"def setup_start_end\n cluster_tasks_set = Set.new each_task\n tasks_to_include = Set.new\n self.subgraphs.each do |subgraph|\n setup_start_end_piece(subgraph, cluster_tasks_set).each do |piece|\n tasks_to_include.add piece\n end\n end\n to_skip_tasks = cluster_tasks_set - tasks_to_include\n to_skip_tasks.each do |task|\n warn \"Skipping task #{task} due to subgraph evaluation\"\n task.skip!\n end\n end",
"def assign_types\n @schedule[0].cost = :travel\n @schedule.each_cons(3) do |days|\n days[1].cost =\n if days[0].date + 1 == days[1].date && days[1].date+ 1 == days[2].date\n :full\n else\n :travel\n end\n end\n @schedule[-1].cost = :travel\n end",
"def initialize_group_schedule(creator_schedule)\n # clear current schedule if one exists\n self.schedule.destroy if self.schedule != nil\n \n # create schedule\n schedule = Schedule.create(:group_id => self.id)\n \n # copy creator's schedule as group's schedule\n creator_schedule.days.each do |creator_day|\n day = Day.create(:name => creator_day.name, :schedule_id => schedule.id)\n creator_day.time_blocks.each do |creator_time_block|\n TimeBlock.create(:chunk_of_time => creator_time_block.chunk_of_time, :day_id => day.id)\n end\n end\n end",
"def restart_node\n stop_node\n sleep 1\n start_node\n end",
"def star_cluster; end",
"def schedule_every(n, &block)\r\n\r\n while true do\r\n before = Time.now\r\n\r\n block.call\r\n \r\n elapsed = Time.now - before\r\n interval = n - elapsed\r\n \r\n @logger.debug \"orders processing/delivery take #{elapsed} seconds.\"\r\n \r\n sleep(interval) if interval > 0\r\n end\r\n\r\nend",
"def initialize_processor(time)\n i = 0\n selected = []\n min = DEVS::INFINITY\n while i < @children.size\n child = @children[i]\n tn = child.initialize_processor(time)\n selected.push(child) if tn < DEVS::INFINITY\n min = tn if tn < min\n i += 1\n end\n\n @scheduler.clear\n if @scheduler.prefer_mass_reschedule?\n @children.each { |c| @scheduler << c }\n else\n selected.each { |c| @scheduler << c }\n end\n\n @time_last = max_time_last\n @time_next = min\n end",
"def define_tasks\n # Task definitions are taken from Rake::TestTask\n # https://github.com/ruby/rake/blob/e644af3/lib/rake/testtask.rb#L98-L112\n namespace :ttnt do\n namespace name do\n define_run_task\n define_anchor_task\n end\n end\n end",
"def evaulate_schedule\n true\n end",
"def schedule\n @schedule ||= all_schedules\n @schedule || {}\n end",
"def schedule_process_connections\n ProcessQueue.create(:type => \"apply_primary_tags\",\n :priority => 1,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_inner_connections\",\n :priority => 2,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_outer_connections\",\n :priority => 5,\n :params => [self.id])\n end"
] | [
"0.70818436",
"0.63025105",
"0.5565143",
"0.54924834",
"0.5266468",
"0.5252445",
"0.5182981",
"0.51793593",
"0.51322055",
"0.5088472",
"0.5044987",
"0.5033813",
"0.49748293",
"0.49304396",
"0.4913319",
"0.489849",
"0.48961222",
"0.48843426",
"0.48836952",
"0.48811868",
"0.48632017",
"0.48305166",
"0.4814741",
"0.48021075",
"0.47797978",
"0.47574604",
"0.47538406",
"0.47497544",
"0.47345546",
"0.4729818",
"0.47033152",
"0.46954334",
"0.46778876",
"0.4656962",
"0.46500102",
"0.46375108",
"0.4631484",
"0.4624379",
"0.46214098",
"0.46207362",
"0.4619535",
"0.46132526",
"0.4611621",
"0.46040854",
"0.45938417",
"0.45922863",
"0.4591393",
"0.45722914",
"0.4559663",
"0.4558871",
"0.45520133",
"0.45469204",
"0.45447117",
"0.45353574",
"0.45349193",
"0.45213515",
"0.4519884",
"0.4519186",
"0.45114157",
"0.45084032",
"0.44990012",
"0.4495715",
"0.44904697",
"0.4485371",
"0.44797516",
"0.44797516",
"0.44736382",
"0.44648597",
"0.4461614",
"0.44452196",
"0.44323593",
"0.44246545",
"0.4421808",
"0.44208828",
"0.44167802",
"0.4411909",
"0.4410077",
"0.4404773",
"0.44035423",
"0.4403107",
"0.4389861",
"0.43890452",
"0.43868527",
"0.43863133",
"0.43859488",
"0.4377467",
"0.4374983",
"0.4368164",
"0.4364832",
"0.43626088",
"0.4351005",
"0.43475065",
"0.43436363",
"0.43433735",
"0.433921",
"0.43371305",
"0.43338376",
"0.43293437",
"0.43260098",
"0.4323564"
] | 0.7916239 | 0 |
A node is ready to be globally scheduled if all outputs have themselves been globally scheduled. | def ready_to_schedule?(node)
# Ready to globally schedule
node.outputs.to_nodes.all? do |i|
globally_scheduled?(i)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def globally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:global_schedule)\n end",
"def locally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:local_schedule)\n end",
"def all_nodes_ready?\n if current_platform_spec.nodes.nil?\n false\n else\n true\n end\n end",
"def should_run?\n val = (!all_nodes_ready? ||\n config_updated?)\n end",
"def scheduled?\r\n @time != :forever\r\n end",
"def global_schedule(graph)\n # Create a work list of the floating nodes.\n\n to_schedule = graph.all_nodes.select {|n| n.floating? && n.op != :immediate }\n\n # Keep going until the work list is empty.\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # Are we ready to schedule this node?\n\n if ready_to_schedule?(node)\n # Find candidates to anchor this node to.\n\n candidates = schedule_candidates(graph, node)\n\n # If there aren't any then we're stuck!\n\n raise 'stuck' if candidates.empty?\n\n # Sort the candidates and take the first one to get the best.\n\n best_candidate = sort_candidates(candidates).first\n\n # Add a global schedule edge.\n\n node.output_to :global_schedule, best_candidate\n else\n # If we aren't ready to schedule this node, try it again later.\n\n to_schedule.push node\n end\n end\n end",
"def registration_pending!\n Chef::Log.info('Waiting for Sumo Collector to register...')\n sleep(1)\n end",
"def send_ready_signal()\n do_send(Erlang::Tuple.new([Erlang::Atom.new('ready')]))\n end",
"def notify_ready\n notify(\"READY=1\")\n end",
"def is_ready\n if self.tasks.empty? and not self.is_done # no tasks assigned for this\n false\n elsif (self.tasks.find_by is_done: false).nil? # can't find any false => all tasks are done\n self.update_attribute(:is_done, true)\n true\n else\n false\n end\n end",
"def process_node(node)\n debug \"Process node: #{node}\"\n node.poll\n return unless node.online?\n ready_task = node.ready_task\n return unless ready_task\n ready_task.run\n end",
"def scheduled?\n @current_state == Psc::ScheduledActivity::SCHEDULED\n end",
"def ready\n Souffle::Log.info \"#{@node.log_prefix} Is ready for provisioning...\"\n end",
"def multi_workers_ready?\n true\n end",
"def multi_workers_ready?\n true\n end",
"def multi_workers_ready?\n true\n end",
"def require_recollect_status\n return @periodic_checker.fire\n end",
"def ready_task\n find do |task|\n task.ready?\n end\n end",
"def do_scheduling?\n\t\t!self.scheduled_at.blank?\n\tend",
"def ready?\n # In test, we're always ready :-)\n return true if ENV['INSTANA_GEM_TEST']\n\n @state == :announced\n end",
"def evaulate_schedule\n true\n end",
"def ready?\n !@needs_reset && @start && @end\n end",
"def ready=(_); end",
"def ready?\n @ready == true\n end",
"def get_node_ready(nodes)\n ready_nodes = nodes.select { |node| check_node_status(node) == \"ready\" }\n idle_nodes = []\n ready_nodes.each { |node| idle_nodes << node if !(DRbObject.new(nil, \"druby://#{node.ip}:9000\").executando_job) }\n idle_nodes.min{|a,b| DRbObject.new(nil, \"druby://#{a.ip}:9000\").cpu <=> DRbObject.new(nil, \"druby://#{b.ip}:9000\").cpu }\n end",
"def _ready?\n true\n end",
"def ready?; @ready; end",
"def ready?; @ready; end",
"def ready?\n state == RUNNABLE_STATE\n end",
"def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end",
"def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end",
"def send_ready_notification\n\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable log\n end",
"def ready?\n\t\t$stderr.puts \"#{@name}: ready? not overridden!\"\n\tend",
"def ready?\n return (@delay <= 0)\n end",
"def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end",
"def ready?\n true\n end",
"def push_notify_ready\n droid_destinations = patient.devices.map do |device|\n device.token if device.platform == 'android' && device.enabled\n end\n data = {:type => \"READY\", :message =>\n \"Your appointment with #{clinic.name} at #{delayed_date_time_ampm} is ready\" }\n Thread.new do\n GCM.send_notification(droid_destinations, data) unless droid_destinations.empty?\n end\n end",
"def unscheduled?\n state == :unscheduled\n end",
"def scheduled_tasks\n self.tasks.select { \n |t| t.interval != :startup && t.interval != :shutdown\n }\n end",
"def ready?\n @latch.count == 0\n end",
"def wait_until_ready\n\t\t\t\twhile true\n\t\t\t\t\tConsole.logger.debug(self) do |buffer|\n\t\t\t\t\t\tbuffer.puts \"Waiting for ready:\"\n\t\t\t\t\t\t@state.each do |child, state|\n\t\t\t\t\t\t\tbuffer.puts \"\\t#{child.class}: #{state.inspect}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tself.sleep\n\t\t\t\t\t\n\t\t\t\t\tif self.status?(:ready)\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def schedule_candidates(graph, node)\n if node.outputs.size == 1\n # If a node has just one output then that's the only candidate.\n\n [node.outputs.to_nodes.first]\n else\n # Otherwise, consider all the nodes in the graph (yes this is\n # quadratic).\n\n graph.all_nodes.select do |candidate|\n # The start node is never a candidate because we're going to schedule\n # before the candidate, and we can't schedule before the start node.\n\n if ![:start, :immediate].include?(candidate.op)\n # We only consider globally scheduled nodes as candidates.\n\n if globally_scheduled?(candidate)\n # Is there a control-flow path from all the inputs of the node to this candidate?\n\n from_all_inputs = node.inputs.from_nodes.all? { |i| !globally_scheduled?(i) || path_from_to(i, candidate) }\n\n # Is there a control-flow path from this candidate to all the outputs of this node?\n\n to_all_outputs = node.outputs.to_nodes.all? { |o| !globally_scheduled?(o) || path_from_to(candidate, o) }\n\n # Both conditions need to be true for this candidate to be valid.\n\n from_all_inputs && to_all_outputs\n end\n end\n end\n end\n end",
"def ready\n @room.user_ready!(current_user)\n broadcast_ready_changed\n end",
"def wait_for_ready\n sleep 0.1 until ready?\n end",
"def ready_status\n 'ready' if notification\n end",
"def ready?\n @status == :ready\n end",
"def update_ready!(connection)\n distribution.set_ready_for(connection)\n nil\n end",
"def update_ready!(connection)\n distribution.set_ready_for(connection)\n nil\n end",
"def ready?\n running? && @event_received\n end",
"def scheduled?(schedulable, starts, ends)\n puts \"This #{schedulable.class} is not scheduled between #{starts} and #{ends}\"\n end",
"def is_ready?\n return @ready\n end",
"def ready?\n running?(status) && running?(phase)\n end",
"def ready?\n @is_ready\n end",
"def send_ready(subs)\n self.send({\n msg: 'ready',\n subs: subs\n })\n end",
"def when_all_assigned_ips(&block)\n reset!\n if list_of_nonterminated_instances.select {|a| a.ip == \"not.assigned\" }.empty? \n block.call if block\n else\n vprint \".\"\n wait \"5.seconds\"\n when_all_assigned_ips(&block)\n end\n end",
"def ready; end",
"def ready; end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end",
"def run_ready\n items = to_run.find_all(&:ready?)\n to_run.delete_if do |item|\n items.include?(item)\n end\n items.map do |item|\n begin\n item.run! unless item.cancelled?\n rescue DeadException\n item.cancel\n rescue => e\n Zoidberg.logger.error \"<#{self}> Timed action generated an error: #{e.class.name} - #{e}\"\n end\n item if item.recur\n end.compact.each do |item|\n to_run << item\n end\n current_self\n end",
"def shutdown_pending?\n @shutdown ||= false\n end",
"def make_ready\n \tself.ready = true\n \tself.save\n end",
"def ready?\n true\n end",
"def ready?(ready_state=RUNNING)\n state == ready_state\n end",
"def if_ready\n error = @target + @period - Time.now\n if error <= 0\n @target += @period\n elapsed = Time.now - @time_start\n yield elapsed\n end\n end",
"def ready(command, opts={})\n now = Time.now.to_i\n if (command != GLOBALS['last_command']) or (now - ENV['last_time'].to_i > RATE_LIMIT)\n ENV['last_time'] = now.to_s\n GLOBALS['last_command'] = command\n return true\n end\n return false\nend",
"def ready?\n status == \"RUNNING\"\n end",
"def readyable?\n readyable\n end",
"def scheduled?\n status == Status[:scheduled]\n end",
"def run_once(timeout = nil)\n\t\t\tKernel::raise \"Running scheduler on non-blocking fiber!\" unless Fiber.blocking?\n\t\t\t\n\t\t\t# If we are finished, we stop the task tree and exit:\n\t\t\tif self.finished?\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t\n\t\t\treturn run_once!(timeout)\n\t\tend",
"def reserve_and_run_one_job; end",
"def report_scheduler_state(state)\n super if defined? super\n end",
"def ready?\n state == :READY\n end",
"def ready?\n state == :READY\n end",
"def ready?\n state == :READY\n end",
"def ready?\n state == :READY\n end",
"def ready?\n state == :READY\n end",
"def ready?\n end",
"def suppress_ready_debug\n @prevent_ready = true\n end",
"def suppress_ready_debug\n @prevent_ready = true\n end",
"def all_ready_nodes\n current_platform_spec.nodes\n end",
"def run_once?\n !!@run\n end",
"def scheduled\n @scheduled ||= count('scheduled')\n end",
"def ready?\n\t\t\t\t\tfalse\n\t\t\t\tend",
"def ready?\n raise(\"Called #{self.class.name}.ready?\")\n end",
"def ready?\n pending? and not dependencies_have_failed? and dependencies_are_ready? and concurrency_available?\n end",
"def notify_ready\n if state == :smoking\n puts \"#{name} says: I'm good on smokes, thanks\"\n else\n transition :procuring\n end\n end",
"def is_runnable?(node)\n if max_per_role > 0\n running_groups[node.role] < max_per_role\n else\n true\n end\n end",
"def schedule_public?\n event && (\n !event.current? || # All past schedules are public\n Settings.show_schedule?) # Current event schedule has explicit go-live flag\n end",
"def scheduled?\n self.status_sym == :scheduled\n end",
"def isNodeReady(node)\n cougaar_node = nil\n if node.kind_of?(String)\n\tcougaar_node = @run.society.nodes[node]\n else\n\tcougaar_node = node\n end\n if cougaar_node == nil\n\t@run.error_message(\"No known node #{node} to look for.\")\n\treturn(true)\n else\n\tcougaar_node.each_agent do |agent|\n\t # If any agent on the node is not ready, then the node is not ready\n\t # Only require this for\n\t # agents that have an SDClientPlugin or ALDynamicSDClientPlugin\n\t hasPI = false\n\t agent.each_component do |comp|\n\t if ((@useSD && /SDClientPlugin/.match(comp.classname)) || (!@useSD && /GLSExpanderPlugin/.match(comp.classname)))\n#\t @run.info_message(\"Agent #{agent.name} had SDClient: #{comp.name}\")\n\t hasPI = true\n\t break\n\t end\n\t end\n\t if (hasPI && ! isAgentReady(agent))\n#\t @run.info_message(\"At least one agent (#{agent.name}) not ready yet.\")\n\t return (false)\n\t end\n\tend\n\t# No agent was not ready, so the node is ready\n\treturn true\n end # end of else block to actually check the node\n end",
"def registration_succeeded!\n Chef::Log.info('Sumo Collector registered successfully.')\n sleep(2)\n end",
"def each_ready_task\n return to_enum(:each_ready_task) unless block_given?\n each_task do |task|\n yield task if task.ready?\n end\n end",
"def waiting_registry?\n status == 'waiting_registry'\n end",
"def update_all_worker_deployed\n self.all_worker_deployed = false\n true\n end",
"def ready?\r\n not select(0) == 0\r\n end",
"def post_init\n JR::JobLogger.log(\"#{@node.name} ready to work\")\n end",
"def ready?\n write_to_engine('isready')\n read_from_engine == \"readyok\"\n end",
"def is_required?\n return self.schedule_status == 'reschedule' ? true : false\n end",
"def instant_broadcast_processing?\n true\n end"
] | [
"0.77894527",
"0.6978141",
"0.58806896",
"0.57745874",
"0.56384164",
"0.5615665",
"0.55965364",
"0.5573211",
"0.55081576",
"0.54975164",
"0.5481254",
"0.5472935",
"0.5431965",
"0.54217064",
"0.54217064",
"0.54217064",
"0.5386987",
"0.53845656",
"0.5379257",
"0.53709334",
"0.53669935",
"0.53544754",
"0.53374565",
"0.53230727",
"0.5319348",
"0.5313298",
"0.53003985",
"0.53003985",
"0.5286728",
"0.52624243",
"0.52624243",
"0.52229995",
"0.52223545",
"0.52118987",
"0.52026105",
"0.5189101",
"0.5188956",
"0.5187923",
"0.5173265",
"0.5171266",
"0.51691586",
"0.51640344",
"0.5163988",
"0.51601946",
"0.51504016",
"0.5149898",
"0.5144901",
"0.51443404",
"0.51443404",
"0.5120323",
"0.511829",
"0.51155156",
"0.5105956",
"0.5099087",
"0.5075919",
"0.50739515",
"0.5070087",
"0.5070087",
"0.5068764",
"0.5066416",
"0.50480634",
"0.50449723",
"0.5042894",
"0.5039603",
"0.50301236",
"0.50236815",
"0.5017153",
"0.50087047",
"0.50075966",
"0.5005373",
"0.5004402",
"0.49974757",
"0.49807283",
"0.49807283",
"0.49807283",
"0.49807283",
"0.49807283",
"0.49796402",
"0.49597663",
"0.49597663",
"0.4959451",
"0.49500468",
"0.49411634",
"0.49303576",
"0.49277854",
"0.49242982",
"0.4923643",
"0.49225616",
"0.49118158",
"0.4911677",
"0.49031457",
"0.4899829",
"0.4896549",
"0.4892857",
"0.4888588",
"0.4871841",
"0.48712173",
"0.48699236",
"0.48666325",
"0.48581755"
] | 0.8257271 | 0 |
A node is globally scheduled if it was fixed anyway or we've scheduled it. | def globally_scheduled?(node)
node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:global_schedule)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ready_to_schedule?(node)\n # Ready to globally schedule\n\n node.outputs.to_nodes.all? do |i|\n globally_scheduled?(i)\n end\n end",
"def locally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:local_schedule)\n end",
"def scheduled?\r\n @time != :forever\r\n end",
"def global_schedule(graph)\n # Create a work list of the floating nodes.\n\n to_schedule = graph.all_nodes.select {|n| n.floating? && n.op != :immediate }\n\n # Keep going until the work list is empty.\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # Are we ready to schedule this node?\n\n if ready_to_schedule?(node)\n # Find candidates to anchor this node to.\n\n candidates = schedule_candidates(graph, node)\n\n # If there aren't any then we're stuck!\n\n raise 'stuck' if candidates.empty?\n\n # Sort the candidates and take the first one to get the best.\n\n best_candidate = sort_candidates(candidates).first\n\n # Add a global schedule edge.\n\n node.output_to :global_schedule, best_candidate\n else\n # If we aren't ready to schedule this node, try it again later.\n\n to_schedule.push node\n end\n end\n end",
"def fixed_anchor(node)\n raise unless globally_scheduled?(node)\n\n if node.fixed?\n # A fixed node is anchored to itself.\n node\n else\n # Otherwise we anchored using an output to another node.\n anchor = node.outputs.with_output_name(:global_schedule).to_nodes.first\n raise unless anchor\n fixed_anchor(anchor)\n end\n end",
"def do_scheduling?\n\t\t!self.scheduled_at.blank?\n\tend",
"def scheduled?\n @current_state == Psc::ScheduledActivity::SCHEDULED\n end",
"def evaulate_schedule\n true\n end",
"def scheduled?\n status == Status[:scheduled]\n end",
"def scheduled?\n self.status_sym == :scheduled\n end",
"def name\n 'always_be_scheduling'\n end",
"def name\n 'always_be_scheduling'\n end",
"def toggle_scheduler\n new_scheduler = WaterManager.first.scheduling_option == CRONTAB_SPRINKLE_ALL ? DAEMON_MINUTE_HAND : CRONTAB_SPRINKLE_ALL\n WaterManager.first.update(scheduling_option: new_scheduler)\n end",
"def schedulable?(starting, ending)\n !scheduled?(starting - lead_time, ending)\n end",
"def report_scheduler_state(state)\n super if defined? super\n end",
"def schedule_public?\n event && (\n !event.current? || # All past schedules are public\n Settings.show_schedule?) # Current event schedule has explicit go-live flag\n end",
"def scheduled?(schedulable, starts, ends)\n puts \"This #{schedulable.class} is not scheduled between #{starts} and #{ends}\"\n end",
"def unresched\n action('unresched')\n end",
"def unscheduled?\n state == :unscheduled\n end",
"def scheduled\n @scheduled ||= count('scheduled')\n end",
"def process_node(node)\n debug \"Process node: #{node}\"\n node.poll\n return unless node.online?\n ready_task = node.ready_task\n return unless ready_task\n ready_task.run\n end",
"def has_schedule?\n self.schedule != nil\n end",
"def require_recollect_status\n return @periodic_checker.fire\n end",
"def schedule\n # implemented by subclass\n end",
"def resched\n action('resched')\n end",
"def is_required?\n return self.schedule_status == 'reschedule' ? true : false\n end",
"def scheduled_tasks\n self.tasks.select { \n |t| t.interval != :startup && t.interval != :shutdown\n }\n end",
"def rocket_job_restart_new_instance\n return unless cron_schedule\n super\n end",
"def rocket_job_restart_new_instance\n return unless cron_schedule\n super\n end",
"def active_schedule\n @_schedule = Schedule.active\n end",
"def schedule_candidates(graph, node)\n if node.outputs.size == 1\n # If a node has just one output then that's the only candidate.\n\n [node.outputs.to_nodes.first]\n else\n # Otherwise, consider all the nodes in the graph (yes this is\n # quadratic).\n\n graph.all_nodes.select do |candidate|\n # The start node is never a candidate because we're going to schedule\n # before the candidate, and we can't schedule before the start node.\n\n if ![:start, :immediate].include?(candidate.op)\n # We only consider globally scheduled nodes as candidates.\n\n if globally_scheduled?(candidate)\n # Is there a control-flow path from all the inputs of the node to this candidate?\n\n from_all_inputs = node.inputs.from_nodes.all? { |i| !globally_scheduled?(i) || path_from_to(i, candidate) }\n\n # Is there a control-flow path from this candidate to all the outputs of this node?\n\n to_all_outputs = node.outputs.to_nodes.all? { |o| !globally_scheduled?(o) || path_from_to(candidate, o) }\n\n # Both conditions need to be true for this candidate to be valid.\n\n from_all_inputs && to_all_outputs\n end\n end\n end\n end\n end",
"def reserve_and_run_one_job; end",
"def rocket_job_restart_new_instance\n return unless cron_schedule\n\n super\n end",
"def should_run?\n val = (!all_nodes_ready? ||\n config_updated?)\n end",
"def scheduling_type_dag?\n scheduling_type.nil? ? find_legacy_scheduling_type == :dag : super\n end",
"def is_scheduling_enabled\n return @is_scheduling_enabled\n end",
"def check_schedule_confirmed\n\t\t# Picked a random 'check' user service and temporary set it's status to schedule_confirmed\n\t\tuser_service \t\t= UserService.find_by(relationship_type: 'check')\n\t\tuser_service.date \t= Time.now\n\t\tuser_service.status = 'schedule_confirmed'\n\t\tUserServicesMailer.check_updated(user_service)\n\tend",
"def local_schedule(graph)\n # Find all basic blocks and locally schedule them.\n\n graph.all_nodes.each do |node|\n if node.begins_block?\n locally_schedule_block node\n end\n end\n end",
"def is_runnable?(node)\n if max_per_role > 0\n running_groups[node.role] < max_per_role\n else\n true\n end\n end",
"def locally_schedule_block(first_node)\n # Find all the nodes in this basic block.\n\n in_block = Set.new(nodes_in_block(first_node))\n\n # Back up a second... our first node could be a fixed node, which\n # actually has input values. Such as a branch with a condition.\n # The nodes involved in that condition actually need to come first.\n\n first_node = first_in_block(first_node, in_block)\n\n # Create a work list of nodes to schedule and a set of nodes\n # already scheduled.\n\n to_schedule = in_block.to_a\n scheduled = Set.new\n\n # The first node in the basic block is already scheduled first.\n\n to_schedule.delete first_node\n scheduled.add first_node\n\n # The tail is the last node we scheduled.\n\n tail = first_node\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # We are ready to locally schedule if all inputs that are in this\n # block have themselves already been scheduled.\n\n if node.inputs.from_nodes.all? { |i| !in_block.include?(i) || scheduled.include?(i) }\n # Add a local schedule edge from the previous last node to this one,\n # which then becomes the last node.\n raise if tail.inputs.from_nodes.include? node\n tail.output_to :local_schedule, node\n tail = node\n scheduled.add node\n else\n to_schedule.push node\n end\n end\n end",
"def trigger_off_schedule(time=EoTime.now)\n\n do_trigger(time)\n end",
"def is_scheduling_enabled=(value)\n @is_scheduling_enabled = value\n end",
"def scheduled?(starting, ending)\n schedule.scheduled?(self, starting, ending)\n end",
"def reboot_if_needed!(node)\n if node.run_context.reboot_requested?\n reboot!(node)\n end\n end",
"def default_fork_every\n defined?(@@default_fork_every) ? @@default_fork_every : true\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def check_schedule_unconfirmed\n\t\t# Picked a random 'check' user service and temporary set it's status to scheduled_unconfirmed\n\t\tuser_service \t\t= UserService.find_by(relationship_type: 'check')\n\t\tuser_service.date \t= Time.now\n\t\tuser_service.status = 'schedule_unconfirm'\n\t\tUserServicesMailer.check_updated(user_service)\n\tend",
"def check_possible_times\n @possible_times = Event::POSSIBLE_TIMES_CONST\n end",
"def periodic_flush\n true\n end",
"def set_scheduled_flag(value)\n self.scheduled = value\n self.save!\n end",
"def not_applicable?\n @current_state == Psc::ScheduledActivity::NA\n end",
"def allow_custom_assignment_schedule\n return @allow_custom_assignment_schedule\n end",
"def capable_tasks() @capable_tasks ||= Task.children; end",
"def preschedule_ct(ct)\n assign_package_for(ct, reservation: true)\n end",
"def scheduler_state\n plan.consolidated_scheduler_state\n end",
"def on_schedule\n return to_enum(:on_schedule) unless block_given?\n start = context.order.created_at\n finish = start + context.order.gateway.orders_expiration_period.seconds\n period = finish - start\n often = {\n base_interval: ENVied.ORDER_CHECK_BASE_INTERVAL.seconds,\n max_interval: ENVied.ORDER_CHECK_MAX_INTERVAL.seconds,\n rand_factor: ENVied.ORDER_CHECK_RAND_FACTOR,\n multiplier: ENVied.ORDER_CHECK_BACKOFF_MULT,\n max_period: period,\n }\n now = start\n with_intervals often do |interval|\n now += interval\n now = now.round(2)\n yield now, false\n end\n yield finish, true\n end",
"def last_run_at\n super || self.schedule.try(:previous_occurrence)\n end",
"def active?\n schedule.active?\n end",
"def assigned?\n self.task_state == TaskState.assigned\n end",
"def planning_simple()\n @free_time = nil\n if(@tasks.size > 0)\n # @timelines[0].add_event(Simple_task.new(2))\n # $time += 1\n @timelines[0].add_event(@tasks.pop)\n end\n nil\n end",
"def assign_node(char)\n assigned = false\n @worker_obj.each do |k, node|\n break if assigned\n unless node\n @worker_obj[k] = [char, NUM_TO_INT_MAP[char] + ADDITIONAL_SECONDS]\n @nodes_being_worked_on << char\n assigned = true\n end\n end\n end",
"def can_cancel_and_reschedule?\n return true unless follow_up_for_dose\n\n Time.zone.now > can_change_after\n end",
"def task_schedule_status(task)\n\t\tstatus = []\n\tend",
"def run_once(timeout = nil)\n\t\t\tKernel::raise \"Running scheduler on non-blocking fiber!\" unless Fiber.blocking?\n\t\t\t\n\t\t\t# If we are finished, we stop the task tree and exit:\n\t\t\tif self.finished?\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t\n\t\t\treturn run_once!(timeout)\n\t\tend",
"def on_volatile(node)\n results << node\n end",
"def refreshable?(node)\n return false if node.arbiter?\n node.down? ? node.down_at < down_boundary : node.needs_refresh?(refresh_boundary)\n end",
"def schedule(parent: @parent || Task.current)\n @scheduler_task ||=\n parent.async { |task|\n task.annotate(\"scheduling tasks for #{self.class}.\")\n\n while @waiting.any? && !limit_blocking?\n delay = [next_acquire_time - Async::Clock.now, 0].max\n task.sleep(delay) if delay.positive?\n resume_waiting\n end\n\n @scheduler_task = nil\n }\n end",
"def reboot_pending?\n # don't break when used as a mixin in contexts without #node (e.g. specs).\n if respond_to?(:node, true) && node.run_context.reboot_requested?\n true\n elsif platform?(\"windows\")\n # PendingFileRenameOperations contains pairs (REG_MULTI_SZ) of filenames that cannot be updated\n # due to a file being in use (usually a temporary file and a system file)\n # \\??\\c:\\temp\\test.sys!\\??\\c:\\winnt\\system32\\test.sys\n # http://technet.microsoft.com/en-us/library/cc960241.aspx\n registry_value_exists?(\"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\", { name: \"PendingFileRenameOperations\" }) ||\n\n # RebootRequired key contains Update IDs with a value of 1 if they require a reboot.\n # The existence of RebootRequired alone is sufficient on my Windows 8.1 workstation in Windows Update\n registry_key_exists?('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired') ||\n\n # Vista + Server 2008 and newer may have reboots pending from CBS\n registry_key_exists?('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\RebootPending')\n elsif platform_family?(\"debian\")\n File.exist?(\"/var/run/reboot-required\")\n else\n false\n end\n end",
"def poos_how_often=(new_poo_schedule)\n\t\tputs \"You don't even know.\"\n\tend",
"def on_masgn(node)\n @in_masgn = true\n result = super\n @in_masgn = false\n result\n end",
"def evaulate_schedule\n 5\n end",
"def find_legacy_scheduling_type\n strong_memoize(:find_legacy_scheduling_type) do\n needs.exists? ? :dag : :stage\n end\n end",
"def test_for_node\n raise \"Failing test #{@name} for #{@node}\" if Node.fail_for.key?(@name) && Node.fail_for[@name].include?(@node)\n\n sleep_time = Node.sleeps.dig(@name, @node)\n sleep sleep_time unless sleep_time.nil?\n Node.runs << [@name, @node]\n end",
"def test_for_node\n deploy_info = @deployer.deployment_info_from(@node)[@node]\n if deploy_info.key?(:error)\n error \"Error while getting deployment info: #{deploy_info[:error]}\"\n elsif Time.now.utc - deploy_info[:deployment_info][:date] > MAX_ACCEPTABLE_REFRESH_PERIOD_SECS\n error \"Last deployment has been done on #{deploy_info[:deployment_info][:date].strftime('%F')}. Should refresh it.\"\n end\n end",
"def save!\n start_scheduler\n end",
"def restart_pending?\n @restart ||= false\n end",
"def local_node\n @local_node ||= DPN::Workers.nodes.node(to_node)\n end",
"def do_not_thread; true; end",
"def do_not_thread; true; end",
"def do_not_thread; true; end",
"def run_now!\n update_attributes(run_at: nil) if cron_schedule\n end",
"def default_volatile?(default); end",
"def on_op_change_force_uncurrent\n if sake_op_changed?\n write_current_sake_op\n mark_all_tasks_uncurrent\n end\n end",
"def default_task\n SidekiqUniqueJobs::TimerTask.new(timer_task_options) do\n with_logging_context do\n redis do |conn|\n refresh_reaper_mutex\n Orphans::Reaper.call(conn)\n end\n end\n end\n end",
"def non_persistent_schedules\n @non_persistent_schedules ||= {}\n end",
"def schedule\n schedule = start_time > Time.current ? UPCOMING_MATCH : PLAYED_MATCH\n\n schedule\n end",
"def reschedule (scheduler)\n to_reschedule(scheduler)\n end",
"def all_nodes_ready?\n if current_platform_spec.nodes.nil?\n false\n else\n true\n end\n end",
"def global?; true end",
"def on_run_flag(node)\n children = node.children.dup\n names = children.shift\n state = children.shift\n Array(names).each do |name|\n if @run_flag_table[name.to_sym].nil?\n @run_flag_table[name.to_sym] = 1\n else\n @run_flag_table[name.to_sym] += 1\n end\n end\n process_all(node.children)\n end",
"def maybe_start!\n return if started? || entries.where(readied_at: nil).any? || entries.count < 2\n\n update(started_at: Time.now.utc + 20.seconds)\n\n # Schedule ghost splits and finishes\n entries.ghosts.find_each do |entry|\n entry.update(finished_at: started_at + (entry.run.duration(Run::REAL).to_sec))\n Api::V4::RaceBroadcastJob.set(wait_until: started_at + entry.run.duration(Run::REAL).to_sec).perform_later(\n self, 'race_entries_updated', 'A ghost has finished'\n )\n entry.run.segments.with_ends.each do |segment|\n Api::V4::RaceBroadcastJob.set(wait_until: started_at + segment.end(Run::REAL).to_sec).perform_later(\n self, 'race_entries_updated', 'A ghost has split'\n )\n end\n end\n\n # Schedule cleanup job for a started race that was abandoned\n RaceCleanupJob.set(wait_until: started_at + 48.hours).perform_later(self)\n\n Api::V4::RaceBroadcastJob.perform_later(self, 'race_start_scheduled', 'The race is starting soon')\n Api::V4::GlobalRaceUpdateJob.perform_later(self, 'race_start_scheduled', 'A race is starting soon')\n end",
"def primitive_has_master_running?(primitive, node = nil)\n is_multistate = primitive_is_multistate? primitive\n return is_multistate unless is_multistate\n status = primitive_status primitive, node\n return status unless status\n status == 'master'\n end",
"def on_run_flag(node)\n children = node.children.dup\n name = children.shift\n state = children.shift\n unless name.is_a?(Array)\n if @run_flag_table[name.to_sym].nil?\n @run_flag_table[name.to_sym] = 1\n else\n @run_flag_table[name.to_sym] += 1\n end\n end\n end",
"def supports_soft_reconfig_always?\n str = node.cmd_ref.lookup('bgp_neighbor_af',\n 'soft_reconfiguration_in').set_value\n str.to_s[/always/]\n end",
"def node(node)\n true\n end",
"def do_not_thread\n true\n end",
"def schedule\n @schedule || Schedule.new\n end",
"def limit_jobs?\n !self[:scheduling].nil? && self[:scheduling] == false\n end"
] | [
"0.7542531",
"0.75391006",
"0.6578071",
"0.65023583",
"0.59982514",
"0.59718174",
"0.59263",
"0.5889321",
"0.58093995",
"0.5792013",
"0.57559276",
"0.57559276",
"0.5634934",
"0.56066346",
"0.5554238",
"0.5544156",
"0.55417806",
"0.5528694",
"0.55213404",
"0.54560167",
"0.5432021",
"0.54238504",
"0.539461",
"0.5393159",
"0.5340358",
"0.5325906",
"0.53243214",
"0.531137",
"0.531137",
"0.530479",
"0.5295328",
"0.528104",
"0.5247587",
"0.5233466",
"0.52278477",
"0.522674",
"0.5210371",
"0.5203132",
"0.51991796",
"0.51982236",
"0.51795816",
"0.5122259",
"0.51049083",
"0.5092692",
"0.5074225",
"0.5070583",
"0.5070583",
"0.5070583",
"0.50676835",
"0.5056901",
"0.5044872",
"0.5035234",
"0.5031409",
"0.50295115",
"0.5024684",
"0.50150204",
"0.5003824",
"0.50000715",
"0.4994094",
"0.49939874",
"0.49768925",
"0.496378",
"0.49616542",
"0.4951535",
"0.49350876",
"0.49224868",
"0.4913503",
"0.49131992",
"0.4911053",
"0.4909729",
"0.49074277",
"0.4905469",
"0.49005064",
"0.4895921",
"0.48934758",
"0.4893036",
"0.48897347",
"0.48893014",
"0.48883265",
"0.48863858",
"0.48863858",
"0.48863858",
"0.4881705",
"0.48815992",
"0.4881254",
"0.48788282",
"0.4875794",
"0.4872813",
"0.48710555",
"0.4869753",
"0.48696706",
"0.48524246",
"0.48474696",
"0.48473793",
"0.4844026",
"0.48423332",
"0.48409554",
"0.4839808",
"0.48382378",
"0.48365796"
] | 0.81634796 | 0 |
Find all possible nodes we could anchor a floating node to to globally schedule it. | def schedule_candidates(graph, node)
if node.outputs.size == 1
# If a node has just one output then that's the only candidate.
[node.outputs.to_nodes.first]
else
# Otherwise, consider all the nodes in the graph (yes this is
# quadratic).
graph.all_nodes.select do |candidate|
# The start node is never a candidate because we're going to schedule
# before the candidate, and we can't schedule before the start node.
if ![:start, :immediate].include?(candidate.op)
# We only consider globally scheduled nodes as candidates.
if globally_scheduled?(candidate)
# Is there a control-flow path from all the inputs of the node to this candidate?
from_all_inputs = node.inputs.from_nodes.all? { |i| !globally_scheduled?(i) || path_from_to(i, candidate) }
# Is there a control-flow path from this candidate to all the outputs of this node?
to_all_outputs = node.outputs.to_nodes.all? { |o| !globally_scheduled?(o) || path_from_to(candidate, o) }
# Both conditions need to be true for this candidate to be valid.
from_all_inputs && to_all_outputs
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end",
"def closest_nodes_to_all(nodes, nodes_from, max_dist = nil)\n closest = []\n nodes_from.each do |node_from|\n closest += closest_nodes(nodes, node_from, max_dist)[0..5]\n end\n closest.uniq\n end",
"def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end",
"def global_schedule(graph)\n # Create a work list of the floating nodes.\n\n to_schedule = graph.all_nodes.select {|n| n.floating? && n.op != :immediate }\n\n # Keep going until the work list is empty.\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # Are we ready to schedule this node?\n\n if ready_to_schedule?(node)\n # Find candidates to anchor this node to.\n\n candidates = schedule_candidates(graph, node)\n\n # If there aren't any then we're stuck!\n\n raise 'stuck' if candidates.empty?\n\n # Sort the candidates and take the first one to get the best.\n\n best_candidate = sort_candidates(candidates).first\n\n # Add a global schedule edge.\n\n node.output_to :global_schedule, best_candidate\n else\n # If we aren't ready to schedule this node, try it again later.\n\n to_schedule.push node\n end\n end\n end",
"def get_neighbors(node)\n possible = []\n possible << @grid[[node.x, node.y - 1]] if @grid[[node.x, node.y - 1]].descriptor == TRAVERSABLE\n possible << @grid[[node.x, node.y + 1]] if @grid[[node.x, node.y + 1]].descriptor == TRAVERSABLE\n possible << @grid[[node.x - 1, node.y]] if @grid[[node.x - 1, node.y]].descriptor == TRAVERSABLE\n possible << @grid[[node.x + 1, node.y]] if @grid[[node.x + 1, node.y]].descriptor == TRAVERSABLE\n return possible\n end",
"def get_neighbors(node)\n possible = []\n possible << @grid[[node.x, node.y - 1]] if @grid[[node.x, node.y - 1]].descriptor == TRAVERSABLE\n possible << @grid[[node.x, node.y + 1]] if @grid[[node.x, node.y + 1]].descriptor == TRAVERSABLE\n possible << @grid[[node.x - 1, node.y]] if @grid[[node.x - 1, node.y]].descriptor == TRAVERSABLE\n possible << @grid[[node.x + 1, node.y]] if @grid[[node.x + 1, node.y]].descriptor == TRAVERSABLE\n return possible\n end",
"def free_nodes\n nodes.select(&:is_free?)\n end",
"def get_nodes\n @known_nodes\n end",
"def unused_nodes\n s = []\n (0..7).each do |i|\n if position[i] && !position[i].used\n s << i\n end\n end\n s\n end",
"def bfs(starting_node, target_value)\n return starting_node if starting_node.value == target_value\n queue = [starting_node]\n until queue.empty?\n queue += starting_node.neighbors\n queue.each { |neighbor| bfs(neighbor, tar) }\n end\n nil\nend",
"def find_reachable_adjacents\n\t\tfind_all_adjacents.select { |p| (is_free?(p) && !@closed.include?(p)) }\n\tend",
"def nodes(nodeSet = Set.new)\n @topo.eachNode do |n|\n nodeSet << n\n end\n return nodeSet\n end",
"def find_neighbors(node)\n nbrs = []\n self.edges.each do |e|\n nbrs.push(e.target) if e.source == node\n nbrs.push(e.source) if e.target == node\n end\n nbrs\n end",
"def bfs(starting_node, target_value)\n queue = [starting_node]\n checked_nodes = Set.new\n\n until queue.empty?\n current = queue.shift\n unless checked_nodes.include?(current)\n checked_nodes.add(current)\n return current if current.value == target_value\n queue += current.neighbors\n end\n end\n nil\nend",
"def closest_nodes(nodes, node_from, max_dist = nil)\n max_dist = [segment_length * 0.10, 2222].min if !max_dist\n closest = []\n nodes.each do |node_to|\n d = node_from.distance(node_to)\n closest << [node_to, d] if d and d <= max_dist\n end\n closest.sort_by! {|x| x[1]}\n closest.collect {|x| x[0]}.uniq\n end",
"def singleton_nodes\n all_node_ids = Node_Query.new(analysis_window: aw).run.first[:objects].collect{|n| n.id}.uniq\n all_nodes_in_ways = Way_Query.new(analysis_window: aw).run.first[:objects].collect{|w| w.nodes}.flatten.uniq\n # all_nodes_in_rels = Relation_Query.new(analysis_window: aw).run.first[:objects].collect{|r| r.nodes}.flatten.uniq\n nodes_not_in_ways_or_rels = (all_node_ids - all_nodes_in_ways).length\n puts \"Total Nodes: #{all_node_ids.length}, Nodes not in ways or relations: #{nodes_not_in_ways_or_rels}\"\n puts \"Percentage: #{nodes_not_in_ways_or_rels.to_f / all_node_ids.length.to_f}\"\n end",
"def find_all_paths\n found_paths = []\n \n explore(found_paths, nil, @start_node)\n \n found_paths\n end",
"def bfs(target_pos) #this is called on the root node \n tar_x, tar_y = target_pos \n\n arr = [self]\n\n until arr.empty?\n current_check = arr.shift \n return current_check if current_check.root_node == target_pos\n arr.concat(current_check.children)\n end\n nil\n end",
"def find_global_leaves\n find_leaf_nodes.to_a.select {|node| node.is_global?}\n end",
"def bfs(start_node_num)\n node = find_node(start_node_num)\n _clear_visited\n ret_list = [node.value]\n # Your code here\n q = Queue.new\n q << node\n node.visited = true\n\n until q.empty?\n current = q.pop\n current.edges.each do |edge|\n next if edge.node_to.visited\n q << edge.node_to\n edge.node_to.visited = true\n ret_list << edge.node_to.value\n end\n end\n\n return ret_list\n end",
"def dfs_helper(start_node)\n\n ret_list = [start_node.value]\n # Your code here\n start_node.visited = true\n start_node.edges.each do |edge|\n unless edge.node_to.visited\n ret_list += dfs_helper(edge.node_to)\n end\n end\n return ret_list\n end",
"def get_all_operations\n list = []\n queue = Queue.new\n queue << node\n until queue.empty?\n n = queue.pop\n puts \"NODE: \" + n.to_s\n if n.operation != NodeOperation::NODE\n list.push(n)\n n.nodes.each do |sub_node|\n queue << sub_node\n end\n end\n end\n list\n end",
"def near(node_map)\n output_nodes = []\n \n potential_neighbor_strings().each do |coordinate_string|\n\n if !node_map[coordinate_string][:contents]\n output_nodes << node_map[coordinate_string][:node]\n end\n end\n\n output_nodes\n end",
"def neighbours_into_start(node)\n # Find all arcs that include this node in the right place\n passable_nodes = []\n @arcs.get_arcs_by_node_id(node.node_id).each do |arc|\n if arc.end_node_id == node.node_id and arc.end_node_direction\n passable_nodes.push nodes[arc.begin_node_id]\n elsif arc.begin_node_id == node.node_id and !arc.begin_node_direction\n passable_nodes.push nodes[arc.end_node_id]\n end\n end\n return passable_nodes.uniq\n end",
"def all_nodes\n nodes = []\n visit_nodes do |node|\n nodes.push node\n end\n nodes\n end",
"def bfs(starting_node, target_value)\n queue = [starting_node]\n visited = Set.new()\n\n starting_node.neighbors.each do |neighb_nodes|\n\n return queue.first.value if queue.first.value == target_value\n\n visited.add(queue.shift) \n\n queue.push(neighb_nodes) unless visited.include?(neighb_nodes)\n \n end\n nil\nend",
"def select_nodes(graph)\n begin\n route1, route2 = graph.random_routes\n node1 = route1.random_node\n node2 = route2.find_closest(node1)\n end while ( (route2.demand + node1.demand) > graph.vehicle_capacity )\n return route1, route2, node1, node2\n end",
"def pin_true_nodes\n r = []\n @start_nodes.each {|n| n.pin(r) }\n @start_nodes = r\n\n # consisitency check\n @start_nodes.each do |n|\n raise unless n.parents.empty?\n next if n.children.empty?\n raise if n.children.size == 1\n raise if n.children.any? {|cc| cc.pinned }\n end\n\n # remove unused nodes\n @start_nodes.reject! {|n| n.children.empty? }\n end",
"def shortest_distance_to_all_nodes(initial)\n Hash[shortest_path_to_all_nodes(initial).map {|n| [n, n.distance]}]\n end",
"def force_cluster_strict_hierarchy\n # Find the nodes belonging to several clusters.\n loop do\n # First cluster found each node name\n # Hash<String, String >\n cluster_per_node = {}\n conflicting_clusters = nil\n @nodes_graph.each do |node_name, node_info|\n node_info[:includes].each do |included_node_name|\n if cluster_per_node.key?(included_node_name)\n # Found a conflict between 2 clusters\n conflicting_clusters = [node_name, cluster_per_node[included_node_name]]\n log_error \"Node #{included_node_name} found in both clusters #{node_name} and #{cluster_per_node[included_node_name]}\"\n break\n else\n cluster_per_node[included_node_name] = node_name\n end\n end\n break unless conflicting_clusters.nil?\n end\n break if conflicting_clusters.nil?\n\n # We have conflicting clusters to resolve\n cluster_1, cluster_2 = conflicting_clusters\n cluster_1_belongs_to_cluster_2 = @nodes_graph[cluster_1][:includes].all? { |cluster_1_node_name| @nodes_graph[cluster_2][:includes_proc].call(cluster_1_node_name) }\n cluster_2_belongs_to_cluster_1 = @nodes_graph[cluster_2][:includes].all? { |cluster_2_node_name| @nodes_graph[cluster_1][:includes_proc].call(cluster_2_node_name) }\n if cluster_1_belongs_to_cluster_2\n if cluster_2_belongs_to_cluster_1\n # Both clusters have the same nodes\n if @nodes_graph[cluster_1][:includes_proc].call(cluster_2)\n @nodes_graph[cluster_2][:includes] = (@nodes_graph[cluster_1][:includes] + @nodes_graph[cluster_2][:includes]).uniq\n @nodes_graph[cluster_1][:includes] = [cluster_2]\n else\n @nodes_graph[cluster_1][:includes] = (@nodes_graph[cluster_1][:includes] + @nodes_graph[cluster_2][:includes]).uniq\n @nodes_graph[cluster_2][:includes] = [cluster_1]\n end\n else\n # All nodes of cluster_1 belong to cluster_2, but some nodes of cluster_2 don't belong to cluster_1\n @nodes_graph[cluster_2][:includes] = @nodes_graph[cluster_2][:includes] - @nodes_graph[cluster_1][:includes] + [cluster_1]\n end\n elsif cluster_2_belongs_to_cluster_1\n # All nodes of cluster_2 belong to cluster_1, but some nodes of cluster_1 don't belong to cluster_2\n @nodes_graph[cluster_1][:includes] = @nodes_graph[cluster_1][:includes] - @nodes_graph[cluster_2][:includes] + [cluster_2]\n else\n # cluster_1 and cluster_2 have to be merged\n new_cluster_name = \"#{cluster_1}_&_#{cluster_2}\"\n # Store thos proc in those variables as the cluster_1 and cluster_2 references are going to be removed\n includes_proc_1 = @nodes_graph[cluster_1][:includes_proc]\n includes_proc_2 = @nodes_graph[cluster_2][:includes_proc]\n @nodes_graph[new_cluster_name] = {\n type: :cluster,\n includes: (@nodes_graph[cluster_1][:includes] + @nodes_graph[cluster_2][:includes]).uniq,\n connections: @nodes_graph[cluster_1][:connections].merge!(@nodes_graph[cluster_2][:connections]) { |_connected_node, labels_1, labels_2| (labels_1 + labels_2).uniq },\n includes_proc: proc do |hostname|\n includes_proc_1.call(hostname) || includes_proc_2.call(hostname)\n end\n }\n replace_nodes([cluster_1, cluster_2], new_cluster_name)\n end\n end\n end",
"def tasks_in_subtree\n seen = {}\n f = proc do |root|\n unless seen[root]\n seen[root] = root\n for elem in root.deps_o\n f.call(elem)\n end\n end\n end\n f.call(self)\n seen.values\n end",
"def bfs(starting_node, target_value)\n visited = Set.new()\n queue = [starting_node]\n until queue.empty?\n dequeued = queue.shift\n return dequeued if dequeued.val == target_value\n visited.add(dequeued)\n dequeued.neighbors.each do |neighbor|\n queue << neighbor unless visited.include?(neighbor)\n end\n end\n nil\nend",
"def starting_nodes(graph)\n graph.nodes.select { |node| node.incoming_edges.empty? }\n end",
"def reachable_cells(x, y, world)\n visited = []\n queue = [[x, y]]\n\n while !queue.empty?\n start = queue.pop\n neighbors = DIRECTIONS.values.\n map {|d| [start[0] + d[:x], start[1] + d[:y]]}.\n select {|x,y| world[y][x] == '.' }\n new_cells = neighbors - visited\n queue = queue + new_cells\n visited.push(start)\n end\n\n visited\nend",
"def resolve_from_to\n @from_hosts << { all: true } if @from_hosts.empty?\n @to_hosts << { all: true } if @to_hosts.empty?\n [\n @nodes_handler.select_nodes(@from_hosts),\n @nodes_handler.select_nodes(@to_hosts)\n ]\n end",
"def shortest_path_to_all_nodes(initial)\n initial.distance = 0\n\n current = initial\n loop do\n unvisited.delete(current)\n\n calculate_neighbor_shortest_distances(current)\n\n return graph.vertices if no_reachable_nodes\n\n current = unvisited.min_by(&:distance)\n end\n end",
"def get_true_node_objects get_all_nodes=false\r\n nodes, all_nodes, names, iter_arr, file_cache_nodes, h = [],[],[],[],[],{}\r\n\r\n @config['chef_nodes'] = @config['ridley'].node.all\r\n\r\n @config['helper'].completion_rate? 0, __method__\r\n\r\n file_cache_nodes = @config['filesystem'].check_nodes_file_cache if @config['filesystem'].compare_file_node_cache_against_chef_nodes('equal')\r\n\r\n @config['chef_nodes'].each do |n|\r\n true_obj = if !file_cache_nodes.empty? && @config['parser'].array_of_nodes_contains_node_name?(file_cache_nodes, n.name)\r\n file_cache_nodes[@config['parser'].index_of_node_name_in_array_of_nodes(file_cache_nodes, n.name)]\r\n else\r\n @config['filesystem'].cleanup_file_caches('current-nodes')\r\n\r\n @config['ridley'].node.find(n.name)\r\n end\r\n\r\n iter_arr << n.name\r\n\r\n progress_value = (( iter_arr.length.to_f/@config['chef_nodes'].length.to_f )*100 ).floor\r\n\r\n @config['helper'].completion_rate? progress_value, __method__\r\n\r\n all_nodes << true_obj\r\n\r\n next if !get_all_nodes && true_obj.chef_environment != @options['env'] && true_obj.chef_environment != '_default'\r\n\r\n if get_all_nodes\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n if @options['role'] == 'all'\r\n next if true_obj.chef_environment == '_default'\r\n\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n if @options['node_name'] && true_obj.name == @options['node_name']\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n if @options['address'] && true_obj.public_ipaddress == @options['address']\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n unless ( @options['address'] || @options['node_name'] )\r\n if true_obj.run_list.include?(\"role[#{ @options['role'] }]\")\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next #not needed here but good to keep in mind\r\n end\r\n end\r\n end\r\n\r\n names.sort.each { |name| nodes << h[name] }\r\n\r\n @config['filesystem'].write_nodes_file_cache(all_nodes) unless @config['filesystem'].compare_file_node_cache_against_chef_nodes('equal')\r\n\r\n puts(\"\") unless @options['quiet']\r\n \r\n nodes\r\n end",
"def dfs(list)\n s = []\n visited = Set.new\n\n s.push(start_node)\n\n while !s.empty?\n current_node = s.shift\n next if visited.include?(current_node)\n visited.add(current_node)\n current_node.neighbors.each do |n|\n s.push(n)\n end\n puts current_node.name\n p s.map(&:name)\n p visited.map(&:name)\n end\nend",
"def static_wheel_nodes(width=@width, height=@height, nodeset=@nodes)\n static = Hash.new()\n nonstatic = Hash.new()\n nodeset.each do |key,node| \n if node.static == 'center'\n static[key] = node\n else\n nonstatic[key] = node \n end\n end\n \n circle_nodes(width,height,nonstatic) #circle the nonstatics normally\n\n # this is just the code from circle_nodes, without the \"static\" check (and swapped circle list). Not worth factoring out\n center = Vector[width/2, height/2]\n radius = (static.length<=1 ? 0 : [width,height].min/5)\n static.each_with_index{|(key, node), i| static[key].location = Vector[\n center[0] + (radius * -1*Math.cos(2*Math::PI*i/static.length)), \n center[1] + (radius * -1*Math.sin(2*Math::PI*i/static.length))]}\n end",
"def possible_edges\n @possible_edges ||= @node_list.to_a.combination(2).to_a\n end",
"def infinite_loops\n reachable_sets = @nodes.group_by(&:forward)\n reachable_sets.each do |reachable,nodes|\n yield reachable if reachable == nodes.to_set\n end\n end",
"def nodes\n @nodes.frozen? ? @nodes : @nodes.dup.freeze\n end",
"def find_management_nodes\n management_nodes = Node.by_is_management.reverse\n end",
"def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end",
"def nodes # :nodoc:\n return @nodes if defined?(@nodes) \n node_ids = (1..Configuration.numbers['total_nodes'])\n @nodes = node_ids.map do |id| \n {\n id: id,\n host: \"node_#{id}_#{Worker::VERSION}\"\n }.to_struct\n end\n end",
"def all_ready_nodes\n current_platform_spec.nodes\n end",
"def path_finder \n until queue.empty? \n current_node = queue.shift()\n generate_neighbours(current_node)\n current_node.neighbour_nodes.each do |neighbour|\n track_visited(current_node, neighbour)\n correct_node?(neighbour) ? (return neighbour.visited) : (queue << neighbour)\n end\n end\n end",
"def nodes\n @nodes ||= each_node.to_a\n end",
"def available_node_list\n all_nodes = Node.by_name\n return all_nodes.select {|node| node.status == \"RUNNING\"}\n end",
"def allowed_nodes\n if is_root?\n Node.with_root_fund_items_for( fund_grant ).under_limit\n else\n Node.with_child_fund_items_for( parent ).under_limit\n end\n end",
"def next_nodes\n transitions.map(&:target)\n end",
"def get_inflated_node_list\n Chef::Node.list(true)\n end",
"def determine_visible_tasks\n [root_task] + determine_visible_subtasks(root_task)\n end",
"def nodes\n # Find the nodes that were down but are ready to be refreshed, or those\n # with stale connection information.\n needs_refresh, available = seeds.partition do |node|\n refreshable?(node)\n end\n\n # Refresh those nodes.\n available.concat(refresh(needs_refresh))\n\n # Now return all the nodes that are available and participating in the\n # replica set.\n available.reject{ |node| node.down? }\n end",
"def molecule_nodes\n @molecule_nodes ||= collection(GraphConfig.molecules.node_class)\n end",
"def find_nodes(target_types, ignoring = [])\n result = []\n look_for_types(target_types, ignoring) { |exp| result << exp }\n result\n end",
"def know_neighbors\n bomb_neighbors = 0\n neighbor_coords = []\n rel_neighbor_coords = [[0, 1], [1, 1], [-1, 0], [-1, 1], [1, 0], [1, -1], [0, -1], [-1, -1]]\n rel_neighbor_coords.each do | coord |\n neighbor_coords << [@coords[0] + coord[0], @coords[1] + coord[1]]\n end\n neighbor_coords.select! {|pos| pos.all? { |coord| (0..8).cover? coord }}\n neighbor_coords\n end",
"def bfs\r\n q = Queue.new\r\n visited = Set.new\r\n\r\n q << [0, panda]\r\n visited << panda\r\n\r\n until q.empty?\r\n level, current_panda = q.shift\r\n unvisited = @members[current_panda].select { |v| !visited.include? v }\r\n unvisited.each do |v|\r\n q << [level + 1, v]\r\n visited << v\r\n end\r\n end\r\n end",
"def nodes_in_block(first_node)\n # We're going to do a depth-first search of the graph from the first\n # node, following control flow edges out, and global schedule edges in,\n # and stopping when we find a node that ends a basic block such as a\n # branch.\n\n worklist = [first_node]\n block = Set.new\n\n until worklist.empty?\n node = worklist.pop\n\n if block.add?(node)\n # We need to visit nodes that are anchored to this one.\n\n node.inputs.edges.each do |i|\n if i.input_name == :global_schedule\n worklist.push i.from\n end\n end\n\n # If this node isn't a branch, and it's either the first node or it\n # isn't a merge, visit the nodes that follow it in control flow.\n\n if node.op != :branch && (node == first_node || node.op != :merge)\n node.outputs.edges.each do |o|\n if o.control?\n if !(node.op == :start && o.to.op == :finish)\n worklist.push o.to\n end\n end\n end\n end\n end\n end\n\n block.to_a\n end",
"def find_subgraph(n)\n # variables: stack of nodes to check, list of nodes in a subgraph \n list_of_nodes = []\n nodes_to_check = [n.id]\n \n until nodes_to_check.empty?\n node = nodes_to_check.pop\n nbrs = self.find_neighbors(node)\n nodes_to_check.add_unique!(nbrs - list_of_nodes)\n list_of_nodes.push(node)\n end \n \n list_of_nodes \n end",
"def children\n possible_nodes = []\n 3.times do |x|\n 3.times do |y|\n if @board.empty?([x, y])\n new_board = @board.dup\n new_board[[x, y]] = @next_mover_mark\n new_mover_mark = (@next_mover_mark == :x ? :o : :x)\n possible_nodes << TicTacToeNode.new(new_board, new_mover_mark, [x, y])\n end\n #call on losing_node? or winning_node? to figure out if this is our move\n end\n end\n possible_nodes\n end",
"def find_all_nodes(*args)\n raise NotImplementedError\n nodes = @database.all_nodes\n # TODO: design node finder syntax\n nodes\n end",
"def nodes(plan)\n if plan['nodes'].is_a?(Regexp)\n @m_finder.match_nodes(plan['nodes'])\n elsif plan['nodes'].is_a?(Array)\n plan['nodes'].collect { |n| @m_finder.machine(n.to_sym) }\n end\n end",
"def path_finder(start_node=START_NODE, goal_node=GOAL_NODE)\n\t\n\t# INITIALIZE\n\tvalid = valid_nodes # largest set\n\treachable = [start_node] # nodes we can reach from current node\n\texplored = [] # nodes we've already considered\n\t# nodes reachable, valid, and not explored\n\topen_nodes = valid.select{|node| reachable.include?(node)}.select{|node| !explored.include?(node)} \n\t# record node path {node => previous_node}\n\tnodes_path = {start_node => nil} \n\t\n\twhile !open_nodes.empty?\n # node = choose_node(reachable)\n\t\tnode = open_nodes.sample # random node in open_nodes\n\t\t\n\t\treturn build_path(goal_node, nodes_path) if node==goal_node # STOP if reached goal! \n \n # Don't repeat ourselves.\n reachable.delete(node) # remove current node from reachable\n explored.push(node) # add node to explored\n \n # What nodes are now open from this node?\n # Adjacent, not in explored, and valid (not an obstacle and in maze)\n new_reachable = (get_adjacent_nodes(node) - explored) & valid\n\t\t# ADD new nodes to reachable\n new_reachable.each do |adj_node|\n if !reachable.include?(adj_node)\n # adjacent.previous = node # Remember how we got there.\n nodes_path[adj_node] = node # {[0,3] => [0,2]}\n reachable << adj_node\n end\n end\n \n\t\t# REFRESH OPEN NODES\n open_nodes = valid.select{|node| reachable.include?(node)}.select{|node| !explored.include?(node)} \n \n end\n \n\treturn nil # open_nodes empty - no path found\nend",
"def dfs(start_node)\n s = []\n visited = Set.new\n\n s.push(start_node)\n\n while !s.empty?\n current_node = s.shift\n next if visited.include?(current_node)\n visited.add(current_node)\n current_node.neighbors.each do |n|\n s.push(n)\n end\n puts current_node.name\n p s.map(&:name)\n p visited.map(&:name)\n end\nend",
"def _all_nodes(this_db = self.started_db)\n Enumerator.new(this_db, :_each_node)\n end",
"def test_get_node_range_no_features\n nodes = @container.get_nodes('1',12,27,0)\n assert_equal(4, nodes.length)\n assert_equal([11,15,0], [nodes[0].start, nodes[0].stop, nodes[0].count])\n assert_equal([16,20,0], [nodes[1].start, nodes[1].stop, nodes[1].count])\n assert_equal([21,25,1], [nodes[2].start, nodes[2].stop, nodes[2].count])\n assert_equal([26,28,0], [nodes[3].start, nodes[3].stop, nodes[3].count])\n end",
"def get_anodes()\n nodes = [] ; 1.upto(32){|i|nodes << \"compute-0-#{i}\"}\n run_cluster(nodes, \"uptime\").map{|e|[e[0], e[1].scan(/\\d\\.\\d\\d/)[0].to_f, e[2]]}.sort_by{|e|e[1]} \nend",
"def getNodesPerVar(target)\n data = $fullvars\n targets = Hash.new {|h,k| h[k] = Array.new}\n data.each do |node, var|\n var.each do |name,value|\n if name == target then\n targets[value].push(node)\n end\n end\n end\n return targets\nend",
"def checkNode()\n source_set = []\n neighbor_set = []\n $networks.each do |s, nb|\n source_set << s\n nb[\"neighbors\"].each do |s_, dist|\n neighbor_set << s_\n end\n end\n source_set.sort!\n source_set.uniq!\n neighbor_set.sort!\n neighbor_set.uniq!\n return source_set == neighbor_set\nend",
"def calculate\n roundtrips = []\n\n if !@exit_nodes.empty?\n closest_to_all = closest_nodes_to_all(@graph.vertices, @exit_nodes, 666)\n roundtrips << find_roundtrip(Array.new(@exit_nodes))\n roundtrips << find_roundtrip(Array.new(@exit_nodes), true)\n roundtrips << find_roundtrip(Array.new(@exit_nodes) + closest_to_all)\n roundtrips << find_roundtrip(Array.new(@exit_nodes) + closest_to_all, true)\n else\n # No exit nodes - component is probably a loop. Need to consider all nodes and try to find two furthest ones.\n roundtrips << find_roundtrip(@graph.to_undirected.furthest_pair_of_nodes(@graph.vertices))\n end\n\n @@log.debug \" roundtrips = #{roundtrips}\"\n @roundtrip = select_best_roundtrip(roundtrips)\n @@log.debug \" best_roundtrip = #{@roundtrip}\"\n end",
"def all_nodes(this_db = self.started_db)\n Enumerator.new(this_db, :each_node)\n end",
"def get_nodes\n nodes = []\n\n self.get_running_containers.each do |container|\n nodes << container.get_node\n end\n\n return nodes\n\n end",
"def find_order_bfs\n queue = []\n @num_courses.times { |v| queue.push(v) if @in_degrees[v].zero? } # 入度为0的全都放入\n\n visited = []\n until queue.empty?\n node_key = queue.shift\n\n visited.unshift(node_key) # 注意顺序\n\n @nodes[node_key]&.each do |neighbor|\n @in_degrees[neighbor] -= 1\n queue.push(neighbor) if @in_degrees[neighbor].zero?\n end\n end\n\n visited.size == @num_courses ? visited : []\n end",
"def target_layout(target_ids, nodeset=@nodes, edgeset=@edges)\n groups = {'inc_targ'=>{}, 'dec_targ'=>{}, 'targ_inc'=>{}, 'targ_dec'=>{}, 'sup_targ'=>{}, 'targ_sup'=>{}} #sup_targ = top\n\n if nodeset.length > 0\n nodeset.each do |id, node| #build our groupings\n if !node.static\n edgeset.values.each do |edge|\n # check if node is related to something in target_ids\n if (node == edge.a and target_ids.include? edge.b.id) # means that node points at target\n g = edge.rel_type & MapvisualizationsHelper::INCREASES != 0 ? 'inc_targ' : (edge.rel_type & \n MapvisualizationsHelper::SUPERSET == 0 ? 'dec_targ' : 'sup_targ') #what group we go in\n groups[g][node.id] = node\n break #stop looking for edges for this node\n elsif (node == edge.b and target_ids.include? edge.a.id) #means that target points at node\n g = edge.rel_type & MapvisualizationsHelper::INCREASES != 0 ? 'targ_inc' : (edge.rel_type & \n MapvisualizationsHelper::SUPERSET == 0 ? 'targ_dec' : 'targ_sup') #what group we go in\n groups[g][node.id] = node\n break #stop looking for edges for this node\n end\n end\n end\n end \n\n set_static_nodes\n static_wheel_nodes\n\n # put the groups into little circles in their respective corners, so they can come out fighting\n radius = 50\n circle_nodes_at_point(groups['inc_targ'], Vector[0,@height], radius)\n circle_nodes_at_point(groups['dec_targ'], Vector[0,0], radius)\n circle_nodes_at_point(groups['sup_targ'], Vector[@width/2,0], radius)\n circle_nodes_at_point(groups['targ_inc'], Vector[@width,@height], radius)\n circle_nodes_at_point(groups['targ_dec'], Vector[@width,0], radius)\n circle_nodes_at_point(groups['targ_sup'], Vector[@width/2,@height], radius)\n \n #fruchterman_reingold(100) #fast, little bit of layout for now\n kamada_kawai\n normalize_graph\n else\n @nodes = NO_ITEM_ERROR\n end\n end",
"def immediate_neighbours(point)\n\t\t\tneighbours = []\n\t\t\t@new_points.each{|p|\n\t\t\t\tnext if p.items == point.items\n\t\t\t\td = distance(point.items,p.items)\n\t\t\t\tneighbours.push(p) if d < @epsilon\n\t\t\t}\n\t\t\tneighbours\n\t\tend",
"def place_nodes\n x = 0\n y = 0\n nodes = []\n\n 64.times do\n id = [x, y]\n\n nodes << Node.new(id)\n\n if y < 7\n y += 1\n else\n x += 1\n y = 0\n end\n end\n nodes\n end",
"def find_all_moves\n stack = []\n stack << @initial_move\n until stack.empty?\n current_node = stack.shift\n calc_move(current_node)\n stack << current_node.children\n stack.flatten!\n end\n end",
"def nodes\n @nodes ||= list_of_nonterminated_instances.collect_with_index do |inst, i|\n RemoteInstance.new(inst.merge({:number => i}))\n end\n end",
"def nodes\n @nodes ||= {}\n end",
"def nodes\n @nodes ||= {}\n end",
"def allNodes!(&block)\n NodeSet.freeze\n ns = RootGroupNodeSet.instance\n return RootNodeSetPath.new(ns, nil, nil, block)\n end",
"def neighbours_off_end(node)\n # Find all arcs that include this node in the right place\n passable_nodes = []\n @arcs.get_arcs_by_node_id(node.node_id).each do |arc|\n if arc.begin_node_id == node.node_id and arc.begin_node_direction\n # The most intuitive case\n passable_nodes.push nodes[arc.end_node_id]\n elsif arc.end_node_id == node.node_id and !arc.end_node_direction\n passable_nodes.push nodes[arc.begin_node_id]\n end\n end\n return passable_nodes.uniq\n end",
"def nodes\n @from | @to\n end",
"def nodes\n nodes = @patches.map { |patch| patch.maps.map(&:nodes) }.flatten.compact.uniq\n Node::Container.new(nodes)\n end",
"def digraphs_with_roots\n graphs_with_roots = {}\n #sort_graphs = @graphs.sort {|a,b| a.size <=> b.size }\n @digraphs.each do |graph|\n best_top_nodes = graph.best_top_vertices\n best_top_node = best_top_nodes.min{ |n1,n2| graph.in_degree(n1) <=> graph.in_degree(n2) }\n graphs_with_roots[best_top_node] = graph\n end\n #@orphans.each do |ok, od|\n # graphs_with_roots[ok] = [{ok => od}]\n #end\n return graphs_with_roots\n end",
"def dfs(initial)\n nodes, seen = Set.new, Set.new\n stack = Array(initial).reverse\n\n while node = stack.pop\n if seen.include?(node)\n nodes.add(node)\n else\n seen.add(node)\n stack.push(node)\n stack.concat(Array(yield node).reverse)\n end\n end\n\n nodes\n end",
"def nodes\n @pathway.graph.keys\n end",
"def nodes\n unless @nodes\n events = state_machine.events.values\n @nodes = events.map{ |event| to_nodes(event) }.flatten\n end\n @nodes\n end",
"def neighbors_of(node)\n return nil unless nodes.include?(node)\n @structure[node] || []\n end",
"def findShortest(graph_nodes, graph_from, graph_to, ids, val)\n return -1 if ids.count(val)<=1 # no two nodes with color val\n dmin = graph_nodes\n num_edges = graph_from.length\n neighbors = {}\n 0.upto(num_edges-1) do |i|\n if neighbors[graph_from[i]]\n neighbors[graph_from[i]] << graph_to[i]\n else\n neighbors[graph_from[i]] = [graph_to[i]]\n end\n if neighbors[graph_to[i]]\n neighbors[graph_to[i]] << graph_from[i]\n else\n neighbors[graph_to[i]] = [graph_from[i]]\n end\n end\n p neighbors\n ids.each_with_index do |v,i|\n if v == val\n # zero-base index to one-base index \n source_node = i+1\n # look for others using bfs (stop looking if distance > dmin)\n queue = []\n visited = []\n backtrace = {}\n queue << source_node\n while !(queue.empty?)\n current_node = queue.shift\n visited << current_node\n if (current_node!=source_node) && (ids[current_node-1]==val)\n puts \"we are here!\"\n # how did I get here? backtrace\n hops = 0\n trace_node = current_node\n while (trace_node!=source_node)\n trace_node = backtrace[trace_node]\n hops +=1\n end\n if hops < dmin\n dmin = hops\n end\n break\n end\n neighbors[current_node].each do |xnode|\n if !(visited.include?(xnode))\n queue << xnode\n backtrace[xnode] = current_node\n end\n end\n end\n p visited\n end\n end\n if dmin == graph_nodes\n return -1\n else\n return dmin\n end\nend",
"def growing\n new_outer_nodes = []\n @outer_nodes.each do |o_n|\n new_partial_outer_nodes = set_outer_nodes(@neighbors_hash[o_n])\n new_outer_nodes << check_partial_outer_nodes(new_partial_outer_nodes, o_n)\n new_outer_nodes.flatten!\n end\n @outer_nodes = new_outer_nodes.compact\n end",
"def find_incoming_roots(remote, opts={:base => nil, :heads => nil,\n :force => false, :base => nil})\n common_nodes(remote, opts)[1]\n end",
"def grid_nodes(width=@width, height=@height, nodeset=@nodes)\n num_cols = (Math.sqrt(nodeset.length)*(width/height)).ceil\n num_rows = (nodeset.length/num_cols.to_f).ceil\n col_len = width/num_cols\n row_len = height/num_rows\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = \n Vector[(0.5 + (i%num_cols))*col_len,(0.5 + (i/num_cols))*row_len] if !nodeset[key].static}\n end",
"def find_all_nodes(*args)\n nodes = @nodes.find_all_nodes(*args)\n nodes.find_all { |n| context?(n) }\n end",
"def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end",
"def setInitialCosts(nodes, start) \n costs = {}\n # set all costs to Infinity from the start node\n nodes.each do |node|\n costs[node] = {\n cost: Float::INFINITY,\n parent: start\n }\n end\n \n # set start node cost to 0 for itself\n costs[start] = {cost: 0}\n return costs\n end",
"def bfs_search(root)\n queue = []\n\n root.marked = true\n queue.push(root)\n\n while queue.length != 0\n current = queue.shift\n visit(current)\n\n current.adjacent.each do |node|\n if !node.marked\n node.marked = true\n queue.push(node)\n end\n end\n end\nend",
"def a_star pitch, start, goal\n\t\t# The set of nodes already evaluated.\n\t\tclosedset = []\n\t\t# The set of tentative nodes to be evaluated.\n\t\topenset = []\n\t\t# Visited nodes\n\t\tfrontier = []\n\t\topenset << start\n\t\t# The map of navigated nodes.\n\t\tcame_from = { }\n\t\t# Distance from start along optimal path.\n\t\tg_score, h_score, f_score = { }, { }, { }\n\t\tg_score[start] = 0\n\t\th_score[start] = dist start, goal, :manhattan\n\t\t# Estimated total distance from start to goal through y.\n\t\tf_score[start] = h_score[start]\n\n\t\t# Main loop\n\t\twhile not openset.empty?\n\t\t\t# Fetching the node among openset with the least f_score\n\t\t\tx, _value = [], 1_000_000\n\t\t\topenset.each do |key|\n\t\t\t\tx, _value = key, f_score[key] if f_score[key] < _value\n\t\t\tend\n\n\t\t\tbreak if x == goal # We reached target point and thus finished looking for it !!\n\n\t\t\t# Moving x from openset to closedset\n\t\t\topenset.delete x\n\t\t\tclosedset << x\n\n\t\t\t(-1..1).each do |i|\n\t\t\t\t(-1..1).each do |j|\n\t\t\t\t\ty = [x[0] + i, x[1] + j]\n\t\t\t\t\tunless i == 0 and y == 0\n\t\t\t\t\t\tif pitch[y].nil? # We only want to explore neighbours\n\t\t\t\t\t\t\tnext if closedset.include? y # If already in closedset, we skip it\n\n\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\th = dist x, y, :manhattan\n\t\t\t\t\t\t\tg = g_score[x] + h\n\n\t\t\t\t\t\t\tif not openset.include? y then\n\t\t\t\t\t\t\t\treturn [] if frontier.include? y\n\t\t\t\t\t\t\t\tfrontier << y\n\t\t\t\t\t\t\t\topenset << y # Adding current neighbours to openset\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telsif g < g_score[y]\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Updating what needs to be\n\t\t\t\t\t\t\tif better then\n\t\t\t\t\t\t\t\tcame_from[y] = x\n\t\t\t\t\t\t\t\tg_score[y] = g\n\t\t\t\t\t\t\t\th_score[y] = dist y, goal, :manhattan # heuristic estimate of distance (y, coords)\n\t\t\t\t\t\t\t\tf_score[y] = g_score[y] + h_score[y]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# Finally assembling path and returning it\n\t\tpath = []\n\t\t_cur = goal\n\t\twhile _cur != start do\n\t\t\tpath << _cur\n\t\t\t_cur = came_from[_cur]\n\t\tend\n\n\t\treturn path.reverse\n\tend",
"def circle_nodes(width=@width, height=@height, nodeset=@nodes)\n center = Vector[width/2, height/2]\n radius = [width,height].min/2\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = Vector[\n center[0] + (radius * Math.sin(Math::PI/4+2*Math::PI*i/nodeset.length)), \n center[1] - (radius * Math.cos(Math::PI/4+2*Math::PI*i/nodeset.length))] if !nodeset[key].static}\n end"
] | [
"0.62472486",
"0.60868007",
"0.60609263",
"0.6042057",
"0.57117707",
"0.57117707",
"0.5709668",
"0.5686278",
"0.5682115",
"0.56498814",
"0.5639523",
"0.56213754",
"0.5605665",
"0.56020916",
"0.5588554",
"0.5572593",
"0.5543723",
"0.5513672",
"0.5493493",
"0.54800934",
"0.54679114",
"0.5458738",
"0.54427075",
"0.5433372",
"0.54274124",
"0.5419308",
"0.53870356",
"0.53730094",
"0.5366718",
"0.53643674",
"0.5360803",
"0.5359839",
"0.53537595",
"0.53530747",
"0.5344849",
"0.5339466",
"0.5317862",
"0.53140324",
"0.5305593",
"0.52899605",
"0.5279879",
"0.5275351",
"0.5274826",
"0.52674747",
"0.5263959",
"0.52599543",
"0.5259858",
"0.52499515",
"0.52213264",
"0.52016443",
"0.519251",
"0.518862",
"0.51764697",
"0.51669955",
"0.5155194",
"0.5143164",
"0.51392454",
"0.51369584",
"0.5136849",
"0.5134321",
"0.51324284",
"0.51309407",
"0.51264375",
"0.51243263",
"0.51075655",
"0.5103505",
"0.5095683",
"0.5094364",
"0.50867724",
"0.5078459",
"0.5076979",
"0.50768924",
"0.5070953",
"0.5063934",
"0.5058416",
"0.5057654",
"0.50504416",
"0.5049071",
"0.50480807",
"0.50448555",
"0.50448555",
"0.5040001",
"0.50388104",
"0.50355864",
"0.50326544",
"0.5029244",
"0.50136846",
"0.50112706",
"0.5000065",
"0.49984246",
"0.49959138",
"0.49922377",
"0.49917528",
"0.49814564",
"0.4980824",
"0.49792635",
"0.49728733",
"0.49707118",
"0.4969237",
"0.49685717"
] | 0.5382475 | 27 |
Sort a list of candidates in decreasing sequence number. | def sort_candidates(candidates)
candidates.sort_by { |candidate|
anchor = fixed_anchor(candidate)
sequence = anchor.props[:sequence]
raise unless sequence
sequence
}.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_list!(list)\n list.sort! do |a,b|\n a, b = a.sort_data, b.sort_data\n i = 0\n i += 1 while a[i] == b[i] && (a[i+1] || b[i+1])\n if a[i] && b[i]\n a[i] <=> b[i]\n else\n a[i] ? 1 : -1\n end\n end\n list\n end",
"def stable_sort_by(list); end",
"def selection_sort(list)\n (0...list.size - 1).each do |i|\n min = i\n (i + 1...list.size).each do |j|\n if list[j] < list[min]\n min = j\n end\n end\n temp = list[min]\n list[min] = list[i]\n list[i] = temp\n end\n list\n end",
"def selection_sort(list)\n (list.size - 1).times do |i|\n min = i # starting min value\n for j in i+1..list.size - 1 # searches all values to right to find min\n min = j if list[j] < list[min] # resets min\n end\n list[min], list[i] = list[i], list[min] # swaps min val with past min val, ignoring already sorted part\n end\n list\nend",
"def ordered_by_qualifications(candidates)\n ordered_candidates = candidates.sort_by { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n return (ordered_candidates).reverse\n\n # @ordered_by_qualifications = []\n\n # candidates.each do |candidate|\n # years_exp s=candidate[:years_of_experience]\n # @ordered_by_qualifications << years_exp\n # if years_exp == years_exp += 1\n # candidate[:github_points] > candidate[github_points] += 1\n # end \n \n # end\n # return @ordered_by_qualifications.sort!.reverse\n #This line returns the values 12..1 \n # return @ordered_by_qualifications.sort!.reverse\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b }\n sorted, n = false, self.length - 1\n while !sorted\n sorted = true\n (0...n).each do |i|\n if prc.call(self[i], self[i + 1]) == 1\n sorted = false\n self[i], self[i + 1] = self[i + 1], self[i]\n end\n end\n end\n self\n end",
"def selection_sort\n\n n = @data.length - 1\n\n for i in (n).downto(1) # Start from the end of the array\n\n k = i # k is the biggest element we have seen so far from the remaining unsorted data\n for j in 0..i # Traverse up to, but not including the sorted part of the array\n\n if @data[j] > @data[k]\n\n k = j # This sets the new max if we ever saw one\n end\n\n swap(@data, i, k) # Regardless if k is ever changed, you still swap (Potentially i equals k)\n end\n end\n\n puts(@data)\n end",
"def sort_votes(list)\n list.sort_by! { |option| option.vote } # Sorts the list by the vote attribute of each option\n list.reverse! # Reverses the list because it naturally sorts ascending order\nend",
"def sort_votes(list)\n list.sort_by! { |option| option.vote } # Sorts the list by the vote attribute of each option\n list.reverse! # Reverses the list because it naturally sorts ascending order\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new{ |ele1, ele2| ele1 <=> ele2 }\n\n sorted = false\n while !sorted\n sorted = true\n # check every pair in array and sort it if necessary \n (0...self.length - 1).each do |i|\n # if prc.call == 1: sort incr; prc.call == -1: sort decr \n if prc.call(self[i], self[i+1]) == 1\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false\n end\n end\n end\n\n self\n end",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a<=>b }\n sorted = false\n while !sorted\n sorted = true\n (0...self.size-1).each do |i|\n if prc.call(self[i], self[i+1]) == 1\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false\n end\n end\n end\n self\n end",
"def ordered_by_qualifications(candidates)\n candidates.sort_by {|candidate| [-candidate[:years_of_experience], -candidate[:github_points]]}\nend",
"def sort_cards_by_value_bis!()\r\n\t\taucun_echange=false\r\n\t\twhile aucun_echange==false\r\n\t\t\taucun_echange=true\r\n\t\t\tlen=@list.length-2\r\n\t\t\tfor i in 0..len\r\n\t\t\t\tif !@list[i].nil? and !@list[i+1].nil?\r\n\t\t\t\t\tif @list[i].get_value_bis<@list[i+1].get_value_bis\r\n\t\t\t\t\t\ttemp=@list[i]\r\n\t\t\t\t\t\t@list[i]=@list[i+1]\r\n\t\t\t\t\t\t@list[i+1]=temp\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\telsif @list[i].get_value_bis == @list[i+1].get_value_bis\r\n\t\t\t\t\t\t@list.delete_at(i)\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def candidates_below_default\n Array(@ranking[@default_rank+1...@ranking.length]).flatten.sort\n end",
"def selection_sort(arr)\n arr.each_with_index do |_, i|\n least = MAX_FIXNUM\n least_index = i\n (i..(arr.length - 1)).each do |j|\n next_val = arr[j]\n if next_val < least\n least = next_val\n least_index = j\n end\n end\n swap(arr, i, least_index) if least_index != i\n end\n end",
"def sort_cards_by_value!()\r\n\t\taucun_echange=false\r\n\t\twhile aucun_echange==false\r\n\t\t\taucun_echange=true\r\n\t\t\tlen=@list.length-2\r\n\t\t\tfor i in 0..len\r\n\t\t\t\tif !@list[i].nil? and !@list[i+1].nil?\r\n\t\t\t\t\tif @list[i].get_value<@list[i+1].get_value\r\n\t\t\t\t\t\ttemp=@list[i]\r\n\t\t\t\t\t\t@list[i]=@list[i+1]\r\n\t\t\t\t\t\t@list[i+1]=temp\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\telsif @list[i].get_value == @list[i+1].get_value\r\n\t\t\t\t\t\t@list.delete_at(i)\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def candidates_below(candidate_id)\n rank = rank_of_candidate(candidate_id)\n candidates_below = Array(@ranking[rank+1...@ranking.length])\n if candidates_below.include?(UNRANKED_ID)\n candidates_below = candidates_below - [UNRANKED_ID] + unranked_candidates\n end\n return candidates_below.flatten.sort\n end",
"def candidates_above_default\n Array(@ranking[0...@default_rank]).flatten.sort\n end",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b }\n sorted = false \n while !sorted \n sorted = true \n (0...self.length-1).each do |i|\n if prc.call(self[i], self[i+1]) == 1\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false \n end \n end \n end \n self \n end",
"def bubble_sort(&prc)\n prc ||= Proc.new { |i, j| i <=> j }\n \n sorted = false \n while !sorted \n sorted = true \n (0...self.length).each do |i|\n if (i + 1) < self.length && prc.call(self[i], self[i + 1]) == 1 \n self[i], self[i + 1] = self[i + 1], self[i] \n sorted = false \n end\n end\n end\n self\n end",
"def ranked_candidates\n Array(@ranking - [UNRANKED_ID]).flatten.sort\n end",
"def bubble_sort(&prc)\n prc ||= Proc.new {|a,b| a <=> b}\n sorted = false\n while ! sorted\n sorted= true\n (0...self.length-1).each do |i|\n if prc.call(self[i], self[i+1]) == 1\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false\n end\n end\n end\n self\n end",
"def bubble_sort(&prc)\n prc ||= Proc.new {|a, b| a <=> b}\n sorted = false\n while !sorted\n sorted = true\n (0...self.length - 1).each do |i|\n if prc.call(self[i], self[i + 1]) == 1\n self[i], self[i + 1] = self[i + 1], self[i]\n sorted = false\n end\n end\n end\n self\n end",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b }\n\n sorted = false\n while !sorted\n sorted = true\n (0...self.length - 1).each do |i|\n if prc.call(self[i], self[i + 1]) == 1\n self[i], self[i + 1] = self[i + 1], self[i]\n sorted = false\n end\n end\n end\n \n self\n end",
"def ordered_by_qualifications(candidates)\n sortedCandidates = candidates.sort_by! { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n return sortedCandidates.reverse! \nend",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b}\n \n sorted = false\n while !sorted\n sorted = true\n \n\n (0...self.length - 1).each do |i|\n if prc.call(self[i], self[i + 1]) == 1\n sorted = false\n self[i], self[i + 1] = self[i + 1], self[i]\n end\n end\n end\n\n self\n end",
"def candidate_events_sorted\n # TODO: rewrite using event states\n candidate_events.sort do |ce1, ce2|\n # in order for this to work due_dates should not be nil.\n # if they are move them to the top so admin can give them\n # one.\n if ce1.due_date.nil?\n if ce2.due_date.nil?\n ce1.event_key <=> ce2.event_key\n else\n -1\n end\n elsif ce2.due_date.nil?\n 1\n elsif ce1.completed_date.nil?\n # due_dates filled in.\n if ce2.completed_date.nil?\n # if neither completed then the first to come\n # due is first\n due_date = ce1.due_date <=> ce2.due_date\n if due_date.zero?\n ce1.event_key <=> ce2.event_key\n else\n due_date\n end\n else\n # non completed goes on top.\n -1\n end\n elsif ce2.completed_date.nil?\n # non completed goes on top.\n 1\n else\n # if both are completed then the first to come\n # due is on top\n due_date = ce1.due_date <=> ce2.due_date\n if due_date.zero?\n ce1.event_key <=> ce2.event_key\n else\n due_date\n end\n end\n end\n end",
"def sort\n @pokers.sort.reverse\n end",
"def natural_sort(list)\n natural_sort_by(list, &:to_s)\n end",
"def rev(list)\n list.sort! { |a, b| b <=> a }\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new {|a, b| a <=> b}\n sorted = false\n\n until sorted\n sorted = true\n i = 0\n while i < self.length - 1\n if prc.call(self[i], self[i + 1]) == 1\n self[i], self[i + 1] = self[i + 1], self[i]\n sorted = false\n end\n i += 1\n end\n end\n self\n end",
"def bubble_sort(&prc)\n sorted=false\n if prc==nil\n while !sorted\n sorted=true\n (0...self.length-1).each do |i|\n if self[i] > self[i+1]\n self[i],self[i+1]=self[i+1],self[i]\n sorted=false\n end\n end \n end\n return self\n end\n\n while !sorted\n sorted=true\n (0...self.length-1).each do |i|\n if prc.call(self[i],self[i+1])==1\n self[i],self[i+1]=self[i+1],self[i]\n sorted=false\n end\n end \n end\n return self\n\n end",
"def bubble_sort(&prc)\n prc ||= Proc.new {|a, b| a <=> b}\n\n (0...self.length).each do |index1|\n (0...self.length-1-index1).each do |index2|\n self[index2], self[index2+1] = self[index2+1], self[index2] if prc.call(self[index2], self[index2+1]) === 1\n end\n end\n self\n end",
"def bubble_sort(&prc)\n sorted = false\n\n until sorted\n sorted = true\n i = 0\n while i < self.length - 1\n if prc.nil?\n if self[i] > self[i + 1]\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false\n end\n else\n if prc.call(self[i], self[i+1]) == 1\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false\n end\n end\n i += 1\n end\n end\n self\n end",
"def ordered_by_qualifications(candidates)\n\n candidates.sort_by{ |candidate| [-candidate[:years_of_experience], -candidate[:github_points]] }\n\nend",
"def sort_by_numbers(unsorted_list, sorted_digits, options={})\n\n unsorted_map = unsorted_list.inject({}) {|map, v| map[v.number] = v; map }\n\n # First sort the list in the order of the sorted digits\n # leaving nils for empty spaces\n sorted_list = if sorted_digits.length > 1\n sorted = [nil] * sorted_digits.length\n sorted_digits.each_with_index{|n, idx|\n sorted[idx] = unsorted_map[n]\n unsorted_map[n] = :used unless options[:keep_duplicates]\n }\n \n sorted.delete_if{|x| x == :used } unless options[:keep_duplicates]\n sorted\n else\n unsorted_list.any? ? unsorted_list.dup : [nil]\n end\n sorted_list\n end",
"def bubble_sort(&prc)\n sorted = true\n if prc == nil #sort by increasing order probably numbers\n while sorted\n sorted = false\n self.each_with_index do |ele,idx|\n if (self[idx+1] !=nil) && (self[idx] > self[idx+1])\n self[idx] , self[idx+1] = self[idx+1] , self[idx]\n sorted = true\n end\n end\n end\n else\n while sorted\n sorted= false\n self.each_with_index do |ele,idx|\n if (self[idx+1] !=nil) && prc.call(self[idx],self[idx+1]) == 1\n self[idx] , self[idx+1] = self[idx+1] , self[idx]\n sorted = true\n end\n end\n end\n end\n self\n end",
"def selection_sort(random_num)\n min_num_index = 0\n for i in 0..(random_num.length - 2) do\n\n min_num_index = i\n for j in (0 + i)..(random_num.length - 2) do\n if random_num[min_num_index] >= random_num[j + 1]\n min_num_index = (j + 1)\n end\n end\n tmp_num = random_num[i]\n random_num[i] = random_num[min_num_index]\n random_num[min_num_index] = tmp_num\n end\n random_num\nend",
"def shell_sort(list)\n gap = list.size / 2\n while gap > 0 do\n for i in gap..list.size - 1 \n j = i \n while j >= gap and list[j] < list[j-gap] # if current < previous. previous = gap values to the left\n list[j], list[j-gap] = list[j-gap], list[j] # swap current and previous\n j -= gap # keep swapping current and previous until previous > current\n end\n end\n gap = gap / 2\n end\n list\nend",
"def sort(array)\n array.each_index do |i|\n (array.length - i - 1).times do |job|\n if array[cownt] > list[cownt + 1]\n array[cownt], array[cownt + 1] = array[cownt + 1], array[cownt]\n end\n end\n end\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b }\n sorted = false\n\n while !sorted\n sorted = true\n\n (0...self.length - 1).each do |i|\n a = self[i]\n b = self[i + 1]\n\n if prc.call(a, b) == 1\n self[i], self[i + 1] = b, a\n\n sorted = false\n end\n end\n end\n\n self\n end",
"def sort\n limit = array.size - 1\n (0..limit).each do |index|\n min = index\n (index..limit).each do |target|\n min = target if array[min] > array[target]\n end\n array[index], array[min] = array[min], array[index]\n end\n array\n end",
"def lsort(list)\n merge_sort(list) {|a,b| a.length <=> b.length}\nend",
"def bubble_sort!(&prc)\n prc ||= Proc.new {|x,y| x <=> y}\n sorted = false\n until sorted\n sorted = true\n i = 0\n while i < self.length - 1 #changed 2 to 1\n if prc.call(self[i], self[i+1]) > 0\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false\n end\n i += 1\n end\n end\n return self\n end",
"def sort_it(list_, n)\n # Your code goes here\nend",
"def selection_sort(arr)\n\ti = 0\n\twhile i < arr.length\n\t\tnext_num = arr[i]\n\t\tj = i\n\t\twhile j < arr.length\n\t\t\tif arr[j] < arr[i]\n\t\t\t\tarr = swap(arr, i, j)\n\t\t\tend\n\t\t\tj += 1\n\t\tend\n\t\ti += 1\n\tend\n\tarr\nend",
"def bubble_sort_descending(a)\n n = a.length\n for i in 0...n-1 do # N-1 Passes\n flag = 0\n for j in 0...n-i-1 do\n if a[j] > a[j+1]\n tmp = a[j]\n a[j] = a[j+1]\n a[j+1] = tmp\n flag = 1\n end\n end\n break if flag == 0 \n end\n return a\nend",
"def do_sorting\n char_list_length = char_list.length\n\n loop do\n swapped = false\n (char_list_length - 1).times do | i |\n if char_list[i] > char_list[i+1]\n char_list[i], char_list[i+1] = char_list[i+1], char_list[i]\n num_list[i], num_list[i+1] = num_list[i+1], num_list[i]\n\n swapped = true\n end\n end\n break if not swapped\n end\n end",
"def sort\n @sort ||= Vidibus::Words.sort_by_occurrence(list)\n end",
"def rollYourOwnSort(list)\n for i in 1..(list.length - 1)\n val = list[i]\n j = i - 1\n\n while j >= 0 && list[j] > val\n list[j + 1] = list[j]\n j -= 1\n end\n\n list[j + 1] = val\n end\nend",
"def bubble_sort(&prc)\n prc = prc || Proc.new{|a,b| a <=> b}\n sorted = false\n\n until sorted\n sorted = true\n (0...self.length-1).each do |idx|\n if prc.call(self[idx], self[idx + 1]) > 0\n self[idx], self[idx + 1] = self[idx + 1], self[idx]\n sorted = false\n end\n end\n end\n self # return the sorted array\n end",
"def bubble_sort(&prc)\n sorted = false\n until sorted\n sorted = true\n self.each_with_index do |num, indx|\n if indx+1 < self.length && prc == nil\n if num > self[indx+1] #|| prc.call(num, self[indx+1]) == 1\n self[indx], self[indx+1] = self[indx+1], self[indx]\n sorted = false\n end\n elsif indx+1 < self.length\n if prc.call(num, self[indx+1]) == 1\n self[indx], self[indx+1] = self[indx+1], self[indx]\n sorted = false\n end \n end\n\n # if indx+1 < self.length && num > self[indx+1]\n # self[indx], self[indx+1] = self[indx+1], self[indx]\n # sorted = false\n # end\n end\n end\n self\n end",
"def sort_by_free_positions(selected_applicants, call)\n more_members_than_deputies = call.member_amount > call.deputy_amount\n selected_applicants.sort_by{|m,d|\n if (not m.nil?) and (not d.nil?)\n 0\n elsif more_members_than_deputies\n m.nil? ? 1 : 2\n else\n m.nil? ? 2 : 1\n end\n }\n end",
"def sortByCountDecreasing\r\n @counts.sort_by { |k,v| v }.reverse\r\n end",
"def sort(a)\n\t\n\tfor i in 1...a.length\n\n\ttemp=a[i]\n\tj=i-1\n\tx=bsearch(a,temp,0,j)\n\n\twhile j>=x do\n\ta[j+1]=a[j]\n\tj-=1\n\tend #This is for the while loop\n\ta[j+1]=temp\n\tend\n\n\tend",
"def selection_sort(n,a)\n for i in 0..n-2\n minimum_index = i\n key = a[i]\n for j in i+1..n-1\n if a[j] < a[minimum_index]\n minimum_index = j\n end\n end\n a[i] = a[minimum_index]\n a[minimum_index] = key\n end\n for i in 0..n-1\n print a[i]\n end\n print \"\\n\"\nend",
"def sort_array_desc(array)\n array.sort do |a, b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new{|n1, n2| n1 <=> n2}\n\n (0...self.length - 1).each do |i|\n (i + 1...self.length).each do |j|\n if prc.call(self[i], self[j]) == 1\n self[i], self[j] = self[j], self[i]\n end\n end\n end\n self\n end",
"def sort_list list\n list.sort{|a,b| b[1]<=>a[1]}\nend",
"def ordered_by_qualifications(candiates)\n # Candidates with the most experience are at the top\n return candiates.sort_by { | obj | [obj[:years_of_experience], obj[:github_points]] }\n # return candiates.sort! { |a, b| b[:years_of_experience] <=> a[:years_of_experience] }\n\n # return candiates.sort_by {|:years_of_experience, :github_points|[ :github_points, :years_of_experience]}\n\n # return candiates.sort { | a, b | }\n # array.sort { |a,b| [ a[1], a[0] ] <=> [ b[1], b[0] ] }\n\n\n # For Candidates that have the same years of experience, \n #they are further sorted by their number of Github points (highest first)\nend",
"def bubble_sort!(&prc)\n sorted = false\n\n while !sorted\n sorted = true\n\n (0...self.length - 1).each do |idx1|\n num1, num2 = self[idx1], self[idx1 + 1]\n\n if prc.call(num1, num2) == 1\n self[idx1], self[idx1 + 1] = num2, num1\n sorted = false\n end\n end\n end\n\n self\n end",
"def sort_array_desc(a)\n a.sort {|b, c|c<=>b}\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new {|a,b| a <=> b}\n sorted = false\n while !sorted\n sorted = true\n self.each_with_index do |value, idx|\n if (self[idx+1] != nil) && (prc.call(self[idx], self[idx+1]) == 1)\n self[idx], self[idx+1] = self[idx+1], self[idx]\n sorted = false\n end\n end\n end\n return self\n end",
"def sort(vec)\n #must use each_index, not just each\n vec.each_index do |i|\n \t(vec.length - i - 1).times do |j|\n \tif vec[j] > vec[j + 1]\n \t\tvec[j], vec[j + 1] = vec[j+ 1], vec[j]\n\t\tend\n \tend\n end\nend",
"def bubble_sort_by(list)\n swapped = true\n while swapped != false\n swapped = false\n for i in (0...list.length-1) do\n {|x,y| x <=> y}\n #if this pair is out of order\n if (list[x] > list[y+1])\n #swap them and remember something changed\n list[x], list[y+1] = list[x+1], list[y]\n swapped = true\n end\n end\n end\n return list\n end",
"def order_by_descending_change_count(lines)\n lines.sort do | one, another |\n one_count = churn_line_to_int(one)\n another_count = churn_line_to_int(another)\n - (one_count <=> another_count)\n end\nend",
"def sorting(numbers)\n numbers.sort\nend",
"def sort_array_desc(array)\n array.sort do |x,y|\n if x == y\n 0\n elsif x < y\n 1\n elsif x > y\n -1\n end\n end\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new { |el_1, el_2| el_1 <=> el_2 }\n (0...self.length - 1).each do |idx_1|\n (idx_1 + 1...self.length).each do |idx_2|\n if prc.call(self[idx_1], self[idx_2]) == 1\n self[idx_1], self[idx_2] = self[idx_2], self[idx_1]\n end\n end\n end\n self\n end",
"def bubble_sort!(&prc)\n\n Prc ||= Proc.new { |x, y| x <=> y}\n\n sorted = false\n until sorted\n sorted = true\n\n self.each_with_index do |el, i|\n next if i + 1 == self.length\n j = i + 1\n if prc.call(self[i], self[j]) == 1\n sorted = false\n self[i], self[j] = self[j], self[i]\n end\n end\n end\n self\n end",
"def sort(sequence)\n\n made_a_swap = true\n swaps = 0\n loops = 0\n\n def swap(counter, sequnce)\n temp = sequnce[counter]\n sequnce[counter] = sequnce[counter + 1]\n sequnce[counter + 1] = temp\n end\n\n\n while made_a_swap do\n counter = 0\n made_a_swap = false\n\n while counter < sequence.length - 1 #&& !made_a_swap\n\n if sequence[counter] > sequence[counter + 1]\n made_a_swap = true\n swaps += 1\n swap(counter, sequence)\n end\n\n\n counter += 1\n end\n\n print \"#{loops} \" if loops % 1000 == 0\n loops += 1\n end\n\nend",
"def natural_sort_by(list, &block)\n list.sort_by do |element|\n # \"file-2022-10-01.txt\" => [\"file-\", 2022, \"-\", 10, \"-\", 1, \".txt\"]\n yield(element).to_s.split(/(\\d+)/).map { |str| str.match?(/\\A\\d+\\z/) ? str.to_i : str }\n end\n end",
"def sort_array_desc(integers)\n integers.sort {|a, b| b <=> a}\nend",
"def sort_array_desc(array)\n array.sort do |a,b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend",
"def selection_sort(arr)\n\t# start with the first element in the array.\n\t# starting_index will increment 1 every time the loop runs\n\tstarting_index = 0\n\t# until you get to the end of the index...\n\tuntil starting_index > (arr.length - 1)\n\t\t# smallest_index will be at the starting index\n\t\tsmallest_index = starting_index\n\t\t# the variable compare_index will be equal to the starting_index + 1\n\t\tcompare_index = starting_index + 1\n\t\t# take the length of the array from the starting index (will only include unsorted data)\n\t\tarr[starting_index..(arr.length - 2)].length.times do\n\t\t\t# if the value of compare_index is smaller than the smallest_index, the smallest_index becomes the compare index\n\t\t\tif arr[compare_index] <= arr[smallest_index]\n\t\t\t\tsmallest_index = compare_index\n\t\t\tend\n\t\t\t# compare_index will then increment in relation to the incrementaiton of the starting_index\n\t\t\tcompare_index += 1\n\t\tend\n\t\t#starting_index and smallest_index swap\n\t\tarr[starting_index], arr[smallest_index] = arr[smallest_index], arr[starting_index]\n\t\t# starting_index increments by 1\n\t\tstarting_index += 1\n\tend\nend",
"def sort_array_desc(arry)\n arry.sort do |num1, num2|\n num2 <=> num1\n end\nend",
"def selection_sort\n for i in 0..@array.size-1\n min_index = i\n for j in i+1..@array.size-1\n min_index = j if (@array[j] < @array[min_index])\n end\n swap(@array, i, min_index)\n end\n print\n end",
"def ordered_by_qualifications(candidates)\n candidates.sort_by{ |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n .reverse\n\nend",
"def sort_files(list_files = [])\n list_files.map{|j| [j, (j.match(/(\\d+)/) && $1).to_i ] }.sort{|v1,v2| v1.last <=> v2.last }.map(&:first)\n end",
"def bubble_sort(list)\n\tlast = list.size - 1\n\tlist.size.times do \n\t\tidx = 0\n\t\twhile idx < last #1 < 2\n\t\t\tif list[idx] > list[idx + 1] #2 > 1\n\t\t\t\ttemp = list[idx] #temp = 2\n\t\t\t\tlist[idx] = list[idx + 1] #list[0] = 1\n\t\t\t\tlist[idx + 1] = temp #list[1] = 2\n\t\t\tend\n\t\t\tidx += 1\n\t\tend\n\t\tlast -= 1\n\tend\n\tp list\nend",
"def ordered_by_qualifications(candidates)\n candidates.sort {|candidate1, candidate2| candidate1[:years_of_experience] == candidate2[:years_of_experience]? candidate2[:github_points] <=> candidate1[:github_points] : candidate2[:years_of_experience] <=> candidate1[:years_of_experience]}\nend",
"def ordered_by_qualifications(candidates)\n\n return @candidates.sort_by{ |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n\nend",
"def insertionsort! arr\n (1..arr.size - 1).each do |i|\n j = i\n while j > 0 && arr[j] < arr[j - 1] do\n arr[j], arr[j - 1] = arr[j - 1], arr[j]\n j -= 1\n end\n end\n arr\nend",
"def selection_sort(array=@base)\n 0.upto(array.size-1) do |index1|\n min_index = index1\n (index1+1).upto(array.size-1) do |index2|\n min_index = index2 if array[index2] < array[min_index]\n end\n array[index1], array[min_index] = array[min_index], array[index1]\n end\n array\n end",
"def solution(nums)\n nums.to_a.sort\nend",
"def ordered_by_qualifications(candidates)\n if [:years_of_experience] == [:years_of_experience]\n @candidates.sort_by { |experience| experience[:years_of_experience] }.reverse\n else\n @candidates.sort_by { |github| github[:github_points]}.reverse\n end\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a,b| a<=>b} # ||= if there are no procs given there I will create one A.K.A nill value for args given\n prc.(self)\n \n sorted = false\n while !sorted \n sorted = true\n (0...self.length - 1).each do |i| \n if prc.(self[i],self[i+1]) == 1 #giving the proc 2 values to compare\n sorted = false # change to false to make the loop run again\n self[i], self[i+1] = self[i+1], self[i] # this is swapping the elements' order\n end\n end\n end\n self\n end",
"def insertion_sort_descending(a)\n for i in 1...(a.length) do\n j=i\n while(j>0) do\n if a[j-1] > a[j]\n tmp = a[j]\n a[j] = a[j-1]\n a[j-1] = tmp\n else\n break\n end\n j=j-1 \n end\n end\n return a\nend",
"def sort_by_algo(state_list)\n state_list.sort_by(&:algie_check)\n end",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b }\n self.sort! &prc\n end",
"def bubble_sort(&prc)\n prc ||= Proc.new{|a,b| a <=> b }\n\n sorted = false\n while !sorted\n sorted = true\n\n (0...self.length - 1).each do |i|\n # debugger\n if prc.call(self[i], self[i + 1]) == 1 # REMEBER: spaceship operator returns a number! only 0 is falsey\n self[i], self[i + 1] = self[i + 1], self[i]\n sorted = false\n end\n end\n end\n\n self\n end",
"def selection_sort(arr)\n step = arr.size - 1\n \n 0.upto(step).each do |i|\n min_index = i\n (i + 1).upto(step).each do |j|\n if arr[min_index] > arr[j]\n min_index = j\n end\n end\n arr[i], arr[min_index] = arr[min_index], arr[i]\n end\n \n arr\nend",
"def sort2(num_array)\n n = num_array.length - 1\n for i in 0..n\n for j in 0..(n-i-1)\n if num_array[j] >= num_array[j+1]\n num_array[j], num_array[j+1] = num_array[j+1], num_array[j]\n end\n end\n end\n return num_array\nend",
"def selection_sort3(array)\n n = array.length\n n.times do |i|\n # assume the min number is the leftmost one, until proven otherwise\n minimum_index = i\n # checking all the digits to the right of i\n ((i + 1)..n - 1).each do |j|\n # if one of those digits is smaller than the one at i, we have a new min\n minimum_index = j if array[j] < array[minimum_index]\n end\n # once the min has been found, we swap it with the leftmost one.\n array[i], array[minimum_index] = array[minimum_index], array[i]\n p array\n end\n array\nend",
"def top_sort\n top_sort_visit([]).reverse\n end",
"def reverse!(list)\n list = list.sort! { |a, b| list.index(b) <=> list.index(a) }\nend",
"def bubble_sort(list)\n\tloop do \n\t\tswapped = false\n\t\t(list.size-1).times do |i|\t\t\t\n\t\t\tif list[i] > list[i+1]\n\t\t\t\tlist[i], list[i+1] = list[i+1], list[i]\n\t\t\t\tswapped = true\t\t\t\t\n\t\t\tend\t\t\t\n\t\tend\n\t\tbreak unless swapped\n\tend \n\tlist \nend",
"def candidates_above(candidate_id)\n rank = rank_of_candidate(candidate_id)\n candidates_above = Array(@ranking[0...rank])\n if candidates_above.include?(UNRANKED_ID)\n candidates_above = candidates_above - [UNRANKED_ID] + unranked_candidates\n end\n return candidates_above.flatten.sort\n end",
"def ordered_by_qualifications(candidates)\n begin\n sorted = candidates.sort_by { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n sorted.reverse!\n rescue\n puts \"There must be a years of experience and github points key.\"\n end\nend",
"def max_sort!(a)\n # Durchlaufe das Array von hinten (a.size - i ist dann immer das\n # aktuelle Element)\n for i in 1 .. a.size-1 do\n # Suche das größte Element zwischen Index 0 und unserem aktuellen Element\n max_pos = max_pos_until(a, a.size - i)\n \n # Tausche das größte Element an unsere aktuelle Stelle\n swap!(a, a.size - i, max_pos)\n end\nend"
] | [
"0.63810384",
"0.63610184",
"0.61656666",
"0.59829026",
"0.5834581",
"0.58151984",
"0.580408",
"0.57987636",
"0.57987636",
"0.57936",
"0.57772225",
"0.5768863",
"0.57473415",
"0.5743058",
"0.57212025",
"0.570653",
"0.5697831",
"0.56953245",
"0.5693282",
"0.56864303",
"0.5686033",
"0.5665765",
"0.5654749",
"0.564691",
"0.5642202",
"0.56301916",
"0.5630137",
"0.5621033",
"0.5608809",
"0.5608034",
"0.55982924",
"0.5576027",
"0.55742997",
"0.5570248",
"0.55678993",
"0.5563992",
"0.5560161",
"0.5535609",
"0.5528225",
"0.5520759",
"0.55199814",
"0.55151016",
"0.5514644",
"0.55084693",
"0.5506801",
"0.548895",
"0.5486457",
"0.5484254",
"0.54826",
"0.5481577",
"0.5470203",
"0.54652464",
"0.5445518",
"0.54428744",
"0.5432615",
"0.54194987",
"0.54048216",
"0.54045963",
"0.5397635",
"0.539721",
"0.53969115",
"0.5395208",
"0.5395151",
"0.5394271",
"0.53874874",
"0.5384175",
"0.5364558",
"0.53638655",
"0.5360257",
"0.5344617",
"0.5342487",
"0.53388697",
"0.5327384",
"0.53224117",
"0.53206795",
"0.5317627",
"0.53103507",
"0.53084743",
"0.5306797",
"0.53060967",
"0.53057694",
"0.53040403",
"0.5302979",
"0.5301123",
"0.53008866",
"0.52965873",
"0.5294164",
"0.52918136",
"0.5291234",
"0.5290292",
"0.5281121",
"0.5279867",
"0.52769303",
"0.52760756",
"0.5272687",
"0.5272687",
"0.5266774",
"0.5266765",
"0.5266079",
"0.5249644"
] | 0.8058321 | 0 |
Is there a controlflow path that we can follow from one node to another. | def path_from_to(a, b)
# Work with the fixed anchors of the nodes because that's where the
# control flow is fixed to.
a = fixed_anchor(a)
b = fixed_anchor(b)
# We're going to do a depth-first search starting with the first node
# and we're going to see if we can find the second node. We keep a stack
# of nodes that we need to visit, and a set of nodes that we've already
# visited so that we don't visit nodes more than once. We pop a node
# off the stack, return if it was the node we were looking for, or move
# on if we've already visited it, if not we push the outputs of the node
# to visit next.
worklist = [a]
considered = Set.new
until worklist.empty?
node = worklist.pop
return true if node == b
if considered.add?(node)
worklist.push *node.outputs.control_edges.to_nodes
end
end
# We traversed the whole graph accessible from the first node and didn't
# find the second one.
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_path_to?(node)\n @visited.include?(node)\n end",
"def has_path_to?(end_node)\n @visited.include?(end_node)\n end",
"def completed_path?\n path.size == nodes.size - 1\n end",
"def has_path_to(node)\n\t\t@visited.include?(node)\n\tend",
"def path?(p)\n p.each_cons(2){|x|\n unless edge?(x[0],x[1])\n return false\n end\n }\n return true\n end",
"def include?(node)\n @pathway.graph[node] ? true : false\n end",
"def path_exists?(edges, start, finish) \n nodes = edges[start].keys\n touchedNodes = nodes + [start]\n newNodes = nodes\n\n until newNodes.length == 0\n return true if touchedNodes.include?(finish)\n newNodes = []\n nodes.each do |node|\n newNodes += edges[node].keys - touchedNodes\n end\n touchedNodes += newNodes\n nodes = newNodes\n end\n false\n end",
"def route?(graph, node)\n graph.depth_first_search(graph.starting_vertex, node)\nend",
"def path?(from_id, to_id)\n from = find_vert(from_id)\n to = find_vert(to_id)\n visted = []\n letters = ''\n return dfs_search(from, to, visted, letters)\n end",
"def path_below_self?(old_path, new_path)\n return (new_path.index(old_path) != nil)\n end",
"def fast_forward?\n branch_merge && ancestor != remote &&\n ancestor == @local_parent &&\n @local_parent.branch != remote.branch\n end",
"def shorter_path_exist?(yx, steps, keys_to_go, visited)\n steps >= (visited[[yx, keys_to_go]] || Float::INFINITY)\n end",
"def directed?() false; end",
"def has_path_bfs?(source_id, dest_id)\n visited = Set.new\n source = get_node(source_id)\n dest = get_node(dest_id)\n\n to_visit = [source].concat(source.adjacent)\n\n to_visit.each do |node|\n unless visited.include?(node.id)\n return true if node.id == dest.id\n visited << node.id\n to_visit.concat(node.adjacent)\n end\n end\n\n return false\n end",
"def route_between?(start_node, end_node)\n queue = BasicQueue.new\n queue.enqueue(start_node)\n until queue.empty?\n node = queue.dequeue\n return true if node == end_node\n node.children.each do |child|\n # Mark the children so that we don't end up in a loop\n queue.enqueue(child) unless child.marked?\n child.marked = true\n end\n end\n false\nend",
"def path_blocked?(target)\n x_steps = target[0].to_i - @x\n y_steps = target[1].to_i - @y\n # Diagonal movements\n if x_steps != 0 && y_steps != 0\n (y_steps.abs - 1).times do |index| \n if y_steps > 0 && x_steps > 0\n current_target = \"#{@x + (index + 1)}#{@y + (index + 1)}\"\n return true if @board[current_target] != nil\n elsif y_steps < 0 && x_steps > 0\n current_target = \"#{@x + (index + 1)}#{@y - (index + 1)}\"\n return true if @board[current_target] != nil\n elsif y_steps > 0 && x_steps < 0\n current_target = \"#{@x - (index + 1)}#{@y + (index + 1)}\"\n return true if @board[current_target] != nil\n elsif y_steps < 0 && x_steps < 0\n current_target = \"#{@x - (index + 1)}#{@y - (index + 1)}\"\n return true if @board[\"#{target[0]}#{current_target}\"] != nil\n end\n end\n # Straight line movements\n else\n (y_steps.abs - 1).times do |index| \n if y_steps > 0\n current_target = @y + (index + 1)\n return true if @board[\"#{target[0]}#{current_target}\"] != nil\n elsif y_steps < 0\n current_target = @y - (index + 1)\n return true if @board[\"#{target[0]}#{current_target}\"] != nil\n end\n end\n (x_steps.abs - 1).times do |index| \n if x_steps > 0\n current_target = @x + (index + 1)\n return true if @board[\"#{current_target}#{target[1]}\"] != nil\n elsif x_steps < 0\n current_target = @x - (index + 1)\n return true if @board[\"#{current_target}#{target[1]}\"] != nil\n end\n end\n end\n false\n end",
"def adjacent_in_path?(start,destination,path)\n adjacent = start.adjacent.include?(destination)\n return adjacent unless path\n if path.index(start) && path.index(destination) && (path.index(start) - path.index(destination)).abs == 1\n adjacent\n else\n false\n end\n end",
"def directed?\n true\n end",
"def isRoute (nodeA, nodeB, visited)\n visited[nodeA.value] = true\n isRoute = false\n if nodaA.value == nodeB.value\n isRoute = true\n end\n if nodeA.nodes == nil\n isRoute = false\n else\n if !isRoute\n nodeA.nodes.each do |node|\n if node.value == nodeB.value\n isRoute = true\n break\n end\n end\n if !isRoute\n nodeA.nodes.each do |node|\n visited[node] = true\n isRoute(node, nodeB, visited) if visited[node] == false\n end\n end\n end\n end\n isRoute\nend",
"def tile_has_path?(tile, exits)\n tile.paths.each do |path|\n if path.exits.size == 2\n # Case 1: simple path from edge to edge\n return true if (path.exits - exits).empty?\n elsif exits.include?(path.exits.first)\n # Case 2: path from edge to node => follow paths out of node\n target_exit = exits.find { |x| x != path.exits.first }\n node = path.nodes.first\n node.paths.each do |node_path|\n next if node_path == path\n\n return true if node_path.exits.first == target_exit\n end\n end\n end\n false\n end",
"def check_path_open (from, to, board)\n #refine\n\n #Check if diagonal\n if (to[1]-from[1]).abs == (to[0]-from[0]).abs\n iterations_y = (to[1]-from[1])\n iterations_x = (to[0]-from[0])\n\n if (iterations_x > 0) && (iterations_y > 0)\n iterations_x.times do |x|\n if !is_spot_open([from[0]+x,from[1]+x],board)\n return false\n end\n end\n\n elsif (iterations_x > 0) && (iterations_y < 0)\n iterations_x.times do |x|\n if !is_spot_open([from[0]+x,from[1]-x],board)\n return false\n end\n end\n\n elsif (iterations_x < 0) && (iterations_y > 0)\n iterations_x.times do |x|\n if !is_spot_open([from[0]-x,from[1]+x],board)\n return false\n end\n end\n\n elsif (iterations_x < 0) && (iterations_y < 0)\n iterations_x.times do |x|\n if !is_spot_open([from[0]-x,from[1]-x],board)\n return false\n end\n end\n end\n\n return true\n\n\n\n #check if it moves vertical\n elsif ((to[0]==from[0])&&(to[1]!=from[1]))\n\n iterations = (to[1]-from[1])\n if iterations > 0\n iterations.times do |x|\n if !is_spot_open([from[0],from[1]+x],board)\n return false\n end\n end\n elsif iterations < 0\n iterations.times do |x|\n if !is_spot_open([from[0],from[1]-x],board)\n return false\n end\n end\n end\n\n return true\n\n #check if it moves horizontal\n elsif ((to[1]==from[1])&&(to[0]!=from[0]))\n iterations = (to[0]-from[0])\n if iterations > 0\n iterations.times do |x|\n if !is_spot_open([from[0]+x,from[1]],board)\n return false\n end\n end\n elsif iterations < 0\n iterations.times do |x|\n if !is_spot_open([from[0]-x,from[1]],board)\n return false\n end\n end\n end\n\n return true\n\n end\n\n end",
"def precede?(node1, node2); end",
"def precede?(node1, node2); end",
"def path?(point, direction)\n @paths[point] & direction != 0\n end",
"def reachable?(target)\n @to_vertex.equal?(target) || @to_vertex.reachable?(target)\n end",
"def in_path?\r\n self.aln_path_id.nil? ? false : true\r\n end",
"def has_route_a?(a, b)\n res = has_route_from_to?(a, b)\n reset_visited(a)\n\n if res\n return true\n end\n\n res = has_route_from_to?(b, a)\n reset_visited(b)\n res\nend",
"def current?\n @node.current_path == path\n end",
"def has_path_dfs?(source_id, dest_id)\n visited = Set.new\n source = get_node(source_id)\n dest = get_node(dest_id)\n\n recursive_dfs(source, dest, visited)\n end",
"def path?(v1,v2)\n return false if v1 < 0 or vertices <= v1\n return false if v2 < 0 or vertices <= v2\n dfs(v1) do |v,w|\n return true if w == v2\n end\n false\n end",
"def goal?(node)\n new_car = (node.cars.select {|car| car.color == 1})[0]\n return true if(new_car.x == Map_x - new_car.length + 1)\n false\n end",
"def has_sibling?(peer); false end",
"def isCyclical?(list_node)\n\tslow = list_node\n\tfast = list_node\n\n\t# Checks if the node exists and has a next node\n\twhile fast != nil && fast.next_node != nil do\n\t\tslow = slow.next_node\n\t\tfast = fast.next_node.next_node\n\t\treturn true if slow == fast\n\tend\n\treturn false\nend",
"def has_sibling?(peer)\n\t plan.has_sibling?(peer)\n\tend",
"def can_visit?(x, y)\n if !is_inbounds?(x, y) or is_visited?(x, y)\n return false\n end\n\n is_pathway?(x, y)\n end",
"def travel_nodes_confirmed?\n self.previous_travel_node.present? &&\n self.previous_travel_node.confirmed? &&\n self.current_travel_node.present? &&\n self.current_travel_node.confirmed? #&&\n # self.next_travel_node.present? &&\n # self.next_travel_node.confirmed?\n end",
"def notes_in_the_same_graph?\n if self.source_note.nil? \n return false\n end\n if self.target_note.nil? \n return false\n end\n return self.source_note.graph == self.target_note.graph\n end",
"def pass_path_check?(rover)\n temp = rover.coordinate.clone\n rover.command.each do |c|\n temp = Navigation.execute_move(c,temp)\n if not pass_boundary_check?(temp)\n if not pass_collision_check?(temp,rover)\n return false\n end\n end\n end\n true\n end",
"def can_traverse_dir?(node1, node2)\n node1, node2 = get_index_from_node(node1), get_index_from_node(node2)\n @adj_mat[node1][node2] != 0\n end",
"def can_traverse_dir?(node1, node2)\n node1, node2 = get_index_from_node(node1), get_index_from_node(node2)\n @adj_mat[node1][node2] != 0\n end",
"def connects_to_beginning?(node_id)\n (node_id == @begin_node_id and !@begin_node_direction) or\n (node_id == @end_node_id and @end_node_direction)\n end",
"def open_path?(start,finish)\n start_piece = piece_at(start)\n end_piece = piece_at(finish)\n #debugger\n return false if end_piece and end_piece.color == start_piece.color\n\n sy, sx = start\n fy, fx = finish\n #check horizontals\n if sy == fy\n minx = [sx,fx].min\n maxx = [sx,fx].max\n ((minx + 1)...maxx).each do |new_x|\n return false if !@board[sy][new_x].nil?\n end\n end\n\n #check verticals\n if sx == fx\n miny = [sy,fy].min\n maxy = [sy,fy].max\n ((miny + 1)...maxy).each do |new_y|\n return false if !@board[new_y][sx].nil?\n end\n end\n\n #check diags\n if (sx - fx).abs == (sy - fy).abs\n miny = [sy,fy].min\n maxy = [sy,fy].max\n #down right\n if ((sx < fx) == (sy < fy))\n new_x = [sx,fx].min\n ((miny+1)...maxy).each_with_index do |new_y, d|\n return false if !@board[new_y][new_x + d + 1].nil?\n end\n #down left\n else\n new_x = [sx,fx].max\n ((miny+1)...maxy).each_with_index do |new_y, d|\n return false if !@board[new_y][new_x - d - 1].nil?\n end\n end\n end\n true\n end",
"def find_path(start, target)\n node = build_path(start, target)\n path = [node]\n until node.next_node.nil? do\n node = node.next_node\n path.push(node)\n end\n path = path.reverse\n puts \"You made it in #{path.length} moves. Here is your path: \"\n path.each do |node|\n puts \"[#{node.x}], [#{node.y}]\"\n end\nend",
"def node?\n (self.forestify_right_position - self.forestify_left_position) > 1\n end",
"def walkable?(x, y)\n inside?(x, y) && node(x, y).walkable\n end",
"def directed?\n false\n end",
"def bomb_has_direct_path\n return false if !check_for_a_bomb\n direction = warrior.feel(get_bomb_direction)\n return true if direction.empty? and \n !direction.stairs? and \n !direction.wall?\n return false\n end",
"def seek_from_node(starting_node)\n puts \"seek started from node #{starting_node.inspect}...\"\n \n # -- PART I -- (starting from one node for now...) \n visited_nodes = grow_basic_path([ starting_node ])\n \n puts \"got basic path of length #{visited_nodes.length}, moving on to IIa)...\"\n \n # -- PART II a) --\n if visited_nodes.length < nodes.length\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n \n while target_nodes.length > 0\n puts \"TNL: #{target_nodes.length}\"\n visited_nodes = restructure_path(visited_nodes, target_nodes)\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n end\n end\n \n puts \"...done, moving on to IIb)...\"\n \n # -- PART II b) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes)\n end\n \n puts \"...done, moving on to IIc)...\"\n \n # -- PART II c) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes.reverse)\n end\n \n # -- PART III --\n results = {}\n \n if visited_nodes.length < nodes.length \n results[:path] = visited_nodes\n else\n results[:tour] = visited_nodes\n \n cycle_starts = connected_to(visited_nodes.first).map do |node|\n visited_nodes[visited_nodes.index(node) - 1]\n end\n cycle_ends = connected_to(visited_nodes.last)\n \n (cycle_starts & cycle_ends).each do |node|\n index = visited_nodes.index(node)\n \n circuit = visited_nodes[0..index] + [ visited_nodes.last ]\n circuit += visited_nodes[(index + 1 - visited_nodes.length)..-2].reverse\n \n results[:cycles] ||= []\n results[:cycles] << circuit\n end\n end\n \n results\n end",
"def has_infinite_loop?(path = [])\n\t\t\tself.survey.node_maps.select { |i| i.parent == self && !i.marked_for_destruction? }.each { |i|\n\t\t\t\t# Detect infinite loop\n\t\t\t\tif path.include?(self.node) || i.has_infinite_loop?(path.clone.push(self.node))\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\t}\n\t\t\tpath.include?(self.node)\n\t\tend",
"def find_path_dfs(target)\n unless (0 <= target[0] && target[0] <= 7) && \n (0 <= target[1] && target[1] <= 7) \n raise \"INVALID POS\"\n end\n result = @root_node.dfs(target)\n # p result.value\n trace_path_back(result)\n end",
"def directed_only?\n true\n end",
"def has_path?(v)\n @visited[v]\n end",
"def hasChild?\n @path.size > 1\n end",
"def has_branches\n branch_found = false\n waypoints[1..-1].each do |waypoint|\n branch_found |= waypoint.parent_index != waypoint.local_index-1\n end\n branch_found\n end",
"def path_blocked_by_player?(next_x,next_y)\n return collision_character?($game_player)\n end",
"def can_walk_to?(transition); end",
"def oneway?\n !@graph.links.has_key?([@dest, @src])\n end",
"def has_sibling?(peer)\n false\n end",
"def path_blocked_by_event?(next_x,next_y)\n px, py = next_x * 4, next_y * 4\n return collision?(px, py)\n end",
"def from_place_to_transition?\n net.places.any? {|p| p.id == source_id} and net.transitions.any? {|t| t.id == target_id}\n end",
"def can_path_through x,y\n @map[x][y] != :wall\n rescue\n false\n end",
"def knight_path(from, to)\r\n\topen_queue = [PositionPath.new( from, [copy(from)] )]\r\n\tputs open_queue.inspect\r\n\tputs open_queue.empty?\r\n\tdiscovered = [from]\r\n\r\n\tuntil open_queue.empty?\r\n\t\tcurrent = open_queue.shift\r\n\t\tputs current.inspect\r\n\r\n\t\treturn current.path if current.position == to\r\n\t\tvalid_moves(current.position).each do |move|\r\n\t\t\tputs \"ruch #{move} jest ok\"\r\n\t\t\tunless discovered.include?(move)\r\n\t\t\t\tputs \"tego ruchu jeszce nie bylo = #{move}\"\r\n\t\t\t\tdiscovered << move\r\n\t\t\t\topen_queue.push(make_position_path(current, move)) \r\n\t\t\t\tputs \"open_queue = #{open_queue.size}\"\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\t\r\nend",
"def connects_beginning_to_beginning?(first_node_id, second_node_id)\n (first_node_id == @begin_node_id and second_node_id == @end_node_id and\n @begin_node_direction == false and @end_node_direction == true) or\n (first_node_id == @end_node_id and second_node_id = @begin_node_id and\n @begin_node_direction == false and @end_node_direction == true)\n end",
"def accessible?(origin, destination, graph, exclude = [])\n\n paths = graph[origin] - exclude\n exclude << origin\n\n if graph[origin].include?(destination)\n true\n elsif paths.empty?\n false\n else\n paths.each do |e|\n return true if accessible?(e, destination, graph, exclude)\n end\n false\n end\n\nend",
"def is_pathway?(x, y)\n @maze[x][y] == '_' or is_exit?(Cell.new(x, y, []))\n end",
"def has_cycle\n @nodes.each do |node, dest_nodes|\n marked = [node] #visited nodes are marked\n cycle_found = cycle_dfs(marked, dest_nodes)\n\n if cycle_found\n return true #quit immediately if cycle found\n end\n #clear for next pass\n marked = []\n end\n\n return false #no cycles found if we reach this point\n end",
"def from_transition_to_place?\n net.transitions.any? {|t| t.id == source_id} and net.places.any? {|p| p.id == target_id}\n end",
"def path(start, goals, mode=:move_to, ignore={})\n start = start.map(&:to_i)\n goals = goals.flatten.size == 3 ? [goals.flatten] : goals\n\n if goals.reject { |goal| (start[0] - goal[0]).abs + (start[1] - goal[1]).abs + (start[2] - goal[2]).abs > MAX_PATH_SIZE }.empty?\n puts \"target too far away\"\n return nil\n elsif mode == :move_to && goals.select { |g| allowed?(*g) }.empty?\n puts \"can't go there...\"\n return nil\n # elsif mode == :next_to && goals.map { |g| available(*g, :next_to).any? { |l| allowed?(*l) } }.empty?\n # puts \"nothing to move next to anymore...\"\n # return nil\n end\n visited = {}\n next_to = {}\n examined = 0\n\n heap = Heap.new { |a, b| a.cost <=> b.cost }\n heap.add Path.new(start, goals, [])\n\n while !heap.empty?\n point = heap.next\n\n if point.path.size > MAX_PATH_SIZE\n puts \"examined #{examined} paths before giving up\"\n return nil\n end\n\n next if visited[point.point]\n visited[point.point] = point\n\n examined += 1\n\n case mode\n when :move_to\n if goals.include?(point.point)\n final_path = point.path + [point.point]\n final_path.shift # don't need the start point, we're already there\n # puts \"examined #{examined} paths\"\n return final_path\n end\n\n when :away_from\n above = point.point.dup\n above[1] += 1\n if !goals.include?(point.point) && !goals.include?(above)\n final_path = point.path + [point.point]\n return final_path\n end\n\n when :next_to\n next_to[point.point] ||= available(*point.point, :build)\n available_for_building = next_to[point.point]\n if available_for_building.any? { |a| goals.include? a }\n final_path = point.path + [point.point]\n final_path.shift # don't need the start point, we're already there\n # puts \"examined #{examined} paths\"\n return final_path\n end\n\n else\n raise \"unknown pathfinding mode: #{mode.inspect}\"\n end\n\n next_available = available(*point.point, :move, ignore).each do |test|\n next if visited[test]\n heap.add Path.new(test, goals, point.path + [point.point])\n end\n end\n nil\n end",
"def calculate_path(from, to)\n if @color == :white && !@moved\n case to\n when [7,1]\n return horizontal_move(from, [8,1])\n when [3,1]\n return horizontal_move(from, [1,1])\n end\n elsif @color == :black && !@moved\n case to\n when [7,8]\n return horizontal_move(from, [8,8])\n when [3,8]\n return horizontal_move(from, [1,8])\n end\n end\n\n if ((from[0] - to[0]).abs > 1) || ((from[1] - to[1]).abs > 1)\n false\n else\n []\n end\n end",
"def next_step_to_shortest_path(from_x, from_y, to_x, to_y)\n move = shortest_path(from_x, from_y, to_x, to_y)&.first\n return nil unless move\n if move[0] == from_x && move[1] == from_y + 1\n return 'S'\n elsif move[0] == from_x && move[1] == from_y - 1\n return 'N'\n elsif move[0] == from_x + 1 && move[1] == from_y\n return 'E'\n elsif move[0] == from_x - 1 && move[1] == from_y\n return 'W'\n end\n raise 'This should not happen'\n end",
"def find(start,last)\n next_nodes = Array.new\n next_nodes << start\n visited = {}\n while (not next_nodes.empty?)\n next_node = next_nodes.shift\n next if visited[next_node]\n visited[next_node] = true\n return true if next_node == last\n @paths[next_node].map do |x| next_nodes << x end\n end\n return false\n end",
"def convertable?(node)\n while(node = node.parent) do\n return false if SKIP.include?(node.name)\n end\n true\n end",
"def relative?\n\t\tpath[0] == 47\n\tend",
"def find_path(end_pos)\n node = root_node.dfs(end_pos)\n\n self.trace_path_back(node)\n end",
"def circular_reference?(path)\n path.include?(\"#{escaped_pointer}/\")\n end",
"def backedge_target?(source)\n return false unless loopheader?\n # if the loopnest of the source is smaller than ours, it is certainly not in the same loop\n return false unless source.loopnest >= loopnest\n # if the source is in the same loop, our loops are a suffix of theirs\n # as loop nests form a tree, the suffices are equal if there first element is\n source_loop_index = source.loopnest - loopnest\n source.loops[source_loop_index] == self.loop\n end",
"def shortest_path(from_x, from_y, to_x, to_y)\n @visited = Array.new(@matrix.size) { Array.new(@matrix.first.size) { false } }\n @farthest_node = nil\n queue = Queue.new\n queue << Node.new(from_x, from_y, 0)\n\n while !queue.empty? do\n node = queue.pop\n\n if !@farthest_node || node.dist > @farthest_node.dist\n @farthest_node =node\n end\n\n if node.x == to_x && node.y == to_y\n # We pathed to the target\n target_node = node\n break\n end\n [[-1,0],[1,0],[0,1],[0,-1]].each do |dir|\n x = node.x + dir[0]\n y = node.y + dir[1]\n if is_valid?(x, y)\n @visited[y][x] = true\n queue.push(Node.new(x, y, node.dist + 1, node))\n end\n end\n end\n\n # We didn't find a path to the target\n return nil unless target_node\n\n # Trace back the journey\n journey = []\n journey.push [node.x,node.y]\n while !node.parent.nil? do\n node = node.parent\n journey.push [node.x,node.y]\n end\n journey.reverse.drop(1)\n end",
"def in_path?(path); end",
"def is_target?\n not is_source? and @next.nil? and @chain.size > 1\n end",
"def which_neighbor_fabs_exist?\n [!self.previous_fab.nil?, !self.next_fab.nil?]\n end",
"def directed?\n @undirected ? false : true\n end",
"def dfs(tree, target)\n\n node_stack = [ ]\n\n #push root\n node_stack.push(tree[0])\n\n # can also set current_node and do `while current_node`\n while node_stack.length > 0\n\n # pop first\n node = node_stack.pop\n\n # then do or look for something, generally w conditional\n if node == target\n return true\n else\n # seems multiple ways to do, but doing right before left\n # makes sense to me, even though most do left before right.\n # With my way, the left is pop'd first and you go down left\n # side first\n\n #### BELOW IS NOT RIGHT -- THERE HAS TO BE SOME RECURSSION HERE\n # This actually is starting to make sense: https://github.com/brianstorti/ruby-graph-algorithms/blob/master/depth_first_search/depth_first_search.rb\n #http://haozeng.github.io/blog/2014/01/05/trees-in-ruby/\n #https://github.com/breadoliveoilsalt/depth-first-search-lab-v-000/blob/solution/index.js\n if node.left\n node_stack.push(node.left)\n end\n if node.right\n node_stack.push(node.right)\n end\n end\n end\n\n return false\n\nend",
"def knight_path(from, to)\n\topen_queue = [PositionPath.new( from, [copy(from)] )]\n\tdiscovered = [from]\n\n\tuntil open_queue.empty?\n\t\tcurrent = open_queue.shift\n\n\t\treturn current.path if current.position == to\n\t\tvalid_moves(current.position).each do |move|\n\t\t\tunless discovered.include?(move)\n\t\t\t\tdiscovered << move\n\t\t\t\topen_queue.push(make_position_path(current, move)) \n\t\t\tend\n\t\tend\n\tend\n\t\nend",
"def has_path?(path)\n !node_for(path).nil?\n end",
"def hit_neighbour_in_same_axis? dir\n relative_cell_at(dir).hit?\n end",
"def find_path(char)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # use request\n request = @request[char]\n # if no nodes to test\n if request.open.size == 0\n # abort testing for this character\n @request.delete(char)\n # resets state\n char.ai.state = (char.ai.state == Invalid ? Return : Ready)\n # stop execution\n return []\n end\n # found\n found = false\n # find minimal key\n key = request.open.keys.min {|a, b|\n Math.hypot(a[0] - request.tx, a[1] - request.ty) <=>\n Math.hypot(b[0] - request.tx, b[1] - request.ty)}\n # this node is now logged as checked\n request.closed[key[0], key[1]] = request.open[key]\n # remove this node from the pending array\n request.open.delete(key)\n # iterate through all possible directions with relative offsets\n Cache::PathDirs.each {|dir|\n # coordinates of new position\n kx, ky = key[0] + dir[0], key[1] + dir[1]\n # if new coordinates are destination\n if kx == request.tx && ky == request.ty\n # the new node was checked\n request.closed[kx, ky] = dir[2]\n # path was found\n found = true\n # stop checking\n break\n # if new node not checked yet and coordinates are passable\n elsif request.closed[kx, ky] == 0 &&\n char.passable?(key[0] * pix, key[1] * pix, dir[2])\n # add new node to be checked\n request.open[[kx, ky]] = dir[2]\n end}\n # stop execution except if found path\n return nil unless found\n # backtrack the path\n result = request.backtrack\n # finish testing for this character\n @request.delete(char)\n # resets state\n char.ai.state = (char.ai.state == Invalid ? Return : Ready)\n # return movement command array\n return result\n end",
"def rec_contains_cycle(slow, fast_parent)\n return false if !slow or !fast_parent \n if (slow == fast_parent.left or slow == fast_parent.right)\n return is_ancestor(slow, fast_parent) \n return true\n end\n if fast_parent.left\n if (rec_contains_cycle(slow.left, fast_parent.left.left) or \n rec_contains_cycle(slow.left, fast_parent.left.right) or\n rec_contains_cycle(slow.right, fast_parent.left.left) or \n rec_contains_cycle(slow.right, fast_parent.left.right)) then\n return true\n end\n end\n if fast_parent.right\n if (rec_contains_cycle(slow.left, fast_parent.right.left) or \n rec_contains_cycle(slow.left, fast_parent.right.right) or\n rec_contains_cycle(slow.right, fast_parent.right.left) or \n rec_contains_cycle(slow.right, fast_parent.right.right)) then\n return true\n end\n end\n false \nend",
"def child_path?(root, target)\n return false if target.size < root.size\n\n target[0...root.size] == root &&\n (target.size == root.size || target[root.size] == '/')\nend",
"def traverse (from, to, points_visited_so_far = [])\n \n return points_visited_so_far if from.eql?(to)\n\n # Select those adjacent points that that has not been already traversed\n # and that do not represent walls\n possible_steps = adjacent_traversible_points(from).select { |point| \n (not points_visited_so_far.include?(point))\n }\n\n # For each possible step, take that step, and find out the list of points\n # that need to be traversed to reach \"to\" point. In case there were more\n # than one possible steps, pick the one that has smaller number of steps\n # to destination\n points_to_destination_from_here = []\n possible_steps.each do |point|\n traversal_result = traverse(point, to, points_visited_so_far + [point])\n if not traversal_result.empty?\n points_to_destination_from_here = traversal_result if \n (points_to_destination_from_here.empty? or\n traversal_result.size < points_to_destination_from_here.size)\n end\n end\n \n return points_to_destination_from_here\n\n end",
"def find_paths(current_node, target_node, current_path=[])\n \tcurrent_path.push(current_node)\n \tif current_node == target_node\n \t\t@found_paths.push(current_path.dup)\n \telse\n \t\t@adjacency_list[current_node].each do |child|\n \t\t\tfind_paths(child, target_node, current_path)\n \t\tend\n \tend\n \tcurrent_path.pop\n end",
"def preceding_comment?(node1, node2); end",
"def include?(proof)\n root = acc[proof.siblings.length]\n n = proof.payload\n proof.siblings.each_with_index do |sibling, height|\n if ((1<<height) & proof.position) == 0\n n = Utreexo.parent(n, sibling)\n else\n n = Utreexo.parent(sibling, n)\n end\n end\n n == root\n end",
"def dfs_rec(target, node = @root)\n return \"Found target: #{target} at node #{node}\" if node.value == target # base case\n\n left_check = dfs_rec(target, node.left) if node.left\n right_check = dfs_rec(target, node.right) if node.right\n\n return left_check if left_check\n return right_check if right_check\n end",
"def connects_beginning_to_end?(first_node_id, second_node_id)\n (first_node_id == @begin_node_id and second_node_id == @end_node_id and\n @begin_node_direction == false and @end_node_direction == false) or\n (first_node_id == @end_node_id and second_node_id = @begin_node_id and\n @begin_node_direction == true and @end_node_direction == true)\n end",
"def following?\n Kippt::FollowRelationship.new(client, self).following?\n end",
"def sibling_of?(node)\n self.read_attribute(self.ancestry_base_class.ancestry_column) == node.read_attribute(self.ancestry_base_class.ancestry_column)\n end",
"def contains_cycle?(first_node)\n slow_runner = first_node\n fast_runner = first_node\n\n while fast_runner && fast_runner.next\n slow_runner = slow_runner.next\n fast_runner = fast_runner.next.next\n\n return true if slow_runner == fast_runner\n end\n\n false\nend",
"def clear_path? start_square, end_square\n if horizontal?(start_square, end_square)\n clear_path_horizontal?(start_square, end_square)\n elsif vertical?(start_square, end_square)\n clear_path_vertical?(start_square, end_square)\n else\n map = board_scan(start_square)\n next_square = map[end_square.name][:predecessor]\n until next_square == start_square\n if next_square.piece != nil\n return false\n else\n next_square = map[next_square.name][:predecessor]\n end\n end\n true\n end\n\n end",
"def touches_path? cell, path, parent\n cell_touch = cells_around(cell, :include_self => true) - [parent]\n (cell_touch - path) == cell_touch ? false : true\n end",
"def reply?\n return !depth.zero?\n end"
] | [
"0.6935976",
"0.6874116",
"0.6861251",
"0.68266964",
"0.6503092",
"0.64903134",
"0.6484965",
"0.6484778",
"0.6423619",
"0.6417184",
"0.6413125",
"0.6314484",
"0.6259633",
"0.62373054",
"0.6230786",
"0.622532",
"0.61801267",
"0.6174962",
"0.6143622",
"0.6028556",
"0.60270894",
"0.5999787",
"0.5999787",
"0.5983843",
"0.5983117",
"0.5975731",
"0.59717155",
"0.59714735",
"0.59628445",
"0.594627",
"0.59216785",
"0.59210205",
"0.5919943",
"0.59018326",
"0.5901722",
"0.5900221",
"0.5874498",
"0.58590156",
"0.5853482",
"0.5853482",
"0.58472157",
"0.583637",
"0.58307517",
"0.58291703",
"0.5820006",
"0.5817104",
"0.5809253",
"0.5785353",
"0.577552",
"0.5774401",
"0.57721096",
"0.5767362",
"0.5767334",
"0.57603633",
"0.57594556",
"0.5753269",
"0.57391787",
"0.5729805",
"0.572484",
"0.57237035",
"0.5718155",
"0.5706558",
"0.56979907",
"0.5683702",
"0.5683167",
"0.5681625",
"0.56781423",
"0.5672578",
"0.56689036",
"0.5646566",
"0.5646089",
"0.564369",
"0.56408316",
"0.5640258",
"0.56383824",
"0.56378025",
"0.5632584",
"0.5627517",
"0.5625294",
"0.5624934",
"0.5619866",
"0.56154895",
"0.5611872",
"0.56070286",
"0.5606164",
"0.5605123",
"0.5598233",
"0.55907226",
"0.55886525",
"0.55803466",
"0.55704975",
"0.55679023",
"0.55655825",
"0.5564891",
"0.55536526",
"0.55483073",
"0.5547293",
"0.5547037",
"0.5546578",
"0.55426735"
] | 0.66143453 | 4 |
Give the node that a node is attached to in the global schedule. | def fixed_anchor(node)
raise unless globally_scheduled?(node)
if node.fixed?
# A fixed node is anchored to itself.
node
else
# Otherwise we anchored using an output to another node.
anchor = node.outputs.with_output_name(:global_schedule).to_nodes.first
raise unless anchor
fixed_anchor(anchor)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node\n publish[:node]\n end",
"def node=(node)\n publish[:node] = node\n end",
"def local_node\n @local_node ||= DPN::Workers.nodes.node(to_node)\n end",
"def set_pm_node\n @pm_node = Pm::Node.find(params[:id])\n end",
"def get_node(node)\n\t\t\t@nodes[node]\n\t\tend",
"def node=(node)\n @node = node\n end",
"def node\n @node ||= Socket.gethostname\n end",
"def admin_node\n @admin_node ||= DPN::Workers.nodes.node(from_node)\n end",
"def Node(node_id)\n return group(\"node#{node_id}\")\n end",
"def node=(node)\n items_node[:node] = node\n end",
"def node=(node)\n retract[:node] = node\n end",
"def node=(node)\n subscription_node[:node] = node\n end",
"def node=(val)\n attributes['node'] = val\n end",
"def node=(val)\n attributes['node'] = val\n end",
"def node=(node)\n purge_node[:node] = node\n end",
"def assign_node(char)\n assigned = false\n @worker_obj.each do |k, node|\n break if assigned\n unless node\n @worker_obj[k] = [char, NUM_TO_INT_MAP[char] + ADDITIONAL_SECONDS]\n @nodes_being_worked_on << char\n assigned = true\n end\n end\n end",
"def add_global_child(node)\n node.build\n global_nodes << node\n end",
"def global_schedule(graph)\n # Create a work list of the floating nodes.\n\n to_schedule = graph.all_nodes.select {|n| n.floating? && n.op != :immediate }\n\n # Keep going until the work list is empty.\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # Are we ready to schedule this node?\n\n if ready_to_schedule?(node)\n # Find candidates to anchor this node to.\n\n candidates = schedule_candidates(graph, node)\n\n # If there aren't any then we're stuck!\n\n raise 'stuck' if candidates.empty?\n\n # Sort the candidates and take the first one to get the best.\n\n best_candidate = sort_candidates(candidates).first\n\n # Add a global schedule edge.\n\n node.output_to :global_schedule, best_candidate\n else\n # If we aren't ready to schedule this node, try it again later.\n\n to_schedule.push node\n end\n end\n end",
"def node\n retract[:node]\n end",
"def start_iasgn(node)\n remember_new_variable(node)\n end",
"def node\n @node\n end",
"def node\n @node\n end",
"def node\n scope.node\n end",
"def node\n run_context.node\n end",
"def node\n run_context.node\n end",
"def ready_to_schedule?(node)\n # Ready to globally schedule\n\n node.outputs.to_nodes.all? do |i|\n globally_scheduled?(i)\n end\n end",
"def node=(node)\n unsubscribe[:node] = node\n end",
"def node(name)\n nodes[name]\n end",
"def set_node\n @node = ::Node::Node.find(params[:id])\n end",
"def node\n run_context.node\n end",
"def master_node\n {:nodename => @master_nodename}\n end",
"def init_without_node\n @internal_node = Neo4j.instance.create_node\n self.classname = self.class.to_s\n Neo4j.instance.ref_node.connect(self) \n\n self.class.fire_event NodeCreatedEvent.new(self) \n $NEO_LOGGER.debug {\"created new node '#{self.class.to_s}' node id: #{@internal_node.getId()}\"} \n end",
"def nodes_like_me\n nodes[:environment => @node.environment]\n end",
"def add_node(node)\n @nodes[node.uri] ||= node\n end",
"def node(name)\n return node_manager.find(name)\n end",
"def set_node\n @node = @current_user.nodes.find_by(short_id: params[:id])\n end",
"def node\n purge_node[:node]\n end",
"def add_node(node)\n #$DEBUG.puts \"Registering #{SNMPPass.num2oid(node.oid)} with #{node}\"\n @fields[node.oid]=node\n end",
"def register_node\n @registered = @registry.register_node(system)\n end",
"def node=(_); end",
"def node=(_); end",
"def node\n attributes['node']\n end",
"def node\n attributes['node']\n end",
"def node=(node)\n query[:node] = node\n end",
"def node=(node)\n query[:node] = node\n end",
"def node\n return @node if @node\n\n @node = client.build_node\n @node.instance_variable_set(:@runner, self)\n @node.class.send(:attr_reader, :runner)\n @node\n end",
"def set_node\n @node = Node.find(params[:id])\n end",
"def set_node\n @node = Node.find(params[:id])\n end",
"def set_node\n @node = Node.find(params[:id])\n end",
"def node\n unsubscribe[:node]\n end",
"def local_node\n node local_namespace\n end",
"def node_type\n \"TeamNode\"\n end",
"def pacemaker_node_name(n)\n if n[:pacemaker][:is_remote]\n \"remote-#{n[:hostname]}\"\n else\n n[:hostname]\n end\nend",
"def set_node\r\n @node = Node.find(params[:id])\r\n end",
"def node\n subscription_node[:node]\n end",
"def node(node)\n true\n end",
"def node_entry\n \"node #{name}\"\n end",
"def node\n return @node\n end",
"def add_node(node)\n @nodes[node.id.to_i] = node\n node.db = self\n end",
"def node\n @node ||= args.dig(:node)\n end",
"def generate_assignment (node)\n\n\tputs \"Generating a nice assignment...\"\n\n\n\t# right side\n\tgenerate(node.children[1])\n\n\tsta($static_table.get(node.children[0].symbol).address)\n\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 set_power_grid_node\n @power_grid_node = PowerGridNode.find(params[:id])\n end",
"def host\n nodes[0][0]\n end",
"def set_node_name!(n)\n n[:name] ||= \"#{n[:host]}:#{n[:port]}\"\n n\n end",
"def node\n @context.node\n end",
"def set_node\n @node = Node.find(params[:id])\n end",
"def set_manage_node\n @manage_node = Manage::Node.find(params[:id])\n end",
"def node(x, y)\n @nodes[y][x]\n end",
"def node\n items_node[:node]\n end",
"def node\n returning \"#{@name}_node\" do |nodename|\n @canvas << \"var #{nodename} = #{@name}.node;\"\n end\n end",
"def neo_node_id\n @internal_node.getId()\n end",
"def setup_node(&blk)\n\t\t\t\tnode_setup_blocks << blk\n\t\t\tend",
"def node\n @node ||= ArkEcosystem::Client::API::Node.new(@client)\n end",
"def threadlocal_ref_node=(reference_node)\n Thread.current[:local_ref_node] = reference_node.nil? ? nil : reference_node._java_node\n end",
"def threadlocal_ref_node=(reference_node)\n Thread.current[:local_ref_node] = reference_node.nil? ? nil : reference_node._java_node\n end",
"def node=(_arg0); end",
"def node(reload=false)\n\n nid = @values[:nid]; return nil unless nid\n exe = execution(reload); return nil unless exe\n\n nodes = exe.data['nodes']; return nil unless nodes\n nodes[nid]\n end",
"def node_id()\n @node_id ||= Config.slanger_id || SecureRandom.uuid\n end",
"def node_id\n jid.resource\n end",
"def add_node(node)\n nodes[node.value] = node\n end",
"def globally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:global_schedule)\n end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end"
] | [
"0.6418489",
"0.6389499",
"0.6234405",
"0.60527945",
"0.6022411",
"0.5969809",
"0.5917216",
"0.58878255",
"0.5863086",
"0.5842805",
"0.583392",
"0.5805671",
"0.57895976",
"0.57895976",
"0.57631314",
"0.5758204",
"0.5728833",
"0.57215697",
"0.57195073",
"0.569772",
"0.56909937",
"0.56909937",
"0.5660508",
"0.565251",
"0.565251",
"0.56087315",
"0.56007427",
"0.5591794",
"0.55891955",
"0.55864346",
"0.55852777",
"0.55788696",
"0.5575436",
"0.5557334",
"0.55538195",
"0.5552418",
"0.55384547",
"0.55379736",
"0.55284804",
"0.5523405",
"0.5523405",
"0.55230665",
"0.55230665",
"0.5515418",
"0.5515418",
"0.550697",
"0.5490819",
"0.5490819",
"0.5490819",
"0.5471663",
"0.5470439",
"0.54225254",
"0.54195344",
"0.5418618",
"0.54018337",
"0.53970516",
"0.5375515",
"0.53636557",
"0.53444356",
"0.5341681",
"0.53396565",
"0.53345096",
"0.53341216",
"0.532407",
"0.53226364",
"0.53156465",
"0.5311579",
"0.5308658",
"0.5306067",
"0.5300192",
"0.5297787",
"0.5293379",
"0.52887225",
"0.5262328",
"0.5257611",
"0.5257611",
"0.5254587",
"0.5252702",
"0.5250199",
"0.5249969",
"0.523823",
"0.5230778",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739",
"0.5223739"
] | 0.57828677 | 14 |
Locally schedule a graph, which means within each basic block decide a single order to run the nodes, which no ambiguity left. | def local_schedule(graph)
# Find all basic blocks and locally schedule them.
graph.all_nodes.each do |node|
if node.begins_block?
locally_schedule_block node
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def global_schedule(graph)\n # Create a work list of the floating nodes.\n\n to_schedule = graph.all_nodes.select {|n| n.floating? && n.op != :immediate }\n\n # Keep going until the work list is empty.\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # Are we ready to schedule this node?\n\n if ready_to_schedule?(node)\n # Find candidates to anchor this node to.\n\n candidates = schedule_candidates(graph, node)\n\n # If there aren't any then we're stuck!\n\n raise 'stuck' if candidates.empty?\n\n # Sort the candidates and take the first one to get the best.\n\n best_candidate = sort_candidates(candidates).first\n\n # Add a global schedule edge.\n\n node.output_to :global_schedule, best_candidate\n else\n # If we aren't ready to schedule this node, try it again later.\n\n to_schedule.push node\n end\n end\n end",
"def locally_schedule_block(first_node)\n # Find all the nodes in this basic block.\n\n in_block = Set.new(nodes_in_block(first_node))\n\n # Back up a second... our first node could be a fixed node, which\n # actually has input values. Such as a branch with a condition.\n # The nodes involved in that condition actually need to come first.\n\n first_node = first_in_block(first_node, in_block)\n\n # Create a work list of nodes to schedule and a set of nodes\n # already scheduled.\n\n to_schedule = in_block.to_a\n scheduled = Set.new\n\n # The first node in the basic block is already scheduled first.\n\n to_schedule.delete first_node\n scheduled.add first_node\n\n # The tail is the last node we scheduled.\n\n tail = first_node\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # We are ready to locally schedule if all inputs that are in this\n # block have themselves already been scheduled.\n\n if node.inputs.from_nodes.all? { |i| !in_block.include?(i) || scheduled.include?(i) }\n # Add a local schedule edge from the previous last node to this one,\n # which then becomes the last node.\n raise if tail.inputs.from_nodes.include? node\n tail.output_to :local_schedule, node\n tail = node\n scheduled.add node\n else\n to_schedule.push node\n end\n end\n end",
"def nodes_in_block(first_node)\n # We're going to do a depth-first search of the graph from the first\n # node, following control flow edges out, and global schedule edges in,\n # and stopping when we find a node that ends a basic block such as a\n # branch.\n\n worklist = [first_node]\n block = Set.new\n\n until worklist.empty?\n node = worklist.pop\n\n if block.add?(node)\n # We need to visit nodes that are anchored to this one.\n\n node.inputs.edges.each do |i|\n if i.input_name == :global_schedule\n worklist.push i.from\n end\n end\n\n # If this node isn't a branch, and it's either the first node or it\n # isn't a merge, visit the nodes that follow it in control flow.\n\n if node.op != :branch && (node == first_node || node.op != :merge)\n node.outputs.edges.each do |o|\n if o.control?\n if !(node.op == :start && o.to.op == :finish)\n worklist.push o.to\n end\n end\n end\n end\n end\n end\n\n block.to_a\n end",
"def schedule_candidates(graph, node)\n if node.outputs.size == 1\n # If a node has just one output then that's the only candidate.\n\n [node.outputs.to_nodes.first]\n else\n # Otherwise, consider all the nodes in the graph (yes this is\n # quadratic).\n\n graph.all_nodes.select do |candidate|\n # The start node is never a candidate because we're going to schedule\n # before the candidate, and we can't schedule before the start node.\n\n if ![:start, :immediate].include?(candidate.op)\n # We only consider globally scheduled nodes as candidates.\n\n if globally_scheduled?(candidate)\n # Is there a control-flow path from all the inputs of the node to this candidate?\n\n from_all_inputs = node.inputs.from_nodes.all? { |i| !globally_scheduled?(i) || path_from_to(i, candidate) }\n\n # Is there a control-flow path from this candidate to all the outputs of this node?\n\n to_all_outputs = node.outputs.to_nodes.all? { |o| !globally_scheduled?(o) || path_from_to(candidate, o) }\n\n # Both conditions need to be true for this candidate to be valid.\n\n from_all_inputs && to_all_outputs\n end\n end\n end\n end\n end",
"def setup_start_end\n cluster_tasks_set = Set.new each_task\n tasks_to_include = Set.new\n self.subgraphs.each do |subgraph|\n setup_start_end_piece(subgraph, cluster_tasks_set).each do |piece|\n tasks_to_include.add piece\n end\n end\n to_skip_tasks = cluster_tasks_set - tasks_to_include\n to_skip_tasks.each do |task|\n warn \"Skipping task #{task} due to subgraph evaluation\"\n task.skip!\n end\n end",
"def execute_best_swap graph\n gain,swap = execute_swap graph\n compute_swap\nend",
"def linearize(graph)\n # The basic blocks.\n blocks = []\n \n # Details of the basic block that contain the finish operation which\n # won't be added to the list of basic blocks until the end.\n first_node_last_block = nil\n last_block = nil\n \n # Two maps that help us map between nodes and the names of the blocks\n # that they go into, and the merge instruction indicies and the blocks\n # they're coming from.\n first_node_to_block_index = {}\n merge_index_to_first_node = {}\n\n # Look at each node that begins a basic block.\n\n basic_block_starters = graph.all_nodes.select { |n| n.begins_block? }\n\n last_basic_block_starter = basic_block_starters.select { |s| nodes_in_block(s).any? { |n| n.op == :finish } }.first\n\n basic_block_starters.delete last_basic_block_starter\n basic_block_starters.push last_basic_block_starter\n\n basic_block_starters.each do |node|\n original_first_node = node\n first_node = first_in_block(original_first_node, nodes_in_block(original_first_node))\n\n # We're going to create an array of operations for this basic\n # block.\n\n block = []\n next_to_last_control = nil\n\n # Follow the local sequence.\n\n node = first_node\n\n begin\n # We don't want to include operations that are just there to form\n # branches or anchor points in the graph such as start and merge.\n\n unless [:start, :merge].include?(node.op)\n op = node.op\n\n # We rename finish to return to match the switch from the\n # declarative style of the graph to the imperative style\n # of the list of operations.\n op = :return if op == :finish\n\n # The instruction begins with the operation.\n insn = [op]\n\n # Then any constant values or similar.\n [:line, :n, :value].each do |p|\n insn.push node.props[p] if node.props.has_key?(p)\n end\n\n # Then any input registers.\n node.inputs.with_input_name(:value).from_nodes.each do |input_values|\n insn.push input_values.props[:register]\n end\n\n # Phi instructions need pairs of source registers with the blocks they came from.\n if node.op == :phi\n node.inputs.edges.each do |input|\n if input.input_name =~ /^value\\((.+)\\)$/\n n = $1.to_i\n insn.push n\n insn.push input.from.props[:register]\n end\n end\n # Elide phi instructions if register allocation has run correctly and values are\n # already in the correct registers.\n insn = nil if insn.drop(2).select.with_index{ |_,i| i.even? }.uniq.size == 1\n end\n\n # Send instructions and lowered equivalents need the arguments.\n if [:send, :call_managed, :int64_add, :int64_sub, :int64_imul, :int64_and, :int64_shift_left, :int64_shift_right].include?(node.op)\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n if node.op == :send\n insn.push node.props[:name]\n elsif node.op == :call_managed\n insn.push node.inputs.with_input_name(:name).from_node.props[:register]\n end\n\n node.props[:argc].times do |n|\n arg = node.inputs.with_input_name(:\"arg(#{n})\").from_node\n\n if arg.op == :immediate\n insn.push arg.props[:value]\n else\n insn.push arg.props[:register]\n end\n end\n end\n\n # Then the target register if the instruction has one.\n insn.push node.props[:register] if insn && (node.produces_value? || node.op == :move)\n\n # If it's a branch then the target basic blocks and the test.\n if node.op == :branch\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n\n [:true, :false].each do |branch|\n target = node.outputs.with_output_name(branch).to_node\n raise unless target\n insn.push target\n end\n\n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Send instructions and lowered managed calls need the list of live registers.\n if [:send, :call_managed].include?(node.op)\n insn.push node.props[:live_registers]\n end\n \n # Guards are like branches, but only have one side.\n if node.op == :guard\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n \n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Kind instructions need the kind.\n if node.op == :kind_is?\n insn.push node.props[:kind]\n end\n \n # Frame states need the instructions, the ip, and to know where values are for\n # the receiver, the arguments, and the stack.\n if node.op == :deopt_map\n insn.push node.props[:insns]\n insn.push node.props[:ip]\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('arg(') }.map { |e|\n /arg\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('stack(') }.map { |e|\n /stack\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n end\n\n # Add the instruction to the block.\n block.push insn if insn\n end\n\n next_to_last_control = node if node.has_control_output?\n\n # Follow the local schedule edge to the next node.\n node = node.outputs.with_output_name(:local_schedule).to_nodes.first\n end while node && node.op != :merge\n\n # Empty blocks cause problems elsewhere - it's easier to just have a nop\n # in them. Really, we should remove empty blocks by modifying the\n # instruction that jumps here to jump to wherever this leads to.\n\n if block.empty?\n block.push [:nop]\n end\n\n # If the last node is a merge, we need to remember which merge index this is.\n\n if node && node.op == :merge\n next_to_last_control.outputs.with_output_name(:control).edges.first.input_name =~ /^control\\((.+)\\)$/\n n = $1.to_i\n merge_index_to_first_node[n] = first_node\n end\n\n # Add a jump instruction if this block was going to just flow into the next\n # - we'll remove it later if the block followed it anyway and we can just\n # fallthrough.\n\n unless [:return, :branch].include?(block.last.first)\n begin\n block.push [:jump, next_to_last_control.outputs.with_output_name(:control).to_node]\n rescue\n block.push [:jump, :broken]\n end\n end\n\n first_node_to_block_index[original_first_node] = blocks.size\n first_node_to_block_index[first_node] = blocks.size\n blocks.push block\n end\n\n # Record the number that this basic block has and then add it to the list of basic blocks.\n\n first_node_to_block_index[first_node_last_block] = blocks.size\n\n # Go back through the basic blocks and update some references that were to things that\n # hadn't been decided yet.\n\n blocks.each do |block|\n block.each do |insn|\n insn.map! do |e|\n # If part of an instruction references a basic block, turn that into the index of\n # the basic block instead.\n\n if e.is_a?(IR::Node)\n :\"block#{first_node_to_block_index[e]}\"\n else\n e\n end\n end\n end\n end\n\n # Go back through the basic blocks and change how the branch instructions out of them\n # work.\n\n blocks.each_with_index do |block, n|\n next_block = :\"block#{n + 1}\"\n last = block.last\n\n if last == [:jump, next_block]\n # A jump that just goes to the next block can be removed and left to fall through.\n block.pop\n elsif last.first == :branch && last[3] == next_block\n # A branch where the else goes to the next block can branch only when true.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n elsif last.first == :branch && last[2] == next_block\n # A branch where the if goes to the next block can branch only unless true.\n block.pop\n test = last.drop(4)\n block.push [:branch_unless, last[1], last[3], *test]\n elsif last.first == :branch\n # A branch that doesn't go to the next block at all can be a branch if true\n # and then fallthrough to a new jump instruction.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n block.push [:jump, last[3]]\n end\n end\n\n blocks\n end",
"def prioritize_rules()\n \n #\n # Process all :reorder_specs. The top row of each table form roots of the DAG.\n # We test for cycles as we go -- there can't be any. \n \n root_sets = []\n hierarchy = Util::DirectedAcyclicGraph.new( false )\n @reorder_specs.each do |spec|\n previous_level = []\n spec.reorder_levels.each do |level|\n \n #\n # Collect rule reference TO RULES IN THIS GRAMMAR ONLY. Rule priority is about\n # rule production. A grammar can use rules from other grammars, but can't PRODUCE\n # rules from other grammars, so local rules only need apply. This is only an issue\n # for groups, where we'll just skip anything that isn't a local Rule.\n \n current_level = []\n level.references.each do |name_token|\n name = name_token.text\n if @rule_defs.member?(name) then\n current_level << name\n elsif @group_defs.member?(name) then\n @group_defs[name].member_references.each do |reference|\n if reference.is_a?(RuleReference) then\n unless (reference.symbol_name.grammar.exists? and reference.symbol_name.grammar != @name)\n current_level << reference.symbol_name.name\n end\n end\n end\n end\n end\n \n #\n # Everything in the current_level is linked to everything in the previous_level. If \n # there is no previous_level, then we'll register the names as points.\n \n if previous_level.empty? then\n root_sets << current_level\n current_level.each do |name|\n hierarchy.register_point( name )\n end\n else\n previous_level.each do |parent_name|\n current_level.each do |child_name|\n if hierarchy.would_cycle?(parent_name, child_name) then\n nyi( \"error handling for precedence cycle [#{parent_name}] to [#{child_name}]\" )\n else\n hierarchy.register( parent_name, child_name )\n end\n end\n end\n end\n \n previous_level = current_level\n end\n end\n \n \n #\n # Now, we want to integrate the prioritized rules back into the overall hierarchy, and we\n # want to preserve as much of the original ordering as possible. We do this by looking\n # within the prioritized rules at each layer and picking the highest priority for each\n # subtree, then inserting that layer at that index, shifting all the unprioritized rules \n # down.\n #\n # I think some examples might help explain what I mean.\n #\n # Rules: a, b, c, d, e, f, g, h | Rules: a, b, c, d, e, f\n # Order: 1, 2, 3, 4, 5, 6, 7, 8 | Order: 1, 2, 3, 4, 5, 6\n # |\n # Prec table 1: | Prec table 1:\n # d | b c\n # e g | e f\n # Prec table 2: | \n # h | \n # d | \n # g | \n # |\n # DAG layers and original order: | DAG layers and original order:\n # h 8 | b c 2 3\n # d 4 | e f 5 6\n # e g 5 7 |\n #\n # So, with these two examples, we want to reinsert the DAG elements back into the order\n # so that the DAG's hierarchy is respected, while -- as much as possible -- not disturbing \n # the original order. At each layer of the DAG, we look down the tree and find the highest\n # priority original position, and that is where we insert that layer. So\n #\n # insertion_points: | insertion_points:\n # 4, 4, 5 | 2, 5\n #\n # Now, obviously we can't insert two layers at the same point, so for the left example,\n # we'll need to adjust the second layer down a level, which will then cascade to the third\n # layer. And as there is no room between those insertion points, any rules originally at\n # levels 4, 5, or 6 must be shifted down as well.\n #\n # For the right example, notice that rule 4 doesn't need to be disturbed by the\n # the prioritization of either layer, as there is space between insertion points 2 and 5.\n # So we leave it in that position.\n #\n # insertion_points: | insertion_points:\n # 4, 5, 6 | 2, 5\n #\n # Finally, after integrating the default and prioritized rules, we get:\n # 1: a | 1: a\n # 2: b | 2: b c\n # 3: c | 3: d\n # 4: h | 4: e f\n # 5: d |\n # 6: e g |\n # 7: f |\n \n all_rules = []\n default_rules = []\n \n @rule_defs.each do |name, element|\n name = name.to_s\n \n if element.is_a?(Rule) then\n all_rules << name\n default_rules << name unless hierarchy.node?(name)\n end\n end\n\n\n #\n # Next we collect the raw insertion point data for the precedence data. But there's another \n # wrinkle. Up top, we merged all the precedence tables into one DAG, so we could find loops\n # and inter-relationships between the precedence tables. However, if some elements don't link\n # up, we don't want to prioritize all the independent trees to the same level -- we want to\n # preserve as much of the original ordering as possible. So we have to process each tree separately,\n # then interleave the data back together.\n \n insertion_point_sets = []\n insertion_layer_sets = []\n \n hierarchy.independent_trees(root_sets).each do |tree|\n insertion_points = []\n insertion_layers = []\n \n tree.each_layer_reverse do |layer|\n insertion_point = all_rules.length\n layer.each do |name|\n insertion_point = min( insertion_point, all_rules.index(name) )\n end\n \n insertion_points.unshift min(insertion_point, insertion_points.empty? ? insertion_point : insertion_points[0])\n insertion_layers.unshift layer\n end\n \n insertion_point_sets << insertion_points\n insertion_layer_sets << insertion_layers\n end\n \n \n #\n # We interleave the data sets back together. We want to do the interleaving by insertion_point.\n \n insertion_points = []\n insertion_layers = []\n\n until insertion_point_sets.empty? \n tops = insertion_point_sets.collect{|set| set[0]}\n min = tops.inject(all_rules.length){|current, aggregate| min(current, aggregate)}\n index = tops.index( min )\n \n insertion_points << insertion_point_sets[index].shift\n insertion_layers << insertion_layer_sets[index].shift\n \n if insertion_point_sets[index].empty? then\n insertion_point_sets.delete_at(index)\n insertion_layer_sets.delete_at(index)\n end\n end\n \n \n #\n # Next, we need to adjust the insertion points so that every one is unique.\n \n last_insertion_point = -1\n insertion_points.each_index do |index|\n insertion_points[index] = last_insertion_point + 1 if insertion_points[index] <= last_insertion_point\n last_insertion_point = insertion_points[index]\n end\n \n \n #\n # Finally, we have to integrate the two systems by setting the priority on each Rule. \n # We proceed one priority level at a time: if it is in the insertion_points list, we set \n # the priority for all rules on that level to that number; otherwise, we shift a name off\n # the default_rules list and set its priority instead.\n \n (default_rules.length + insertion_layers.length).times do |i|\n if insertion_points.member?(i) then\n insertion_layers[insertion_points.index(i)].each do |name|\n @rule_defs[name].priority = i\n end\n else\n default_rules.shift.each do |rule_name|\n @rule_defs[rule_name].priority = i\n end\n end\n end\n end",
"def each_involved_task(&block)\n return enum_for(__method__) unless block_given?\n\n trace.each_vertex(&block)\n end",
"def eachNode(&block)\n @topo.eachNode(&block) if !@topo.nil?\n end",
"def create_local_graph(block)\n block_flow = dfg.block_flows.fetch(block.id)\n\n # A map of instructions to nodes.\n insn_nodes = {}\n\n # Create a node for each instruction in the block.\n block.each_with_length do |insn, offset|\n node = InsnNode.new(insn, offset)\n insn_nodes[offset] = node\n nodes << node\n end\n\n # The first and last node in the sub-graph, and the last fixed node.\n previous_fixed = nil\n first_fixed = nil\n last_fixed = nil\n\n # The merge node for the phi nodes to attach to.\n merge_node = nil\n\n # If there is more than one predecessor and we have basic block\n # arguments coming in, then we need a merge node for the phi nodes to\n # attach to.\n if block.incoming_blocks.size > 1 && !block_flow.in.empty?\n merge_node = MergeNode.new(id_counter)\n nodes << merge_node\n\n previous_fixed = merge_node\n first_fixed = merge_node\n last_fixed = merge_node\n end\n\n # Connect local control flow (only nodes with side effects.)\n block.each_with_length do |insn, length|\n if insn.side_effects?\n insn_node = insn_nodes[length]\n connect previous_fixed, insn_node, :control if previous_fixed\n previous_fixed = insn_node\n first_fixed ||= insn_node\n last_fixed = insn_node\n end\n end\n\n # Connect basic block arguments.\n inputs = {}\n outputs = {}\n block_flow.in.each do |arg|\n # Each basic block argument gets a phi node. Even if there's only\n # one predecessor! We'll tidy this up later.\n phi = PhiNode.new(id_counter)\n connect(phi, merge_node, :info) if merge_node\n nodes << phi\n inputs[arg] = phi\n\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows[consumer_offset]\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer == arg\n connect(phi, insn_nodes[consumer_offset], :data, input_index)\n end\n end\n end\n\n block_flow.out.each { |out| outputs[out] = phi if out == arg }\n end\n\n # Connect local dataflow from consumers back to producers.\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows.fetch(consumer_offset)\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer.local?\n connect(\n insn_nodes[producer.length],\n insn_nodes[consumer_offset],\n :data,\n input_index\n )\n end\n end\n end\n\n # Connect dataflow from producers that leaves the block.\n block.each_with_length do |_, producer_pc|\n dfg\n .insn_flows\n .fetch(producer_pc)\n .out\n .each do |consumer|\n unless consumer.local?\n # This is an argument to the successor block - not to an\n # instruction here.\n outputs[consumer.name] = insn_nodes[producer_pc]\n end\n end\n end\n\n # A graph with only side-effect free instructions will currently have\n # no fixed nodes! In that case just use the first instruction's node\n # for both first and last. But it's a bug that it'll appear in the\n # control flow path!\n SubGraph.new(\n first_fixed || insn_nodes[block.block_start],\n last_fixed || insn_nodes[block.block_start],\n inputs,\n outputs\n )\n end",
"def create_sub_graph(spec_edges, move_dist = nil)\n # declare locals\n time = Time.now\n m = $game_map\n map_width,map_height = m.width, m.height\n MoveUtils.init_ev_passables\n \n if !move_dist\n dist = spec_edges[:move] ||= TactBattleManager::Defaults::Move\n else\n dist = move_dist\n end\n \n x_low = x_high = y_low = y_high = nil\n if @source\n x_low, x_high = [@source.x-dist, 0].max, [@source.x+dist,map_width-1].min\n y_low, y_high = [@source.y-dist, 0].max, [@source.y+dist,map_height-1].min \n else\n x_low, x_high = 0, [dist,map_width-1].min\n y_low, y_high = 0, [dist,map_height-1].min\n end\n \n @jump_time = 0\n @optim_cache = {}\n x_low.upto(x_high).each do |x|\n y_low.upto(y_high).each do |y|\n expand_graph_adj(v=Vertex.new(x,y, m.terrain_tag(x,y)), spec_edges[:pass])\n add_adjacent_jumpables(v.x,v.y,dist,spec_edges)if spec_edges[:jump_length]>0\n end\n end\n self\n end",
"def run_while!\n\n before_run\n\n i=1\n\n while yield i do\n\n break if maximum_round? i\n\n before_round i\n\n if i == 1\n # some things are different for the first round, namely nodes with activation = start\n run_first_round!\n else\n run_round!\n end\n\n after_round i\n i+=1\n end\n\n after_run\n\n self\n\n end",
"def schedule(&block)\n fiber = pool_fiber\n EM.next_tick { fiber.resume(block) }\n end",
"def build_graph\n @matrix.each_with_index do |row, x|\n row.each_with_index do |move, y|\n move = Coordinate.new(x,y)\n @matrix[x][y] = possible_moves(move)\n end\n end\n\tend",
"def solve_start(first)\n starting_edge = Edge.new(first,first,0, 0)\n @queue.push(starting_edge)\n solve(first)\n end",
"def test\n puts 'Building Graph for tests...'\n # Simple graph\n #\n # First\n # / \\\n # second third\n # / | | \\\n # fourth fifth goal sixth\n #\n # Construct graph\n first = GraphNode.new 'First'\n second = GraphNode.new 'Second'\n third = GraphNode.new 'Third'\n fourth = GraphNode.new 'Fourth'\n fifth = GraphNode.new 'Fifth'\n sixth = GraphNode.new 'Sixth'\n goal = GraphNode.new 'Goal'\n\n first.connect second\n first.connect third\n\n second.connect first\n second.connect fourth\n second.connect fifth\n\n third.connect first\n third.connect goal\n third.connect sixth\n\n fourth.connect second\n fifth.connect second\n\n goal.connect third\n sixth.connect third\n\n # Perform tests\n puts \"Testing from root node 'First'\"\n puts(bfs(first) { |node| puts ' ' + node })\n\n puts \"Testing from second node 'Second'\"\n puts(bfs(second) { |node| puts ' ' + node })\nend",
"def run\n closed_squares = []\n opened_squares = [@start]\n\n @start.current_path_cost = 0\n\n while opened_squares.any?\n current_square = opened_squares.sort do |a, b|\n a.estimated_total_cost(@finish) <=> b.estimated_total_cost(@finish)\n end.first\n\n if current_square == @finish\n return find_path(current_square)\n end\n\n closed_squares.push(current_square)\n opened_squares.delete(current_square)\n\n @board.neighbours(current_square).each do |neighbour|\n if closed_squares.include?(neighbour)\n next\n end\n\n if !opened_squares.include?(neighbour)\n opened_squares.push(neighbour)\n end\n\n if current_square.current_path_cost + neighbour.move_cost >= neighbour.current_path_cost\n next\n end\n\n neighbour.path_via = current_square\n neighbour.current_path_cost = current_square.current_path_cost + neighbour.move_cost \n end\n end\n end",
"def select_nodes(graph)\n begin\n route1, route2 = graph.random_routes\n node1 = route1.random_node\n node2 = route2.find_closest(node1)\n end while ( (route2.demand + node1.demand) > graph.vehicle_capacity )\n return route1, route2, node1, node2\n end",
"def visit(task, permanently_visited = Set.new, temporary_visited = [], direction: :forward, &block)\n unless block_given?\n return to_enum(method=:visit, task, permanently_visited, temporary_visited, direction: direction)\n end\n if temporary_visited.include? task\n # This node have already been visited in this small iteration and\n # it means that there is a loop.\n temporary_visited << task\n raise Deployment::LoopDetected.new self, 'Loop detected!', temporary_visited\n end\n if permanently_visited.include? task\n # We have already checked this node for loops in\n # its forward dependencies. Skip it.\n return\n end\n # Start a small iteration over this node's forward dependencies\n # add this node to the last iteration visit list and run recursion\n # on the forward dependencies\n temporary_visited << task\n task_method = \"each_#{direction}_dependency\"\n task.send(task_method.to_sym) do |_task|\n visit(_task, permanently_visited, temporary_visited, direction: direction, &block)\n end\n # Small iteration have completed without loops.\n # We add this node to the list of permanently marked nodes and\n # remove in from the temporary marked nodes list.\n permanently_visited.add task\n temporary_visited.delete task\n # Insert this node to the head of topology sort list and return it.\n yield task\n end",
"def schedule(&block)\n pool_fiber.resume(block)\n end",
"def each_graph(&block)\n if block_given?\n yield self\n end\n enum_graph\n end",
"def sim\n for_each_timeunit do\n sim_children\n end\n end",
"def each\n cycles_found = []\n\n @graph.keys.each do |start_node|\n @ticker.tick\n next if cycles_found.include?(start_node)\n\n find_cycles(start_node).each do |cycle|\n unless cycles_found.include?(cycle.node)\n cycles_found << cycle.node\n yield cycle.node\n end\n end\n end\n end",
"def walk_tasks(&blk)\n @flows.each_value do |f|\n f.walk_tasks(&blk)\n end\n end",
"def walk(catalog)\n nodes = {}\n runlist = {}\n failed = {}\n threads = {}\n\n catalog['applications'].each do |app, components|\n components.each do |component, data|\n nodename = data['node']\n nodes[nodename] ||= { :produces => [], :consumes => [] }\n nodes[nodename][:produces] += data['produces']\n nodes[nodename][:consumes] += data['consumes']\n end\n end\n\n loop do\n # move any nodes ready to go (not waiting for something to be produced) to the runlist\n runlist.merge! nodes.select { |node, rel| rel[:consumes].empty? }\n nodes.reject! { |node, rel| rel[:consumes].empty? }\n\n # if the runlist is empty, then that means that none are running and none are ready to run\n break if runlist.empty?\n\n runlist.each do |node, running|\n next if threads.include? node\n\n if block_given?\n puts \"Enforcing configuration on #{node}...\"\n # run the block passed in with the name of the node\n thr = Thread.new { yield(node, running) }\n threads.merge!( node => thr )\n else\n puts \" * #{node} producing #{running[:produces].inspect}\"\n mark_completed(nodes, running)\n runlist.delete(node)\n end\n end\n\n threads.each do |node, thr|\n next if thr.alive?\n\n if thr.value\n mark_completed(nodes, runlist[node])\n else\n failed.merge!(node => runlist[node])\n end\n\n threads.delete(node)\n runlist.delete(node)\n end\n\n sleep 5 if block_given?\n end\n\n puts \"\\nNode failues:\" unless failed.empty?\n failed.each do |node, relationships|\n puts \" * #{node}: \"\n puts \" produces: #{relationships[:produces].inspect}\"\n end\n\n puts \"\\nSkipped due to failed requirements:\" unless nodes.empty?\n nodes.each do |node, relationships|\n puts \" * #{node}: \"\n puts \" consumes: #{relationships[:consumes].inspect}\"\n end\n puts\n\n end",
"def schedule_with_state(state, action)\n raise 'action cannot be nil' unless action\n\n schedule_relative_with_state(state, 0, action)\n end",
"def execute_swap graph, swap\n mark {a,b}\n swap a,b\n compute_d {a,b}\n graph.t += swap.gain\n return graph\nend",
"def create_graphs\n if(@config[\"Smain\"][\"graphs\"] == \"interval\")\n @childs[\"graph\"] = Process.fork do\n # Ignore HANUP signal\n trap('HUP', 'IGNORE')\n\n # Exit on SIGTERM or SIGKILL\n trap(\"SIGTERM\") { Process.exit!(0) }\n trap(\"SIGKILL\") { Process.exit!(0) }\n\n # Initialize time object\n time = Time.now\n\n # Create graphs in endless loop\n loop do\n # Check if enough time since last update has gone\n if(time <= Time.now)\n # Increment time object with @config['graph_interval'] seconds\n time = Time.now + @config[\"Smain\"]['graph_interval']\n\n # Create graphs for every module\n @config[\"Smain\"]['modules'].each do |modul|\n @modules[modul].graph(\"day\")\n @modules[modul].graph(\"week\")\n @modules[modul].graph(\"month\")\n @modules[modul].graph(\"year\")\n end\n end\n\n # Sleep until next run\n sleep 60\n end\n end\n end\n end",
"def topology_sort\n topology = []\n permanently_visited = Set.new\n temporary_visited = []\n loop do\n next_task = each_task.find do |task|\n not (permanently_visited.include? task or temporary_visited.include? task)\n end\n return topology unless next_task\n visit(next_task, permanently_visited, temporary_visited).each do |task|\n topology.insert 0, task\n end\n end\n topology\n end",
"def simulate_workflow(workflow, service)\n # Only need to consider the remaining workflow.\n queue = []\n visited = Set.new # Ensure each node is only enqueued once\n return visited unless workflow && service\n # Add current nodes children to queue.\n workflow.each do |tool, depends_set|\n queue << tool if depends_set.include? service\n end\n until queue.empty?\n current_service = queue.shift # shift is equivalent to dequeue.\n # Execute the block given at each node\n yield current_service if block_given?\n visited.add(current_service)\n workflow.each do |tool, depends_set|\n queue << tool if depends_set.include?(current_service) && !visited.include?(tool)\n end\n end\n visited.delete service\n end",
"def solve\n # Generate uniques\n spaces = student_ids.product(bag_ids)\n\n visited_nodes = 0\n student_ids.each do |sid|\n bid = solver.choose(*bag_choices_for_student(sid))\n visited_nodes +=1\n partial_plan[sid] = bid\n solver.assert assigned_bags_are_unique(partial_plan)\n solver.assert assigned_bags_without_student_repeats(partial_plan)\n end\n\n puts \"Visited: #{visited_nodes} nodes\"\n partial_plan.to_a\n end",
"def make_blank_graph\n ISSUE_NAMES.each_with_index {|name, i| @nodes[i] = Graph::Node.new(i, name, \"\") unless name.blank? }\n\n #testing\n #@edges[1] = Graph::Edge.new(1, @nodes[0], @nodes[3], MapvisualizationsHelper::INCREASES)\n\n @nodes[START].location = Vector[(@width-200)/2, @height/2] #pull out Menhaden Population and center\n grid_nodes_in_box(@nodes.reject{|k,v| k==START},Vector[@width-200+50, 130],Vector[200, @height-130+50]) #hard-coded starting box\n end",
"def visit_nodes\n # Run a depth-first traversal of the graph with a worklist and a\n # visited set.\n\n worklist = [@start]\n visited = Set.new\n until worklist.empty?\n node = worklist.pop\n if visited.add?(node)\n yield node\n worklist.push *node.inputs.nodes\n worklist.push *node.outputs.nodes\n end\n end\n end",
"def apply(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).apply\n end\n end",
"def run\n strategy_delay = @dax.collect { |_k, v| v.min_delay }.min\n\n EM.synchrony do\n @dax.each do |name, exchange|\n Arke::Log.debug \"Starting Exchange: #{name}\"\n\n exchange.timer = EM::Synchrony::add_periodic_timer(exchange.min_delay) do\n exchange.queue.pop do |action|\n Arke::Log.debug \"Scheduling Action #{Time.now} - Exchange #{name} Delay #{exchange.min_delay} - Queue size: #{exchange.queue.size}\"\n Arke::Log.debug \"pop: #{action}\"\n schedule(action)\n end\n end\n\n exchange.start\n end\n\n # order stacking is a very big issue here, I multiply by 2 because I yield 2 orders\n # one for buy and one for sell\n @timer = EM::Synchrony::add_periodic_timer(strategy_delay) do\n execute_strategy if queues_empty?\n end\n end\n end",
"def run_sim\n @continue_running = @started = true\n processed = []\n\n (0...@num_rounds).each do |round|\n puts \"Round #{round}\"\n (0...Board::BOARD_ROWS).each do |i|\n (0...Board::BOARD_COLUMNS).each do |j|\n\n Thread.stop unless continue_running? \n\n grid_object = @board.matrix[i][j]\n next if grid_object.nil? or grid_object == :Grass\n\n # do not process the same agent twice; this happens when an agent\n # moves down (to the next row) and maybe other cases\n processed.include?(grid_object) ? next : processed << grid_object\n\n options = @board.get_move_options(i,j)\n\n if grid_object.respond_to?(:evaluate_moves) then\n result = grid_object.evaluate_moves(options)\n\n # Check if we should move or delete the object\n result == :delete ? @board.delete(i,j) : move(@board.matrix,i,j,result)\n\n # Check if the agent is ready to reproduce and handle accordingly\n # NOTE: It is important to understand that the base spawn address is where\n # the agent started NOT where it was moved. That doesn't really make sense,\n # but I didn't bother to address it.\n # TODO: Fix that...\n if grid_object.ready_to_reproduce?\n grid_object.reset_food_consumption\n @board.spawn_agents(grid_object.class,i,j) \n end\n\n grid_object.decrement_life\n else\n next\n end\n\n options = nil\n sleep(@speed)\n end\n end\n\n @board.grow_grass()\n processed = []\n end\n end",
"def schedule(parent: @parent || Task.current)\n @scheduler_task ||=\n parent.async { |task|\n task.annotate(\"scheduling tasks for #{self.class}.\")\n\n while @waiting.any? && !limit_blocking?\n delay = [next_acquire_time - Async::Clock.now, 0].max\n task.sleep(delay) if delay.positive?\n resume_waiting\n end\n\n @scheduler_task = nil\n }\n end",
"def init_graph\n Graph.new(self, skip_track: :broad)\n end",
"def test_proxy_graph_separation\n\ttasks = prepare_plan :add => 3\n\tproxies = tasks.map { |t| transaction[t] }\n\n\tt1, t2, t3 = tasks\n\tp1, p2, p3 = proxies\n\tp1.depends_on p2\n\n\tassert_equal([], t1.enum_for(:each_child_object, Hierarchy).to_a)\n\tt2.depends_on t3\n\tassert(! Hierarchy.linked?(p2, p3))\n end",
"def visit( bb )\n # ignore if we've been here before\n if bb.visited == :unvisited\n # note that we're visiting here\n bb.visited = :visiting\n\n # recurse\n bb.sucs.reverse.each do |suc|\n visit suc\n end\n\n # now finish this node\n bb.visited = :visited\n @topo.push bb\n end\n end",
"def primary()\n while true\n moves = []\n map = $network.frame\n\n (0...map.height).each do |y|\n (0...map.width).each do |x|\n loc = Location.new(x, y)\n site = map.site(loc)\n\n next if site.owner != $tag\n\n next if should_wait(map, site)\n\n valid = valid_moves(map, loc)\n if valid.empty?\n opts = $directions\n #opts = site.strength == 255 ? directions : ([GameMap::DIRECTIONS[0] ] + directions\n moves << Move.new(loc, opts.shuffle.first)\n else\n moves << Move.new(loc, valid.shuffle.first)\n end\n\n end\n end\n\n $network.send_moves(moves)\n end\nend",
"def connect_local_graphs_control(local_graphs)\n dfg.blocks.each do |predecessor|\n predecessor_last = local_graphs[predecessor.id].last_fixed\n predecessor.outgoing_blocks.each_with_index do |successor, index|\n label =\n if index > 0 &&\n index == (predecessor.outgoing_blocks.length - 1)\n # If there are multiple outgoing blocks from this block, then\n # the last one is a fallthrough. Otherwise it's a branch.\n :fallthrough\n else\n :\"branch#{index}\"\n end\n\n connect(\n predecessor_last,\n local_graphs[successor.id].first_fixed,\n :control,\n label\n )\n end\n end\n end",
"def generate_graph\n end",
"def schedule(&blk)\n @reactor.next_tick(blk)\n end",
"def schedule_process_connections\n ProcessQueue.create(:type => \"apply_primary_tags\",\n :priority => 1,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_inner_connections\",\n :priority => 2,\n :params => [self.id])\n ProcessQueue.create(:type => \"make_outer_connections\",\n :priority => 5,\n :params => [self.id])\n end",
"def aStar(tx = @player.x/@TILESIZE, ty = @player.y/@TILESIZE, x = @x/@TILESIZE, y = @y/@TILESIZE)\n #exit conditions\n if tx > @map.WIDTH or ty > @map.HEIGHT or tx < 0 or ty < 0\n return Node.new(x, y, nil, 0)\n end\n start = Time.now\n evald = Array.new #nodes that have already been evaluated\n queue = [Node.new(x, y, 0)]#the last element is the g value\n until queue.empty?\n #queue.each{ |q| print q.toArray, \"...\"}\n #print \"\\n\" #for debugging\n current = queue[0]#finds the node in queue with the lowest f value\n queue.each do |q|\n current = q if q.f(tx, ty) < current.f(tx, ty)\n end\n evald.push(current)#move current from 'queue' to 'evald'\n queue.delete(current)\n #direction from the second node aka the one after the one the ghost is at\n if current.x == tx and current.y == ty\n current.trim\n return current\n #print \"the ghost is confused\\n\" # for debugging\n end\n @map.getSurrounding(current.x, current.y, false).each{ |n|\n node = Node.toNode(n)\n node.g= current.g + 1\n node.parent= current\n nodeInEvald = false\n evald.each{ |evNode|\n if(evNode.coords == node.coords)\n if(evNode.g > node.g)\n evNode.g = node.g\n evvNode.dir = node.dir\n end\n nodeInEvald = true\n break\n end\n }\n if !nodeInEvald\n queue.push(node) \n end\n }\n #just gives up if it's been trying to find a path for more than 5 seconds\n if Time.now - start > 5\n current.trim\n current.timeOut = true;\n return current\n end\n end\n nil\n end",
"def schedule_call(&block)\n EM::next_tick(&block)\n end",
"def detect_cycle_in_graph(edges)\nend",
"def solve!\n #calculates the initial adjacency matrix\n self.calculate_adjacency_matrix!\n\n #create the root node, with city ID 0 (for Beijing)\n self.root_node = Node.new(0)\n self.root_node.set_cost_matrix(self.adj_matrix) #set the cost matrix to the adjacency matrix\n\n #calculate the base cost manually (usually would happen during init but ROOT lacks a parent)\n self.root_node.calculate_base_cost!\n node = self.root_node\n\n #keep creating child nodes and selecting the minimum from the next level,\n #repeating until all cities have been visited.\n while(node.visited_this_tour.size < @@cities.size)\n node.create_children!\n\n best_node = node.children.min\n node = best_node\n end\n\n #print the results!\n node.visited_this_tour.each do |city_id|\n puts @@cities[city_id][:name]\n end\n\n end",
"def schedule\n run_callbacks :schedule do\n inline_mode ? perform_inline : perform_async\n end\n end",
"def force_cluster_strict_hierarchy\n # Find the nodes belonging to several clusters.\n loop do\n # First cluster found each node name\n # Hash<String, String >\n cluster_per_node = {}\n conflicting_clusters = nil\n @nodes_graph.each do |node_name, node_info|\n node_info[:includes].each do |included_node_name|\n if cluster_per_node.key?(included_node_name)\n # Found a conflict between 2 clusters\n conflicting_clusters = [node_name, cluster_per_node[included_node_name]]\n log_error \"Node #{included_node_name} found in both clusters #{node_name} and #{cluster_per_node[included_node_name]}\"\n break\n else\n cluster_per_node[included_node_name] = node_name\n end\n end\n break unless conflicting_clusters.nil?\n end\n break if conflicting_clusters.nil?\n\n # We have conflicting clusters to resolve\n cluster_1, cluster_2 = conflicting_clusters\n cluster_1_belongs_to_cluster_2 = @nodes_graph[cluster_1][:includes].all? { |cluster_1_node_name| @nodes_graph[cluster_2][:includes_proc].call(cluster_1_node_name) }\n cluster_2_belongs_to_cluster_1 = @nodes_graph[cluster_2][:includes].all? { |cluster_2_node_name| @nodes_graph[cluster_1][:includes_proc].call(cluster_2_node_name) }\n if cluster_1_belongs_to_cluster_2\n if cluster_2_belongs_to_cluster_1\n # Both clusters have the same nodes\n if @nodes_graph[cluster_1][:includes_proc].call(cluster_2)\n @nodes_graph[cluster_2][:includes] = (@nodes_graph[cluster_1][:includes] + @nodes_graph[cluster_2][:includes]).uniq\n @nodes_graph[cluster_1][:includes] = [cluster_2]\n else\n @nodes_graph[cluster_1][:includes] = (@nodes_graph[cluster_1][:includes] + @nodes_graph[cluster_2][:includes]).uniq\n @nodes_graph[cluster_2][:includes] = [cluster_1]\n end\n else\n # All nodes of cluster_1 belong to cluster_2, but some nodes of cluster_2 don't belong to cluster_1\n @nodes_graph[cluster_2][:includes] = @nodes_graph[cluster_2][:includes] - @nodes_graph[cluster_1][:includes] + [cluster_1]\n end\n elsif cluster_2_belongs_to_cluster_1\n # All nodes of cluster_2 belong to cluster_1, but some nodes of cluster_1 don't belong to cluster_2\n @nodes_graph[cluster_1][:includes] = @nodes_graph[cluster_1][:includes] - @nodes_graph[cluster_2][:includes] + [cluster_2]\n else\n # cluster_1 and cluster_2 have to be merged\n new_cluster_name = \"#{cluster_1}_&_#{cluster_2}\"\n # Store thos proc in those variables as the cluster_1 and cluster_2 references are going to be removed\n includes_proc_1 = @nodes_graph[cluster_1][:includes_proc]\n includes_proc_2 = @nodes_graph[cluster_2][:includes_proc]\n @nodes_graph[new_cluster_name] = {\n type: :cluster,\n includes: (@nodes_graph[cluster_1][:includes] + @nodes_graph[cluster_2][:includes]).uniq,\n connections: @nodes_graph[cluster_1][:connections].merge!(@nodes_graph[cluster_2][:connections]) { |_connected_node, labels_1, labels_2| (labels_1 + labels_2).uniq },\n includes_proc: proc do |hostname|\n includes_proc_1.call(hostname) || includes_proc_2.call(hostname)\n end\n }\n replace_nodes([cluster_1, cluster_2], new_cluster_name)\n end\n end\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 graph\n initialize_connection unless @graph\n sleep API_CALL_DELAY\n @graph\nend",
"def create_knight_tour_graph(board_size)\n new_graph = Graph.new()\n board_size.times do |x|\n board_size.times do |y|\n new_graph.add_vertex([x,y])\n end\n end\n knight_legal_moves(new_graph)\n new_graph\nend",
"def schedule(spec)\n @task.schedule = Cloud::Cycler::Schedule.parse(spec)\n end",
"def plan(tasks)\n\t\t\ttasks.each do |day,task|\n\t\t\t puts \"#{day}, we must complete the #{task}\"\n\t\t\tend\n\t\t\tputs \"I'm the Boss! No one must do anything without my knowledge!\"\n\t\tend",
"def validate_dag\n def dfs(group, seen)\n if seen.include?(group)\n self.errors[:base] << (\n \"Creating a dependency from group '#{from.name}' to \" \\\n + (from.name == to.name ? \"itself\" : \"group '#{to.name}'\") \\\n + \" creates a cycle\")\n end\n group.node_groups.each { |grp|\n dfs(grp, seen + [group])\n }\n end\n\n dfs(self.to,[self.from])\n end",
"def partially_order(graph)\n # Create a work list of the fixed nodes.\n\n to_sequence = graph.all_nodes.select(&:fixed?)\n\n # Keep going until the work list is empty.\n\n until to_sequence.empty?\n node = to_sequence.shift\n\n # We're only interested in the control inputs to the node.\n\n control_input_nodes = node.inputs.control_edges.from_nodes\n\n # Nodes with no control input (such as start but possibly others) have sequence number zero.\n\n if control_input_nodes.empty?\n node.props[:sequence] = 0\n next\n end\n\n # If all control inputs have been given a sequence, we can give this\n # node as at least one greater than all of those.\n\n if control_input_nodes.all? { |i| i.props[:sequence] }\n node.props[:sequence] = control_input_nodes.map { |i| i.props[:sequence] }.max + 1\n next\n end\n\n # If all the control inputs haven't been given a sequence number yet\n # then put it back on the work list and come back to it later.\n\n to_sequence.push node\n end\n end",
"def testSimpleTasksReordering\n executeSimpleTest(\n [ [ 'T1', 'R1', 800, 2, [], ' =='],\n [ 'T2', 'R1', 100, 2, ['T3'], '=='],\n [ 'T3', 'R2', 900, 2, [], ' =='],\n [ 'T4', 'R3', 200, 3, ['T3'], '==='] ] )\n end",
"def traverse_graph(start_node_name, definitions, file_name)\n json_result = []\n all_paths = find_all_paths_from_node(start_node_name)\n all_paths = remove_subarrays(all_paths)\n\n all_paths.each do |path|\n p \"path: #{path}\"\n next if path.length < 2\n\n (0..path.length - 1).each do |i|\n break if i == path.length - 1\n break if @adj_matrix[path[i]].eql? nil\n break if @adj_matrix[path[i]][path[i + 1]].eql? nil\n\n @adj_matrix.fetch(path[i]).fetch(path[i + 1]).fetch('function')\n begin\n definitions.send(@adj_matrix.fetch(path[i]).fetch(path[i + 1]).fetch('function'))\n @adj_matrix[path[i]][path[i + 1]]['value'] = true\n rescue RuntimeError => e\n puts \"ERROR going from #{path[i]} to #{path[i + 1]}\"\n puts e.message.to_s\n # unless @adj_matrix[path[i]][path[i + 1]]['value'] = false\n # appended_error = @adj_matrix[path[i]][path[i + 1]]['label'].concat(\" \\nError: #{e.message}\")\n # @adj_matrix[path[i]][path[i + 1]]['label'] = appended_error\n # end\n @adj_matrix[path[i]][path[i + 1]]['value'] = false\n end\n\n temp = {}\n temp['source'] = path[i]\n temp['destination'] = path[i + 1]\n temp['label'] = @adj_matrix[path[i]][path[i + 1]]['label']\n temp['value'] = @adj_matrix[path[i]][path[i + 1]]['value']\n json_result.push(temp)\n end\n build_model(json_result, file_name)\n end\n build_model(json_result, file_name)\n end",
"def launch_tasks\n config.prepare_task.run if config.prepare_task\n\n # level = 1\n Parallel.map(root.children, config.parallel => root.children.size) do |node|\n logger.info(\"Run locally. localhost => #{node.host}\")\n config.local_task.run(root.host, node.host)\n end\n # level in (2..depth)\n fork_remote_tasks(root.children)\n\n config.finish_task.run if config.finish_task\n end",
"def execute\n\n\n raise \"this job is not in the planned phase yet\" unless planned?\n\n if schedule_form == 'at'\n Gremlin.scheduler.at schedule_time do Gremlin.world.execute(plan_id) end\n else\n Gremlin.scheduler.in schedule_time do Gremlin.world.execute(plan_id) end\n end\n\n self.save\n end",
"def schedule(program, name, insertions, deletions)\n\t\t@driver.synchronize do\n\t\t\tif (program == \"runtime\") \n\t\t\t task = Driver::Task.new\n\t\t\t task.insertions = insertions\n\t\t\t task.deletions = deletions\n\t\t\t task.program = program\n\t\t\t task.name = name\n#\t\t puts \"XXX Tasking: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n \t\t\t@driver.task(task)\n\t\t\telse\n\t\t\t\ttuple = Tuple.new(clock.current + 1, program, name, insertions, deletions)\n\t\t print \"XXX Scheduling: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n\t\t\t\tschedule.force(tuple)\n\t\t\tend\n\t\t\t# XXXXXXXXXX\n\t\t\t@driver.cond_var.signal\n\t\tend\n\tend",
"def testTasksReorderingWithPredecessor\n # TODO: Code the interchangeable days feature, and uncomment after\n# executeSimpleTest(\n# [ [ 'T1', 'R1', 800, 4, [], '=== ='],\n# [ 'T2', 'R2', 100, 2, ['T3'], '=='],\n# [ 'T3', 'R1', 500, 2, ['T4'], ' =='],\n# [ 'T4', 'R3', 900, 2, [], ' =='],\n# [ 'T5', 'R4', 200, 5, ['T4'], '====='] ] )\n executeSimpleTest(\n [ [ 'T1', 'R1', 800, 4, [], '== =='],\n [ 'T2', 'R2', 100, 2, ['T3'], '=='],\n [ 'T3', 'R1', 500, 2, ['T4'], ' =='],\n [ 'T4', 'R3', 900, 2, [], ' =='],\n [ 'T5', 'R4', 200, 5, ['T4'], '====='] ] )\n end",
"def new_graph\n # Clear physics\n physics.clear\n center = TVec2D.new(width / 2, height / 2)\n @clusters = (0..8).map do\n Cluster.new(\n app: self,\n number: rand(3..8),\n diameter: rand(20..100),\n center: center\n )\n end\n #\tAll clusters connect to all clusters\n clusters.each_with_index do |ci, i|\n clusters[i + 1..clusters.size - 1].each do |cj|\n ci.connect(cj)\n end\n end\nend",
"def process_all_nodes\n debug 'Start processing all nodes'\n each_node do |node|\n process_node node\n end\n end",
"def add_blocks_to_schedule(time_blocks, schedule, recurring)\n time_blocks.each do |block|\n day_of_week = block.split(\"_\")[0]\n time = block.split(\"_\")[1]\n start_time = Time.utc(\"2011\", nil, nil, time.split(\" - \")[0])\n end_time = Time.utc(\"2011\", nil, nil, time.split(\" - \")[1])\n \n if Day.exists?(day_of_week, schedule.id)\n day = Day.where(:name => day_of_week, :schedule_id => schedule.id).first\n else\n day = Day.new(:name => day_of_week, :schedule_id => schedule.id)\n day.save\n end\n \n if !TimeBlock.exists?(start_time, end_time, day.id, recurring)\n time_block = TimeBlock.new(:start_time => start_time, :end_time => end_time, :day_id => day.id, :recurring => recurring)\n time_block.save\n end\n end\n end",
"def eachNode(&block)\n @nodeSets.each { |s|\n s.eachNode &block\n }\n end",
"def explore\n rover_bay.each do |r|\n if pass_path_check?(r)\n move(r)\n else\n raise \"There is a collision\\nin placement #{r.coordinate.inspect}, please revise instruction set #{r.command.inspect}\"\n end\n end\n end",
"def initialize_processor(time)\n i = 0\n selected = []\n min = DEVS::INFINITY\n while i < @children.size\n child = @children[i]\n tn = child.initialize_processor(time)\n selected.push(child) if tn < DEVS::INFINITY\n min = tn if tn < min\n i += 1\n end\n\n @scheduler.clear\n if @scheduler.prefer_mass_reschedule?\n @children.each { |c| @scheduler << c }\n else\n selected.each { |c| @scheduler << c }\n end\n\n @time_last = max_time_last\n @time_next = min\n end",
"def solve\n \n # Clean up.\n reset_visiting_state\n \n # Enqueue start position.\n @queue = []\n enqueue_cell([], @start_x, @start_y)\n \n # Loop as long as there are cells to visit and no solution has\n # been found yet.\n path = nil\n until path || @queue.empty?\n path = solve_visit_cell\n end\n \n if path\n # Mark the cells that make up the shortest path.\n for x, y in path\n @path[x][y] = true\n end\n else\n puts \"No solution found?!\"\n end\n end",
"def ready_to_schedule?(node)\n # Ready to globally schedule\n\n node.outputs.to_nodes.all? do |i|\n globally_scheduled?(i)\n end\n end",
"def task()\n world = Robota::World\n world.read_world(\"../karel/empty.map\")\n \n karel = Question3.new(1, 1, Robota::NORTH, 1)\n karel2 = Question3.new(6, 1, Robota::EAST, 0)\n karel3 = Question3.new(6, 6, Robota::SOUTH, 0)\n karel4 = Question3.new(1, 6, Robota::WEST, 0)\n karel.put_beeper\n karel.run\n karel2.run\n karel3.run\n karel4.run\n karel4.run\n karel.run\n karel2.run\n karel3.run\n karel3.run\n karel4.run\n karel.run\n karel2.run\n karel2.run\n karel3.run\n karel4.run\n karel.run\n \n \nend",
"def schedule_with_state(state, action)\n raise 'action cannot be nil' unless action\n schedule_at_absolute_with_state(state, @clock, action)\n end",
"def bft(&block)\n queue = Queue.new\n \n # Set all nodes to not enqueued\n self.each do |node|\n node.enqueued = false\n end\n\n queue.push(self) \n self.enqueued = true\n\n while(queue.size > 0)\n # Get next node in the queue\n node = queue.pop\n \n # Pass node off to block\n block.call(node)\n\n # Enqueue all children nodes\n node.child_array.each do |child|\n if !child.enqueued\n queue.push(child)\n child.enqueued = true\n end\n end\n\n end #while\n end",
"def schedule(uri); end",
"def generate_schedule\n \tschedule = Array.new\n \tqueue = Array.new\n \tcurrent_job = nil\n \tcurrent_job_execution_time = 0\n\n \tfor time in 0...hyper_period\n \t\t# add released tasks to queue\n \t\tqueue += get_released_jobs time\n\n \t\t# give the current job credit for execution in last step\n \t\tcurrent_job_execution_time += 1 unless current_job.nil?\n\n \t\t#check if current task is finished\n \t\tif !!current_job and current_job[:task].worst_case_execution_time == current_job_execution_time\n \t\t\t#task is finished\n \t\t\tcurrent_job = nil\n \t\t\tcurrent_job_execution_time = 0\n \t\tend\n\n \t\t#find a task to execute\n \t\tif current_job.nil?\n \t\t\tcurrent_job = get_highest_priorty_task(queue)\n \t\t\tqueue.delete(current_job)\n \t\tend\n\n \t\t# if we are missing a deadline task set is not schedulable\n \t\tif !!current_job and time >= current_job[:deadline]\n \t\t\treturn nil\n \t\tend\n\n \t\t# add current job to schedule\n \t\tschedule.push(current_job.nil? ? 0 : current_job[:task].id)\n\n \t\t#log whats executing in this slot\n \t\t#puts \"Slot #{time + 1} \" + (current_job.nil? ? \"Idle\" : current_job[:task].name)\n \tend\n\n \t# if queue isn't empty, then return nil\n \treturn nil unless queue.empty?\n\n \t#return schedule\n \tschedule\n end",
"def trace(begX, begY, endX, endY); MazeSolver.new(plane,graph).trace(begX, begY, endX, endY) end",
"def dfs(start_vertex, &block)\n start_vertex.gray!\n @time += 1\n start_vertex.discovery = @time\n start_vertex.get_connections.each do |next_vertex|\n if next_vertex.white?\n next_vertex.predecessor = start_vertex\n dfs(next_vertex, &block)\n end\n end\n start_vertex.black!\n @time += 1\n start_vertex.finish = @time\n yield start_vertex if block_given?\n end",
"def target_layout(target_ids, nodeset=@nodes, edgeset=@edges)\n groups = {'inc_targ'=>{}, 'dec_targ'=>{}, 'targ_inc'=>{}, 'targ_dec'=>{}, 'sup_targ'=>{}, 'targ_sup'=>{}} #sup_targ = top\n\n if nodeset.length > 0\n nodeset.each do |id, node| #build our groupings\n if !node.static\n edgeset.values.each do |edge|\n # check if node is related to something in target_ids\n if (node == edge.a and target_ids.include? edge.b.id) # means that node points at target\n g = edge.rel_type & MapvisualizationsHelper::INCREASES != 0 ? 'inc_targ' : (edge.rel_type & \n MapvisualizationsHelper::SUPERSET == 0 ? 'dec_targ' : 'sup_targ') #what group we go in\n groups[g][node.id] = node\n break #stop looking for edges for this node\n elsif (node == edge.b and target_ids.include? edge.a.id) #means that target points at node\n g = edge.rel_type & MapvisualizationsHelper::INCREASES != 0 ? 'targ_inc' : (edge.rel_type & \n MapvisualizationsHelper::SUPERSET == 0 ? 'targ_dec' : 'targ_sup') #what group we go in\n groups[g][node.id] = node\n break #stop looking for edges for this node\n end\n end\n end\n end \n\n set_static_nodes\n static_wheel_nodes\n\n # put the groups into little circles in their respective corners, so they can come out fighting\n radius = 50\n circle_nodes_at_point(groups['inc_targ'], Vector[0,@height], radius)\n circle_nodes_at_point(groups['dec_targ'], Vector[0,0], radius)\n circle_nodes_at_point(groups['sup_targ'], Vector[@width/2,0], radius)\n circle_nodes_at_point(groups['targ_inc'], Vector[@width,@height], radius)\n circle_nodes_at_point(groups['targ_dec'], Vector[@width,0], radius)\n circle_nodes_at_point(groups['targ_sup'], Vector[@width/2,@height], radius)\n \n #fruchterman_reingold(100) #fast, little bit of layout for now\n kamada_kawai\n normalize_graph\n else\n @nodes = NO_ITEM_ERROR\n end\n end",
"def each_statement(&block)\n return enum_statement unless block_given?\n\n each_subject do |subject|\n graph.query({subject: subject}, &block)\n end\n end",
"def find_initial_task_basis_plan\n kill_one_artificial until status.got_task?\n BasisPlan.new optimal_plan_real_part, real_task_basis\n end",
"def topological_sort(vertices)\n sorted = []\n top = new Queue() \n graph.vertices.each do |vertex|\n if vertex.in_edges.empty? \n top.enqueue(vertex)\n end \n end \nd\n until top.empty? \n current = top.pop \n sorted << current \n current.out_edges.each do |edge|\n if edge.destination.in_edges.empty? \n top.enqueue(edges)\n end \n end \n graph.delete_edge(edge)\n graph.delete_vertex(current); \n end \n\n \n\nend",
"def test_discover_neighborhood\n\tpeer2peer do |remote|\n\t mission, subtask, next_mission =\n\t\tTasks::Simple.new(:id => 'mission'), \n\t\tTasks::Simple.new(:id => 'subtask'),\n\t\tTasks::Simple.new(:id => 'next_mission')\n\t mission.depends_on subtask\n\t mission.signals(:stop, next_mission, :start)\n\n\t remote.plan.add_mission(mission)\n\t remote.plan.add_mission(next_mission)\n\tend\n\n\tr_mission\t= remote_task(:id => 'mission', :permanent => true)\n\tr_subtask\t= remote_task(:id => 'subtask', :permanent => true)\n\tr_next_mission = remote_task(:id => 'next_mission', :permanent => true)\n\n\t# We don't know about the remote relations\n\tassert_equal([], r_mission.children.to_a)\n\tassert_equal([], r_mission.event(:stop).child_objects(EventStructure::Signal).to_a)\n\n\t# add remote relations\n\tremote_peer.discover_neighborhood(r_mission, 1) do |r_mission|\n\t proxies = r_mission.children.to_a\n\t assert_equal(1, proxies.to_a.size)\n\t assert_equal(r_subtask, proxies.first)\n\t proxies = r_mission.event(:stop).child_objects(EventStructure::Signal).to_a\n\t assert_equal(r_next_mission.event(:start), proxies.first)\n\tend\n\n\tplan.unmark_permanent(r_mission)\n\tplan.unmark_permanent(r_subtask)\n\tplan.unmark_permanent(r_next_mission)\n\tengine.wait_one_cycle\n\tassert_equal([remote_peer.task], plan.permanent_tasks.to_a)\n end",
"def tick\n # memoize number of neighbors for live cells\n # and dead cells with any adjacent live cells\n @live_cells.each { |live_cell| set_num_live_neighbors_at_live_cell(live_cell[0], live_cell[1]) }\n\n # update to next generation\n overwrite_matrix_with_next_generation\n\n # clear memoized values for next generation to determine neighbors\n @num_live_neighbors_by_dead_cells = {}\n @num_live_neighbors_by_live_cells = {}\n end",
"def fork_remote_tasks(parents)\n families = []\n next_generation = []\n parents.each do |parent|\n if parent.children.size.zero?\n logger.debug(\"#{parent} Reached leaf. Nothing to do.\")\n next\n end\n parent.children.each do |child|\n families << [parent, child]\n next_generation << child\n end\n end\n\n if families.size.zero?\n logger.info(\"Reached bottom of the tree. Nothing to do.\")\n return\n end\n\n Parallel.map(families, config.parallel => families.size) do |family|\n parent = family[0]\n child = family[1]\n logger.info(\"Run remote [#{parent.level}]. #{parent.host} => #{child.host}\")\n config.remote_task.run(parent.host, child.host)\n end\n\n fork_remote_tasks(next_generation)\n end",
"def compile\n queue = all_members\n while queue.count > 0\n found_strands = queue.shift.cluster_maps.map do |obj|\n obj.strand(false)\n end\n found_strands.reject! { |s| @strands.include?(s) }\n @strands += found_strands\n queue += found_strands.map(&:members).flatten\n end\n evaluate\n end",
"def resched\n action('resched')\n end",
"def solve\n graph = Graph.create(words, WordNode)\n graph.connect_nodes(:one_char_diff)\n\n end_node = graph.nodes_hash[end_word]\n start_node = graph.nodes_hash[start_word]\n start_node.cost = 0\n\n heap = Containers::Heap.new { |a, b| (a.cost <=> b.cost) == -1 }\n graph.nodes_hash.each do |k, v|\n heap.push v\n end\n\n puts heap.size\n # puts \"is empty?#{heap.empty?}\"\n until heap.empty? do\n current_node = heap.pop\n puts current_node.value, current_node.cost\n # puts current_node == end_node\n # puts current_node.value, end_node.value\n return graph.path(end_node) if current_node == end_node\n\n current_node.connected_nodes.each do |node|\n\n # puts node.visited\n unless node.visited\n cost = current_node.cost + 1\n if cost < node.cost\n node.cost = cost\n node.parent = current_node\n # puts \"changed parent\"\n # puts node.parent\n end\n end\n end\n\n current_node.visited = true\n end\n end",
"def sorted_with_order\n # Identify groups of nodes that can be executed concurrently\n groups = tsort_each.slice_when { |a, b| parents(a) != parents(b) }\n\n # Assign order to each node\n i = 0\n groups.flat_map do |group|\n group_with_order = group.product([i])\n i += group.size\n group_with_order\n end\n end",
"def run_asap( &block )\n ::EM.next_tick( &block )\n end",
"def apply_kruskal\r\n #sort the edges by its time-distance (sec)\r\n #then go over each edge, check if its borders vertices belong to the same group, if not , connect it,\r\n #groups are the lowest id\r\n\r\n edges_counter=0\r\n\r\n #1. sort edges\r\n @valid_edges.sort! { |a,b| a.time_distance <=> b.time_distance }\r\n\r\n #2. initialize head and inks nodes. each is his own head and points to null. (we maintaint information only for the selected ones (saving))\r\n @valid_vertices.each do |n|\r\n n.set_node_head_mst(n.osm_id)\r\n n.set_node_tail_mst(n.osm_id)\r\n #puts \"#{n.osm_id}, #{n.mst_head} \"\r\n end\r\n\r\n #3. go over valid (filtered)edges, join if possible. lower id will always be n1\r\n @valid_edges.each do |e|\r\n #lower id to be first of the selected two nodes\r\n if e.osm_from<e.osm_to\r\n then\r\n n1osm=e.osm_from\r\n n2osm=e.osm_to\r\n else\r\n n1osm=e.osm_to\r\n n2osm=e.osm_from\r\n end\r\n\r\n #get object, its current head and next\r\n n1=@nodes_hash[n1osm]\r\n n2=@nodes_hash[n2osm]\r\n n1_head_osm=n1.mst_head\r\n n2_head_osm=n2.mst_head\r\n\r\n #4. if the head1 != head2, nodes can be connected and marked bold red\r\n if n1_head_osm != n2_head_osm\r\n #mark the edge as bold\r\n e.set_bold\r\n edges_counter=edges_counter + 1\r\n\r\n #get head object of both lists\r\n n1_tail_osm=n1.mst_tail\r\n n2_tail_osm=n2.mst_tail\r\n n1_head=@nodes_hash[n1_head_osm]\r\n n1_tail=@nodes_hash[n1_tail_osm]\r\n\r\n #join two lists (if they are lists)\r\n #puts \"n1: H1:#{n1_head.mst_head} T1:#{n1_head.mst_tail} H1N:#{n1_head.mst_next} ## n2: H2:#{n2Head.mst_head} T2:#{n2Head.mst_tail} H2N:#{n2Head.mst_next}\"\r\n n1_tail.set_next_node_mst(n2_head_osm)\r\n n1_head.set_node_tail_mst(n2_tail_osm)\r\n\r\n #fix links to head and tail on all their children\r\n child_node_osm=n1_head.mst_next\r\n until child_node_osm==-1 do\r\n child_node=@nodes_hash[child_node_osm]\r\n child_node.set_node_head_mst(n1_head_osm)\r\n child_node.set_node_tail_mst(n2_tail_osm)\r\n child_node_osm=child_node.mst_next\r\n end\r\n\r\n #puts \"n1: H1:#{n1_head.mst_head} T1:#{n1_head.mst_tail} H1N:#{n1_head.mst_next} ## n2: H2:#{n2Head.mst_head} T2:#{n2Head.mst_tail} H2N:#{n2Head.mst_next}\"\r\n end\r\n end\r\n\r\n #validations\r\n\r\n puts \"Validation error. In mst should be less edges then vertices\" if @valid_vertices.length <= edges_counter\r\n puts \"Validation passed. Minimum spanning tree has less edges (#{edges_counter}) than vertices (#{@valid_vertices.length}). Graph has more components. \" if @valid_vertices.length > edges_counter+1\r\n puts \"Validation passed. Minimum spanning tree has one edge less (#{edges_counter}) than vertices (#{@valid_vertices.length}). Graph has one component. \" if @valid_vertices.length == edges_counter+1\r\n end",
"def before_graph_recalculation\n each_adapter(&:before_graph_recalculation!)\n end",
"def schedule_sjn(data)\n sorted_data = data.sort { |a,b| a[:cpu_cycles] <=> b[:cpu_cycles] }\n result = schedule_fcfs(sorted_data)\n result[:policy] = 'SJN'\n result\nend",
"def star_cluster; end",
"def test_schedule_sort\n s = Schedule.new\n [4.0, 3, 5, 1, 4.1, 4.2 ].each { |n| s.insert(Time.at(n.to_i), n) }\n [1, 3, 4.0, 4.1, 4.2].each { |n| assert_equal n, s.pop(Time.at(4)) }\n refute_empty s # Not empty but nothing due until time 5\n assert_equal Time.at(5), s.next_tick\n assert_nil s.pop(Time.at(4))\n assert_equal 5, s.pop(Time.at(5))\n end",
"def run\n start = rand(20)\n puts \" Starting at: #{@locations[start].name}\"\n tripDesc = \"\" # human-readable List of moves for current trip segment\n @locations[start].visited = true\n visited = 1\n totalTime = 0\n while visited < 20\n group = group_nearest(start)\n best_time = 9999999999\n\n for i in 0..3\n result = getBestPath(start, group[i]) if group[i]\n if result[0] < best_time\n best_time = result[0]\n best_path = result[1]\n best_dest = group[i]\n end\n end\n tripDesc << best_path\n totalTime += best_time\n @locations[best_dest].visited = true\n start = best_dest\n visited += 1\n end\n\n puts \"*********** Total Trip Time = #{secondstoHMS(totalTime)} **************\"\n confirm = \"Complete.\\n\"\n for i in 0..19\n confirm = \"Error, not all locations visited!!\\n\" if !@locations[i].visited\n end\n tripDesc << confirm\n return [totalTime, tripDesc]\n\n end",
"def minimum_spanning_tree(known_weights)\n starting_node = Node.new(nodes.first.label)\n tree = WeightedGraph.new([ starting_node ])\n \n candidates = nodes.first.connected_nodes.map { |n| [ nodes.first, n, n.distance_between(nodes.first) ] }\n \n while tree.nodes.length < nodes.length\n print \"#{tree.nodes.length} \" if tree.nodes.length % 10 == 0\n # Pick the first suitable edge\n next_edge = nil\n known_weights.each do |weight|\n next_edge = candidates.detect { |edge| edge.last == weight }\n break if next_edge\n end\n \n # Break it down\n connected_existing_node, connected_new_node, distance = next_edge \n \n # Add to the tree\n new_node = Node.new(connected_new_node) \n existing_node = tree.get_node(connected_existing_node)\n tree.nodes << new_node\n tree.connect!(existing_node, new_node, distance)\n \n # Remove edges that would now create cycles:\n dropping = tree.nodes.map do |node|\n connected_node = get_node(node)\n [ connected_node, connected_new_node, connected_new_node.distance_between(connected_node) ]\n end\n candidates -= dropping\n \n # Add unlocked edges:\n connected_new_node.connected_nodes.each do |node|\n candidates << [ connected_new_node, node, node.distance_between(connected_new_node) ] unless tree.nodes.index(tree.get_node(node))\n end \n end\n \n tree\n end",
"def assign_types\n @schedule[0].cost = :travel\n @schedule.each_cons(3) do |days|\n days[1].cost =\n if days[0].date + 1 == days[1].date && days[1].date+ 1 == days[2].date\n :full\n else\n :travel\n end\n end\n @schedule[-1].cost = :travel\n end"
] | [
"0.6652021",
"0.58744603",
"0.5705704",
"0.5672693",
"0.55824625",
"0.5418472",
"0.5282473",
"0.526016",
"0.5256413",
"0.524882",
"0.5218984",
"0.52164775",
"0.51534736",
"0.50778574",
"0.50678074",
"0.5027008",
"0.50128585",
"0.49651617",
"0.49647626",
"0.49570063",
"0.49377102",
"0.49370497",
"0.49223876",
"0.490994",
"0.48998436",
"0.4898035",
"0.4879731",
"0.48722282",
"0.48620868",
"0.48548803",
"0.48268124",
"0.4825009",
"0.48084658",
"0.48016217",
"0.47965494",
"0.47888237",
"0.47815564",
"0.47735372",
"0.47680908",
"0.47571427",
"0.47495264",
"0.47482944",
"0.4747566",
"0.47281778",
"0.47241378",
"0.47213116",
"0.47197628",
"0.47162387",
"0.47146583",
"0.47100404",
"0.4709919",
"0.46992615",
"0.46985427",
"0.4697057",
"0.4695374",
"0.46704632",
"0.4668531",
"0.46638888",
"0.46619737",
"0.465509",
"0.46527484",
"0.46513104",
"0.4648609",
"0.4647333",
"0.4636737",
"0.46337312",
"0.46185112",
"0.46015814",
"0.45987988",
"0.45976844",
"0.45968893",
"0.45918348",
"0.45905513",
"0.4587621",
"0.45827883",
"0.4581412",
"0.45788375",
"0.45781112",
"0.45710278",
"0.45709383",
"0.45702046",
"0.45687622",
"0.4567182",
"0.45650595",
"0.4562062",
"0.45459995",
"0.4544945",
"0.45426",
"0.4539875",
"0.45316136",
"0.45315158",
"0.452875",
"0.45216924",
"0.4519946",
"0.4517432",
"0.45164534",
"0.4515836",
"0.45155042",
"0.4513493",
"0.4511795"
] | 0.73488915 | 0 |
Locally schedule within each basic block. | def locally_schedule_block(first_node)
# Find all the nodes in this basic block.
in_block = Set.new(nodes_in_block(first_node))
# Back up a second... our first node could be a fixed node, which
# actually has input values. Such as a branch with a condition.
# The nodes involved in that condition actually need to come first.
first_node = first_in_block(first_node, in_block)
# Create a work list of nodes to schedule and a set of nodes
# already scheduled.
to_schedule = in_block.to_a
scheduled = Set.new
# The first node in the basic block is already scheduled first.
to_schedule.delete first_node
scheduled.add first_node
# The tail is the last node we scheduled.
tail = first_node
until to_schedule.empty?
node = to_schedule.shift
# We are ready to locally schedule if all inputs that are in this
# block have themselves already been scheduled.
if node.inputs.from_nodes.all? { |i| !in_block.include?(i) || scheduled.include?(i) }
# Add a local schedule edge from the previous last node to this one,
# which then becomes the last node.
raise if tail.inputs.from_nodes.include? node
tail.output_to :local_schedule, node
tail = node
scheduled.add node
else
to_schedule.push node
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule\n # implemented by subclass\n end",
"def schedule(&blk)\n @reactor.next_tick(blk)\n end",
"def local_schedule(graph)\n # Find all basic blocks and locally schedule them.\n\n graph.all_nodes.each do |node|\n if node.begins_block?\n locally_schedule_block node\n end\n end\n end",
"def schedule(&block)\n pool_fiber.resume(block)\n end",
"def schedule(&block)\n fiber = pool_fiber\n EM.next_tick { fiber.resume(block) }\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule\n run_callbacks :schedule do\n inline_mode ? perform_inline : perform_async\n end\n end",
"def schedule_call(&block)\n EM::next_tick(&block)\n end",
"def blocks() end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(time, callback); end",
"def schedule(uri); end",
"def add_blocks_to_schedule(time_blocks, schedule, recurring)\n time_blocks.each do |block|\n day_of_week = block.split(\"_\")[0]\n time = block.split(\"_\")[1]\n start_time = Time.utc(\"2011\", nil, nil, time.split(\" - \")[0])\n end_time = Time.utc(\"2011\", nil, nil, time.split(\" - \")[1])\n \n if Day.exists?(day_of_week, schedule.id)\n day = Day.where(:name => day_of_week, :schedule_id => schedule.id).first\n else\n day = Day.new(:name => day_of_week, :schedule_id => schedule.id)\n day.save\n end\n \n if !TimeBlock.exists?(start_time, end_time, day.id, recurring)\n time_block = TimeBlock.new(:start_time => start_time, :end_time => end_time, :day_id => day.id, :recurring => recurring)\n time_block.save\n end\n end\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(spec)\n @task.schedule = Cloud::Cycler::Schedule.parse(spec)\n end",
"def schedule\n run_callbacks :schedule do\n perform_async\n end\n end",
"def eachRun(&_block)\n @runList.each{|_run|\n _block.call(_run) ;\n }\n end",
"def grandclock(presenthour,&block)\n \n for i in (1..presenthour)\n block.call\n end\n \nend",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def schedule_at (at, params={}, &block)\n\n do_schedule_at(\n at,\n prepare_params(params),\n &block)\n end",
"def schedule(parent: @parent || Task.current)\n @scheduler_task ||=\n parent.async { |task|\n task.annotate(\"scheduling tasks for #{self.class}.\")\n\n while @waiting.any? && !limit_blocking?\n delay = [next_acquire_time - Async::Clock.now, 0].max\n task.sleep(delay) if delay.positive?\n resume_waiting\n end\n\n @scheduler_task = nil\n }\n end",
"def schedule_every(n, &block)\r\n\r\n while true do\r\n before = Time.now\r\n\r\n block.call\r\n \r\n elapsed = Time.now - before\r\n interval = n - elapsed\r\n \r\n @logger.debug \"orders processing/delivery take #{elapsed} seconds.\"\r\n \r\n sleep(interval) if interval > 0\r\n end\r\n\r\nend",
"def evaulate_schedule\n 5\n end",
"def run\n schedule_managers\n end",
"def run_now!\n update_attributes(run_at: nil) if cron_schedule\n end",
"def valid_blocks(base_time)\n set_base_time(base_time)\n time_entries = time_entries_for(base)\n end",
"def execute_in_main_thread(&block)\n EventMachine.schedule(&block)\n end",
"def Clockwork\n puts \"testing clockwork!\"\n every(30.seconds, 'Send Messages') {\n rake 'scheduler:send_messages'\n mail(:to => \"swamy@ostryalabs.com\", subject: 'hello')\n }\n \nend",
"def run(&block); end",
"def yield\n\t\t\tFiber.scheduler.yield\n\t\tend",
"def start\n events.map(&:schedule)\n end",
"def run( page )\n schedule.each { |mod| exception_jail( false ){ run_one( mod, page ) } }\n end",
"def begin\n time_setup\n super\n end",
"def schedule(*)\n yield\n rescue Exception\n @stream.close\n raise\n end",
"def evaulate_schedule\n true\n end",
"def refresh; schedule_update end",
"def run_asap( &block )\n ::EM.next_tick( &block )\n end",
"def run(&block)\n @running_template = block\n end",
"def each_registered_block(type, &block); end",
"def setProcessingTime(&block)\n bTime = Time.new() ;\n block.call() ;\n eTime = Time.new() ;\n setBeginEndTime(bTime, eTime) ;\n end",
"def generate_schedule\n \tschedule = Array.new\n \tqueue = Array.new\n \tcurrent_job = nil\n \tcurrent_job_execution_time = 0\n\n \tfor time in 0...hyper_period\n \t\t# add released tasks to queue\n \t\tqueue += get_released_jobs time\n\n \t\t# give the current job credit for execution in last step\n \t\tcurrent_job_execution_time += 1 unless current_job.nil?\n\n \t\t#check if current task is finished\n \t\tif !!current_job and current_job[:task].worst_case_execution_time == current_job_execution_time\n \t\t\t#task is finished\n \t\t\tcurrent_job = nil\n \t\t\tcurrent_job_execution_time = 0\n \t\tend\n\n \t\t#find a task to execute\n \t\tif current_job.nil?\n \t\t\tcurrent_job = get_highest_priorty_task(queue)\n \t\t\tqueue.delete(current_job)\n \t\tend\n\n \t\t# if we are missing a deadline task set is not schedulable\n \t\tif !!current_job and time >= current_job[:deadline]\n \t\t\treturn nil\n \t\tend\n\n \t\t# add current job to schedule\n \t\tschedule.push(current_job.nil? ? 0 : current_job[:task].id)\n\n \t\t#log whats executing in this slot\n \t\t#puts \"Slot #{time + 1} \" + (current_job.nil? ? \"Idle\" : current_job[:task].name)\n \tend\n\n \t# if queue isn't empty, then return nil\n \treturn nil unless queue.empty?\n\n \t#return schedule\n \tschedule\n end",
"def sim\n for_each_timeunit do\n sim_children\n end\n end",
"def wrap_in_schedule (raw_expression, options)\n\n oat = options[:at]\n oin = options[:in]\n ocron = options[:cron]\n oevery = options[:every]\n\n fei = new_fei(\n :workflow_instance_id => get_wfid_generator.generate(nil),\n :workflow_definition_name => 'schedlaunch',\n :expression_name => 'sequence')\n\n # not very happy with this code, it builds custom\n # wrapping processes manually, maybe there is\n # a more elegant way, but for now, it's ok.\n\n template = if oat or oin\n\n sleep_atts = if oat\n { 'until' => oat }\n else #oin\n { 'for' => oin }\n end\n sleep_atts['scheduler-tags'] = \"scheduled-launch, #{fei.wfid}\"\n\n raw_expression.new_environment\n raw_expression.store_itself\n\n [\n 'sequence', {}, [\n [ 'sleep', sleep_atts, [] ],\n raw_expression.fei\n ]\n ]\n\n elsif ocron or oevery\n\n fei.expression_name = 'cron'\n\n cron_atts = if ocron\n { 'tab' => ocron }\n else #oevery\n { 'every' => oevery }\n end\n cron_atts['name'] = \"//cron_launch__#{fei.wfid}\"\n cron_atts['scheduler-tags'] = \"scheduled-launch, #{fei.wfid}\"\n\n template = raw_expression.raw_representation\n remove(raw_expression)\n\n [ 'cron', cron_atts, [ template ] ]\n\n else\n\n nil # don't schedule at all\n end\n\n if template\n\n raw_exp = RawExpression.new_raw(\n fei, nil, nil, @application_context, template)\n\n #raw_exp.store_itself\n raw_exp.new_environment\n\n raw_exp\n else\n\n raw_expression\n end\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 to_block (params, &block)\n\n return block if block\n\n schedulable = params.delete(:schedulable)\n\n return nil unless schedulable\n\n l = lambda do\n schedulable.trigger(params)\n end\n class << l\n attr_accessor :schedulable\n end\n l.schedulable = schedulable\n\n l\n end",
"def cron_tasks\n end",
"def schedule_updates\n schedule_update_in(48.hours)\n end",
"def em_async_schedule\n o = self.class.environment\n self.class.set :environment, :normal\n async_schedule { yield }\n ensure\n self.class.set :environment, o\n end",
"def schedule\n @schedule ||= all_schedules\n @schedule || {}\n end",
"def run!\n logger.info(\"Running task #{self.class.to_s}\")\n @block.call\n @next_run = cron_parser && cron_parser.next(Time.now)\n end",
"def initialize(&block)\n @triggers = []\n self.instance_eval(&block)\n end",
"def each_frame &block\n\t\t\t@update_block = block\n\t\tend",
"def perform_now(block=nil)\n Thread.current[:name] ||= name\n if defined?(Rails) && defined?(ActiveRecord::Base)\n require 'gb_dispatch/active_record_patch'\n thread_block = ->() do\n if Rails::VERSION::MAJOR < 5\n begin\n ActiveRecord::Base.connection_pool.force_new_connection do\n block ? block.call : yield\n end\n ensure\n ActiveRecord::Base.clear_active_connections!\n end\n else\n Rails.application.executor.wrap do\n ActiveRecord::Base.connection_pool.force_new_connection do\n block ? block.call : yield\n end\n end\n end\n end\n else\n thread_block = block ? block : ->() { yield }\n end\n begin\n Runner.execute thread_block, name: name\n rescue Exception => e\n return e\n end\n end",
"def prepare_each_run\n # puts \"prepare_each_run called\"\n if @initial_run\n @interval_index = 0\n @initial_run = false\n end\n end",
"def on_schedule\n return to_enum(:on_schedule) unless block_given?\n start = context.order.created_at\n finish = start + context.order.gateway.orders_expiration_period.seconds\n period = finish - start\n often = {\n base_interval: ENVied.ORDER_CHECK_BASE_INTERVAL.seconds,\n max_interval: ENVied.ORDER_CHECK_MAX_INTERVAL.seconds,\n rand_factor: ENVied.ORDER_CHECK_RAND_FACTOR,\n multiplier: ENVied.ORDER_CHECK_BACKOFF_MULT,\n max_period: period,\n }\n now = start\n with_intervals often do |interval|\n now += interval\n now = now.round(2)\n yield now, false\n end\n yield finish, true\n end",
"def initialize_group_schedule(creator_schedule)\n # clear current schedule if one exists\n self.schedule.destroy if self.schedule != nil\n \n # create schedule\n schedule = Schedule.create(:group_id => self.id)\n \n # copy creator's schedule as group's schedule\n creator_schedule.days.each do |creator_day|\n day = Day.create(:name => creator_day.name, :schedule_id => schedule.id)\n creator_day.time_blocks.each do |creator_time_block|\n TimeBlock.create(:chunk_of_time => creator_time_block.chunk_of_time, :day_id => day.id)\n end\n end\n end",
"def run(&block)\n end",
"def test_container_schedule_chain\n c = Container.new(__method__)\n delays = [0.05, 0.02, 0.04]\n i = delays.each\n a = []\n p = Proc.new { c.schedule(i.next) { a << Time.now; p.call } rescue nil }\n p.call # Schedule the first, which schedules the second etc.\n start = Time.now\n c.run\n assert_equal 3, a.size\n assert_equalish delays.reduce(:+), Time.now-start\n end",
"def schedule_for!\n unless self.parent_id\n starts_on = created_at\n course.lessons.all(order: :position).each do |lesson|\n unless scheduled_course.scheduled_lessons.where('lesson_id= ? and enrolment_id = ?',lesson.id, id ).first\n ScheduledLesson.create(student_user_id: self.student_user_id, enrolment_id: self.id, scheduled_course_id: scheduled_course.id, lesson_id: lesson.id )\n end\n end\n end\n end",
"def heat_block\n show do\n title \"Place all tubes in 50 degree heat block\"\n timer initial: { hours: 0, minutes: 10, seconds: 0}\n note \"Vortex every few minutes to speed up the process.\"\n note \"Retrieve after 10 minutes or until the gel slice is competely dissovled.\"\n end\n end",
"def schedule_every (freq, params={}, &block)\n\n params = prepare_params(params)\n params[:every] = freq\n\n first_at = params[:first_at]\n first_in = params[:first_in]\n\n #params[:delayed] = true if first_at or first_in\n\n first_at = if first_at\n at_to_f(first_at)\n elsif first_in\n Time.now.to_f + Rufus.duration_to_f(first_in)\n else\n Time.now.to_f + Rufus.duration_to_f(freq) # not triggering immediately\n end\n\n do_schedule_at(first_at, params, &block)\n end",
"def check_schedule()\n create_daily_tests()\n create_weekly_tests()\n end",
"def rake_tasks(&block); end",
"def rake_tasks(&block); end",
"def ding &block\n tund = Time.new.hour\n tund.times do\n block.call \n end\nend",
"def call_block\n puts 'Start'\n yield\n yield\n puts 'End'\nend",
"def schedule_updates\n schedule_updates_in(24.hours, 48.hours)\n end",
"def execute(&block)\n v = @v.map &block\n TimeArray.new(@start_time, v, zone: Time.zone.name)\n end",
"def run_block\n yield\nend",
"def reload_schedule!\n @schedule = all_schedules\n end",
"def schedule_job_specs(job_specs)\n job_specs.each { |job_spec| schedule_job_spec(job_spec) }\n end",
"def game_schedule\n EM.next_tick do\n env.refresh(nil) # remove current player and ws\n yield\n end\n end",
"def run\n super\n cron_poller.start\n end",
"def perform(&block); end",
"def run_replications\n # Add fresh schedule\n old_shedule = @schedule\n @schedule = {}\n @active = false\n\n old_shedule.each_value do |conn|\n conn.start\n end\n end",
"def list; @schedule_lock.synchronize { @schedule.dup } end",
"def do_trigger\n\n @block.call @job_id, @cron_line, @params\n end",
"def schedule_in (duration, params={}, &block)\n\n do_schedule_at(\n Time.new.to_f + Rufus.duration_to_f(duration),\n prepare_params(params),\n &block)\n end"
] | [
"0.6341952",
"0.63037956",
"0.6245337",
"0.6236898",
"0.6190105",
"0.60779387",
"0.6077296",
"0.6060238",
"0.60593796",
"0.6051279",
"0.6051279",
"0.60431254",
"0.60101354",
"0.5986354",
"0.59528625",
"0.59313506",
"0.5929625",
"0.59140587",
"0.5877349",
"0.5876079",
"0.5876079",
"0.5876079",
"0.58037835",
"0.57827336",
"0.5774677",
"0.5773638",
"0.5736885",
"0.5624345",
"0.56047434",
"0.55921346",
"0.55243444",
"0.5506634",
"0.5498728",
"0.5464892",
"0.54445416",
"0.5443997",
"0.5443408",
"0.5424287",
"0.54224795",
"0.5402491",
"0.5401377",
"0.53948295",
"0.5391028",
"0.5390998",
"0.5389708",
"0.5385718",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5376566",
"0.5373162",
"0.53683424",
"0.5366494",
"0.53529185",
"0.5325793",
"0.53247786",
"0.53035975",
"0.53027445",
"0.5302231",
"0.52887595",
"0.5278734",
"0.52738416",
"0.5270161",
"0.5255891",
"0.5249382",
"0.5242819",
"0.5240497",
"0.52400625",
"0.5232005",
"0.5232005",
"0.5231867",
"0.5226389",
"0.5224833",
"0.52197915",
"0.5218536",
"0.5203893",
"0.518818",
"0.5186356",
"0.51855296",
"0.51732004",
"0.51692957",
"0.5163163",
"0.516174",
"0.5157298"
] | 0.5590462 | 30 |
We've got a problem with our IR design here. We expect some fixed control flow node to be the start of the basic block. In the case of at least some branches, they can have input that needs to run first, but our system just isn't designed for anything except a control flow node to need to run first. This fixup method walks back from the fixed node to see if actually there is an input that needs to run first. Not a great solution. | def first_in_block(first, nodes)
first.inputs.from_nodes.each do |n|
if nodes.include?(n)
return first_in_block(n, nodes)
end
end
first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix\n assembled_address = $config[:base_address]\n instructions.each do |instr|\n instr.fix(assembled_address)\n assembled_address += instr.size\n end\n end",
"def cleanup_insn_nodes\n nodes.dup.each do |node|\n next unless node.is_a?(InsnNode)\n\n case node.insn\n when AdjustStack\n # If there are any inputs to the adjust stack that are immediately\n # discarded, we can remove them from the input list.\n number = node.insn.number\n\n node.inputs.dup.each do |input_edge|\n next if input_edge.type != :data\n\n from = input_edge.from\n next unless from.is_a?(InsnNode)\n\n if from.inputs.empty? && from.outputs.size == 1\n number -= 1\n remove(input_edge.from)\n elsif from.insn.is_a?(Dup)\n number -= 1\n connect_over(from)\n remove(from)\n\n new_edge = node.inputs.last\n new_edge.from.outputs.delete(new_edge)\n node.inputs.delete(new_edge)\n end\n end\n\n if number == 0\n connect_over(node)\n remove(node)\n else\n next_node =\n if number == 1\n InsnNode.new(Pop.new, node.offset)\n else\n InsnNode.new(AdjustStack.new(number), node.offset)\n end\n\n next_node.inputs.concat(node.inputs)\n next_node.outputs.concat(node.outputs)\n\n # Dynamically finding the index of the node in the nodes array\n # because we're mutating the array as we go.\n nodes[nodes.index(node)] = next_node\n end\n when Jump\n # When you have a jump instruction that only has one input and one\n # output, you can just connect over top of it and remove it.\n if node.inputs.size == 1 && node.outputs.size == 1\n connect_over(node)\n remove(node)\n end\n when Pop\n from = node.inputs.find { |edge| edge.type == :data }.from\n next unless from.is_a?(InsnNode)\n\n removed =\n if from.inputs.empty? && from.outputs.size == 1\n remove(from)\n true\n elsif from.insn.is_a?(Dup)\n connect_over(from)\n remove(from)\n\n new_edge = node.inputs.last\n new_edge.from.outputs.delete(new_edge)\n node.inputs.delete(new_edge)\n true\n else\n false\n end\n\n if removed\n connect_over(node)\n remove(node)\n end\n end\n end\n end",
"def process_fix\n super\n end",
"def scan\n @top_level.comment ||= \"\"\n state=:code_blank\n line_number = 0\n line = nil\n\n # This started out as a really long nested case statement,\n # which also led to repetitive code. I'd like to avoid that\n # so I'm using a \"table\" instead.\n\n # Firstly we need some procs to do the transition and processing\n # work. Because these are procs they are closures, and they can\n # use variables in the local scope.\n #\n # First, the \"nothing to see here\" stuff.\n code_noop = lambda do\n if line =~ /^\\s+$/\n state = :code_blank\n end\n end\n\n pod_noop = lambda do\n if line =~ /^\\s+$/\n state = :pod_blank\n end\n @top_level.comment += filter(line)\n end\n\n begin_noop = lambda do\n if line =~ /^\\s+$/\n state = :begin_blank\n end\n @top_level.comment += filter(line)\n end\n\n # Now for the blocks that process code and comments...\n\n transit_to_pod = lambda do\n case line\n when /^=(?:pod|head\\d+)/\n state = :pod_no_blank\n @top_level.comment += filter(line)\n when /^=over/\n state = :over_no_blank\n @top_level.comment += filter(line)\n when /^=(?:begin|for)/\n state = :begin_no_blank\n end\n end\n\n process_pod = lambda do\n case line\n when /^\\s*$/ then\n state = :pod_blank\n @top_level.comment += filter(line)\n when /^=cut/ then\n state = :code_no_blank\n when /^=end/ then\n $stderr.puts \"'=end' unexpected at #{line_number} in #{@file_name}\"\n else\n @top_level.comment += filter(line)\n end\n end\n\n process_begin = lambda do\n case line\n when /^\\s*$/ then\n state = :begin_blank\n @top_level.comment += filter(line)\n when /^=end/ then\n state = :code_no_blank\n when /^=cut/\n $stderr.puts \"'=cut' unexpected at #{line_number} in #{@file_name}\"\n else\n @top_level.comment += filter(line)\n end\n end\n\n transitions = { :code_no_blank => code_noop,\n :code_blank => transit_to_pod,\n :pod_no_blank => pod_noop,\n :pod_blank => process_pod,\n :begin_no_blank => begin_noop,\n :begin_blank => process_begin,\n }\n\n @content.each_line do |l|\n line = l\n line_number += 1\n transitions[state].call\n end\n\n @top_level\n end",
"def branch_to\n @first unless opcode == :swi\n end",
"def bb_unconditional_branch\n @file.puts \" @current_block.left = arg1.basic_block\"\n @file.puts \" @current_block.close\"\n @file.puts \" @current_block = new_basic_block\"\n end",
"def else!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n\n\n type = ELSE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 27:7: 'sino'\n match( \"sino\" )\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__, 6 )\n\n\n end",
"def corder!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n\n\n type = CORDER\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 297:3: ']'\n match( 0x5d )\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__, 11 )\n\n\n end",
"def mipsLowerSimpleBranchOps(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n annotation = node.annotation\n case node.opcode\n when /^b(addi|subi|ori|addp)/\n op = $1\n bc = $~.post_match\n branch = \"b\" + bc\n\n case op\n when \"addi\", \"addp\"\n op = \"addi\"\n when \"subi\"\n op = \"subi\"\n when \"ori\"\n op = \"ori\"\n end\n\n if bc == \"o\"\n case op\n when \"addi\"\n # addu $s0, $s1, $s2\n # xor $t0, $s1, $s2\n # blt $t0, $zero, no overflow\n # xor $t0, $s0, $s1\n # blt $t0, $zero, overflow\n # no overflow:\n #\n tr = Tmp.new(node.codeOrigin, :gpr)\n tmp = Tmp.new(node.codeOrigin, :gpr)\n noFlow = LocalLabel.unique(\"noflow\")\n noFlowRef = LocalLabelReference.new(node.codeOrigin, noFlow)\n newList << Instruction.new(node.codeOrigin, op, [node.operands[0], node.operands[1], tr], annotation)\n newList << Instruction.new(node.codeOrigin, \"xori\", [node.operands[0], node.operands[1], tmp])\n newList << Instruction.new(node.codeOrigin, \"bilt\", [tmp, MIPS_ZERO_REG, noFlowRef])\n newList << Instruction.new(node.codeOrigin, \"xori\", [tr, node.operands[0], tmp])\n newList << Instruction.new(node.codeOrigin, \"bilt\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n newList << noFlow\n newList << Instruction.new(node.codeOrigin, \"move\", [tr, node.operands[1]])\n when \"subi\"\n # subu $s0, $s1, $s2\n # xor $t0, $s1, $s2\n # bge $t0, $zero, no overflow\n # xor $t0, $s0, $s1\n # blt $t0, $zero, overflow\n # no overflow:\n #\n tr = Tmp.new(node.codeOrigin, :gpr)\n tmp = Tmp.new(node.codeOrigin, :gpr)\n noFlow = LocalLabel.unique(\"noflow\")\n noFlowRef = LocalLabelReference.new(node.codeOrigin, noFlow)\n newList << Instruction.new(node.codeOrigin, op, [node.operands[1], node.operands[0], tr], annotation)\n newList << Instruction.new(node.codeOrigin, \"xori\", [node.operands[1], node.operands[0], tmp])\n newList << Instruction.new(node.codeOrigin, \"bigteq\", [tmp, MIPS_ZERO_REG, noFlowRef])\n newList << Instruction.new(node.codeOrigin, \"xori\", [tr, node.operands[1], tmp])\n newList << Instruction.new(node.codeOrigin, \"bilt\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n newList << noFlow\n newList << Instruction.new(node.codeOrigin, \"move\", [tr, node.operands[1]])\n when \"ori\"\n # no ovwerflow at ori\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..1], annotation)\n end\n else\n if node.operands[1].is_a? Address\n addr = node.operands[1]\n tr = Tmp.new(node.codeOrigin, :gpr)\n newList << Instruction.new(node.codeOrigin, \"loadp\", [addr, tr], annotation)\n newList << Instruction.new(node.codeOrigin, op, [node.operands[0], tr])\n newList << Instruction.new(node.codeOrigin, \"storep\", [tr, addr])\n else\n tr = node.operands[1]\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..-2], annotation)\n end\n newList << Instruction.new(node.codeOrigin, branch, [tr, MIPS_ZERO_REG, node.operands[-1]])\n end\n when \"bia\", \"bpa\", \"bba\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[1], node.operands[0]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bnz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when \"biaeq\", \"bpaeq\", \"bbaeq\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[0], node.operands[1]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when \"bib\", \"bpb\", \"bbb\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[0], node.operands[1]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bnz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when \"bibeq\", \"bpbeq\", \"bbbeq\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[1], node.operands[0]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when /^bt(i|p|b)/\n lowerMIPSCondBranch(newList, \"b\" + $~.post_match + $1, node)\n else\n newList << node\n end\n else\n newList << node\n end\n }\n newList\nend",
"def prepare_result\n\t\t\tsuper\n\t\t\t@lowest_old = MM.get_lowest_old(@current_point, @start_vector, @hd_config, false, @tuning_range)\n if @lowest_old[0] == nil\n\t\t\t\t@initial_run = true\n\t\t\t\tthrow :jump_back\n\t\t\tend\n\t\tend",
"def test_jmpf_branches_if_top_of_stack_is_false\n @ctx.constants = [false, 'ok']\n @bc.codes = [:cls, :pushc, 0, :jmpf, 7, :pushl, 15, :pushc, 1, :halt]\n assert_eq @ci.run, 'ok'\n end",
"def verify_first_follow(compiled_grammar)\n compiled_grammar.rules.each do |rule|\n rule.branches.each do |branch|\n has_epsilon = branch.first_set.find { |step| step.is_a?(Epsilon) }\n\n if has_epsilon and !branch.follow_set.empty?\n compiled_grammar.add_error(\n 'first/follow conflict, branch can start with epsilon and is ' \\\n 'followed by (non) terminals',\n branch.source_line\n )\n\n compiled_grammar.add_error(\n 'epsilon originates from here',\n has_epsilon.source_line\n )\n end\n end\n end\n end",
"def unconditional_branch\n @before_stream = lambda { @file.puts \" location = @ip + 1\" }\n @after_stream = lambda { @file.puts \" arg1.used_at location\" }\n @after_stack = lambda { bb_unconditional_branch }\n method_definition\n end",
"def validate_and_fix_last_defined_transition_offset(file, last_defined, first_rule_offset); end",
"def tree_begin!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 4)\n\n type = TREE_BEGIN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 10:14: '^('\n match(\"^(\")\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__, 4)\n\n end",
"def ignorable!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 105 )\n\n \n # - - - - main rule block - - - -\n # at line 941:3: ( '//' (~ ( '\\\\n' | '\\\\r' ) )* ( ( '\\\\r' )? '\\\\n' )? | '/*' ( . )* '*/' | ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\\\\\' ( '\\\\r' )? '\\\\n' )+ )\n alt_44 = 3\n look_44_0 = @input.peek( 1 )\n\n if ( look_44_0 == 0x2f )\n look_44_1 = @input.peek( 2 )\n\n if ( look_44_1 == 0x2f )\n alt_44 = 1\n elsif ( look_44_1 == 0x2a )\n alt_44 = 2\n else\n raise NoViableAlternative( \"\", 44, 1 )\n end\n elsif ( look_44_0 == 0x9 || look_44_0 == 0xc || look_44_0 == 0x20 || look_44_0 == 0x5c || look_44_0 == 0xa0 )\n alt_44 = 3\n else\n raise NoViableAlternative( \"\", 44, 0 )\n end\n case alt_44\n when 1\n # at line 941:5: '//' (~ ( '\\\\n' | '\\\\r' ) )* ( ( '\\\\r' )? '\\\\n' )?\n match( \"//\" )\n # at line 941:10: (~ ( '\\\\n' | '\\\\r' ) )*\n while true # decision 38\n alt_38 = 2\n look_38_0 = @input.peek( 1 )\n\n if ( look_38_0.between?( 0x0, 0x9 ) || look_38_0.between?( 0xb, 0xc ) || look_38_0.between?( 0xe, 0xffff ) )\n alt_38 = 1\n\n end\n case alt_38\n when 1\n # at line 941:10: ~ ( '\\\\n' | '\\\\r' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 38\n end\n end # loop for decision 38\n # at line 941:28: ( ( '\\\\r' )? '\\\\n' )?\n alt_40 = 2\n look_40_0 = @input.peek( 1 )\n\n if ( look_40_0 == 0xa || look_40_0 == 0xd )\n alt_40 = 1\n end\n case alt_40\n when 1\n # at line 941:30: ( '\\\\r' )? '\\\\n'\n # at line 941:30: ( '\\\\r' )?\n alt_39 = 2\n look_39_0 = @input.peek( 1 )\n\n if ( look_39_0 == 0xd )\n alt_39 = 1\n end\n case alt_39\n when 1\n # at line 941:30: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n end\n\n when 2\n # at line 942:5: '/*' ( . )* '*/'\n match( \"/*\" )\n # at line 942:10: ( . )*\n while true # decision 41\n alt_41 = 2\n look_41_0 = @input.peek( 1 )\n\n if ( look_41_0 == 0x2a )\n look_41_1 = @input.peek( 2 )\n\n if ( look_41_1 == 0x2f )\n alt_41 = 2\n elsif ( look_41_1.between?( 0x0, 0x2e ) || look_41_1.between?( 0x30, 0xffff ) )\n alt_41 = 1\n\n end\n elsif ( look_41_0.between?( 0x0, 0x29 ) || look_41_0.between?( 0x2b, 0xffff ) )\n alt_41 = 1\n\n end\n case alt_41\n when 1\n # at line 942:10: .\n match_any\n\n else\n break # out of loop for decision 41\n end\n end # loop for decision 41\n match( \"*/\" )\n\n when 3\n # at line 943:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\\\\\' ( '\\\\r' )? '\\\\n' )+\n # at file 943:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\\\\\' ( '\\\\r' )? '\\\\n' )+\n match_count_43 = 0\n while true\n alt_43 = 6\n case look_43 = @input.peek( 1 )\n when 0x9 then alt_43 = 1\n when 0xc then alt_43 = 2\n when 0x20 then alt_43 = 3\n when 0xa0 then alt_43 = 4\n when 0x5c then alt_43 = 5\n end\n case alt_43\n when 1\n # at line 943:7: '\\\\t'\n match( 0x9 )\n\n when 2\n # at line 943:14: '\\\\f'\n match( 0xc )\n\n when 3\n # at line 943:21: ' '\n match( 0x20 )\n\n when 4\n # at line 943:27: '\\\\u00A0'\n match( 0xa0 )\n\n when 5\n # at line 943:38: '\\\\\\\\' ( '\\\\r' )? '\\\\n'\n match( 0x5c )\n # at line 943:43: ( '\\\\r' )?\n alt_42 = 2\n look_42_0 = @input.peek( 1 )\n\n if ( look_42_0 == 0xd )\n alt_42 = 1\n end\n case alt_42\n when 1\n # at line 943:43: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n else\n match_count_43 > 0 and break\n eee = EarlyExit(43)\n\n\n raise eee\n end\n match_count_43 += 1\n end\n\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 105 )\n\n end",
"def work(toy_index, cube)\n if $debug && cube.available_heads.empty?\n puts \"\\t\" * toy_index + \"Working for piece #{toy_index} but it has no available heads; recursing.\"\n end\n\n if $debug\n puts \"\\t\" * toy_index + \"Working for piece #{toy_index} which has #{cube.available_heads.count} available heads. Cube:\"\n cube.display_in_line(toy_index)\n end\n\n cube.available_heads.each do |available_head|\n cah = C.new(available_head[:face], available_head[:row], available_head[:left])\n\n puts \"\\t\" * toy_index + \"Attempting to place piece #{toy_index} from head #{cah.to_s}\" if $debug\n\n [:vertical_up, :vertical_down, :sideways_right, :sideways_left, :long_far, :long_near].each do |orientation|\n if cube.place! piece: $toy[toy_index], orientation: orientation, c: cah\n puts \"\\t\" * toy_index + \"\\tPlaced piece #{toy_index} in orientation #{orientation}\" if $debug\n\n if cube.complete?\n $solution_counter += 1\n puts \"====================== SOLUTION #{$solution_counter} FOUND! ===========================\"\n cube.display_in_line\n else\n if toy_index <= $toy.size && !cube.available_heads.empty?\n work(toy_index + 1, cube.clone2)\n else\n puts \"\\t\" * toy_index + \"Not progressing to piece #{toy_index + 1}, no available heads.\" if $debug\n end\n end\n\n puts \"\\t\" * toy_index + \"Undo orientation #{orientation} and progressing to the next one.\" if $debug\n cube.undo!\n else\n puts \"\\t\" * toy_index + \"\\t\\tTried to place piece #{toy_index} in orientation #{orientation} but it didn't work\" if $debug\n end\n end\n puts \"\\t\" * toy_index + \"Tried all possible orientations, moving to the next available head.\" if $debug\n end\n puts \"\\t\" * toy_index + \"Tried all available heads. Recurse back from piece #{toy_index} to piece #{toy_index - 1}.\" if $debug\nend",
"def partially_order(graph)\n # Create a work list of the fixed nodes.\n\n to_sequence = graph.all_nodes.select(&:fixed?)\n\n # Keep going until the work list is empty.\n\n until to_sequence.empty?\n node = to_sequence.shift\n\n # We're only interested in the control inputs to the node.\n\n control_input_nodes = node.inputs.control_edges.from_nodes\n\n # Nodes with no control input (such as start but possibly others) have sequence number zero.\n\n if control_input_nodes.empty?\n node.props[:sequence] = 0\n next\n end\n\n # If all control inputs have been given a sequence, we can give this\n # node as at least one greater than all of those.\n\n if control_input_nodes.all? { |i| i.props[:sequence] }\n node.props[:sequence] = control_input_nodes.map { |i| i.props[:sequence] }.max + 1\n next\n end\n\n # If all the control inputs haven't been given a sequence number yet\n # then put it back on the work list and come back to it later.\n\n to_sequence.push node\n end\n end",
"def on_flow(node)\n # Pre-process the AST for # of occurences of each run-flag used\n t = ExtractRunFlagTable.new\n t.process(node)\n @run_flag_table = t.run_flag_table\n\n name, *nodes = *node\n results = []\n node_a = nil\n nodes.each do |node_b|\n if node_a && node_a.type == :test && node_b.type == :run_flag\n result, node_a = remove_run_flag(node_a, node_b)\n results << result\n else\n results << node_a unless node_a.nil?\n node_a = node_b\n end\n end\n results << node_a unless node_a.nil?\n node.updated(nil, [name] + results)\n end",
"def actual_flow_control\n super\n end",
"def precheck\n end",
"def misty ci, &blk\n begin\n print 'stack: '; p ci.ctx.stack\n puts 'vars: '; p ci.ctx.vars\n print 'next instruction: '; p ci.peek\n gets\n ci.step\n rescue HaltState\n puts 'halted'\n rescue OpcodeError => err\n puts err.message\n end\nend",
"def rewrite_tree_block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 34)\n return_value = RewriteTreeBlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n char_literal154 = nil\n rewrite_tree_alternative153 = nil\n\n tree_for_lp = nil\n tree_for_char_literal154 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__81\")\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__83\")\n stream_rewrite_tree_alternative = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rewrite_tree_alternative\")\n begin\n # at line 366:9: lp= '(' rewrite_tree_alternative ')'\n lp = match(T__81, TOKENS_FOLLOWING_T__81_IN_rewrite_tree_block_2596) \n if @state.backtracking == 0\n stream_T__81.add(lp)\n end\n @state.following.push(TOKENS_FOLLOWING_rewrite_tree_alternative_IN_rewrite_tree_block_2598)\n rewrite_tree_alternative153 = rewrite_tree_alternative\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree_alternative.add(rewrite_tree_alternative153.tree)\n end\n char_literal154 = match(T__83, TOKENS_FOLLOWING_T__83_IN_rewrite_tree_block_2600) \n if @state.backtracking == 0\n stream_T__83.add(char_literal154)\n end\n # AST Rewrite\n # elements: rewrite_tree_alternative\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 367:6: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] rewrite_tree_alternative EOB[$lp,\\\"EOB\\\"] )\n # at line 367:9: ^( BLOCK[$lp,\\\"BLOCK\\\"] rewrite_tree_alternative EOB[$lp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(BLOCK, lp, \"BLOCK\"), root_1)\n\n @adaptor.add_child(root_1, stream_rewrite_tree_alternative.next_tree)\n @adaptor.add_child(root_1, @adaptor.create!(EOB, lp, \"EOB\"))\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 34)\n\n end\n \n return return_value\n end",
"def first\n goto(0)\n end",
"def goto_if_defined\n <<-CODE\n next_int;\n t1 = stack_pop();\n if(t1 != Qundef) {\n c->ip = _int;\n cpu_cache_ip(c);\n }\n CODE\n end",
"def preprocess(&block); end",
"def misty ci, &blk\n print 'stack: '; p ci.ctx.stack\n puts 'vars: '; p ci.ctx.vars\n print 'next instruction: '; p ci.peek\n gets\n ci.step\nend",
"def expand_elses(branch); end",
"def expand_elses(branch); end",
"def rewrite_indirect_template_head\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 42)\n return_value = RewriteIndirectTemplateHeadReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n __ACTION184__ = nil\n char_literal185 = nil\n char_literal186 = nil\n char_literal188 = nil\n rewrite_template_args187 = nil\n\n tree_for_lp = nil\n tree_for_ACTION184 = nil\n tree_for_char_literal185 = nil\n tree_for_char_literal186 = nil\n tree_for_char_literal188 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__81\")\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__83\")\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ACTION\")\n stream_rewrite_template_args = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rewrite_template_args\")\n begin\n # at line 446:4: lp= '(' ACTION ')' '(' rewrite_template_args ')'\n lp = match(T__81, TOKENS_FOLLOWING_T__81_IN_rewrite_indirect_template_head_3026) \n if @state.backtracking == 0\n stream_T__81.add(lp)\n end\n __ACTION184__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_rewrite_indirect_template_head_3028) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION184__)\n end\n char_literal185 = match(T__83, TOKENS_FOLLOWING_T__83_IN_rewrite_indirect_template_head_3030) \n if @state.backtracking == 0\n stream_T__83.add(char_literal185)\n end\n char_literal186 = match(T__81, TOKENS_FOLLOWING_T__81_IN_rewrite_indirect_template_head_3032) \n if @state.backtracking == 0\n stream_T__81.add(char_literal186)\n end\n @state.following.push(TOKENS_FOLLOWING_rewrite_template_args_IN_rewrite_indirect_template_head_3034)\n rewrite_template_args187 = rewrite_template_args\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_template_args.add(rewrite_template_args187.tree)\n end\n char_literal188 = match(T__83, TOKENS_FOLLOWING_T__83_IN_rewrite_indirect_template_head_3036) \n if @state.backtracking == 0\n stream_T__83.add(char_literal188)\n end\n # AST Rewrite\n # elements: ACTION, rewrite_template_args\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 447:3: -> ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] ACTION rewrite_template_args )\n # at line 447:6: ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] ACTION rewrite_template_args )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(TEMPLATE, lp, \"TEMPLATE\"), root_1)\n\n @adaptor.add_child(root_1, stream_ACTION.next_node)\n @adaptor.add_child(root_1, stream_rewrite_template_args.next_tree)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 42)\n\n end\n \n return return_value\n end",
"def rewrite_tree_block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n return_value = RewriteTreeBlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n char_literal154 = nil\n rewrite_tree_alternative153 = nil\n\n tree_for_lp = nil\n tree_for_char_literal154 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__81\" )\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__83\" )\n stream_rewrite_tree_alternative = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rewrite_tree_alternative\" )\n begin\n # at line 357:9: lp= '(' rewrite_tree_alternative ')'\n lp = match( T__81, TOKENS_FOLLOWING_T__81_IN_rewrite_tree_block_2591 )\n if @state.backtracking == 0\n stream_T__81.add( lp )\n end\n @state.following.push( TOKENS_FOLLOWING_rewrite_tree_alternative_IN_rewrite_tree_block_2593 )\n rewrite_tree_alternative153 = rewrite_tree_alternative\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree_alternative.add( rewrite_tree_alternative153.tree )\n end\n char_literal154 = match( T__83, TOKENS_FOLLOWING_T__83_IN_rewrite_tree_block_2595 )\n if @state.backtracking == 0\n stream_T__83.add( char_literal154 )\n end\n # AST Rewrite\n # elements: rewrite_tree_alternative\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 358:6: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] rewrite_tree_alternative EOB[$lp,\\\"EOB\\\"] )\n # at line 358:9: ^( BLOCK[$lp,\\\"BLOCK\\\"] rewrite_tree_alternative EOB[$lp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( BLOCK, lp, \"BLOCK\" ), root_1 )\n\n @adaptor.add_child( root_1, stream_rewrite_tree_alternative.next_tree )\n @adaptor.add_child( root_1, @adaptor.create( EOB, lp, \"EOB\" ) )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n end\n \n return return_value\n end",
"def else!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n\n\n type = ELSE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 222:7: 'else'\n match( \"else\" )\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__, 44 )\n\n\n end",
"def t__47!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n\n\n type = T__47\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 24:9: '<'\n match( 0x3c )\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__, 18 )\n\n\n end",
"def t__53!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n\n\n\n type = T__53\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 30:9: '^'\n match( 0x5e )\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__, 24 )\n\n\n end",
"def solve_start(first)\n starting_edge = Edge.new(first,first,0, 0)\n @queue.push(starting_edge)\n solve(first)\n end",
"def first_step_dsnf(universe)\n is_done = false\n while not is_done\n is_done = true\n universe.each_with_index do |clause, index|\n right_sentence_current_clause = clause.right_sentence\n if right_sentence_current_clause.operator\n case right_sentence_current_clause.operator.type\n when :conjunction\n dsnf_rules_for_conjunction(clause, index, right_sentence_current_clause, universe)\n is_done = false\n\n # ******* NEW DSNF RULES FOR CONJUNCTION CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_dsnf_rules_for_conjunction()\n\n when :disjunction\n unless right_sentence_current_clause.right_sentence.is_literal?\n #IF THE RIGHT SENTENCE IS A LITERAL, WE FOLLOW THE RULE EXACTLY THE WAY IT APPEARS IN THE PAPER TAKING FIRST THE LEFT SENTENCE\n #AND THEN THE RIGHT SENTENCE AS ARGUMENT\n dsnf_rules_for_disjunction(clause, index, right_sentence_current_clause.left_sentence, right_sentence_current_clause.right_sentence, universe)\n is_done = false\n\n # ******* NEW DSNF RULES FOR DISJUNTION CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_dsnf_rules_for_disjunction()\n\n else\n #HOWEVER, THE RULE IS ASSOCIATIVE AND COMMUTATIVE. SO, IF THE LEFT SENTENCE IS THE LITERAL WE INVERT THE ORDER AND TAKE\n #FIRST THE RIGHT SENTENCE AND THEN THE LEFT SENTENCE AS ARGUMENT\n unless right_sentence_current_clause.left_sentence.is_literal?\n dsnf_rules_for_disjunction(clause, index, right_sentence_current_clause.right_sentence, right_sentence_current_clause.left_sentence, universe)\n is_done = false\n end\n end\n\n when :new_operator\n # ******* OR A NEW OPERATOR NOT USED BEFORE CAN BE ADDED - LIKE NEGATION FOR EXAMPLE *******\n\n # ******* AND A NEW SIMPLIFICATION RULE CAN BE ADDED TO THIS OPERATOR *******\n # ******* FOR EXAMPLE: *******\n dsnf_rules_for_new_operator()\n end\n end\n end\n end\n end",
"def head!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n type = HEAD\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 321:7: 'head'\n match( \"head\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end",
"def _branch_adjust(byte)\n -> { _eval_byte(byte) - 2 }\nend",
"def k_imprimir!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n\n\n type = K_IMPRIMIR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 373:3: ( 'puts' | 'print' | 'write' )\n # at line 373:3: ( 'puts' | 'print' | 'write' )\n alt_5 = 3\n look_5_0 = @input.peek( 1 )\n\n if ( look_5_0 == 0x70 )\n look_5_1 = @input.peek( 2 )\n\n if ( look_5_1 == 0x75 )\n alt_5 = 1\n elsif ( look_5_1 == 0x72 )\n alt_5 = 2\n else\n raise NoViableAlternative( \"\", 5, 1 )\n\n end\n elsif ( look_5_0 == 0x77 )\n alt_5 = 3\n else\n raise NoViableAlternative( \"\", 5, 0 )\n\n end\n case alt_5\n when 1\n # at line 373:4: 'puts'\n match( \"puts\" )\n\n\n when 2\n # at line 373:11: 'print'\n match( \"print\" )\n\n\n when 3\n # at line 373:19: 'write'\n match( \"write\" )\n\n\n end\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n\n end",
"def rewrite_indirect_template_head\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 42 )\n return_value = RewriteIndirectTemplateHeadReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n __ACTION184__ = nil\n char_literal185 = nil\n char_literal186 = nil\n char_literal188 = nil\n rewrite_template_args187 = nil\n\n tree_for_lp = nil\n tree_for_ACTION184 = nil\n tree_for_char_literal185 = nil\n tree_for_char_literal186 = nil\n tree_for_char_literal188 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__81\" )\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__83\" )\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ACTION\" )\n stream_rewrite_template_args = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rewrite_template_args\" )\n begin\n # at line 437:4: lp= '(' ACTION ')' '(' rewrite_template_args ')'\n lp = match( T__81, TOKENS_FOLLOWING_T__81_IN_rewrite_indirect_template_head_3021 )\n if @state.backtracking == 0\n stream_T__81.add( lp )\n end\n __ACTION184__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_rewrite_indirect_template_head_3023 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION184__ )\n end\n char_literal185 = match( T__83, TOKENS_FOLLOWING_T__83_IN_rewrite_indirect_template_head_3025 )\n if @state.backtracking == 0\n stream_T__83.add( char_literal185 )\n end\n char_literal186 = match( T__81, TOKENS_FOLLOWING_T__81_IN_rewrite_indirect_template_head_3027 )\n if @state.backtracking == 0\n stream_T__81.add( char_literal186 )\n end\n @state.following.push( TOKENS_FOLLOWING_rewrite_template_args_IN_rewrite_indirect_template_head_3029 )\n rewrite_template_args187 = rewrite_template_args\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_template_args.add( rewrite_template_args187.tree )\n end\n char_literal188 = match( T__83, TOKENS_FOLLOWING_T__83_IN_rewrite_indirect_template_head_3031 )\n if @state.backtracking == 0\n stream_T__83.add( char_literal188 )\n end\n # AST Rewrite\n # elements: rewrite_template_args, ACTION\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 438:3: -> ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] ACTION rewrite_template_args )\n # at line 438:6: ^( TEMPLATE[$lp,\\\"TEMPLATE\\\"] ACTION rewrite_template_args )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( TEMPLATE, lp, \"TEMPLATE\" ), root_1 )\n\n @adaptor.add_child( root_1, stream_ACTION.next_node )\n @adaptor.add_child( root_1, stream_rewrite_template_args.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 42 )\n\n end\n \n return return_value\n end",
"def try!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n\n type = TRY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 180:7: 'try'\n match( \"try\" )\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__, 59 )\n\n end",
"def instruction\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n value = nil\n instruction_start_index = @input.index\n put_ingredient_into_mixing_bowl1 = nil\n liquefy_mixing_bowl2 = nil\n pour_contents_into_baking_dish3 = nil\n fold_ingredient_into_mixing_bowl4 = nil\n clean_the_mixing_bowl5 = nil\n take_ingredient_from_refrigerator6 = nil\n remove_ingredient_from_mixing_bowl7 = nil\n refrigerate_for_hours8 = nil\n add_ingredient_to_mixing_bowl9 = nil\n serve_with10 = nil\n mix_the_mixing_bowl_well11 = nil\n combine_ingredient_into_mixing_bowl12 = nil\n stir_mixing_bowl13 = nil\n stir_ingredient_into_the_mixing_bowl14 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return value\n end\n # at line 36:3: ( put_ingredient_into_mixing_bowl | liquefy_mixing_bowl | pour_contents_into_baking_dish | fold_ingredient_into_mixing_bowl | clean_the_mixing_bowl | take_ingredient_from_refrigerator | remove_ingredient_from_mixing_bowl | refrigerate_for_hours | add_ingredient_to_mixing_bowl | serve_with | set_aside | mix_the_mixing_bowl_well | combine_ingredient_into_mixing_bowl | divide_ingredient_into_mixing_bowl | stir_mixing_bowl | stir_ingredient_into_the_mixing_bowl )\n alt_1 = 16\n alt_1 = @dfa1.predict( @input )\n case alt_1\n when 1\n # at line 36:5: put_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_put_ingredient_into_mixing_bowl_IN_instruction_83 )\n put_ingredient_into_mixing_bowl1 = put_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = put_ingredient_into_mixing_bowl1\n \n # <-- action\n end\n\n when 2\n # at line 39:5: liquefy_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_liquefy_mixing_bowl_IN_instruction_91 )\n liquefy_mixing_bowl2 = liquefy_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = liquefy_mixing_bowl2\n \n # <-- action\n end\n\n when 3\n # at line 42:5: pour_contents_into_baking_dish\n @state.following.push( TOKENS_FOLLOWING_pour_contents_into_baking_dish_IN_instruction_99 )\n pour_contents_into_baking_dish3 = pour_contents_into_baking_dish\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = pour_contents_into_baking_dish3\n \n # <-- action\n end\n\n when 4\n # at line 45:5: fold_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_fold_ingredient_into_mixing_bowl_IN_instruction_107 )\n fold_ingredient_into_mixing_bowl4 = fold_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = fold_ingredient_into_mixing_bowl4\n \n # <-- action\n end\n\n when 5\n # at line 48:5: clean_the_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_clean_the_mixing_bowl_IN_instruction_115 )\n clean_the_mixing_bowl5 = clean_the_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = clean_the_mixing_bowl5\n \n # <-- action\n end\n\n when 6\n # at line 51:5: take_ingredient_from_refrigerator\n @state.following.push( TOKENS_FOLLOWING_take_ingredient_from_refrigerator_IN_instruction_123 )\n take_ingredient_from_refrigerator6 = take_ingredient_from_refrigerator\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = take_ingredient_from_refrigerator6\n \n # <-- action\n end\n\n when 7\n # at line 54:5: remove_ingredient_from_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_remove_ingredient_from_mixing_bowl_IN_instruction_131 )\n remove_ingredient_from_mixing_bowl7 = remove_ingredient_from_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = remove_ingredient_from_mixing_bowl7\n \n # <-- action\n end\n\n when 8\n # at line 57:5: refrigerate_for_hours\n @state.following.push( TOKENS_FOLLOWING_refrigerate_for_hours_IN_instruction_139 )\n refrigerate_for_hours8 = refrigerate_for_hours\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = refrigerate_for_hours8\n \n # <-- action\n end\n\n when 9\n # at line 60:5: add_ingredient_to_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_add_ingredient_to_mixing_bowl_IN_instruction_147 )\n add_ingredient_to_mixing_bowl9 = add_ingredient_to_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = add_ingredient_to_mixing_bowl9\n \n # <-- action\n end\n\n when 10\n # at line 63:5: serve_with\n @state.following.push( TOKENS_FOLLOWING_serve_with_IN_instruction_155 )\n serve_with10 = serve_with\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = serve_with10\n \n # <-- action\n end\n\n when 11\n # at line 66:5: set_aside\n @state.following.push( TOKENS_FOLLOWING_set_aside_IN_instruction_163 )\n set_aside\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = $serve_with.value\n \n # <-- action\n end\n\n when 12\n # at line 69:5: mix_the_mixing_bowl_well\n @state.following.push( TOKENS_FOLLOWING_mix_the_mixing_bowl_well_IN_instruction_171 )\n mix_the_mixing_bowl_well11 = mix_the_mixing_bowl_well\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = mix_the_mixing_bowl_well11\n \n # <-- action\n end\n\n when 13\n # at line 72:5: combine_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_combine_ingredient_into_mixing_bowl_IN_instruction_179 )\n combine_ingredient_into_mixing_bowl12 = combine_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = combine_ingredient_into_mixing_bowl12\n \n # <-- action\n end\n\n when 14\n # at line 75:5: divide_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_divide_ingredient_into_mixing_bowl_IN_instruction_187 )\n divide_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = $stir_ingredient_into_the_mixing_bowl.value\n \n # <-- action\n end\n\n when 15\n # at line 78:5: stir_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_stir_mixing_bowl_IN_instruction_195 )\n stir_mixing_bowl13 = stir_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = stir_mixing_bowl13\n \n # <-- action\n end\n\n when 16\n # at line 81:5: stir_ingredient_into_the_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_stir_ingredient_into_the_mixing_bowl_IN_instruction_203 )\n stir_ingredient_into_the_mixing_bowl14 = stir_ingredient_into_the_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = stir_ingredient_into_the_mixing_bowl14\n \n # <-- action\n end\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n memoize( __method__, instruction_start_index, success ) if @state.backtracking > 0\n\n end\n \n return value\n end",
"def refrigerate\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 36 )\n refrigerate_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 319:5: ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'F' | 'f' ) ( 'R' | 'r' ) ( 'I' | 'i' ) ( 'G' | 'g' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'E' | 'e' )\n if @input.peek( 1 ).between?( T__20, T__21 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__28, T__29 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__30, T__31 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__20, T__21 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__24, T__25 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__56, T__57 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__28, T__29 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__20, T__21 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__48, T__49 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__16, T__17 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__28, T__29 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 36 )\n memoize( __method__, refrigerate_start_index, success ) if @state.backtracking > 0\n\n end\n \n return \n end",
"def transition_from_pending\n if requires_transcoding?\n enter_transcoding\n elsif requires_post_processing?\n enter_post_processing\n else\n enter_conformance_checking\n end\n end",
"def k_begin!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 55 )\n\n\n\n type = K_BEGIN\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 473:3: 'begin'\n match( \"begin\" )\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__, 55 )\n\n\n end",
"def step\n log_iteration_start\n\n\n @current_task = tasks_list.shift\n status.no_tasks! and return unless current_task #empty tasks list\n\n solve_current_task\n\n return unless current_basis_plan # no optimal plan, so we don't change record and continue\n\n if current_target_function <= record # not interested as previsous record is higher\n status.target_less_than_record!\n elsif task.satisfies_integer?(current_basis_plan)\n change_record\n else\n split_current_task\n end\n log_status\n end",
"def prepare_to_check_solve(fake_value = 0.01)\n 2.times do\n find_max_values(end_layer_sum).each do |max_value|\n log format('faking values: %d-%x', end_layer_sum, max_value)\n vbyte_reader = VByteReader.new(\n layer_part_pathname(end_layer_sum, max_value)\n )\n @solver.generate_values_for_check(\n vbyte_reader,\n fake_value,\n new_solution(end_layer_sum, max_value).values.to_s\n )\n end\n @end_layer_sum -= 2\n end\n end",
"def if!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n\n\n\n type = IF\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 26:5: 'si'\n match( \"si\" )\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__, 5 )\n\n\n end",
"def root!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 5)\n\n type = ROOT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 11:8: '^'\n match(?^)\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__, 5)\n\n end",
"def resolve_rule rule, node\n puts \" apply #{rule} at #{node}\"\n case rule\n when Optional\n rules = rule.rules.dup\n return true if rules.empty? # TODO warn about empty?\n context = nil\n callcc {|cc| context = cc}\n return false if rules.empty?\n add_backtrack context, \"#{rule} : #{rules}\"\n resolve_impl rules.shift, node\n when Concat\n rule.rules.each do |r_id|\n node = resolve_impl r_id, node\n return false if node == false\n end\n node\n when Repeat\n (0..rule.min-1).each do\n node = resolve_impl rule.rule, node\n return false if node == false\n end\n nodes = [node]\n (0..rule.max-1).each do\n node = resolve_impl rule.rule, node\n break if node == false\n nodes.push node\n # TODO warn if no consuming?\n end\n context = nil\n callcc {|cc| context = cc}\n return false if nodes.empty?\n add_backtrack context, \"#{rule} : #{nodes}\"\n nodes.pop\n=begin\nTODO add cardinality depending on number of candidates?\nTODO make that the node return is the next...\n when OnCandidates\n nodes = rule.generator.call node\n return false if nodes.empty?\n context = nil\n callcc {|cc| context = cc}\n return false if nodes.empty?\n add_backtrack context, \"#{rule} : #{nodes}\"\n resolve_impl rule.rule, nodes.shift\n=end\n when Empty\n node\n when FinalNode\n node == nil ? nil : false\n when String\n resolve_impl rule, node\n else\n raise ArgumentError, \"invalid rule #{rule}\"\n return false\n end\n end",
"def next_hack(n)\n return n.next if hack? n.next\n next_hack n.next\nend",
"def exec_fix\n super\n end",
"def ignorable_nl!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 106 )\n\n \n # - - - - main rule block - - - -\n # at line 948:3: ( '//' (~ ( '\\\\n' | '\\\\r' ) )* ( ( '\\\\r' )? '\\\\n' )? | '/*' ( . )* '*/' | ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\n' | '\\\\r' )+ )\n alt_50 = 3\n look_50_0 = @input.peek( 1 )\n\n if ( look_50_0 == 0x2f )\n look_50_1 = @input.peek( 2 )\n\n if ( look_50_1 == 0x2f )\n alt_50 = 1\n elsif ( look_50_1 == 0x2a )\n alt_50 = 2\n else\n raise NoViableAlternative( \"\", 50, 1 )\n end\n elsif ( look_50_0.between?( 0x9, 0xa ) || look_50_0.between?( 0xc, 0xd ) || look_50_0 == 0x20 || look_50_0 == 0xa0 )\n alt_50 = 3\n else\n raise NoViableAlternative( \"\", 50, 0 )\n end\n case alt_50\n when 1\n # at line 948:5: '//' (~ ( '\\\\n' | '\\\\r' ) )* ( ( '\\\\r' )? '\\\\n' )?\n match( \"//\" )\n # at line 948:10: (~ ( '\\\\n' | '\\\\r' ) )*\n while true # decision 45\n alt_45 = 2\n look_45_0 = @input.peek( 1 )\n\n if ( look_45_0.between?( 0x0, 0x9 ) || look_45_0.between?( 0xb, 0xc ) || look_45_0.between?( 0xe, 0xffff ) )\n alt_45 = 1\n\n end\n case alt_45\n when 1\n # at line 948:10: ~ ( '\\\\n' | '\\\\r' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 45\n end\n end # loop for decision 45\n # at line 948:28: ( ( '\\\\r' )? '\\\\n' )?\n alt_47 = 2\n look_47_0 = @input.peek( 1 )\n\n if ( look_47_0 == 0xa || look_47_0 == 0xd )\n alt_47 = 1\n end\n case alt_47\n when 1\n # at line 948:30: ( '\\\\r' )? '\\\\n'\n # at line 948:30: ( '\\\\r' )?\n alt_46 = 2\n look_46_0 = @input.peek( 1 )\n\n if ( look_46_0 == 0xd )\n alt_46 = 1\n end\n case alt_46\n when 1\n # at line 948:30: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n end\n\n when 2\n # at line 949:5: '/*' ( . )* '*/'\n match( \"/*\" )\n # at line 949:10: ( . )*\n while true # decision 48\n alt_48 = 2\n look_48_0 = @input.peek( 1 )\n\n if ( look_48_0 == 0x2a )\n look_48_1 = @input.peek( 2 )\n\n if ( look_48_1 == 0x2f )\n alt_48 = 2\n elsif ( look_48_1.between?( 0x0, 0x2e ) || look_48_1.between?( 0x30, 0xffff ) )\n alt_48 = 1\n\n end\n elsif ( look_48_0.between?( 0x0, 0x29 ) || look_48_0.between?( 0x2b, 0xffff ) )\n alt_48 = 1\n\n end\n case alt_48\n when 1\n # at line 949:10: .\n match_any\n\n else\n break # out of loop for decision 48\n end\n end # loop for decision 48\n match( \"*/\" )\n\n when 3\n # at line 950:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\n' | '\\\\r' )+\n # at file 950:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\n' | '\\\\r' )+\n match_count_49 = 0\n while true\n alt_49 = 2\n look_49_0 = @input.peek( 1 )\n\n if ( look_49_0.between?( 0x9, 0xa ) || look_49_0.between?( 0xc, 0xd ) || look_49_0 == 0x20 || look_49_0 == 0xa0 )\n alt_49 = 1\n\n end\n case alt_49\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek( 1 ).between?( 0xc, 0xd ) || @input.peek(1) == 0x20 || @input.peek(1) == 0xa0\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_49 > 0 and break\n eee = EarlyExit(49)\n\n\n raise eee\n end\n match_count_49 += 1\n end\n\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 106 )\n\n end",
"def rewrite_tree_element\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 36)\n return_value = RewriteTreeElementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n rewrite_tree_atom156 = nil\n rewrite_tree_atom157 = nil\n ebnf_suffix158 = nil\n rewrite_tree159 = nil\n ebnf_suffix160 = nil\n rewrite_tree_ebnf161 = nil\n\n stream_rewrite_tree = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rewrite_tree\")\n stream_rewrite_tree_atom = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rewrite_tree_atom\")\n stream_ebnf_suffix = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule ebnf_suffix\")\n begin\n # at line 375:2: ( rewrite_tree_atom | rewrite_tree_atom ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | rewrite_tree ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree ) | rewrite_tree_ebnf )\n alt_76 = 4\n alt_76 = @dfa76.predict(@input)\n case alt_76\n when 1\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 375:4: rewrite_tree_atom\n @state.following.push(TOKENS_FOLLOWING_rewrite_tree_atom_IN_rewrite_tree_element_2662)\n rewrite_tree_atom156 = rewrite_tree_atom\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, rewrite_tree_atom156.tree)\n end\n\n when 2\n # at line 376:4: rewrite_tree_atom ebnf_suffix\n @state.following.push(TOKENS_FOLLOWING_rewrite_tree_atom_IN_rewrite_tree_element_2667)\n rewrite_tree_atom157 = rewrite_tree_atom\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree_atom.add(rewrite_tree_atom157.tree)\n end\n @state.following.push(TOKENS_FOLLOWING_ebnf_suffix_IN_rewrite_tree_element_2669)\n ebnf_suffix158 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add(ebnf_suffix158.tree)\n end\n # AST Rewrite\n # elements: ebnf_suffix, rewrite_tree_atom\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 377:3: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 377:6: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_ebnf_suffix.next_node(), root_1)\n\n # at line 377:21: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(BLOCK, \"BLOCK\"), root_2)\n\n # at line 377:38: ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list!\n root_3 = @adaptor.become_root(@adaptor.create!(ALT, \"ALT\"), root_3)\n\n @adaptor.add_child(root_3, stream_rewrite_tree_atom.next_tree)\n @adaptor.add_child(root_3, @adaptor.create!(EOA, \"EOA\"))\n\n @adaptor.add_child(root_2, root_3)\n @adaptor.add_child(root_2, @adaptor.create!(EOB, \"EOB\"))\n\n @adaptor.add_child(root_1, root_2)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n # at line 378:6: rewrite_tree ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree )\n @state.following.push(TOKENS_FOLLOWING_rewrite_tree_IN_rewrite_tree_element_2703)\n rewrite_tree159 = rewrite_tree\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree.add(rewrite_tree159.tree)\n end\n # at line 379:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree )\n alt_75 = 2\n look_75_0 = @input.peek(1)\n\n if (look_75_0 == T__74 || look_75_0.between?(T__91, T__92)) \n alt_75 = 1\n elsif (look_75_0 == EOF || look_75_0 == TREE_BEGIN || look_75_0 == REWRITE || look_75_0.between?(TOKEN_REF, ACTION) || look_75_0 == RULE_REF || look_75_0 == T__71 || look_75_0.between?(T__81, T__83) || look_75_0 == T__93) \n alt_75 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 75, 0)\n raise nvae\n end\n case alt_75\n when 1\n # at line 379:5: ebnf_suffix\n @state.following.push(TOKENS_FOLLOWING_ebnf_suffix_IN_rewrite_tree_element_2709)\n ebnf_suffix160 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add(ebnf_suffix160.tree)\n end\n # AST Rewrite\n # elements: rewrite_tree, ebnf_suffix\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 380:4: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 380:7: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_ebnf_suffix.next_node(), root_1)\n\n # at line 380:21: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(BLOCK, \"BLOCK\"), root_2)\n\n # at line 380:38: ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list!\n root_3 = @adaptor.become_root(@adaptor.create!(ALT, \"ALT\"), root_3)\n\n @adaptor.add_child(root_3, stream_rewrite_tree.next_tree)\n @adaptor.add_child(root_3, @adaptor.create!(EOA, \"EOA\"))\n\n @adaptor.add_child(root_2, root_3)\n @adaptor.add_child(root_2, @adaptor.create!(EOB, \"EOB\"))\n\n @adaptor.add_child(root_1, root_2)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 381:5: \n # AST Rewrite\n # elements: rewrite_tree\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 381:5: -> rewrite_tree\n @adaptor.add_child(root_0, stream_rewrite_tree.next_tree)\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 4\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 383:6: rewrite_tree_ebnf\n @state.following.push(TOKENS_FOLLOWING_rewrite_tree_ebnf_IN_rewrite_tree_element_2755)\n rewrite_tree_ebnf161 = rewrite_tree_ebnf\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, rewrite_tree_ebnf161.tree)\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 36)\n\n end\n \n return return_value\n end",
"def prestart ( )\n reset( )\n @matchstate[:state] = 0\n @chain = [ @states[0], ]\n end",
"def t__53!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 42 )\n\n type = T__53\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 58:9: 'b'\n match( 0x62 )\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__, 42 )\n\n end",
"def first_pass\n found_end = false\n \n File.open(@tas_path, \"r\") do |file| \n while (line = file.gets)\n line.chomp!\n \n code = {}\n code[:line] = line\n code[:line_counter] = @line_counter\n \n tokens = line.strip.split(/\\s+/)\n first = tokens.first \n \n if (first.match(/^\\w+:$/))\n handle_label(tokens, code)\n elsif (first == 'END')\n found_end = true\n break\n elsif (first != 'REM')\n handle_opcode(tokens, code)\n end\n \n @instructions.push(code) \n @line_counter = @line_counter.next \n end\n end\n \n @warnings.push(\"END directive not found\") if (!found_end)\n \n if (@errors.empty?)\n second_pass\n else\n write_lis\n puts \"Errors encountered on first pass, .obj file not created. See .lis file for details\"\n end\n end",
"def jump_forever\n jump_to_negative_relative_offset(current_assembly_position)\n end",
"def sIf\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n begin\n # at line 45:11: IF LPAR comp RPAR bloq ( ELSE bloq )?\n match( IF, TOKENS_FOLLOWING_IF_IN_sIf_333 )\n match( LPAR, TOKENS_FOLLOWING_LPAR_IN_sIf_335 )\n @state.following.push( TOKENS_FOLLOWING_comp_IN_sIf_337 )\n comp\n @state.following.pop\n match( RPAR, TOKENS_FOLLOWING_RPAR_IN_sIf_339 )\n # --> action\n agc_4('if')\n # <-- action\n @state.following.push( TOKENS_FOLLOWING_bloq_IN_sIf_343 )\n bloq\n @state.following.pop\n # --> action\n agc_5('if')\n # <-- action\n # --> action\n agc_4('else')\n # <-- action\n # at line 45:78: ( ELSE bloq )?\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0 == ELSE )\n alt_9 = 1\n end\n case alt_9\n when 1\n # at line 45:79: ELSE bloq\n match( ELSE, TOKENS_FOLLOWING_ELSE_IN_sIf_350 )\n @state.following.push( TOKENS_FOLLOWING_bloq_IN_sIf_352 )\n bloq\n @state.following.pop\n\n end\n # --> action\n agc_5('else')\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n end\n \n return \n end",
"def on_begin(node)\n child, other_children = *node.children\n\n # Not sure if this can happen in an `if` statement\n raise LogicError if other_children\n\n case @truth.fetch(child, process(child))\n when :true\n :true\n when :false\n :false\n else\n nil\n end\n end",
"def parse_root\n s0 = @scanner.pos\n s1 = []\n s2 = parse_header\n while s2 != :failed\n s1 << s2\n s2 = parse_header\n end\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s2 = parse_initialboard\n s2 = nil if s2 == :failed\n s3 = []\n s4 = parse_header\n while s4 != :failed\n s3 << s4\n s4 = parse_header\n end\n s4 = parse_moves\n if s4 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s5 = []\n s6 = parse_fork\n while s6 != :failed\n s5 << s6\n s6 = parse_fork\n end\n @reported_pos = s0\n s0 = transform_root(s1, s2, s3, s4, s5)\n end\n end\n s0\n end",
"def propagate_defs(defs, rin, rmid, rout, node)\n # Definitions that reach node entry are those that reach exit\n # of any of its predecessors\n new_node_rin = node.pr.inject(Set[]) {|s,cp| s | (rout[cp] || [])}\n # Definitions that reach inside of the node are either those that\n # reach its entry, or just the one that's defined in SSA-in, if any.\n if defs.include? [node, false]\n new_node_rmid = [[node, false]]\n else\n new_node_rmid = new_node_rin\n end\n # Definitions that reach exit of the node are either those that\n # reach its inside, or just the one that's defined by the inside, if any.\n if defs.include? [node, true]\n new_node_rout = [[node, true]]\n else\n new_node_rout = new_node_rmid\n end\n \n unless new_node_rin == rin[node] and new_node_rmid == rmid[node] and new_node_rout == rout[node]\n rin[node] = new_node_rin\n rmid[node] = new_node_rmid\n rout[node] = new_node_rout\n node.nx.each{|cp,phi_out|\n propagate_defs(defs, rin, rmid, rout, cp)\n }\n end\nend",
"def optimize_if_return(node = @prog)\n retry_flag = true\n while retry_flag\n retry_flag = false\n node.traverse(nil) {|st0, parent0|\n if st0.kind_of? ECMA262::StIf and parent0.kind_of? ECMA262::StatementList\n i = parent0.index(st0)\n break if i.nil?\n parent = parent0.deep_dup\n st = parent[i]\n #\n if parent[i+1].nil? and !parent.kind_of?(ECMA262::SourceElements)\n next\n end\n if parent[i+1].nil? or parent[i+1].to_return?\n s = st\n while s.kind_of? ECMA262::StIf and s.else_st and s.then_st.to_return?\n s = s.else_st\n end\n if s and s.kind_of? ECMA262::StIf and s.then_st.to_return?\n if parent[i+1]\n s.replace(s.else_st, parent[i+1])\n parent.replace(parent[i+1], ECMA262::StEmpty.new)\n else\n s.replace(s.else_st, ECMA262::StReturn.new(ECMA262::ExpVoid.new(ECMA262::ECMA262Numeric.new(0))))\n end\n if_to_cond(parent)\n if parent.to_js(:no_debug => true).length <= parent0.to_js(:no_debug => true).length\n parent0.replace(st0, st)\n if parent[i+1]\n parent0.replace(parent0[i+1], ECMA262::StEmpty.new)\n end\n retry_flag = true\n node = parent0\n end\n end\n end\n end\n }\n end\n self\n end",
"def else_branch\n node_parts[-1]\n end",
"def else_branch\n node_parts[-1]\n end",
"def processing_instruction?; end",
"def processing_instruction?; end",
"def digito!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 73 )\n\n\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x660, 0x669 ) || @input.peek( 1 ).between?( 0x6f0, 0x6f9 ) || @input.peek( 1 ).between?( 0x966, 0x96f ) || @input.peek( 1 ).between?( 0x9e6, 0x9ef ) || @input.peek( 1 ).between?( 0xa66, 0xa6f ) || @input.peek( 1 ).between?( 0xae6, 0xaef ) || @input.peek( 1 ).between?( 0xb66, 0xb6f ) || @input.peek( 1 ).between?( 0xbe7, 0xbef ) || @input.peek( 1 ).between?( 0xc66, 0xc6f ) || @input.peek( 1 ).between?( 0xce6, 0xcef ) || @input.peek( 1 ).between?( 0xd66, 0xd6f ) || @input.peek( 1 ).between?( 0xe50, 0xe59 ) || @input.peek( 1 ).between?( 0xed0, 0xed9 ) || @input.peek( 1 ).between?( 0x1040, 0x1049 )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 73 )\n\n\n end",
"def browser_block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n return_value = BrowserBlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal102 = nil\n string_literal105 = nil\n browser_name103 = nil\n statement_block104 = nil\n block106 = nil\n\n tree_for_char_literal102 = nil\n tree_for_string_literal105 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 417:5: '!' browser_name statement_block ( 'else' block )?\n char_literal102 = match( NOT, TOKENS_FOLLOWING_NOT_IN_browser_block_2757 )\n if @state.backtracking == 0\n\n tree_for_char_literal102 = @adaptor.create_with_payload( char_literal102 )\n @adaptor.add_child( root_0, tree_for_char_literal102 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_browser_name_IN_browser_block_2759 )\n browser_name103 = browser_name\n @state.following.pop\n if @state.backtracking == 0\n root_0 = @adaptor.become_root( browser_name103.tree, root_0 )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_browser_block_2762 )\n statement_block104 = statement_block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, statement_block104.tree )\n end\n # at line 417:39: ( 'else' block )?\n alt_20 = 2\n look_20_0 = @input.peek( 1 )\n\n if ( look_20_0 == ELSE )\n alt_20 = 1\n end\n case alt_20\n when 1\n # at line 417:41: 'else' block\n string_literal105 = match( ELSE, TOKENS_FOLLOWING_ELSE_IN_browser_block_2766 )\n @state.following.push( TOKENS_FOLLOWING_block_IN_browser_block_2769 )\n block106 = block\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, block106.tree )\n end\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 26 )\n\n end\n \n return return_value\n end",
"def backtrack!(nodes)\n while true\n return nil if nodes.empty? # backtracked back to 0, so we are done\n \n # We tried nodes.last and it didn't work, so\n # pop it off and uncover the corresponding columns.\n node = nodes.pop\n node.unchoose_except_self_column\n \n # Try the next node in this column.\n x = node.down\n\n return x unless x.is_a? Column\n \n # Our downwards iteration has gone full-circle\n # back to the column object where it started.\n x.uncover # Uncover the column.\n end\n end",
"def elseb\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n\n\n return_value = ElsebReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __K_ELSE116__ = nil\n __LLAIZQ117__ = nil\n __LLADER119__ = nil\n bodyexp118 = nil\n\n\n tree_for_K_ELSE116 = nil\n tree_for_LLAIZQ117 = nil\n tree_for_LLADER119 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 127:4: K_ELSE LLAIZQ bodyexp LLADER\n __K_ELSE116__ = match( K_ELSE, TOKENS_FOLLOWING_K_ELSE_IN_elseb_560 )\n if @state.backtracking == 0\n tree_for_K_ELSE116 = @adaptor.create_with_payload( __K_ELSE116__ )\n @adaptor.add_child( root_0, tree_for_K_ELSE116 )\n\n end\n\n __LLAIZQ117__ = match( LLAIZQ, TOKENS_FOLLOWING_LLAIZQ_IN_elseb_562 )\n if @state.backtracking == 0\n tree_for_LLAIZQ117 = @adaptor.create_with_payload( __LLAIZQ117__ )\n @adaptor.add_child( root_0, tree_for_LLAIZQ117 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_bodyexp_IN_elseb_564 )\n bodyexp118 = bodyexp\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bodyexp118.tree )\n end\n\n __LLADER119__ = match( LLADER, TOKENS_FOLLOWING_LLADER_IN_elseb_566 )\n if @state.backtracking == 0\n tree_for_LLADER119 = @adaptor.create_with_payload( __LLADER119__ )\n @adaptor.add_child( root_0, tree_for_LLADER119 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 24 )\n\n\n end\n\n return return_value\n end",
"def directive_line!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 107 )\n\n \n # - - - - main rule block - - - -\n # at line 956:5: ( IGNORABLE )* ( HIDE | REQUIRE ) ( IGNORABLE )* ( ( '\\\\r' )? '\\\\n' )?\n # at line 956:5: ( IGNORABLE )*\n while true # decision 51\n alt_51 = 2\n look_51_0 = @input.peek( 1 )\n\n if ( look_51_0 == 0x9 || look_51_0 == 0xc || look_51_0 == 0x20 || look_51_0 == 0x2f || look_51_0 == 0x5c || look_51_0 == 0xa0 )\n alt_51 = 1\n\n end\n case alt_51\n when 1\n # at line 956:5: IGNORABLE\n ignorable!\n\n else\n break # out of loop for decision 51\n end\n end # loop for decision 51\n # at line 957:5: ( HIDE | REQUIRE )\n alt_52 = 2\n look_52_0 = @input.peek( 1 )\n\n if ( look_52_0 == 0x68 )\n alt_52 = 1\n elsif ( look_52_0 == 0x69 || look_52_0 == 0x72 )\n alt_52 = 2\n else\n raise NoViableAlternative( \"\", 52, 0 )\n end\n case alt_52\n when 1\n # at line 957:7: HIDE\n hide!\n\n when 2\n # at line 958:7: REQUIRE\n require!\n\n end\n # at line 960:5: ( IGNORABLE )*\n while true # decision 53\n alt_53 = 2\n look_53_0 = @input.peek( 1 )\n\n if ( look_53_0 == 0x9 || look_53_0 == 0xc || look_53_0 == 0x20 || look_53_0 == 0x2f || look_53_0 == 0x5c || look_53_0 == 0xa0 )\n alt_53 = 1\n\n end\n case alt_53\n when 1\n # at line 960:5: IGNORABLE\n ignorable!\n\n else\n break # out of loop for decision 53\n end\n end # loop for decision 53\n # at line 961:5: ( ( '\\\\r' )? '\\\\n' )?\n alt_55 = 2\n look_55_0 = @input.peek( 1 )\n\n if ( look_55_0 == 0xa || look_55_0 == 0xd )\n alt_55 = 1\n end\n case alt_55\n when 1\n # at line 961:7: ( '\\\\r' )? '\\\\n'\n # at line 961:7: ( '\\\\r' )?\n alt_54 = 2\n look_54_0 = @input.peek( 1 )\n\n if ( look_54_0 == 0xd )\n alt_54 = 1\n end\n case alt_54\n when 1\n # at line 961:7: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n end\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 107 )\n\n end",
"def step\n instcode = @memory[@ip]\n raise \"nil opcode encountered\" if instcode.nil?\n\n opcode = instcode % 100\n argcount = ARGCOUNT[opcode] || 0\n addressing_modes = argcount.times.map { |ix| (instcode / (10 ** (ix + 2))) % 10 }\n args = addressing_modes.each_with_index.map do |am, ix|\n raw_arg = @memory[@ip + ix + 1]\n translate_arg(opcode, ix, raw_arg, am)\n end\n\n if TRACE\n STDERR.puts \"#{@id} @ip=#{@ip} @base=#{@base} inst=#{@memory[@ip..@ip+argcount].inspect} opcode=#{opcode} am=#{addressing_modes.inspect} args=#{args.inspect}\"\n end\n\n jump_target = nil\n case opcode\n when 1 # add\n @memory[args[2]] = args[0] + args[1]\n when 2 # mul\n @memory[args[2]] = args[0] * args[1]\n when 3 # in\n if @inputs.any?\n @memory[args[0]] = @inputs.shift\n else\n return :need_input\n end\n when 4 # out\n @outputs << args[0]\n when 5 # jnz\n jump_target = args[1] if args[0] != 0\n when 6 # jz\n jump_target = args[1] if args[0] == 0\n when 7 # lt\n @memory[args[2]] = (args[0] < args[1]) ? 1 : 0\n when 8 # eq\n @memory[args[2]] = (args[0] == args[1]) ? 1 : 0\n when 9 #base\n @base += args[0]\n when 99\n return nil\n else\n raise \"invalid opcode #{opcode} at position #{@ip}\"\n end\n\n if jump_target\n @ip = jump_target\n else\n @ip += argcount + 1\n end\n end",
"def rbrack!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n type = RBRACK\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 135:10: ']'\n match( 0x5d )\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__, 14 )\n\n end",
"def linearize(graph)\n # The basic blocks.\n blocks = []\n \n # Details of the basic block that contain the finish operation which\n # won't be added to the list of basic blocks until the end.\n first_node_last_block = nil\n last_block = nil\n \n # Two maps that help us map between nodes and the names of the blocks\n # that they go into, and the merge instruction indicies and the blocks\n # they're coming from.\n first_node_to_block_index = {}\n merge_index_to_first_node = {}\n\n # Look at each node that begins a basic block.\n\n basic_block_starters = graph.all_nodes.select { |n| n.begins_block? }\n\n last_basic_block_starter = basic_block_starters.select { |s| nodes_in_block(s).any? { |n| n.op == :finish } }.first\n\n basic_block_starters.delete last_basic_block_starter\n basic_block_starters.push last_basic_block_starter\n\n basic_block_starters.each do |node|\n original_first_node = node\n first_node = first_in_block(original_first_node, nodes_in_block(original_first_node))\n\n # We're going to create an array of operations for this basic\n # block.\n\n block = []\n next_to_last_control = nil\n\n # Follow the local sequence.\n\n node = first_node\n\n begin\n # We don't want to include operations that are just there to form\n # branches or anchor points in the graph such as start and merge.\n\n unless [:start, :merge].include?(node.op)\n op = node.op\n\n # We rename finish to return to match the switch from the\n # declarative style of the graph to the imperative style\n # of the list of operations.\n op = :return if op == :finish\n\n # The instruction begins with the operation.\n insn = [op]\n\n # Then any constant values or similar.\n [:line, :n, :value].each do |p|\n insn.push node.props[p] if node.props.has_key?(p)\n end\n\n # Then any input registers.\n node.inputs.with_input_name(:value).from_nodes.each do |input_values|\n insn.push input_values.props[:register]\n end\n\n # Phi instructions need pairs of source registers with the blocks they came from.\n if node.op == :phi\n node.inputs.edges.each do |input|\n if input.input_name =~ /^value\\((.+)\\)$/\n n = $1.to_i\n insn.push n\n insn.push input.from.props[:register]\n end\n end\n # Elide phi instructions if register allocation has run correctly and values are\n # already in the correct registers.\n insn = nil if insn.drop(2).select.with_index{ |_,i| i.even? }.uniq.size == 1\n end\n\n # Send instructions and lowered equivalents need the arguments.\n if [:send, :call_managed, :int64_add, :int64_sub, :int64_imul, :int64_and, :int64_shift_left, :int64_shift_right].include?(node.op)\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n if node.op == :send\n insn.push node.props[:name]\n elsif node.op == :call_managed\n insn.push node.inputs.with_input_name(:name).from_node.props[:register]\n end\n\n node.props[:argc].times do |n|\n arg = node.inputs.with_input_name(:\"arg(#{n})\").from_node\n\n if arg.op == :immediate\n insn.push arg.props[:value]\n else\n insn.push arg.props[:register]\n end\n end\n end\n\n # Then the target register if the instruction has one.\n insn.push node.props[:register] if insn && (node.produces_value? || node.op == :move)\n\n # If it's a branch then the target basic blocks and the test.\n if node.op == :branch\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n\n [:true, :false].each do |branch|\n target = node.outputs.with_output_name(branch).to_node\n raise unless target\n insn.push target\n end\n\n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Send instructions and lowered managed calls need the list of live registers.\n if [:send, :call_managed].include?(node.op)\n insn.push node.props[:live_registers]\n end\n \n # Guards are like branches, but only have one side.\n if node.op == :guard\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n \n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Kind instructions need the kind.\n if node.op == :kind_is?\n insn.push node.props[:kind]\n end\n \n # Frame states need the instructions, the ip, and to know where values are for\n # the receiver, the arguments, and the stack.\n if node.op == :deopt_map\n insn.push node.props[:insns]\n insn.push node.props[:ip]\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('arg(') }.map { |e|\n /arg\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('stack(') }.map { |e|\n /stack\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n end\n\n # Add the instruction to the block.\n block.push insn if insn\n end\n\n next_to_last_control = node if node.has_control_output?\n\n # Follow the local schedule edge to the next node.\n node = node.outputs.with_output_name(:local_schedule).to_nodes.first\n end while node && node.op != :merge\n\n # Empty blocks cause problems elsewhere - it's easier to just have a nop\n # in them. Really, we should remove empty blocks by modifying the\n # instruction that jumps here to jump to wherever this leads to.\n\n if block.empty?\n block.push [:nop]\n end\n\n # If the last node is a merge, we need to remember which merge index this is.\n\n if node && node.op == :merge\n next_to_last_control.outputs.with_output_name(:control).edges.first.input_name =~ /^control\\((.+)\\)$/\n n = $1.to_i\n merge_index_to_first_node[n] = first_node\n end\n\n # Add a jump instruction if this block was going to just flow into the next\n # - we'll remove it later if the block followed it anyway and we can just\n # fallthrough.\n\n unless [:return, :branch].include?(block.last.first)\n begin\n block.push [:jump, next_to_last_control.outputs.with_output_name(:control).to_node]\n rescue\n block.push [:jump, :broken]\n end\n end\n\n first_node_to_block_index[original_first_node] = blocks.size\n first_node_to_block_index[first_node] = blocks.size\n blocks.push block\n end\n\n # Record the number that this basic block has and then add it to the list of basic blocks.\n\n first_node_to_block_index[first_node_last_block] = blocks.size\n\n # Go back through the basic blocks and update some references that were to things that\n # hadn't been decided yet.\n\n blocks.each do |block|\n block.each do |insn|\n insn.map! do |e|\n # If part of an instruction references a basic block, turn that into the index of\n # the basic block instead.\n\n if e.is_a?(IR::Node)\n :\"block#{first_node_to_block_index[e]}\"\n else\n e\n end\n end\n end\n end\n\n # Go back through the basic blocks and change how the branch instructions out of them\n # work.\n\n blocks.each_with_index do |block, n|\n next_block = :\"block#{n + 1}\"\n last = block.last\n\n if last == [:jump, next_block]\n # A jump that just goes to the next block can be removed and left to fall through.\n block.pop\n elsif last.first == :branch && last[3] == next_block\n # A branch where the else goes to the next block can branch only when true.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n elsif last.first == :branch && last[2] == next_block\n # A branch where the if goes to the next block can branch only unless true.\n block.pop\n test = last.drop(4)\n block.push [:branch_unless, last[1], last[3], *test]\n elsif last.first == :branch\n # A branch that doesn't go to the next block at all can be a branch if true\n # and then fallthrough to a new jump instruction.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n block.push [:jump, last[3]]\n end\n end\n\n blocks\n end",
"def k_else!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 40 )\n\n\n\n type = K_ELSE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 413:4: 'else'\n match( \"else\" )\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__, 40 )\n\n\n end",
"def autocorrect(node)\n *, body = *node\n description = block_desc(body).first || desc(body).first\n return unless description\n\n MoveToTopCorrector.new(description, body, processed_source).correct\n end",
"def process\n return if @processed\n\n in_count = 0\n mark = -1\n start_of_chunk = -1\n last_of_chunk = -1\n chunk_name = ''\n chunk_loc = -1\n chunk_level = @define_hash[:register_level][:val]\n chunk_unused = @define_hash[:register_unused][:val]\n chunk_width = @define_hash[:register_width][:val]\n stack = [true]\n def_name = def_arg = def_rest = def_val = def_ref = def_kind = nil\n # true accepting input\n # false rejecting input\n # nil rejecting input due to nested #ifdef/#ifndef\n while in_count < @input.length\n l = input[in_count].chomp\n l_in_count = in_count\n while (in_count < @input.length) && (match = /\\\\[ \\t]*/.match(l))\n l[match.begin(0), match.end(0)] = @input[in_count].chomp # question: should we add a space before the next line?\n in_count += 1\n end\n skip = false\n #print \"in=#{in_count} out=#{@lines.length} mark=#{mark} start=#{start_of_chunk} '#{l}'\\n\"\n\n if /^#+[ \\t]/.match(l)\n mark = @lines.length\n elsif /^=+[ \\t]/.match(l)\n mark = @lines.length\n elsif (m = /^#define[ \\t]+(\\w+)[ \\t]*(\\([\\w, ]*\\))?[ \\t]+(.*)$/.match(l))\n def_name = m[1]\n def_arg = m[2]\n def_rest = m[3]\n if stack[-1]\n value = {}\n value[:arg] = def_arg.gsub(/[\\(\\)]/, '') if def_arg\n if def_rest && def_rest != '' # value and possibly ref\n if (m2 = /^(.*)[ \\t]+\\/\\*[ \\t]*([-A-Z0-9][- A-Z0-9]*)([-A-Z0-9])[ \\t]*\\*\\/[ \\t]*$/.match(def_rest)) # value and ref both present\n def_val = m2[1]\n def_ref = m2[2]\n def_kind = m2[3]\n value[:val] = def_val\n value[:ref] = def_ref + def_kind\n value[:kind] = def_kind\n @device_hash[def_name] = value if value[:kind] == 'D'\n @register_hash[def_name] = value if (value[:kind] == 'R' || value[:kind] == 'A')\n if /^[DRA]$/.match(value[:kind])\n if start_of_chunk >= 0 && last_of_chunk >= 0\n @chunks << {:start => start_of_chunk,\n :end => last_of_chunk,\n :key => chunk_loc,\n :name => chunk_name,\n :unused => chunk_unused,\n :level => chunk_level,\n :width => chunk_width}\n print \"chunk=#{@chunks[-1]}\\n\"\n end\n start_of_chunk = mark + 1\n chunk_name = def_name\n chunk_loc = @lines.length\n chunk_unused = @define_hash[:register_unused][:val]\n chunk_level = @define_hash[:register_level][:val]\n chunk_width = @define_hash[:register_width][:val]\n end\n last_of_chunk = @lines.length\n else\n value[:val] = def_rest # no ref present\n end\n end\n @define_hash[def_name] = value\n mark = @lines.length\n end\n\n elsif (m = /^#undef[ \\t]+(\\w+)[ \\t]*$/.match(l))\n def_name = m[1]\n @define_hash.delete(def_name) if stack[-1]\n\n elsif (m = /^#ifdef[ \\t]+(\\w+)[ \\t]*$/.match(l))\n def_name = m[1]\n if stack[-1].nil?\n stack.push(nil)\n else\n stack.push(@define_hash.has_key?(def_name))\n end\n skip = true\n\n elsif (m = /^#ifndef[ \\t]+(\\w+)[ \\t]*$/.match(l))\n def_name = m[1]\n if stack[-1].nil?\n stack.push(nil)\n else\n stack.push(!@define_hash.has_key?(def_name))\n end\n skip = true\n\n elsif /^#else[ \\t]*$/.match(l)\n if stack[-1] != nil\n stack[-1] = !stack[-1]\n end\n skip = true\n\n elsif /^#endif[ \\t]*$/.match(l)\n stack.pop if stack.length > 1\n skip = true\n end\n\n if stack[-1] && !skip\n @src_map[@lines.length] = l_in_count\n @lines << l\n end\n in_count += 1\n end\n\n if start_of_chunk > 0\n @chunks << {:start => start_of_chunk,\n :end => last_of_chunk,\n :key => chunk_loc,\n :name => chunk_name,\n :unused => chunk_unused,\n :level => chunk_level,\n :width => chunk_width}\n end\n @processed = true\n\n end",
"def verify\n insns[0...-1].each { |insn| raise unless insn.branch_targets.empty? }\n end",
"def correction_exceeds_line_limit?(node, branches); end",
"def archivo_compilado\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n\n return_value = ArchivoCompiladoReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n paquete1 = nil\n librerias2 = nil\n clase_interface_declaracion3 = nil\n\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 10:4: paquete ( librerias )* clase_interface_declaracion\n @state.following.push( TOKENS_FOLLOWING_paquete_IN_archivo_compilado_41 )\n paquete1 = paquete\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, paquete1.tree )\n end\n\n # at line 10:12: ( librerias )*\n while true # decision 1\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == K_REQUIRE )\n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 10:12: librerias\n @state.following.push( TOKENS_FOLLOWING_librerias_IN_archivo_compilado_43 )\n librerias2 = librerias\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, librerias2.tree )\n end\n\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n @state.following.push( TOKENS_FOLLOWING_clase_interface_declaracion_IN_archivo_compilado_46 )\n clase_interface_declaracion3 = clase_interface_declaracion\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, clase_interface_declaracion3.tree )\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n\n end\n return return_value\n end",
"def setup_cutin\n return unless PONY::ERRNO::check_sequence(current_act)\n #reserved\n end",
"def create_local_graph(block)\n block_flow = dfg.block_flows.fetch(block.id)\n\n # A map of instructions to nodes.\n insn_nodes = {}\n\n # Create a node for each instruction in the block.\n block.each_with_length do |insn, offset|\n node = InsnNode.new(insn, offset)\n insn_nodes[offset] = node\n nodes << node\n end\n\n # The first and last node in the sub-graph, and the last fixed node.\n previous_fixed = nil\n first_fixed = nil\n last_fixed = nil\n\n # The merge node for the phi nodes to attach to.\n merge_node = nil\n\n # If there is more than one predecessor and we have basic block\n # arguments coming in, then we need a merge node for the phi nodes to\n # attach to.\n if block.incoming_blocks.size > 1 && !block_flow.in.empty?\n merge_node = MergeNode.new(id_counter)\n nodes << merge_node\n\n previous_fixed = merge_node\n first_fixed = merge_node\n last_fixed = merge_node\n end\n\n # Connect local control flow (only nodes with side effects.)\n block.each_with_length do |insn, length|\n if insn.side_effects?\n insn_node = insn_nodes[length]\n connect previous_fixed, insn_node, :control if previous_fixed\n previous_fixed = insn_node\n first_fixed ||= insn_node\n last_fixed = insn_node\n end\n end\n\n # Connect basic block arguments.\n inputs = {}\n outputs = {}\n block_flow.in.each do |arg|\n # Each basic block argument gets a phi node. Even if there's only\n # one predecessor! We'll tidy this up later.\n phi = PhiNode.new(id_counter)\n connect(phi, merge_node, :info) if merge_node\n nodes << phi\n inputs[arg] = phi\n\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows[consumer_offset]\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer == arg\n connect(phi, insn_nodes[consumer_offset], :data, input_index)\n end\n end\n end\n\n block_flow.out.each { |out| outputs[out] = phi if out == arg }\n end\n\n # Connect local dataflow from consumers back to producers.\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows.fetch(consumer_offset)\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer.local?\n connect(\n insn_nodes[producer.length],\n insn_nodes[consumer_offset],\n :data,\n input_index\n )\n end\n end\n end\n\n # Connect dataflow from producers that leaves the block.\n block.each_with_length do |_, producer_pc|\n dfg\n .insn_flows\n .fetch(producer_pc)\n .out\n .each do |consumer|\n unless consumer.local?\n # This is an argument to the successor block - not to an\n # instruction here.\n outputs[consumer.name] = insn_nodes[producer_pc]\n end\n end\n end\n\n # A graph with only side-effect free instructions will currently have\n # no fixed nodes! In that case just use the first instruction's node\n # for both first and last. But it's a bug that it'll appear in the\n # control flow path!\n SubGraph.new(\n first_fixed || insn_nodes[block.block_start],\n last_fixed || insn_nodes[block.block_start],\n inputs,\n outputs\n )\n end",
"def fix_input_line\n @input_line\n end",
"def t__88!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 33)\n\n type = T__88\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 39:9: '<'\n match(?<)\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__, 33)\n\n end",
"def setup_branch\n return unless PONY::ERRNO::check_sequence(current_act)\n act_true = @acts[2]\n act_false = @acts[3]\n bool = false\n \n begin # Test the script call condition\n bool = eval(@acts[1])\n rescue StandardError => err\n PONY::ERRNO.sequence_error(:eval, err)\n end\n act_result = (bool ? act_true : (!act_false.nil? ? act_false: nil))\n if act_result\n is_array = act_result.is_a?(Array)\n if is_array && act_result[0].is_a?(Array)\n act_result.each do |action|\n next unless action.is_a?(Array)\n @acts = action\n execute_act\n end\n elsif is_array\n @acts = act_result\n execute_act\n else\n @acts = [:action, act_result]\n execute_act\n end\n end\n \n end",
"def nip_it_in_the_bud\n while has_bud?(@sequence) do\n @sequence.shift\n @sequence.each { |entry| entry.level -= 1 }\n end\n end",
"def dif!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n\n\n type = DIF\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 55:6: '<>'\n match( \"<>\" )\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__, 34 )\n\n\n end",
"def rewrite_tree_element\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 36 )\n return_value = RewriteTreeElementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n rewrite_tree_atom156 = nil\n rewrite_tree_atom157 = nil\n ebnf_suffix158 = nil\n rewrite_tree159 = nil\n ebnf_suffix160 = nil\n rewrite_tree_ebnf161 = nil\n\n stream_rewrite_tree = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rewrite_tree\" )\n stream_rewrite_tree_atom = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rewrite_tree_atom\" )\n stream_ebnf_suffix = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule ebnf_suffix\" )\n begin\n # at line 366:2: ( rewrite_tree_atom | rewrite_tree_atom ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | rewrite_tree ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree ) | rewrite_tree_ebnf )\n alt_76 = 4\n alt_76 = @dfa76.predict( @input )\n case alt_76\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 366:4: rewrite_tree_atom\n @state.following.push( TOKENS_FOLLOWING_rewrite_tree_atom_IN_rewrite_tree_element_2657 )\n rewrite_tree_atom156 = rewrite_tree_atom\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, rewrite_tree_atom156.tree )\n end\n\n when 2\n # at line 367:4: rewrite_tree_atom ebnf_suffix\n @state.following.push( TOKENS_FOLLOWING_rewrite_tree_atom_IN_rewrite_tree_element_2662 )\n rewrite_tree_atom157 = rewrite_tree_atom\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree_atom.add( rewrite_tree_atom157.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_ebnf_suffix_IN_rewrite_tree_element_2664 )\n ebnf_suffix158 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add( ebnf_suffix158.tree )\n end\n # AST Rewrite\n # elements: ebnf_suffix, rewrite_tree_atom\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 368:3: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 368:6: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ebnf_suffix.next_node, root_1 )\n\n # at line 368:21: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( BLOCK, \"BLOCK\" ), root_2 )\n\n # at line 368:38: ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list\n root_3 = @adaptor.become_root( @adaptor.create( ALT, \"ALT\" ), root_3 )\n\n @adaptor.add_child( root_3, stream_rewrite_tree_atom.next_tree )\n @adaptor.add_child( root_3, @adaptor.create( EOA, \"EOA\" ) )\n\n @adaptor.add_child( root_2, root_3 )\n @adaptor.add_child( root_2, @adaptor.create( EOB, \"EOB\" ) )\n\n @adaptor.add_child( root_1, root_2 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n # at line 369:6: rewrite_tree ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree )\n @state.following.push( TOKENS_FOLLOWING_rewrite_tree_IN_rewrite_tree_element_2698 )\n rewrite_tree159 = rewrite_tree\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree.add( rewrite_tree159.tree )\n end\n # at line 370:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree )\n alt_75 = 2\n look_75_0 = @input.peek( 1 )\n\n if ( look_75_0 == T__74 || look_75_0.between?( T__91, T__92 ) )\n alt_75 = 1\n elsif ( look_75_0 == EOF || look_75_0 == TREE_BEGIN || look_75_0 == REWRITE || look_75_0.between?( TOKEN_REF, ACTION ) || look_75_0 == RULE_REF || look_75_0 == T__71 || look_75_0.between?( T__81, T__83 ) || look_75_0 == T__93 )\n alt_75 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 75, 0 )\n end\n case alt_75\n when 1\n # at line 370:5: ebnf_suffix\n @state.following.push( TOKENS_FOLLOWING_ebnf_suffix_IN_rewrite_tree_element_2704 )\n ebnf_suffix160 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add( ebnf_suffix160.tree )\n end\n # AST Rewrite\n # elements: ebnf_suffix, rewrite_tree\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 371:4: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 371:7: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ebnf_suffix.next_node, root_1 )\n\n # at line 371:21: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( BLOCK, \"BLOCK\" ), root_2 )\n\n # at line 371:38: ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list\n root_3 = @adaptor.become_root( @adaptor.create( ALT, \"ALT\" ), root_3 )\n\n @adaptor.add_child( root_3, stream_rewrite_tree.next_tree )\n @adaptor.add_child( root_3, @adaptor.create( EOA, \"EOA\" ) )\n\n @adaptor.add_child( root_2, root_3 )\n @adaptor.add_child( root_2, @adaptor.create( EOB, \"EOB\" ) )\n\n @adaptor.add_child( root_1, root_2 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 372:5: \n # AST Rewrite\n # elements: rewrite_tree\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 372:5: -> rewrite_tree\n @adaptor.add_child( root_0, stream_rewrite_tree.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 374:6: rewrite_tree_ebnf\n @state.following.push( TOKENS_FOLLOWING_rewrite_tree_ebnf_IN_rewrite_tree_element_2750 )\n rewrite_tree_ebnf161 = rewrite_tree_ebnf\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, rewrite_tree_ebnf161.tree )\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 36 )\n\n end\n \n return return_value\n end",
"def candidate_block(block)\n return unless (my_index = block.parent.blocks.find_index block)\n\n next_block = block.parent.blocks[my_index + 1]\n return unless next_block && next_block.context == :pass\n\n next_block\n end",
"def prioritize_rules()\n \n #\n # Process all :reorder_specs. The top row of each table form roots of the DAG.\n # We test for cycles as we go -- there can't be any. \n \n root_sets = []\n hierarchy = Util::DirectedAcyclicGraph.new( false )\n @reorder_specs.each do |spec|\n previous_level = []\n spec.reorder_levels.each do |level|\n \n #\n # Collect rule reference TO RULES IN THIS GRAMMAR ONLY. Rule priority is about\n # rule production. A grammar can use rules from other grammars, but can't PRODUCE\n # rules from other grammars, so local rules only need apply. This is only an issue\n # for groups, where we'll just skip anything that isn't a local Rule.\n \n current_level = []\n level.references.each do |name_token|\n name = name_token.text\n if @rule_defs.member?(name) then\n current_level << name\n elsif @group_defs.member?(name) then\n @group_defs[name].member_references.each do |reference|\n if reference.is_a?(RuleReference) then\n unless (reference.symbol_name.grammar.exists? and reference.symbol_name.grammar != @name)\n current_level << reference.symbol_name.name\n end\n end\n end\n end\n end\n \n #\n # Everything in the current_level is linked to everything in the previous_level. If \n # there is no previous_level, then we'll register the names as points.\n \n if previous_level.empty? then\n root_sets << current_level\n current_level.each do |name|\n hierarchy.register_point( name )\n end\n else\n previous_level.each do |parent_name|\n current_level.each do |child_name|\n if hierarchy.would_cycle?(parent_name, child_name) then\n nyi( \"error handling for precedence cycle [#{parent_name}] to [#{child_name}]\" )\n else\n hierarchy.register( parent_name, child_name )\n end\n end\n end\n end\n \n previous_level = current_level\n end\n end\n \n \n #\n # Now, we want to integrate the prioritized rules back into the overall hierarchy, and we\n # want to preserve as much of the original ordering as possible. We do this by looking\n # within the prioritized rules at each layer and picking the highest priority for each\n # subtree, then inserting that layer at that index, shifting all the unprioritized rules \n # down.\n #\n # I think some examples might help explain what I mean.\n #\n # Rules: a, b, c, d, e, f, g, h | Rules: a, b, c, d, e, f\n # Order: 1, 2, 3, 4, 5, 6, 7, 8 | Order: 1, 2, 3, 4, 5, 6\n # |\n # Prec table 1: | Prec table 1:\n # d | b c\n # e g | e f\n # Prec table 2: | \n # h | \n # d | \n # g | \n # |\n # DAG layers and original order: | DAG layers and original order:\n # h 8 | b c 2 3\n # d 4 | e f 5 6\n # e g 5 7 |\n #\n # So, with these two examples, we want to reinsert the DAG elements back into the order\n # so that the DAG's hierarchy is respected, while -- as much as possible -- not disturbing \n # the original order. At each layer of the DAG, we look down the tree and find the highest\n # priority original position, and that is where we insert that layer. So\n #\n # insertion_points: | insertion_points:\n # 4, 4, 5 | 2, 5\n #\n # Now, obviously we can't insert two layers at the same point, so for the left example,\n # we'll need to adjust the second layer down a level, which will then cascade to the third\n # layer. And as there is no room between those insertion points, any rules originally at\n # levels 4, 5, or 6 must be shifted down as well.\n #\n # For the right example, notice that rule 4 doesn't need to be disturbed by the\n # the prioritization of either layer, as there is space between insertion points 2 and 5.\n # So we leave it in that position.\n #\n # insertion_points: | insertion_points:\n # 4, 5, 6 | 2, 5\n #\n # Finally, after integrating the default and prioritized rules, we get:\n # 1: a | 1: a\n # 2: b | 2: b c\n # 3: c | 3: d\n # 4: h | 4: e f\n # 5: d |\n # 6: e g |\n # 7: f |\n \n all_rules = []\n default_rules = []\n \n @rule_defs.each do |name, element|\n name = name.to_s\n \n if element.is_a?(Rule) then\n all_rules << name\n default_rules << name unless hierarchy.node?(name)\n end\n end\n\n\n #\n # Next we collect the raw insertion point data for the precedence data. But there's another \n # wrinkle. Up top, we merged all the precedence tables into one DAG, so we could find loops\n # and inter-relationships between the precedence tables. However, if some elements don't link\n # up, we don't want to prioritize all the independent trees to the same level -- we want to\n # preserve as much of the original ordering as possible. So we have to process each tree separately,\n # then interleave the data back together.\n \n insertion_point_sets = []\n insertion_layer_sets = []\n \n hierarchy.independent_trees(root_sets).each do |tree|\n insertion_points = []\n insertion_layers = []\n \n tree.each_layer_reverse do |layer|\n insertion_point = all_rules.length\n layer.each do |name|\n insertion_point = min( insertion_point, all_rules.index(name) )\n end\n \n insertion_points.unshift min(insertion_point, insertion_points.empty? ? insertion_point : insertion_points[0])\n insertion_layers.unshift layer\n end\n \n insertion_point_sets << insertion_points\n insertion_layer_sets << insertion_layers\n end\n \n \n #\n # We interleave the data sets back together. We want to do the interleaving by insertion_point.\n \n insertion_points = []\n insertion_layers = []\n\n until insertion_point_sets.empty? \n tops = insertion_point_sets.collect{|set| set[0]}\n min = tops.inject(all_rules.length){|current, aggregate| min(current, aggregate)}\n index = tops.index( min )\n \n insertion_points << insertion_point_sets[index].shift\n insertion_layers << insertion_layer_sets[index].shift\n \n if insertion_point_sets[index].empty? then\n insertion_point_sets.delete_at(index)\n insertion_layer_sets.delete_at(index)\n end\n end\n \n \n #\n # Next, we need to adjust the insertion points so that every one is unique.\n \n last_insertion_point = -1\n insertion_points.each_index do |index|\n insertion_points[index] = last_insertion_point + 1 if insertion_points[index] <= last_insertion_point\n last_insertion_point = insertion_points[index]\n end\n \n \n #\n # Finally, we have to integrate the two systems by setting the priority on each Rule. \n # We proceed one priority level at a time: if it is in the insertion_points list, we set \n # the priority for all rules on that level to that number; otherwise, we shift a name off\n # the default_rules list and set its priority instead.\n \n (default_rules.length + insertion_layers.length).times do |i|\n if insertion_points.member?(i) then\n insertion_layers[insertion_points.index(i)].each do |name|\n @rule_defs[name].priority = i\n end\n else\n default_rules.shift.each do |rule_name|\n @rule_defs[rule_name].priority = i\n end\n end\n end\n end",
"def branch; end",
"def t__48!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n\n\n\n type = T__48\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 25:9: '<='\n match( \"<=\" )\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__, 19 )\n\n\n end",
"def t__73!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 18)\n\n type = T__73\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 24:9: '::'\n match(\"::\")\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__, 18)\n\n end",
"def else!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 66 )\n\n type = ELSE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 187:8: 'else'\n match( \"else\" )\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__, 66 )\n\n end",
"def first_assignment?(node); end",
"def process_else(exp)\n add_to_score :branch\n penalize_by 0.1 do\n process_until_empty exp\n end\n s()\n end",
"def input!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n\n\n\n type = INPUT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 42:8: 'traer'\n match( \"traer\" )\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__, 21 )\n\n\n end",
"def next_exercise_minimal_path_not_done\n i = 0\n while(i < self.user_sequence.size() && self.user_sequence[i][2]) do\n i = i + STEP_SIZE\n end\n if i < self.user_sequence.size()\n return self.user_sequence[i][0]\n elsif self.user_sequence.last[2] # last exercise is done\n return nil\n else\n return self.user_sequence.last[0]\n end \n end",
"def solve\n\t\t\n\t\tcell_index = 0\n\t\t# move to the right position..\n\t\t# puts @unsolved.length.to_s + \" unknown cells!\"\n\n\t\twhile cell_index >= 0 && cell_index < @unsolved.length do\n\t\t\tcell = @unsolved[cell_index];\n\t\t\t\n\t\t\tpossible = cell.nextPossible()\t\n\n\t\t\tif possible > 9 || possible <= 0\n\t\t\t\tcell.set(0)\n\t\t\t\tcell_index -= 1\n\t\t\telse\n\t\t\t\tcell.set(possible)\n\t\t\t\tcell_index += 1\n\t\t\tend\t\t\t\t\t\t\t\n\t\tend\n\n\t\tif cell_index < 0\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend"
] | [
"0.54165345",
"0.5269058",
"0.5166568",
"0.51402485",
"0.50974125",
"0.50485486",
"0.5019855",
"0.4994094",
"0.49908936",
"0.49681368",
"0.49582392",
"0.4958214",
"0.49570262",
"0.49471688",
"0.4946688",
"0.4914956",
"0.48796713",
"0.4878304",
"0.48496935",
"0.483608",
"0.47965938",
"0.47944343",
"0.4785689",
"0.47836426",
"0.47819787",
"0.47712457",
"0.4764721",
"0.4763602",
"0.4763602",
"0.47577506",
"0.47559667",
"0.4753005",
"0.47481993",
"0.47447425",
"0.47345662",
"0.47306532",
"0.4722883",
"0.4722002",
"0.47209433",
"0.47154924",
"0.47133932",
"0.47094533",
"0.47039235",
"0.46980608",
"0.46913147",
"0.46896085",
"0.46823794",
"0.46725175",
"0.46647653",
"0.46628693",
"0.46558958",
"0.46554318",
"0.46513408",
"0.46454218",
"0.46446055",
"0.4643927",
"0.4641078",
"0.46340054",
"0.46333587",
"0.46321613",
"0.46316245",
"0.46222326",
"0.46100193",
"0.46098983",
"0.46098983",
"0.46064138",
"0.46064138",
"0.46041057",
"0.4592759",
"0.45891544",
"0.4588121",
"0.4587095",
"0.45841968",
"0.45830074",
"0.4581924",
"0.45779064",
"0.45776474",
"0.45738268",
"0.45699924",
"0.456916",
"0.45635554",
"0.4562141",
"0.45581773",
"0.4549946",
"0.4548605",
"0.45418215",
"0.45401847",
"0.45397797",
"0.45379573",
"0.4537024",
"0.45361936",
"0.45349497",
"0.45308545",
"0.45296225",
"0.4529327",
"0.4527316",
"0.45233896",
"0.452326",
"0.45126545",
"0.4511443"
] | 0.45434842 | 85 |
Find all the nodes in a basic block, given the first node. | def nodes_in_block(first_node)
# We're going to do a depth-first search of the graph from the first
# node, following control flow edges out, and global schedule edges in,
# and stopping when we find a node that ends a basic block such as a
# branch.
worklist = [first_node]
block = Set.new
until worklist.empty?
node = worklist.pop
if block.add?(node)
# We need to visit nodes that are anchored to this one.
node.inputs.edges.each do |i|
if i.input_name == :global_schedule
worklist.push i.from
end
end
# If this node isn't a branch, and it's either the first node or it
# isn't a merge, visit the nodes that follow it in control flow.
if node.op != :branch && (node == first_node || node.op != :merge)
node.outputs.edges.each do |o|
if o.control?
if !(node.op == :start && o.to.op == :finish)
worklist.push o.to
end
end
end
end
end
end
block.to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_in_block(first, nodes)\n first.inputs.from_nodes.each do |n|\n if nodes.include?(n)\n return first_in_block(n, nodes)\n end\n end\n first\n end",
"def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end",
"def nodes_breadthfirst(node = self.root, &block)\n @nodes = []\n iterate_breadthfirst(node, &block)\n ensure\n @nodes = nil\n end",
"def each(&block)\n # get the first\n node=getnext([])\n $DEBUG.puts \"each: first node is #{node}\"\n while node\n block.call node\n oldnode=node\n node=getnext(node.oid)\n $DEBUG.puts \"each: next of #{oldnode} is #{node}\"\n end\n end",
"def each(&block)\n node = first\n\n while node\n if block\n block.yield(node)\n end\n\n if node.next\n node = node.next\n else\n break\n end\n end\n\n return node\n end",
"def each_node(&block)\n nodes.each(&block)\n end",
"def select_nodes(&block)\n each_node.select &block\n end",
"def each_node(&block)\n\t\t\tnodes.each(&block)\n\t\tend",
"def each_node(&block)\n nodes.each_node &block\n end",
"def each_node(&block)\n nodes.each_node &block\n end",
"def find_node(node, type, first, last, depth: 0)\n child_nodes = node.children.select { |c| c.is_a?(RubyVM::AbstractSyntaxTree::Node) }\n # @logger.debug(\"D: #{depth} #{node.type} has #{child_nodes.size} children and spans #{node.first_lineno}:#{node.first_column} to #{node.last_lineno}:#{node.last_column}\")\n\n if node.type == type && first >= node.first_lineno && last <= node.last_lineno\n return node\n end\n\n child_nodes.map { |n| find_node(n, type, first, last, depth: depth + 1) }.flatten\n end",
"def each_node(&block)\n @nodes.each &block\n end",
"def each_node(&block)\n @nodes.each &block\n end",
"def find_nodes(*ops)\n found = []\n visit_nodes do |node|\n if ops.empty? || ops.include?(node.op)\n if !block_given? || yield(node)\n found.push node\n end\n end\n end\n found\n end",
"def by_basic_block(bb, level)\n assert(\"RelationNodeList#by_basic_block: level != :src,:dst\") { [:src,:dst].include?(level) }\n lookup(@basic_block_index[level], bb, \"#{level}-block\", false) || []\n end",
"def each_node(&block)\n nodes.each_value(&block)\n end",
"def eachNode(&block)\n @topo.eachNode(&block) if !@topo.nil?\n end",
"def each_node(&block)\r\n @nodes.each { |node| block.call(node) }\r\n end",
"def each(node, &block); end",
"def all_nodes\n nodes = []\n visit_nodes do |node|\n nodes.push node\n end\n nodes\n end",
"def match_all(data, &block)\n return nil if @root == nil\n i=0\n while (i<data.length)\n node = @root.find_forward(data, i, data.length-i)\n if (node!=nil && node.value!=nil)\n yield Item.new(i, true, node)\n i += node.length\n else\n i += 1\n end\n end\n end",
"def select_nodes(&block)\r\n @map.select(&block)\r\n end",
"def eachNode(&block)\n @nodeSets.each { |s|\n s.eachNode &block\n }\n end",
"def find_all_nodes(*args)\n nodes = @nodes.find_all_nodes(*args)\n nodes.find_all { |n| context?(n) }\n end",
"def each(&block)\n each_node([], @root, block)\n end",
"def iterating_block?(node); end",
"def deep_find_first sexp=nil, &block\n if sexp.nil?\n return deep_find_first_node(&block)\n end\n deep_enhance! unless deep_enhanced?\n found = nil\n each do |node|\n if node == sexp\n found = node\n break\n else\n if node.kind_of?(Sexp)\n found = node.deep_find_first(sexp)\n break if found\n end\n end\n end\n found\n end",
"def find_all_nodes(*args)\n raise NotImplementedError\n nodes = @database.all_nodes\n # TODO: design node finder syntax\n nodes\n end",
"def deep_find\n ([self] + all_subtrees.to_a).each do |node|\n return node if yield(node)\n end\n nil\n end",
"def fakesearch_all_nodes(options = {})\n fakesearch_nodes(nil, options)\nend",
"def each_node\n list_nodes.each do |node|\n yield node\n end\n end",
"def each(node, &block)\n visit(node, &block)\n end",
"def find_by(type, filter, single = true, &block)\n nodes = []\n env = node.chef_environment\n if node.public_send(Inflections.pluralize(type.to_s)).include? filter\n nodes << node\n end\n if !single || nodes.empty?\n search(:node, \"#{type}:#{filter} AND chef_environment:#{env}\") do |n|\n nodes << n\n end\n end\n\n if block_given?\n nodes.each { |n| yield n }\n else\n single ? nodes.first : nodes\n end\n end",
"def find_all_paths\n found_paths = []\n \n explore(found_paths, nil, @start_node)\n \n found_paths\n end",
"def each(&block)\n Placeholder.each(node_data, &block)\n end",
"def nodes\n return @nodes if (not @nodes.nil? and @nodes.size > 0)\n init_nodes\n @nodes\n end",
"def allNodes!(&block)\n NodeSet.freeze\n ns = RootGroupNodeSet.instance\n return RootNodeSetPath.new(ns, nil, nil, block)\n end",
"def each_node(nodes)\n unless ::Nokogiri::XML::NodeSet === nodes\n nodes = [nodes]\n end\n nodes.each do |node|\n yield(node)\n end\n end",
"def read_nodes(elem)\n return [] if elem == nil\n nodes = []\n elem.elements.each('node') do |node_elem|\n nodes << read_node(node_elem)\n end\n nodes\nend",
"def find_paths(&block)\n follow,kill,find,continue = SearchParams.process(&block)\n\n paths,path = [],[]\n search = lambda do |node|\n if find[node]\n paths << path.dup\n next if not continue[node]\n end\n next if kill[node]\n [*follow[node]].each do |n|\n next if path.include? n\n path.push(n)\n search[n]\n path.pop\n end\n end\n\n [*follow[self]].each do |n| \n path.push(n)\n search[n] \n path.pop\n end\n\n paths\n end",
"def process_all_nodes\n debug 'Start processing all nodes'\n each_node do |node|\n process_node node\n end\n end",
"def find_attributes(node, &block); end",
"def visit_all(&block)\n visit &block\n children.each {|c| c.visit_all &block}\n end",
"def find_nodes(src_dir=\"./\",full_tree=false)\n file = File.open(\"#{@name}\") if !self.is_leaf\n file.each_line do |line|\n match = /.*#include\\s+[<|\"](.*?)[\\>|\"]\\s*/.match(line)\n if !match.nil? and !match[1].nil?\n header = match[1]\n name = Dir.glob(\"#{src_dir}/**/#{header}\").first\n if name.nil? or name == \"\"\n node = Node.new(header,self,true)\n else\n node = Node.new(name,self,false)\n end\n existed = full_tree ? my_parents_has?(node) : tree_has?(node)\n if full_tree\n add_child(node) if !existed\n else\n node.is_leaf = existed if !node.is_leaf\n add_child(node)\n end\n end\n end\n self.childs\n end",
"def self_or_first_descendant\n block = self\n while block.descendant; block = block.descendant; end\n block\n end",
"def each_containment(&block)\n @nodes.values.sort.each do |node|\n if node.parent\n block.call node.parent, node\n end\n end\n end",
"def each_node(&block)\n c = children # save children before yield\n yield(self)\n c.each do |n|\n n.each_node(&block)\n end\n end",
"def each(&block)\n tree.each(&block)\n end",
"def each(node=@head)\n until node.nil?\n result = yield(node)\n node = node.next_node\n end\n result\n end",
"def each(&block)\n node = top\n\n while node\n if block\n block.yield(node)\n end\n\n if node.previous\n node = node.previous\n else\n break\n end\n end\n\n return node\n end",
"def map_nodes!(&ruby_block)\n # Nothing to do.\n end",
"def nodes; end",
"def nodes; end",
"def nodes; end",
"def check_nodes(node)\n nodes = []\n all_nodes = get_consul_members\n if (node.downcase != \"all\")\n nodes << node if all_nodes.include? node\n else\n nodes = all_nodes\n end\n return nodes\n end",
"def nodes\n @nodes ||= each_node.to_a\n end",
"def neighbours_into_start(node)\n # Find all arcs that include this node in the right place\n passable_nodes = []\n @arcs.get_arcs_by_node_id(node.node_id).each do |arc|\n if arc.end_node_id == node.node_id and arc.end_node_direction\n passable_nodes.push nodes[arc.begin_node_id]\n elsif arc.begin_node_id == node.node_id and !arc.begin_node_direction\n passable_nodes.push nodes[arc.end_node_id]\n end\n end\n return passable_nodes.uniq\n end",
"def each(&block)\n node = @Node.new(nil,nil,nil)\n node = @head\n\n while !(node.nil?)\n yield node.value\n\n node = node.next\n end\n end",
"def each_node(safe_path, xpath, &block)\n return enum_for(:each_node, safe_path, xpath) unless block\n\n require 'nokogiri'\n\n with_encoding_check(safe_path) do |stream, encoding|\n stream_xml_nodes(stream, xpath, encoding, &block)\n end\n end",
"def map_nodes!(&ruby_block)\n # By default, nothing to do.\n end",
"def each &block\n collection = self.collection\n if prefix = prefix_with_delim\n collection = collection.with_prefix(prefix)\n end\n collection.each(:delimiter => delimiter) do |member|\n case\n when member.respond_to?(:key)\n yield LeafNode.new(parent, member)\n when member.respond_to?(:prefix)\n yield BranchNode.new(parent, member,\n :delimiter => delimiter,\n :append => append?)\n end\n end\n nil\n end",
"def find_all(value)\n nodes = []\n self.each {|node| nodes << node if node.value == value}\n nodes\n end",
"def all_nodes\n [self] + descendants\n end",
"def each(node,options={},&block)\n all(node,options).each(&block)\n end",
"def process_all(nodes)\n results = []\n nodes.to_a.each do |node|\n n = process(node)\n if n\n if n.is_a?(Inline)\n results += n\n else\n results << n\n end\n end\n end\n results\n end",
"def all_nodes\n Pathname.glob(node_file(\"*\", false)).map do |file|\n json = JSON.parse(file.read)\n Config::Node.from_json(json)\n end\n end",
"def process_all_nodes\n debug 'Start processing all nodes'\n hook 'pre_all'\n each_node do |node|\n process_node node\n end\n hook 'post_all'\n end",
"def find_nodes_and_map(xml)\n self.maps.each do |map|\n doc = LibXML::XML::Parser.string(xml).parse\n nodes = doc.find(map[:base_path])\n return nodes, map if !nodes.empty?\n end\n return [], nil\n puts \"No map found in #{self.class} for xml #{xml[0..100]}...\" if $DEBUG\n end",
"def nodes\n []\n end",
"def iterate\n return unless block_given?\n\n current_node = @head\n\n until current_node.nil?\n yield current_node\n\n current_node = current_node.next\n end\n end",
"def find_all(&block)\n @asset.representation_utis.each do |uti|\n find_by_uti(uti) do |rep|\n block.call(rep)\n end\n end\n end",
"def each_node(&block)\n block.call(@value)\n @left.each_node(&block) if @left\n @right.each_node(&block) if @right\n end",
"def returns_from(node); end",
"def returns_from(node); end",
"def visit_nodes\n # Run a depth-first traversal of the graph with a worklist and a\n # visited set.\n\n worklist = [@start]\n visited = Set.new\n until worklist.empty?\n node = worklist.pop\n if visited.add?(node)\n yield node\n worklist.push *node.inputs.nodes\n worklist.push *node.outputs.nodes\n end\n end\n end",
"def each_mergeable_node\n each_condition_node do |node|\n unless node.nick_selector?\n yield node\n end\n end\n end",
"def iterate_children(ts, block, new_model)\n ts.children.each do |cs|\n # assumes there is only one element - could iterate instead but what case would that be?\n element = block.css(cs.selector).first\n\n handle_element(cs, element, new_model)\n end # end top selector children iteration\n end",
"def first_all(conditions={}, &block)\n all.detect { |item| match_all(item, conditions, &block) }\n end",
"def each\n Directory.all.each do |node_id|\n yield find node_id\n end\n end",
"def each_leaf(&block)\n each_leaf_node([], @root, block)\n end",
"def find_all_in_scope(node, predicate); end",
"def depth_first_search!(node)\n node.marked = true\n node.type = \"M\"\n node.adj.each do |n|\n if n.marked == false\n depth_first_search(n)\n end\n end\n end",
"def find_examples(node)\n return [] if scope_change?(node)\n\n if example?(node)\n [node]\n else\n examples_in_scope(node)\n end\n end",
"def each( &block )\n @trees.merge( @networks ).each( &block )\n end",
"def candidate_nodes(*path)\n return @command_registry.commands_tree.children if path.count.zero?\n last_name = path.pop\n node = @command_registry.commands_tree.node_by_path(*path)\n return [] if node.nil?\n last_node = node.node_by_path(last_name)\n return last_node.children unless last_node.nil?\n node.children.select { |n| n.name =~ /^#{Regexp.escape(last_name)}/ }\n end",
"def for_node; end",
"def breadth_first_scan(root, &block)\n puts \"=== \".light_black + root.light_cyan + \" ===\".light_black if $verbose\n\n root = slashed(root)\n \n dirs, files = listdir(root)\n path_id = File.lstat(root).ino\n \n if seenpath = $visited[path_id]\n STDERR.puts \"*** WARNING: Already seen #{root.inspect} as #{seenpath.inspect}\".red if $verbose\n else\n $visited[path_id] = root\n \n dirs.each { |f| yield root, f }\n files.each { |f| yield root, f }\n \n for dir in dirs\n breadth_first_scan(root+dir, &block)\n end\n end\nend",
"def find_by_name(node_id, node = @root_node, list = [])\n if node.name.to_s == node_id.to_s\n list << node\n else\n node.children.each { |child| find_by_name(node_id, child, list) }\n end\n list.compact\n end",
"def each(&block)\n root.each(&block)\n end",
"def each\n node = @head\n while node\n yield node\n node = node.next_node\n end\n end",
"def all\n Directory.all.map do |node_id|\n find node_id\n end\n end",
"def basic_blocks\n @basic_block_collection ||= BasicBlockCollection.new(self)\n end",
"def each\n self.traverse_down { |node| yield(node) }\n end",
"def block_node; end",
"def block_node; end",
"def each_node\n return to_enum(__method__) unless block_given?\n\n doc.xpath(query).each do |node|\n yield node\n end\n end",
"def each_recursive(&block)\n tree.each_recursive(&block)\n end",
"def rspec_test(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).rspec_test\n end\n end",
"def get_nodes_by_recipe(recipe, includeme=true, options={})\n options = {\n :search_string => recipe,\n :include_me => includeme,\n :order => [:recipe],\n :safe_deref => nil,\n :current_node => nil,\n :one_or_all => :all\n }.merge(options)\n opsit_search(options)\n end",
"def locally_schedule_block(first_node)\n # Find all the nodes in this basic block.\n\n in_block = Set.new(nodes_in_block(first_node))\n\n # Back up a second... our first node could be a fixed node, which\n # actually has input values. Such as a branch with a condition.\n # The nodes involved in that condition actually need to come first.\n\n first_node = first_in_block(first_node, in_block)\n\n # Create a work list of nodes to schedule and a set of nodes\n # already scheduled.\n\n to_schedule = in_block.to_a\n scheduled = Set.new\n\n # The first node in the basic block is already scheduled first.\n\n to_schedule.delete first_node\n scheduled.add first_node\n\n # The tail is the last node we scheduled.\n\n tail = first_node\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # We are ready to locally schedule if all inputs that are in this\n # block have themselves already been scheduled.\n\n if node.inputs.from_nodes.all? { |i| !in_block.include?(i) || scheduled.include?(i) }\n # Add a local schedule edge from the previous last node to this one,\n # which then becomes the last node.\n raise if tail.inputs.from_nodes.include? node\n tail.output_to :local_schedule, node\n tail = node\n scheduled.add node\n else\n to_schedule.push node\n end\n end\n end"
] | [
"0.6709291",
"0.6666401",
"0.6242137",
"0.60401005",
"0.6026713",
"0.6015269",
"0.60145676",
"0.59886914",
"0.59748894",
"0.59748894",
"0.5884524",
"0.58118886",
"0.58118886",
"0.57877636",
"0.57521826",
"0.57321405",
"0.5704309",
"0.57033086",
"0.5685873",
"0.56380695",
"0.5606539",
"0.5599774",
"0.5595386",
"0.55269104",
"0.5499954",
"0.54814476",
"0.54461145",
"0.544104",
"0.53913116",
"0.5383503",
"0.5367731",
"0.5362118",
"0.5353878",
"0.53154176",
"0.5283052",
"0.5280382",
"0.5277501",
"0.5272125",
"0.5259632",
"0.5257592",
"0.52540684",
"0.5252382",
"0.52408963",
"0.5236147",
"0.523253",
"0.5220242",
"0.5216722",
"0.5174835",
"0.5144603",
"0.51351434",
"0.51292133",
"0.5123242",
"0.5123242",
"0.5123242",
"0.5115287",
"0.51097906",
"0.5104243",
"0.50878143",
"0.50612515",
"0.50479865",
"0.5046965",
"0.5044719",
"0.5043682",
"0.5030064",
"0.5028114",
"0.5016588",
"0.50095373",
"0.50095075",
"0.50052464",
"0.50041556",
"0.4998479",
"0.49849287",
"0.49758643",
"0.49758643",
"0.49609792",
"0.4955504",
"0.495323",
"0.49501672",
"0.49432743",
"0.4922296",
"0.4920619",
"0.49160922",
"0.4913356",
"0.49103853",
"0.49092424",
"0.49089226",
"0.49087375",
"0.49075723",
"0.4904455",
"0.48972756",
"0.48920494",
"0.48885617",
"0.48845991",
"0.48804176",
"0.48804176",
"0.48743308",
"0.48732212",
"0.48668656",
"0.48664606",
"0.48622042"
] | 0.69855666 | 0 |
A node is locally scheduled if it's fixed or we have locally scheduled it. | def locally_scheduled?(node)
node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:local_schedule)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def globally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:global_schedule)\n end",
"def ready_to_schedule?(node)\n # Ready to globally schedule\n\n node.outputs.to_nodes.all? do |i|\n globally_scheduled?(i)\n end\n end",
"def scheduled?\r\n @time != :forever\r\n end",
"def scheduled?\n @current_state == Psc::ScheduledActivity::SCHEDULED\n end",
"def scheduled?\n status == Status[:scheduled]\n end",
"def do_scheduling?\n\t\t!self.scheduled_at.blank?\n\tend",
"def scheduled?\n self.status_sym == :scheduled\n end",
"def locally_schedule_block(first_node)\n # Find all the nodes in this basic block.\n\n in_block = Set.new(nodes_in_block(first_node))\n\n # Back up a second... our first node could be a fixed node, which\n # actually has input values. Such as a branch with a condition.\n # The nodes involved in that condition actually need to come first.\n\n first_node = first_in_block(first_node, in_block)\n\n # Create a work list of nodes to schedule and a set of nodes\n # already scheduled.\n\n to_schedule = in_block.to_a\n scheduled = Set.new\n\n # The first node in the basic block is already scheduled first.\n\n to_schedule.delete first_node\n scheduled.add first_node\n\n # The tail is the last node we scheduled.\n\n tail = first_node\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # We are ready to locally schedule if all inputs that are in this\n # block have themselves already been scheduled.\n\n if node.inputs.from_nodes.all? { |i| !in_block.include?(i) || scheduled.include?(i) }\n # Add a local schedule edge from the previous last node to this one,\n # which then becomes the last node.\n raise if tail.inputs.from_nodes.include? node\n tail.output_to :local_schedule, node\n tail = node\n scheduled.add node\n else\n to_schedule.push node\n end\n end\n end",
"def global_schedule(graph)\n # Create a work list of the floating nodes.\n\n to_schedule = graph.all_nodes.select {|n| n.floating? && n.op != :immediate }\n\n # Keep going until the work list is empty.\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # Are we ready to schedule this node?\n\n if ready_to_schedule?(node)\n # Find candidates to anchor this node to.\n\n candidates = schedule_candidates(graph, node)\n\n # If there aren't any then we're stuck!\n\n raise 'stuck' if candidates.empty?\n\n # Sort the candidates and take the first one to get the best.\n\n best_candidate = sort_candidates(candidates).first\n\n # Add a global schedule edge.\n\n node.output_to :global_schedule, best_candidate\n else\n # If we aren't ready to schedule this node, try it again later.\n\n to_schedule.push node\n end\n end\n end",
"def schedule_public?\n event && (\n !event.current? || # All past schedules are public\n Settings.show_schedule?) # Current event schedule has explicit go-live flag\n end",
"def evaulate_schedule\n true\n end",
"def local_node\n @local_node ||= DPN::Workers.nodes.node(to_node)\n end",
"def local_schedule(graph)\n # Find all basic blocks and locally schedule them.\n\n graph.all_nodes.each do |node|\n if node.begins_block?\n locally_schedule_block node\n end\n end\n end",
"def schedulable?(starting, ending)\n !scheduled?(starting - lead_time, ending)\n end",
"def fixed_anchor(node)\n raise unless globally_scheduled?(node)\n\n if node.fixed?\n # A fixed node is anchored to itself.\n node\n else\n # Otherwise we anchored using an output to another node.\n anchor = node.outputs.with_output_name(:global_schedule).to_nodes.first\n raise unless anchor\n fixed_anchor(anchor)\n end\n end",
"def process_node(node)\n debug \"Process node: #{node}\"\n node.poll\n return unless node.online?\n ready_task = node.ready_task\n return unless ready_task\n ready_task.run\n end",
"def scheduled?(schedulable, starts, ends)\n puts \"This #{schedulable.class} is not scheduled between #{starts} and #{ends}\"\n end",
"def should_run?\n val = (!all_nodes_ready? ||\n config_updated?)\n end",
"def unscheduled?\n state == :unscheduled\n end",
"def name\n 'always_be_scheduling'\n end",
"def name\n 'always_be_scheduling'\n end",
"def has_schedule?\n self.schedule != nil\n end",
"def local?\n return true unless ROUTABLE_STANZAS.include?(@node.name)\n to = JID.new(@node[TO])\n to.empty? || local_jid?(to)\n end",
"def is_required?\n return self.schedule_status == 'reschedule' ? true : false\n end",
"def scheduled?(starting, ending)\n schedule.scheduled?(self, starting, ending)\n end",
"def toggle_scheduler\n new_scheduler = WaterManager.first.scheduling_option == CRONTAB_SPRINKLE_ALL ? DAEMON_MINUTE_HAND : CRONTAB_SPRINKLE_ALL\n WaterManager.first.update(scheduling_option: new_scheduler)\n end",
"def primitive_has_master_running?(primitive, node = nil)\n is_multistate = primitive_is_multistate? primitive\n return is_multistate unless is_multistate\n status = primitive_status primitive, node\n return status unless status\n status == 'master'\n end",
"def active?\n schedule.active?\n end",
"def require_recollect_status\n return @periodic_checker.fire\n end",
"def scheduled_tasks\n self.tasks.select { \n |t| t.interval != :startup && t.interval != :shutdown\n }\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end",
"def is_scheduling_enabled\n return @is_scheduling_enabled\n end",
"def force_local?\n return true\n end",
"def planning_work\n self.planned_at = Time.now\n self.unfreeze_request! if self.frozen?\n self.push_msg\n end",
"def check_schedule_confirmed\n\t\t# Picked a random 'check' user service and temporary set it's status to schedule_confirmed\n\t\tuser_service \t\t= UserService.find_by(relationship_type: 'check')\n\t\tuser_service.date \t= Time.now\n\t\tuser_service.status = 'schedule_confirmed'\n\t\tUserServicesMailer.check_updated(user_service)\n\tend",
"def should_run?\n Time.zone.now - @info.last_sent - @config.delay_time >= @config.run_every\n end",
"def schedule_candidates(graph, node)\n if node.outputs.size == 1\n # If a node has just one output then that's the only candidate.\n\n [node.outputs.to_nodes.first]\n else\n # Otherwise, consider all the nodes in the graph (yes this is\n # quadratic).\n\n graph.all_nodes.select do |candidate|\n # The start node is never a candidate because we're going to schedule\n # before the candidate, and we can't schedule before the start node.\n\n if ![:start, :immediate].include?(candidate.op)\n # We only consider globally scheduled nodes as candidates.\n\n if globally_scheduled?(candidate)\n # Is there a control-flow path from all the inputs of the node to this candidate?\n\n from_all_inputs = node.inputs.from_nodes.all? { |i| !globally_scheduled?(i) || path_from_to(i, candidate) }\n\n # Is there a control-flow path from this candidate to all the outputs of this node?\n\n to_all_outputs = node.outputs.to_nodes.all? { |o| !globally_scheduled?(o) || path_from_to(candidate, o) }\n\n # Both conditions need to be true for this candidate to be valid.\n\n from_all_inputs && to_all_outputs\n end\n end\n end\n end\n end",
"def not_applicable?\n @current_state == Psc::ScheduledActivity::NA\n end",
"def assigned?\n self.task_state == TaskState.assigned\n end",
"def scheduling_type_dag?\n scheduling_type.nil? ? find_legacy_scheduling_type == :dag : super\n end",
"def action_online\n if current_resource.exists? && current_resource.online?\n Chef::Log.debug(\"#{new_resource} already online - skipping\")\n else\n converge_by(\"Online #{new_resource}\") do\n executor.execute!('online-node', escape(new_resource.slave_name))\n end\n end\n end",
"def should_run?\n Time.zone.now - @info.last_sent - @config.delay_time >= @config.run_every\n end",
"def ping(calling_node)\n @router.touch(calling_node)\n return true\n end",
"def startable?\n status.to_sym.in? [:pending]\n end",
"def scheduled\n @scheduled ||= count('scheduled')\n end",
"def active_schedule\n @_schedule = Schedule.active\n end",
"def due?\n cron_parser && (@next_run < Time.now)\n end",
"def reboot_pending?\n # don't break when used as a mixin in contexts without #node (e.g. specs).\n if respond_to?(:node, true) && node.run_context.reboot_requested?\n true\n elsif platform?(\"windows\")\n # PendingFileRenameOperations contains pairs (REG_MULTI_SZ) of filenames that cannot be updated\n # due to a file being in use (usually a temporary file and a system file)\n # \\??\\c:\\temp\\test.sys!\\??\\c:\\winnt\\system32\\test.sys\n # http://technet.microsoft.com/en-us/library/cc960241.aspx\n registry_value_exists?(\"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\", { name: \"PendingFileRenameOperations\" }) ||\n\n # RebootRequired key contains Update IDs with a value of 1 if they require a reboot.\n # The existence of RebootRequired alone is sufficient on my Windows 8.1 workstation in Windows Update\n registry_key_exists?('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired') ||\n\n # Vista + Server 2008 and newer may have reboots pending from CBS\n registry_key_exists?('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\RebootPending')\n elsif platform_family?(\"debian\")\n File.exist?(\"/var/run/reboot-required\")\n else\n false\n end\n end",
"def currently_online\n false\n end",
"def conditional?\n @current_state == Psc::ScheduledActivity::CONDITIONAL\n end",
"def rocket_job_restart_new_instance\n return unless cron_schedule\n super\n end",
"def rocket_job_restart_new_instance\n return unless cron_schedule\n super\n end",
"def can_cancel_and_reschedule?\n return true unless follow_up_for_dose\n\n Time.zone.now > can_change_after\n end",
"def is_synced_from_on_premises\n return @is_synced_from_on_premises\n end",
"def instant_broadcast_processing?\n true\n end",
"def reboot_if_needed!(node)\n if node.run_context.reboot_requested?\n reboot!(node)\n end\n end",
"def ssh_to_compute_node?\n if !cluster_ssh_to_compute_node?.nil?\n return cluster_ssh_to_compute_node?\n else\n return global_ssh_to_compute_node?\n end\n end",
"def scheduler_state\n plan.consolidated_scheduler_state\n end",
"def fixed?\n !moving? && day.present?\n end",
"def reserve_and_run_one_job; end",
"def is_scheduling_enabled=(value)\n @is_scheduling_enabled = value\n end",
"def schedule\n # implemented by subclass\n end",
"def is_scheduled_action_enabled\n return @is_scheduled_action_enabled\n end",
"def allow_custom_assignment_schedule\n return @allow_custom_assignment_schedule\n end",
"def is_scheduled_to_be_off\n offset_to_pdt = -25200\n current_time = Time.now.utc + offset_to_pdt\n current_time_minutes = (current_time.hour * 60) + current_time.min\n self.schedules.each do |schedule|\n return true if (current_time_minutes > schedule.start_time) && (current_time_minutes < schedule.end_time)\n end\n false\n end",
"def test_for_node\n deploy_info = @deployer.deployment_info_from(@node)[@node]\n if deploy_info.key?(:error)\n error \"Error while getting deployment info: #{deploy_info[:error]}\"\n elsif Time.now.utc - deploy_info[:deployment_info][:date] > MAX_ACCEPTABLE_REFRESH_PERIOD_SECS\n error \"Last deployment has been done on #{deploy_info[:deployment_info][:date].strftime('%F')}. Should refresh it.\"\n end\n end",
"def refetch_hosts?\n return false unless vima?\n return true if hosts_updated_at.nil?\n\n hosts_updated_at < Archiving.settings[:skip_host_fetch_time_period].ago\n end",
"def schedule_impact?\n self.impact != 'None'\n end",
"def task_schedule_status(task)\n\t\tstatus = []\n\tend",
"def rocket_job_restart_new_instance\n return unless cron_schedule\n\n super\n end",
"def restart_pending?\n @restart ||= false\n end",
"def deferred?\n\t\tstart && start > Time.now\n\tend",
"def is_static_node?(nodename)\n # Match queue1-st-compute2-1 or queue1-st-compute2-[1-1000] format\n match = nodename.match(/^([a-z0-9\\-]+)-(st|dy)-([a-z0-9\\-]+)-\\[?\\d+[\\-\\d+]*\\]?$/)\n raise \"Failed when parsing Compute nodename: #{nodename}\" if match.nil?\n\n match[2] == \"st\"\nend",
"def within_threshold?\n\n s_timing_threshold = scheduled_time_local.in(self.threshold)\n now_in_target_tz = DateTime.now.in_time_zone(Sundial::Config.default_time_zone)\n\n logger.info(\"Checking schedule [#{self.id}] timing threshold [#{s_timing_threshold}] using current time in \"\\\n \"schedule's time zone: #{now_in_target_tz}\")\n\n return now_in_target_tz <= s_timing_threshold\n end",
"def local?\n true\n end",
"def schedule\n schedule = start_time > Time.current ? UPCOMING_MATCH : PLAYED_MATCH\n\n schedule\n end",
"def all_nodes_ready?\n if current_platform_spec.nodes.nil?\n false\n else\n true\n end\n end",
"def scheduled?(start_date, end_date)\n schedule.scheduled?(self, start_date, end_date)\n end",
"def scheduled?(start_date, end_date)\n schedule.scheduled?(self, start_date, end_date)\n end",
"def scheduled?(start_date, end_date)\n schedule.scheduled?(self, start_date, end_date)\n end",
"def is_runnable?(node)\n if max_per_role > 0\n running_groups[node.role] < max_per_role\n else\n true\n end\n end",
"def functional?\n not self.schedules.empty? and self.schedules.first.is_pickup_stop? and self.schedules.last.is_drop_stop?\n end",
"def run_now!\n update_attributes(run_at: nil) if cron_schedule\n end",
"def get_node_ready(nodes)\n ready_nodes = nodes.select { |node| check_node_status(node) == \"ready\" }\n idle_nodes = []\n ready_nodes.each { |node| idle_nodes << node if !(DRbObject.new(nil, \"druby://#{node.ip}:9000\").executando_job) }\n idle_nodes.min{|a,b| DRbObject.new(nil, \"druby://#{a.ip}:9000\").cpu <=> DRbObject.new(nil, \"druby://#{b.ip}:9000\").cpu }\n end",
"def task_defined?(task_name) \n lookup(task_name) != nil\n end",
"def change_primary\n start = Mongo::Utils.monotonic_time\n existing_primary = admin_client.cluster.next_primary\n existing_primary_address = existing_primary.address\n\n target = admin_client.cluster.servers_list.detect do |server|\n !server.arbiter? && server.address != existing_primary_address\n end\n\n cfg = get_rs_config\n cfg['members'].each do |member|\n member['priority'] = case member['host']\n when existing_primary_address.to_s\n 1\n when target.address.to_s\n 10\n else\n 0\n end\n end\n set_rs_config(cfg)\n\n if unfreeze_server(target.address)\n # Target server self-elected as primary, no further action is needed.\n return\n end\n\n step_down\n persistently_step_up(target.address)\n\n new_primary = admin_client.cluster.next_primary\n puts \"#{Time.now} [CT] Primary changed to #{new_primary.address}. Time to change primaries: #{Mongo::Utils.monotonic_time - start}\"\n end",
"def local?\n @local == true\n end",
"def check_schedule_unconfirmed\n\t\t# Picked a random 'check' user service and temporary set it's status to scheduled_unconfirmed\n\t\tuser_service \t\t= UserService.find_by(relationship_type: 'check')\n\t\tuser_service.date \t= Time.now\n\t\tuser_service.status = 'schedule_unconfirm'\n\t\tUserServicesMailer.check_updated(user_service)\n\tend",
"def planning_simple()\n @free_time = nil\n if(@tasks.size > 0)\n # @timelines[0].add_event(Simple_task.new(2))\n # $time += 1\n @timelines[0].add_event(@tasks.pop)\n end\n nil\n end",
"def scheduled_at\n run_at || created_at\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 call_from_scheduler?\n # This path is from the `resque-scheduler` gem\n # Its not related to resque-uniqueness.\n caller.grep(%r{lib/resque/scheduler\\.rb.*enqueue_next_item}).any?\n end",
"def flag_for_pickup \n if start_dt_tm && (TzTime.zone.utc_to_local(start_dt_tm).to_date <= TzTime.now.to_date ) && #Is this portion of the check necessary\n end_dt_tm && (TzTime.zone.utc_to_local(end_dt_tm).to_date >= TzTime.now.to_date) && #Is this portion of the check necessary\n Schedulehelper.IsEntryDueOn(self,TzTime.now.to_date) \n #On update, if the entry is already marked for due today, then skip this step\n EntryStatus.flag_entry(self) if entry_status == nil || !is_due_today\n #Update account_detail if not already\n user = self.user\n if !user.are_tasks_flagged_today \n user.account_detail.update_attribute(:tasks_last_flagged_on, TzTime.now.utc)\n end \n \n elsif entry_status && is_due_today #Here 'is_due_today' is returning the status as it was before the update since it is merely a flag \n #This case is to catch while the entry is being updated and if the entry's frequency schedule changed\n #in such a way where it is not due to day anymore\n EntryStatus.remove_flag(self)\n elsif entry_status == nil\n #Entry either starts in the future or not due today \n #Create a dummy record so that if the entry is ended right away, it can be recorded\n self.entry_status = EntryStatus.new( :user_id => self.user_id) \n end\n end",
"def report_scheduler_state(state)\n super if defined? super\n end",
"def set_scheduled_flag(value)\n self.scheduled = value\n self.save!\n end",
"def local?\n false\n end",
"def unresched\n action('unresched')\n end",
"def is_synced_from_on_premises=(value)\n @is_synced_from_on_premises = value\n end"
] | [
"0.7720234",
"0.7297023",
"0.6649845",
"0.6274704",
"0.6190029",
"0.61287236",
"0.61020935",
"0.590382",
"0.589468",
"0.5834543",
"0.5804419",
"0.5800366",
"0.57706374",
"0.5762994",
"0.569952",
"0.56203103",
"0.55885994",
"0.5582333",
"0.5563899",
"0.55336",
"0.55336",
"0.55145764",
"0.5502539",
"0.5455621",
"0.5408383",
"0.53593314",
"0.5319701",
"0.5318688",
"0.5294453",
"0.52934325",
"0.5270061",
"0.5270061",
"0.5270061",
"0.52527595",
"0.52501506",
"0.5249713",
"0.52418447",
"0.5235853",
"0.5227545",
"0.52204895",
"0.5194255",
"0.51897043",
"0.51671714",
"0.51653814",
"0.5161598",
"0.5161587",
"0.5156333",
"0.51519144",
"0.5148368",
"0.5130019",
"0.51079464",
"0.510436",
"0.5100517",
"0.5100517",
"0.5100339",
"0.5092047",
"0.50860935",
"0.50780475",
"0.50772077",
"0.5071029",
"0.50703144",
"0.50681156",
"0.5065085",
"0.50581896",
"0.50501215",
"0.50491345",
"0.50455433",
"0.5042865",
"0.50426865",
"0.5039902",
"0.5038969",
"0.5032495",
"0.5022292",
"0.50202715",
"0.5019329",
"0.5015404",
"0.5014412",
"0.5004429",
"0.50036246",
"0.50029",
"0.50029",
"0.50029",
"0.5002253",
"0.49910772",
"0.49901733",
"0.49809855",
"0.4978489",
"0.49729627",
"0.49712163",
"0.4970254",
"0.49692354",
"0.49689353",
"0.49584138",
"0.49546137",
"0.4953428",
"0.49452505",
"0.49441546",
"0.4938583",
"0.4934079",
"0.4929849"
] | 0.8236161 | 0 |
Linearize a graph into a single linear sequence of operations with jumps and branches. | def linearize(graph)
# The basic blocks.
blocks = []
# Details of the basic block that contain the finish operation which
# won't be added to the list of basic blocks until the end.
first_node_last_block = nil
last_block = nil
# Two maps that help us map between nodes and the names of the blocks
# that they go into, and the merge instruction indicies and the blocks
# they're coming from.
first_node_to_block_index = {}
merge_index_to_first_node = {}
# Look at each node that begins a basic block.
basic_block_starters = graph.all_nodes.select { |n| n.begins_block? }
last_basic_block_starter = basic_block_starters.select { |s| nodes_in_block(s).any? { |n| n.op == :finish } }.first
basic_block_starters.delete last_basic_block_starter
basic_block_starters.push last_basic_block_starter
basic_block_starters.each do |node|
original_first_node = node
first_node = first_in_block(original_first_node, nodes_in_block(original_first_node))
# We're going to create an array of operations for this basic
# block.
block = []
next_to_last_control = nil
# Follow the local sequence.
node = first_node
begin
# We don't want to include operations that are just there to form
# branches or anchor points in the graph such as start and merge.
unless [:start, :merge].include?(node.op)
op = node.op
# We rename finish to return to match the switch from the
# declarative style of the graph to the imperative style
# of the list of operations.
op = :return if op == :finish
# The instruction begins with the operation.
insn = [op]
# Then any constant values or similar.
[:line, :n, :value].each do |p|
insn.push node.props[p] if node.props.has_key?(p)
end
# Then any input registers.
node.inputs.with_input_name(:value).from_nodes.each do |input_values|
insn.push input_values.props[:register]
end
# Phi instructions need pairs of source registers with the blocks they came from.
if node.op == :phi
node.inputs.edges.each do |input|
if input.input_name =~ /^value\((.+)\)$/
n = $1.to_i
insn.push n
insn.push input.from.props[:register]
end
end
# Elide phi instructions if register allocation has run correctly and values are
# already in the correct registers.
insn = nil if insn.drop(2).select.with_index{ |_,i| i.even? }.uniq.size == 1
end
# Send instructions and lowered equivalents need the arguments.
if [:send, :call_managed, :int64_add, :int64_sub, :int64_imul, :int64_and, :int64_shift_left, :int64_shift_right].include?(node.op)
insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]
if node.op == :send
insn.push node.props[:name]
elsif node.op == :call_managed
insn.push node.inputs.with_input_name(:name).from_node.props[:register]
end
node.props[:argc].times do |n|
arg = node.inputs.with_input_name(:"arg(#{n})").from_node
if arg.op == :immediate
insn.push arg.props[:value]
else
insn.push arg.props[:register]
end
end
end
# Then the target register if the instruction has one.
insn.push node.props[:register] if insn && (node.produces_value? || node.op == :move)
# If it's a branch then the target basic blocks and the test.
if node.op == :branch
insn.push node.inputs.with_input_name(:condition).from_node.props[:register]
[:true, :false].each do |branch|
target = node.outputs.with_output_name(branch).to_node
raise unless target
insn.push target
end
if node.props[:test]
insn.push node.props[:test]
end
end
# Send instructions and lowered managed calls need the list of live registers.
if [:send, :call_managed].include?(node.op)
insn.push node.props[:live_registers]
end
# Guards are like branches, but only have one side.
if node.op == :guard
insn.push node.inputs.with_input_name(:condition).from_node.props[:register]
if node.props[:test]
insn.push node.props[:test]
end
end
# Kind instructions need the kind.
if node.op == :kind_is?
insn.push node.props[:kind]
end
# Frame states need the instructions, the ip, and to know where values are for
# the receiver, the arguments, and the stack.
if node.op == :deopt_map
insn.push node.props[:insns]
insn.push node.props[:ip]
insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]
insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('arg(') }.map { |e|
/arg\((\d+)\)/ =~ e.input_name.to_s
[$1.to_i, e.from.props[:register]]
}.sort_by { |pair| pair.first }.map { |pair| pair.last }
insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('stack(') }.map { |e|
/stack\((\d+)\)/ =~ e.input_name.to_s
[$1.to_i, e.from.props[:register]]
}.sort_by { |pair| pair.first }.map { |pair| pair.last }
end
# Add the instruction to the block.
block.push insn if insn
end
next_to_last_control = node if node.has_control_output?
# Follow the local schedule edge to the next node.
node = node.outputs.with_output_name(:local_schedule).to_nodes.first
end while node && node.op != :merge
# Empty blocks cause problems elsewhere - it's easier to just have a nop
# in them. Really, we should remove empty blocks by modifying the
# instruction that jumps here to jump to wherever this leads to.
if block.empty?
block.push [:nop]
end
# If the last node is a merge, we need to remember which merge index this is.
if node && node.op == :merge
next_to_last_control.outputs.with_output_name(:control).edges.first.input_name =~ /^control\((.+)\)$/
n = $1.to_i
merge_index_to_first_node[n] = first_node
end
# Add a jump instruction if this block was going to just flow into the next
# - we'll remove it later if the block followed it anyway and we can just
# fallthrough.
unless [:return, :branch].include?(block.last.first)
begin
block.push [:jump, next_to_last_control.outputs.with_output_name(:control).to_node]
rescue
block.push [:jump, :broken]
end
end
first_node_to_block_index[original_first_node] = blocks.size
first_node_to_block_index[first_node] = blocks.size
blocks.push block
end
# Record the number that this basic block has and then add it to the list of basic blocks.
first_node_to_block_index[first_node_last_block] = blocks.size
# Go back through the basic blocks and update some references that were to things that
# hadn't been decided yet.
blocks.each do |block|
block.each do |insn|
insn.map! do |e|
# If part of an instruction references a basic block, turn that into the index of
# the basic block instead.
if e.is_a?(IR::Node)
:"block#{first_node_to_block_index[e]}"
else
e
end
end
end
end
# Go back through the basic blocks and change how the branch instructions out of them
# work.
blocks.each_with_index do |block, n|
next_block = :"block#{n + 1}"
last = block.last
if last == [:jump, next_block]
# A jump that just goes to the next block can be removed and left to fall through.
block.pop
elsif last.first == :branch && last[3] == next_block
# A branch where the else goes to the next block can branch only when true.
block.pop
block.push [:branch_if, last[1], last[2], *last.drop(4)]
elsif last.first == :branch && last[2] == next_block
# A branch where the if goes to the next block can branch only unless true.
block.pop
test = last.drop(4)
block.push [:branch_unless, last[1], last[3], *test]
elsif last.first == :branch
# A branch that doesn't go to the next block at all can be a branch if true
# and then fallthrough to a new jump instruction.
block.pop
block.push [:branch_if, last[1], last[2], *last.drop(4)]
block.push [:jump, last[3]]
end
end
blocks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequence_nodes(graph)\n # Note that this algorithm is very wasteful! It allocates two sides of a branch\n # the same sequence numbers. This means that to the linear scan values on both\n # sides of the branch and internal to those branches appear to be live at the\n # same time and they won't use the same registers. I think we're supposed to be\n # sequencing one side of the branch at a time, and starting the right side\n # with the max sequence number of the left side.\n\n # Create a worklist of nodes to sequence.\n\n to_sequence = graph.all_nodes\n\n until to_sequence.empty?\n node = to_sequence.shift\n\n # If all this node's inputs have already been sequenced.\n\n if node.inputs.from_nodes.all? { |i| i.props[:register_sequence] }\n # Give this node an sequence number at least one higher than all others.\n input_sequences = node.inputs.from_nodes.map { |i| i.props[:register_sequence] }\n node.props[:register_sequence] = if input_sequences.empty? then 0 else input_sequences.max + 1 end\n next\n end\n\n # Not all inputs were sequenced - put this node back on the list and try again later.\n\n to_sequence.push node\n end\n end",
"def parse_additive\n tree = parse_multiply()\n\n while additive?\n operator, multiply = parse_additive_tail()\n tree = [operator, tree, multiply]\n end\n\n tree\n end",
"def mipsLowerSimpleBranchOps(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n annotation = node.annotation\n case node.opcode\n when /^b(addi|subi|ori|addp)/\n op = $1\n bc = $~.post_match\n branch = \"b\" + bc\n\n case op\n when \"addi\", \"addp\"\n op = \"addi\"\n when \"subi\"\n op = \"subi\"\n when \"ori\"\n op = \"ori\"\n end\n\n if bc == \"o\"\n case op\n when \"addi\"\n # addu $s0, $s1, $s2\n # xor $t0, $s1, $s2\n # blt $t0, $zero, no overflow\n # xor $t0, $s0, $s1\n # blt $t0, $zero, overflow\n # no overflow:\n #\n tr = Tmp.new(node.codeOrigin, :gpr)\n tmp = Tmp.new(node.codeOrigin, :gpr)\n noFlow = LocalLabel.unique(\"noflow\")\n noFlowRef = LocalLabelReference.new(node.codeOrigin, noFlow)\n newList << Instruction.new(node.codeOrigin, op, [node.operands[0], node.operands[1], tr], annotation)\n newList << Instruction.new(node.codeOrigin, \"xori\", [node.operands[0], node.operands[1], tmp])\n newList << Instruction.new(node.codeOrigin, \"bilt\", [tmp, MIPS_ZERO_REG, noFlowRef])\n newList << Instruction.new(node.codeOrigin, \"xori\", [tr, node.operands[0], tmp])\n newList << Instruction.new(node.codeOrigin, \"bilt\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n newList << noFlow\n newList << Instruction.new(node.codeOrigin, \"move\", [tr, node.operands[1]])\n when \"subi\"\n # subu $s0, $s1, $s2\n # xor $t0, $s1, $s2\n # bge $t0, $zero, no overflow\n # xor $t0, $s0, $s1\n # blt $t0, $zero, overflow\n # no overflow:\n #\n tr = Tmp.new(node.codeOrigin, :gpr)\n tmp = Tmp.new(node.codeOrigin, :gpr)\n noFlow = LocalLabel.unique(\"noflow\")\n noFlowRef = LocalLabelReference.new(node.codeOrigin, noFlow)\n newList << Instruction.new(node.codeOrigin, op, [node.operands[1], node.operands[0], tr], annotation)\n newList << Instruction.new(node.codeOrigin, \"xori\", [node.operands[1], node.operands[0], tmp])\n newList << Instruction.new(node.codeOrigin, \"bigteq\", [tmp, MIPS_ZERO_REG, noFlowRef])\n newList << Instruction.new(node.codeOrigin, \"xori\", [tr, node.operands[1], tmp])\n newList << Instruction.new(node.codeOrigin, \"bilt\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n newList << noFlow\n newList << Instruction.new(node.codeOrigin, \"move\", [tr, node.operands[1]])\n when \"ori\"\n # no ovwerflow at ori\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..1], annotation)\n end\n else\n if node.operands[1].is_a? Address\n addr = node.operands[1]\n tr = Tmp.new(node.codeOrigin, :gpr)\n newList << Instruction.new(node.codeOrigin, \"loadp\", [addr, tr], annotation)\n newList << Instruction.new(node.codeOrigin, op, [node.operands[0], tr])\n newList << Instruction.new(node.codeOrigin, \"storep\", [tr, addr])\n else\n tr = node.operands[1]\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..-2], annotation)\n end\n newList << Instruction.new(node.codeOrigin, branch, [tr, MIPS_ZERO_REG, node.operands[-1]])\n end\n when \"bia\", \"bpa\", \"bba\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[1], node.operands[0]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bnz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when \"biaeq\", \"bpaeq\", \"bbaeq\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[0], node.operands[1]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when \"bib\", \"bpb\", \"bbb\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[0], node.operands[1]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bnz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when \"bibeq\", \"bpbeq\", \"bbbeq\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[1], node.operands[0]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when /^bt(i|p|b)/\n lowerMIPSCondBranch(newList, \"b\" + $~.post_match + $1, node)\n else\n newList << node\n end\n else\n newList << node\n end\n }\n newList\nend",
"def connect_local_graphs_control(local_graphs)\n dfg.blocks.each do |predecessor|\n predecessor_last = local_graphs[predecessor.id].last_fixed\n predecessor.outgoing_blocks.each_with_index do |successor, index|\n label =\n if index > 0 &&\n index == (predecessor.outgoing_blocks.length - 1)\n # If there are multiple outgoing blocks from this block, then\n # the last one is a fallthrough. Otherwise it's a branch.\n :fallthrough\n else\n :\"branch#{index}\"\n end\n\n connect(\n predecessor_last,\n local_graphs[successor.id].first_fixed,\n :control,\n label\n )\n end\n end\n end",
"def add_bitcode_constraints(machine_function)\n return unless @pml.relation_graphs.has_named?(machine_function.name, :dst)\n rg = @pml.relation_graphs.by_name(machine_function.name, :dst)\n return unless rg.accept?(@options)\n bitcode_function = rg.get_function(:src)\n bitcode_function.blocks.each { |block|\n @bc_model.add_block_constraint(block)\n }\n # Our LCTES 2013 paper describes 5 sets of constraints referenced below\n # map from src/dst edge to set of corresponding relation edges (constraint set (3) and (4))\n rg_edges_of_edge = { :src => {}, :dst => {} }\n # map from progress node to set of outgoing src/dst edges (constraint set (5))\n rg_progress_edges = { }\n each_relation_edge(rg) do |edge|\n rg_level = relation_graph_level(edge.level.to_s)\n source_block = edge.source.get_block(rg_level)\n target_block = (edge.target.type == :exit) ? :exit : (edge.target.get_block(rg_level))\n\n assert(\"Bad RG: #{edge}\") { source_block && target_block }\n # (3),(4)\n (rg_edges_of_edge[rg_level][IPETEdge.new(source_block,target_block,edge.level)] ||=[]).push(edge)\n # (5)\n if edge.source.type == :entry || edge.source.type == :progress\n rg_progress_edges[edge.source] ||= { :src => [], :dst => [] }\n rg_progress_edges[edge.source][rg_level].push(edge)\n end\n end\n # (3),(4)\n rg_edges_of_edge.each do |_level,edgemap|\n edgemap.each do |edge,rg_edges|\n lhs = rg_edges.map { |rge| [rge,1] } + [[edge,-1]]\n @ilp.add_constraint(lhs, \"equal\", 0, \"rg_edge_#{edge.qname}\", :structural)\n end\n end\n # (5)\n rg_progress_edges.each do |progress_node, edges|\n lhs = edges[:src].map { |e| [e,1] } + edges[:dst].map { |e| [e,-1] }\n @ilp.add_constraint(lhs, \"equal\", 0, \"rg_progress_#{progress_node.qname}\", :structural)\n end\n end",
"def maximal_non_branching_paths(graph)\n <<-DOC\n A node v in a directed graph Graph is called a 1-in-1-out node if its indegree and outdegree are both equal to 1, \n i.e., in(v) = out(v) = 1. We can rephrase the definition of a \"maximal non-branching path\" from the main text \n as a path whose internal nodes are 1-in-1-out nodes and whose initial and final nodes are not 1-in-1-out nodes. \n Also, note that the definition from the main text does not handle the special case when Graph has a connected \n component that is an isolated cycle, in which all nodes are 1-in-1-out nodes.\n\n The MaximalNonBranchingPaths pseudocode below generates all non-branching paths in a graph. \n It iterates through all nodes of the graph that are not 1-in-1-out nodes and generates all non-branching \n paths starting at each such node. In a final step, MaximalNonBranchingPaths finds all isolated cycles in the graph.\n\n MaximalNonBranchingPaths(Graph)\n Paths ← empty list\n for each node v in Graph\n if v is not a 1-in-1-out node\n if out(v) > 0\n for each outgoing edge (v, w) from v\n NonBranchingPath ← the path consisting of the single edge (v, w)\n while w is a 1-in-1-out node\n extend NonBranchingPath by the outgoing edge (w, u) from w \n w ← u\n add NonBranchingPath to the set Paths\n for each isolated cycle Cycle in Graph\n add Cycle to Paths\n return Paths \n DOC\n\n paths = []\n\n in_degrees = {}\n out_degrees = {}\n # Calculating the indegree and outdegree for each node\n graph.values.flatten.each do |val|\n in_degrees[val] = 0 unless in_degrees.has_key?(val)\n in_degrees[val] += 1\n end\n graph.keys.each do |val|\n out_degrees[val] = graph[val].length\n end\n\n non_branch_path = \"\"\n\n one_in_one_out_nodes = []\n in_degrees.each do |k,v|\n if v == 1\n one_in_one_out_nodes << k if (out_degrees[k] == 1)\n end\n end\n\n # puts one_in_one_out_nodes\n nodes = []\n nodes = graph.keys\n graph.values.flatten.each {|v| nodes << v}\n nodes.uniq!\n\n v_index = 0\n loop do\n break if v_index == nodes.length\n v = nodes[v_index]\n\n if (one_in_one_out_nodes.include?(v))\n v_index += 1\n next\n else\n if (out_degrees[v] && (out_degrees[v] > 0))\n loop do\n break unless graph[v]\n break if graph[v].empty?\n w = graph[v][0]\n non_branch_path = v\n non_branch_path += w[-1]\n graph[v].delete_at(graph[v].index(w))\n graph.delete(v) if graph[v].length == 0\n while (w && graph[w] && in_degrees[w] && out_degrees[w] && in_degrees[w] == 1 && out_degrees[w] == 1) do\n u = graph[w][0]\n non_branch_path += u[-1]\n graph.delete(w)\n w = u\n end\n paths << non_branch_path\n # puts \"path:\" + non_branch_path\n non_branch_path = \"\"\n end\n else\n v_index += 1\n next\n end\n end\n v_index += 1\n end\n # puts paths\n paths.sort\n end",
"def alienlang(graph, in_degrees)\n g, deg, visited, solution = graph, in_degrees, 0, []\n\n # enqueue all vertices with an in-degree of 0\n queue = []\n deg.each do |k, v|\n if v == 0\n queue << k\n deg.delete(k)\n end\n end\n\n # until que is empty\n until queue.empty?\n solution << queue.shift\n visited += 1\n\n # traverse graph and remove edges\n parent = solution.last\n child = g[parent]\n # update in-degree count\n if deg.include?(child)\n deg[child] -= 1\n if deg[child] == 0 \n queue << child\n deg.delete(child)\n end\n end\n end\n\n g.length == visited ? solution : \"\"\nend",
"def build_graph\n @matrix.each_with_index do |row, x|\n row.each_with_index do |move, y|\n move = Coordinate.new(x,y)\n @matrix[x][y] = possible_moves(move)\n end\n end\n\tend",
"def all_paths_source_target(graph, results=[], current_node=0, current_path=[])\n if current_node == graph.length - 1\n return results << (current_path + [current_node])\n end\n\n graph[current_node].each do |node|\n all_paths_source_target(graph, results, node, (current_path + [current_node]))\n end\n\n return results\nend",
"def translate_states_and_rules(states)\n # new rules, one state(set of states) to all character\n rules = states.flat_map { |state| rules_for state }\n # set of states that a state can reach(nfa.next_state)\n # treated as a new state\n more_states = rules.map(&:next_state).to_set\n # if true, then all states rule had been added to rules\n if more_states.subset? states\n [states, rules]\n else\n translate_states_and_rules(states + more_states)\n end\n end",
"def connect_local_graphs_data(local_graphs)\n dfg.blocks.each do |predecessor|\n arg_outs = local_graphs[predecessor.id].outputs.values\n arg_outs.each_with_index do |arg_out, arg_n|\n predecessor.outgoing_blocks.each do |successor|\n successor_graph = local_graphs[successor.id]\n arg_in = successor_graph.inputs.values[arg_n]\n\n # We're connecting to a phi node, so we may need a special\n # label.\n raise unless arg_in.is_a?(PhiNode)\n\n label =\n case arg_out\n when InsnNode\n # Instructions that go into a phi node are labelled by the\n # offset of last instruction in the block that executed\n # them. This way you know which value to use for the phi,\n # based on the last instruction you executed.\n dfg.blocks.find do |block|\n block_start = block.block_start\n block_end =\n block_start + block.insns.sum(&:length) -\n block.insns.last.length\n\n if (block_start..block_end).cover?(arg_out.offset)\n break block_end\n end\n end\n when PhiNode\n # Phi nodes to phi nodes are not labelled.\n else\n raise\n end\n\n connect(arg_out, arg_in, :data, label)\n end\n end\n end\n end",
"def closure_of(node_label)\r\n closure = [node_label].flatten\r\n changed = true\r\n while (changed == true)\r\n changed = false\r\n closure.each do |node|\r\n # if there is m not already in C and n->lambda->m then add m to c\r\n if(!@graph_hash[node].nil? && !@graph_hash[node][LAMBDA].nil?)\r\n lambda_reachables = [@graph_hash[node][LAMBDA]].flatten\r\n lambda_reachables.each do |l_node|\r\n if !closure.include?(l_node)\r\n closure << l_node\r\n changed = true\r\n end\r\n end\r\n end\r\n end\r\n end\r\n\r\n return closure #.flatten\r\n end",
"def make_graph(all_dependencies)\n graph = RGL::DirectedAdjacencyGraph.new\n all_dependencies.each do |source, targets|\n if targets.empty?\n graph.add_vertex(source)\n else\n targets.each { |target| graph.add_edge(source, target) }\n end\n end\n graph\n end",
"def sh4LowerSimpleBranchOps(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n annotation = node.annotation\n case node.opcode\n when /^b(addi|subi|ori|addp)/\n op = $1\n bc = $~.post_match\n\n case op\n when \"addi\", \"addp\"\n op = \"addi\"\n when \"subi\", \"subp\"\n op = \"subi\"\n when \"ori\", \"orp\"\n op = \"ori\"\n end\n\n if bc == \"s\"\n raise \"Invalid operands number (#{node.operands.size})\" unless node.operands.size == 3\n if node.operands[1].is_a? RegisterID or node.operands[1].is_a? SpecialRegister\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..1])\n newList << Instruction.new(node.codeOrigin, \"bs\", node.operands[1..2])\n else\n tmpVal = Tmp.new(node.codeOrigin, :gpr)\n tmpPtr = Tmp.new(node.codeOrigin, :gpr)\n addr = Address.new(node.codeOrigin, tmpPtr, Immediate.new(node.codeOrigin, 0))\n newList << Instruction.new(node.codeOrigin, \"leap\", [node.operands[1], tmpPtr])\n newList << Instruction.new(node.codeOrigin, \"loadi\", [addr, tmpVal])\n newList << Instruction.new(node.codeOrigin, op, [node.operands[0], tmpVal])\n newList << Instruction.new(node.codeOrigin, \"storei\", [tmpVal, addr])\n newList << Instruction.new(node.codeOrigin, \"bs\", [tmpVal, node.operands[2]])\n end\n elsif bc == \"nz\"\n raise \"Invalid operands number (#{node.operands.size})\" unless node.operands.size == 3\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..1])\n newList << Instruction.new(node.codeOrigin, \"btinz\", node.operands[1..2])\n else\n newList << node\n end\n when \"bmulio\", \"bmulpo\"\n raise \"Invalid operands number (#{node.operands.size})\" unless node.operands.size == 3\n tmp1 = Tmp.new(node.codeOrigin, :gpr)\n tmp2 = Tmp.new(node.codeOrigin, :gpr)\n newList << Instruction.new(node.codeOrigin, node.opcode, [tmp1, tmp2].concat(node.operands))\n else\n newList << node\n end\n else\n newList << node\n end\n }\n newList\nend",
"def annotate_edges(graph)\n graph.edges.each do |edge|\n if edge.to.props.dig(:node_class, :node_class) == 'org.graalvm.compiler.nodes.ValuePhiNode' && edge.props[:name] == 'values'\n merge_node = edge.to.edges.find { |e| e.props[:name] == 'merge' }.from\n control_into_merge = %w[ends loopBegin]\n merge_node_control_edges_in = merge_node.edges.select { |e| control_into_merge.include?(e.props[:name]) && e.to.props.dig(:node_class, :node_class) != 'org.graalvm.compiler.nodes.LoopExitNode' }\n matching_control_edge = merge_node_control_edges_in[edge.props[:index]]\n control_in_node = matching_control_edge.nodes.find { |n| n != merge_node }\n edge.props[:label] = \"from #{control_in_node.id}\"\n edge.props[:kind] = 'data'\n next\n end\n\n # Look at the name of the edge to decide how to treat them.\n case edge.props[:name]\n\n # Control edges.\n when 'ends', 'next', 'trueSuccessor', 'falseSuccessor', 'exceptionEdge'\n edge.props[:kind] = 'control'\n case edge.props[:name]\n when 'trueSuccessor'\n # Simplify trueSuccessor to T\n edge.props[:label] = 'T'\n when 'falseSuccessor'\n # Simplify falseSuccessor to F\n edge.props[:label] = 'F'\n when 'exceptionEdge'\n # Simplify exceptionEdge to unwind\n edge.props[:label] = 'unwind'\n end\n\n # Info edges, which are drawn reversed as they point from the user\n # to the info.\n when 'frameState', 'callTarget', 'stateAfter'\n edge.props[:label] = nil\n edge.props[:kind] = 'info'\n edge.props[:reverse] = true\n\n # Condition for branches, which we label as ?.\n when 'condition'\n edge.props[:kind] = 'data'\n edge.props[:label] = '?'\n\n # loopBegin edges point from LoopEndNode (continue) and LoopExitNode\n # (break) to the LoopBeginNode. Both are drawn reversed.\n when 'loopBegin'\n edge.props[:hidden] = true\n\n case edge.to.props.dig(:node_class, :node_class)\n when 'org.graalvm.compiler.nodes.LoopEndNode'\n # If it's from the LoopEnd then it's the control edge to follow.\n edge.props[:kind] = 'loop'\n edge.props[:reverse] = true\n when 'org.graalvm.compiler.nodes.LoopExitNode'\n # If it's from the LoopExit then it's just for information - it's\n # not control flow to follow.\n edge.props[:kind] = 'info'\n edge.props[:reverse] = true\n else\n raise EncodingError, 'loopBegin edge not to LoopEnd or LoopExit'\n end\n\n # Merges are info.\n when 'merge'\n edge.props[:kind] = 'info'\n edge.props[:reverse] = true\n\n # Successors are control from a switch.\n when 'successors'\n # We want to label the edges with the corresponding index of the key.\n if edge.props[:index] == edge.from.props['keys'].size\n label = 'default'\n else\n label = \"k[#{edge.props[:index]}]\"\n end\n edge.props[:label] = label\n edge.props[:kind] = 'control'\n\n # Successors are control from a switch.\n when 'arguments'\n # We want to label the edges with their corresponding argument index.\n edge.props[:label] = \"arg[#{edge.props[:index]}]\"\n edge.props[:kind] = 'data'\n\n # Everything else is data.\n else\n edge.props[:kind] = 'data'\n edge.props[:label] = edge.props[:name]\n\n end\n end\n end",
"def process_lasgn exp\n exp = exp.dup\n exp.rhs = process exp.rhs\n exp\n end",
"def build\n GraphUtilities.alternation(@left.build, @right.build)\n end",
"def process_iasgn exp\n exp = exp.dup\n exp.rhs = process exp.rhs\n exp\n end",
"def execute_swap graph, swap\n mark {a,b}\n swap a,b\n compute_d {a,b}\n graph.t += swap.gain\n return graph\nend",
"def graphit\n ticks = %w(▁ ▂ ▃ ▄ ▅ ▆ ▇)\n distance = @data.max.to_f / ticks.size\n puts @data.map { |x| compute(x, distance) <= 0 ? ticks[0] : ticks[compute(x, distance)] }.join('')\n end",
"def traverse_graph(start_node_name, definitions, file_name)\n json_result = []\n all_paths = find_all_paths_from_node(start_node_name)\n all_paths = remove_subarrays(all_paths)\n\n all_paths.each do |path|\n p \"path: #{path}\"\n next if path.length < 2\n\n (0..path.length - 1).each do |i|\n break if i == path.length - 1\n break if @adj_matrix[path[i]].eql? nil\n break if @adj_matrix[path[i]][path[i + 1]].eql? nil\n\n @adj_matrix.fetch(path[i]).fetch(path[i + 1]).fetch('function')\n begin\n definitions.send(@adj_matrix.fetch(path[i]).fetch(path[i + 1]).fetch('function'))\n @adj_matrix[path[i]][path[i + 1]]['value'] = true\n rescue RuntimeError => e\n puts \"ERROR going from #{path[i]} to #{path[i + 1]}\"\n puts e.message.to_s\n # unless @adj_matrix[path[i]][path[i + 1]]['value'] = false\n # appended_error = @adj_matrix[path[i]][path[i + 1]]['label'].concat(\" \\nError: #{e.message}\")\n # @adj_matrix[path[i]][path[i + 1]]['label'] = appended_error\n # end\n @adj_matrix[path[i]][path[i + 1]]['value'] = false\n end\n\n temp = {}\n temp['source'] = path[i]\n temp['destination'] = path[i + 1]\n temp['label'] = @adj_matrix[path[i]][path[i + 1]]['label']\n temp['value'] = @adj_matrix[path[i]][path[i + 1]]['value']\n json_result.push(temp)\n end\n build_model(json_result, file_name)\n end\n build_model(json_result, file_name)\n end",
"def build_stack(graph)\n require 'set'\n\n terminals = graph.filter_map { |(from, to)| to.nil? && from }\n stack = [terminals]\n seen = Set.new(terminals)\n deps = []\n\n loop do\n stack[-1].each do |e|\n deps = graph.select { |(from, to)| to == e && !seen.include?(from) }.map do |from, _to|\n seen << from\n from\n end\n stack << deps if deps.any?\n end\n\n break if deps.empty?\n end\n\n stack\n end",
"def dag_longpath(source, sink, weight_edge_graph, graph)\n <<-DOC\n The backtracking method can be generalized to construct a longest path in any DAG. Whenever we compute S(b) as\n S(b) = max (all predecessors a of node b) {S(a) + weight_of_edge_from_a_to_b }\n we simply need to store a predecessor of b that was used in the computation of sb so that we can backtrack later on. \n You are now ready to use backtracking to find the longest path in an arbitrary DAG.\n DOC\n topo_graph = Marshal.load(Marshal.dump(graph))\n topo_nodes = topological_ordering(topo_graph)\n # puts topo_nodes.join(\" \")\n\n puts graph\n keys = graph.keys\n values = graph.values.flatten.uniq\n # puts keys.join(\" \")\n # puts values.join(\" \")\n nodes_with_indegree_zero = keys - values\n puts nodes_with_indegree_zero.join(\" \")\n\n puts weight_edge_graph.join(\" \")\n nodes_with_indegree_zero.each do |node|\n unless node == source\n topo_nodes.delete(node) \n weight_edge_graph.delete_if {|entry| /^#{node}->/.match(entry)}\n end\n end\n\n # nodes_to_consider = [source]\n # next_node = source\n # index = 1\n # loop do\n # break if next_node == sink\n # if graph[next_node]\n # graph[next_node].each do |node|\n # # puts node\n # nodes_to_consider << node unless nodes_to_consider.include?(node)\n # end\n # end\n # next_node = nodes_to_consider[index]\n # index += 1\n # end\n # puts \"nodes_to_consider: \" + nodes_to_consider.join(\" \")\n # topo_nodes.keep_if {|node| nodes_to_consider.include?(node)}\n puts \"topo nodes: \" + topo_nodes.join(\" \")\n\n puts weight_edge_graph.join(\" \")\n incoming_nodes = {}\n incoming_nodes[topo_nodes[0]] = [{\"pred_node\" => nil, \"weight\" => 0}]\n\n\n best_pred = {}\n topo_nodes.each do |node|\n # incoming_nodes[node] = [{\"pred_node\" => nil, \"weight\" => 0}]\n best_pred[node] = {\"pred_node\" => nil, \"weight\" => 0}\n end\n\n # puts weight_edge_graph.join(\" \")\n (1..(topo_nodes.length-1)).each do |i|\n node = topo_nodes[i]\n puts \"Node: \" + node\n all_weights = []\n weight_edge_graph.each do |entry| \n # puts \"Entry: \" + entry\n # puts best_pred\n if /(\\d+)->#{node}:(\\d+)/.match(entry) \n incoming_nodes[node] = [] unless incoming_nodes[node]\n pred_node_matched = /(\\d+)->#{node}:(\\d+)/.match(entry)[1]\n pred_node_weight = /(\\d+)->#{node}:(\\d+)/.match(entry)[2].to_i\n # puts /(\\d+)->#{node}:(\\d+)/.match(entry)[1]\n # puts /(\\d+)->#{node}:(\\d+)/.match(entry)[2]\n incoming_nodes[node] << {\"pred_node\" => pred_node_matched, \"weight\" => pred_node_weight}\n all_weights << (pred_node_weight + best_pred[pred_node_matched][\"weight\"])\n end\n end\n # puts all_weights.join(\" \")\n if incoming_nodes[node] \n # puts incoming_nodes[node]\n incoming_nodes[node].each do |pred_node_entry|\n # puts all_weights.join(\" \")\n if ((best_pred[pred_node_entry[\"pred_node\"]][\"weight\"] + pred_node_entry[\"weight\"]) == all_weights.max)\n best_pred[node][\"weight\"] = all_weights.max\n best_pred[node][\"pred_node\"] = pred_node_entry[\"pred_node\"]\n end\n end\n end\n end\n # puts incoming_nodes\n # puts best_pred\n length = best_pred[sink][\"weight\"]\n path = [sink]\n node = sink\n loop do\n puts node\n break if node == source\n node = best_pred[node][\"pred_node\"]\n path << node\n end\n return length, path.reverse\n end",
"def jump(*node_types); end",
"def graphviz(oGraph, c0, c1, c2, c3, c4)\n return if @src_id.nil? || @dst_id.nil?\n return if @count > 1 # TODO: eliminate dupulicate trans\n\n guard = @block.condition_success unless @block.nil?\n guard = \"unknown\" if guard.nil?\n\n if @title.nil?\n title = ''\n else\n title = \"#{@title}\"\n end\n @label = @type + '(' + title + ')\\n' + guard + '\\n' + @block.id\n\n if (@src_id =~ /^V_/) && (@dst_id =~ /^V_/)\n # V to V form\n src_id = @src_id + '_inbound'\n dst_id = @dst_id + '_inbound'\n\n elsif (@src_id =~ /^V_/) && (@dst_id =~ /^C_/)\n src_id = @src_id + '_inbound'\n dst_id = @dst_id\n\n c2.add_node(dst_id) if $graphviz_with_rank\n elsif (@src_id =~ /^C_/) && (@dst_id =~ /^V_/)\n src_id = @src_id\n dst_id = @dst_id + '_outbound'\n c2.add_node(src_id) if $graphviz_with_rank\n c4.add_node(dst_id) if $graphviz_with_rank\n elsif (@src_id =~ /^C_/) && (@dst_id =~ /^C_/)\n # redirect\n src_id = @src_id\n dst_id = @dst_id\n c2.add_node(src_id) if $graphviz_with_rank\n c3.add_node(dst_id) if $graphviz_with_rank\n else\n src_id = @src_id\n dst_id = @dst_id\n end\n\n # draw\n e = oGraph.add_edge(src_id, dst_id, label: @label)\n end",
"def make_graph\r\n lines.each {|line, stations|\r\n stations.each_with_index {|x, index|\r\n unless stations.at(index+1).nil?\r\n graph.add_edge(find_node(x), find_node(stations.at(index+1)))\r\n end\r\n }\r\n }\r\n end",
"def reduce_edges(graph)\n graph.nodes.each_value do |node|\n if SIMPLE_INPUTS.include?(node.props.dig(:node_class, :node_class))\n node.props[:inlined] = true\n end\n end\n end",
"def evaluate(inputs=[], soft_fail=true)\n stack = Stack.new\n tokens.each do |token|\n if numeric?(token)\n stack.push(token.to_f)\n elsif token.start_with? \"i\"\n if inputs.size == 0\n next if soft_fail\n raise \"Trying to use 'i' token with 0 inputs\"\n end\n # input:\n index = token[1..-1].to_i % inputs.size\n stack.push(inputs[index])\n elsif token == \"+\"\n next if soft_fail and stack.size < 2\n rhs = stack.pop\n lhs = stack.pop\n stack.push(lhs + rhs)\n elsif token == \"*\"\n next if soft_fail and stack.size < 2\n rhs = stack.pop\n lhs = stack.pop\n stack.push(lhs * rhs)\n elsif token == \"-\"\n next if soft_fail and stack.size < 2\n rhs = stack.pop\n lhs = stack.pop\n stack.push(lhs - rhs)\n elsif token == \"/\"\n next if soft_fail and stack.size < 2\n rhs = stack.pop\n lhs = stack.pop\n stack.push(lhs / rhs)\n elsif token == \"log\"\n next if soft_fail and stack.size < 1\n rhs = stack.pop\n stack.push(Math.log(rhs))\n elsif token == \"log10\"\n next if soft_fail and stack.size < 1\n rhs = stack.pop\n stack.push(Math.log10(rhs))\n elsif token == \"tanh\"\n next if soft_fail and stack.size < 1\n rhs = stack.pop\n stack.push(Math.tanh(rhs))\n else\n next if soft_fail\n raise \"Unknown token: #{token}\"\n end\n end\n stack.pop\n end",
"def problem_107\n if false\n net = [ \"-,16,12,21,-,-,-\", \"16,-,-,17,20,-,-\", \"12,-,-,28,-,31,-\",\n \"21,17,28,-,18,19,23\", \"-,20,-,18,-,-,11\", \"-,-,31,19,-,-,27\",\n \"-,-,-,23,11,27,-\" ]\n net.map! {|line| line.split(/,/).map {|i| i == '-' ? nil : i.to_i}}\n else\n net = []\n open(\"network.txt\").each do |line|\n net << line.chomp.split(/,/).map {|i| i == '-' ? nil : i.to_i}\n end\n end\n\n # Reformat into an array of nodes, with the their connections\n nodes = Hash.new {|h,k| h[k] = Hash.new }\n net.each_with_index do |row,i| # Each nodes is connected to...\n row.each_index do |col| # For each possible connection....\n # Add the node we are connected to and the cost\n nodes[i][col] = row[col] if row[col]\n end\n end\n\n initial = nodes.reduce(0) do |a,row|\n row[1].reduce(a) {|aa,p| aa + p[1] }\n end / 2\n # add to the 'borg' that is node0\n node0,node0_links = nodes.shift\n ans = []\n node0_contains = Hash.new\n node0_contains[node0] = true\n\n # What we do select the lowest link, the 'merge' it into node0, repeat\n while nodes.length > 0\n n,v = node0_links.min {|a,b| a[1] <=> b[1]}\n ans << [n,v] # Save the link for the answer\n node0_contains[n] = true # add to the 'borg' that is node0\n nodes[n].each_pair do |k,a| # Now merge in new poin, update vertexs\n next if node0_contains[k]\n node0_links[k] = [a, node0_links[k] || 1_000_000].min\n end\n nodes.delete(n) # Remove from free nodes\n node0_links.delete(n) # Remove from vertexes to resolve\n end\n\n now = ans.reduce(0) {|a,v| a + v[1]}\n puts \"initial = #{initial}\"\n puts \"now = #{now}\"\n initial - now\nend",
"def linearize(lines)\n lines = lines.split(/\\n/) if lines.is_a? String\n lines = lines.select { |l| not l.blank? }\n return '' if lines.empty?\n i = lines.\n index_range.\n sort_by { |i| lines[i] =~ /^( *)(-*)/; [$1.length,-$2.length,i] }.\n first { |i| good_divider(lines,i) }\n above,below = lines.rows(0...i),lines.rows((i+1)..-1)\n last_text = nil\n segments(lines[i]).collect { |text,range|\n implicit_mult = ((last_text =~ /[a-z0-9.\\)\\]]$/i and text =~ /^[a-z0-9.\\(]/i))? '*' : ''\n #p [implicit_mult,last_text,text,last_text =~ /[a-z0-9.\\)\\]]$/i,text =~ /^[a-z0-9.\\(]/i]\n a = above.columns(range)\n b = below.columns(range)\n implicit_mult + case text\n when /^ *$/ then (b.all_blank? ? '' : \"[#{ linearize(b)}]\") + (a.all_blank? ? '' : \"**(#{linearize(a)})\")\n when /^---+$/ then last_text = \"((#{linearize(a)})/(#{linearize(b)}))\"\n else last_text = text.strip\n end\n }.join\n end",
"def ll_map(function) \n current = 0\n current_node = @head\n\n while current < @num_nodes\n current_node.set_Data(function.call(current_node.get_Data()))\n current_node = current_node.get_Next()\n current += 1\n end\n end",
"def operation\n results = []\n @children.each { |child| results.append(child.operation) }\n \"Branch(#{results.join('+')})\"\n end",
"def start_graph(words)\n # initialize graph and edge count\n g = nodeset(words)\n gk = g.keys\n\n # initialize edge count\n incoming_edges = {}\n gk.each { |k| incoming_edges[k] = 0 }\n\n words.each_with_index do |w, i|\n w2 = words[i + 1]\n unless i + 1 == words.length\n # grab adjacent words in the dict and split them into arrays of their characters\n chars1, chars2 = w.split(\"\"), w2.split(\"\")\n chars1.each_with_index do |c, j|\n # compare characters in the words\n c2 = chars2[j]\n next if c == c2\n # note the parent/child relationship and increment the in-degree count\n g[c] += c2\n incoming_edges[c2] += 1\n break\n end\n end\n end\n\n alienlang(g, incoming_edges)\nend",
"def traceR( nodes, acc )\n if !acc || nodes.count <= 1\n return acc # base cases for failure / success\n else\n head = nodes.slice!(0)\n step = head.distanceTo( nodes[0] )\n\n acc = step ? ( acc + step ) : nil\n return traceR( nodes, acc )\n end\n end",
"def operation\n results = []\n @children.each { |child| results.push(child.operation) }\n \"Branch(#{results.join('+')})\"\n end",
"def call(*args)\n left = root.call(*args)\n\n right = nodes.map { |node|\n response =\n if node.lazy?\n node.call(args.first, left)\n else\n node.call(left)\n end\n\n if node.one? && !node.graph?\n [response]\n else\n response\n end\n }\n\n if one?\n [[left], right]\n else\n [left, right]\n end\n end",
"def create_local_graph(block)\n block_flow = dfg.block_flows.fetch(block.id)\n\n # A map of instructions to nodes.\n insn_nodes = {}\n\n # Create a node for each instruction in the block.\n block.each_with_length do |insn, offset|\n node = InsnNode.new(insn, offset)\n insn_nodes[offset] = node\n nodes << node\n end\n\n # The first and last node in the sub-graph, and the last fixed node.\n previous_fixed = nil\n first_fixed = nil\n last_fixed = nil\n\n # The merge node for the phi nodes to attach to.\n merge_node = nil\n\n # If there is more than one predecessor and we have basic block\n # arguments coming in, then we need a merge node for the phi nodes to\n # attach to.\n if block.incoming_blocks.size > 1 && !block_flow.in.empty?\n merge_node = MergeNode.new(id_counter)\n nodes << merge_node\n\n previous_fixed = merge_node\n first_fixed = merge_node\n last_fixed = merge_node\n end\n\n # Connect local control flow (only nodes with side effects.)\n block.each_with_length do |insn, length|\n if insn.side_effects?\n insn_node = insn_nodes[length]\n connect previous_fixed, insn_node, :control if previous_fixed\n previous_fixed = insn_node\n first_fixed ||= insn_node\n last_fixed = insn_node\n end\n end\n\n # Connect basic block arguments.\n inputs = {}\n outputs = {}\n block_flow.in.each do |arg|\n # Each basic block argument gets a phi node. Even if there's only\n # one predecessor! We'll tidy this up later.\n phi = PhiNode.new(id_counter)\n connect(phi, merge_node, :info) if merge_node\n nodes << phi\n inputs[arg] = phi\n\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows[consumer_offset]\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer == arg\n connect(phi, insn_nodes[consumer_offset], :data, input_index)\n end\n end\n end\n\n block_flow.out.each { |out| outputs[out] = phi if out == arg }\n end\n\n # Connect local dataflow from consumers back to producers.\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows.fetch(consumer_offset)\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer.local?\n connect(\n insn_nodes[producer.length],\n insn_nodes[consumer_offset],\n :data,\n input_index\n )\n end\n end\n end\n\n # Connect dataflow from producers that leaves the block.\n block.each_with_length do |_, producer_pc|\n dfg\n .insn_flows\n .fetch(producer_pc)\n .out\n .each do |consumer|\n unless consumer.local?\n # This is an argument to the successor block - not to an\n # instruction here.\n outputs[consumer.name] = insn_nodes[producer_pc]\n end\n end\n end\n\n # A graph with only side-effect free instructions will currently have\n # no fixed nodes! In that case just use the first instruction's node\n # for both first and last. But it's a bug that it'll appear in the\n # control flow path!\n SubGraph.new(\n first_fixed || insn_nodes[block.block_start],\n last_fixed || insn_nodes[block.block_start],\n inputs,\n outputs\n )\n end",
"def eval_operation(node, env, stack_trace)\n\n\t# Evaluate both sides of operation (discard returned environment)\n\tleft, _ = eval_node_under(node.left, env, stack_trace)\n\tright, _ = eval_node_under(node.right, env, stack_trace)\n\n\tif left == nil or right == nil\n\t\treturn nil, env\n\tend\n\n\t# TODO: Add more operations.\n\tcase node.operator.value\n\twhen \"+\"\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn add_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn add_term_and_term_list(left, right), env\n\t\tin [TermList, Term]\n\t\t\treturn add_term_and_term_list(left, right), env\n\t\tin [TermList, TermList]\n\t\t\treturn add_term_list_and_term_list(left, right), env\n\t\tin [Fraction, Term]\n\t\t\treturn add_fraction_and_term(left, right), env\n\t\tin [Term, Fraction]\n\t\t\treturn add_fraction_and_term(right, left), env\n\t\tin [Fraction, TermList]\n\t\t\treturn add_fraction_and_term_list(left, right), env\n\t\tin [TermList, Fraction]\n\t\t\treturn add_fraction_and_term_list(right, left), env\n\t\tin [Fraction, Fraction]\n\t\t\treturn add_fraction_and_fraction(left, right), env\t\n\t\tin [Matrix, Matrix]\n\t\t\treturn add_two_matrices(left, right), env\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"-\"\n\t\tputs \"inter l: #{__LINE__} -- IMPORTANT NOTE: Using a subtraction.\" # TODO: Does this ever get used now that I've inverted a - b to a + (-b)?\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn subtract_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn subtract_term_list_from_term(right, left), env\n\t\tin [TermList, Term]\n\t\t\treturn subtract_term_from_term_list(right, left), env\n\t\tin [TermList, TermList]\n\t\t\treturn subtract_term_list_from_term_list(left, right), env\n\t\tin [Matrix, Matrix]\n\t\t\treturn subtract_matrix_minus_matrix(left, right), env\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"*\"\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn multiply_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn multiply_term_and_term_list(left, right), env\n\t\tin [TermList, Term]\n\t\t\treturn multiply_term_and_term_list(left, right), env\n\t\tin [TermList, TermList]\n\t\t\treturn multiply_term_list_and_term_list(left, right), env\n\t\tin [Fraction, Term]\n\t\t\treturn multiply_fraction_and_term(left, right), env\n\t\tin [Term, Fraction]\n\t\t\treturn multiply_fraction_and_term(right, left), env\n\t\tin [Fraction, TermList]\n\t\t\treturn multiply_fraction_and_term_list(left, right), env\n\t\tin [TermList, Fraction]\n\t\t\treturn multiply_fraction_and_term_list(right, left), env\n\t\tin [Fraction, Fraction]\n\t\t\treturn multiply_fraction_and_fraction(left, right), env\t\n\t\tin [Matrix, Matrix]\n\t\t\treturn multiply_two_matrices(left, right), env\n\t\tin [Matrix, Term]\n\t\t\treturn multiply_matrix_and_term(left, right), env\n\t\tin [Term, Matrix]\n\t\t\treturn multiply_matrix_and_term(right, left), env\n\t\tin [Matrix, TermList]\n\t\t\treturn multiply_matrix_and_term_list(left, right), env\n\t\tin [TermList, Matrix]\n\t\t\treturn multiply_matrix_and_term_list(right, left), env\n\t\tin [Matrix, Fraction]\n\t\t\treturn multiply_matrix_and_fraction(left, right), env\n\t\tin [Fraction, Matrix]\n\t\t\treturn multiply_matrix_and_fraction(right, left), env\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"/\"\n\t\tcase [left, right]\n\t\tin [Term, Term]\n\t\t\treturn divide_two_terms(left, right), env\n\t\tin [Term, TermList]\n\t\t\treturn divide_term_by_term_list(left, right), env\n\t\tin [TermList, Term]\n\t\t\treturn divide_term_list_by_term(left, right), env\n\t\tin [TermList, TermList]\n\t\t\treturn divide_term_list_by_term_list(left, right), env\n\t\tin [Fraction, Term]\n\t\t\treturn divide_fraction_by_term(left, right), env\n\t\tin [Term, Fraction]\n\t\t\treturn divide_term_by_fraction(right, left), env\n\t\tin [Fraction, TermList]\n\t\t\treturn divide_fraction_by_term_list(left, right), env\n\t\tin [TermList, Fraction]\n\t\t\treturn divide_term_list_by_fraction(right, left), env\n\t\tin [Fraction, Fraction]\n\t\t\treturn divide_fraction_by_fraction(left, right), env\t\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\tend\n\twhen \"*!\"\n\t\tcase [left, right]\n\t\tin [Matrix, Matrix]\n\t\t\treturn tensor_product_of_two_matrices(left, right), env\n\t\telse\n\t\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented for left: #{left.type}, right: #{right.type}.\", node, stack_trace) \n\t\t\treturn nil, env\n\t\tend\n\telse\n\t\tthrow_error(\"Operator '#{node.operator.value}' not implemented.\", node, stack_trace) \n\tend\nend",
"def initialize_graph!(rules)\n rules.each do |rule|\n bag, linked_bags = rule\n\n node = find_or_create_node(bag.color)\n\n edges = linked_bags.map do |linked_bag|\n linked_node = find_or_create_node(linked_bag.color)\n\n Edge.new(linked_bag.num, linked_node)\n end\n\n node.edges += edges\n\n @nodes_by_color[bag.color] = node\n end\n end",
"def make_graph(input)\n dg = RGL::AdjacencyGraph[]\n lines = input.split(\"\\n\")\n n = lines[0].to_i\n for i in 1..n do\n data = lines[i].split(\" \")\n next if data[0].to_i <= 0\n data.shift # break data\n data.each{|v| dg.add_edge i, v.to_i }\n end\n dg\nend",
"def minilang(instructions)\n stack = []\n register = 0\n functions = {\n 'PUSH' => Proc.new { stack.push(register) },\n 'ADD' => Proc.new { register += stack.pop },\n 'SUB' => Proc.new { register -= stack.pop },\n 'MULT' => Proc.new { register = stack.pop * register },\n 'DIV' => Proc.new { register = register / stack.pop },\n 'MOD' => Proc.new { register = register % stack.pop },\n 'POP' => Proc.new { register = stack.pop },\n 'PRINT'=> Proc.new { puts register },\n 'STACK'=> Proc.new { puts stack }\n }\n\n instructions = instructions.split\n instructions.map! do |instruction|\n if instruction.to_i != 0\n instruction.to_i\n else\n instruction\n end\n end\n\n instructions.each do |instruction|\n if instruction.is_a?(Integer)\n register = instruction\n next\n end\n functions[instruction].call\n end\nend",
"def next_nodes\n transitions.map(&:target)\n end",
"def all_paths_source_target(graph)\n current_path = []\n results = []\n\n dfs(graph, results, 0, current_path)\n return results\nend",
"def node_seq(node, this, nxt)\n a = this\n b = new_state()\n\n # Create a sequence of transitions between this and next, \n # creating more states as needed\n node.children.each.with_index do |child, index|\n if index == node.children.size - 1\n b = nxt\n end\n\n process_node(child, a, b)\n\n a = b\n b = new_state()\n end\n end",
"def sh4LowerMisplacedLabels(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n operands = node.operands\n newOperands = []\n operands.each {\n | operand |\n if operand.is_a? LabelReference\n tmp = Tmp.new(operand.codeOrigin, :gpr)\n newList << Instruction.new(operand.codeOrigin, \"move\", [operand, tmp])\n newOperands << tmp\n else\n newOperands << operand\n end\n }\n newList << Instruction.new(node.codeOrigin, node.opcode, newOperands, node.annotation)\n else\n newList << node\n end\n }\n newList\nend",
"def draw(graph, machine, event, valid_states)\n state_requirements.each do |state_requirement|\n # From states determined based on the known valid states\n from_states = state_requirement[:from].filter(valid_states)\n\n # If a to state is not specified, then it's a loopback and each from\n # state maps back to itself\n if state_requirement[:to].values.empty?\n loopback = true\n else\n to_state = state_requirement[:to].values.first\n to_state = to_state ? to_state.to_s : 'nil'\n loopback = false\n end\n\n # Generate an edge between each from and to state\n from_states.each do |from_state|\n from_state = from_state ? from_state.to_s : 'nil'\n graph.add_edges(from_state, loopback ? from_state : to_state,\n label: event.to_s,\n labelfontsize: 10,\n taillabel: callback_method_names(machine, :before).join('\\n'),\n headlabel: callback_method_names(machine, :after).join('\\n'))\n end\n end\n\n true\n end",
"def solve_linear\n unless params[:a].blank? || params[:b].blank?\n @equation = \"#{params[:a]}x + #{params[:b]} = 0\"\n #url = 'http://equation-solver-backend.herokuapp.com/solve'\n url = Sinatra::SERVER_URL # backend server url\n data = { equation: { type: 'linear', a: params[:a], b: params[:b] } }.to_json\n res_body = json_response(http_post(url, data))\n @answer = res_body['success']\n @error = res_body['error']\n else\n flash.now[:error] = \"fields can't be blank!\"\n render '_linear'\n end\n end",
"def each(solutions: RDF::Query::Solutions(RDF::Query::Solution.new), &block)\n log_debug(\"(formula each)\") {SXP::Generator.string([self, solutions].to_sxp_bin)}\n\n # Yield statements by binding variables\n solutions.each do |solution|\n # Bind blank nodes to the solution when it doesn't contain a solution for an existential variable\n existential_vars.each do |var|\n solution[var.name] ||= RDF::Node.intern(var.name.to_s.sub(/^\\$+/, ''))\n end\n\n log_debug(\"(formula apply)\") {solution.to_sxp}\n # Yield each variable statement which is constant after applying solution\n log_depth do\n n3statements.each do |statement|\n terms = {}\n [:subject, :predicate, :object].each do |part|\n terms[part] = case o = statement.send(part)\n when RDF::Query::Variable\n if solution[o] && solution[o].formula?\n log_info(\"(formula from var form)\") {solution[o].graph_name.to_sxp}\n form_statements(solution[o], solution: solution, &block)\n else\n solution[o] || o\n end\n when RDF::N3::List\n o.variable? ? o.evaluate(solution.bindings, formulae: formulae) : o\n when RDF::N3::Algebra::Formula\n # uses the graph_name of the formula, and yields statements from the formula. No solutions are passed in.\n log_info(\"(formula from form)\") {o.graph_name.to_sxp}\n form_statements(o, solution: solution, &block)\n else\n o\n end\n end\n\n statement = RDF::Statement.from(terms)\n log_debug(\"(formula add)\") {statement.to_sxp}\n\n block.call(statement)\n end\n\n # statements from sub-operands\n sub_ops.each do |op|\n log_debug(\"(formula sub_op)\") {SXP::Generator.string [op, solution].to_sxp_bin}\n op.each(solutions: RDF::Query::Solutions(solution)) do |stmt|\n log_debug(\"(formula add from sub_op)\") {stmt.to_sxp}\n block.call(stmt)\n # Add statements for any term which is a formula\n stmt.to_a.select(&:node?).map {|n| formulae[n]}.compact.each do |ef|\n log_debug(\"(formula from form)\") {ef.graph_name.to_sxp}\n form_statements(ef, solution: solution, &block) \n end\n end\n end\n end\n end\n end",
"def test_branch_chain\n #puts \"---------------test_branch_chain-----------------\"\n\n t1= t2 = t11 = t12 = t21 = t22 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do\n b.chain do\n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n b.chain do\n t21 = b.add(Thing21.new)\n t22 = b.add(Thing22.new)\n end\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12,t21,t22])\n assert r.include? [t1,t11]\n assert r.include? [t11,t12]\n assert r.include? [t12,t2]\n\n assert r.include? [t1,t21]\n assert r.include? [t21,t22]\n assert r.include? [t22,t2]\n\n assert_equal 6, r.size\n end",
"def export_jumptables(func)\n func.blocks.each do |mbb|\n branches = 0\n mbb.instructions.each do |ins|\n branches += 1 if ins.branch_type && ins.branch_type != \"none\"\n if ins.branch_type == 'indirect'\n successors = ins.branch_targets ? ins.branch_targets : mbb.successors\n targets = successors.uniq.map { |succ|\n succ.ais_ref\n }.join(\", \")\n gen_fact(\"instruction #{ins.ais_ref(:branch_index => branches)} branches to #{targets}\",\"jumptable (source: llvm)\",ins)\n end\n end\n end\n end",
"def lisp(*ops)\n case ops.length\n when 1\n send ops.first\n when 2\n sk!\n lisp *ops[0]\n lisp *ops[1]\n when 3\n sk! ; sk! ; sk! ; s\n lisp *ops[0]\n sk! ; k ; lisp *ops[2]\n lisp *ops[1]\n when 4\n sk! ; sk! ; sk! ; sk! ; s\n lisp *ops[0]\n sk! ; k ; lisp *ops[2]\n lisp *ops[1]\n lisp *ops[3]\n end\nend",
"def test_proxy_graph_separation\n\ttasks = prepare_plan :add => 3\n\tproxies = tasks.map { |t| transaction[t] }\n\n\tt1, t2, t3 = tasks\n\tp1, p2, p3 = proxies\n\tp1.depends_on p2\n\n\tassert_equal([], t1.enum_for(:each_child_object, Hierarchy).to_a)\n\tt2.depends_on t3\n\tassert(! Hierarchy.linked?(p2, p3))\n end",
"def solve(a)\n return [[1]] if a == 1\n prev = solve(a - 1)\n last = prev.last\n new_row = [1]\n (0..last.length - 2).each do |i|\n new_row << last[i] + last[i + 1]\n end\n new_row << 1\n prev << new_row\nend",
"def lowerMIPSCondBranch(list, condOp, node)\n if node.operands.size == 2\n list << Instruction.new(node.codeOrigin,\n condOp,\n [node.operands[0], MIPS_ZERO_REG, node.operands[-1]],\n node.annotation)\n elsif node.operands.size == 3\n tmp = Tmp.new(node.codeOrigin, :gpr)\n list << Instruction.new(node.codeOrigin,\n \"andi\",\n [node.operands[0], node.operands[1], tmp],\n node.annotation)\n list << Instruction.new(node.codeOrigin,\n condOp,\n [tmp, MIPS_ZERO_REG, node.operands[-1]])\n else\n raise \"Expected 2 or 3 operands but got #{node.operands.size} at #{node.codeOriginString}\"\n end\nend",
"def detect_cycle_in_graph(edges)\nend",
"def reduce_graph( states )\n @graph.delete_if do |state, neighbours|\n neighbours.delete_if { |neighbour| !states.include?(neighbour) }\n !states.include?(state)\n end\n end",
"def train(inputs, outputs)\n eval(inputs)\n backpropagate(outputs)\n calculate_error(outputs)\n end",
"def transitive_closure!\n cgtc = condensation.plexus_inner_transitive_closure!\n cgtc.each do |cgv|\n cgtc.adjacent(cgv).each do |adj|\n cgv.each do |u| \n adj.each {|v| add_edge!(u,v)} \n end\n end\n end; self\n end",
"def test_branch\n #puts \"---------------test_branch-----------------\"\n t1= nil\n t2 = nil\n t11 = nil\n t12 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12])\n assert_equal 4, r.size\n assert r.include? [t1,t11]\n assert r.include? [t1,t12]\n assert r.include? [t11,t2]\n assert r.include? [t12,t2]\n end",
"def generate_graph\n end",
"def parse(text)\n lines = text.lines\n\n header = eval(lines.shift)\n required, post, total, locals = header\n opt = total - required\n\n raise 'optional arguments not supported' unless opt == 0\n raise 'post arguments not supported' unless post == 0\n\n insns = []\n labels = {}\n\n # Explicitly load arguments into locals.\n\n locals.each_with_index do |name, n|\n insns.push [:arg, n]\n insns.push [:store, name]\n end\n\n # Translate each instruction.\n\n lines.each do |line|\n index = insns.size\n\n case line\n when /(\\d+):\\s+push_self/\n insns.push [:self]\n when /(\\d+):\\s+push_local\\s+(\\d+)\\s+#.*/\n insns.push [:load, locals[$2.to_i]]\n when /(\\d+):\\s+push_int\\s+(\\d+)/\n insns.push [:push, $2.to_i]\n when /(\\d+):\\s+send_stack\\s+:([\\w\\+\\-<]+),\\s+(\\d+)/\n insns.push [:send, $2.to_sym, $3.to_i]\n when /(\\d+):\\s+goto\\s+(\\d+):/\n insns.push [:jump, $2.to_i]\n when /(\\d+):\\s+goto_if_false\\s+(\\d+):/\n insns.push [:not]\n insns.push [:branch, $2.to_i]\n when /(\\d+):\\s+ret/\n insns.push [:return]\n when /(\\d+):\\s+allow_private/\n else\n raise 'unknown instruction'\n end\n\n # Remember that the Rubinius byte offset of this instruction was at this index in our array of instructions.\n\n labels[$1.to_i] = index\n end\n\n # Go back and modify branch targets - we didn't know offsets for forward jumps on the first pass.\n\n insns.each do |insn|\n if [:jump, :branch].include?(insn.first)\n insn[1] = labels[insn[1]]\n end\n end\n\n insns\n end",
"def add_phi_moves(graph)\n to_remove = []\n\n phis = graph.find_nodes(:phi)\n\n phis.each do |phi|\n phi_register = phi.props[:register]\n merge = phi.inputs.with_input_name(:switch).nodes.first\n\n phi.inputs.edges.dup.each do |input|\n if input.value?\n input_register = input.from.props[:register]\n if input_register != phi_register\n # We want to add a move node, but by the time the register\n # allocator is run the graph is very complicated, with\n # data flow, control flow, and a local schedule. We'll ignore\n # most of that and just insert this move into the local\n # schedule.\n\n input.input_name =~ /value\\((.*)\\)/\n name = $1\n\n last_before_merge = merge.inputs.with_input_name(:\"control(#{name})\").nodes.first\n local_schedule_edge = last_before_merge.outputs.edges.find { |e| e.output_name == :local_schedule }\n\n move = IR::Node.new(:move, from: input_register, register: phi_register)\n local_schedule_edge.interdict move\n input.from.output_to input.output_name, move, :value\n move.output_to :value, input.to, input.input_name\n input.remove\n end\n end\n end\n\n to_remove.each(&:remove)\n end\n end",
"def sum_lists(head1, head2)\n # Numbers are forward e.g. 5->2->1 turns into 125\n number1 = list_to_string(head1)\n number2 = list_to_string(head2)\n\n result = (number1.to_i + number2.to_i).to_s\n head = Node.new(result[-1].to_i)\n tail = head\n\n # Loop through all numbers except the head from the end of the list to the beginning\n # in order to reverse the result e.g. '125' turns into 5->2->1\n (result.size - 2).downto(0) do |x|\n tail.next = Node.new(result[x].to_i)\n tail = tail.next\n end\n head\nend",
"def get_all_operations\n list = []\n queue = Queue.new\n queue << node\n until queue.empty?\n n = queue.pop\n puts \"NODE: \" + n.to_s\n if n.operation != NodeOperation::NODE\n list.push(n)\n n.nodes.each do |sub_node|\n queue << sub_node\n end\n end\n end\n list\n end",
"def complete_graph(n)\n set = (Integer === n) ? 1..n : n\n RGL::ImplicitGraph.new do |g|\n g.vertex_iterator { |b| set.each(&b) }\n g.adjacent_iterator do |x, b|\n set.each { |y| b.call(y) unless x == y }\n end\n end\nend",
"def trace(begX, begY, endX, endY)\n path,solution = solve(begX, begY, endX, endY)\n if(solution.length != 0)\n solution.each{|x| self.graph[x[0]][x[1]] = '@'}\n puts graph.map { |x| x.join(' ') }\n else\n puts \"There are no way from #{[begX,begY]} to #{[endX,endY]}\"\n end\n end",
"def rpn(operation)\n rpn_stack = Stack.new\n tokens = parse_tokens(operation)\n puts tokens.to_s\n tokens.each do |token|\n if !is_operator?(token)\n puts \"pushing token #{token}\"\n rpn_stack.push(token)\n else\n val2 = rpn_stack.pop\n val1 = rpn_stack.pop\n rpn_stack.push(calculate(val1,val2, token))\n end # end of if\n end # end of each\n rpn_stack.pop\nend",
"def eulerian_path(graph)\n # We can just use the eulerian cycle problem by just choosing the \n # first node which has greater outdegree than indegree\n\n node = graph.keys[0]\n in_degrees = {}\n graph.values.flatten.each do |val|\n in_degrees[val] = 0 unless in_degrees.has_key?(val)\n in_degrees[val] += 1\n end\n # puts in_degrees.to_s\n graph.each do |k,v|\n if in_degrees.has_key?(k) and v.length > in_degrees[k]\n node = k\n break\n end\n unless in_degrees.has_key?(k)\n node = k\n break\n end\n end\n stack = [node]\n cycle = []\n while (not stack.empty?)\n node = stack[-1]\n if graph.has_key?(node)\n new_node = graph[node][0]\n # puts \"New node:\" + new_node\n stack << new_node\n if graph[node].length > 1\n graph[node].delete(new_node)\n else\n graph.delete(node)\n end\n else\n cycle.unshift(stack.pop)\n # puts stack.join(\" \")\n end\n end\n\n return cycle \n end",
"def expression\n if is_addop($lookahead)\n emitln \"xor %eax, %eax\"\n else\n term\n end\n\n while is_addop($lookahead)\n emitln \"movl %eax, -(0x8*#{$stackdepth})(%rsp)\"\n case $lookahead\n when \"+\"\n add\n when \"-\"\n subtract\n else\n expected \"Addop\"\n end\n end\nend",
"def test_branch_chain2\n #puts \"---------------test_branch_chain2-----------------\"\n\n t1= t2 = t11 = t12 = t21 = t23 = t31 = t32 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do\n b.chain do\n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n b.chain do\n b.branch do\n t21 = b.add(Thing21.new)\n b.chain do\n t31 = b.add(Thing31.new)\n t32 = b.add(Thing32.new)\n end\n end\n t23 = b.add(Thing23.new)\n end\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12,t21,t23,t31,t32])\n assert r.include? [t1,t11]\n assert r.include? [t1,t21]\n assert r.include? [t1,t31]\n\n assert r.include? [t11,t12]\n assert r.include? [t12,t2]\n\n assert r.include? [t21,t23]\n assert r.include? [t23,t2]\n\n assert r.include? [t31,t32]\n assert r.include? [t32,t23]\n\n assert_equal 9, r.size\n end",
"def transitions\n [\n {:parked => :idling, :on => :ignite},\n {:idling => :first_gear, :first_gear => :second_gear, :on => :shift_up}\n # ...\n ]\n end",
"def boomerang(texts, opts={})\n texts = Array(texts)\n origin = opts[:from] || detect(texts[0])[0]\n throughs = opts[:through] || set_target(texts)\n nodes = Array(throughs).unshift(origin).push(origin)\n\n translated = []\n nodes.each_cons(2) do |from, to|\n texts = translate(texts, :from => from, :to => to)\n translated << texts if opts[:verbose]\n end\n\n opts[:verbose] ? translated : texts\n end",
"def bridge\n visited = {}\n disc = [Float::INFINITY] * @V\n low = [Float::INFINITY] * @V\n parent = [-1] * @V\n (0...@V).each{|u|\n bridgeUtil(u, visited, parent, low, disc)\n }\n @answer\n\n end",
"def level_order_traversal_line_by_line_sol1(root_node)\n queue = Queue.new\n queue.enq root_node\n while(!queue.empty?)\n node_count = queue.size\n while(node_count > 0)\n node = queue.deq\n print node.value\n print \"\\s\"\n\n queue.enq node.left unless node.left.nil?\n queue.enq node.right unless node.right.nil?\n node_count -= 1\n end\n puts \"\\n\"\n end \n end",
"def process_sequence(sequence)\n @current_node = @init_node\n sequence.each do |instance|\n next_label = instance.label\n next_node = @label_to_node[next_label]\n if !next_node\n next_node = Node.new\n next_node.label = next_label\n next_node.output = instance.output\n @label_to_node[next_label] = next_node\n end\n @labels.add next_label\n @outputs.add instance.output\n @current_node.add_obj(instance, @seq_n)\n @graph.add_edge(@current_node, next_node)\n @current_node = next_node\n end\n @graph.add_edge(@current_node, @end_node)\n @seq_n += 1;\n end",
"def add_next_vertex(grammar, fsm, rules, vertex_by_set, curr_vertex)\n\tsignal = rules[0];\n\tr = rules[1];\n\tvertex_index = [];\n\tr.each do |rule|\n\t\tvertex_index += [rule[0], [rule[1][0..rule[2]-1]]];\n\tend\n\n\t#r = [[nonterm, [term,term,...], index], [ ... ] , ... ]\n\tnext_vertex = vertex_by_set[vertex_index]\n\tif next_vertex != nil then\n\t\t# vertex exists\n\t\tfsm.add_edge(signal, next_vertex, curr_vertex);\n\telse\n\t\t# vertex does not exist\n\n\t\tindex_new = fsm.vertex_set.size \n\t\tvertex_by_set[vertex_index] = index_new;\n\n\t\t# get completed production rules\n\t\tproduct = nil;\n\t\tr.each do |x|\n\t\t\tif x[2] >= x[1].size then\n\t\t\t\tproduct = x.clone;\n\t\t\t\tbreak;\n\t\t\tend\n\t\tend\n\t\tfsm.add_vertex(index_new, product);\n\n\t\tfsm.add_edge(signal, fsm.vertex_set.size - 1, curr_vertex);\n\n\t\trules_new = grammar.accepted_signals(r);\n\n\t\trules_new.each do |rule|\n\t\t\t#increment token index\n\t\t\tfor i in 0..rule[1].size-1 do\n\t\t\t\trule[1][i][2] += 1;\n\t\t\tend\n\t\t\tadd_next_vertex(grammar, fsm, rule, vertex_by_set, index_new);\n\t\tend\n\tend\nend",
"def translate( *args ) \n ## From Martin Rinehart 'Edges to Rubies' chapter 15\n ## May be called with a transformation and a vector, \n ## or with a transformation and r, g, b values.\n\n trans = args[0]\n if args.length == 2\n vec = args[1]\n r = vec[0]; g = vec[1]; b = vec[2] \n else\n r = args[1]; g = args[2]; b = args[3] \n end\n arr = trans.to_a()\n arr[12] += r; arr[13] += g; arr[14] += b \n return Geom::Transformation.new( arr )\n \n\tend",
"def Graph(str)\n graph = Graph.new\n nodes = {}\n str.lines.each do |line|\n case line\n when /^\\s*(\\w+):(.*)$/\n name,code = $~[1,2]\n graph << (nodes[name] = eval(code))\n when /^\\s*(\\w+)\\s*->\\s*(\\w+)((\\s*->\\s*\\w+)*)\\s*(#.*)?$/\n name1,name2,others = $~[1,3]\n [name1,name2].each do |name|\n raise \"Undefined node: #{name} on line: #{line}\" if not nodes.key? name\n end\n nodes[name1].out << nodes[name2]\n \n if others != \"\"\n # repeat on the part of this line which we have not processed yet\n line = name2+others\n redo\n end\n when /^\\s*(#.*)?$/\n next\n else\n raise \"Couldn't parse this line: #{line}\"\n end\n end\n raise \"No start node defined! There should be a node called START.\" if not nodes.key? 'START'\n graph.start = nodes['START']\n graph\nend",
"def simplification\n changed = true\n while changed\n changed = false\n unless @operator.nil?\n old_left = ( @left_sentence ? Sentence.new(@left_sentence) : nil )\n old_right = ( @right_sentence ? Sentence.new(@right_sentence) : nil )\n case @operator.type\n when :conjunction\n simplification_rules_for_conjunction\n\n # ******* NEW APNF RULES FOR NEGATED IMPLICATION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_simplification_rules_for_conjunction()\n\n when :disjunction\n simplification_rules_for_disjunction\n\n # ******* NEW APNF RULES FOR NEGATED IMPLICATION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_simplification_rules_for_disjunction()\n\n when :negation\n simplification_rules_for_negation\n\n # ******* NEW SIMPLIFICATION RULES FOR NEGATION CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_simplification_rules_for_negation()\n\n when :new_operator\n # ******* OR A NEW OPERATOR NOT USED BEFORE CAN BE ADDED IN THE SIMPLIFICATION - LIKE IMPLICATION FOR EXAMPLE *******\n\n # ******* AND A NEW SIMPLIFICATION RULE CAN BE ADDED TO THIS OPERATOR *******\n # ******* FOR EXAMPLE: *******\n simplification_rules_for_new_operator()\n\n end\n\n @left_sentence.simplification unless @left_sentence.nil?\n @right_sentence.simplification unless @right_sentence.nil?\n\n unless Sentence.equals?(old_left, @left_sentence) && Sentence.equals?(old_right, @right_sentence)\n changed = true\n update\n end\n end\n end\n self\n end",
"def solve_prims\n linked, unlinked = [nodes.first], nodes[1..-1].dup\n end",
"def generate_rules(grammar)\n rules = []\n action_index = 0\n rule_indices = grammar.rule_indices\n term_indices = grammar.terminal_indices\n\n grammar.rules.each_with_index do |rule, rule_index|\n rule.branches.each do |branch|\n row = [TYPES[:action], action_index]\n\n action_index += 1\n\n branch.steps.reverse_each do |step|\n if step.is_a?(LL::Terminal)\n row << TYPES[:terminal]\n row << term_indices[step] + 1\n\n elsif step.is_a?(LL::Rule)\n row << TYPES[:rule]\n row << rule_indices[step]\n\n elsif step.is_a?(LL::Epsilon)\n row << TYPES[:epsilon]\n row << 0\n end\n end\n\n rules << row\n end\n end\n\n return rules\n end",
"def process_all(nodes)\n results = []\n nodes.to_a.each do |node|\n n = process(node)\n if n\n if n.is_a?(Inline)\n results += n\n else\n results << n\n end\n end\n end\n results\n end",
"def minilang(commands)\n stack = []\n register = 0\n command_arr = commands.split\n\n command_arr.each do |command|\n case command\n when \"PUSH\"\n stack.push(register)\n when \"ADD\"\n register += stack.pop\n when \"SUB\"\n register -= stack.pop\n when \"MULT\"\n register *= stack.pop\n when \"DIV\"\n if stack.last == 0\n puts \"Divide by zero error. Can't perform \\\"DIV\\\" command.\"\n else\n register /= stack.pop\n end\n when \"MOD\"\n if stack.last == 0\n puts \"Divide by zero error. Can't perform \\\"MOD\\\" command.\"\n else\n register %= stack.pop\n end\n when \"POP\"\n register = stack.pop\n when \"PRINT\"\n puts register\n else\n register = command.to_i\n end\n end\nend",
"def execute_best_swap graph\n gain,swap = execute_swap graph\n compute_swap\nend",
"def linear_equation(equation)\n #TODO:: calculate\n end",
"def infix\n @solutions.map do |solution|\n stack = []\n\n solution.each do |s|\n if s.is_a? Fixnum\n stack.push expr: s, precedence: 3\n else\n b = stack.pop\n a = stack.pop\n p = {'-' => 1, '+' => 1, '*' => 2, '/' => 2}[s]\n\n a[:expr] = \"(#{a[:expr]})\" if a[:precedence] < p\n b[:expr] = \"(#{b[:expr]})\" if b[:precedence] <= p\n\n stack.push expr: '%s %s %s' % [a[:expr], s, b[:expr]], precedence: p\n end\n end\n\n '%s = %d' % [stack.pop[:expr], @target]\n end\n end",
"def graph(hash_graph)\n # write your code here\n next_node = 0\n result = [0]\n \n while next_node != 4\n next_node = hash_graph[next_node].first\n result << next_node\n end\n \n result\nend",
"def bridge_on(*nodes)\n results = []\n nodes.zip(each_exit.cycle) do |curr, exit_node|\n node = curr.sample\n node .add_link exit_node.id\n exit_node.add_link node .id\n results << node\n end\n results\n end",
"def to_rpn(ast)\n out = []\n ops = []\n\n out.push(ast.shift) unless ast.empty?\n\n until ast.empty? do\n op = ast.shift\n p = OPS[op] || fail(Error \"Unknown operator '#{op}'\")\n\n until ops.empty? do\n break if p > OPS[ops.first]\n out.push(ops.shift)\n end\n\n ops.unshift(op)\n out.push(ast.shift) unless UNARY[op]\n end\n (out.concat(ops)).flatten\n end",
"def generate_chain(graph,chains)\r\n \r\n puts \"--- CHAIN ---------\"\r\n \r\n @Jobs.each do |current_job| \r\n \r\n name = Array.new\r\n \r\n # ciclo sui nodi della catena \r\n chains.each_with_index do |in_line,i|\r\n fields = in_line.split(',')\r\n classe = fields[1].split('.') \r\n \r\n # controllo se e un mapper\r\n node = in_line.scan(/addMapper\\(\\w+.*\\)/).map { |line| line.gsub(/\\s/, '') }\r\n unless node.size == 0\r\n type = \"MAPPER_\" \r\n is_what = \"is_mapper\"\r\n end\r\n \r\n # controllo se e un reducer\r\n node = in_line.scan(/setReducer\\(\\w+.*\\)/).map { |line| line.gsub(/\\s/, '') }\r\n unless node.size == 0\r\n type = \"REDUCER_\"\r\n is_what = \"is_reducer\"\r\n end\r\n\r\n if current_job == fields[0].split('(').last # se il job da analizzare é uguale al job del mapper => lo lavoro\r\n \r\n name[i] = current_job + \".\" + type + fields[1].split('(').last.split('.').first\r\n \r\n graph.add_node(name[i],is_what)\r\n puts \"aggiunto nodo chain:\" + name[i]\r\n \r\n # se non é il primo nodo della catena => chiudo i nodi pendenti\r\n if i==0\r\n Close_ALL_pending_links(graph,current_job,name[i])\r\n end\r\n \r\n # se non é il primo nodo della catena => aggiungo il link\r\n unless i==0 \r\n graph.add_link(name[i-1], name[i], \"\")\r\n puts \"aggiunto link:\" + name[i-1] + \"->\" + name[i]\r\n end\r\n \r\n # memorizzo l'ultimo nodo della catena ( mi servirá pi u avanti per definire i link)\r\n @last_mapper_name = name[i]\r\n\r\n end #if current job \r\n end #do cycle\r\n \r\n unless @last_mapper_name.nil?\r\n @OpenLink.push(@last_mapper_name); # l'ultimo nodo rimane con link pendente\r\n end\r\n \r\n end # do jobs \r\n\r\n end",
"def create_graph(stringSet)\n stringSet.each do |string|\n string.split(\"\").each_with_index do |char, i|\n curr_node = node_with_char(char)\n break if (i == (string.length) - 1)\n for index in (i+1)..(string.length-1) do \n next_node = node_with_char(string[index])\n curr_node.add_vertice(next_node) unless curr_node.contains?(next_node)\n end\n end\n end\n end",
"def n_ary_trees(range=2..2, minimize=true)\n raise \"Range parameter expected\" unless range.is_a? Range\n min = range.first.to_i\n raise \"minimum branches must be at least 2\" unless min > 1\n max = range.last.to_i\n max -= 1 if range.exclude_end?\n raise \"maximum branches less than minimum branches\" if max < min\n return [] if empty?\n\n # a lambda so we can do recursion without sticking private methods in Array\n\n # all n-way branches of a\n nwb = -> (a, n) do\n n = a.length if n > a.length\n if n == 1\n [a]\n else\n rv = []\n (1..( a.length - n + 1 )).each do |i|\n a1 = a[0...i]\n r = n - 1\n nwb.call( a[i..-1], r ).each do |branches|\n branches = [branches] if r == 1\n rv << [a1.dup] + branches\n end\n end\n rv\n end\n end\n\n # faux method for recursively making n-ary trees\n nt = -> (a) do\n if a.length <= min\n [a]\n else\n rv = []\n (min..( a.length < max ? a.length : max )).each do |branchiness|\n nwb.call( a, branchiness ).each do |part|\n head, *tail = part.map{ |a2| nt.call a2 }\n if tail.any?\n head = head.map{ |t| [t] }\n tail.each do |nxt|\n h = []\n head.each do |a1|\n nxt.each do |a2|\n h << a1 + [a2]\n end\n end\n head = h\n end\n end\n rv += head\n end\n end\n rv\n end\n end\n\n trees = nt.(self)\n\n if minimize\n m = -> (t) do\n if t.is_a? Array\n if t.length == 1\n m.call( t[0] )\n else\n t.map{ |t2| m.call t2 }\n end\n else\n t\n end\n end\n\n m.call trees\n else\n trees\n end\n end",
"def components_to_basic_nodes(components)\n nodes_components = []\n\n components.each do |component|\n if component.is_a?(Keisan::Parsing::LineSeparator)\n nodes_components << [component]\n elsif nodes_components.empty? || nodes_components.last.last.is_a?(Keisan::Parsing::LineSeparator)\n nodes_components << [component]\n else\n is_operator = [nodes_components.last.last.is_a?(Keisan::Parsing::Operator), component.is_a?(Keisan::Parsing::Operator)]\n\n if is_operator.first == is_operator.last\n nodes_components.last << component\n else\n nodes_components << [component]\n end\n end\n end\n\n nodes_components.inject([]) do |nodes, node_or_component_group|\n if node_or_component_group.first.is_a?(Keisan::Parsing::Operator)\n node_or_component_group.each do |component|\n nodes << component\n end\n else\n nodes << node_from_components(node_or_component_group)\n end\n\n nodes\n end\n end",
"def json_directional(name, logger)\n\t# return '{\"nodes\":[], \"links\":[], \"constraints\":[]}'\n\t\n\t\n\t\n\t\n\t# input sanitization???\n\t# I mean, the name is coming from a URL piece, so it could be anything...\n\t\n\t\n\t# logger.info @rake.methods.grep(/task/).inspect\n\t# logger.info @rake.tasks.inspect\n\t\n\tshort_path = 'public/CS_BS_all.yaml'\n\t\n\tregenerate_graph = false\n\t@rake[short_path].invoke ->(){\n\t\t# --- this callback runs when YAML file in 'short_path' is regenerated\n\t\tlogger.info \"graph generation callback\"\n\t\t\n\t\tregenerate_graph = true\n\t}\n\t\n\t# Generate graphs if\n\t# 1) no graph yet in memory\n\t# 2) source YAML file was modified\n\tif regenerate_graph or @graphs[short_path].nil?\n\t\t@graphs[short_path] = SummerResearch::DependencyGraph.new.tap do |graph|\n\t\t\traw_data = Models::Utilities.load_yaml_file(short_path)\n\t\t\t# raw_data = \n\t\t\t\t# if name.include? 'split'\n\t\t\t\t# \tModels::Utilities.load_yaml_file \"public/#{name}.yaml\"\n\t\t\t\t# else\n\t\t\t\t\t# Models::Utilities.load_yaml_file(short_path)\n\t\t\t\t# end\n\t\t\t\n\t\t\t# NOTE: just get the node and vert information first. The data will be converted to the proper output format later.\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- add basic node and edge information to the graph\n\t\t\tnodes = raw_data.collect{ |k,v| [k, v] }.flatten.uniq\n\t\t\t\n\t\t\tlinks =\n\t\t\t\traw_data.collect do |course, deps|\n\t\t\t\t\tdeps.collect do |dependency|\n\t\t\t\t\t\t[course, dependency]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tlinks = links.flatten(1) # remove extra level of nesting\n\t\t\tlinks.delete_if do |course, dependency|\n\t\t\t\tcourse == dependency # remove self-links resulting from messy data\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\tlogger.info nodes.inspect\n\t\t\tlogger.info links.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tnodes.each do |vertex|\n\t\t\t\tgraph.add_vertex(vertex)\n\t\t\tend\n\t\t\t\n\t\t\tlinks.each do |course, dependency|\n\t\t\t\tgraph.add_edge(dependency, course)\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- debug printing to make sure that worked\n\t\t\t\n\t\t\t# NOTE: the first item in either of these lists, is the requested node.\n\t\t\t# ie) ancestors of CS 367 includes CS 367 itself, even if all self-loops were removed\n\t\t\t# NOTE: was able to fix this by returning a slightly different Enumerator from the DependencyGraph class.\n\t\t\tlogger.info \"Ancestors\"\n\t\t\tlogger.info graph.ancestors(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Parents\"\n\t\t\tlogger.info graph.parents(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Children\"\n\t\t\tlogger.info graph.children(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Descendants\"\n\t\t\tlogger.info graph.descendants(\"CS 367\").to_a.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tlogger.info graph.each_vertex.to_a\n\t\t\tlogger.info graph.each_edge.to_a\n\t\tend\n\tend\n\t\n\t# pull graph from the cache\n\tgraph = @graphs[short_path]\n\t\n\traise \"Could not find DependencyGraph data. Should have been generated after #{short_path} was made, but it seems like that as not the case.\" if graph.nil?\n\t\n\t\n\t# if short_path == 'data/CS_BS_all.yaml'\n\t\t[\n\t\t\t'CS 310',\n\t\t\t'CS 330',\n\t\t\t'CS 367',\n\t\t\t# 'ENGH 302',\n\t\t\t# # 'CS 262',\n\t\t\t# # 'CS 351',\n\t\t\t# # 'MATH 351',\n\t\t\t# # 'MATH 203',\n\t\t\t# 'STAT 344',\n\t\t\t# # 'MATH 125',\n\t\t\t# 'ECE 445',\n\t\t\t# # 'CS 222',\n\t\t\t# # 'CS 112',\n\t\t\t# # 'STAT 346',\n\t\t\t# 'SYST 210',\n\t\t].each do |course|\n\t\t\t# graph.cut course\n\t\tend\n\t# end\n\t\n\t# graph.remove_vertex('MATH 112') # Discrete Math for IT\n\t# graph.remove_vertex('CS 222') # \"Computer Programming for Engineers\", basically like CS 262\n\t\n\t\n\t\n\t\n\trequirement_by_type_file = 'data/CS_BS_requirements_by_type.yaml'\n\t@rake[requirement_by_type_file].invoke\n\t\n\trequirement_by_type = Models::Utilities.load_yaml_file(requirement_by_type_file)\n\t\n\t\n\t\n\trequired_courses = requirement_by_type[:required].to_set\n\telective_courses = requirement_by_type[:elective].to_set\n\t\n\t\n\t\n\t\n\t\n\t\n\trequirements_file = 'data/CS_BS_requirements.yaml'\n\t@rake[requirements_file].invoke\n\t\n\tdegree_requirements = Models::Utilities.load_yaml_file(requirements_file)\n\tdegree_requirements\n\t\n\telective_category = \n\t\tdegree_requirements.select{ |name, sector| sector[:data].is_a? Hash }\n\t\t .collect { |name, sector|\n\t\t \t sector[:data].collect{ |category, course_id|\n\t\t \t \t[course_id, name]\n\t\t \t }\n\t\t }\n\t\t .flatten(1) # array of [course_id, name] pairs\n\t\n\t# convert [course_id, name] relation into { course_id => i }, where i is an integer corresponding to 'name' in a list of all values for 'name'\n\telective_category = elective_category.to_h\n\t\n\tname_list = elective_category.values.uniq\n\tname_to_number = name_list.each_with_index.to_h\n\t\n\tlogger.info name_list.inspect\n\t\n\telective_category = \n\t\telective_category.collect{ |course_id, name|\n\t\t\t[course_id].flatten.collect { |id|\n\t\t\t\t[ id, name_to_number[name] ]\n\t\t\t}\n\t\t}\n\t\t.flatten(1)\n\t\t.to_h\n\t\n\tlogger.info elective_category.inspect\n\t\n\t\n\treturn graph.to_json_d3v3_cola(required_courses, elective_courses, elective_category)\n\t\n\t\n\t\n\t# below is a bunch of old code, to generate the graph the old way\n\t# still keeping it around, because some of these constraints have not been implemented\n\t# in the new system.\n\t# Also, this alternative way of specifying colors is interesting.\n\t# -------------------------------------------------------------------\n\t\n\t\n\t\n\t\n\t# === Create Constraints\n\t# basic constraint: prereqs go above later courses.\n\t\t# (overall visual flow: top to bottom as skill increases)\n\t\t# defined as local property.\n\t\t# graph ends up showing global properties.\n\tc1 =\n\t\traw_data2.collect do |course, deps|\n\t\t\tdeps.collect do |d|\n\t\t\t\ti_left =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == course}\n\t\t\t\t\n\t\t\t\ti_right =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == d}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{\n\t\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => 25\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tc1.flatten!\n\t\n\tconstraints = c1\n\t\n\t# TODO: implement constraint such that all 100-level courses are above the 200-level ones, etc etc.\n\t# (want to stratify course levels)\n\t# logger.info \"HEY\"\n\tgap = 500\n\tc2 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\"left\" => 28, \"right\" => i_left, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c2\n\tconstraints.flatten!\n\t\n\t\n\t\n\t# all nodes want to have horizontal spacing\n\tgap = 25\n\tc3 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t\ttrue\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"x\", \n\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c3\n\tconstraints.flatten!\n\t\n\t\n\t\n\t\n\t# TODO: implement constraint that causes all courses from a single department to clump\n\t\n\t\n\t\n\t\n\t\n\t# === additional processing on the graph\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t# === rough packaging for output\n\tout = {\n\t\t# 'name' => name,\n\t\t'nodes' => nodes,\n\t\t'links' => links,\n\t\t'constraints' => constraints\n\t}\n\t\n\t\n\t# === style the nodes\n\t\n\tcolor_key ||= {\n\t\t:gated_elective_clump => \"#10D588\", # light green\n\t\t:split_link => \"#3399FF\", # blue\n\t\t\n\t\t:required => \"#CC2300\", # red / orange\n\t\t:elective => \"#242424\", # black\n\t\t:not_required => \"#AAA\" # grey\n\t}\n\t\n\trequired =\n\t\t@data[:required].collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\telective = \n\t\t@data[:elective].values\n\t\t.collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\t\n\tout['nodes'].each do |node|\n\t\t# --- color assigment\n\t\ttype = node_type(node['name'], required, elective)\n\t\t# node['color'] = color_key[type]\n\t\tnode['class'] = type.to_s.tr('_', '-')\n\t\t\n\t\t\n\t\t# --- do other things with type\n\t\t# leaves << node['id'] if type == :not_required\n\tend\n\t\n\t\nend",
"def generate_tree(operands, operators, parent_node)\n return operands[0] if operands.length==1\n\n i = index_of_lowest_precedence(operators)\n operator = operators[i]\n new_operand = node_class.new(parent_node)\n new_operand.add_match generate_tree(operands[0..i], operators[0..i-1],new_operand), :left\n new_operand.add_match operators[i], :operator_node\n new_operand.add_match generate_tree(operands[i+1..-1], operators[i+1..-1],new_operand), :right\n new_operand\n end",
"def minilang(program)\n register = 0\n stack = []\n\n program.split.each do |step|\n p step\n case step\n when 'PUSH' then stack.push(register)\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = step.to_i\n end\n p stack\n end\nend",
"def run(operations_list)\n output = []\n operations_list.each do |operation|\n if operation.is_a? Tree::Add\n add(operation.node, operation.value)\n else\n output << max(operation.start_node, operation.end_node)\n end\n end\n output\n end",
"def next_paths\n Operations.list.map do |operation|\n new_value = Operations.send(operation, @current_value)\n operation_history = @operation_history + [operation]\n Path.new(new_value, @target_value, operation_history: operation_history)\n end\n end",
"def add\r\n node = mul()\r\n\r\n loop do\r\n if consume(\"+\")\r\n node = new_binary(ND_ADD, node, mul())\r\n elsif consume(\"-\")\r\n node = new_binary(ND_SUB, node, mul())\r\n else\r\n return node\r\n end\r\n end\r\nend",
"def doProduction(lhs)\n if lhs == BNF.void\n progress(\"\\nvoid\")\n return\n end\n if lhs == BNF.eof\n progress( \"\\nEOF\")\n return\n end\n if lhs.is_a?(RDF::Literal)\n literalTerminals[lhs.value()] = 1\n return\n end\n\n branchDict = {}\n\n rhs = graph.first_object(:subject => lhs, :predicate => BNF.matches)\n if rhs\n chatty(\"\\nToken #{lhs} matches regexp #{rhs}\")\n tokenRegexps[lhs] = rhs.value\n\n cc = graph.query(:subject => lhs, :predicate => BNF.canStartWith)\n progress(recordError(\"No record of what token #{lhs} can start with\")) if cc.empty?\n cc.each {|statement| chatty(\" Can start with: #{statement.object}\")}\n return\n end\n \n rhs = graph.first_object(:subject => lhs, :predicate => BNF.mustBeOneSequence)\n unless rhs\n progress(recordError(\"No definition of #{lhs}\"))\n # raise RuntimeError(\"No definition of %s in\\n %s\" %(`lhs`, `g`))\n return\n end\n\n options = rhs\n progress(\"\\nProduction #{lhs} :: #{options}\")\n graph.query(:subject => lhs, :predicate => BNF.canPrecede) do |statement|\n chatty(\" Can precede '#{statement.object}'\")\n end\n\n graph.query(:subject => lhs, :predicate => BNF.branch) do |statement|\n branch = statement.object\n sequence = graph.first_object(:subject => statement.object, :predicate => BNF.sequence)\n option = RDF::List.new(sequence, graph).to_a\n progress(\" option: #{option}\")\n \n option.each do |part|\n agenda << part unless already.include?(part) || agenda.include?(part)\n end\n \n conditions = graph.query(:subject => branch, :predicate => BNF.condition).map(&:object)\n if conditions.empty?\n progress(recordError(\"NO SELECTOR for #{lhs} option #{option}\"))\n if option.empty?\n # Void case - the tricky one\n graph.pattern(:subject => lhs, :predicate => BNF.canPrecede) do |st|\n progress(\" Can precede #{st.object}\")\n end\n end\n end\n \n progress(\" Conditions: #{conditions.to_a.map(&:to_s)}\")\n conditions.each do |str1|\n if branchDict.has_key?(str1)\n progress(\n \"Conflict: #{str1} is also the condition for #{branchDict[str1]}\")\n end\n branchDict[str1] = option\n end\n end\n \n branchDict.keys.each do |str1|\n branchDict.keys.each do |str2|\n s1, s2 = str1.to_s, str2.to_s\n if (s1.index(s2) == 0 || s2.index(s1) == 0) && branchDict[str1] != branchDict[str2]\n progress(\"WARNING: for #{lhs}, #{str1} indicates #{branchDict[str1]}, but #{str2} indicates #{branchDict[str2]}\")\n end\n end\n end\n \n branchTable[lhs] = branchDict\n end"
] | [
"0.52156484",
"0.5168368",
"0.51504165",
"0.49801686",
"0.49400368",
"0.48782519",
"0.48777598",
"0.48631516",
"0.48461762",
"0.48178646",
"0.47682714",
"0.47647086",
"0.4758322",
"0.4757274",
"0.47395635",
"0.47346252",
"0.47234565",
"0.46919",
"0.4686709",
"0.4685276",
"0.46768528",
"0.46570435",
"0.46434936",
"0.4604938",
"0.4601227",
"0.45944384",
"0.4587328",
"0.4565591",
"0.45650396",
"0.45456794",
"0.45450187",
"0.45434725",
"0.4542662",
"0.4519986",
"0.451934",
"0.45111063",
"0.45101985",
"0.45021453",
"0.44791234",
"0.44770783",
"0.44674206",
"0.44670057",
"0.4465406",
"0.44631281",
"0.44631103",
"0.4456186",
"0.44522277",
"0.4433324",
"0.44325042",
"0.44303015",
"0.44223574",
"0.44219497",
"0.44152066",
"0.44131458",
"0.44030383",
"0.43789554",
"0.43719754",
"0.43571615",
"0.43459806",
"0.43454394",
"0.4337462",
"0.43342072",
"0.4326965",
"0.4326385",
"0.43162695",
"0.4303143",
"0.43022236",
"0.42983574",
"0.42948556",
"0.42934117",
"0.42931864",
"0.4291041",
"0.4290954",
"0.42882043",
"0.42834067",
"0.42812294",
"0.42810228",
"0.42781493",
"0.42776963",
"0.42694876",
"0.4261357",
"0.42539114",
"0.425198",
"0.42509204",
"0.42468107",
"0.42461598",
"0.42418852",
"0.42356095",
"0.4230863",
"0.42295668",
"0.42293888",
"0.42260605",
"0.4225735",
"0.42177606",
"0.42153803",
"0.42100203",
"0.4205614",
"0.42055804",
"0.4204733",
"0.4198158"
] | 0.687203 | 0 |
GET /offers GET /offers.json | def index
@offers = Offer.where(customer: current_user.customer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def get_offers\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n get('offer')\n end",
"def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def offers\n authenticated_post(\"offers\").body\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end",
"def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def index\n @offers = Offer.all\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end",
"def show\n render json: @offer\n end",
"def show\n render json: @offer\n end",
"def index\n\n @offers = Offer.order(:id)\n\n render( {json: @offers}.merge set_render_options )\n\n end",
"def index\n @offers = getmydata(\"Offer\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n \n end",
"def show\n @breadcrumb = 'read'\n @offer = Offer.find(params[:id])\n @items = @offer.offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def index\n @accepted_offers = AcceptedOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accepted_offers }\n end\n end",
"def show\n @breadcrumb = 'read'\n @sale_offer = SaleOffer.find(params[:id])\n @items = @sale_offer.sale_offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_offer }\n end\n end",
"def index\n if params[:for_applicant]\n @offers = current_user.applicant.offers\n elsif params[:for_positions]\n @offers = []\n current_user.positions.each { |offer| @offers << offer }\n else\n @offers = Offer.all\n end\n\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n @offer_quizzes = @offer.quizzes\n @offer_packages = @offer.packages\n @quizzes = Quiz.excluding(@offer.quizzes)\n @packages = Package.excluding(@offer.packages)\n @offer_users = @offer.offer_users\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def getOffers\n if current_contractor || current_user\n offers_per_post = Offer.where(post_id: params[:post_id])\n @offers = offers_per_post.order(created_at: :asc).limit(10)\n\n render json: @offers.as_json(include: [{contractor: { methods: [:avatar_url] }}, :post,])\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers.to_json, :callback => params[:callback] }\n end\n end",
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def index\n if params[:event_id].blank?\n @offerings = Offering.all\n else\n @offerings = Offering.find_all_by_event_id params[:event_id]\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n end\n end",
"def new\n @offers = Offer.all\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end",
"def index\n @category_offers = CategoryOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @category_offers }\n end\n end",
"def response(env)\n uid = env.params['uid']\n if uid.nil?\n [200, {}, erb(:default, :locals => {:uid => nil, :pub0 => nil, :page => nil})]\n else\n pub0 = env.params['pub0']\n page = env.params['page']\n begin\n\n offers = Application.offersService.getOffers(uid, pub0, page)\n [200, {}, erb(:offers, :locals => {:offers => offers, :uid => uid, :pub0 => pub0, :page => page})]\n rescue Exception => error\n [200, {}, erb(:error, :locals => {:errorMsg => error.message, :uid => uid, :pub0 => pub0, :page => page})]\n end\n end\n end",
"def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def offers; global.offers end",
"def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end",
"def index\n if backend_request?\n @shop_resource_offers = Shop::ResourceOffer.all\n else \n @shop_resource_offers = Shop::ResourceOffer.where([\"(started_at is null or started_at < ?) and (ends_at is null or ends_at > ?)\", Time.now, Time.now])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_resource_offers }\n end\n end",
"def index\n @offerers = Offerer.all\n end",
"def show\n @accepted_offer = AcceptedOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accepted_offer }\n end\n end",
"def list\n offers = []\n if params[:product_id]\n product = Product.find(params[:product_id])\n if product && (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n if product.user.id == @current_user.id && params[:include_offers_made_by_other_users] == \"true\"\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n elsif product.user.id != @current_user.id && params[:include_offers_made_by_current_user] == \"true\"\n offer = Offer.find_by(product_id: product.id, user_id: @current_user.id)\n if offer\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n\t\t\t\t username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n else\n render status: 404, json: {error: true}\n end\n else\n if params[:include_offers_made_by_current_user] == \"true\"\n @current_user.offers.each do |offer|\n if (offer.product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: offer.product.user.id,\n\t\t\t\t username: offer.product.user.username\n },\n thumbnail: offer.product.thumbnail,\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_price: offer.product.price\n },\n product_name: offer.product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n if params[:include_offers_made_by_other_users] == \"true\"\n @current_user.products.each do |product|\n if (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n end\n end\n render status: 200, json: {offers: offers}\n end",
"def show\n @ms_offer = MsOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def read\n offer = Offer.find(params[:id])\n if offer\n if @current_user.id == offer.user.id || @current_user.id == offer.product.user.id\n render status: 200, json: {\n offer_id: offer.id,\n product: {\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_type: offer.product.product_type,\n product_sold_status: offer.product.sold_status,\n price: offer.product.price,\n description: offer.product.description,\n thumbnail: offer.product.thumbnail,\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end",
"def index\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offer_codes }\n end\n end",
"def show\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end",
"def index\n @aid_offers = AidOffer.all\n end",
"def show\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end",
"def index\n @general_offers = GeneralOffer.all\n end",
"def show\n offer = Offer.find params[:id]\n @offer = render_to_string partial: 'offers/offer.json', locals: { offer: offer }\n respond_to do |format|\n format.html { render layout: false }\n end\n end",
"def index\n @auto_offers = AutoOffer.all\n end",
"def index\n @offers = Offer.search_offers(params[:keyword],\n params[:pick_up_point], params[:drop_off_point],\n params[:vancancy_lower_limit], params[:vancancy_upper_limit],\n params[:cost_lower_limit], params[:cost_upper_limit])\n end",
"def show\n @shop_fb_credit_offer = Shop::FbCreditOffer.find(params[:id])\n\n @prices = []\n\n JSON.parse(@shop_fb_credit_offer.prices).each do |o|\n @prices << o\n end\n\n respond_to do |format|\n format.html { render layout: 'empty' }\n format.json { render json: @shop_fb_credit_offer }\n end\n end",
"def show\n @public_offer = PublicOffer.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @public_offer }\n end\n end",
"def index\n if api_request?\n @shop_special_offers = Shop::SpecialOffer.buyable_by_character(current_character)\n else\n @shop_special_offers = Shop::SpecialOffer.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: include_root(@shop_special_offers, :special_offer) }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def won_offers(options={})\n won_status.offers.all(options)\n end",
"def new\n @offer = Offer.new\n @user = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def index\n \n if user_signed_in?\n \n if current_user.is_admin\n \n @offers = Offer.all\n\n else\n\n redirect_to root_path\n\n end\n\n else\n\n redirect_to root_path\n\n end\n\n end",
"def show\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_customer }\n end\n end",
"def offers(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(location, 'publishers', publisher, 'artifacttypes', 'vmimage', 'offers')\n\n JSON.parse(rest_get(url)).map{ |element| element['name'] }\n end",
"def index\n @special_offers = SpecialOffer.all\n end",
"def index\n @shop_fb_credit_offers = Shop::FbCreditOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_fb_credit_offers }\n end\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def show\n @job_offer = JobOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_offer }\n end\n end",
"def index\n @offers = Offer.search(params[:search])\nend",
"def offers\n @offers ||= offer_map.values.map { |v| v[:offer] }\n end",
"def show \n # @offer = Offer.find(params[:id])\nend",
"def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end",
"def new\n @shop_resource_offer = Shop::ResourceOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n \n @venue_name= Venue.find(@offer.venue_id).venue_name\n @offer_opinions = @offer.opinions\n if @offer_opinions.first\n @offer_opinions = Opinion.all_offer_opinions(@offer.id)\n #@offer_opinions = @offer_opinions.joins('LEFT OUTER JOIN users ON users.id = opinions.user_id').select('title, description, points, username')\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def index\n @project_offers = Project::Offer.all\n end",
"def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def show\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end",
"def new\n @accepted_offer = AcceptedOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accepted_offer }\n end\n end",
"def show\n @offer_code = OfferCode.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_code }\n end\n end",
"def index\n @course_offers = CourseOffer.all\n end",
"def index\n @shop_bonus_offers = Shop::BonusOffer.order('resource_id asc, currency asc, price asc')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @shop_bonus_offers.each do |offer|\n offer[:resource_effect] = offer.effect_for_character(current_character) \n end\n \n render json: @shop_bonus_offers\n end\n end\n end",
"def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end",
"def lost_offers(options={})\n lost_status.offers.all(options)\n end",
"def index\n @base_offer = BaseOffer.new\n @base_offers = BaseOffer.all\n end",
"def show\n @shop_special_offer = Shop::SpecialOffer.find_by_id(params[:id])\n raise NotFoundError.new('offer not found') if @shop_special_offer.nil?\n\n if api_request? && !current_character.purchases.where('external_offer_id = ? and redeemed_at is not null', @shop_special_offer.external_offer_id).empty?\n raise NotFoundError.new('offer not found')\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_special_offer }\n end\n end",
"def new\n @offer = Offer.new\n if can? :manage, @offer\n @venue_names = current_user.venues.pluck(:venue_name)\n #@venue_names = current_user.venues.select('venues.id, venue_name')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n else\n redirect_to offers_path\n end\n end",
"def new\n @clientsOffers = ClientsOffers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientsOffers }\n end\n end",
"def new\n @offer_customer = OfferCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer_customer }\n end\n end",
"def show\n render json: Agent.find(params[:id]).buyers\n end",
"def index\n @help_offers = @job_request.help_offers\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_offers }\n end\n end",
"def show\n @product_offer = ProductOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_offer }\n end\n end",
"def index\n authorize Offer\n\n @offers = if params[:q]\n policy_scope(Offer).search params[:q], fields: [:name]\n else\n policy_scope(Offer)\n end.select do | offer |\n offer.expire == nil || !(offer.booked?) || (offer.booked? && offer.customer == current_user.id)\n end\n @booked = Offer.all.where(\"expire > ? AND customer = ?\", Time.now, current_user.id)\n end",
"def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end",
"def offer\n @offer ||= params[:id].present? ? Offer.find(params[:id]) : Offer.find_by(listing_id: params[:listing_id])\n end",
"def show\n \n @offering = Offering.find_by_id(params[:id])\n @resource = Resource.find @offering.resource_id\n @question = Question.new\n @negociation = Negociation.new\n @questions = @offering.questions\n @event = Event.find @offering.event_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offering }\n end\n end",
"def index\n @sells = Sell.all\n\n render json: @sells\n end",
"def new\n @shop_bonus_offer = Shop::BonusOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end",
"def show\n render json: @pricing\n end",
"def show\n render json: @email_price_list\n end",
"def scrape_offers_for(item)\n return [] unless valid_offers_url?(item.more_offers_url)\n root = Nokogiri::HTML(get_more_offers_page(item.more_offers_url))\n scraped_offers = scrape_offers(root)\n publish(:on_offers_scrapped_for, item, scraped_offers)\n scraped_offers\n end",
"def index\n @offerte_regels = OfferteRegel.all\n end",
"def index\n client = find_client(request.headers[\"X-CLIENT-TOKEN\"], request.headers[\"X-CLIENT-EMAIL\"])\n @appointments = client.appointments.includes(:stylist).includes(:offerings).order(\"created_at DESC\")\n respond_to do |f|\n f.json {\n render :json => @appointments\n }\n end\n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end"
] | [
"0.8171875",
"0.7944721",
"0.79157716",
"0.79029083",
"0.7764754",
"0.76819086",
"0.7671478",
"0.7586528",
"0.7481807",
"0.7481807",
"0.7466798",
"0.74593174",
"0.7443136",
"0.73937756",
"0.73937756",
"0.73937756",
"0.73937756",
"0.7368404",
"0.73248607",
"0.7323364",
"0.727816",
"0.7111794",
"0.70934635",
"0.70629996",
"0.70342314",
"0.69278336",
"0.69216377",
"0.6909375",
"0.6854069",
"0.6830361",
"0.68179333",
"0.68090415",
"0.6783584",
"0.6783584",
"0.6783584",
"0.678181",
"0.67570424",
"0.67471576",
"0.6746282",
"0.6736924",
"0.67006797",
"0.66957724",
"0.6669606",
"0.66637576",
"0.66555303",
"0.6652437",
"0.6636182",
"0.6632018",
"0.6625163",
"0.6623001",
"0.6613954",
"0.66076446",
"0.65794635",
"0.65770763",
"0.6565777",
"0.6534047",
"0.65305525",
"0.6528381",
"0.65265554",
"0.65046334",
"0.64607817",
"0.64542514",
"0.64211226",
"0.6415941",
"0.6402201",
"0.6347079",
"0.63454354",
"0.6334979",
"0.6320717",
"0.6317981",
"0.63089156",
"0.63082916",
"0.6289676",
"0.6286114",
"0.62814355",
"0.6280918",
"0.625472",
"0.62504566",
"0.62423635",
"0.62213683",
"0.62160456",
"0.6201632",
"0.620109",
"0.61881244",
"0.61746687",
"0.6165437",
"0.61626476",
"0.61553407",
"0.6140222",
"0.61392087",
"0.6135877",
"0.6135123",
"0.6128391",
"0.612714",
"0.61214304",
"0.6116663",
"0.611106",
"0.61106086",
"0.6106476",
"0.610159"
] | 0.6431345 | 62 |
GET /offers/1 GET /offers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n render json: @offer\n end",
"def show\n render json: @offer\n end",
"def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end",
"def show\n @breadcrumb = 'read'\n @offer = Offer.find(params[:id])\n @items = @offer.offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def index\n @offers = Offer.all\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @offers = getmydata(\"Offer\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def get_offers\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n get('offer')\n end",
"def index\n\n @offers = Offer.order(:id)\n\n render( {json: @offers}.merge set_render_options )\n\n end",
"def offers\n authenticated_post(\"offers\").body\n end",
"def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n \n end",
"def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def index\n @accepted_offers = AcceptedOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accepted_offers }\n end\n end",
"def show\n @breadcrumb = 'read'\n @sale_offer = SaleOffer.find(params[:id])\n @items = @sale_offer.sale_offer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_offer }\n end\n end",
"def new\n @offers = Offer.all\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @accepted_offer = AcceptedOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accepted_offer }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n @offer_quizzes = @offer.quizzes\n @offer_packages = @offer.packages\n @quizzes = Quiz.excluding(@offer.quizzes)\n @packages = Package.excluding(@offer.packages)\n @offer_users = @offer.offer_users\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end",
"def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end",
"def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end",
"def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end",
"def index\n if params[:event_id].blank?\n @offerings = Offering.all\n else\n @offerings = Offering.find_all_by_event_id params[:event_id]\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n end\n end",
"def read\n offer = Offer.find(params[:id])\n if offer\n if @current_user.id == offer.user.id || @current_user.id == offer.product.user.id\n render status: 200, json: {\n offer_id: offer.id,\n product: {\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_type: offer.product.product_type,\n product_sold_status: offer.product.sold_status,\n price: offer.product.price,\n description: offer.product.description,\n thumbnail: offer.product.thumbnail,\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end",
"def show\n offer = Offer.find params[:id]\n @offer = render_to_string partial: 'offers/offer.json', locals: { offer: offer }\n respond_to do |format|\n format.html { render layout: false }\n end\n end",
"def show\n @public_offer = PublicOffer.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @public_offer }\n end\n end",
"def show\n @ms_offer = MsOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def index\n if params[:for_applicant]\n @offers = current_user.applicant.offers\n elsif params[:for_positions]\n @offers = []\n current_user.positions.each { |offer| @offers << offer }\n else\n @offers = Offer.all\n end\n\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers.to_json, :callback => params[:callback] }\n end\n end",
"def index\n @category_offers = CategoryOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @category_offers }\n end\n end",
"def show \n # @offer = Offer.find(params[:id])\nend",
"def show\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_customer }\n end\n end",
"def getOffers\n if current_contractor || current_user\n offers_per_post = Offer.where(post_id: params[:post_id])\n @offers = offers_per_post.order(created_at: :asc).limit(10)\n\n render json: @offers.as_json(include: [{contractor: { methods: [:avatar_url] }}, :post,])\n end\n end",
"def index\n if backend_request?\n @shop_resource_offers = Shop::ResourceOffer.all\n else \n @shop_resource_offers = Shop::ResourceOffer.where([\"(started_at is null or started_at < ?) and (ends_at is null or ends_at > ?)\", Time.now, Time.now])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_resource_offers }\n end\n end",
"def index\n @general_offers = GeneralOffer.all\n end",
"def show\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end",
"def index\n @offerers = Offerer.all\n end",
"def show\n @job_offer = JobOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_offer }\n end\n end",
"def response(env)\n uid = env.params['uid']\n if uid.nil?\n [200, {}, erb(:default, :locals => {:uid => nil, :pub0 => nil, :page => nil})]\n else\n pub0 = env.params['pub0']\n page = env.params['page']\n begin\n\n offers = Application.offersService.getOffers(uid, pub0, page)\n [200, {}, erb(:offers, :locals => {:offers => offers, :uid => uid, :pub0 => pub0, :page => page})]\n rescue Exception => error\n [200, {}, erb(:error, :locals => {:errorMsg => error.message, :uid => uid, :pub0 => pub0, :page => page})]\n end\n end\n end",
"def index\n @aid_offers = AidOffer.all\n end",
"def index\n @auto_offers = AutoOffer.all\n end",
"def new\n @offer = Offer.new\n @user = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @shop_fb_credit_offer = Shop::FbCreditOffer.find(params[:id])\n\n @prices = []\n\n JSON.parse(@shop_fb_credit_offer.prices).each do |o|\n @prices << o\n end\n\n respond_to do |format|\n format.html { render layout: 'empty' }\n format.json { render json: @shop_fb_credit_offer }\n end\n end",
"def new\n @shop_resource_offer = Shop::ResourceOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end",
"def offer\n @offer ||= params[:id].present? ? Offer.find(params[:id]) : Offer.find_by(listing_id: params[:listing_id])\n end",
"def offers; global.offers end",
"def index\n @special_offers = SpecialOffer.all\n end",
"def index\n if api_request?\n @shop_special_offers = Shop::SpecialOffer.buyable_by_character(current_character)\n else\n @shop_special_offers = Shop::SpecialOffer.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: include_root(@shop_special_offers, :special_offer) }\n end\n end",
"def new\n @accepted_offer = AcceptedOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accepted_offer }\n end\n end",
"def show\n @shop_special_offer = Shop::SpecialOffer.find_by_id(params[:id])\n raise NotFoundError.new('offer not found') if @shop_special_offer.nil?\n\n if api_request? && !current_character.purchases.where('external_offer_id = ? and redeemed_at is not null', @shop_special_offer.external_offer_id).empty?\n raise NotFoundError.new('offer not found')\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_special_offer }\n end\n end",
"def show\n @offer = Offer.find params[:id]\n render layout: nil\n end",
"def index\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offer_codes }\n end\n end",
"def index\n @base_offer = BaseOffer.new\n @base_offers = BaseOffer.all\n end",
"def show\n @offer_code = OfferCode.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_code }\n end\n end",
"def show\n @offer = Offer.find(params[:id])\n \n @venue_name= Venue.find(@offer.venue_id).venue_name\n @offer_opinions = @offer.opinions\n if @offer_opinions.first\n @offer_opinions = Opinion.all_offer_opinions(@offer.id)\n #@offer_opinions = @offer_opinions.joins('LEFT OUTER JOIN users ON users.id = opinions.user_id').select('title, description, points, username')\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end",
"def show\n @product_offer = ProductOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_offer }\n end\n end",
"def list\n offers = []\n if params[:product_id]\n product = Product.find(params[:product_id])\n if product && (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n if product.user.id == @current_user.id && params[:include_offers_made_by_other_users] == \"true\"\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n elsif product.user.id != @current_user.id && params[:include_offers_made_by_current_user] == \"true\"\n offer = Offer.find_by(product_id: product.id, user_id: @current_user.id)\n if offer\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n\t\t\t\t username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n else\n render status: 404, json: {error: true}\n end\n else\n if params[:include_offers_made_by_current_user] == \"true\"\n @current_user.offers.each do |offer|\n if (offer.product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: offer.product.user.id,\n\t\t\t\t username: offer.product.user.username\n },\n thumbnail: offer.product.thumbnail,\n product_id: offer.product.id,\n product_name: offer.product.product_name,\n product_price: offer.product.price\n },\n product_name: offer.product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n if params[:include_offers_made_by_other_users] == \"true\"\n @current_user.products.each do |product|\n if (product.sold_status != Product.SOLD_SOLD || params[:allow_sold])\n product.offers.each do |offer|\n offers << {\n offer_id: offer.id,\n product: {\n user: {\n user_id: product.user.id,\n username: product.user.username\n },\n thumbnail: product.thumbnail,\n product_id: product.id,\n product_name: product.product_name,\n product_price: product.price\n },\n product_name: product.product_name,\n user: {\n user_id: offer.user.id,\n\t\t\t\t username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n conversation: offer.conversation ? {id: offer.conversation.id} : nil,\n offer_status: offer.offer_status,\n price: offer.price,\n created_at: offer.created_at.strftime(\"%-m/%-d/%Y\")\n }\n end\n end\n end\n end\n end\n render status: 200, json: {offers: offers}\n end",
"def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def show\n \n @offering = Offering.find_by_id(params[:id])\n @resource = Resource.find @offering.resource_id\n @question = Question.new\n @negociation = Negociation.new\n @questions = @offering.questions\n @event = Event.find @offering.event_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offering }\n end\n end",
"def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shop_bonus_offer = Shop::BonusOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end",
"def show\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def index\n @shop_bonus_offers = Shop::BonusOffer.order('resource_id asc, currency asc, price asc')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @shop_bonus_offers.each do |offer|\n offer[:resource_effect] = offer.effect_for_character(current_character) \n end\n \n render json: @shop_bonus_offers\n end\n end\n end",
"def new\n @clientsOffers = ClientsOffers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientsOffers }\n end\n end",
"def index\n @project_offers = Project::Offer.all\n end",
"def offer_page(page = 1)\n #get all offers\n if page == 1 && has_first_page_of_full_offers\n self.offers \n else\n products = self.class.find(:item_id => self.asin, \n :response_group => \"OfferListings\",\n :merchant_id => \"All\",\n :condition => \"All\",\n :offer_page => page)\n\n if products\n product = products[0] \n self.offer_pages = self.class.offer_pages_for(product)\n product.offers\n else\n []\n end\n end\n end",
"def show\n render json: Agent.find(params[:id]).buyers\n end",
"def new\n @offer_customer = OfferCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer_customer }\n end\n end",
"def new\n @shop_special_offer = Shop::SpecialOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_special_offer }\n end\n end",
"def index\n @shop_fb_credit_offers = Shop::FbCreditOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_fb_credit_offers }\n end\n end",
"def manage_offer\n @offer = @host.offers.find(params[:id])\n end",
"def index\n @offers = Offer.search_offers(params[:keyword],\n params[:pick_up_point], params[:drop_off_point],\n params[:vancancy_lower_limit], params[:vancancy_upper_limit],\n params[:cost_lower_limit], params[:cost_upper_limit])\n end",
"def show\n render json: @pricing\n end",
"def new\n @offer = Offer.new\n if can? :manage, @offer\n @venue_names = current_user.venues.pluck(:venue_name)\n #@venue_names = current_user.venues.select('venues.id, venue_name')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n else\n redirect_to offers_path\n end\n end",
"def index\n @offers = Offer.where(customer: current_user.customer)\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def show\n @essay = Essay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @essay }\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vessel }\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render :show, status: :created, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def index\n @offers = Offer.search(params[:search])\nend",
"def index\n \n if user_signed_in?\n \n if current_user.is_admin\n \n @offers = Offer.all\n\n else\n\n redirect_to root_path\n\n end\n\n else\n\n redirect_to root_path\n\n end\n\n end",
"def index\n @offers = Offer.newer_first\n end",
"def won_offers(options={})\n won_status.offers.all(options)\n end",
"def show\n @local_offer = LocalOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @local_offer }\n end\n end"
] | [
"0.7893452",
"0.7734393",
"0.76324385",
"0.7481251",
"0.7394545",
"0.7394545",
"0.73184246",
"0.7309764",
"0.72893107",
"0.72650313",
"0.7260039",
"0.72340804",
"0.7228739",
"0.72237456",
"0.71911067",
"0.71911067",
"0.71911067",
"0.71911067",
"0.71791774",
"0.7166139",
"0.7083678",
"0.7045825",
"0.6914751",
"0.6910557",
"0.6910557",
"0.6910557",
"0.6883007",
"0.68693906",
"0.68681985",
"0.6867413",
"0.68522686",
"0.6847046",
"0.6845456",
"0.681817",
"0.680954",
"0.67830443",
"0.67806697",
"0.67750555",
"0.67451155",
"0.67203206",
"0.66741914",
"0.6635292",
"0.6631235",
"0.66182816",
"0.6612149",
"0.66047055",
"0.65950644",
"0.6589422",
"0.6548254",
"0.6536184",
"0.65312934",
"0.65280575",
"0.6524745",
"0.65179366",
"0.6469483",
"0.6464563",
"0.6431625",
"0.6406943",
"0.63987625",
"0.63976395",
"0.6378094",
"0.6374538",
"0.63406223",
"0.63328373",
"0.63325363",
"0.6331919",
"0.63308525",
"0.63215524",
"0.63212305",
"0.63088375",
"0.6301514",
"0.62789303",
"0.6272164",
"0.62332237",
"0.6232876",
"0.6217999",
"0.62173826",
"0.62147695",
"0.6209059",
"0.6196952",
"0.61935544",
"0.6181759",
"0.6175685",
"0.61650723",
"0.61634755",
"0.6155079",
"0.6151077",
"0.61396194",
"0.6136377",
"0.61319035",
"0.61115915",
"0.61045104",
"0.60923135",
"0.6083651",
"0.6083651",
"0.6083651",
"0.6075369",
"0.60700166",
"0.6066723",
"0.60612416",
"0.6058473"
] | 0.0 | -1 |
POST /offers POST /offers.json | def create
@offer = Offer.new(offer_params)
@offer.customer_id = current_user.customer_id
redirect_to @offer, notice: 'Offer was successfully created.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end",
"def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n if @offer.save\n render json: @offer, status: :created, location: @offer\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end",
"def offers\n authenticated_post(\"offers\").body\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render :show, status: :created, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to admin_offers_path,\n notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = current_user.offers.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @offer }\n else\n format.html { render action: 'new' }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offers\n return nil unless have_key?\n url = \"/v1/offers\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to offers_url, notice: 'Offer was successfully created.' }\n format.json { render :index, estado: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, estado: :unprocessable_entity }\n end\n end\n end",
"def create\n ids = Offer.new_offer(offer_params)\n @offer = Offer.get_offer(ids[0], ids[1]) if ids\n #HACK\n @offer = Offer.create(offer_params) unless ids\n respond_to do |format|\n if ids\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(params[:offer])\n \n respond_to do |format|\n if @offer.save\n format.html { redirect_to [:admins,@offer], notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(params[:offer])\n @offer.account_id = @oeaccount.id\n respond_to do |format|\n if @offer.save\n format.html { redirect_to offers_url, notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = current_user.offers.build(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Oferta utworzona pomyślnie.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def create_offer(options = {}, &block)\n options = set_options(options, &block)\n @response = post('offer', options)\n end",
"def create\n @offer = Offer.new(params[:offer])\n\n respond_to do |format|\n if @offer.save(params[:offer])\n format.html { redirect_to edit_offer_path(@offer), notice: 'Oferta a fost creata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @offers = Offer.all\n @price = Price.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price }\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n flash[:notice] = 'Se ha creado su nueva oferta'\n format.html { redirect_to @offer }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auto_offer = AutoOffer.new(auto_offer_params)\n\n respond_to do |format|\n if @auto_offer.save\n format.html { redirect_to offers_path, notice: 'Auto offers ware successfully created.' }\n format.json { render action: 'show', status: :created, location: @auto_offer }\n else\n format.html { render action: 'new' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n @offer.user = current_user\n authorize @offer\n\n respond_to do |format|\n if @offer.save\n Offer.delay.reindex\n\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_offer\n end",
"def create\n @offer = @company.offers.new(offer_params)\n @offer.user = current_user\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @company, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breadcrumb = 'create'\n @sale_offer = SaleOffer.new(params[:sale_offer])\n @sale_offer.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @sale_offer.save\n format.html { redirect_to @sale_offer, notice: crud_notice('created', @sale_offer) }\n format.json { render json: @sale_offer, status: :created, location: @sale_offer }\n else\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @clients = clients_dropdown\n @payment_methods = payment_methods_dropdown\n @status = sale_offer_statuses_dropdown\n # @products = products_dropdown\n @contracting_requests = contracting_requests_dropdown\n @approval = 'false'\n format.html { render action: \"new\" }\n format.json { render json: @sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(params[:offer])\n if @offer.save\n redirect_to admin_offer_path(@offer), notice: 'Offer was successfully created.'\n else\n render :new\n end\n end",
"def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def show\n render json: @offer\n end",
"def show\n render json: @offer\n end",
"def create\n @ms_offer = MsOffer.new(params[:ms_offer])\n\n respond_to do |format|\n if @ms_offer.save\n format.html { redirect_to @ms_offer, notice: 'Ms offer was successfully created.' }\n format.json { render json: @ms_offer, status: :created, location: @ms_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ms_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @offer = Offer.new\n @user = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n flash[:notice] = 'Se ha creado una oferta'\n format.html { redirect_to @offer}\n format.json { render :show, status: :created, location: @offer }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end",
"def create\n @shop_bonus_offer = Shop::BonusOffer.new(params[:shop_bonus_offer])\n\n respond_to do |format|\n if @shop_bonus_offer.save\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully created.' }\n format.json { render json: @shop_bonus_offer, status: :created, location: @shop_bonus_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer_article = OfferArticle.new(offer_article_params)\n\n respond_to do |format|\n if @offer_article.save\n format.html { redirect_to :back, notice: 'Offer article was successfully created.' }\n format.json { render :show, status: :created, location: @offer_article }\n else\n format.html { render :new }\n format.json { render json: @offer_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @accepted_offer = AcceptedOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accepted_offer }\n end\n end",
"def create\n @offerer = Offerer.new(offerer_params)\n #byebug\n\n respond_to do |format|\n if @offerer.save\n format.html { redirect_to @offerer, notice: 'Offerer was successfully created.' }\n format.json { render :show, status: :created, location: @offerer }\n else\n format.html { render :new }\n format.json { render json: @offerer.errors, status: :unprocessable_entity }\n end\n end\n #byebug\n end",
"def of_generate_offer\n supplier = params[:supplier]\n request = params[:request]\n offer_no = params[:offer_no]\n offer_date = params[:offer_date] # YYYYMMDD\n offer = nil\n offer_item = nil\n code = ''\n\n if request != '0'\n offer_request = OfferRequest.find(request) rescue nil\n offer_request_items = offer_request.offer_request_items rescue nil\n if !offer_request.nil? && !offer_request_items.nil?\n # Format offer_date\n offer_date = (offer_date[0..3] + '-' + offer_date[4..5] + '-' + offer_date[6..7]).to_date\n # Try to save new offer\n offer = Offer.new\n offer.offer_no = offer_no\n offer.offer_date = offer_date\n offer.offer_request_id = offer_request.id\n offer.supplier_id = supplier\n offer.payment_method_id = offer_request.payment_method_id\n offer.created_by = current_user.id if !current_user.nil?\n offer.discount_pct = offer_request.discount_pct\n offer.discount = offer_request.discount\n offer.project_id = offer_request.project_id\n offer.store_id = offer_request.store_id\n offer.work_order_id = offer_request.work_order_id\n offer.charge_account_id = offer_request.charge_account_id\n offer.organization_id = offer_request.organization_id\n if offer.save\n # Try to save new offer items\n offer_request_items.each do |i|\n offer_item = OfferItem.new\n offer_item.offer_id = offer.id\n offer_item.product_id = i.product_id\n offer_item.description = i.description\n offer_item.quantity = i.quantity\n offer_item.price = i.price\n offer_item.tax_type_id = i.tax_type_id\n offer_item.created_by = current_user.id if !current_user.nil?\n offer_item.project_id = i.project_id\n offer_item.store_id = i.store_id\n offer_item.work_order_id = i.work_order_id\n offer_item.charge_account_id = i.charge_account_id\n if !offer_item.save\n # Can't save offer item (exit)\n code = '$write'\n break\n end # !offer_item.save?\n end # do |i|\n # Update totals\n offer.update_column(:totals, Offer.find(offer.id).total)\n else\n # Can't save offer\n code = '$write'\n end # offer.save?\n else\n # Offer request or items not found\n code = '$err'\n end # !offer_request.nil? && !offer_request_items.nil?\n else\n # Offer request 0\n code = '$err'\n end # request != '0'\n if code == ''\n code = I18n.t(\"ag2_purchase.offers.generate_offer_ok\", var: offer.id.to_s)\n end\n @json_data = { \"code\" => code }\n render json: @json_data\n end",
"def index\n @offers = Offer.all\n \n end",
"def new\n @ms_offer = MsOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_offer }\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end",
"def create\n @base_offer = BaseOffer.new(base_offer_params)\n\n respond_to do |format|\n if @base_offer.save\n format.html { redirect_to base_offers_url, notice: 'Base offer was successfully created.' }\n format.json { render :show, status: :created, location: @base_offer }\n else\n format.html { render :index }\n format.json { render json: @base_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @special_offer = SpecialOffer.new(special_offer_params)\n\n respond_to do |format|\n if @special_offer.save\n format.html { redirect_to @special_offer, notice: 'Special offer was successfully created.' }\n format.json { render :show, status: :created, location: @special_offer }\n else\n format.html { render :new }\n format.json { render json: @special_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def index\n @offers = Offer.all\n @offer_codes = OfferCode.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def create\n @offerte_regel = OfferteRegel.new(offerte_regel_params)\n\n respond_to do |format|\n if @offerte_regel.save\n format.html { redirect_to @offerte_regel, notice: 'Offerte regel was successfully created.' }\n format.json { render :show, status: :created, location: @offerte_regel }\n else\n format.html { render :new }\n format.json { render json: @offerte_regel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offering = current_user.offerings.new(offering_params)\n @offering.status = 1\n respond_to do |format|\n if @offering.save\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido creada correctamente.' }\n format.json { render :show, status: :created, location: @offering }\n else\n format.html { render :new }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def index\n @offers = Offer.all\n end",
"def create\n @shop_resource_offer = Shop::ResourceOffer.new(params[:shop_resource_offer])\n\n respond_to do |format|\n if @shop_resource_offer.save\n format.html { redirect_to @shop_resource_offer, notice: 'Resource offer was successfully created.' }\n format.json { render json: @shop_resource_offer, status: :created, location: @shop_resource_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_resource_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n offer = params[:offer]\n @offer = Offer.new\n @offer.publicated = false\n @offer.prizes_attributes = offer[:prizes_attributes]\n @offer.name = offer[:name]\n @offer.start_date = offer[:start_date]\n @offer.end_date = offer[:end_date]\n @offer.created_at = Time.now\n @offer.updated_at = Time.now\n @offer.photo = offer[:photo]\n @offer.branch = Branch.find(offer[:branch_id])\n @offer.description = offer[:description]\n @offer.publication_date = offer[:publication_date]\n @offer.start_date = @offer.start_date.change({:hour => (offer[:start_hour]).to_i})\n @offer.end_date = @offer.end_date.change({:hour => (offer[:end_hour]).to_i})\n @offer.is_first_game = [true, false].sample\n\n\n respond_to do |format|\n if params[:title_ids].nil?\n format.html { redirect_to :back , notice: @offer.name + ' posee errores o no posee intereses.' }\n end\n if @offer.save\n title_ids = params[:title_ids]\n unless title_ids.nil?\n title_ids.each do |id|\n offers_titles = OffersTitles.new\n offers_titles.offer_id = @offer.id\n offers_titles.title_id = id\n offers_titles.save\n end\n end\n format.html { redirect_to users_offers_company_user_path , notice: @offer.name + ' fue creada correctamente.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:product, :title, :description)\n end",
"def index\n\n @offers = Offer.order(:id)\n\n render( {json: @offers}.merge set_render_options )\n\n end",
"def offer_params\n params.require(:offer).permit(:description, :price, :user_id, :listing_id, :status)\n end",
"def new\n @offer_customer = OfferCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer_customer }\n end\n end",
"def create\n @breadcrumb = 'create'\n @offer = Offer.new(params[:offer])\n @offer.created_by = current_user.id if !current_user.nil?\n # Should use attachment from drag&drop?\n if @offer.attachment.blank? && !$attachment.avatar.blank?\n @offer.attachment = $attachment.avatar\n end\n\n respond_to do |format|\n $attachment_changed = false\n if @offer.save\n $attachment.destroy\n $attachment = nil\n format.html { redirect_to @offer, notice: crud_notice('created', @offer) }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n $attachment.destroy\n $attachment = Attachment.new\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @suppliers = suppliers_dropdown\n @offer_requests = offer_requests_dropdown\n @payment_methods = payment_methods_dropdown\n # @products = products_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @offer = Offer.new\n @offer.create_new_image_token\n @offer.offer_images.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end",
"def create\n @offer_customer = OfferCustomer.new(params[:offer_customer])\n\n respond_to do |format|\n if @offer_customer.save\n format.html { redirect_to @offer_customer, notice: 'Offer customer was successfully created.' }\n format.json { render json: @offer_customer, status: :created, location: @offer_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offering = Offering.new(params[:offering])\n @offering.event_id = params[:event_id]\n @offering.user_id = current_user.id\n\n respond_to do |format|\n if @offering.save\n format.html { redirect_to @offering, notice: 'Oferta criada com sucesso.' }\n format.json { render json: @offering, status: :created, location: @offering }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:cost, :date, :photo_url, :seats, :available)\n end",
"def create\n c= Compare.find(params[:compare])\n c.offers<< Offer.new(offer_params)\n # @offer = Offer.new(offer_params)\n @offer = c.offers.last\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to [@offer.compare.site,@offer], notice: 'offer was successfully created.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:estado, :agency, :tipo, :app, :os, :kpi, :geo, :price, :agencyLink, :oferta_des)\n end",
"def create\n @general_offer = GeneralOffer.new(general_offer_params)\n\n respond_to do |format|\n if @general_offer.save\n format.html { redirect_to @general_offer, notice: 'General offer was successfully created.' }\n format.json { render :show, status: :created, location: @general_offer }\n else\n format.html { render :new }\n format.json { render json: @general_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:merchant_id, :title, :description, :url, :expires_at)\n end",
"def newOffer()\n @offer_operation = :create\n end",
"def offer_params\n params.require(:offer).permit(:proposal,:price, :post_id, :status)\n end",
"def create\n @locations = Location.where(\"status <> 'NORMAL'\").order(\"state, township desc\")\n @aid_offer = AidOffer.new(aid_offer_params)\n @aid_offer.code = SecureRandom.hex(3).to_s.upcase.insert(3,\"-\").insert(0,\"O-\")\n\n respond_to do |format|\n if @aid_offer.save\n format.html { redirect_to @aid_offer, notice: 'Aid offer was successfully created.' }\n format.json { render :show, status: :created, location: @aid_offer }\n else\n format.html { render :new }\n format.json { render json: @aid_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_offer_for\n @offer_for = params[:for]\n @offer = @host.offers.find(params[:id])\n if request.post?\n if params[:places].present?\n @offer.places = []\n @offer.places << Place.find(params[:places])\n elsif params[:experiences].present?\n @offer.experiences = []\n @offer.experiences << Experience.find(params[:experiences])\n end\n end\n end",
"def create\n @offer = Offer.new(params[:offer])\n\n respond_to do |format|\n if @offer.save\n\t\t@offer.update_notification\n\t\t@offer.push\n\n format.html { redirect_to offers_path(:playerid => current_player.playerid)}\n\t\t#offer_path(@offer, :playerid=> current_player.playerid), notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shop_special_offer = Shop::SpecialOffer.new(params[:shop_special_offer])\n\n respond_to do |format|\n if @shop_special_offer.save\n format.html { redirect_to @shop_special_offer, notice: 'Special offer was successfully created.' }\n format.json { render json: @shop_special_offer, status: :created, location: @shop_special_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_special_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @accepted_offers = AcceptedOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accepted_offers }\n end\n end",
"def create\n @project_offer = Project::Offer.new(project_offer_params)\n\n respond_to do |format|\n if @project_offer.save\n format.html { redirect_to @project_offer, notice: 'Offer was successfully created.' }\n format.json { render :show, status: :created, location: @project_offer }\n else\n format.html { render :new }\n format.json { render json: @project_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def account_offers(opts = {})\n params = {\n account: opts.delete(:account) || client_account,\n ledger: :current,\n ledger_index: opts[:ledger_index] || \"validated\",\n ledger_hash: opts[:ledger_hash],\n }\n post(:account_offers, params)\n end",
"def new\n @shop_resource_offer = Shop::ResourceOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_resource_offer }\n end\n end",
"def offer_params\n params.require(:offer).permit(:advertiser_name, :url, :description, :starts_at, :ends_at, :premium, :offer_state)\n end",
"def create\n @offer_apartment = OfferApartment.new(offer_apartment_params)\n\n respond_to do |format|\n if @offer_apartment.save\n format.html { redirect_to @offer_apartment, notice: 'Offer apartment was successfully created.' }\n format.json { render :show, status: :created, location: @offer_apartment }\n else\n format.html { render :new }\n format.json { render json: @offer_apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_offer\n if params[:id] == 'new'\n render status: 404\n return\n end\n offer = Offer.find(params[:id])\n @offer = offer\n end",
"def response_for_offer_create(params)\n {\"response\" => { \"status\" => 1, \"data\" => rand(1_000_000).to_s } }\n end",
"def create\n @credits_offer = CreditsOffer.new(credits_offer_params)\n respond_to do |format|\n if @credits_offer.save\n format.html { redirect_to @credits_offer, notice: 'CreditsOffer was successfully created.' }\n format.json { render :show, status: :created, location: @credits_offer }\n else\n format.html { render :new }\n format.json { render json: @credits_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clientsOffers = ClientsOffers.new(params[:clientsOffers])\n\n respond_to do |format|\n if @clientsOffers.save\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully created.' }\n format.json { render json: @clientsOffers, status: :created, location: @clientsOffers }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end",
"def create\n offer = Offer.where(user_id: @current_user.id, product_id: params[:product_id]).first\n if offer\n render status: 471, json: {error: true}\n else\n product = Product.find(params[:product_id])\n if product\n if product.user.id != @current_user.id\n if product.sold_status != Product.SOLD_SOLD\n offer = Offer.new\n offer.user = @current_user\n offer.price = params[:price]\n offer.offer_status = Offer.OFFER_OFFERED\n offer.product = product\n if offer.save()\n\n notify(\"NOTIF_NEW_OFFER\", {\n user: {\n id: @current_user.id,\n username: @current_user.username,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name,\n },\n offer: {\n id: offer.id,\n price: offer.price,\n created_at: offer.created_at.strftime('%-l:%M%P')\n },\n product: {\n id: product.id,\n product_name: product.product_name\n }\n }, product.user_id)\n\n OfferMailer.new_offer_email(product.user, offer, product, @current_user).deliver_later!(wait: 15.seconds)\n\n payload = {\n error: false,\n id: offer.id\n }\n render status: 200, json: payload\n else\n errors = []\n offer.errors.keys.each do |key|\n errors << {field: key, message: offer.errors.full_messages_for(key).first}\n end\n payload = {\n error: true,\n errors: errors\n }\n render status: 200, json: payload\n end\n else\n render status: 473, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end\n end",
"def new\n @shop_bonus_offer = Shop::BonusOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end",
"def offer_params\n params.require(:offer).permit(:price, :company)\n end",
"def create\n venue = Venue.find_by_venue_name(params[:venue_name])\n if current_user.venues.include?(venue)\n received = params[:offer]\n received[:venue_id] = venue.id\n @offer = Offer.new(received)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Offer was successfully created.' }\n format.json { render json: @offer, status: :created, location: @offer }\n else\n @venue_names = current_user.venues.pluck(:venue_name)\n format.html { render action: \"new\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_offer_path\n end\n end",
"def offer_params\n params.require(:offer).permit(:datetime,\n :pickUpPoint, :dropOffPoint, :vacancies, :car_license_plate_number, :cost)\n end",
"def offer_params\n params.require(:offer).permit!\n end",
"def create\n @offer_code = OfferCode.new(params[:offer_code])\n \n respond_to do |format|\n if @offer_code.save\n @offer_codes = OfferCode.all\n @offers = Offer.all\n format.html { redirect_to admins_offers_url, notice: 'Offer code was successfully created.' }\n format.json { render json: @offer_code, status: :created, location: @offer_code }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offer_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def set_offer\n @offer = Offer.find(params[:id])\n end",
"def create\n @shop_platinum_offer = Shop::PlatinumOffer.new(params[:shop_platinum_offer])\n\n respond_to do |format|\n if @shop_platinum_offer.save\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully created.' }\n format.json { render json: @shop_platinum_offer, status: :created, location: @shop_platinum_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offering = Offering.new(params[:offering])\n\n respond_to do |format|\n if @offering.save\n flash[:notice] = 'Offering was successfully created.'\n format.html { redirect_to(edit_offering_path(@offering, :anchor => \"features\")) }\n format.xml { render :xml => @offering, :status => :created, :location => @offering }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def offer_params\n params.require(:offer).permit(:name, :description, :reward_description, :reward_factor, :redemption_value, :active, :image_url, :published, :expires)\n end"
] | [
"0.77869576",
"0.7748448",
"0.7657578",
"0.74718577",
"0.73447186",
"0.7245436",
"0.7179201",
"0.7179201",
"0.7135144",
"0.71086293",
"0.71079504",
"0.709092",
"0.70722723",
"0.70427686",
"0.69463056",
"0.6876874",
"0.6863741",
"0.6815877",
"0.6815877",
"0.6815877",
"0.6795273",
"0.6790855",
"0.6785077",
"0.6762536",
"0.6742587",
"0.6710709",
"0.6681282",
"0.6664291",
"0.66632015",
"0.65775865",
"0.655766",
"0.6508589",
"0.64811546",
"0.64811546",
"0.646804",
"0.6459853",
"0.6450158",
"0.6436341",
"0.6358082",
"0.63550156",
"0.6353717",
"0.63090396",
"0.63065493",
"0.6299512",
"0.62961096",
"0.62887436",
"0.6265314",
"0.6252347",
"0.6234117",
"0.6221784",
"0.6211913",
"0.62006867",
"0.62006867",
"0.62006867",
"0.62006867",
"0.62004316",
"0.6200426",
"0.6199791",
"0.61827093",
"0.6181911",
"0.61790615",
"0.617085",
"0.6169308",
"0.6164647",
"0.6162146",
"0.61586666",
"0.61573124",
"0.6138704",
"0.61360776",
"0.61295736",
"0.6123895",
"0.6104637",
"0.6103143",
"0.6095448",
"0.60934776",
"0.60888916",
"0.6080588",
"0.60801905",
"0.6075638",
"0.6074381",
"0.60737103",
"0.60652494",
"0.60594445",
"0.603932",
"0.6035323",
"0.60238767",
"0.602216",
"0.60117996",
"0.6009425",
"0.6008119",
"0.5999114",
"0.5995995",
"0.598015",
"0.59787565",
"0.5971963",
"0.5971963",
"0.5971963",
"0.59583724",
"0.5952515",
"0.5939556"
] | 0.59388435 | 100 |
PATCH/PUT /offers/1 PATCH/PUT /offers/1.json | def update
if @offer.update(offer_params)
redirect_to @offer, notice: 'Offer was successfully updated.'
else
render :edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n\n if @offer.update(offer_params)\n head :no_content\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to admin_offers_path,\n notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def updateOffer()\n @offer_operation = :update\n end",
"def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to edit_offer_path(@offer), notice: 'Oferta a fost updatata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ids = Offer.update_offer(offer_params, @paramss[0], @paramss[1])\n @offer.update(offer_params) unless ids\n respond_to do |format|\n if ids\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n \n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to [:admins,@offer], notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @auto_offer.update(auto_offer_params)\n format.html { redirect_to @auto_offer, notice: 'Auto offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @offer\n\n respond_to do |format|\n if @offer.update(offer_params)\n Offer.delay.reindex\n\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offer\n @offer = @host.offers.find(params[:id])\n @offer.update(offer_params) if request.put?\n redirect_to offers_host_path if request.put?\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :index, estado: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, estado: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_bonus_offer.update_attributes(params[:shop_bonus_offer])\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Oferta zmieniona pomyślnie.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.find(params[:id])\n if user_owns_offer?(@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n else\n format.html {redirect_to :status => 422}\n end \n end",
"def update\n @accepted_offer = AcceptedOffer.find(params[:id])\n\n respond_to do |format|\n if @accepted_offer.update_attributes(params[:accepted_offer])\n format.html { redirect_to @accepted_offer, notice: 'Accepted offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @accepted_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n format.html { redirect_to @offering, notice: 'Oferta atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @serv_offer.update(serv_offer_params)\n format.html { redirect_to @serv_offer, notice: 'Serv offer was successfully updated.' }\n format.json { \n render json: {status:0, msg:\"success\"}\n }\n else\n format.html { render :edit }\n format.json {\n render json: { status: -1 }\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer.user, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_resource_offer.update_attributes(params[:shop_resource_offer])\n format.html { redirect_to @shop_resource_offer, notice: 'Resource offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_resource_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n offer = Offer.find(params[:id])\n if offer\n if @current_user.id == offer.user.id\n if offer.offer_status != Offer.OFFER_COMPLETED\n old_price = offer.price\n offer.price = params[:price] if params[:price]\n if offer.save()\n\n notify(\"NOTIF_OFFER_UPDATED\", {\n user: {\n id: offer.user.id,\n username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n offer: {\n id: offer.id,\n prev_price: old_price,\n price: offer.price\n },\n product: {\n id: offer.product.id,\n product_name: offer.product.product_name\n }\n }, offer.product.user_id)\n\n payload = {\n error: false,\n id: offer.id\n }\n render status: 200, json: payload\n else\n errors = []\n offer.errors.keys.each do |key|\n errors << {field: key, message: offer.errors.full_messages_for(key).first}\n end\n payload = {\n error: true,\n errors: errors\n }\n render status: 200, json: payload\n end\n else\n render status: 473, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end",
"def update\n @job_offer = JobOffer.find(params[:id])\n\n respond_to do |format|\n if @job_offer.update_attributes(params[:job_offer])\n format.html { redirect_to job_offers_path(@job_offer), notice: 'Job offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @base_offer.update(base_offer_params)\n format.html { redirect_to base_offers_url, notice: 'Base offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @base_offer }\n else\n @base_offers = BaseOffer.all.map{ |c| c = (c.id == @base_offer.id)? @base_offer:c}\n @base_offer = BaseOffer.new\n format.html { render :index }\n format.json { render json: @base_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @ms_offer = MsOffer.find(params[:id])\n\n respond_to do |format|\n if @ms_offer.update_attributes(params[:ms_offer])\n format.html { redirect_to @ms_offer, notice: 'Ms offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ms_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: '¡El Voucher se ha canjeado con éxito!' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = @offer_article.offer\n respond_to do |format|\n if @offer_article.update(offer_article_params)\n format.html { redirect_to @offer, notice: 'Offer article was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer_article }\n else\n format.html { render :edit }\n format.json { render json: @offer_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n flash[:notice] = 'Se ha modificado su oferta'\n format.html { redirect_to @offer }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n if @offer_customer.update_attributes(params[:offer_customer])\n format.html { redirect_to @offer_customer, notice: 'Offer customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_special_offer = Shop::SpecialOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_special_offer.update_attributes(params[:shop_special_offer])\n format.html { redirect_to @shop_special_offer, notice: 'Special offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_special_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @special_offer.update(special_offer_params)\n format.html { redirect_to @special_offer, notice: 'Special offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @special_offer }\n else\n format.html { render :edit }\n format.json { render json: @special_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @ride.update(offer_1_ride_params)\n\t\t\t\t@ride.set_routes\n\t\t\t\t@ride.handle_return_date_and_recurring_weeks\n\t\t\t\tformat.html { redirect_to \"/#{@ride.id}/offer-seats/2\" }\n\t\t\t\tformat.json { render :show, status: :created, location: @ride }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @ride.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to [@offer.compare.site,@offer], notice: 'offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update!(**args)\n @available_offers = args[:available_offers] if args.key?(:available_offers)\n @no_offer_reason = args[:no_offer_reason] if args.key?(:no_offer_reason)\n @response_metadata = args[:response_metadata] if args.key?(:response_metadata)\n end",
"def update\n @offer = Offer.find(params[:id])\n offer = params[:offer]\n unless offer.nil?\n @offer.prizes_attributes = offer[:prizes_attributes] unless offer[:prizes_attributes].nil?\n @offer.name = offer[:name]\n @offer.start_date = offer[:start_date]\n @offer.end_date = offer[:end_date]\n @offer.created_at = Time.now\n @offer.updated_at = Time.now\n @offer.photo = offer[:photo]\n @offer.branch = Branch.find(offer[:branch_id])\n @offer.description = offer[:description]\n @offer.start_date = @offer.start_date.change({:hour => (offer[:start_hour]).to_i})\n @offer.end_date = @offer.end_date.change({:hour => (offer[:end_hour]).to_i})\n respond_to do |format|\n if @offer.save\n title_ids = params[:title_ids]\n unless title_ids.nil?\n ot = OffersTitles.find_all_by_offer_id(@offer.id)\n ot.each do |o|\n o.destroy\n end\n title_ids.each do |id|\n# unless @offer.prefer(Title.find(id))\n offers_titles = OffersTitles.new\n offers_titles.offer_id = @offer.id\n offers_titles.title_id = id\n offers_titles.save\n # end\n end\n end\n format.html { redirect_to @offer, notice: 'La oferta fue actualizada correctamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end\n if @offer.nil?\n format.html { redirect_to @offer }\n format.json { head :no_content }\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @offerer.update(offerer_params)\n format.html { redirect_to @offerer, notice: 'Offerer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offerer }\n else\n format.html { render :edit }\n format.json { render json: @offerer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offering.update(offering_params)\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @offering }\n else\n format.html { render :edit }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(filter_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @market_offering.update(market_offering_params)\n format.html { redirect_to @market_offering, notice: 'Market offering was successfully updated.' }\n format.json { render :show, status: :ok, location: @market_offering }\n else\n format.html { render :edit }\n format.json { render json: @market_offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @voucher_offer = VoucherOffer.find(params[:id])\n\n respond_to do |format|\n if @voucher_offer.update_attributes(params[:voucher_offer])\n format.html { redirect_to(@voucher_offer, :notice => 'Voucher offer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @voucher_offer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_platinum_offer.update_attributes(params[:shop_platinum_offer])\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n @public_offer = PublicOffer.find(params[:id])\n\n respond_to do |format|\n if @public_offer.update_attributes(params[:public_offer])\n format.html { redirect_to club_public_offers_path(@club), notice: 'Das Angebot wurde aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @general_offer.update(general_offer_params)\n format.html { redirect_to @general_offer, notice: 'General offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @general_offer }\n else\n format.html { render :edit }\n format.json { render json: @general_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer_apartment.update(offer_apartment_params)\n format.html { redirect_to @offer_apartment, notice: 'Offer apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer_apartment }\n else\n format.html { render :edit }\n format.json { render json: @offer_apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @offer = Offer.find(params[:id])\n end",
"def update # PATCH\n raise NotImplementedError\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 rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n respond_to do |format|\n if @credits_offer.update(credits_offer_params)\n format.html { redirect_to admin_credits_offers_path, notice: 'CreditsOffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @credits_offer }\n else\n format.html { render :edit }\n format.json { render json: @credits_offer.errors, status: :unprocessable_entity }\n end\n end\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 @service_offering.update(service_offering_params)\n format.html { redirect_to @service_offering, notice: 'Service offering was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_offering }\n else\n format.html { render :edit }\n format.json { render json: @service_offering.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @listing = UserListing.find(params[:id])\n \n if(@listing.type == \"Offer\")\n respond_to do |format|\n if @listing.update_attributes(params[:offer])\n format.html { redirect_to current_user, notice: 'Your offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n if @listing.update_attributes(params[:need])\n format.html { redirect_to current_user, notice: 'Your need was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end \n end",
"def update\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n flash[:notice] = 'Offering was successfully updated.'\n format.html { redirect_to(admin_offering_path(@offering)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @offering ||= Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n flash[:notice] = 'Offering was successfully updated.'\n format.html { redirect_to(@offering) }\n format.xml { head :ok }\n format.js { render :text => \"Saved at #{Time.now.to_s(:time12)}.\" }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n format.js { render :text => \"Could not save offering.\", :status => 409 }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n flash[:notice] = 'La Oferta ha sido modificada'\n format.html { redirect_to @offer }\n format.json { render :show, status: :ok, location: @offer }\n format.js { js_redirect_to(offer_path @offer)}\n else\n format.html { render :edit }\n format.js {}\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project_offer.update(project_offer_params)\n format.html { redirect_to @project_offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_offer }\n else\n format.html { render :edit }\n format.json { render json: @project_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @offer = InternshipOffer.find(params[:id])\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @poll_options_set = PollOptionsSet.find(params[:id])\n\n respond_to do |format|\n if @poll_options_set.update_attributes(params[:poll_options_set])\n format.html { redirect_to @poll_options_set, notice: 'Poll options set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_options_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @text_book_sale_offer.update(text_book_sale_offer_params)\n format.html { redirect_to @text_book_sale_offer, notice: 'Text book sale offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @text_book_sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offerte_regel.update(offerte_regel_params)\n format.html { redirect_to @offerte_regel, notice: 'Offerte regel was successfully updated.' }\n format.json { render :show, status: :ok, location: @offerte_regel }\n else\n format.html { render :edit }\n format.json { render json: @offerte_regel.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 @offer_code = OfferCode.find(params[:id])\n \n respond_to do |format|\n if @offer_code.update_attributes(params[:offer_code])\n @offer_codes = OfferCode.all\n @offers = Offer.all\n format.html { redirect_to admins_offers_url, notice: 'Offer code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def toggle_status\n @offer.toggle_status\n\n respond_to do |format|\n format.html { redirect_to admin_offers_url,\n notice: 'Offer status was updated.' }\n format.json { render :show, status: :ok, location: @offer }\n end\n end",
"def update\n respond_to do |format|\n format.js\n if @offer_saved.update(offer_saved_params)\n format.html { redirect_to @offer_saved, notice: 'Offer saved was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer_saved }\n else\n format.js\n format.html { render :edit }\n format.json { render json: @offer_saved.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @offer = Offer.find(params[:id])\n\n master_changed = false\n # Should use attachment from drag&drop?\n if $attachment != nil && !$attachment.avatar.blank? && $attachment.updated_at > @offer.updated_at\n @offer.attachment = $attachment.avatar\n end\n if @offer.attachment.dirty? || $attachment_changed\n master_changed = true\n end\n\n items_changed = false\n if params[:offer][:offer_items_attributes]\n params[:offer][:offer_items_attributes].values.each do |new_item|\n current_item = OfferItem.find(new_item[:id]) rescue nil\n if ((current_item.nil?) || (new_item[:_destroy] != \"false\") ||\n ((current_item.product_id.to_i != new_item[:product_id].to_i) ||\n (current_item.description != new_item[:description]) ||\n (current_item.code != new_item[:code]) ||\n (current_item.quantity.to_f != new_item[:quantity].to_f) ||\n (current_item.price.to_f != new_item[:price].to_f) ||\n (current_item.discount_pct.to_f != new_item[:discount_pct].to_f) ||\n (current_item.discount.to_f != new_item[:discount].to_f) ||\n (current_item.tax_type_id.to_i != new_item[:tax_type_id].to_i) ||\n (current_item.project_id.to_i != new_item[:project_id].to_i) ||\n (current_item.work_order_id.to_i != new_item[:work_order_id].to_i) ||\n (current_item.charge_account_id.to_i != new_item[:charge_account_id].to_i) ||\n (current_item.store_id.to_i != new_item[:store_id].to_i)))\n items_changed = true\n break\n end\n end\n end\n if ((params[:offer][:organization_id].to_i != @offer.organization_id.to_i) ||\n (params[:offer][:project_id].to_i != @offer.project_id.to_i) ||\n (params[:offer][:offer_no].to_s != @offer.offer_no) ||\n (params[:offer][:offer_date].to_date != @offer.offer_date) ||\n (params[:offer][:supplier_id].to_i != @offer.supplier_id.to_i) ||\n (params[:offer][:offer_request_id].to_i != @offer.offer_request_id.to_i) ||\n (params[:offer][:work_order_id].to_i != @offer.work_order_id.to_i) ||\n (params[:offer][:charge_account_id].to_i != @offer.charge_account_id.to_i) ||\n (params[:offer][:store_id].to_i != @offer.store_id.to_i) ||\n (params[:offer][:payment_method_id].to_i != @offer.payment_method_id.to_i) ||\n (params[:offer][:discount_pct].to_f != @offer.discount_pct.to_f) ||\n (params[:offer][:remarks].to_s != @offer.remarks))\n master_changed = true\n end\n\n respond_to do |format|\n if master_changed || items_changed\n @offer.updated_by = current_user.id if !current_user.nil?\n $attachment_changed = false\n if @offer.update_attributes(params[:offer])\n destroy_attachment\n $attachment = nil\n format.html { redirect_to @offer,\n notice: (crud_notice('updated', @offer) + \"#{undo_link(@offer)}\").html_safe }\n format.json { head :no_content }\n else\n $attachment = Attachment.new\n destroy_attachment\n @projects = projects_dropdown_edit(@offer.project)\n @work_orders = @offer.project.blank? ? work_orders_dropdown : @offer.project.work_orders.order(:order_no)\n @charge_accounts = work_order_charge_account(@offer)\n @stores = work_order_store(@offer)\n @suppliers = @offer.organization.blank? ? suppliers_dropdown : @offer.organization.suppliers(:supplier_code)\n @offer_requests = @offer.organization.blank? ? offer_requests_dropdown : @offer.organization.offer_requests.approved(@offer.organization_id)\n @payment_methods = @offer.organization.blank? ? payment_methods_dropdown : payment_payment_methods(@offer.organization_id)\n # @products = @offer.organization.blank? ? products_dropdown : @offer.organization.products(:product_code)\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @offer }\n format.json { head :no_content }\n end\n end\n end",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @course_offer.update(course_offer_params)\n format.html { redirect_to @course_offer, notice: 'Course offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_offer }\n else\n format.html { render :edit }\n format.json { render json: @course_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @optinpartner = Optinpartner.find(params[:id])\n\n respond_to do |format|\n if @optinpartner.update_attributes(params[:optinpartner])\n format.html { redirect_to @optinpartner, notice: 'Optinpartner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optinpartner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_single_poll(id,polls__question__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :polls__question__,\n :polls__description__,\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n raise \"polls__question__ is required\" if polls__question__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id,\n :polls__question__ => polls__question__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end",
"def update\n if current_user.id == @offer.user_id\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer}\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"frame#inicio\" \n end\n end",
"def update\n respond_to do |format|\n if @category_offer.update_attributes(params[:category_offer])\n format.html { redirect_to @category_offer, notice: 'Category offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update!(**args)\n @available = args[:available] if args.key?(:available)\n @country_offer_infos = args[:country_offer_infos] if args.key?(:country_offer_infos)\n @description = args[:description] if args.key?(:description)\n @id = args[:id] if args.key?(:id)\n @max_account_age = args[:max_account_age] if args.key?(:max_account_age)\n @name = args[:name] if args.key?(:name)\n @offer_level = args[:offer_level] if args.key?(:offer_level)\n @offer_type = args[:offer_type] if args.key?(:offer_type)\n @qualified_customer = args[:qualified_customer] if args.key?(:qualified_customer)\n @qualified_customers_complete = args[:qualified_customers_complete] if args.key?(:qualified_customers_complete)\n @show_special_offer_copy = args[:show_special_offer_copy] if args.key?(:show_special_offer_copy)\n @terms = args[:terms] if args.key?(:terms)\n end",
"def update\n @partner = Partner.find(params[:id])\n\n respond_to do |format|\n if @partner.update_attributes(params[:partner])\n format.html { redirect_to @partner }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end",
"def update\n respond_to do |format|\n if @endpoint.update(endpoint_params)\n format.html { redirect_to root_url, notice: 'Endpoint was successfully updated.' }\n format.json { head :ok }\n else\n format.html { head :unprocessable_entity }\n format.json { render json: @endpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n format.html { redirect_to @officer, :notice => 'Officer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n if @vessel.update_attributes(params[:vessel])\n format.html { redirect_to @vessel, notice: 'Vessel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vessel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n format.html { redirect_to @officer, notice: 'Officer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_offer.update(job_offer_params)\n format.html { redirect_to company_job_offer_url, notice: \"La Oferta laboral fue actualizada exitosamente.\" }\n format.json { render :show, status: :ok, location: @job_offer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @job_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @poll = Poll.find(params[:id])\n\n respond_to do |format|\n if @poll.update_attributes(params[:poll])\n format.html { redirect_to @poll, notice: 'Poll was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @poll = Poll.find(params[:id])\n\n respond_to do |format|\n if @poll.update_attributes(params[:poll])\n format.html { redirect_to @poll, notice: 'Poll was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_fb_credit_offer = Shop::FbCreditOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_fb_credit_offer.update_attributes(params[:shop_fb_credit_offer])\n format.html { redirect_to @shop_fb_credit_offer, notice: 'Fb credit offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_fb_credit_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n if @poll.update(poll_params)\n format.html { redirect_to polls_url, notice: 'Poll was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @poll.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_object_offers\n @object = params[:class_name].constantize.find(params[:id])\n @offer = @host.offers.find(params[:offer_id])\n @offer_for = params[:class_name].pluralize.downcase\n if request.post?\n @object.offers = []\n @object.offers << Offer.find(params[:offers])\n end\n end"
] | [
"0.74339384",
"0.7110587",
"0.7080391",
"0.7080391",
"0.6979401",
"0.69471204",
"0.69373626",
"0.6936734",
"0.6856799",
"0.6839258",
"0.68097216",
"0.68097216",
"0.6719154",
"0.669173",
"0.6616138",
"0.66114545",
"0.6611033",
"0.6597479",
"0.6562729",
"0.6559597",
"0.6522435",
"0.6494571",
"0.6465132",
"0.64522046",
"0.64499885",
"0.6442713",
"0.643944",
"0.64281315",
"0.6410255",
"0.6372812",
"0.63716906",
"0.62983817",
"0.62904274",
"0.6279001",
"0.6256996",
"0.624898",
"0.62310565",
"0.62300354",
"0.6216007",
"0.6198613",
"0.6185518",
"0.6184874",
"0.6157346",
"0.615622",
"0.61423403",
"0.6136726",
"0.6125432",
"0.61084706",
"0.6107883",
"0.60953164",
"0.6093631",
"0.60925555",
"0.60909754",
"0.6085747",
"0.60714847",
"0.6057279",
"0.6054521",
"0.6052132",
"0.6052132",
"0.60333323",
"0.6032472",
"0.6032472",
"0.6032178",
"0.60260195",
"0.60246575",
"0.60212696",
"0.6007756",
"0.5997012",
"0.5996819",
"0.59928536",
"0.5928171",
"0.5920693",
"0.5893958",
"0.58679223",
"0.5867419",
"0.5866449",
"0.5865296",
"0.5851029",
"0.58500797",
"0.5845632",
"0.5843821",
"0.58393747",
"0.58378863",
"0.58377206",
"0.5821515",
"0.5814537",
"0.5814205",
"0.5807511",
"0.5795613",
"0.5794962",
"0.5792314",
"0.57781506",
"0.57680994",
"0.57641834",
"0.5759773",
"0.5759773",
"0.57573014",
"0.57553256",
"0.5748452",
"0.57429105"
] | 0.62453574 | 36 |
DELETE /offers/1 DELETE /offers/1.json | def destroy
@offer.destroy
respond_to do |format|
redirect_to offers_url, notice: 'Offer was successfully destroyed.'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auto_offer.destroy\n respond_to do |format|\n format.html { redirect_to auto_offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_offers_url,\n notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @offer\n\n @offer.destroy\n Offer.delay.reindex\n\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n \n respond_to do |format|\n format.html { redirect_to admins_offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n\n head :no_content\n end",
"def destroy\n Offer.destroy_offer(@paramss[0], @paramss[1])\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to site_offers_url, notice: 'offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_path, notice: 'Oferta a fost stearsa cu success.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Oferta eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Su oferta ha sido eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_resource_offer = Shop::ResourceOffer.find(params[:id])\n @shop_resource_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_resource_offers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Oferta usunięta pomyślnie.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n flash[:notice] = 'Se ha eliminado exitosamente'\n format.html { redirect_to offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aid_offer.destroy\n respond_to do |format|\n format.html { redirect_to aid_offers_url, notice: 'Aid offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n @shop_bonus_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_bonus_offers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.destroy\n format.html { redirect_to offers_url,\n notice: (crud_notice('destroyed', @offer) + \"#{undo_link(@offer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to offers_url, alert: \"#{@offer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @base_offer.destroy\n respond_to do |format|\n format.html { redirect_to base_offers_url, notice: 'Base offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ms_offer = MsOffer.find(params[:id])\n @ms_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to ms_offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offering = Offering.find(params[:id])\n @offering.destroy\n\n respond_to do |format|\n format.html { redirect_to offerings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accepted_offer = AcceptedOffer.find(params[:id])\n @accepted_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to accepted_offers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @offering.destroy\n respond_to do |format|\n format.html { redirect_to offerings_url, notice: 'Se ha eliminado la oferta de servicio.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @serv_offer.destroy\n @serv_offer.status = Const::GOODS_STATUS[:destroy]\n if @serv_offer.save\n respond_to do |format|\n # format.html { redirect_to serv_offers_url, notice: 'Serv offer was successfully destroyed.' }\n format.json {render json: {status:0, msg:\"success\"}}\n end\n else\n respond_to do |format|\n # format.html { redirect_to serv_offers_url, notice: 'Serv offer was successfully destroyed.' }\n format.json {render json: {status:-1, msg:\"fail\"}}\n end\n end\n\n end",
"def destroy\n @clientsOffers = ClientsOffers.find(params[:id])\n @clientsOffers.destroy\n\n respond_to do |format|\n format.html { redirect_to clientsOffers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_special_offer = Shop::SpecialOffer.find(params[:id])\n @shop_special_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_special_offers_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @special_offer.destroy\n respond_to do |format|\n format.html { redirect_to special_offers_url, notice: 'Special offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale_offer = SaleOffer.find(params[:id])\n\n respond_to do |format|\n if @sale_offer.destroy\n format.html { redirect_to sale_offers_url,\n notice: (crud_notice('destroyed', @sale_offer) + \"#{undo_link(@sale_offer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to sale_offers_url, alert: \"#{@sale_offer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @sale_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @offering = Offering.find(params[:id])\n @offering.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_offerings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @general_offer.destroy\n respond_to do |format|\n format.html { redirect_to general_offers_url, notice: 'General offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offering ||= Offering.find(params[:id])\n @offering.destroy\n\n respond_to do |format|\n format.html { redirect_to(offerings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offerte_regel.destroy\n respond_to do |format|\n format.html { redirect_to offerte_regels_url, notice: 'Offerte regel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer_customer = OfferCustomer.find(params[:id])\n @offer_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to offer_customers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @voucher_offer = VoucherOffer.find(params[:id])\n @voucher_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to(voucher_offers_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @local_offer = LocalOffer.find(params[:id])\n @local_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to(local_offers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n respond_to do |format|\n if user_owns_offer?(@offer)\n @offer.destroy\n format.html { redirect_to offers_url }\n format.json { head :ok } \n else\n format.html {redirect_to :status => 422}\n end \n end \n end",
"def destroy\n @offer_apartment.destroy\n respond_to do |format|\n format.html { redirect_to offer_apartments_url, notice: 'Offer apartment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @offer = Offer.find(params[:id])\n name = @offer.name\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to users_offers_company_user_path , notice: name + ' se ha eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n @shop_platinum_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_platinum_offers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @offerer.destroy\n respond_to do |format|\n format.html { redirect_to offerers_url, notice: 'Offerer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @text_book_sale_offer.destroy\n respond_to do |format|\n format.html { redirect_to text_book_sale_offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_offer = JobOffer.find(params[:id])\n @job_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to job_offers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n offer = Offer.find(params[:id])\n if offer\n if offer.user.id == @current_user.id || offer.product.user.id == @current_user.id\n if offer.offer_status != Offer.OFFER_COMPLETED\n\n if offer.user.id == @current_user.id\n notify(\"NOTIF_OFFER_REVOKE\", {\n conversation: offer.conversation ? offer.conversation.id : nil,\n user: {\n id: offer.user.id,\n username: offer.user.username,\n first_name: offer.user.first_name,\n last_name: offer.user.last_name\n },\n offer: {\n price: offer.price\n },\n product: {\n id: offer.product.id,\n product_name: offer.product.product_name\n }\n }, offer.product.user_id)\n else\n notify(\"NOTIF_OFFER_REJECT\", {\n conversation: offer.conversation ? offer.conversation.id : nil,\n user: {\n id: offer.product.user.id,\n username: offer.product.user.username,\n first_name: offer.product.user.first_name,\n last_name: offer.product.user.last_name\n },\n offer: {\n price: offer.price\n },\n product: {\n id: offer.product.id,\n product_name: offer.product.product_name\n }\n }, offer.user.id)\n end\n\n offer.destroy\n\n render status: 200, json: {error: false}\n else\n render status: 473, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @bill = Bill.find(params[:id])\n offer = @bill.offer\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(offer) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @offer_article.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Offer article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @essay = Essay.find(params[:id])\n @essay.destroy\n\n respond_to do |format|\n format.html { redirect_to essays_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @service_offering.destroy\n respond_to do |format|\n format.html { redirect_to service_offerings_url, notice: 'Service offering was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @credits_offer.destroy\n respond_to do |format|\n format.html { redirect_to admin_credits_offers_url, notice: 'CreditsOffer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @category_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to category_offers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @market_offering.destroy\n respond_to do |format|\n format.html { redirect_to market_offerings_url, notice: 'Market offering was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_offer.destroy\n respond_to do |format|\n format.html { redirect_to job_offers_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n if user_signed_in?\n\n if current_user.is_admin\n\n @offer.destroy\n respond_to do |format|\n format.html { redirect_to offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n else\n\n redirect_to root_path\n \n end\n\n else\n\n redirect_to root_path\n end\n\n\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete_offer(slug)\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n delete(\"/offer/#{slug}\")\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @public_offer = PublicOffer.find(params[:id])\n @public_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to club_path(@team.club), notice: 'Das Angebot wurde geloescht' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_offer.destroy\n respond_to do |format|\n format.html { redirect_to project_offers_url, notice: 'Offer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n params.require(%i[id])\n beverage = Beverage.find_by!(id: params[:id])\n beverage.destroy!\n head :no_content\n end",
"def destroy\n @endpoint.destroy\n respond_to do |format|\n format.html { redirect_to endpoints_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end",
"def destroy\n @avail = Avail.find(params[:id])\n @avail.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ecommerceplan = Ecommerceplan.find(params[:id])\n @ecommerceplan.destroy\n\n respond_to do |format|\n format.html { redirect_to ecommerceplans_url }\n format.json { head :ok }\n end\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def destroy\n @eatvent = Eatvent.find(params[:id])\n @eatvent.destroy\n\n respond_to do |format|\n format.html { redirect_to eatvents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\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 delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def destroy\n @offer_saved.destroy\n @offer = Offer.find(params[:offer_id])\n respond_to do |format|\n format.js\n format.html { redirect_to offer_saveds_url, notice: 'Offer saved was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @theader.destroy\n respond_to do |format|\n format.html { redirect_to offices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @advert.destroy\n respond_to do |format|\n format.html { redirect_to adverts_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end"
] | [
"0.78265435",
"0.78265435",
"0.77179426",
"0.7585767",
"0.7585767",
"0.753747",
"0.753747",
"0.7530682",
"0.7455453",
"0.74433076",
"0.74234",
"0.73523116",
"0.73467505",
"0.73374295",
"0.7332255",
"0.7332255",
"0.7332255",
"0.7332255",
"0.7321798",
"0.7311942",
"0.7264411",
"0.72176605",
"0.72171134",
"0.7195898",
"0.71922493",
"0.7148211",
"0.7139588",
"0.7139278",
"0.71387696",
"0.71184886",
"0.71181124",
"0.7099271",
"0.7073289",
"0.69766104",
"0.69699997",
"0.6969767",
"0.6949345",
"0.69456595",
"0.69309884",
"0.69194186",
"0.68986773",
"0.68932986",
"0.68806726",
"0.6871395",
"0.686866",
"0.685761",
"0.68350136",
"0.68326634",
"0.6826756",
"0.6826441",
"0.6816661",
"0.6815686",
"0.6815243",
"0.68130374",
"0.68019885",
"0.6793842",
"0.6793129",
"0.6784759",
"0.67655766",
"0.67620414",
"0.6752269",
"0.67364454",
"0.67251927",
"0.6724901",
"0.6718598",
"0.6714823",
"0.6698967",
"0.6694366",
"0.6669938",
"0.66427493",
"0.6617817",
"0.66162694",
"0.6612643",
"0.66097236",
"0.6586019",
"0.65825814",
"0.65790457",
"0.6566992",
"0.6557973",
"0.65527254",
"0.6540168",
"0.65394485",
"0.6538298",
"0.6536794",
"0.6535941",
"0.6535305",
"0.6522234",
"0.6518527",
"0.6518527",
"0.6518527",
"0.6518527",
"0.6515473",
"0.65117985",
"0.6508507",
"0.6506416",
"0.6501587",
"0.64989215",
"0.64982545",
"0.6496506",
"0.6495889"
] | 0.69947404 | 33 |
Use callbacks to share common setup or constraints between actions. | def set_offer
@offer = Offer.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 offer_params
params.require(:offer).permit(:name, :description, :reward_description, :reward_factor, :redemption_value, :active, :image_url, :published, :expires)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
limit is not within the scope of the method fib | def fib(limit, first_num, second_num) # made limit an argument to be passed in
while first_num + second_num < limit
sum = first_num + second_num
first_num = second_num
second_num = sum
end
sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fib(limit)\n\tfib = 0\n\tprev = 1\n\tcurrent = 1\n\twhile current < limit\n\t\tif (prev + current).even? && (current + prev) < limit\n\t\t\tfib += (prev + current)\n\t\tend\n\n\t\told_current = current\n\t\tcurrent = prev + current\n\t\tprev = old_current\n\tend\n\tfib\nend",
"def fibs(limit, n=2)\n\t@a ||= []\n\tf = fib(n)\n\tif f < limit \n\t\t@a.push(f) \n\t\tn += 1\n\t\tfibs(limit, n)\n\telse\n\t\t@a\n\tend\nend",
"def fibsBelow(limit)\n\tfibs = [1, 2]\n\ti = 0\n\tloop do\n\t\tnextFib = fibs[i] + fibs[i+1]\n\t\tbreak if nextFib > limit\n\t\tfibs << nextFib\n\t\ti += 1\n\tend\n\treturn fibs\nend",
"def fib(first_num, second_num, limit) #add limit as additional argument\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def find_fibonaccis(limit)\n fib_array = []\n i = 1\n while i <= limit\n first_num = fib_array[i-1] ||= 1 # 1, \n second_num = fib_array[i] ||= 1 # 1, \n result = first_num + second_num\n if result > limit\n break\n end\n fib_array << result\n i += 1\n end\n fib_array\nend",
"def fib(first_num, second_num, limit) #add to method's scope.\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(n)\n \nend",
"def fibonacci(a, b, count, count_limit)\n if(count >= count_limit)\n return a\n else\n c = a + b\n puts a\n a = b\n b = c\n fibonacci(a, b, count += 1, count_limit)\n end\n\nend",
"def fib(n)\n # your work here\nend",
"def sumOfFibsBelow(limit)\n\tfibs = fibsBelow(limit)\n\tsum = fibs.inject() {|result, num| result + num}\n\treturn sum\nend",
"def fib_sequence(limit)\n seq = [1,2]\n while seq[-1] + seq[-2] < limit do\n seq << seq[-1] + seq[-2]\n end\n\n return seq\nend",
"def fib(n)\n\nend",
"def fib(n)\nend",
"def fib(n)\nend",
"def fib(first_num, second_num, limit=15)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\n end",
"def fibs(n)\nend",
"def fib(first_num, second_num, limit=15)\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit = 15)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit = 15)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit = 15)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num, limit)\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib( max_val )\n x = [ 1, 2 ]\n while\n next_val = ( x[ -2 ] + x[ -1 ] )\n return x if next_val > max_val\n x << next_val \n end\nend",
"def fib bound\n\tsum = 0\n\tval1 = 1\n\tval2 = 2\n\ttotal = val2\n\twhile true\n\t\tsum = val1 + val2\n\t\tbreak if sum > bound \n\t\t\n\t\tval1 = val2\n\t\tval2 = sum\n\t\ttotal += sum if sum%2 == 0\n\tend\n\n\ttotal\nend",
"def fib(first_num, second_num)\n while second_num < LIMIT\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fibonacci_sequence(limit)\n fib_seq = [1,2]\n i = 1\n until fib_seq[i] + fib_seq[i-1] > limit\n fib_seq.push(fib_seq[i] + fib_seq[i-1])\n i += 1\n end\n\n return fib_seq\nend",
"def problem_2_build_fib_array(upper_limit)\n fib_array = [1,2]\n while fib_array.last < upper_limit\n next_fib = fib_array[-1] + fib_array[-2]\n fib_array << next_fib\n end\n fib_array.pop\n fib_array\nend",
"def generate_fibonacci_numbers(limit)\n i = 1\n fibonacci_numbers = [0, 1]\n sum = 0\n check = true\n\n while check == true do\n if fibonacci_numbers[i - 1] + fibonacci_numbers[i] > limit\n check = false\n else\n fibonacci_numbers << fibonacci_numbers[i - 1] + fibonacci_numbers[i]\n end\n\n i += 1\n end\n\n # return fibonacci_numbers.inspect\n\n fibonacci_numbers.each do |fib|\n if fib % 2 == 0\n sum += fib\n end\n end\n\n return sum\nend",
"def fib \n arr = [0, 1]\n\n while arr[-1] + arr[-2] <= 4_000_000\n arr << arr[-1] + arr[-2]\n end\n arr.select(&:even?).inject(:+)\nend",
"def even_fibonacci(limit)\r\n start = [1, 2]\r\n\r\n start << start.last(2).inject(:+) while start[-1] < limit\r\n\r\n start.select { |number| number.even? }.inject(:+)\r\nend",
"def sum_of_even_fibonaccis(limit)\n\n holder = [1,2]\n\n while ( holder[-1] + holder[-2] ) < limit\n holder << holder[-1] + holder[-2]\n end\n\n return holder.select { |n| n.even? }.reduce(:+)\n\nend",
"def fib(first_num, second_num)\n limit = 15\n\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(n)\n #if n > 4000000\n #\treturn puts n\n #end\n return n if (0..1).include? n\n fib(n-1) + fib(n-2) if n > 1\nend",
"def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum \nend",
"def even_fibonacci_sum(limit)\n fibs = [1, 2]\n even_fibs = 2\n next_fib = 3\n\n while next_fib < limit\n fibs << next_fib\n #binding.pry\n even_fibs += next_fib if next_fib % 2 == 0\n next_fib += fibs[-2]\n end\n even_fibs\nend",
"def sum_of_fib_evens(limit_num)\n first = 1\n second = 2\n third = 3\n sum_evens = 2\n \n loop do\n first = second\n second = third\n third = first + second\n break if third > limit_num\n sum_evens += third if third.even?\n end\n \n sum_evens\nend",
"def even_fib_sum(limit)\n fib0, fib1, sum = 1, 2, 0\n while fib1 <= limit\n sum += fib1 if fib1 % 2 == 0\n fib0, fib1 = fib1, fib0 + fib1\n end\n sum\nend",
"def even_fibonacci(limit, current, prev, sum = 0)\n return sum if current >= limit\n\n sum += current if (current % 2).zero?\n current, prev = current + prev, current\n even_fibonacci(limit, current, prev, sum)\nend",
"def fibonacci_sum(limit)\r\n\tsum = 0\r\n\tprev_term = 1\r\n\tcurr_term = 2\r\n\twhile curr_term <= limit \r\n\t\tsum += curr_term if curr_term % 2 == 0\r\n\t\thold = curr_term\r\n\t\tcurr_term += prev_term\r\n\t\tprev_term = hold\r\n\tend\r\n\treturn sum\r\nend",
"def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fibs_sum(n)\n\nend",
"def fib(sum, curr, prev)\n if curr > 4_000_000\n puts sum\n return\n end\n if curr % 2 == 0\n sum += curr\n end\n fib(sum, prev + curr, curr)\nend",
"def fibonnaci_even(limit)\n fibonnacci = [1, 1]\n (1...limit).each { fibonnacci << fibonnacci.last(2).sum }\n fibo_even = fibonnacci.select { |num| num.even? }.sum\nend",
"def fibonacci(limit)\n sequence = [0]\n if limit == 0\n puts \"Please enter a number above 0\"\n else\n pattern = 1\n (limit - 1).times do |index|\n sequence << pattern\n pattern = pattern + sequence[index]\n end\n puts \"The first #{limit.to_s} numbers in the Fibonacci Sequence are #{sequence}\"\n end\nend",
"def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def fibUpTo(max)\n i1, i2 = 1, 1 # parallel assignment\n while i1 <= max\n yield i1\n i1, i2 = i2, i1+i2\n end\nend",
"def even_fibs(limit)\n a = []\n i = 0\n j = 1\n \n while j < limit do\n i, j = j, i+j\n a << j if j.even?\n end\n a.sum\nend",
"def fibo_fast(last, current, n)\n n == 0 ? last : fibo_fast(current, last + current, n - 1)\nend",
"def even_fibo_summer(upper_limit)\n f0 = 0\n f1 = 1\n sum = 0\n\n loop do\n f2 = f0 + f1\n break if f2 > upper_limit\n # puts \"f2 is #{f2}\"\n sum += f2 if (f2 % 2 == 0)\n # puts \" sum is #{sum}\"\n f0 = f1\n f1 = f2\n # puts \" f0 is now #{f0} and f1 is now #{f1}\"\n end\n\n puts \"The sum of the even-valued Fibonacci numbers under #{upper_limit} is #{sum}.\"\nend",
"def fib_up_to(max)\n i1, i2 = 1,1 #parallel assignment (i1 = 1, i2 = 1)\n while i1 <= max\n yield i1\n i1, i2 = i2, i1+i2\n end\nend",
"def fib\n first, second, i = 1, 1, 2\n while second.to_s.size < 1000\n first, second = second, first + second\n i = i + 1\n end \n puts \"#{i}\"\nend",
"def fib(first, second)\n temp_sum = first + second\n @sum += temp_sum if (temp_sum % 2).zero?\n first = second\n second = temp_sum\n\n fib(first, second) if temp_sum < 4000000\nend",
"def fibs_up_to(max)\n i1, i2 = 1, 1\n while i1 < max\n yield i1\n i1, i2 = i2, i1 + i2\n end\nend",
"def fibs(j,k)\n\t@goal = 4000000\n\ti = j\n\tj = k\n\tk = i + j\n unless k > @goal\n \t@fib_array << k\n fibs(j,k)\n end\nend",
"def fibUpTo(max)\n i1, i2 = 1, 1\n while i1 <= max\n yield i1\n i1, i2 = i2, i1 + i2\n end\nend",
"def fibUpTo(max)\n i1, i2 = 1, 1 # parralel assignment\n while i1 <= max\n yield i1\n i1, i2 = i2, i1+i2\n end\nend",
"def fib_sequence(max)\n fib_array = [1,2]\n until fib_array.last >= max do\n fib_array << (fib_array.last + fib_array[-2])\n end\n return fib_array\nend",
"def fib2(first_num, second_num)\n limit = 100\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend",
"def bottom_up(max)\n fib = []\n fib[0] = 1\n fib[1] = 2\n\n for i in 2..Float::INFINITY\n sum = fib[i-1] + fib[i-2]\n\n if sum > max\n break\n else\n fib[i] = sum\n end\n end\n\n return fib\n end",
"def fibs(n) ; PHI**n - PHA**n ; end",
"def fibonacci(n)\n \nend",
"def sum_even_fib(upper_limit)\n sum = fib0 = 0\n fib = 1\n while (fib < upper_limit)\n sum+= fib if(fib%2 == 0)\n temp = fib0\n fib0 = fib\n fib+= temp\n end \n sum\nend",
"def find_fibonacci_index_by_length(int)\nlimit = (10**int)/10\nindex = 2\nx = 1\ny = 1\n loop do\n z = x + y\n x = y\n y = z\n index += 1\n break if z > limit \n end\n index\nend",
"def fibonacci(n)\n \nend",
"def even_fibonacci_sum(limit)\n array = [0, 1]\n array << (array[-1] + array[-2]) while (array[-1] + array[-2]) < limit\n array.select(&:even?).reduce(:+)\nend",
"def buildFibbs(fibbs, max)\n while fibbs[fibbs.length-1] < max do\n fibbs.push(fibbs[fibbs.length-1] + fibbs[fibbs.length-2])\n end\n fibbs\nend",
"def fib_slow(n)\n return 0 if n == 0\n return 1 if n == 1\n return fib(n - 1) + fib(n - 2)\nend",
"def fib(n)\n return n if n < 2\n arr = [0, 1]\n (n-1).times { arr << arr.last(2).inject(:+) }\n arr.last\nend",
"def fib(n)\r\n gRatio = 1.61803398875\r\n\r\n if n == 0\r\n return 0\r\n elsif n == 1\r\n return 1\r\n else\r\n num = (((gRatio)**n) - ((1 - gRatio) ** n)) / Math.sqrt(5)\r\n return num.to_i\r\n end\r\nend",
"def a\r\n b = fib(5)\r\n if b == 10\r\n 1\r\n else\r\n 3.0\r\n end\r\nend",
"def quick_fib(n)\n (((1 + Math.sqrt(5)) / 2) ** n / Math.sqrt(5)).round\nend",
"def sup_limit(max)\n (1..Float::INFINITY).lazy.map{|i| [i,Prime.take(i).reduce(:+)]}.detect{|i,sum| sum >= max}.first\nend",
"def sum_evens(limit) \n e = []\n fibs(limit).each do |fib|\n \te << fib if fib.even?\n end\n e.inject(:+)\nend",
"def fibevensum xmax\n a, b = 1, 2\n sum = 0\n while a < xmax\n sum += a if a.even?\n a, b = b, a + b\n end\n sum\nend",
"def naive_fib(number)\n return -1 if number < 0\n return 0 if number == 0# && (@operations += 1)\n return 1 if number == 1# && (@operations += 1)\n naive_fib(number-1) + naive_fib(number-2)\nend",
"def fib(target)\n\tseries = [1, 2]\n\tbegin\n\t\tseries << series.last(2).reduce(:+)\n\tend while series.last < target\n\tseries.delete(series.last)\n\tseries\nend",
"def fib_numbers(max) #max must be integer 1 or greater\n\tfib = [1,1]\n\n\ti = 1\n\n\twhile fib[i] < max\n\t\tfib << fib[i] + fib[i-1]\n\t\ti += 1\n\tend\n\n\tfib.delete_at(fib.length - 1) if fib.last > max\n\n\treturn fib\nend",
"def fib(num)\n return num if num < 2\n return fib(num - 1) + fib(num - 2)\nend",
"def fib(n)\n return n if n < 2\n fib(n-1) + fib(n-2)\nend",
"def largest_fib\n\n fib = [1,1]\n x = 0\n\n\n\nwhile fib[-1].to_s.length != 1000\n fib << (fib[x] + fib[x + 1])\n x += 1\n\nend\n\n\nfib.each_with_index { |x, index| puts \"#{x.to_s.length} and index:#{index}\"}\n\nend"
] | [
"0.7764187",
"0.77455133",
"0.75802004",
"0.75529206",
"0.75474316",
"0.74438614",
"0.7432258",
"0.7429745",
"0.7416253",
"0.7401014",
"0.7365452",
"0.7315744",
"0.730413",
"0.730413",
"0.7265812",
"0.7246173",
"0.7226784",
"0.7207308",
"0.7207308",
"0.7207308",
"0.7207308",
"0.7207308",
"0.7207308",
"0.7207308",
"0.7207308",
"0.7207308",
"0.7195779",
"0.7195779",
"0.7195779",
"0.7192686",
"0.7192686",
"0.71627957",
"0.7128365",
"0.7069829",
"0.7004714",
"0.699659",
"0.6931378",
"0.6922259",
"0.6915982",
"0.69053423",
"0.68831086",
"0.68691397",
"0.68677765",
"0.68625486",
"0.68612444",
"0.6847077",
"0.6815331",
"0.6810587",
"0.6808636",
"0.6808203",
"0.6808203",
"0.6808203",
"0.6808203",
"0.6806183",
"0.6806183",
"0.6806183",
"0.6806183",
"0.6806183",
"0.6802062",
"0.6794583",
"0.67769474",
"0.67728823",
"0.67728823",
"0.67728823",
"0.67728823",
"0.67555934",
"0.6746974",
"0.6745997",
"0.6718416",
"0.67167664",
"0.6688643",
"0.66821516",
"0.6678184",
"0.6670399",
"0.665966",
"0.66308665",
"0.66211617",
"0.6610396",
"0.66025877",
"0.6583739",
"0.6571019",
"0.6562836",
"0.6560352",
"0.65554625",
"0.65553117",
"0.6549143",
"0.6547697",
"0.6543727",
"0.6534049",
"0.65180665",
"0.6512391",
"0.65061694",
"0.6498633",
"0.64980936",
"0.64865273",
"0.6484674",
"0.6479909",
"0.6463888",
"0.6463671",
"0.6460342"
] | 0.7435566 | 6 |
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize | def call(container, context)
if spec.respond_to?(:to_proc) && !spec.is_a?(Symbol)
spec.to_proc
elsif spec.respond_to?(:call)
spec
elsif spec.nil?
context.method(name)
elsif container[spec]
with(container[spec]).call(container, context)
else
raise InvalidPlugError, name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def offences_by; end",
"def strategy; end",
"def used?; end",
"def custom; end",
"def custom; end",
"def isolated; end",
"def isolated; end",
"def private_method\n end",
"def suivre; end",
"def intensifier; end",
"def internal; end",
"def spec; end",
"def spec; end",
"def operations; end",
"def operations; end",
"def initialize\n \n end",
"def celebration; end",
"def initialize\n\n end",
"def initialize\n\n end",
"def initialize\n \n end",
"def missing; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def ignores; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super()\n end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def extra; end",
"def initialize\n\t\t\n\tend",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def villian; end",
"def internship_passed; end",
"def overrides; end",
"def anchored; end",
"def initialize() end",
"def same; end",
"def ignore; end",
"def formation; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def missing?; end",
"def apply\n end",
"def weber; end",
"def initialize\r\n\r\n end",
"def who_we_are\r\n end",
"def operation; end",
"def initialize\n # nothing here for now\n end",
"def identify; end",
"def wrapper; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def used\n raise NotImplementedError\n end",
"def processor; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def prepareForReuse; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end"
] | [
"0.76538837",
"0.62887454",
"0.62282014",
"0.62282014",
"0.61805004",
"0.6156519",
"0.6156519",
"0.6156519",
"0.6156519",
"0.612837",
"0.59572196",
"0.5944528",
"0.5892693",
"0.5819787",
"0.5819787",
"0.5808322",
"0.5808322",
"0.58052987",
"0.5795088",
"0.57326925",
"0.5687854",
"0.56765187",
"0.56765187",
"0.56681097",
"0.56681097",
"0.5666472",
"0.5664217",
"0.5661484",
"0.5661484",
"0.565292",
"0.564905",
"0.56440926",
"0.56440926",
"0.56440926",
"0.56440926",
"0.56440926",
"0.56440926",
"0.56440926",
"0.56440926",
"0.56440926",
"0.56440926",
"0.56440926",
"0.5631964",
"0.561223",
"0.561223",
"0.561223",
"0.5603082",
"0.56013376",
"0.56013376",
"0.55721384",
"0.55687004",
"0.55595726",
"0.55595726",
"0.55595726",
"0.55595726",
"0.55595726",
"0.55595726",
"0.55595726",
"0.55595726",
"0.55595726",
"0.55595726",
"0.55561584",
"0.5554702",
"0.5553566",
"0.5548372",
"0.5537303",
"0.5530531",
"0.5523947",
"0.5509951",
"0.55079937",
"0.55079937",
"0.55079937",
"0.55037254",
"0.5498602",
"0.5495862",
"0.54939497",
"0.54907876",
"0.54850566",
"0.5476925",
"0.54745",
"0.5472552",
"0.5469456",
"0.5469456",
"0.5469456",
"0.5469456",
"0.5466271",
"0.5465413",
"0.54596597",
"0.54596597",
"0.54596597",
"0.545392",
"0.545392",
"0.545392",
"0.545392",
"0.5444147",
"0.5434436",
"0.5434436",
"0.5434436",
"0.5434436",
"0.5434436",
"0.5434436"
] | 0.0 | -1 |
N is an integer within the range [0..100,000]; the elements of A are all distinct; each element of array A is an integer within the range [1..(N + 1)]. | def solution(a)
((1..a.size + 1).to_a - a).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition(n)\n subset_size = (@array.size.to_f / n).ceil\n (0...n).collect {|i| @array[i * subset_size, subset_size]}\n end",
"def solution(n)\n array = Array.new\n (1..n).each do\n array.push(0)\n end\n while (array.length >= 16)\n (1..16).each do\n array.pop\n end \n end\n array.length\nend",
"def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend",
"def to_multiset_simple n\n @set.permutation(n).to_a.sort_by { rand }\n end",
"def generate_n_sets(array, number_of_sets)\n\nend",
"def count(n,ar)\r\n result = Array.new(100){|x| x = 0}\r\n ar.each { |x| result[x] = result[x]+1 }\r\n return result\r\nend",
"def duplicate_elements(n = 2)\n self.inject([]) do |array, current|\n array << [current] * n\n array\n end.flatten\n end",
"def ary(n); Array.new(n){rand}; end",
"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 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 chunk(array, n)\n arr_result = []\n sub_arr = []\n i = 0\n while i < array.length\n num = array[i]\n \n if sub_arr.length == n\n arr_result << sub_arr\n sub_arr = []\n end \n sub_arr << num\n\n i += 1\n end\n arr_result << sub_arr\n arr_result\nend",
"def sorted_squared_array_n_nlogn(values)\n values.collect!{|val| val*val}\n merge_sort(values)\nend",
"def lAS(n: 0)\n array = [1]\n puts \"#{array.inspect}\"\n previous = array.first\n new_array = []\n counter = 0\n \n n.times do\n previous = array.first\n counter = 0\n new_array = []\n \n array.each do |element|\n if(element == previous)\n counter = counter + 1\n else\n new_array << counter\n new_array << previous\n counter = 1\n previous = element\n end\n end\n \n new_array << counter\n new_array << previous\n array = new_array.dup\n puts \"#{array.inspect}\"\n end\nend",
"def prime_set(n)\n\t\tprimes_arr =[]\n\t\ti = 1\n\t\t# keep inserting prime numbers into array until its length is equal to 'n'\n\t\tuntil primes_arr.count == n\n\t\t\tif is_prime(i) == true \n\t\t\t\tprimes_arr << i \n\t\t\tend \n\t\t\ti+=1\n\t\tend \n\t\tp primes_arr\n\tend",
"def multipleSet(n)\n return (n..99).step(n).to_a.to_set\nend",
"def select_every_n arr, n=1\n ans = []\n arr.each_with_index do |item, i|\n ans.push item if i%n == 0\n end\n ans\nend",
"def partition(arr, n)\n\nend",
"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 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 nth_subset(n)\n # Ruby allows us to index integers as if they were arrays of bits,\n # so we can check if an element should be included in the result by testing if the ith bit of n is 1\n each_with_index.map { |e, i| e if n[i] == 1 }.compact\n end",
"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 generate_collection(array)\n array =[]\n 50.times do |n|\n array << n + 1\n end\n return array.shuffle\nend",
"def pretentious_primes(arr, n) \n arr.map { |ele| nth_prime(ele,n) }\nend",
"def find_unique_elements(arr)\n \nend",
"def add_num_to_permutation(input_arr, n)\n\tret = []\n\t\n\tinput_arr.each do |arr|\n\t\t(0..arr.length).to_a.each do |i|\n\t\t\ttmp = arr.dup\n\t\t\tret << tmp.insert(i, n)\n\t\tend\n\n\tend\n\n\tret\nend",
"def removNb(n)\n res = []\n total = (n*n + n) / 2\n range = (1..n)\n \n (1..n).each do |a|\n b = ((total - a) / (a * 1.0 + 1.0))\n if b == b.to_i && b <= n\n res.push([a,b.to_i])\n end\n end\n\n return res\nend",
"def arrPrimeFactors (n)\n result = Array.new\n while n != 1\n (2 .. n).each do |i|\n if n % i == 0\n result.push i\n n /= i\n break\n end\n end\n end\n result\nend",
"def uniq(array)\n counts = Hash.new(0)\n result = []\n array.each do |element|\n counts[element] += 1\n result << element unless counts[element] > 1\n end\n result\nend",
"def solution(arr)\n arr.map do |i|\n arr_without_i = arr.select { |item| item != i }\n arr_without_i.reduce { |n, acc| acc *= n }\n end\nend",
"def find_unsorted_subarray(nums)\n \nend",
"def solution(a)\n a.uniq.count\nend",
"def rand_indexes(n, lim)\n \t# lim = Event.count\n \treturn [] if (n < 1 || n > lim)\n \tray = []\n \twhile ray.count != n do\n \t\tray << (rand * lim).round\n \t\tray.delete(0)\n \t\tray.uniq! \t\t\n \tend\n \treturn ray\n end",
"def duplin(list, n)\n list.map { |i| [i] * n }.flatten\nend",
"def find_unique_elements(arr)\n arr_unique = []\n arr.each do |elem1|\n var1 = 0\n arr.each do |elem2|\n if elem1 == elem2\n var1 = var1 + 1\n end\n end\n if var1 <= 1\n arr_unique.push(elem1)\n end\n end\nend",
"def duplicates_subarray3(arr)\n arr.uniq.map { |elm| [elm] * arr.count(elm)}.sort_by {|subarr| subarr[0].ord }\nend",
"def chunk(array, n)\n \n results = []\n until array.empty?\n results << array.shift(n)\n end\n \n results\n\nend",
"def gen_arr(n, min = 0, max = 999999999)\n n.times.map do |x|\n rand(min..max)\n end\nend",
"def uniq_integer(input_array)\n unique = 0\n input_array.each do |num|\n unique = unique ^ num\n end\n\n unique\nend",
"def series_up(n) # given n, return a list that goes [1,1,2,1,2,3... n]\n n_list = []\n (n+1).times do |m|\n m.times do |val|\n n_list.push(val+1)\n end\n end\n return n_list\nend",
"def unique_elements(array)\n hash = Hash.new(0)\n array.each { |ele| hash[ele] += 1 }\n\n hash.keys\nend",
"def random_select(array, n)\n randnumber = Random.new\n randvalues = Array.new\n randomizedarray = Array.new\n n.times do\n randomizedarray << array[randnumber.rand(array.count)]\n end\n return randomizedarray\nend",
"def magic_array(ma)\nma.flatten.sort.map{|n|n*2}.uniq.delete_if{|n|n%3==0}\nend",
"def random_select(array, n)\n\tnew_array = []\n\twhile n > 0\n\t\tnew_array << array[rand(array.length + 1)]\n\t\tn -= 1\n\tend\n\treturn new_array\nend",
"def repeated_number_ranges(arr)\n\n\nend",
"def rand_subarrays(n = 1)\n raise ArgumentError, 'negative argument' if n < 0\n (1..n).map do\n r = rand(2**self.size)\n self.select.with_index { |_, i| r[i] == 1 }\n end\n end",
"def find_all arr, n\n answer = []\n (0..arr.length - 1).each do |i|\n if arr[i] == n\n answer << i\n end\n end\n answer\nend",
"def random_select(array, n)\n\tresult = [] # Solution array\n\tn.times do # n times repeat\n\t\tresult << array[rand(array.length)] # Random position & save number\n\tend\n\tresult\nend",
"def solution(number)\r\n (3...number).each_with_object([]) { |n, arr| arr << n if (n % 3).zero? || (n % 5).zero? }.uniq.sum\r\nend",
"def answer(n, a)\n count = 0\n n.times do |nn|\n next if a[nn] != nn + 1\n a[nn], a[nn + 1] = a[nn + 1], a[nn]\n count += 1\n end\n count\nend",
"def series_up(n)\n list = []\n (n+1).times do |a|\n a.times do |b|\n list.push(b+1)\n end \n end\n return list\nend",
"def amicables(limit)\n numbers = Array.new(limit, 0)\n (1...limit).each do |i|\n ((i * 2)...limit).step(i) do |j|\n numbers[j] += i\n end\n end\n result = []\n numbers.each_with_index do |j, i|\n if j < limit && i == numbers[j] && i != j\n result << i\n end\n end\n result\nend",
"def numUnique(array)\n\n uniques = {}\n counter = 0\n\n for element in array\n if uniques[element]\n uniques[element] = uniques[element] + 1\n else\n uniques[element] = 1\n end\n end\n\n count_uniques = 0\n\n for element in uniques\n count_uniques += 1\n end\n\n return count_uniques\n\nend",
"def getArray(n=3)\n return (1..n).to_a\nend",
"def numUnique(array)\n uniq_nums = {}\n if array.length == 0\n uniq_nums = {}\n end\n for i in 0...array.length\n uniq_nums[array[i]] = true\n end\n return uniq_nums.keys.length\nend",
"def random_select(array, n)\n result = Array.new\n n.times do \n result << array[rand(array.length)]\n end\n return result\nend",
"def num_unique2(arr)\n count = 0\n new_number = nil\n arr.each do |number|\n if new_number != number\n new_number = number\n count += 1\n end\n end\n return count\n end",
"def random_select(array, n)\n random_arr = Array.new\n n.times do\n random_array << array[rand(array.length)]\n end\nend",
"def gather(n=0)\n array = []\n sum = 0\n (0...n).each do |i|\n sum += i\n array << sum\n end\n return array\n end",
"def delete_nth(arr, n)\n results = []\n arr.each do |current_num|\n times_it_appears_in_results = results.count(current_num)\n results << current_num if times_it_appears_in_results < n\n end\n results\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def count_to (n)\n array = []\n count = 0\n while count <= n\n count += 1\n array.push(count.round)\n end\nend",
"def unique_elements(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] += 1}\n return hash.keys\n\nend",
"def distinctValues(array)\n\nend",
"def subarray_bitwise_o_rs(a)\n result_set = Set.new()\n a.size.times do |i|\n (1..a.size-i).each do |length|\n subarray = a[i, length]\n #puts subarray.inspect\n result = subarray.reduce(0) do |bor, elem|\n bor | elem\n end\n #puts result\n result_set << result\n end\n end\n result_set.size\nend",
"def permutations(array)\n results = []\n\n 1000.times do \n premutation = array.shuffle\n results << array << premutation\n end\n\n results.uniq.sort\nend",
"def unique_items(arr) #O(n)\n hash = Hash.new(0)\n results = []\n arr.each do |el|\n hash[el] += 1\n end\n hash.select { |k, v| k if v == 1 }.keys\nend",
"def compute(n)\n a = []\n a.push(1)\n a.push(1)\n n -=1\n first = 1\n second = 1\n n.times do\n third = first + second\n first = second\n second = third\n a.push(third)\n end\n #first\n a\nend",
"def eratosthenes(n)\r\n array = Array.new((n), true);\r\n index = 2\r\n primes_sum = 0\r\n\r\n until index >= n\r\n j = 0\r\n if array[index]\r\n ((index*2)..(n)).step(index+j) do |j|\r\n array[j] = false;\r\n end\r\n primes_sum += index\r\n end\r\n index += 1\r\n end\r\n primes_sum\r\nend",
"def unique_elements(arr)\n hash = Hash.new(0)\n arr.each { |ele| hash[ele] += 1}\n hash.keys\nend",
"def long_subarrays(arr)\n res =[]\n window = arr.length\n while window>=1\n idx = 0\n while idx+window<=arr.length\n sub_arr = arr.slice(idx, window)\n p sub_arr\n res << sub_arr\n idx += 1\n end\n window -= 1\n end\n res.map{|el| el.inject(0){|acc, el2| acc+el2}}.sort.last\nend",
"def array_unique(array = [])\n raise 'incorrect array' unless array.is_a? Array\n\n uniq_values = []\n array.each do |el|\n unique_counter = 0\n array.each do |e|\n next if el != e\n\n unique_counter += 1\n end\n uniq_values << el if unique_counter == 1\n end\n uniq_values\nend",
"def count_by(x, n)\n (1..n).map{|i| i*x}\nend",
"def find_unique_elements(arr)\n freq = Hash.new #hash to count integers in using key as integer and value as count\n answer = Array.new #array to store the answer to be returned in\n\n \n arr.each {|a| #loop through every element in array \n if freq[a] != nil #check to see if hash value exists\n freq[a] = freq[a] + 1 #add 1 to the hash value\n else \n freq[a] = 1 #create the hash value\n end\n }\n\n\n freq.each {|key, value| #loop through all key and value combinations in hash\n if value == 1 #If the value is 1 it is unique so add it to the answer array to be returned\n answer << key\n end\n } \n return answer\n\nend",
"def select_every_n(arr,n = 1)\n arr.select.each_with_index { |el,idx| if idx % n === 0 then true end}\n end",
"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 crear_serie(n)\n array = [1, 2]\n\n # times indica cuantas vecesdebe ejecutarse un fragmento de codigo\n (n - 2).times {\n array << array [-1] + array [-2]\n }\n \n return array\nend",
"def find_unique_elements(arr)\n \n#Algorithmic Process\n#Create an array that includes elements without the repeats\n#Create a hash that pairs each element of the new array with how many times it appears in the original array\n#Any key-value pair that has 1 for a value is unique and gets placed in the desired array\n \nnew_hash = {}\narr.each do |x|\n new_hash[x] = 0 if new_hash[x].nil?\n new_hash[x] = new_hash[x] + 1\nend\n\nnew_hash.delete_if {|key, value| value != 1}\nnew_hash.each_key {|key| puts key}\n\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 mutiply_all_element_of_an_array_excep_itself2(array_n)\n total_mutiplication_value = 1\n result_array = []\n \n array_n.each do |elm|\n total_mutiplication_value = elm * total_mutiplication_value\n end\n \n puts \"Total mutiplication : #{total_mutiplication_value}\"\n \n array_n.each do |elm|\n result = divide_by_bit_shift(total_mutiplication_value, elm)\n result_array.push(result[0])\n end\n \n\n return result_array\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 removNb(n)\n results = []\n (2..n).each do |a|\n b = (n*(n+1)/2.0-a)/(a + 1)\n results << [a, b.to_i] if b % 1 == 0 && b < n && b > 2\n end\n results\nend",
"def DistinctList(arr)\n\n return arr.size - arr.uniq.size\n \nend",
"def problem_77a\n primes = Primes.upto(100)\n\n # off is the offset in the prime array, we can work down :-)\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1 if (a & primes).length == a.uniq.length\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n m = 0\n (2..100).each do |num|\n break if (m = solve.call([1] * num,0,num-1)) > 5000\n puts \"#{num} => #{m}\"\n end\n m\nend",
"def distribute(m, n)\n arr=[]\n return arr if n<=0\n \n if m <=0\n \ta = 0\n \tb = 0\n else \n \ta = m/n\n \tb = m%n\n\tend \n\n n.times {|i| arr[i] = a}\n b.times {|i| arr[i] += 1}\n \n return arr\nend",
"def repa(array, x)\n result = []\n (1..x).each do\n result.concat(array)\n end\n return result\nend",
"def find_unique_elements(arr)\n arr_fin=[]\n arr.each do |x|\n arr.count(x)\n if arr.count(x)==1\n arr_fin << x\n end\n end\n return arr_fin\nend",
"def unique_elements(arr)\n my_hash = Hash.new(0)\n arr.each do |element|\n my_hash[element] += 1\n end\n return my_hash.keys\nend",
"def random_select(array, n)\n result = []\n n.times do\n result << array[rand(array.size)]\n end\n return result\nend",
"def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end",
"def equalizeArray(arr)\n arr = arr.sort\n count = 0; j = 0\n for i in 0..(arr.length-1)\n if arr[j] != arr[i]\n j += 1\n count+=1\n end\n end\n count\nend",
"def pretentious_primes(arr, n)\n pretentious_primes = []\n\n if n > 0\n arr.each do |x|\n primes = []\n i = (x + 1)\n while primes.length <= n\n primes << i if prime?(i)\n i +=1\n end\n pretentious_primes << primes[n-1]\n end\n elsif n < 0\n arr.each do |x|\n primes = []\n i = (x - 1)\n while primes.length <= -n\n if i <= 1\n primes << nil\n else\n primes << i if prime?(i)\n end\n i -=1\n end\n pretentious_primes << primes[(-n)-1]\n end\n else\n pretentious_primes = arr\n end\n pretentious_primes\nend",
"def subsets(arr, n = arr.size-1)\n #Heaps permutations\n @sol = [] if n == arr.size - 1\n\n if n == 0\n p arr\n @sol << arr\n return arr\n else\n (n+1).times do |i|\n p i\n subsets(arr,n-1)\n if( (n - 1) % 2 == 1)\n arr[1],arr[n] = arr[n],arr[1]\n else\n arr[i],arr[n] = arr[n],arr[i]\n end\n end\n end\nend",
"def create_rand_num (random_num_array, num_of_itens)\n num_of_itens.times do |i|\n random_num = rand(0..num_of_itens - 1 )\n while random_num_array.include?(random_num)\n random_num = rand(0..num_of_itens - 1 )\n end\n random_num_array << random_num\n end\nend",
"def uniques(array)\n test_array=[]\n array.each do |i|\n if test_array.include?(i)==false\n test_array.push(i)\n else \n end\n end\n return test_array\nend",
"def find_unique_elements (arr)\n n = Hash.new(0)\n return_array = []\n arr.each do |element|\n n[element] += 1\n end\n n.each_pair { |k,v| \n if v == 1\n return_array << k\n end\n }\n \n return return_array\nend",
"def sockMerchant(n, ar)\n return unless Integer(n) && ar.length == n\n count = 0\n ar.group_by(&:itself).each do |key, value|\n next if value.count <= 1\n value.drop(1) if value.count.odd?\n count += value.count/2\n end\n count\nend",
"def chunk(array, n)\nend",
"def count_to(n)\n arr = []\n if n>=0\n n = n.floor\n 0.upto(n) do |x|\n arr << x\n end\n else\n n = -(-n).floor\n 0.downto(n) do |x|\n arr << x\n end\n end\n arr\n end",
"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 take(n=@size)\n a = []\n n.times{a.push(pop)}\n a\n end",
"def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend"
] | [
"0.6170042",
"0.6133191",
"0.6103782",
"0.6086202",
"0.60320264",
"0.5967556",
"0.5954287",
"0.5933797",
"0.59126025",
"0.59023273",
"0.58910584",
"0.5838661",
"0.5821795",
"0.5805914",
"0.5803847",
"0.57865995",
"0.5783589",
"0.5783436",
"0.5776862",
"0.57762074",
"0.57683307",
"0.5767337",
"0.5764116",
"0.5735106",
"0.5716326",
"0.57145196",
"0.57107365",
"0.5689627",
"0.56868637",
"0.56818837",
"0.56762266",
"0.5676087",
"0.56707966",
"0.5665371",
"0.56598437",
"0.5657826",
"0.56468165",
"0.5646471",
"0.56333137",
"0.562781",
"0.56269675",
"0.5608311",
"0.5604267",
"0.56036496",
"0.56036264",
"0.56007195",
"0.5590134",
"0.5585207",
"0.55839926",
"0.5571812",
"0.5571507",
"0.55692565",
"0.55683386",
"0.55660224",
"0.5559544",
"0.5554987",
"0.55527365",
"0.55442286",
"0.5542573",
"0.5530105",
"0.5528212",
"0.552436",
"0.5518772",
"0.5511693",
"0.55066174",
"0.55055285",
"0.5503435",
"0.5502953",
"0.5502881",
"0.5502224",
"0.5500647",
"0.5500246",
"0.5497464",
"0.54963917",
"0.54946464",
"0.5491649",
"0.54888093",
"0.5487021",
"0.5486253",
"0.5484181",
"0.54827213",
"0.54821175",
"0.5481711",
"0.5480459",
"0.5476839",
"0.54754466",
"0.5473289",
"0.5467537",
"0.5458146",
"0.5457517",
"0.5456545",
"0.5452004",
"0.54463357",
"0.54391855",
"0.54339814",
"0.5423279",
"0.5422399",
"0.5419444",
"0.54178286",
"0.5417519",
"0.5414533"
] | 0.0 | -1 |
Returns true if resource or collection exists. Example: vortex.exists?(" | def exists?(uri)
uri = URI.parse(uri) if uri.is_a? String
begin
self.propfind(uri.path)
rescue Net::HTTPServerException => e
return false if(e.to_s =~ /404/)
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exist?\n @resource.exist?\n end",
"def exists?\n @exists\n end",
"def exists?\n !@not_found\n end",
"def exists?\n !@exists.nil? && @exists\n end",
"def exists?\n !@exists.nil? && @exists\n end",
"def exists?\n @exists == true\n end",
"def exists?\n !@exists.nil? && @exists\n end",
"def exists?\n !@exists.nil? && @exists\n end",
"def exists?\n !@exists.nil? && @exists\n end",
"def exist?\n @exists\n end",
"def exists?\n !!@exists\n end",
"def exists?\n true\n end",
"def exist?\n !find_exists.nil?\n end",
"def resource_exists?\n ciudades\n end",
"def exists?\n begin \n CouchSpring.get uri\n true\n rescue\n false\n end \n end",
"def exist?\n true\n end",
"def exists?\n begin\n url_for(:resources_resource, credentials, id).head\n true\n rescue RestClient::Forbidden\n true\n rescue RestClient::ResourceNotFound\n false\n end\n end",
"def exists?()\n end",
"def exists?\n\t\treturn false\n\tend",
"def exists?\n load!\n true\n rescue RecordNotFound\n false\n end",
"def exist?(*args)\n find(*args) && true\n rescue NotFoundError\n false\n end",
"def exists?()\n #This is a stub, used for indexing\n end",
"def exists?(id, options = {})\r\n id && !find_single(id, options).nil?\r\n rescue ActiveResource::ResourceNotFound\r\n false\r\n end",
"def exists?(id, options = {})\n id && !find_single(id, options).nil?\n rescue ActiveResource::ResourceNotFound\n false\n end",
"def exists?(object); end",
"def exists?(object); end",
"def exists?\n false\n end",
"def exists?\n false\n end",
"def exists?\n File.exists?(@resource[:name])\n end",
"def check_exists(collection, data)\n halt 404 unless data.collection?(collection)\n end",
"def exist?\n nil\n end",
"def exist?\n request(:get)\n true\n rescue Stretcher::RequestError::NotFound\n false\n end",
"def exists?\n stats.key? @resource[:name]\n end",
"def exists?\n begin \n CouchDB.get uri\n true\n rescue\n false\n end \n end",
"def exists?\n !count.zero?\n end",
"def exists?\n users(should_user, should_vhost)\n end",
"def exists?; end",
"def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end",
"def exists?\n schema.exists?(self)\n end",
"def exists?\n model.exists?(@id)\n end",
"def exist?\n !!@exist\n end",
"def exist?\n !!@exist\n end",
"def exists?()\n\t\t\treturn @metadata.exists?\n\t\tend",
"def exists?\n criteria.exists?\n end",
"def exist?\n\t\t!self.class.first(:conditions => {:identification_document => identification_document}).nil?\n\tend",
"def exists?\n status.exists? name\n end",
"def exists?\n assert_exists\n true\n rescue UnknownObjectException\n false\n end",
"def exists? force: false\n return resource_exists? if force\n # If we have a value, return it\n return @exists unless @exists.nil?\n # Always true if we have a gapi_json object\n return true if resource?\n resource_exists?\n end",
"def resource_present?(type, title)\n !!catalog.resource(type, title)\n end",
"def exists?\n if self.class.oneimage_list().include?(resource[:name])\n self.debug \"Found image #{resource[:name]}\"\n true\n end\n end",
"def exists?\n\t\treturn self.entry ? true : false\n\tend",
"def exists?(id)\n id && !find_single(id).nil?\n rescue ActiveWmi::ResourceNotFound\n false\n end",
"def exists?\n zk.exists?(path)\n end",
"def object_exists?(uri)\n url = uri\n request = Request.new(\"Get\", url)\n response = request.perform\n exists = (response and response.code.to_i == 200) ? true : false\n exists\n end",
"def exists?\n this.count > 0\n end",
"def exists!\n @exists = true\n end",
"def exists?(name)\n get(name).exists?\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 exists?\n vnic\n end",
"def exists?\n Puppet.debug(self.class.to_s.split('::').last + ': Calling exists method : ')\n @property_hash[:ensure] == :present\n end",
"def exist\n\treturn true\n end",
"def exists?(query)\n @coll.find(query).count > 0\n end",
"def has_resource(name)\n return @resources.has_key?(name) # Exists key in Hash\n # return @resources.include?(name) # Exists value into Array\n end",
"def has_resource?(name)\n @resources.has_key?(name)\n end",
"def exists?\n # false if the user passed in cert and private key data, this will force\n # a call to create()\n return false if resource[:cert] && resource[:priv_key]\n\n # if we're trying to delete the cert, we simply need to check if there are certs\n # at all, so that all of them are deleted, no sense in checking if exisintg certs\n # are expiring/revoked when deleting certs,\n return !certificate_list.empty? if certificate_list && resource[:ensure] == :absent\n\n # Check for the certificate existing at all\n # if we have > 1 cert, we need to cleanup \"extra\" ones by returning (false) so that\n # create is called, so only return true if we have exactly one 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 (certificate_list && certificate_list.size == 1 &&\n check_cert_exists_list && !check_cert_expiring_list && !check_cert_revoked_list)\n end",
"def exist?\n !count.zero?\n end",
"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 exists?\n !data.empty?\n end",
"def resource_exists?\n reload!\n @exists = true\n rescue Google::Cloud::NotFoundError\n @exists = false\n end",
"def resource_id_exists?(resource_id)\n t = @resources.select do |r|\n r.resource_id == resource_id\n end\n return false if t == []\n true\n end",
"def exists?\n context.count > 0\n end",
"def exist?\n not self.name.nil?\n end",
"def exists? obj\n not [obj].nil?\n end",
"def exists?\n json['exists']\n end",
"def exists?\r\n !new? && self.class.exists?(id, prefix_options)\r\n end",
"def exists?\n !new? && self.class.exists?(id, prefix_options)\n end",
"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 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 exists?(id)\n resource_gateway.show_head(id)\n true\n rescue RestClient::ResourceNotFound\n false\n end",
"def exists?(path)\n @exists[path]\n end",
"def exists? path\n end",
"def exists?\n fail NotImplementedError\n end",
"def exists?(conditions = :none)\n return super if conditions.unfriendly_id?\n return true if exists_by_friendly_id?(conditions)\n super\n end",
"def exists?\n\t\tprovider.exists?\n\tend",
"def exists?\n\t\tprovider.exists?\n\tend",
"def collection_handle_exists?(handle:)\n variables = FastLand::Shopify::Variables.collection_by_handle(handle: handle)\n collection = ShopifyAPIRetry.retry(2) { get_collection_by_handle(variables: variables, with_products: false) }\n collection.present?\n end",
"def exists?\n !new? && self.class.exists?(id)\n end",
"def exists?\n self.ensure == :present\n end",
"def exists?\n request :head\n true\n rescue Stretcher::RequestError::NotFound\n false\n end",
"def exists?\n error_code.success?\n end",
"def exists?\n self.path.present? && File.exist?(self.path)\n end",
"def exists?\n begin\n res=@db.fetch %Q/ SELECT tablename FROM pg_tables WHERE tablename='%s' AND schemaname='%s'/ % [table_name,schema_name]\n if res.count == 0\n res=@db.fetch %Q/ SELECT viewname FROM pg_views WHERE viewname='%s'AND schemaname='%s'/ % [table_name,schema_name]\n end\n rescue PG::Error => err\n return false\n end\n\n # also say false if the table is empty\n if res.count > 0\n return ds.select(1).limit(1).count > 0\n else\n return true\n end\n return false\n end",
"def exists?(id)\n path(id).exist?\n end",
"def exists?(id)\n path(id).exist?\n end",
"def has_resource?(resource)\n ret = false\n self.resources.each{ |rsc| ret = true if rsc == resource }\n ret\n end",
"def exists?\n name, type = resource[:name].split('/')\n # Create the resolver, pointing to the nameserver\n r = Resolv::DNS.new(:nameserver => server)\n # Do the look-up\n begin\n @dnsres = r.getresources(name, typeclass(type))\n rescue Resolv::ResolvError\n return false\n end\n # MX and SRV lookups will return empty arrays\n if @dnsres.is_a? Array\n return false if @dnsres.empty?\n end\n # The record exists!\n return true\n end",
"def exist?\n NotImplemented\n end",
"def exist?\n NotImplemented\n end",
"def has_resources?\n return resources.count > 0\n end"
] | [
"0.81929517",
"0.7711331",
"0.770568",
"0.7675827",
"0.7675827",
"0.76745874",
"0.76381975",
"0.76381975",
"0.76381975",
"0.7522061",
"0.7505184",
"0.7498501",
"0.7493516",
"0.74874175",
"0.7480204",
"0.7425897",
"0.7419037",
"0.7412122",
"0.73974633",
"0.73892134",
"0.73729825",
"0.73712885",
"0.7345856",
"0.7325609",
"0.7293362",
"0.7293362",
"0.728011",
"0.728011",
"0.7223471",
"0.7185392",
"0.7178732",
"0.71761894",
"0.7128961",
"0.7105887",
"0.7104943",
"0.70919585",
"0.7060292",
"0.70449716",
"0.7040404",
"0.7030359",
"0.7026469",
"0.7026469",
"0.70134586",
"0.70031023",
"0.69997454",
"0.69943964",
"0.69923437",
"0.6970887",
"0.6964099",
"0.694751",
"0.6941884",
"0.69164383",
"0.6905836",
"0.6900316",
"0.68933195",
"0.68835217",
"0.68786705",
"0.68735987",
"0.6867219",
"0.6856422",
"0.6845549",
"0.6832897",
"0.68279964",
"0.68171245",
"0.68129003",
"0.680607",
"0.68033177",
"0.67954475",
"0.6792407",
"0.678458",
"0.67806494",
"0.67780054",
"0.67527384",
"0.6741545",
"0.67357504",
"0.67307174",
"0.6722525",
"0.6718427",
"0.6718427",
"0.6718427",
"0.67140424",
"0.67112845",
"0.670582",
"0.66959316",
"0.66934055",
"0.66894543",
"0.66894543",
"0.6689428",
"0.66830057",
"0.6658847",
"0.6648652",
"0.66419756",
"0.6640891",
"0.6639373",
"0.6629489",
"0.6629489",
"0.6625351",
"0.6622267",
"0.66184175",
"0.66184175",
"0.6601554"
] | 0.0 | -1 |
Writes a document a document to the web. Same as publish, except that if document type is StructuredArticle publishDate | def write(object)
if(object.is_a? HtmlArticle or object.is_a? HtmlEvent or object.is_a? StructuredArticle or object.is_a? Vortex::Person)
uri = @uri.merge(object.url)
# puts "DEBUG: uri = " + uri.to_s
self.put_string(uri, object.content)
# puts "DEBUG: object.properties: #{uri}\n#{object.properties.gsub("><",">\n<")}\n-----\n"
self.proppatch(uri, object.properties)
return uri.to_s
else
warn "Unknown vortex resource: " + object.class.to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish_document(document)\n schema = config.get(:schema)\n paths = config.get(:paths)\n file = \"#{paths[:output]}/#{schema[:name].downcase}\"\n puts \"\\n>> #{file}\"\n # puts document\n File.write(\"#{file}.rb\", document)\n end",
"def write_to(doc);end",
"def save doc\n if doc['_attachments']\n doc['_attachments'] = encode_attachments(doc['_attachments'])\n end\n if doc['_id']\n slug = CGI.escape(doc['_id'])\n CouchRest.put \"#{@root}/#{slug}\", doc\n else\n CouchRest.post \"#{@root}\", doc\n end\n end",
"def create\n @published_document = PublishedDocument.new(params[:published_document])\n\n respond_to do |format|\n if @published_document.save\n flash[:notice] = 'PublishedDocument was successfully created.'\n format.html { redirect_to(@published_document) }\n format.xml { render :xml => @published_document, :status => :created, :location => @published_document }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @published_document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def transmit_document!\n version_id = document_version_ref_id\n version_id.present? ? update_document(version_id) : upload_document\n end",
"def docs_to_write; end",
"def save document\n ensure_connection!\n resp = connection.create_doc index_id, document.to_hash\n if resp.success?\n raw = document.instance_variable_get \"@raw\"\n raw.merge! JSON.parse(resp.body)\n return document\n end\n fail ApiError.from_response(resp)\n rescue JSON::ParserError\n raise ApiError.from_response(resp)\n end",
"def save_publish_date\n if publisher_tools_config.always_private?\n word_document.private = true\n import_data[:always_private] = true\n return true\n end\n end",
"def publish(object)\n write(object)\n uri = @uri.merge(object.url)\n if(object.is_a? StructuredArticle) then\n if(object.publishDate == nil)then\n time = Time.now.httpdate.to_s\n prop = '<v:publish-date xmlns:v=\"vrtx\">' + time + '</v:publish-date>'\n self.proppatch(uri, prop)\n end\n end\n return uri.to_s\n end",
"def create\n\t\t@post = @document.build_post(params[:post])\n\n\t\tif @post.save\n\t\t\tredirect_to admin_document_path(@document), notice: '<strong>Awesome!</strong> The document has been published.'\n\t\telse\n\t\t\trender action: \"new\"\n\t\tend\n\tend",
"def docs_to_write\n documents.select(&:write?)\n end",
"def publish!\r\n publish\r\n save!\r\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 write\n\t\t@day = post_params[:day] ? Day.from_identifier(post_params[:day]) : Day.from_time(Time.zone.now)\n\t\t@docs = Document.for_user(@user.id, @day.year, @day.month)\n\t\t@progress = Hash[*@docs.map { |doc| [Day.calculate_identifier(doc.year, doc.month, doc.day), (doc.words.to_f / doc.goal)] }.flatten]\n\t\t@document = get_or_create_document(@user, @day)\n\tend",
"def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end",
"def create\n authorize! :create, Document.new, @project\n main = @project.document_mains.create\n rev = main.revisions.create\n document = rev.versions.new(document_params(true))\n if document.save\n send_emails_helper(document)\n render json: document.attributes_for_edit\n else\n rev.destroy\n main.destroy\n render json: document.errors, status: :unprocessable_entity\n end\n end",
"def save_design_doc(data)\n attrs = case data\n when String\n MultiJson.load(data)\n when IO\n MultiJson.load(data.read)\n when Hash\n data\n else\n raise ArgumentError, \"Document should be Hash, String or IO instance\"\n end\n rv = nil\n id = attrs.delete('_id').to_s\n attrs['language'] ||= 'javascript'\n if id !~ /\\A_design\\//\n rv = Result.new(:operation => :http_request,\n :key => id,\n :error => ArgumentError.new(\"'_id' key must be set and start with '_design/'.\"))\n yield rv if block_given?\n raise rv.error unless async?\n end\n req = make_http_request(id, :body => MultiJson.dump(attrs),\n :method => :put, :extended => true)\n req.on_body do |res|\n rv = res\n val = MultiJson.load(res.value)\n if block_given?\n if res.success? && val['error']\n res.error = Error::View.new(\"save_design_doc\", val['error'])\n end\n yield(res)\n end\n end\n req.continue\n unless async?\n rv.success? or raise res.error\n end\n end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def write_document_to_index(document)\n\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to(@document, :notice => 'Document was successfully created.') }\n format.xml { render :xml => @document, :status => :created, :location => @document }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def publish!\n publish\n save\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to documents_path, notice: 'Document was successfully uploaded.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render new_document_path }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def indexDocument(index, type, document, id)\n self.class.post(\"#{index}/#{type}/#{id}\", :body => document.to_json)\n end",
"def publish\n p = Page.find_by_id(params[:id])\n p.published_on = Time.now\n p.save!\n respond_with p, :location => nil\n end",
"def create\n if signed_in?\n if current_user.admin?\n @document = Document.new(document_params)\n @document.user = current_user\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: I18n.t('documents.messages.create_success') }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n else\n admin_user\n end\n else\n redirect_to signin_path\n end\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, :notice => 'Document was successfully created.' }\n format.json { render :json => @document, :status => :created, :location => @document }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(document_params)\n @document.user = current_user\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(params[:document].merge(:owner => current_user))\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to \"/view_pad/#{@document.id}\", notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save(doc)\n doc = encode_attachments_of(doc)\n\n if doc['_id']\n server.put(\"#{name}/#{CGI.escape(doc['_id'])}\", doc)\n else\n server.post(\"#{name}\", doc)\n end\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_post_document_save_as\n filename = 'test_multi_pages.docx'\n remote_name = 'TestPostDocumentSaveAs.docx'\n dest_name = remote_test_out + 'TestPostDocumentSaveAs.pdf'\n save_options = SaveOptionsData.new({:SaveFormat => 'pdf', :FileName => dest_name})\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_common_folder + filename, \"r\").read\n @storage_api.put_create st_request\n\n request = PostDocumentSaveAsRequest.new remote_name, save_options, remote_test_folder + test_folder\n result = @words_api.post_document_save_as request\n assert_equal 200, result.code\n end",
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n flash[:notice] = 'Document was successfully created.'\n #format.html { redirect_to(@document) }\n format.xml { render :xml => @document, :status => :created, :location => @document }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create \n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to documents_path, notice: 'Document was successfully created.' }\n format.json { render :show, status: :created, location: document_path }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def create\n \n @doc = Doc.new(params[:doc])\n\n respond_to do |format|\n if @doc.save\n save_object_relationship\n format.html { redirect_to(@doc, :notice => 'Doc was successfully created.') }\n format.xml { render :xml => @doc, :status => :created, :location => @doc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def publish\n @page = Page.find(params[:id])\n @page.published_on = Time.now\n @page.save\n\n respond_to do |format|\n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n end",
"def document_params\n params.require(:document).permit(:title, :date, :content)\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render jbuilder: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @documentable = find_documentable\n @document = @documentable.documents.build(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: t('.notice', document: @document) }\n format.json\n else\n format.html { render :new }\n format.json {\n render json: @document.errors[:attachment], status: :unprocessable_entity\n }\n end\n end\n end",
"def set_document\n url = params[:document_url] ? params[:document_url] : 'kei-press-documentation'\n @document = Article.find_by(content_url: url)\n end",
"def create\n @document = Document.new(document_params)\n\n if @document.save\n render :show, status: :created, location: @document\n else\n render json: @document.errors, status: :unprocessable_entity\n end\n end",
"def put_convert_document\n filename = 'test_multi_pages.docx'\n format = 'pdf'\n \n request = PutConvertDocumentRequest.new(File.open(FILE_PATH + filename, \"r\"), format)\n result = @words_api.put_convert_document request\n end",
"def create\n @document = Document.new(document_params)\n\n if @document.save\n render json: {status: 'SUCCESS', message:'Document created', data:@document}, status: :ok\n else\n render json: {status: 'ERROR', message:'Document not created', data:@document.errors}, status: :unprocessable_entity\n end\n\n end",
"def publish\n\t\t@article.publish!\n\t\tredirect_to @article\n\tend",
"def save_design_doc(data)\n attrs = case data\n when String\n MultiJson.load(data)\n when IO\n MultiJson.load(data.read)\n when Hash\n data\n else\n raise ArgumentError, \"Document should be Hash, String or IO instance\"\n end\n\n id = attrs.delete('_id').to_s.split('/')[1]\n\n design_doc = DesignDocument.new(id)\n\n attrs['views'].each_pair do |view, functions|\n view_design = if functions['reduce']\n ViewDesign.new(view.to_s.to_java_string, functions['map'].to_java_string, functions['reduce'].to_java_string)\n else\n ViewDesign.new(view.to_s.to_java_string, functions['map'].to_java_string)\n end\n design_doc.getViews.add(view_design)\n end\n\n client.createDesignDoc(design_doc)\n end",
"def test_post_save_document_as_from_pdf_to_doc\n filename = '45.pdf'\n remote_name = 'TestPostDocumentSaveAsFromPdfToDoc.docx'\n dest_name = remote_test_out + 'TestPostDocumentSaveAs.docx'\n save_options = SaveOptionsData.new({:SaveFormat => 'docx', :FileName => dest_name})\n\n st_request = PutCreateRequest.new remote_test_folder + test_folder + '/' + remote_name, File.open(local_test_folder + test_folder + '/' + filename, \"r\").read\n @storage_api.put_create st_request\n\n request = PostDocumentSaveAsRequest.new remote_name, save_options, remote_test_folder + test_folder, :dest_file_name => dest_name\n result = @words_api.post_document_save_as request\n assert_equal 200, result.code\n end",
"def create\n\t \n\tdata = unpack_document(params[:document][:datafile]) \n\tdoc_params = {:title => document_params[\"title\"], :date => get_date(document_params,\"date\")}\n\tif !data.nil? then\n\t\tdoc_params[:content] = data[:content]\n\t\tdoc_params[:styles] = data[:styles]\n\tend\n @document = Document.new(doc_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render action: 'show', status: :created, location: @document }\n else\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_document(birthdate:, first_name:, last_name:, street:, postal_code:, country_code:, document_type:, document_value:)\n data = {\n doc: {\n birth_day: birthdate.day,\n birth_month: birthdate.month,\n birth_year: birthdate.year,\n name_first: first_name,\n name_last: last_name,\n address_street1: street,\n address_postal_code: postal_code,\n address_country_code: country_code,\n document_type: document_type,\n document_value: document_value\n }\n }\n\n @client.patch(path: \"/users/#{@user_id}\", oauth_key: @oauth_key, fingerprint: @fingerprint, json: data)\n end",
"def create_document\n filename = 'NewDocument.docx'\n folder = 'Word Documents'\n storage = 'Default Storage'\n\n request = PutCreateDocumentRequest.new storage, filename, folder\n result = @words_api.put_create_document request\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to(@document, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @document, :status => :created, :location => @document }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def save!\n Powirb.log.debug(\"[#{wid}] saving on #{@filename}\")\n File.open(@filename, 'w+') {|io| io.puts @doc}\n end",
"def create\n @current_user = User.find_by_id(session[:user_id])\n @document = Document.new(params[:document])\n @document.user = @current_user\n if @document.file && !document.file.empty?\n @document.name = @document.file.original_filename\n @document.status = 'pending'\n #@document.dt_reference = DocTrackrEnterprise.secure_document(@document.file, \"https://doctrackr-salesforce.herokuapp.com/documents/callback\")\n end\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(projectId, document)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/documents/\"\r\n\t\t\t\tfileBody = Hash.new\r\n\t\t\t\tfileBody[\"uploaddoc\"] = document.getUploaddoc\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, document.toParamMAP, fileBody)\t\t\r\n\t\t\t\treturn $documentParser.getDocument(response)\r\n\t\t\tend",
"def document\n document_type_class.new document_type_class.unique_key => document_id\n end",
"def write(document)\n if key?(document.key) && get(document.key) != document\n fail Atlas::DuplicateKeyError.new(document.key)\n end\n\n path = document.path\n\n content = Atlas::HashToTextParser.new(\n serializable_attributes(document)\n ).to_text\n\n # Ensure the directory exists.\n FileUtils.mkdir_p(path.dirname)\n\n @all.push(document) unless path.file?\n\n path.open('w') do |file|\n file.write(content)\n file.write(\"\\n\") unless content[-1] == \"\\n\"\n end\n\n lookup_map[document.key] = path\n @documents[document.key] = document\n\n true\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |wants|\n if @document.save\n flash[:notice] = 'Document was successfully created.'\n wants.html { redirect_to(@document) }\n wants.xml { render :xml => @document, :status => :created, :location => @document }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def convert_and_save(document, format, out_path, password = nil, storage = nil, fonts_folder = nil, slides = nil, options = nil)\n convert_and_save_with_http_info(document, format, out_path, password, storage, fonts_folder, slides, options)\n nil\n end",
"def create\n @doc = Doc.new(params[:doc])\n\n respond_to do |format|\n if @doc.save\n format.html { redirect_to(@doc, :notice => 'Doc was successfully created.') }\n format.xml { render :xml => @doc, :status => :created, :location => @doc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, success: 'Documento creado con éxito.' }\n format.json { render :show, status: :created, location: @document }\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish\n # Make sure it is not already published\n if published_at\n raise Exception.new(\"Cannot publish User Agreement that is already published\");\n end\n published_datetime = Time.now # It's being published now\n transaction do\n versioned_document = VersionedDocument.get_versioned_document\n previous_agreement = versioned_document.published_version\n \n puts \"published_datetime = #{published_datetime.inspect}\"\n \n # Any existing published version will be superceded\n if previous_agreement\n previous_agreement.superceded_at = published_datetime\n previous_agreement.save\n puts \"Saved previous_agreement\"\n end\n self.published_at = published_datetime\n puts \"Saving self = #{self.inspect}\"\n save\n # Record this user agreement as being the published version\n versioned_document.published_version = self\n # This user agreement is no longer the new version (which it presumably was)\n versioned_document.new_version = nil\n puts \"Saving versioned_document = #{versioned_document.inspect}\"\n versioned_document.save\n puts \"All saved.\"\n end\n end",
"def document?; end",
"def document?; end",
"def create\n @document = @adverse_event.ae_documents.where(project: @project, user: current_user).new(ae_document_params)\n\n if @document.save\n @document.uploaded!(current_user)\n redirect_to ae_module_documents_path(@project, @adverse_event), notice: \"Document was successfully created.\"\n else\n render :new\n end\n end",
"def generate_document(data)\n template = config.get(:template)\n options = template[:options]\n file = \"#{template[:root]}/mongoid.slim\"\n # create template\n document = Slim::Template.new(\n # delegate file read to slim\n file,\n # declare default options\n options\n )\n .render(\n # ensure helpers are scoped\n self,\n # pass data via parameter\n data: data\n )\n # publish data to file\n publish_document(document)\n # return document\n document\n end",
"def create\n @document = Document.new(params[:document].merge({:updated_by => current_user}))\n\n respond_to do |format|\n if @document.save\n @document.add_contributor! current_user\n format.html { redirect_to edit_admin_document_path(@document), notice: '<strong>Awesome!</strong> The document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(document_params)\n\n authorize @document\n\n respond_to do |format|\n if @document.save\n flash_label = \"Document was successfully created.\"\n flash.now[:notice] = flash_label\n\n format.html { redirect_to @document, notice: flash_label }\n format.json { render :show, status: :created, location: @document }\n format.js\n else\n format.html { render :new }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def document_params\n params.require(:document).permit(\n :title, :author, :description, :keywords, :published_year, :publisher, :file, :is_private)\n end",
"def create\n #creates a new document and also its parameters(its title and its content)\n @doc = current_user.docs.build(doc_params)\n\n #says if the doc is saved then get the application to redirect the user to the document that was #just created/saved.\n if @doc.save\n redirect_to @doc\n # says if it fails to save then render the doc again so the user can have another go at saving it.\n # The reason why render 'new' is used here instead of 'redirect_to' is because redirect_to is a NEW http refresh. Meaning if the user has a long document and a save fails then if we used redireect_to they would lose all of their previous work!\n # but render does not refresh the page. It keeps the user where they are and they get to have another go at saving the doc.\n else\n render \"new\"\n end\n end",
"def create\n @special_document = ModifiedDocument.new(params[:special_document])\n\n respond_to do |format|\n if @special_document.save\n format.html { redirect_to @special_document, notice: 'Special document was successfully created.' }\n format.json { render json: @special_document, status: :created, location: @special_document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @special_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def writeToFile(type, text)\n\t\t# get collection\n\t\tthings = @@db.collection(\"saves\")\n\t\t\n\t\t# get form name\n\t\tfrm = @@form\n\t\t\n\t\t# check if form variable is set\n\t\tif(!frm)\n\t\t\tfrm = \"N/A\"\n\t\tend\n\t\t\n\t\t# insert into document\n\t\tthings.insert(type => text, \"form\" => frm)\n\tend",
"def create\n @document = Document.new(resource_params)\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, notice: 'Primary document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document = Document.new(params[:document])\n @document.generate_token\n @document.archived = false\n if params[:group_id]\n @document.owner = Group.find(params[:group_id]) \n else\n @document.owner ||= default_company\n end\n @document.author = current_user\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to document_path(@document), :flash => { :success => 'Document was successfully created.'} }\n format.json { render json: @document, status: :created, location: @document }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if(@document = Document.new(params[:document])).save\n flash['notice'] = 'Document was successfully created.'\n respond_with @document, \n :location => site_document_url(@document.site.slug , @document.id.to_s)\n else\n\n if doc = Document.where(uri: params[:document][:uri]).first\n params[:id] = doc.id\n update\n else\n respond_with @document\n end\n end\n \n end",
"def create\n @documentable = find_resource\n @document = @documentable.documents.build(document_params)\n @document.creator = current_user\n\n respond_to do |format|\n if @document.save\n notify_user(:notice, 'Document was successfully created.')\n format.html { redirect_back(fallback_location: root_path) }\n format.json { render action: 'show', status: :created, location: @document }\n format.js { @asset = @document.documentable }\n else\n format.html { render action: 'new' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n format.js { render action: 'new' }\n end\n end\n end",
"def document_params\n params.require(:document).permit(:title, :doc)\n end",
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to edit_admin_document_path(@document), notice: 'Document was successfully created.' }\n format.json { render json: @document, status: :created, location: @document }\n format.js { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end",
"def create_document!(model)\n document = model.new(params)\n unless document.valid?\n error 400, convert(body_for(:invalid_document, document))\n end\n unless document.save\n error 400, convert(body_for(:internal_server_error))\n end\n document\n end",
"def save doc, to_filename, &data_iterator\n\n @file_manager = OfficeFileManager.new(@ods_template)\n \n data_iterator.call(doc)\n\n @file_manager.save doc, to_filename\n \n end",
"def save_publication\n \n init_publishable_data\n\n if publishing_workflow.is_accepted?(self, PublishingAction::SAVE)\n self.publishing_state_id = PublishingState::DRAFT.id\n save if self.respond_to?(:save)\n end\n\n end"
] | [
"0.750352",
"0.68032277",
"0.6658165",
"0.64120036",
"0.6408126",
"0.6327213",
"0.6285273",
"0.623843",
"0.61735594",
"0.609951",
"0.6096324",
"0.609122",
"0.6090767",
"0.6064074",
"0.6038858",
"0.603182",
"0.60215497",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0.60130084",
"0.600164",
"0.5994882",
"0.5994427",
"0.5988229",
"0.5945115",
"0.59428644",
"0.59381795",
"0.59358984",
"0.5934605",
"0.5930738",
"0.5920582",
"0.5920582",
"0.5917049",
"0.591411",
"0.5903289",
"0.58975506",
"0.5890121",
"0.5885214",
"0.5884431",
"0.5871421",
"0.58690435",
"0.5862932",
"0.58571124",
"0.58546585",
"0.5848532",
"0.5848269",
"0.5838107",
"0.5837704",
"0.58360475",
"0.58307225",
"0.58224493",
"0.5814905",
"0.5811915",
"0.58065677",
"0.57784754",
"0.5776928",
"0.57560706",
"0.5749806",
"0.57456774",
"0.57313573",
"0.57199144",
"0.5714437",
"0.570528",
"0.570528",
"0.5703275",
"0.5695611",
"0.5687212",
"0.5667981",
"0.5665573",
"0.56635606",
"0.56628305",
"0.5660419",
"0.5652743",
"0.5642767",
"0.5642405",
"0.563872",
"0.5638075",
"0.56374544",
"0.56369835",
"0.5635166",
"0.56315136",
"0.56296176"
] | 0.0 | -1 |
Publish a document object to the web. If content is a StructuredArticle stored as json, and publisDate is note set, then publishDate will be set to current time. Publishes a object by performing a PUT request to object.url with object.content and then performing a PROPPATCH request to object.url with object.properties Example: vortex = Vortex::Connection.new(" article = Vortex::StructuredArticle(:title=>"My title") vortex.publish(article) | def publish(object)
write(object)
uri = @uri.merge(object.url)
if(object.is_a? StructuredArticle) then
if(object.publishDate == nil)then
time = Time.now.httpdate.to_s
prop = '<v:publish-date xmlns:v="vrtx">' + time + '</v:publish-date>'
self.proppatch(uri, prop)
end
end
return uri.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish!\r\n publish\r\n save!\r\n end",
"def publish!\n publish\n save\n end",
"def publish\n public_content.delete if public_content\n PublicContent.create!(\n content: self,\n topic:,\n text:,\n otu:\n )\n end",
"def publish_impl(publish_target, digital_object)\n digital_object_pid = digital_object_pids(digital_object).first\n return [false, \"Never preserved to Fedora3\"] unless digital_object_pid\n return [false, \"No DOI\"] if digital_object.doi.blank?\n connection = Faraday.new(publish_target.publish_url)\n connection.token_auth(publish_target.api_key)\n resp = connection.put(digital_object_pid)\n [true, [resp.headers['Location']]]\n rescue StandardError => e\n [false, [e.message]]\n end",
"def publish\n end",
"def publish\n end",
"def publish\n end",
"def p_publish( obj )\n puts \"## Page: #{ obj.link }, updated #{ obj.updated }\"\n end",
"def publish\n\t\t@article.publish!\n\t\tredirect_to @article\n\tend",
"def publish_document(document)\n schema = config.get(:schema)\n paths = config.get(:paths)\n file = \"#{paths[:output]}/#{schema[:name].downcase}\"\n puts \"\\n>> #{file}\"\n # puts document\n File.write(\"#{file}.rb\", document)\n end",
"def publish_directly\n publish!\n end",
"def publish\n ZC.standard_request(:post, @links[:publish], zc_id: @zc_id)\n end",
"def publish(args)\n object = args[:object]\n action = args[:action]\n options = (args[:options] || {}).stringify_keys\n\n data = {\n :key => object.obj_key,\n :action => action,\n :headline => object.to_title,\n :url => object.public_url,\n :admin_url => object.admin_edit_url,\n :status => object.status\n }.merge(options)\n\n $redis.publish(\"scprcontent\", data.to_json)\n end",
"def publish\n p = Page.find_by_id(params[:id])\n p.published_on = Time.now\n p.save!\n respond_with p, :location => nil\n end",
"def publish(work, publish_url)\n response = post(work, publish_url)\n { response: response, work: JSON.parse(response.body) }\n end",
"def publish(workflow: nil, lane_id: nil)\n query_params = [].tap do |params|\n params << \"workflow=#{workflow}\" if workflow\n params << \"lane-id=#{lane_id}\" if lane_id\n end\n query_string = query_params.any? ? \"?#{query_params.join('&')}\" : ''\n publish_path = \"#{object_path}/publish#{query_string}\"\n resp = connection.post do |req|\n req.url publish_path\n end\n return resp.headers['Location'] if resp.success?\n\n raise_exception_based_on_response!(resp)\n end",
"def publish!\n raise 'Not implemented!'\n end",
"def publish\n respond_to do |format|\n if @post.publish!\n format.html { redirect_to blog_post_no_prefix_path(@blog, @post),\n notice: 'Post was successfully published.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish\n @page = Page.find(params[:id])\n @page.published_on = Time.now\n @page.save\n\n respond_to do |format|\n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n end",
"def publish(content_id, update_type = nil, options = {})\n params = {\n update_type: update_type,\n }\n\n optional_keys = %i[locale previous_version]\n\n params = merge_optional_keys(params, options, optional_keys)\n\n post_json(publish_url(content_id), params)\n end",
"def publish!\n self.published = true\n if self.respond_to?(:publish_on)\n self.publish_on ||= Date.today\n end\n self.save\n end",
"def publish(*args, &blk)\n (@client ||= connect).publish(*args, &blk)\n end",
"def publish(*args, &blk)\n (@client ||= connect).publish(*args, &blk)\n end",
"def publish\n set_publish(true)\n end",
"def publish\n respond_to do |format|\n if @course_content.publish(course_content_params)\n format.html { redirect_to @course_content, notice: 'CourseContent was successfully published.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @course_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish(*args)\n Iodine.publish *args\n end",
"def create\n @publish = Publish.new(params[:publish])\n\n respond_to do |format|\n if @publish.save\n format.html { redirect_to @publish, notice: 'Publish was successfully created.' }\n format.json { render json: @publish, status: :created, location: @publish }\n else\n format.html { render action: \"new\" }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish\n jsfl.publish\n execute\n end",
"def publish\n @page.publish\n respond_with(@page, location: published_api_pages_url)\n end",
"def publish!\n self.published = true\n\n # upgrade if necessary\n if upgrade_needed? || current_version.nil?\n upgrade_version!\n else\n save(:validate => false)\n end\n end",
"def publish!\n self.published = true\n save\n end",
"def publish\n topic = find_topic\n TagPublisher.new(topic).publish\n redirect_to topic\n end",
"def publish(data = {})\n assign_properties(data)\n\n self\n end",
"def create\n @publish = Publish.new(publish_params)\n\n respond_to do |format|\n if @publish.save\n format.html { redirect_to @publish, notice: 'Publish was successfully created.' }\n format.json { render :show, status: :created, location: @publish }\n else\n format.html { render :new }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publish = Publish.new(publish_params)\n\n respond_to do |format|\n if @publish.save\n format.html { redirect_to @publish, notice: 'Publish was successfully created.' }\n format.json { render :show, status: :created, location: @publish }\n else\n format.html { render :new }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish(topic, *args, **kwargs)\n raise 'The topic can not be nil' unless url != nil\n\n params = {\n topic: topic,\n args: args,\n kwargs: kwargs\n }\n\n self._make_api_call(params)\n end",
"def create\n @article = Article.new(params[:article])\n @article.user_id = current_user.id\n publish_or_not\n\n respond_to do |format|\n if @article.save\n if @article.published?\n flash[:success] = 'Article was successfully published.'\n format.html { redirect_to article_path(@article) }\n else\n flash[:success] = 'Article was successfully saved.'\n format.html { redirect_to edit_article_path(@article) }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish\n @opportunity.status = \"Publish\"\n @opportunity.publishdate = Time.new\n if @opportunity.save\n render json: @opportunity, status: :created, location: @opportunity\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end",
"def publish\n @blog_post = BlogPost.find(params[:id])\n respond_to do |format|\n if @blog_post.publish\n format.html { redirect_to(@blog_post) }\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.html { redirect_to(@blog_post) }\n format.xml { render :xml => @blog_post.errors, :status => :unprocessable_entity }\n format.json { render :json => @blog_post.errors.to_json, :status => :unprocessable_entity }\n end\n end\n end",
"def publish(type, data = nil)\n raise \"implement!\"\n end",
"def publish!(repository_client, publication)\n files = stage_attached_files(publication)\n response = repository_work(repository_client, publication, files).publish\n publication.update(pub_url: publication_url(repository_client, response: response[:response]))\n publication.publish!\n end",
"def publish\n set_publish_state(Event::PUBLISHED_STATE)\n end",
"def publish\n Milkrun.say \"Publishing changelog for #{variant} package with version_code #{version_code}\"\n\n build = {\n 'build' => version_code,\n 'changelog' => changelog,\n 'variant' => variant\n }\n body = (current_builds.select{|b| b[:build] != version_code} + [build]).to_yaml\n\n object = Milkrun.s3_client.put_object(body: body, bucket: Milkrun.bucket, key: 'builds.yaml')\n\n Milkrun.say \"Changelog published\"\n end",
"def publish(*args)\n provider.publish(*args)\n end",
"def publish(data, opts = {})\n\t exchange.publish(data, opts)\n\t end",
"def publish\n self.published = true\n end",
"def publish\n if @item.publish\n flash[:notice] = 'Your item is published!'\n else\n flash[:notice] = 'There was an error'\n end\n\n redirect_to @item\n end",
"def publish\n load_resource\n resource_instance_variable.public = true\n resource_instance_variable.save\n flash[:notice] = t(\"page_published\", :name => resource_instance_variable.name)\n redirect_back_or_to_default(resources_path)\n end",
"def create\n \n @article = Article.new()\n \n set_publishable_params(params[:article], @article)\n \n @article.assign_attributes(article_params)\n @article.user_id = current_user.id\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_params\n params.require(:publish).permit(:title, :text)\n end",
"def publish(body, routing_key, **properties)\n @client.publish(body, @name, routing_key, **properties)\n self\n end",
"def publish!\n self.published = true\n self.downloads = 0\n \n # upgrade if necessary\n if upgrade_needed? || current_version.nil?\n upgrade_version!\n else\n save(:validate => false)\n end\n end",
"def publish(payload, &block)\n publish!(payload, &block)\n rescue => e\n config.on_error_publish.call(e, { payload: payload })\n end",
"def publish\n unless publish = pubsub.find_first('ns:publish', :ns => self.class.registered_ns)\n self.pubsub << (publish = XMPPNode.new('publish', self.document))\n publish.namespace = self.pubsub.namespace\n end\n publish\n end",
"def publish( message )\n raise NotImplementedError, \"please implement 'publish'\"\n end",
"def create\n @published_document = PublishedDocument.new(params[:published_document])\n\n respond_to do |format|\n if @published_document.save\n flash[:notice] = 'PublishedDocument was successfully created.'\n format.html { redirect_to(@published_document) }\n format.xml { render :xml => @published_document, :status => :created, :location => @published_document }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @published_document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def handle_publish(client, data)\n topic_uri, payload, exclude, include = data\n\n @engine.create_event(client, topic_uri, payload, exclude, include)\n\n trigger(:publish, client, topic_uri, payload, exclude, include)\n end",
"def publish!(timestamp = Time.now)\n ts = timestamp.respond_to?(:xmlschema) ? timestamp.xmlschema : timestamp.to_s\n\n if has_published?\n published.text = ts\n else\n add_child Published.new { |u| u.text = ts }\n end\n\n self\n end",
"def publish\n @options['date'] ||= read_draft_date || Time.now.iso8601\n\n post_options = {\n 'title' => read_draft_title,\n 'date' => @options['date'],\n 'slug' => publish_slug,\n 'content' => read_draft_content,\n 'dir' => @options['dir'],\n 'type' => 'post from draft'\n }\n\n # Create a new post file\n #\n Post.new(post_options).write\n \n # Remove the old draft file\n #\n FileUtils.rm @options['path']\n\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 publish!\n self.update_attribute(:published, true)\n end",
"def publish\n # TODO: move all of the _sm_ property processes into the wrapper\n _sm_header.published_at = Time.now\n _sm_header.publisher_pid = Process.pid\n\n payload = encode\n\n raise Errors::BrokerNotConfigured if broker_missing?\n broker.publish(_sm_header, payload)\n\n SS.add(_sm_header.message_class, 'publish')\n end",
"def publish(id, options={})\n id = self.get_id(id)\n self.perform_post(\"/#{id}\", options)\n end",
"def publish(event)\n event_key = publisher_key if protocol == :http\n event_key ||= event.name.split('.').last\n publish_operation_name = publish_operation_name_for(event_key)\n\n logger.debug \"Publisher#publish publish_operation_name: #{publish_operation_name}\"\n publish_operation = find_publish_operation_for(publish_operation_name)\n publish_operation.call(event.payload, {headers: event.headers})\n end",
"def publish(channel, data)\n send_action('publish', channel, data)\n end",
"def publish\n @options['date'] ||= read_post_yaml('date') || Time.now.iso8601\n @options['title'] = read_post_yaml('title')\n\n post_options = {\n 'title' => @options['title'],\n 'date' => @options['date'],\n 'slug' => path_slug(@options['path']),\n 'extension' => File.extname(@options['path']).sub(/^\\./, ''),\n 'content' => read_post_content,\n 'dir' => @options['dir'],\n 'type' => \"post from draft\",\n 'write_message' => \"Published: #{relative_path(path)} →\",\n 'force' => @options['force']\n }\n\n # Create a new post file\n #\n Post.new(site, post_options).write\n \n # Remove the old draft file\n #\n FileUtils.rm @options['path']\n\n end",
"def publish\n fail_with! 'Already published' if version.published?\n\n version.published_at = Time.zone.now\n version.active = true\n\n ActiveRecord::Base.transaction do\n save_or_die! version\n TosVersion.where.not(id: version.id).update_all(active: false)\n end\n\n reset_tos_acceptance\n end",
"def publish\n # Make sure it is not already published\n if published_at\n raise Exception.new(\"Cannot publish User Agreement that is already published\");\n end\n published_datetime = Time.now # It's being published now\n transaction do\n versioned_document = VersionedDocument.get_versioned_document\n previous_agreement = versioned_document.published_version\n \n puts \"published_datetime = #{published_datetime.inspect}\"\n \n # Any existing published version will be superceded\n if previous_agreement\n previous_agreement.superceded_at = published_datetime\n previous_agreement.save\n puts \"Saved previous_agreement\"\n end\n self.published_at = published_datetime\n puts \"Saving self = #{self.inspect}\"\n save\n # Record this user agreement as being the published version\n versioned_document.published_version = self\n # This user agreement is no longer the new version (which it presumably was)\n versioned_document.new_version = nil\n puts \"Saving versioned_document = #{versioned_document.inspect}\"\n versioned_document.save\n puts \"All saved.\"\n end\n end",
"def publish\n @article = Article.find(params[:id])\n @article.change_publish_status(1)\n flash[:notice] = \"Article status changed to published.\"\n redirect_to :back\n rescue Exception => e\n log_exception(e)\n flash[:warning] = \"Error!\"\n redirect_to :back\n end",
"def publish\n @page = params[:page]\n public = params[:public]\n @story = Story.find(params[:id])\n \n respond_to do |format|\n if @story.update_attribute(:public, public)\n format.html { redirect_to(\"/admin/stories?filter=\" + @story.story_set_id.to_s + \"&page=\" + @page.to_s) }\n format.xml { head :ok }\n format.json { render json: @story, status: :updated}\n format.js\n else \n format.json{ render :json=> {:success => \"false\"} }\n format.js\n end\n end\n end",
"def publish!(current_time = Time.current)\n PublishPageJob.perform_later(id, public_on: current_time)\n end",
"def publish\n original = Newsly::Template.find(self.parent_id)\n original.subject= self.subject\n original.body= self.body\n original.save\n original\n end",
"def publish\n\n current_user_or_redirect ? nil : return\n\n @post = Post.find(params[:id])\n # topic = Topic.where(\"id = ?\", params[:topic]).first\n # if topic\n # @post.topics << topic unless @post.topics.include?(topic)\n # end\n \n if !@post.mine?(@current_user.id)\n redirect_to root_path\n return\n end\n \n @post.status = 'live'\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n @post.update_created_at\n @post.delay.add_interactions\n format.html { redirect_to @post.link_for_post, notice: 'Post was successfully published.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def publish(_ = nil)\n answers.each do |answer|\n answer.publish! if answer.submitted?\n end\n self.publisher = User.stamper || User.system\n self.published_at = Time.zone.now\n end",
"def publish\r\n return if published?\r\n self.publish_at = Time.now\r\n self.unpublish_at = nil\r\n end",
"def publish\n return true if self.published_at\n\n if self.new_record?\n return false unless self.save\n end\n\n self.published_at = Time.now\n self.save\n end",
"def do_publish(params)\n content_type 'text/plain', :charset => 'utf-8'\n unless params['hub.url'] and not params['hub.url'].empty?\n throw :halt, [400, \"Bad request: Empty or missing 'hub.url' parameter\"]\n end\n begin\n # TODO: move the subscribers notifications to some background job (worker?)\n hash = Topic.to_hash(params['hub.url'])\n topic = DB[:topics].filter(:url => hash)\n if topic.first # already registered\n # minimum 5 min interval between pings\n #time_diff = (Time.now - topic.first[:updated]).to_i\n #throw :halt, [204, \"204 Try after #{(300-time_diff)/60 +1} min\"] if time_diff < 300\n topic.update(:updated => Time.now, :dirty => 1)\n # only verified subscribers, subscribed to that topic\n subscribers = DB[:subscriptions].filter(:topic_id => topic.first[:id], :state => 0)\n atom_diff = Topic.diff(params['hub.url'], true)\n postman(subscribers, atom_diff) if (subscribers.count > 0 and atom_diff)\n topic.update(:dirty => 0)\n else \n DB[:topics] << { :url => hash, :created => Time.now, :updated => Time.now }\n end\n throw :halt, [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [404, e.to_s]\n end\n end",
"def publish\n template = Template.find(params[:id])\n authorize template\n publishable, errors = template.publishability\n if publishable\n if template.publish!\n flash.now[:notice] = _(\"Your #{template_type(template)} has been published and is now available to users.\")\n else\n flash.now[:alert] = _(\"Unable to publish your #{template_type(template)}.\")\n end\n else\n flash.now[:alert] = errors\n end\n redirect_to(request.referer.presence || org_admin_templates_path)\n end",
"def publish\n @training = Training.find(params[:id])\n @training.publish\n respond_to do |format|\n format.html { redirect_to @training, notice: 'Training was successfully published.' }\n end\n end",
"def _publish(event, url)\n publish(event, url)\n end",
"def publish(revision, content=nil)\n\n # first_published_filter = published_filter = {}\n\n db.transaction do\n with_editable do\n first_published_filter = {:first_published_at => nil}\n published_filter = {}\n\n must_publish_all = (content.nil? || (!revision_exists?(revision-1)) || \\\n (content.is_a?(Array) && content.empty?))\n\n if must_publish_all\n create_revision(revision) do\n with_revision(revision) do\n _set_publish_timestamps(revision, first_published_filter, published_filter)\n end\n end\n else\n content = content.map do |c|\n c.is_a?(content_model) ? c.reload : content_model.get(c)\n end.compact\n\n # pages should be published in depth order because it's\n # possible to be publishing a child of\n # a page that's never been published\n content.sort! { |c1, c2| c1.depth <=> c2.depth }\n\n ids = content.map { |c| c.id }\n first_published_filter.update(:id => ids)\n published_filter.update(:id => ids)\n\n create_revision(revision, revision-1) do\n content.each do |c|\n c.sync_to_revision(revision, true)\n end\n with_revision(revision) do\n _set_publish_timestamps(revision, first_published_filter, published_filter)\n end\n end\n end\n\n # run any passed code and if it fails revert the publish step\n if block_given?\n begin\n with_revision(revision) { yield }\n rescue Exception => e\n delete_revision(revision)\n raise e\n end\n end\n\n # Only set the timestamps once we're sure the publish has completed\n # successfully\n # The revision timestamps must be set above because the revision must\n # be completely written before it is copied to the revision history\n # table.\n with_editable do\n _set_publish_timestamps(revision, first_published_filter, published_filter)\n end\n end\n end\n end",
"def publish_impl(publish_target, digital_object)\n return [false, \"Never preserved\"] if digital_object.first_preserved_at.blank?\n\n [true, [\"https://example.com/#{publish_target.string_key}/#{digital_object.uid}\"]]\n rescue StandardError => e\n [false, [e.message]]\n end",
"def transmit_document!\n version_id = document_version_ref_id\n version_id.present? ? update_document(version_id) : upload_document\n end",
"def publish\n respond_to do |format|\n if @submission.publish!\n format.html { redirect_to @submission, notice: 'Published!' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_profile_submission_path(@profile, @submission), notice: 'There were missing parts.' }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish\n @topics = current_organization.topics\n @topics.each do |topic|\n topic.publish!\n end\n record_activity(\"update\", \"actualizó su programa de apertura.\")\n redirect_to new_inventory_path, :notice => \"Muy bien, tu programa de apertura está listo. De cualquier forma siempre puedes regresar a editarlo.<br/>El siguiente paso es subir un inventario de datos.\"\n end",
"def publish\n if self.draft\n self.published_at = nil\n else\n self.published_at ||= DateTime.now\n end\n end",
"def publish(data, opts = {})\n exchange.publish(data, opts.merge(:routing_key => self.name))\n end",
"def create\n @publication = Publication.new(params[:publication].merge(\n :user => User.current\n ))\n respond_to do |format|\n if @publication.save\n flash_notice(:runtime_created_at.t(:type => :publication))\n format.html { redirect_to(@publication) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n flash_object_errors(@publication)\n format.html { render :action => :new }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def publish(endpoint, payload)\n comm.endpoint = endpoint.type\n response = endpoint.uid ? comm.update(endpoint.uid, payload) : comm.create(id, payload)\n response.status.eql?(200) ? 'ok' : response.body\n end",
"def publish(object)\n @channel << object\n end",
"def publish!(payload, &block)\n add_transaction_headers(payload)\n return unless ensure_publish(payload)\n\n current_transaction ? current_transaction.add_payload(payload) : connector_publish(payload)\n block&.call\n payload\n rescue => e\n print_error(e, payload)\n raise\n end",
"def publish(event, payload)\n end",
"def publish\n render json: ErrorSerializer.serialize(resource_name => \"is already published\"), status: 422 and return if resource.published\n\n if ResourcePublisher.new(resource).publish\n render json: resource, status: 200\n else\n render json: ErrorSerializer.serialize(resource.errors), status: 422\n end\n end",
"def publish!\n release_file = build_role 'release', release\n\n timestamp.replace(release_file)\n\n timestamp_file = build_role 'timestamp', timestamp\n\n bucket.create(release_file.path_with_hash, release_file.body)\n bucket.create(timestamp_file.path, timestamp_file.body)\n end",
"def publish(event, payload = {})\n exchange.publish(MultiJson.dump(payload), routing_key: event, content_type: 'application/json')\n end",
"def set_publish\n @publish = Publish.find(params[:id])\n end",
"def set_publish\n @publish = Publish.find(params[:id])\n end",
"def save_publication\n \n init_publishable_data\n\n if publishing_workflow.is_accepted?(self, PublishingAction::SAVE)\n self.publishing_state_id = PublishingState::DRAFT.id\n save if self.respond_to?(:save)\n end\n\n end",
"def publication(topic_id, id)\n Sensit::Api::Publication.new topic_id, id, @http_client\n end",
"def publish_message(message)\n\t\t\traise Error, \"No server specified, ensure private_pub.yml was loaded properly.\" unless config[:server]\n\t\t\turi = URI.parse(config[:server])\n\n\t\t\tform = Net::HTTP::Post.new(uri.path.empty? ? '/' : uri.path)\n\t\t\tform.set_form_data(:message => message.to_json)\n\n\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\thttp.use_ssl = uri.scheme == 'https'\n\t\t\t# http.verify_mode = OpenSSL::SSL::VERIFY_NONE for when the SSL certs of the server are expired\n\t\t\thttp.start {|h| h.request(form)}\n\t\tend"
] | [
"0.71453977",
"0.7045975",
"0.7017596",
"0.6807467",
"0.6760118",
"0.6760118",
"0.6760118",
"0.6748706",
"0.67122275",
"0.66668534",
"0.66657275",
"0.666556",
"0.6642465",
"0.65153235",
"0.6425978",
"0.6425434",
"0.6381326",
"0.6377038",
"0.63627976",
"0.63621724",
"0.63498247",
"0.63481396",
"0.63481396",
"0.6312759",
"0.6233035",
"0.6231776",
"0.6231768",
"0.6222615",
"0.62216175",
"0.6212256",
"0.6205438",
"0.61976546",
"0.6195874",
"0.6171817",
"0.6171817",
"0.6148258",
"0.6044724",
"0.60178363",
"0.6016287",
"0.60124046",
"0.6010457",
"0.6009103",
"0.6005857",
"0.60045964",
"0.5989215",
"0.5979341",
"0.5976358",
"0.59739536",
"0.5957285",
"0.5948621",
"0.59404826",
"0.59380835",
"0.59333086",
"0.59324163",
"0.59272945",
"0.59148216",
"0.5902351",
"0.58983016",
"0.5897424",
"0.58921313",
"0.5887133",
"0.5880731",
"0.58774203",
"0.5869998",
"0.5860097",
"0.58586144",
"0.58454645",
"0.5844441",
"0.58424604",
"0.58394414",
"0.5838574",
"0.58309895",
"0.5824319",
"0.58139646",
"0.58086884",
"0.580176",
"0.5796616",
"0.578989",
"0.5782258",
"0.5774416",
"0.576451",
"0.5764295",
"0.5760467",
"0.5758273",
"0.5753962",
"0.573776",
"0.57322204",
"0.57312405",
"0.57276684",
"0.5723145",
"0.5720147",
"0.5709579",
"0.56802547",
"0.56773794",
"0.56772494",
"0.5670389",
"0.5670389",
"0.5668023",
"0.5658083",
"0.5656791"
] | 0.7683737 | 0 |
Creates collections Example: connection = Connection.new(' collecion = ArticleListingCollection.new(:url => '/url') connection.create(collection) | def create(object)
if(object.is_a? Collection)
uri = @uri.merge(object.url)
self.mkdir(uri)
self.proppatch(uri, object.properties)
return uri.to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_collections\n @client[URLS_COLLECTION].create\n @client[DOCUMENTS_COLLECTION].create\n\n nil\n end",
"def create_collections\n self.collections.each do |c|\n self.add_collection(c)\n end\n end",
"def create_collection(client, collection_name)\n client[collection_name].drop\n client[collection_name].create\n end",
"def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, :notice => 'Collection was successfully created.' }\n format.json { render :json => @collection, :status => :created, :location => @collection }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = Admin::Collection.new(collection_params)\n\n if @collection.save\n render json: @collection, status: :created#, location: @collection\n else\n render json: @collection.errors, status: :unprocessable_entity\n end\n end",
"def create\n collection = Collection.create(collection_params)\n\n render json: collection\n end",
"def create(title: \"\", description: \"\", private: false)\n params = {\n title: title,\n description: description,\n private: private\n }\n Unsplash::Collection.new JSON.parse(connection.post(\"/collections\", params).body)\n end",
"def create\n collection = @current_user.collections.create\n collection.set_attributes(params)\n\n if not collection.valid?\n collection_errors(collection)\n redirect_to :back and return\n else\n collection.save\n end\n redirect_to collection_path(:id => collection.id)\n end",
"def create_collection(name, template: nil, bare: nil)\n unless exists_collection? name\n create_wiki(name, @meta_wiki_name, {\n :bare => bare,\n :assert_valid_collection => false,\n :template => template\n })\n else\n true\n end\n end",
"def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to root_path, notice: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n collection = @current_user.collections.create\n collection.set_attributes(params)\n \n if not collection.valid?\n collection_errors(collection)\n redirect_to :back and return\n else\n collection.save\n end\n redirect_to collection_path(:id => collection.id)\n end",
"def create_collection(name)\n @change_collections_mutex.synchronize do\n collection = native.collection(name)\n collection.create\n collections[name] = Robe::DB::Mongo::Collection.new(self, collection)\n end\n end",
"def create\n @collection = Collection.new(collection_params)\n ensure_default_editors\n ensure_default_viewers\n authorize! :create, @collection\n flash[:notice] = 'Collection was successfully created.' if @collection.save\n respond_with(@collection)\n end",
"def create_collection\n return if collection\n\n google_session.root_collection.create_subcollection('riskcovry_uploads')\n end",
"def create\n @category_collection = CategoryCollection.new(params[:category_collection])\n @collection = @category_collection.collection\n\n respond_to do |format|\n if @category_collection.save\n flash[:notice] = 'CategoryCollection was successfully created.'\n format.html { redirect_to(@collection) }\n format.xml { render :xml => @category_collection, :status => :created, :location => @category_collection }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @category_collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = Collection.new(collection_params)\n authorize! :create, @collection\n respond_to do |format|\n if @collection.save\n format.html { redirect_to admin_collections_url, notice: \"Collection '#{@collection.title}' was successfully created.\" }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_collection\n Models::Collection.new\n end",
"def create\n @collection = Collection.new(params[:collection])\n\n # scrape each resource URL to add those fields\n @collection.collectionizes.each do |each_collectionize|\n resource_object = Resource.scrape_data(each_collectionize.resource.raw_url)\n\n each_collectionize.resource\n resource_object = Resource.scrape_data(@resource.raw_url)\n each_collectionize.resource.keywords_scraped = resource_object[:keywords_scraped] ? resource_object[:keywords_scraped] : nil\n each_collectionize.resource.description_scraped = resource_object[:description_scraped] ? resource_object[:description_scraped] : nil\n each_collectionize.resource.title_scraped = resource_object[:title_scraped] ? resource_object[:title_scraped] : nil\n each_collectionize.resource.raw_html = resource_object[:raw_html] ? resource_object[:raw_html] : nil\n end\n\n respond_to do |format|\n if @collection.save\n redirect_to @collection, notice: 'Collection was successfully created.'\n else\n render action: \"new\"\n end\n end\n end",
"def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @collection }\n\n\n else\n format.html { render action: 'new' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_collection\n @resource.make_collection\n end",
"def create\n create! do |success, failure|\n success.html { redirect_to collection_path }\n end\n end",
"def create\n # Manual load and authorize necessary because Cancan will pass in all\n # form attributes. When `permissions_attributes` are present the\n # collection is saved without a value for `has_model.`\n @collection = ::Collection.new\n authorize! :create, @collection\n # Coming from the UI, a collection type gid should always be present. Coming from the API, if a collection type gid is not specified,\n # use the default collection type (provides backward compatibility with versions < Hyrax 2.1.0)\n @collection.collection_type_gid = params[:collection_type_gid].presence || default_collection_type.gid\n @collection.id = Californica::IdGenerator.id_from_ark(collection_params[\"ark\"])\n @collection.attributes = collection_params.except(:members, :parent_id, :collection_type_gid)\n @collection.apply_depositor_metadata(current_user.user_key)\n add_members_to_collection unless batch.empty?\n @collection.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE unless @collection.discoverable?\n if @collection.save\n after_create\n else\n after_create_error\n end\n end",
"def create\n @collection = Collection.new(params[:collection])\n @collection.account_id = session[:account].id\n\n respond_to do |format|\n if @collection.save\n save_activity(@collection, \"created collection\")\n \n flash[:notice] = \"Collection #{@collection.name} was successfully created.\"\n format.html { redirect_to(dashboard_path) }\n format.xml { render :xml => @collection, :status => :created, :location => @collection }\n else\n flash[:error] = \"Collection #{@collection.name} was not created.\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = current_user.collections.new(collection_params)\n respond_to do |format|\n if @collection.save\n format.html { redirect_to account_collections_url, notice: 'Collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @collection }\n else\n format.html { render action: 'new' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = current_user.collections.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = current_user.collections.build(params[:collection])\n\n # set some default values - set collection value to the number of current collections\n if Collection.where(\"name like ?\", \"%Untitled%\").count > 0\n count = Collection.where(\"name like ?\", \"%Untitled%\").order(\"created_at DESC\").first.name.sub('Untitled-Collection-','').to_i + 1\n else\n count = 1\n end\n \n @collection.name = \"Untitled-Collection-\"+count.to_s()\n @collection.user = current_user\n @collection.challenge = false\n @collection.privacy = \"unlisted\"\n\n respond_to do |format|\n if @collection.save\n @collection.update_attributes(:name => \"Untitled-Collection-\" + @collection.id.to_s)\n format.html { redirect_to @collection }\n format.json { render :json => @collection, :status => :created, :location => @collection }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @users_collection = Users::Collection.new(users_collection_params)\n\n respond_to do |format|\n if @users_collection.save\n format.html { redirect_to @users_collection, notice: 'Collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @users_collection }\n else\n format.html { render action: 'new' }\n format.json { render json: @users_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def collection\n Rails.logger.info \"XXXXX COLLECTION NAME #{collection_hash['collection name']}\"\n\n @collection ||= CollectionCreator.find_or_create_collection(\n collection_hash['collection name'],\n collection_hash['unit name'],\n collection_hash['collection description'],\n submitter_user_key\n )\n end",
"def find_or_create_collection(collection)\n\t # collection is response from sohpify api\n\t\tc = collections.find_by_shopify_collection_id(collection.id)\n \tRails.logger.debug(\"Found existing collection (#{collection.class.name}): #{c.title}\") if c\n\t\treturn c if c\n\n\t\tRails.logger.debug(\"No collection yet for this shopify collection: #{collection.inspect}\")\n\n\t\tcollections.create(\n\t\t\ttitle: collection.title,\n\t\t\tshopify_collection_id: collection.id #[:id], # Dont know what the actual id is called\n\t\t)\n\tend",
"def make_collection\n# Dir.mkdir(file_path)\n# Created\n\n # ディレクトリなら末尾に「/」をつける。\n # (dstにもともと「/」が付いているかどうか、クライアントに依存している)\n # CarotDAV : 「/」が付いていない\n # TeamFile : 「/」が付いている\n collection!\n\n bson = @collection.find_one({:filename => file_path}) rescue nil\n\n # 0バイトのファイルを作成しディレクトリの代わりとする\n @filesystem.open(file_path, \"w\") { |f| } if !bson\n \n# @@logger.error('make_collection : ' + file_path)\n\n Created\n end",
"def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n action_message_for('new')\n if create_collection\n format.html { redirect_to redirect_target(@collection), flash: @feedback_flash }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_create_collection\n with_a_collection do\n assert_instance_of QualityCenter::Defect::Collection, @coll\n refute @coll.empty?\n end\n end",
"def create\n if params[:collection]\n @collection = Collection.new( params[:collection] )\n # Check: if user submitted an id, but it is not set, there was an error\n if params[:collection][:id] && params[:collection][:id] != @collection.id\n render_json :status => :bad_request, :messages => @collection.errors.full_messages and return\n end\n\n if @user && params[:collection][:owner_id]\n if @collection.indestructible\n render_json :status => :bad_request, :messages => \"Cannot set both: owner and indestructible\" and return\n elsif params[:collection][:owner_id] != @user.guid\n render_json :status => :bad_request, :messages => \"Owner cannot be different than logged in user.\" and return\n else\n @collection.owner = @user\n end\n else\n if params[:collection][:priv]\n render_json :status => :bad_request, :messages => \"Cannot set a collection private without an owner.\" and return\n end\n end\n else\n @collection = Collection.new\n end\n @collection.client = @client\n @collection.updated_by = @user ? @user.guid : @client.id\n\n if @collection.save\n render_json :status => :created, :entry => @collection.to_hash(@user, @client) and return\n else\n render_json :status => :bad_request, :messages => @collection.errors.full_messages and return\n end\n end",
"def make_collection\n raise NotImplementedError\n end",
"def save(collection_name, json)\n collection = get_db.create_collection(collection_name)\n collection.save(json)\n end",
"def save(collection_name, json)\n collection = get_db.create_collection(collection_name)\n collection.save(json)\n end",
"def create\n @collection = @current_user.collections.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to [@current_user, @collection],\n\t\t notice: 'Collection was successfully created.' }\n format.json { render json: [@current_user, @collection], \n\t\t status: :created, \n location: [@current_user, @collection] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, \n\t\t status: :unprocessable_entity }\n end\n end\n end",
"def create_collection(database_id:, collection_id:, name:, permissions: nil, document_security: nil)\n path = '/databases/{databaseId}/collections'\n .gsub('{databaseId}', database_id)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n collectionId: collection_id,\n name: name,\n permissions: permissions,\n documentSecurity: document_security,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::Collection\n )\n end",
"def new\n @collection = Collection.new\n end",
"def initialize(collection)\n @collection = collection\n end",
"def collections_created?\n true\n end",
"def collection(name=nil)\n if name\n @collection = db.collection(name: name)\n else\n @collection || raise('Please give a collection name for this model')\n end\n end",
"def create\n @collection = @institution.collections.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to [@collection.institution, @collection], notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def instantiate_collection(collection)\n collection.collect! { |record| instantiate_record(record) }\n end",
"def collection(collection_name)\n Collection.new(@backend, @bucket_name, @name, collection_name)\n end",
"def instantiate_collection_with_collection(collection, prefix_options = {})\n if collection.is_a?(Hash) && collection[\"type\"] == \"collection\"\n collectables = collection.values.find{|c| c.is_a?(Hash) || c.is_a?(Array) }\n collectables = [collectables].compact unless collectables.kind_of?(Array)\n instantiated_collection = WillPaginate::Collection.create(collection[\"current_page\"], collection[\"per_page\"], collection[\"total_entries\"]) do |pager|\n pager.replace instantiate_collection_without_collection(collectables, prefix_options)\n end \n else\n instantiate_collection_without_collection(collection, prefix_options)\n end \n end",
"def create\n @item_collection = ItemCollection.new(item_collection_params)\n\n respond_to do |format|\n if @item_collection.save\n format.html { redirect_to @item_collection, notice: \"La collection a été correctement créée\" }\n format.json { render :show, status: :created, location: @item_collection }\n else\n format.html { render :new }\n format.json { render json: @item_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _collection(name)\n @collections[name] ||= Dynamodb::Collection.new(\n @client,\n Lotus::Model::Adapters::Dynamodb::Coercer.new(_mapped_collection(name)),\n name,\n _identity(name),\n )\n end",
"def new_collection(query, resources = nil, &block)\n Collection.new(query, resources, &block)\n end",
"def create\n @user = User.find(params[:user_id])\n \n #@product = Product.find(params[:product_id])\n \n @collection = @user.collections.build(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to user_path(@user.id), notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = Collection.new(collection_params)\n @collection.owner = User.find_by username: session[:user]\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, success: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { redirect_to @collection, alert: 'Collection was not created.' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_collection\n Dir.mkdir @src_path\n end",
"def initialize(collection)\n @collection = collection\n end",
"def create_child_collection(name)\n return @coll_man_service.create_collection(name)\n end",
"def create\n @collection = @user.collections.new(collection_params)\n @collection.order_no = @user.collections.size\n respond_to do |format|\n if @collection.save\n format.html { redirect_to collection_documents_path(@collection), notice: 'The collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(collection, options = {})\n @collection = collection\n @options = options\n end",
"def initialize(collection, options = {})\n @collection = collection\n @options = options\n end",
"def create(collection, entity)\n entity.id = command(collection).create(entity)\n entity\n end",
"def create\n @data_collection = DataCollection.new(params[:data_collection])\n\n respond_to do |format|\n if @data_collection.save\n format.html { redirect_to @data_collection, notice: 'Data collection was successfully created.' }\n format.json { render json: @data_collection, status: :created, location: @data_collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n book = Book.find(params[:book_id])\n @collection = current_user.collections.build(book: book)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to collections_path, notice: 'Book added to your collection.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = Collection.new(params[:collection])\n @collection.user = current_user\n\n #Checks collection for parent, inherits permissions\n if ( params[:collection].include?(\"parent_id\") and params[:collection][\"parent_id\"] != \"\" )\n parent_collection = Collection.find(params[:collection][\"parent_id\"])\n inherit_collection(parent_collection)\n else\n puts \"### Collection has no parent\"\n end\n\n respond_to do |format|\n if @collection.save\n #format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.html { redirect_to collections_path, notice: 'Collection was successfully created.' }\n #format.json { render json: @collection, status: :created, location: @collection }\n format.json { render json: collections_path, status: :created, location: collections_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def collections\n respond_to?(:articleHasCollection) ? articleHasCollection : []\n end",
"def create_collection(collection_id, collection, opts = {})\n data, _status_code, _headers = create_collection_with_http_info(collection_id, collection, opts)\n data\n end",
"def create\n run_callbacks :create do\n connection.post(collection_path, encode, self.class.headers).tap do |response|\n self.id = id_from_response(response)\n load_attributes_from_response(response)\n end\n end\n end",
"def collections_coll\n settings.db['collections']\n end",
"def publish\n type = params[:type]\n collection_id = params[:id]\n\n if type==\"collect\"\n drowCollect(params)\n else\n #drowSet(params[:items], params[:info])\n drowSet(params)\n end\n \n respond_to do |format|\n #format.json { render json: @collection.to_json }\n format.json { render :json => { status: true, location: \"/collections/#{@collection.id}\", msg: \"콜렉션을 등록하였습니다.\" }.to_json }\n end\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.friendly.find(params[:id])\n end",
"def initialize\n @coll=self.class.collection\n end",
"def collections\n with_caching({}, 'collections') do\n sibling_nodes_for('collection').map {|n| Collection.new(n, authentication_options) }\n end\n end",
"def instantiate_collection(collection, prefix_options = {})\n puts collection.inspect\n unless collection.kind_of? Array\n [instantiate_record(collection, prefix_options)]\n else\n collection.collect! { |record| instantiate_record(record, prefix_options) }\n end\n end",
"def collection\n @collection ||= Collection.load(self.collection_url)\n end",
"def collection(options={})\n response = client.get(api_path, options)\n\n if response.success?\n collection = []\n\n response.body.each do |json|\n collection << new(json)\n end\n\n collection\n else\n []\n end\n end",
"def create_collection(collectionName=nil)\n if collectionName.class == String && block_given?\n @j_del.java_method(:createCollection, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(collectionName,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling create_collection(#{collectionName})\"\n end",
"def initialize\n @coll = self.class.collection\n end",
"def find_or_create_collection_ids\n return self.collection_ids if collections_created?\n if sets.blank? || parser.collection_name != 'all'\n # c = Collection.where(Bulkrax.system_identifier_field => importerexporter.unique_collection_identifier(parser.collection_name)).first\n collection = find_collection(importerexporter.unique_collection_identifier(parser.collection_name))\n self.collection_ids << collection.id if collection.present? && !self.collection_ids.include?(collection.id)\n else # All - collections should exist for all sets\n sets.each do |set|\n c = Collection.find_by(work_identifier => importerexporter.unique_collection_identifier(set.content))\n self.collection_ids << c.id if c.present? && !self.collection_ids.include?(c.id)\n end\n end\n return self.collection_ids\n end",
"def build(attrs, collection)\n collection.new(attrs)\n end",
"def collections; end",
"def add_to_collection_action (collection, item)\n\n api = Harvard::LibraryCloud::API.new\n path = 'collections/' + collection\n\n connection = Faraday.new(:url => api.get_base_uri + path) do |faraday|\n faraday.request :url_encoded\n faraday.response :logger\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n faraday.headers['X-LibraryCloud-API-Key'] = ENV[\"LC_API_KEY\"]\n end\n\n raw_response = begin\n response = connection.post do |req|\n req.body = '[{\"item_id\": \"' + item + '\"}]'\n end\n { status: response.status.to_i, headers: response.headers, body: response.body.force_encoding('utf-8') }\n rescue Errno::ECONNREFUSED, Faraday::Error => e\n raise RSolr::Error::Http.new(connection, e.response)\n end\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to '/collections'}#@collection, notice: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n @user=User.find_by name: session[:user]\n\n @collection_user = CollectionUser.new\n @collection_user.id_collection = @collection.id\n @collection_user.id_user = @user.id\n @collection_user.save\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n\n end\n end\n end",
"def set_collection\n @collection = Collection.friendly.find params[:id]\n end",
"def collections(what)\n list = []\n collections = what == 'all' ? all_collections() : local_collections()\n collections.each do |collection|\n model = collection.classify.constantize rescue nil\n next if model.nil?\n next unless model.respond_to?(:mongo_client)\n record = {'id' => collection, 'description' => I18n.t(\"helpers.label.#{collection}.tabletitle\") } \n list << [record, model_fields(collection)]\n end\n list\nend",
"def create(collection, entity)\n @mutex.synchronize do\n entity.id = command(collection).create(entity)\n entity\n end\n end",
"def create\n @user_collection = UserCollection.new(user_collection_params)\n\n respond_to do |format|\n if @user_collection.save\n format.html { redirect_to @user_collection}\n format.json { render action: 'show', status: :created, location: @user_collection }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_collection(options = {})\n self._collection = Collection.new(self, self.collection_name, options)\n end",
"def create_collection(application_id, campaign_id, body, opts = {})\n data, _status_code, _headers = create_collection_with_http_info(application_id, campaign_id, body, opts)\n data\n end",
"def save\n @item = Collection.new(collection_params)\n @collection.collections << @item\n @collection.save\n\n @collections = @collection.collections\n\n # return_to = @collection.is_root? ? collections_path : collection_path\n #\n # respond_to do |format|\n # if @item.save\n # format.html { redirect_to return_to, notice: 'Collection was successfully created.' }\n # format.json { render :show, status: :created, location: @collection }\n # else\n # format.html { render :new }\n # format.json { render json: @collection.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def instantiate_collection(collection, prefix_options = {})\r\n ## collection with timestamps\r\n if collection.size == 3\r\n value = collection.values[1]\r\n ## collection without timestamp\r\n elsif collection.size ==2\r\n value = collection.values[0]\r\n elsif collection.size == 4\r\n value = collection\r\n end\r\n if(value.is_a? Array)\r\n # Assume the value contains an array of elements to create\r\n return value.collect! { |record| instantiate_record(record, prefix_options) }\r\n elsif(value.is_a? Hash) # search results\r\n result = []\r\n result << instantiate_record(value, prefix_options)\r\n end\r\n end",
"def [](collection_name)\n Collection.new(self, collection_name)\n end",
"def create_collection(uri, mk_col)\n (parent_uri, new_name) = Http::UrlUtil.split_path(uri)\n\n # Making sure the parent exists\n begin\n parent = @tree.node_for_path(parent_uri)\n rescue Exception::NotFound => e\n raise Exception::Conflict, 'Parent node does not exist'\n end\n\n # Making sure the parent is a collection\n unless parent.is_a?(ICollection)\n fail Exception::Conflict, 'Parent node is not a collection'\n end\n\n # Making sure the child does not already exist\n begin\n parent.child(new_name)\n\n # If we got here.. it means there's already a node on that url, and we need to throw a 405\n fail Exception::MethodNotAllowed, 'The resource you tried to create already exists'\n rescue Exception::NotFound => e\n # NotFound is the expected behavior.\n end\n\n return nil unless emit('beforeBind', [uri])\n\n if parent.is_a?(IExtendedCollection)\n # If the parent is an instance of IExtendedCollection, it means that\n # we can pass the MkCol object directly as it may be able to store\n # properties immediately.\n parent.create_extended_collection(new_name, mk_col)\n else\n # If the parent is a standard ICollection, it means only\n # 'standard' collections can be created, so we should fail any\n # MKCOL operation that carries extra resourcetypes.\n if mk_col.resource_type.size > 1\n fail Exception::InvalidResourceType, 'The {DAV:}resourcetype you specified is not supported here.'\n end\n\n parent.create_directory(new_name)\n end\n\n # If there are any properties that have not been handled/stored,\n # we ask the 'propPatch' event to handle them. This will allow for\n # example the propertyStorage system to store properties upon MKCOL.\n emit('propPatch', [uri, mk_col]) if mk_col.remaining_mutations\n success = mk_col.commit\n\n unless success\n result = mk_col.result\n # generateMkCol needs the href key to exist.\n result['href'] = uri\n return result\n end\n\n @tree.mark_dirty(parent_uri)\n emit('afterBind', [uri])\n end",
"def collection\n @collection ||= PublicEarth::Db::Collection.find_by_id!(collection_id)\n end",
"def index\n @article_collections = ArticleCollection.all\n set_article_list\n end",
"def instantiate_collection(*args)\n data = args.shift\n if data.is_a?(Hash)\n # if the data has the collection name as a root element, use that to build the records\n if data.has_key?(collection_name)\n super(data[collection_name], *args) \n else\n instantiate_flattened_collection(data, *args)\n end\n else\n super(data, *args)\n end\n end"
] | [
"0.8263633",
"0.7974147",
"0.74858946",
"0.70476377",
"0.7022508",
"0.7022508",
"0.69382787",
"0.6932999",
"0.6920648",
"0.6895061",
"0.6889256",
"0.6884643",
"0.6868855",
"0.68587774",
"0.6837959",
"0.6834537",
"0.6825461",
"0.6812891",
"0.67772347",
"0.6742718",
"0.6672638",
"0.6661303",
"0.6609977",
"0.6608809",
"0.6592242",
"0.65590024",
"0.6556563",
"0.65517545",
"0.6503263",
"0.6494248",
"0.64813334",
"0.6478259",
"0.64651525",
"0.6462652",
"0.64394796",
"0.6427026",
"0.641652",
"0.641652",
"0.64056665",
"0.6391449",
"0.6385738",
"0.6385602",
"0.63779986",
"0.63594675",
"0.6336049",
"0.6327967",
"0.6300109",
"0.62938774",
"0.62860286",
"0.6285353",
"0.6267889",
"0.6264601",
"0.6246834",
"0.62450206",
"0.62358886",
"0.6235144",
"0.62064886",
"0.6202647",
"0.6202647",
"0.6179157",
"0.61700445",
"0.6130922",
"0.6106537",
"0.608667",
"0.60664654",
"0.6063247",
"0.6062736",
"0.60585326",
"0.605838",
"0.605838",
"0.605838",
"0.6055628",
"0.6050737",
"0.60491055",
"0.6042185",
"0.6041913",
"0.6034994",
"0.60292166",
"0.6020443",
"0.60149515",
"0.6014336",
"0.60083187",
"0.6001207",
"0.59944654",
"0.59944654",
"0.59944654",
"0.59944654",
"0.5981427",
"0.5975759",
"0.59687674",
"0.5957008",
"0.59504944",
"0.594874",
"0.5939156",
"0.59319943",
"0.593163",
"0.5927982",
"0.5922546",
"0.59180963",
"0.5914065",
"0.5909504"
] | 0.0 | -1 |
Create path create all folders in the given path if they do not exist. Default is articlelisting folder and the foldername used as title. Example: create_path('/folders/to/be/created/') create_path('/folders/to/be/created/', :type => "eventlisting", :title => "Testing") | def create_path(dest_path, *args)
title = nil
if(args.size > 0)then
type = args[0][:type]
title = args[0][:title]
end
if(not(type))then
type = "article-listing"
end
destination_path = "/"
dest_path.split("/").each do |folder|
if(folder != "")then
folder = folder.downcase
destination_path = destination_path + folder + "/"
if( not(exists?(destination_path)) )then
mkdir(destination_path)
proppatch(destination_path,'<v:collection-type xmlns:v="vrtx">' + type + '</v:collection-type>')
if(title)then
proppatch(destination_path,'<v:userTitle xmlns:v="vrtx">' + title.to_s + '</v:userTitle>')
end
end
end
end
return destination_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreatePath(path)\n #puts \"Creating path #{path}\"\n dirsToCreate = []\n currentPath = path\n while(!currentPath.exist?)\n\t#puts \"Need to create path #{currentPath}\"\n\tdirsToCreate.push(currentPath.AbsolutePath())\n\tcurrentPath = currentPath.Up()\n end\n dirsToCreate.reverse().each() do |dir|\n\tDir.mkdir(dir)\n end\n end",
"def creatFolder(path)\n Dir.mkdir(path) unless File.exists?(path)\n end",
"def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend",
"def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend",
"def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end",
"def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end",
"def create_dirs(path)\n FileUtils.makedirs path.split('/').reverse[1..-1].reverse.join('/')\n end",
"def create_folder (folder_path, params = \"-p\")\n \"mkdir #{params} '#{folder_path}'\"\n end",
"def mkdir path\n parent = lookup_single! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend",
"def file_create_folder(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/create_folder\", params)\n\n parse_response(response)\n end",
"def mkdir(path)\n @dirs_to_create.push(path) unless @dirs_to_create.include?(path)\n end",
"def create_directory(path)\n FileUtils.mkdir_p(path)\n path\n end",
"def create_folders_for full_path\n full_path = File.dirname(full_path)\n\n return if File.directory?(full_path) || [\"/\", \".\"].include?(full_path)\n create_folders_for(full_path)\n Dir::mkdir(full_path)\n end",
"def mkdir(path)\n @client.file_create_folder(path)\n rescue\n puts $! if @@verbose\n nil\n end",
"def mkdirs\n if (not exists?)\n parent.mkdirs\n factory.system.mkdir @path\n end\n end",
"def mkdir(path)\n Utils.traverse(path) do |dir, name|\n params = make_params :is_dir => true,\n :dir_id => dir.try(:id),\n :name => name\n\n scope.find_or_create_by(params)\n end\n end",
"def mkdir(*path)\n for dir in path\n\tDir.mkdir(expand_path(dir))\n end\n end",
"def create\n FileUtils.mkdir_p path\n end",
"def create_folder(name)\n Dir.mkdir(\"#{name}\")\nend",
"def create_dir(path, property)\n FileUtils.mkdir_p(path)\n insert_property(property, path)\n end",
"def mkdir(path)\n Dir.mkdir path unless exists? path\n end",
"def create_folder(path)\n notify \"Path:#{path}\"\n full_path = @dst_full_path + path\n r = path_transform(full_path,false)\n url = sprintf(NAS_FOLDER_CREATE_URL,CGI.escape(r[:path]),CGI.escape(r[:share]))\n notify \"create folder with #{url}\"\n result = RestClient.get(url, {:cookies => @nas_cookies})\n notify \"create result#{result.inspect}\"\n return result == \"{\\\"errmsg0\\\": \\\"OK\\\"}\"\n end",
"def mkdir(path)\n names = path.split('/')\n names.shift\n node = @root\n until names.empty?\n name = names.shift\n node.mkdir(name) unless node.children.key?(name)\n node = node.children[name]\n end\n node\n end",
"def mkdir(*args) Dir.mkdir(path, *args) end",
"def make_dir(path)\n FileUtils.mkdir_p( path )# unless File.exists?(path)\n end",
"def create_directory(path)\n clean_path = File.expand_path(path.gsub(/ /, '_'))\n Dir.mkdir(clean_path)\n clean_path\n end",
"def mkdir(path)\n FileUtils.mkdir_p(path)\n end",
"def create_directories(path)\n FileUtils.mkdir_p(path) unless Dir.exists?(path)\nend",
"def create_folder(path, opts = {})\r\n create_folder_with_http_info(path, opts)\r\n nil\r\n end",
"def create_media_path(path, type)\n folders = path.split('/')[1..-2]\n\n str = mediaize_path('', type) + '.'\n\n folders.each do |f|\n str = str + '/' + f\n\n unless $r.exists(str + '/')\n EzPub::MediaFolder.store(str + '/')\n end\n end\n end",
"def create\n create_directories\n end",
"def create_dir path\n path = with_root path\n path = fix_path path\n sftp.mkdir! path\n end",
"def create_dir path\n sftp.mkdir! path\n end",
"def create_directory path\n unless File.exists?(path)\n FileUtils::mkdir_p path\n Puppet.notice \"Created directory #{path}\"\n end\n end",
"def create_dir(path)\n FileUtils.mkdir_p(path, { mode: 0775 }) unless File.exists?(path)\n end",
"def create_folder(folder_path, name, root=\"auto\")\n to_path = File.join(folder_path, name)\n payload = {\n path: to_path,\n root: root\n }\n\n connexion = Dropbox.start(:create_folder, access_token)\n response = connexion.post do |req|\n req.url \"fileops/create_folder\"\n req.body = payload\n end\n\n response = format_response(response)\n tree_cache(response)\n end",
"def mkdir_p_folders\n [systems_folder, images_systems_folder, data_systems_folder, pages_score_folder].each do |dossier|\n FileUtils.mkdir_p(dossier)\n end\nend",
"def mkdir_p(path)\n FileUtils.mkdir_p(path)\n end",
"def folder_create(path, opts = {})\n input_json = {\n path: path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/folder_create\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def create_path path\n if path.include? 'public' # path is absolute\n FileUtils.mkdir_p(\"#{path}\")\n else # path is relative\n FileUtils.mkdir_p(\"#{PUBLIC_IMAGES_ROOT}/#{path}\")\n end\n end",
"def mkdir_p(path, options = {})\n parts = path.split(/[\\\\\\/]/)\n parts.each_index do |i|\n next if parts[i] == \"\"\n subpath = File.join(*parts[0, i + 1])\n unless File.exist?(subpath)\n FileUtils.mkdir_p(subpath)\n @cache[\"directories\"][subpath] = !!options[:install]\n end\n end\n end",
"def mk_dir(path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n end",
"def traverse_and_create path\n root = @folder_cache.values.find{|file| file.name == ROOT_FOLDER and file.parents.nil?}\n\n #DriveV3::File (actually folders)\n files = [root]\n places = path.split '/'\n places.each do |place|\n next if place == ''\n folder = folder_with_name place, files.last\n folder = create_folder(place, files.last) if folder.nil?\n files << folder\n end\n files.last\n end",
"def mkpath path\n end",
"def createIfMissing(folder_name)\n\tunless Dir.exists?(folder_name)\n\t\tputs \"Creating directory \" + folder_name\n\t\tDir.mkdir folder_name\n\tend\nend",
"def createEmptyFolder(path)\n FileUtils.remove_dir(path) if Dir.exist?(path)\n FileUtils.mkdir_p(path)\nend",
"def create_directories(*args)\n args.each do |argument|\n FileUtils.mkdir_p(argument) unless File.directory?(argument)\n end\n end",
"def create\n temp = @folder_client.create(params_create_folder)\n if temp[:status]\n flash_message(:notice,\"#{t('folder.folder')} #{t('succesfully_created')}\")\n folder_path(temp[:data].id)\n else\n flash_message(:error, 'Problema creando Carpeta')\n redirect_to root_path\n end\n @success = temp[:status]\n end",
"def google_create_folder(client)\n path = CGI::unescape(@fields[:path].to_s)\n result = client.create_folder_by_path(path)\n end",
"def makeFolder(path, logkey='')\n\tunless Dir.exist?(path)\n\t\tMcmlln::Tools.makeDir(path)\n\telse\n\t logstring = 'n-a'\n\tend\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def mkpath(path)\n FileUtils.mkpath\n end",
"def mkdir(path)\n dir = File.dirname(path)\n if !File.directory?(dir)\n FileUtils.mkdir_p(dir)\n end\n end",
"def make_folder(path:, mode: \"644\", owner: nil, group: nil )\n @output.item @i18n.t('setup.mkdir', path: path)\n FileUtils::mkdir_p path unless File::exist? path\n FileUtils.chmod mode.to_i(8), path\n FileUtils.chown owner, group, path if owner and group\n end",
"def make_dir_for_path(path)\n dir_name = File.dirname(path)\n Dir.mkdir(dir_name) if !File.directory?(dir_name)\n end",
"def create(folder)\n # Ensure API availability\n api.call(\"system\", \"greet\")\n\n api.call(files_project, \"newFolder\", { parents: true, folder: folder })\n end",
"def mkdir_p(path)\n if !Dir::exist? path\n Dir::mkdir path\n end\nend",
"def ensure_dir(path)\n directory path do\n action :create\n recursive true\n end\nend",
"def create_folder\n unless File.directory?(client.config.tmp_folder)\n FileUtils.mkdir_p(client.config.tmp_folder)\n end\n end",
"def mkpath\n @path.mkpath\n end",
"def team_folder_create(folder:, trace: false)\n dropbox_query(query: '2/team/team_folder/create', query_data: \"{\\\"name\\\":\\\"#{folder}\\\"}\", trace: trace)\n end",
"def create_if_missing \n if File.exists?(@folder)\n return\n else\n Dir.mkdir(@folder) unless \n $LOG.info(\"#{@name} : #{@folder} created\")\n end\n end",
"def mkpath(path)\n FileUtils.mkpath(abspath(path))\n exist?(path) ? dir(path) : false\n end",
"def mkdir(path)\n vprint_status(\"Creating directory #{path}\")\n if session.type == 'meterpreter'\n vprint_status(\"Meterpreter Session\")\n result = session.fs.dir.mkdir(path)\n else\n if session.platform == 'windows'\n result = cmd_exec(\"mkdir \\\"#{path}\\\"\")\n else\n result = cmd_exec(\"mkdir -p '#{path}'\")\n end\n end\n vprint_status(\"#{path} created\")\n register_dir_for_cleanup(path)\n result\n end",
"def mkdirs(folders, enter=false)\n oldCWD = FileUtils.pwd\n path = folders.join(\"/\")\n folders.delete_at(folders.size - 1)\n folders.each do |f|\n mkfolder(f, true)\n end\n FileUtils.chdir(oldCWD) unless enter\nend",
"def create_folder(name, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_post_call('/files/create-folder?name=%s&parent_id=%i' % [name, folder])\n end",
"def create_dir(path)\n is_file = File.file?(path)\n is_dir = File.directory?(path)\n\n # Check for existing file/dir, and offer to overwrite\n if is_file || is_dir\n puts \"File #{path} already exists.\" if is_file\n puts \"Directory #{path} already exists.\" if is_dir\n\n if prompt(\"WARNING: Existing #{path} will be deleted. Continue?\")\n puts \"Removing existing #{path} ...\"\n FileUtils.rm_rf(path)\n else\n puts \"Please use another directory.\"\n Process.exit\n end\n end\n\n puts \"Creating directory #{path} ...\"\n FileUtils.mkdir_p(path)\n end",
"def makeFolder(path, logkey='')\n unless File.exist?(path)\n Dir.mkdir(path)\n else\n\t logstring = 'n-a'\n\tend\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def create_directories\n directory '.', './'\n end",
"def create_folder(directory)\n\tputs 'Creating directory \\'' + directory + '\\'...'\n\tFileUtils.mkdir_p directory\n\tputs 'done'\nend",
"def create_folder(folder_name)\n IITPlaylist.new(@ole.CreateFolder(folder_name))\n end",
"def make_dirs(*args)\n FileUtils.mkdir_p(args)\nend",
"def create_directory\n remove_dir(@name) if Dir.exist?(@name)\n Dir.mkdir(@name)\n end",
"def test_create_folder\n request = CreateFolderRequest.new(path: remote_data_folder + '/TestCreateFolder')\n\n @words_api.create_folder(request)\n end",
"def create_app_folder_structure\n puts \"Create #{name} folder structure\"\n end",
"def createFolder(folderName,parentFolder)\n\tthesame = lambda { |key| hostName }\t\n client = Savon.client(wsdl: @@wsdl, ssl_verify_mode: :none, ssl_version: :TLSv1, convert_request_keys_to: :none)\n parentId = getFolder(parentFolder)\n if parentId.nil?\n print \"Parent Folder \" + parentFolder + \" doesn't exist\"\n return nil\n else\n response = client.call(:folder_create, message: {\n token: @@token,\n folderName: folderName,\n parentFolderId: parentId,\n folderTypeId: 1\n })\n doc = Nokogiri::XML.parse(response.to_xml)\n puts doc\n end\n end",
"def createProdFolder(path) \n # Create book production folder\n @book_zip_generated_folder=path+\"book_prod_folder/\"\n if (File.exists?(@book_zip_generated_folder) && File.directory?(@book_zip_generated_folder))\n puts \"Book Production folder exists\"\n else\n Dir.mkdir(@book_zip_generated_folder)\n end\n \n #Create book zip folder\n @book_prod_final_zip_folder=@book_zip_generated_folder+\"book/\"\n if (File.exists?(@book_prod_final_zip_folder) && File.directory?(@book_prod_final_zip_folder))\n puts \"Book Prod Zip folder exists\"\n else\n Dir.mkdir(@book_prod_final_zip_folder)\n end\nend",
"def mkdir!(path, attrs={}, &callback)\n wait_for(mkdir(path, attrs, &callback))\n end",
"def create_dirs_if_missing (*paths)\n\tpaths.each do |path|\n\t\tcurrpath = File.join('.', '')\n\t\tpath.split(File::SEPARATOR).each do |dir|\n\t\t\tcurrpath = File.join(currpath, dir)\n\t\t\tDir.mkdir(currpath) unless File.directory?(currpath)\n\t\tend\n\tend\nend",
"def create\n location.mkdir\n end",
"def create_folder()\n\n directory_name = \"./public/swap/imageuploader\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n\nend",
"def create_log_folder\n @log_folder = FileUtils.mkdir_p(log_folder_name).first\n end",
"def subdirs_to_create(dir, user)\n Chef::Log.debug(\"Dir to create: #{dir}, user: #{user}\")\n existing_subdirs = []\n remaining_subdirs = dir.split('/')\n remaining_subdirs.shift # get rid of '/'\n reason = ''\n \n until remaining_subdirs.empty?\n Chef::Log.debug(\"remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}\")\n path = existing_subdirs.push('/' + remaining_subdirs.shift).join\n break unless File.exist?(path)\n reason = \"Path \\'#{path}\\' exists and is a file, expecting directory.\" unless File.directory?(path)\n reason = \"Directory \\'#{path}\\' exists but is not traversable by user \\'#{user}\\'.\" unless can_traverse?(user, path)\n end\n\n new_dirs = [existing_subdirs.join]\n new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty?\n [new_dirs, reason]\n end",
"def mkdir(path, box = nil); \n\t\t@connection.mkdir(path, box)\n\tend",
"def __create_directories(key, value)\n return if value['documentation']\n\n empty_directory @output.join(key)\n create_directory_hierarchy * value.to_a.first\n end",
"def create_remote_path(remote_path, ftp)\n path_parts = []\n remote_path.split('/').each do |path_part|\n path_parts << path_part\n begin\n dir = path_parts.join('/')\n ftp.mkdir(dir) unless dir.empty?\n rescue Net::FTPPermError;\n end\n end\n end",
"def create_directory\n return if File.directory?(DIRECTORY_PATH)\n\n FileUtils.mkdir_p(DIRECTORY_PATH)\n end",
"def create(path)\n log.debug \"synapse: creating ZK path: #{path}\"\n\n # recurse if the parent node does not exist\n create File.dirname(path) unless @zk.exists? File.dirname(path)\n @zk.create(path, ignore: :node_exists)\n end",
"def mkdir(path)\n raise NotImplemented\n end",
"def subdirs_to_create(dir, user)\n Chef::Log.info(\"Dir to create: #{dir}, user: #{user}\")\n existing_subdirs = []\n remaining_subdirs = dir.split('/')\n remaining_subdirs.shift # get rid of '/'\n\n until remaining_subdirs.empty?\n Chef::Log.debug(\"remaining_subdirs: #{remaining_subdirs.inspect}, existing_subdirs: #{existing_subdirs.inspect}\")\n path = existing_subdirs.push('/' + remaining_subdirs.shift).join\n break unless File.exist?(path)\n raise \"Path #{path} exists and is a file, expecting directory.\" unless File.directory?(path)\n raise \"Directory #{path} exists but is not traversable by #{user}.\" unless can_traverse?(user, path)\n end\n\n new_dirs = [existing_subdirs.join]\n new_dirs.push(new_dirs.last + '/' + remaining_subdirs.shift) until remaining_subdirs.empty?\n new_dirs\n end",
"def mkpath(*args)\n args[0] = {} unless args[0]\n args[0] = args[0].merge(mode: 0700) unless args[0][:mode]\n FileUtils.mkpath(self.to_s, *args)\n end",
"def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end",
"def directory(dir)\n Rake.each_dir_parent(dir) do |d|\n file_create d do |t|\n mkdir_p t.name if ! File.exist?(t.name)\n end\n end\nend",
"def create_subfolders_in(folder_name)\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Start Add Menu\").fire_event(\"onfocus\")\n frm.table(:class=>/listHier lines/).row(:text=>/#{Regexp.escape(folder_name)}/).link(:text=>\"Create Folders\").click\n instantiate_class(:create_folders)\n end",
"def mkdir(path, metadata=false)\n # FIXME: does metadata mkdir even make sense?\n metadata ? @metadata_tree.mkdir(path) : @content_tree.mkdir(path)\n end",
"def makeFolder(path, logkey='')\n unless Dir.exist?(path)\n Mcmlln::Tools.makeDir(path)\n else\n logstring = 'n-a'\n end\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def make_file_dir(folder, path=\"public/temp/#{@current_user.user_name}\")\n @file_dir= \"#{path}/#{folder}\"\n FileUtils.mkdir_p(\"#{@file_dir}\")\n return @file_dir\n end",
"def createFolders(path)\n #timeutc = @update_timestamp.utc\n update_ts=@update_timestamp.to_s()\n update_ts=update_ts.split(\" +\").first\n update_ts = update_ts.gsub(\":\",\"-\")\n update_ts = update_ts.gsub(\" \",\"_\")\n\n # Create root diff folder\n difFolder=path+\"diff_folder/\"\n if !(File.directory?(difFolder))\n Dir.mkdir(difFolder)\n end\n\n # Create book diff folder\n @book_diff_folder=difFolder+update_ts+\"/\"\n if File.directory?(@book_diff_folder)\n FileUtils.rm_rf(@book_diff_folder)\n #File.rename(@book_diff_folder, @book_diff_folder+\"-OLD_\"+current_ts)\n end\n Dir.mkdir(@book_diff_folder)\n \n # Create update root folder\n @updateFolder=path+@book_full_name+\"_update/\"\n if !(File.directory?(@updateFolder))\n Dir.mkdir(@updateFolder)\n end\n \n # Create update book folder\n @book_update_folder=@updateFolder+update_ts+\"/\"\n if File.directory?(@book_update_folder)\n #File.rename(@book_update_folder, @book_update_folder+\"-OLD_\"+current_ts)\n File.rename(@book_update_folder, @updateFolder+update_ts+\"-OLD\") \n FileUtils.rm_rf(@updateFolder+update_ts+\"-OLD\")\n end \n Dir.mkdir(@book_update_folder)\nend",
"def create\n FileUtils.mkdir_p(directory) unless exist?\n end",
"def mkdir(name)\n return self if name == '.'\n name = name[1..-1] if name[0] == '/'\n newdir, *remainder = name.split('/')\n subdir = get(newdir)\n unless subdir.dir?\n result = @od.request(\"#{api_path}/children\",\n name: newdir,\n folder: {},\n '@microsoft.graph.conflictBehavior': 'rename'\n )\n subdir = OneDriveDir.new(@od, result)\n end\n remainder.any? ? subdir.mkdir(remainder.join('/')) : subdir\n end",
"def create_dirs\n if :dynamic == @build.link_type\n return if '.' == @dir_root\n dir = File.join @build.obj_root, @dir_root\n else # static\n dir = if '.' == @dir_root\n File.join @build.obj_root, 'static'\n else\n File.join @build.obj_root, @dir_root, 'static'\n end\n end\n Util.run_cmd \"mkdir -p #{dir}\"\n end"
] | [
"0.7562714",
"0.74080586",
"0.74074733",
"0.74074733",
"0.73084944",
"0.72921425",
"0.7221092",
"0.7201068",
"0.7070131",
"0.70429796",
"0.7016707",
"0.6875615",
"0.68651265",
"0.6803575",
"0.678743",
"0.6734393",
"0.67006356",
"0.6680061",
"0.66497284",
"0.6634607",
"0.66258234",
"0.6623749",
"0.6606453",
"0.6598609",
"0.6580381",
"0.6557143",
"0.6550121",
"0.65348107",
"0.6533829",
"0.6509837",
"0.6509228",
"0.65078825",
"0.65074396",
"0.64818364",
"0.64783895",
"0.6467391",
"0.641338",
"0.64098674",
"0.63835484",
"0.63583845",
"0.63525087",
"0.63481283",
"0.6342136",
"0.63358784",
"0.6335223",
"0.6250272",
"0.6234973",
"0.62286747",
"0.6221592",
"0.621533",
"0.62108374",
"0.62060595",
"0.6202642",
"0.6197326",
"0.6193372",
"0.61861193",
"0.61716974",
"0.6142109",
"0.6141417",
"0.608693",
"0.60844207",
"0.60763496",
"0.6075634",
"0.6067577",
"0.60637397",
"0.6045152",
"0.60318655",
"0.60267925",
"0.60227674",
"0.59959537",
"0.5994621",
"0.5992",
"0.5985645",
"0.5983122",
"0.5964074",
"0.595632",
"0.5952473",
"0.5950061",
"0.59421736",
"0.5934708",
"0.5924982",
"0.5919688",
"0.59092623",
"0.59070545",
"0.5895097",
"0.5895049",
"0.58918065",
"0.58890074",
"0.5885314",
"0.5872238",
"0.5868448",
"0.5850848",
"0.583351",
"0.58299905",
"0.5819913",
"0.5818631",
"0.58134526",
"0.5802863",
"0.5799595",
"0.5794544"
] | 0.6938284 | 11 |
Returns current working directory on vortex/webdav server as string. | def cwd
return cd("").to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dir\n @working_directory\n end",
"def pwd\r\n ndev.rpc.command(\"show cli directory\").text.strip\r\n end",
"def workspace_folder\n @pwd\n end",
"def current_directory\n File.expand_path @current_directory\n end",
"def working_directory\n @options[:working_directory]\n end",
"def getWorkingDir\n currDir = Dir.pwd\n dr = \"\"\n currDir.split(\"/\").each{ |entry|\n dr = dr+entry+\"/\"\n #puts dr\n if(File.directory? dr+\".hoster\")\n @workingDir = dr+\".hoster\"\n end\n }\n @workingDir\n end",
"def getWorkingDir\n if(@workingDir != nil)\n return @workingDir\n end\n currDir = Dir.pwd\n dr = \"\"\n currDir.split(\"/\").each{ |entry|\n dr = dr+entry+\"/\"\n #puts dr\n if(File.directory? dr+\".hoster\")\n @workingDir = dr+\".hoster\"\n end\n }\n @workingDir\n end",
"def working_dir\n ENV['PWD'] || Dir.pwd\n end",
"def getwd\n Dir.getwd\n end",
"def integration_cwd\n root.to_s\n end",
"def working_directory\n @link.WorkingDirectory\n end",
"def prefixed_working_directory\n return self.storage.prefixed_working_directory\n end",
"def get_local_dir\n return @resource[:local_dir]\n end",
"def cwd\n Dir.getwd\n end",
"def directory\n File.dirname @path\n end",
"def root\n Dir.pwd\n end",
"def path\n\t\tif self.instance_of?(UNIXServer)\n\t\t\t@path\n\t\telse\n\t\t\t\"\"\n\t\tend\n\tend",
"def directory\n File.dirname(@path) + '/'\n end",
"def working_dir\n return nil if !repo || !user\n return \"#{Bini.data_dir}/repos/#{user}/#{repo}\"\n end",
"def get_remote_dir\n return @resource[:remote_dir]\n end",
"def current_dir\n File.dirname(file_path)\n end",
"def current_working_directory; @rye_current_working_directory; end",
"def server_root\n return @server_root\n end",
"def root\n settings[:basedir]\n end",
"def current_dir; end",
"def base_path\n @base_path ||= server_path(File.expand_path(Dir.pwd))\n end",
"def root\n File.dirname __dir__\n end",
"def root\n File.dirname __dir__\n end",
"def root\n File.dirname __dir__\n end",
"def root; Pathname(__dir__).parent; end",
"def base_path\n Dir.pwd + \"/\"\n end",
"def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end",
"def current_path\n current_folder.path\n end",
"def full_path_to_remote_dir\n (remote_dir[0] == ?/ ? remote_dir : \"$(pwd)/#{remote_dir}\").chomp('/')\n end",
"def directory\n return @directory\n end",
"def base_dir\r\n datastore['WritableDir']\r\n end",
"def dir\n File.dirname(self.path)\n end",
"def directory_name\n return @directory_name.to_s if @directory_name\n return local_path.basename.to_s if exist?\n return name\n end",
"def to_s\n @directory\n end",
"def base_directory\n @base_directory\n end",
"def basedir\n self.class._basedir\n end",
"def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end",
"def get_root_directory\n return @@root_directory\n end",
"def get_root_directory\n return @@root_directory\n end",
"def directory\n self.path.directory\n end",
"def dir\n @dir ||= File.dirname(fullpath)\n end",
"def working_directory\n if @working_directory.nil?\n raise \"`working_directory` for the current storage provider is `nil` as the `#download` method was never called\"\n end\n return @working_directory\n end",
"def dir\n Rails.root.join(ROOT, type, name).to_s\n end",
"def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end",
"def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end",
"def directory_path\n @directory_path || Ferver::DEFAULT_FILE_SERVER_DIR_PATH\n end",
"def containing_directory\n path.dirname\n end",
"def pwd\n @local\n end",
"def work\n '/' + File.dirname(file)\n end",
"def path\n @directory.path\n end",
"def directory\r\n \t@directory.path\r\n end",
"def path()\n return ::File.join(@root, @name)\n end",
"def root\n Pathname.new(File.dirname(__dir__))\n end",
"def dir\n @directory\n end",
"def pwd\n Dir.pwd\n end",
"def work_dir; end",
"def pwd\n if session.type == \"meterpreter\"\n return session.fs.dir.getwd\n else\n if session.platform == 'windows'\n # XXX: %CD% only exists on XP and newer, figure something out for NT4\n # and 2k\n return session.shell_command_token(\"echo %CD%\")\n else\n if command_exists?(\"pwd\")\n return session.shell_command_token(\"pwd\").to_s.strip\n else\n # Result on systems without pwd command\n return session.shell_command_token(\"echo $PWD\").to_s.strip\n end\n end\n end\n end",
"def basedir\n return nil if !file\n File.dirname File.absolute_path @file\n end",
"def get_root\n return File.join('/root/path', SETTINGS[:project])\n end",
"def dirname\n return File.dirname( self.path )\n end",
"def osw_dir\n File.dirname(@osw_abs_path)\n end",
"def osw_dir\n File.dirname(@osw_abs_path)\n end",
"def enclosed_directory\n \".\"\nend",
"def current\n\t\t\t\t\treturn Pathname.new(\".\")\n\t\t\t\tend",
"def to_s\n return contentHost.locationDescriptor(baseDir)\n end",
"def dir\n url[-1, 1] == '/' ? url : File.dirname(url)\n end",
"def rails_root\n `pwd`.gsub(\"\\n\", \"\")\n end",
"def rails_root\n `pwd`.gsub(\"\\n\", \"\")\n end",
"def golang_project_dirname\n DeliveryGolang::Helpers.golang_project_dirname(node)\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def sys_root\n '/'\n end",
"def root\n find_single_directory || @droplet.root\n end",
"def working_directory(v)\n @options[:working_directory] = v\n end",
"def path\n @base\n end",
"def cwd\n File.expand_path(@options[:cwd] || \".\")\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def repo_store_root\n Pathname(Razor.config['repo_store_root'])\n end",
"def project_root\n if server_environment\n server_environment['project-root'] || ''\n end\n end",
"def cwd\n @cwd ||= begin\n exec! 'pwd'\n rescue => e\n raise e\n '/'\n end\n end",
"def basedir\n File.dirname File.absolute_path options[:file]\n end",
"def dir\n calc_dir(@basename)\n end",
"def local_path\n @io.local_path\n end",
"def dir\n # config.repos_dir + @name\n end",
"def path\r\n @pathname.to_s\r\n end",
"def construct_document_root\n return Dir.pwd + \"/public\"\n end",
"def cwd(pid)\n\tFile.readlink(\"/proc/#{pid}/cwd\")\nend",
"def base_path\n @base_path ||= Dir.pwd\n end",
"def path\n @pathname.to_s\n end",
"def cwd\n @target.is_a?(String) && File.directory?(@target) ? @target : \"./\"\n end",
"def root_dir\n superblock.root_dir\n end",
"def dir\n self\n end",
"def dir_path\n File.expand_path(File.dirname(@path))\n end",
"def dir\n File.dirname(__FILE__)\n end",
"def dir\n self.a_dir.join '/'\n end",
"def rails_root\n @path\n end"
] | [
"0.7138188",
"0.68991274",
"0.6828789",
"0.6804457",
"0.6770572",
"0.6711622",
"0.6696754",
"0.66654766",
"0.6646018",
"0.6644067",
"0.66334367",
"0.66313285",
"0.6585613",
"0.65604436",
"0.65427303",
"0.6518838",
"0.6505358",
"0.64944625",
"0.6485838",
"0.6464636",
"0.6459569",
"0.64322084",
"0.63820744",
"0.6379746",
"0.6377981",
"0.6364006",
"0.6355275",
"0.6355275",
"0.6318438",
"0.6304793",
"0.62826157",
"0.624846",
"0.6244582",
"0.6237745",
"0.6229216",
"0.62032175",
"0.6202422",
"0.6199302",
"0.6161973",
"0.6148813",
"0.6145466",
"0.613548",
"0.61335444",
"0.61335444",
"0.6131741",
"0.6126392",
"0.611729",
"0.61144054",
"0.61062086",
"0.61062086",
"0.6103878",
"0.6103395",
"0.6100793",
"0.6085998",
"0.6076697",
"0.60453564",
"0.60301256",
"0.60177577",
"0.60110295",
"0.6010496",
"0.60015947",
"0.6001178",
"0.59940267",
"0.59877634",
"0.5953683",
"0.59500486",
"0.59500486",
"0.5928807",
"0.5927806",
"0.5911746",
"0.5908444",
"0.59070563",
"0.59070563",
"0.58935535",
"0.58935165",
"0.58880174",
"0.58850455",
"0.5874459",
"0.5867867",
"0.585738",
"0.5852143",
"0.58460045",
"0.58420473",
"0.58301866",
"0.581372",
"0.58119464",
"0.580225",
"0.57943374",
"0.5794165",
"0.57917786",
"0.5791115",
"0.57852525",
"0.57824063",
"0.57810605",
"0.57678807",
"0.57666636",
"0.57661694",
"0.57622015",
"0.57568103",
"0.5753229"
] | 0.6785824 | 4 |
Create a new article of type htmlarticle: plain html file with introduction stored as a webdav property. | def initialize(options={})
options.each{|k,v|send("#{k}=",v)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_article_content(article_id, data)\n create_content(Voog::API::Contents::ParentKind::Article, article_id, data)\n end",
"def html_file\n new_or_existing_file 'hello.html', 'text/html', 1.megabyte\n end",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path = File.join(@dir, new_file)\n File.open(@path, 'w') do |file|\n file.write initial_content\n end\n\n new_file\n end",
"def generate_article(post)\n create_partials true, read_data\n header = read_file(get_header_path(true))\n footer = read_file(get_footer_path(true))\n data = { post: post, sub_file: true, header: header, footer: footer }\n write_data data, 'data'\n system \"erb _templates/_article.html.erb > articles/#{post.filename}\"\n end",
"def new\n @article = Thumbwebs::Article.new(:title =>'', :synopsis => '',:body =>'', :published =>'',\n :rights =>'', :channel_id => '')\n\n respond_to do |format|\n format.html {render :template => \"new\"}# new.html.erb\n format.xml { render :xml => @article, :root => 'thumbwebs:articles' }\n end\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n # Format HTML representa o padrão de projeto Template, que redefine partes do algoritmo\n # sem mudar a estrutura do codigo.\n format.html { redirect_to @article, notice: 'Artigo criado com sucesso.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_article(api_id, headline, subheading, body_text, category_id, img_src, publication_date)\n # Do not take articles older than 10 days ago\n return false if publication_date < 10.days.ago\n\n new_article = Article.new(api_id: api_id, headline: headline,\n subheading: subheading, body_text: body_text,\n category_id: category_id, img_src: img_src,\n created_at: Time.now, updated_at: Time.now,\n publication_date: publication_date)\n new_article.save ? true : false\n end",
"def create_locally\n write_file(@description, @news_name)\n write_file(@poster_file, @poster_name)\n end",
"def create_article(topic_id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"topics/#{topic_id}/articles\",options)\n if response['success']\n return response['results']['article']\n else\n return response\n end\n end",
"def create(p)\n puts \"Creating page #{p}\"\n Dir.mkdir p unless File.exists? p\n Content.new(\"#{@dir}\", @extension).page p\n end",
"def new\n\t \t@article = Article.new\n\t end",
"def new_personal_article(api_id, headline, subheading, body_text, category_id, img_src, publication_date, reader_id)\n # Do not take articles older than 10 days ago\n return false if publication_date < 10.days.ago\n\n # Do not take if user has already read the article\n return false if Reader.find(reader_id).orders.find_by(article_url: api_id)\n\n new_personal_article = Reader.find(reader_id)\n .articles\n .new(api_id: api_id, headline: headline,\n subheading: subheading, body_text: body_text,\n category_id: category_id, img_src: img_src,\n created_at: Time.now, updated_at: Time.now,\n publication_date: publication_date)\n new_personal_article.save ? true : false\n end",
"def create\n @article = Article.new(article_params)\n @article.view = 0\n @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def interpret(d)\n article = Article.new\n article.title = !d['webTitle'].nil? ? d['webTitle'] : 'n/a'\n article.source = @source\n article.pub_date = !d['webPublicationDate'].nil? ? (DateTime.parse d['webPublicationDate']) : nil\n article.author = !d['fields']['byline'].nil? ? d['fields']['byline'] : 'n/a'\n article.link = !d['webUrl'].nil? ? d['webUrl'] : 'n/a'\n\n re = /<(\"[^\"]*\"|'[^']*'|[^'\">])*>/\n summary = !d['fields']['body'].nil? ? d['fields']['body'] : 'n/a'\n summary.gsub!(re, '')\n article.summary = summary[0...126] + '...'\n\n article.image = !d['fields']['thumbnail'].nil? ? d['fields']['thumbnail'] : 'n/a'\n article\n end",
"def create\n\t\t# pull out form data\n\t\t@article = Article.new(article_params)\n\t\t\t\n\t\t\t# redundant. input hash has same structure as output\n\t\t\t#title: params[:article][:title],\n\t\t\t#body: params[:article][:title])\n\t\t\n\t\t# alternate syntax\n\t\t#@article.title = params[:article][:title]\n\t\t#@article.body = params[:article][:body]\n\t\t\n\t\t@article.save\n\n\t\t#flash\n\t\tflash.notice = \"Article '#{@article.title}' Created!\"\n\n\t\t# don't want a view template for this action, redirect to show\n\t\tredirect_to article_path(@article)\n\tend",
"def new\n @article = Article.new()\n end",
"def create\n # @article = Article.new\n # @article.title = params[:article][:title] # pull title from the request and insert into article object\n # @article.body = params[:article][:body] # pull body from the request and insert into article object\n \n @article = Article.new(article_params)\n \n @article.save\n\n flash.notice = \"Article '#{@article.title}' created!\"\n redirect_to article_path(@article)\n end",
"def xhtml_file\n new_or_existing_file 'hello.xhtml', 'application/xhtml+xml', 1.megabyte\n end",
"def create_object(dir_name, content, attributes, identifier)\n # Determine path\n path = dir_name + (identifier == '/' ? '/index.html' : identifier[0..-2] + '.html')\n parent_path = File.dirname(path)\n\n # Notify\n Nanoc3::NotificationCenter.post(:file_created, path)\n\n # Write item\n FileUtils.mkdir_p(parent_path)\n File.open(path, 'w') do |io|\n io.write(YAML.dump(attributes.stringify_keys) + \"\\n\")\n io.write(\"---\\n\")\n io.write(content)\n end\n end",
"def create\n @article = Article.new\n @article.title = params[:title]\n @article.description = params[:description]\n @article.save\n redirect_to article_path(@article)\n end",
"def interpret(i)\n article = Article.new\n article.title = !i.title.nil? ? i.title : 'n/a'\n article.source = @source\n article.pub_date = !i.pubDate.nil? ? i.pubDate : nil\n\n name = !i.source.nil? ? i.source.content : 'n/a'\n article.author = (name[0..2] == 'By ') ? name.slice(3..name.size) : name\n\n article.link = !i.link.nil? ? i.link : 'n/a'\n article.summary = !i.description.nil? ? i.description : 'n/a'\n article.image = (!i.enclosure.nil? && i.enclosure.type == 'image/jpeg') ? i.enclosure.url : 'n/a' \n article\n end",
"def main\n blog = File.read(FILE_PATH).gsub(/-----[\\r\\n|\\n|\\r]EXTENDED BODY:/, '<!-- more -->')\n articles = split_to_articles(blog)\n headers_and_bodies = split_to_headers_and_bodies(articles)\n\n headers_and_bodies.each do |header_and_body|\n header_and_body[:header] = convert_header(header_and_body[:header])\n header_and_body[:body] = ReverseMarkdown.convert header_and_body[:body]\n end\n\n create_md_file(headers_and_bodies)\nend",
"def new\n @article ||= Article.new(:locale => I18n.default_locale)\n @title = t('label.article.creating')\n\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article }\n end\n end",
"def interpret(d)\n article = Article.new\n\n if d['headline'] != []\n if !d['headline']['main'].nil?\n article.title = d['headline']['main']\n elsif !d['headline']['name'].nil?\n article.title = d['headline']['name']\n end\n end\n if article.title.nil?\n article.title = 'n/a'\n end\n\n article.source = @source\n article.pub_date = !(d['pub_date'].eql? '') ? (DateTime.parse d['pub_date']) : nil\n\n byline = (d['byline'] != []) ? d['byline']['original'] : 'n/a'\n article.author = (byline[0..2] == 'By ') ? byline[3..byline.size] : byline\n\n article.link = !(d['web_url'].eql? '') ? d['web_url'] : 'n/a'\n article.summary = !(d['snippet'].eql? '') ? d['snippet'] : 'n/a'\n\n # an article may contain several images\n image = []\n if d['multimedia'] != []\n url = 'http://www.nytimes.com/'\n img = d['multimedia']\n img.each { |i| (i['type'] == 'image') ? image << (url + i['url']) : 'n/a' }\n else\n image << 'n/a'\n end\n article.image = image.join(',')\n\n article\n end",
"def create(filename, text); end",
"def new\n\n @article = Article.new # Create a new article and assign it to an instance variable, article\n\n end",
"def article options = {}\n Diffbot::APIClient::Article.new self, options\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to(@article, :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to(@article, :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to(@article, :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug \"request: #{params.inspect}\"\n vari = params.require(:article).permit(:text, :title)\n logger.debug \"SOLO LOS ARTICLES : #{vari}\"\n @article = Article.new(vari)\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n logger.debug \"New article: #{@article.attributes.inspect}\"\n logger.debug \"Article should be valid: #{@article.valid?}\"\n end",
"def create\n @article = Article.new(params[:article])\n @article.user_id = current_user.id\n @title = t('label.article.creating')\n\n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to(article_path(:id =>@article.id)) }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to(@article) }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\t\tdeny_access_unless(admin? || editor?)\n\t\t\n\t\topts = {}\n\t\topts[:as]=[]\n\t\t\n\t\topts = {}\n\t\topts = { :as => :editor } if editor?\n\t\topts = { :as => :admin } if admin?\n\t\t\n respond_to do |format|\n if @article.save(opts)\n\t\t\t\t@article.update_attributes(params[:article], opts)\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n @article.category = \"Rails\"\n respond_to do |format|\n if @article.save\n format.html { redirect_to(admin_article_path(@article), :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def newPost(title, contents, categories = nil, keywords = nil, created = nil, publish = 1, user = nil, password = nil)\n article = MetaWeblogStructs::Article.new\n article.title = title\n article.description = contents\n article.categories = categories if categories\n article.mt_keywords = keywords if keywords\n article.dateCreated = created if created\n\n @client.newPostStruct(@blog.blogid, user, password, article, publish)\n end",
"def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n \n format.html { redirect_to article_url(@article) }\n format.xml do\n headers[\"Location\"] = article_url(@article)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors.to_xml }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to [:edit, @article], notice: 'Nouvel article créé.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def private_article_create(article, opts = {})\n data, _status_code, _headers = private_article_create_with_http_info(article, opts)\n return data\n end",
"def create \n epub = params[:file]\n logger.debug(epub.inspect)\n new_book = Book.new()\n new_book.epub = epub\n new_book.user_id = current_user.id\n new_book.import_metadata\n\n if new_book.title.blank? && new_book.epub\n new_book.title = File.basename(new_book.epub.url, '.epub')\n end\n \n new_book.save\n\n respond_to do |format| \n format.html { render :nothing => true }\n format.xml { render :xml => books_url, :status => :created, :location => books_url }\n end\n end",
"def create_from(entry:, blog_id:, content_bucket:)\n article = Article.new(\n blogId: blog_id,\n url: entry.url,\n title: entry.title,\n author: entry.author,\n publishedAt: entry.published,\n excerpt: entry.summary || '',\n tags: entry.categories\n )\n\n begin\n Article.write_content_to_s3(content_bucket, article.get_content_key, entry.content)\n article.image = Article.get_main_image(article.url)\n rescue Aws::S3::Errors::ServiceError => e\n p \" -- FAILED TO STORE CONTENT: #{e.message}\"\n raise\n rescue StandardError => e\n p \" -- FAILED TO CREATE NEW ARTICLE: #{e.message}\"\n raise\n end\n\n article.contentUri = \"#{article.get_content_key}.md\"\n article.published = true\n article.save!\n\n article\n end",
"def path_to_article(path)\n article = Article.new(self)\n article.parse(fetch(path))\n return article\n end",
"def create(name,content='')\n @name=name\n @content=content\n end",
"def create(name,content='')\n @name=name\n @content=content\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def new\n @title = \"Creating New Content\"\n @content_node = ContentNode.new\n end",
"def article(id)\n url = index.knowledgeManagement.articles.article\n url = url(url, ArticleID: id)\n decorate(get(url).body) { |o| autodefine(o) }\n end",
"def create\n\n #render plain: params[:article].inspect # Uncomment to display input parameters from web page\n\n #return # It is not an error to return early from a method\n\n @article = Article.new(article_params) # Create a new instance of Article initialized with values from the web form\n\n if @article.save # Save the new article to the database. Returns true if successful, false otherwise.\n flash[:notice] = 'New article was successfully created'\n # Re-direct to the show method to display the newly-created article. If we don't re-direct, Ruby will attempt to\n # return a response view based on the method name (create.html.erb).\n redirect_to article_path(@article) # article_path is a helper method; the \"article\" prefix is found by rake routes\n else # Article was not successfully saved\n render 'new' # Re-renders the New Article view (new.htlm.erb), but this time, error messages will be added\n end\n\n end",
"def new\n @article = Article.new\n end",
"def create\n @article = article_create(params[:article])\n @article.save\n respond_with(@article)\n end",
"def new_article\n self.model = store._articles.buffer # creates buffer that assigns to a model which we change latetly\n page._new_article = true \n end",
"def add_article(magazine, title)\n Article.new(magazine, title)\n\n end",
"def create\r\n\r\n article = Article.new(article_params)\r\n article.user = current_user\r\n\r\n if article.save\r\n\r\n addTopic(topic_params[:topic_name].to_s,article)\r\n addTagsAndhandleTagCount(article)\r\n\r\n addAttachment(article,false)\r\n\r\n redirect_to articles_path\r\n else\r\n $text = article_params[:text];\r\n $tags = article_params[:Tags];\r\n $topic = topic_params[:topic_name];\r\n render 'articles/new'\r\n end\r\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 create_object(dir_name, content, attributes, identifier, params={})\n # Check for periods\n if (@config.nil? || !@config[:allow_periods_in_identifiers]) && identifier.include?('.')\n raise RuntimeError,\n \"Attempted to create an object in #{dir_name} with identifier #{identifier} containing a period, but allow_periods_in_identifiers is not enabled in the site configuration. (Enabling allow_periods_in_identifiers may cause the site to break, though.)\"\n end\n\n # Get filenames\n ext = params[:extension] || '.html'\n meta_filename = dir_name + (identifier == '/' ? '/index.yaml' : identifier[0..-2] + '.yaml')\n content_filename = dir_name + (identifier == '/' ? '/index.html' : identifier[0..-2] + ext)\n parent_path = File.dirname(meta_filename)\n\n # Notify\n Nanoc::NotificationCenter.post(:file_created, meta_filename)\n Nanoc::NotificationCenter.post(:file_created, content_filename)\n\n # Create files\n FileUtils.mkdir_p(parent_path)\n File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.stringify_keys)) }\n File.open(content_filename, 'w') { |io| io.write(content) }\n end",
"def new\n @article = Article.new #el metodo \"new\" es para crear un nuevo objeto vacio, es decir\n\t\t# Los nuevos objetos se pueden instanciar con atributos vacíos o preestablecidos\n\t\t# pero aun sin ser grabados. En ambos casos la validación de los atributos se da con los \n\t\t# nombres de las columnas de las tablas generadas.\n\t\t# en este caso esta accion \"new\" es nuestro articulo vacío\n @categories = Category.all\n @articles = Article.published\n end",
"def create_html_document(directory, filename, locale, deliverable_json = nil)\n version = Settings[:CURRENT_VERSION]\n \n # Why not let CouchDB create the ID? Because it actually affects performance.\n # Also, if we define the ID, then we can find the document without a view.\n id = \"#{Settings[:APP_NAME]}.#{filename}.#{locale}.#{version}\"\n \n # Create a Nokogiri document from the XML file on disk\n content_doc = Nokogiri::XML(open(\"#{directory}/#{filename}\")){|config| config.noent }\n content_doc.remove_namespaces!\n \n # Figure out the title for the document, pick it up from the\n # Dublin Core metadata, if available, otherwise grab it from the\n # title element.\n title=content_doc.xpath(\"/html/head/meta[@name = 'DC.Title']/@content\")\n title ||= content_doc.xpath('/html/head/title').inner_text().to_s\n title = title.to_s rescue nil\n \n # Add facets.\n # The rescue nil is there because if something happens, we're okay\n # with no value.\n app_area = content_doc.xpath(\"/html/head/meta[@name = 'app_area']/@content\").to_s rescue nil \n role = content_doc.xpath(\"/html/head/meta[@name = 'role']/@content\").to_s rescue nil\n edition = content_doc.xpath(\"/html/head/meta[@name = 'edition']/@content\").to_s rescue nil\n topic_type = content_doc.xpath(\"/html/head/meta[@name = 'topic_type']/@content\").to_s rescue nil\n technology = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.Technology']/@content\").to_s rescue nil\n\n # Add deliverable title and other metadata\n deliverable_title = deliverable_json['title'] rescue nil\n deliverable_type = deliverable_json['type'] rescue nil\n deliverable_pdf_name = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.RelatedPDF']/@content\").to_s rescue nil\n deliverable_pdf_url = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.RelatedPDFURL']/@content\").to_s rescue nil\n deliverable_home = deliverable_json['default_topic'] rescue nil\n \n #scrub the table of data we don't need\n body_content = content_doc.xpath('/html/body/*')\n scrub_table(body_content)\n body_content = body_content.to_html\n \n\n # Create a document to add the searchable text. We have to create a\n # new document, we can't reuse content_doc. That's because nodesets\n # are queries of documents. In other words, if you do a\n # nodeset.xpath('//xpath').remove, it removes that xpath from all\n # nodesets created from a document, not just nodeset.\n search_doc = content_doc.dup\n \n # Remove items we don't want returned in the search snippet\n search_content=search_doc.xpath('/html/body')\n search_content.xpath('/html/body//table[contains(@class, \"permTable\") or contains(@class, \"editionTable\")]').remove\n search_content.xpath('/html/body//*[contains(@class, \"breadcrumb\")]').remove\n search_content.xpath('/html/body/h1[1]').remove\n \n # Encode the search_content, replacing unsafe codepoints. This allows search to find items like >\n coder = HTMLEntities.new\n search_content=coder.encode(search_content.children().inner_text()).strip\n \n #remove weird new line characters\n search_content = search_content.gsub(\"\\n\", ' ')\n search_content = HTMLEntities.new.decode(search_content)\n \n #doc fields to create, if needed\n newDoc = {\n '_id' => id,\n :name => filename,\n :locale => locale,\n :version => version,\n :title => title,\n :body_content => body_content,\n :app_area => app_area,\n :role => role,\n :edition => edition,\n :topic_type => topic_type,\n :technology => technology,\n :deliverable_title => deliverable_title,\n :deliverable_type => deliverable_type,\n :deliverable_pdf_name => deliverable_pdf_name,\n :deliverable_pdf_url => deliverable_pdf_url,\n :deliverable_home => deliverable_home,\n :search_content => search_content}\n \n #This content hash accounts for changes necessary from the deliverable metadata as well as changes to the xml document in general\n newDoc[:content_hash] = generateCheckSum(newDoc.inspect)\n \n #Dynamic content added after the hash\n newDoc[:updated] = Time.now.to_date.iso8601\n \n #upsert the document\n upsert_doc_via_checksum(@db, newDoc, [:locale, :version], @id_checksum_hash[id], @log)\n \n return id\n end",
"def new\n\t\t@article = Article.new\n\n\tend",
"def new\n\t\tdeny_access_unless(admin? || editor?)\n @article = Article.new\n\t\t@article.published = false\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @article }\n end\n end",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n @article = Article.new\n \n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to articles_public_url, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_empty_page(p)\n cli.say 'Creating project page'\n FileUtils.mkdir_p(browse_file(p, '.'))\n %w[favicon-32.png style.css].each do |i|\n FileUtils.cp(template_file(i), browse_file(p, i))\n end\n write_file(p, 'about.html') do\n build_from_template('about.html', citation: MiGA::MiGA.CITATION)\n end\n end",
"def create\n\t\t#para mostrar lo que se esta enviando se hace con\n\t\t#render plain: params[:article].inspect\n\t\t\n\t\t#para hacer debug basta con escribir:\n\t\t#debugger \n\t\t#en la linea necesaria\n\t\t#para pasar a la siguiente linea se escribe n \n\t\t#y para terminar se ejecuta ctr+d\n\n\t\t@article = Article.new(article_params)\n\t\t#se añade usuario segun el usuario logueado\n\t\t@article.user = current_user\n\n\t\t#@article.save\n\t\t#redirecciona a la pagina del articulo cuando lo \n\t\t#halla creado.\n\t\t#consultando \"rake routes\" sabemos cual es la ruta\n\t\t#y se le pasa el articulo que se cargo en la \n\t\t#variable global.\n\t\t\n\t\tif @article.save\n\t\t\t#da el mensaje que se guardo bien\n\t\t\tflash[:success] = \"Se guardó correctamente!\"\n\t\t\tredirect_to article_path(@article)\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\n\tend",
"def create\r\n html=params[:page][:html]\r\n @page = Page.new(params[:page])\r\n respond_to do |format|\r\n if @page.save\r\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\r\n format.json { render json: @page, status: :created, location: @page }\r\n target = \"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\"\r\n if !File.directory?(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}/images\")\r\n end\r\n File.open(target, \"w+\") do |f|\r\n f.write(html)\r\n end\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @page.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n # render plain: params[:article].inspect\n @article = Article.new(article_params)\n\n if @article.save\n flash[:notice] = \"Article created successfully.\"\n redirect_to @article\n else\n flash[:notice] = \"Error creating Article.\"\n end\n end",
"def createArqArticles (articles, arq)\n\t\tRails.logger.info \"aqui no articles\"\n\t\tRails.logger.info articles\n\t\tFile.open(arq, 'w') do | f2 |\n \t\t\tf2.puts articles\n \t\tend\n\tend",
"def create_item(content, attributes, identifier)\n # Get filenames\n base_path = 'content' + (identifier == '/' ? '/index' : identifier[0..-2])\n meta_filename = base_path + '.yaml'\n content_filename = base_path + '.html'\n\n # Notify\n Nanoc3::NotificationCenter.post(:file_created, meta_filename)\n Nanoc3::NotificationCenter.post(:file_created, content_filename)\n\n # Create files\n FileUtils.mkdir_p(File.dirname(meta_filename))\n File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.stringify_keys)) }\n File.open(content_filename, 'w') { |io| io.write(content) }\n end",
"def store_article_text(entry)\n puts \"storing data\"\n if(entry.link != '#')\n \n # Get html from link\n response = Net::HTTP.get(URI.parse(entry.link))\n if(response.downcase.include?(\"<h1>moved permanently</h1>\"))\n html = Nokogiri::HTML(response, nil, 'UTF-8')\n tag = html.css(\"a\")\n link = tag.attribute('href')\n response = Net::HTTP.get(URI.parse(link))\n end\n \n # Use readability to find text from html\n data = Readability::Document.new(response || \"\")\n if(data.content == nil || data.content.length < 15)\n new_data = entry.description\n else\n new_data = data.content.gsub(/<[^>]+>/,\"\").squeeze(\" \").strip.toutf8 || \"\"\n end\n \n else\n new_data = entry.description\n end\n \n # Save data if new\n if(!entry.data || entry.data != new_data)\n entry.data = new_data\n return true\n end\n return false\nend",
"def test_add_an_article\n $ie.link(:text, /Add an Article/).click\n $ie.text_field(:id, \"content_title\").set(\"a new article\")\n $ie.text_field(:id, \"content_teaser\").set(\"the new article teaser\")\n $ie.text_field(:id, \"content_body\").set(\"the new article body\")\n $ie.form(:id, \"new_article\").submit\n $ie.link(:text, \"a new article\").click\n assert $ie.h1(:text, \"a new article\").exist?\n assert $ie.p(:text, \"the new article teaser\").exist?\n assert $ie.div(:id, \"content_body\").text.include?(\"the new article body\")\n end",
"def create\n @article = Article.new(params[:article])\n flash[:notice] = t('actions.create.success', Article.model_name.human) if @article.save\n respond_with(@article)\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def create\n # @article = Article.new(params[:article])\n @article = Article.new(:title => params[:article][:title], :body => params[:article][:body])\n\n @article = Article.new(params[:article])\n\n # @article.title = params[:article][:title]\n # @article.body = params[:article][:body]\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.author = chive_user\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_blank_post(path, title)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n layout: post\n title: #{title}\n published: false\n ---\n\n EOS\n end\nend",
"def faq_new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def initialize(file_path)\n\n @title, @abstract = \"\", \"\"\n @metadata = {}\n\n if file_path\n\n @file_path = File.expand_path(file_path)\n\n # Read the YAML front matter.\n convertible = OpenStruct.new.extend(Jekyll::Convertible)\n @metadata = convertible.read_yaml(File.dirname(@file_path), File.basename(@file_path))\n\n # Scrub the YAML out of the markdown.\n markdown = File.read(@file_path).sub(/---(.|\\n)*---/, '')\n\n # Parse the cleaned markdown.\n renderer = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n document = Nokogiri::HTML::fragment(renderer.render(markdown))\n\n # Set the title.\n header = document.at_css('h1')\n @title = header.text\n header.remove\n\n # Set the abstract.\n @abstract = document.to_s.strip\n\n end\n\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n setup_images()\n format.html { redirect_to @article, notice: '記事を作成しました。' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end"
] | [
"0.61438954",
"0.61188227",
"0.6017308",
"0.5986638",
"0.58510935",
"0.5845582",
"0.5822948",
"0.5802643",
"0.57804376",
"0.56814253",
"0.5671804",
"0.5663171",
"0.5656578",
"0.56535244",
"0.56494075",
"0.5631068",
"0.56215477",
"0.5618898",
"0.5594392",
"0.5587019",
"0.5571454",
"0.5546001",
"0.55362517",
"0.5524657",
"0.5519996",
"0.5466103",
"0.54532814",
"0.5437164",
"0.5437164",
"0.5437164",
"0.543704",
"0.54342866",
"0.5431222",
"0.5427798",
"0.5404478",
"0.5403718",
"0.54002255",
"0.53968394",
"0.5385216",
"0.538407",
"0.5375815",
"0.53752095",
"0.5373834",
"0.53649426",
"0.53649426",
"0.5356436",
"0.5356436",
"0.5354164",
"0.5349593",
"0.5348199",
"0.53432685",
"0.5335253",
"0.5325394",
"0.5307577",
"0.5305934",
"0.529987",
"0.5292868",
"0.5283125",
"0.5282661",
"0.5275245",
"0.52663934",
"0.52543175",
"0.52543175",
"0.52543175",
"0.52543175",
"0.52543175",
"0.52487063",
"0.5237053",
"0.52370274",
"0.523169",
"0.5209118",
"0.5201579",
"0.519651",
"0.519455",
"0.5189995",
"0.51808566",
"0.5174724",
"0.51717854",
"0.51717854",
"0.51717854",
"0.51717854",
"0.51717854",
"0.51717854",
"0.51717854",
"0.51717854",
"0.5171192",
"0.51691484",
"0.5167691",
"0.51574683",
"0.5157263",
"0.51564425",
"0.5149219",
"0.51486534",
"0.51461583",
"0.51461583",
"0.51461583",
"0.51461583",
"0.51461583",
"0.51461583",
"0.51461583",
"0.51461583"
] | 0.0 | -1 |
Create a new article of type htmlarticle: plain html file with introduction stored as a webdav property. | def initialize(options={})
options.each{|k,v|send("#{k}=",v)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_article_content(article_id, data)\n create_content(Voog::API::Contents::ParentKind::Article, article_id, data)\n end",
"def html_file\n new_or_existing_file 'hello.html', 'text/html', 1.megabyte\n end",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path = File.join(@dir, new_file)\n File.open(@path, 'w') do |file|\n file.write initial_content\n end\n\n new_file\n end",
"def generate_article(post)\n create_partials true, read_data\n header = read_file(get_header_path(true))\n footer = read_file(get_footer_path(true))\n data = { post: post, sub_file: true, header: header, footer: footer }\n write_data data, 'data'\n system \"erb _templates/_article.html.erb > articles/#{post.filename}\"\n end",
"def new\n @article = Thumbwebs::Article.new(:title =>'', :synopsis => '',:body =>'', :published =>'',\n :rights =>'', :channel_id => '')\n\n respond_to do |format|\n format.html {render :template => \"new\"}# new.html.erb\n format.xml { render :xml => @article, :root => 'thumbwebs:articles' }\n end\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n # Format HTML representa o padrão de projeto Template, que redefine partes do algoritmo\n # sem mudar a estrutura do codigo.\n format.html { redirect_to @article, notice: 'Artigo criado com sucesso.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_article(api_id, headline, subheading, body_text, category_id, img_src, publication_date)\n # Do not take articles older than 10 days ago\n return false if publication_date < 10.days.ago\n\n new_article = Article.new(api_id: api_id, headline: headline,\n subheading: subheading, body_text: body_text,\n category_id: category_id, img_src: img_src,\n created_at: Time.now, updated_at: Time.now,\n publication_date: publication_date)\n new_article.save ? true : false\n end",
"def create_locally\n write_file(@description, @news_name)\n write_file(@poster_file, @poster_name)\n end",
"def create_article(topic_id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"topics/#{topic_id}/articles\",options)\n if response['success']\n return response['results']['article']\n else\n return response\n end\n end",
"def create(p)\n puts \"Creating page #{p}\"\n Dir.mkdir p unless File.exists? p\n Content.new(\"#{@dir}\", @extension).page p\n end",
"def new\n\t \t@article = Article.new\n\t end",
"def new_personal_article(api_id, headline, subheading, body_text, category_id, img_src, publication_date, reader_id)\n # Do not take articles older than 10 days ago\n return false if publication_date < 10.days.ago\n\n # Do not take if user has already read the article\n return false if Reader.find(reader_id).orders.find_by(article_url: api_id)\n\n new_personal_article = Reader.find(reader_id)\n .articles\n .new(api_id: api_id, headline: headline,\n subheading: subheading, body_text: body_text,\n category_id: category_id, img_src: img_src,\n created_at: Time.now, updated_at: Time.now,\n publication_date: publication_date)\n new_personal_article.save ? true : false\n end",
"def create\n @article = Article.new(article_params)\n @article.view = 0\n @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def interpret(d)\n article = Article.new\n article.title = !d['webTitle'].nil? ? d['webTitle'] : 'n/a'\n article.source = @source\n article.pub_date = !d['webPublicationDate'].nil? ? (DateTime.parse d['webPublicationDate']) : nil\n article.author = !d['fields']['byline'].nil? ? d['fields']['byline'] : 'n/a'\n article.link = !d['webUrl'].nil? ? d['webUrl'] : 'n/a'\n\n re = /<(\"[^\"]*\"|'[^']*'|[^'\">])*>/\n summary = !d['fields']['body'].nil? ? d['fields']['body'] : 'n/a'\n summary.gsub!(re, '')\n article.summary = summary[0...126] + '...'\n\n article.image = !d['fields']['thumbnail'].nil? ? d['fields']['thumbnail'] : 'n/a'\n article\n end",
"def create\n\t\t# pull out form data\n\t\t@article = Article.new(article_params)\n\t\t\t\n\t\t\t# redundant. input hash has same structure as output\n\t\t\t#title: params[:article][:title],\n\t\t\t#body: params[:article][:title])\n\t\t\n\t\t# alternate syntax\n\t\t#@article.title = params[:article][:title]\n\t\t#@article.body = params[:article][:body]\n\t\t\n\t\t@article.save\n\n\t\t#flash\n\t\tflash.notice = \"Article '#{@article.title}' Created!\"\n\n\t\t# don't want a view template for this action, redirect to show\n\t\tredirect_to article_path(@article)\n\tend",
"def new\n @article = Article.new()\n end",
"def create\n # @article = Article.new\n # @article.title = params[:article][:title] # pull title from the request and insert into article object\n # @article.body = params[:article][:body] # pull body from the request and insert into article object\n \n @article = Article.new(article_params)\n \n @article.save\n\n flash.notice = \"Article '#{@article.title}' created!\"\n redirect_to article_path(@article)\n end",
"def xhtml_file\n new_or_existing_file 'hello.xhtml', 'application/xhtml+xml', 1.megabyte\n end",
"def create_object(dir_name, content, attributes, identifier)\n # Determine path\n path = dir_name + (identifier == '/' ? '/index.html' : identifier[0..-2] + '.html')\n parent_path = File.dirname(path)\n\n # Notify\n Nanoc3::NotificationCenter.post(:file_created, path)\n\n # Write item\n FileUtils.mkdir_p(parent_path)\n File.open(path, 'w') do |io|\n io.write(YAML.dump(attributes.stringify_keys) + \"\\n\")\n io.write(\"---\\n\")\n io.write(content)\n end\n end",
"def create\n @article = Article.new\n @article.title = params[:title]\n @article.description = params[:description]\n @article.save\n redirect_to article_path(@article)\n end",
"def interpret(i)\n article = Article.new\n article.title = !i.title.nil? ? i.title : 'n/a'\n article.source = @source\n article.pub_date = !i.pubDate.nil? ? i.pubDate : nil\n\n name = !i.source.nil? ? i.source.content : 'n/a'\n article.author = (name[0..2] == 'By ') ? name.slice(3..name.size) : name\n\n article.link = !i.link.nil? ? i.link : 'n/a'\n article.summary = !i.description.nil? ? i.description : 'n/a'\n article.image = (!i.enclosure.nil? && i.enclosure.type == 'image/jpeg') ? i.enclosure.url : 'n/a' \n article\n end",
"def main\n blog = File.read(FILE_PATH).gsub(/-----[\\r\\n|\\n|\\r]EXTENDED BODY:/, '<!-- more -->')\n articles = split_to_articles(blog)\n headers_and_bodies = split_to_headers_and_bodies(articles)\n\n headers_and_bodies.each do |header_and_body|\n header_and_body[:header] = convert_header(header_and_body[:header])\n header_and_body[:body] = ReverseMarkdown.convert header_and_body[:body]\n end\n\n create_md_file(headers_and_bodies)\nend",
"def new\n @article ||= Article.new(:locale => I18n.default_locale)\n @title = t('label.article.creating')\n\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article }\n end\n end",
"def interpret(d)\n article = Article.new\n\n if d['headline'] != []\n if !d['headline']['main'].nil?\n article.title = d['headline']['main']\n elsif !d['headline']['name'].nil?\n article.title = d['headline']['name']\n end\n end\n if article.title.nil?\n article.title = 'n/a'\n end\n\n article.source = @source\n article.pub_date = !(d['pub_date'].eql? '') ? (DateTime.parse d['pub_date']) : nil\n\n byline = (d['byline'] != []) ? d['byline']['original'] : 'n/a'\n article.author = (byline[0..2] == 'By ') ? byline[3..byline.size] : byline\n\n article.link = !(d['web_url'].eql? '') ? d['web_url'] : 'n/a'\n article.summary = !(d['snippet'].eql? '') ? d['snippet'] : 'n/a'\n\n # an article may contain several images\n image = []\n if d['multimedia'] != []\n url = 'http://www.nytimes.com/'\n img = d['multimedia']\n img.each { |i| (i['type'] == 'image') ? image << (url + i['url']) : 'n/a' }\n else\n image << 'n/a'\n end\n article.image = image.join(',')\n\n article\n end",
"def create(filename, text); end",
"def new\n\n @article = Article.new # Create a new article and assign it to an instance variable, article\n\n end",
"def article options = {}\n Diffbot::APIClient::Article.new self, options\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to(@article, :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to(@article, :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to(@article, :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug \"request: #{params.inspect}\"\n vari = params.require(:article).permit(:text, :title)\n logger.debug \"SOLO LOS ARTICLES : #{vari}\"\n @article = Article.new(vari)\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n logger.debug \"New article: #{@article.attributes.inspect}\"\n logger.debug \"Article should be valid: #{@article.valid?}\"\n end",
"def create\n @article = Article.new(params[:article])\n @article.user_id = current_user.id\n @title = t('label.article.creating')\n\n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to(article_path(:id =>@article.id)) }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to(@article) }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\t\tdeny_access_unless(admin? || editor?)\n\t\t\n\t\topts = {}\n\t\topts[:as]=[]\n\t\t\n\t\topts = {}\n\t\topts = { :as => :editor } if editor?\n\t\topts = { :as => :admin } if admin?\n\t\t\n respond_to do |format|\n if @article.save(opts)\n\t\t\t\t@article.update_attributes(params[:article], opts)\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def newPost(title, contents, categories = nil, keywords = nil, created = nil, publish = 1, user = nil, password = nil)\n article = MetaWeblogStructs::Article.new\n article.title = title\n article.description = contents\n article.categories = categories if categories\n article.mt_keywords = keywords if keywords\n article.dateCreated = created if created\n\n @client.newPostStruct(@blog.blogid, user, password, article, publish)\n end",
"def create\n @article = Article.new(params[:article])\n @article.category = \"Rails\"\n respond_to do |format|\n if @article.save\n format.html { redirect_to(admin_article_path(@article), :notice => 'Article was successfully created.') }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n \n format.html { redirect_to article_url(@article) }\n format.xml do\n headers[\"Location\"] = article_url(@article)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors.to_xml }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to [:edit, @article], notice: 'Nouvel article créé.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def private_article_create(article, opts = {})\n data, _status_code, _headers = private_article_create_with_http_info(article, opts)\n return data\n end",
"def create_from(entry:, blog_id:, content_bucket:)\n article = Article.new(\n blogId: blog_id,\n url: entry.url,\n title: entry.title,\n author: entry.author,\n publishedAt: entry.published,\n excerpt: entry.summary || '',\n tags: entry.categories\n )\n\n begin\n Article.write_content_to_s3(content_bucket, article.get_content_key, entry.content)\n article.image = Article.get_main_image(article.url)\n rescue Aws::S3::Errors::ServiceError => e\n p \" -- FAILED TO STORE CONTENT: #{e.message}\"\n raise\n rescue StandardError => e\n p \" -- FAILED TO CREATE NEW ARTICLE: #{e.message}\"\n raise\n end\n\n article.contentUri = \"#{article.get_content_key}.md\"\n article.published = true\n article.save!\n\n article\n end",
"def create \n epub = params[:file]\n logger.debug(epub.inspect)\n new_book = Book.new()\n new_book.epub = epub\n new_book.user_id = current_user.id\n new_book.import_metadata\n\n if new_book.title.blank? && new_book.epub\n new_book.title = File.basename(new_book.epub.url, '.epub')\n end\n \n new_book.save\n\n respond_to do |format| \n format.html { render :nothing => true }\n format.xml { render :xml => books_url, :status => :created, :location => books_url }\n end\n end",
"def path_to_article(path)\n article = Article.new(self)\n article.parse(fetch(path))\n return article\n end",
"def create(name,content='')\n @name=name\n @content=content\n end",
"def create(name,content='')\n @name=name\n @content=content\n end",
"def new\n @title = \"Creating New Content\"\n @content_node = ContentNode.new\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create_document(name, content = \"\")\n File.open(File.join(data_path, name), \"w\") do |file|\n file.write(content)\n end\n end",
"def create\n\n #render plain: params[:article].inspect # Uncomment to display input parameters from web page\n\n #return # It is not an error to return early from a method\n\n @article = Article.new(article_params) # Create a new instance of Article initialized with values from the web form\n\n if @article.save # Save the new article to the database. Returns true if successful, false otherwise.\n flash[:notice] = 'New article was successfully created'\n # Re-direct to the show method to display the newly-created article. If we don't re-direct, Ruby will attempt to\n # return a response view based on the method name (create.html.erb).\n redirect_to article_path(@article) # article_path is a helper method; the \"article\" prefix is found by rake routes\n else # Article was not successfully saved\n render 'new' # Re-renders the New Article view (new.htlm.erb), but this time, error messages will be added\n end\n\n end",
"def article(id)\n url = index.knowledgeManagement.articles.article\n url = url(url, ArticleID: id)\n decorate(get(url).body) { |o| autodefine(o) }\n end",
"def new\n @article = Article.new\n end",
"def create\n @article = article_create(params[:article])\n @article.save\n respond_with(@article)\n end",
"def new_article\n self.model = store._articles.buffer # creates buffer that assigns to a model which we change latetly\n page._new_article = true \n end",
"def add_article(magazine, title)\n Article.new(magazine, title)\n\n end",
"def create\r\n\r\n article = Article.new(article_params)\r\n article.user = current_user\r\n\r\n if article.save\r\n\r\n addTopic(topic_params[:topic_name].to_s,article)\r\n addTagsAndhandleTagCount(article)\r\n\r\n addAttachment(article,false)\r\n\r\n redirect_to articles_path\r\n else\r\n $text = article_params[:text];\r\n $tags = article_params[:Tags];\r\n $topic = topic_params[:topic_name];\r\n render 'articles/new'\r\n end\r\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 create_object(dir_name, content, attributes, identifier, params={})\n # Check for periods\n if (@config.nil? || !@config[:allow_periods_in_identifiers]) && identifier.include?('.')\n raise RuntimeError,\n \"Attempted to create an object in #{dir_name} with identifier #{identifier} containing a period, but allow_periods_in_identifiers is not enabled in the site configuration. (Enabling allow_periods_in_identifiers may cause the site to break, though.)\"\n end\n\n # Get filenames\n ext = params[:extension] || '.html'\n meta_filename = dir_name + (identifier == '/' ? '/index.yaml' : identifier[0..-2] + '.yaml')\n content_filename = dir_name + (identifier == '/' ? '/index.html' : identifier[0..-2] + ext)\n parent_path = File.dirname(meta_filename)\n\n # Notify\n Nanoc::NotificationCenter.post(:file_created, meta_filename)\n Nanoc::NotificationCenter.post(:file_created, content_filename)\n\n # Create files\n FileUtils.mkdir_p(parent_path)\n File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.stringify_keys)) }\n File.open(content_filename, 'w') { |io| io.write(content) }\n end",
"def new\n @article = Article.new #el metodo \"new\" es para crear un nuevo objeto vacio, es decir\n\t\t# Los nuevos objetos se pueden instanciar con atributos vacíos o preestablecidos\n\t\t# pero aun sin ser grabados. En ambos casos la validación de los atributos se da con los \n\t\t# nombres de las columnas de las tablas generadas.\n\t\t# en este caso esta accion \"new\" es nuestro articulo vacío\n @categories = Category.all\n @articles = Article.published\n end",
"def create_html_document(directory, filename, locale, deliverable_json = nil)\n version = Settings[:CURRENT_VERSION]\n \n # Why not let CouchDB create the ID? Because it actually affects performance.\n # Also, if we define the ID, then we can find the document without a view.\n id = \"#{Settings[:APP_NAME]}.#{filename}.#{locale}.#{version}\"\n \n # Create a Nokogiri document from the XML file on disk\n content_doc = Nokogiri::XML(open(\"#{directory}/#{filename}\")){|config| config.noent }\n content_doc.remove_namespaces!\n \n # Figure out the title for the document, pick it up from the\n # Dublin Core metadata, if available, otherwise grab it from the\n # title element.\n title=content_doc.xpath(\"/html/head/meta[@name = 'DC.Title']/@content\")\n title ||= content_doc.xpath('/html/head/title').inner_text().to_s\n title = title.to_s rescue nil\n \n # Add facets.\n # The rescue nil is there because if something happens, we're okay\n # with no value.\n app_area = content_doc.xpath(\"/html/head/meta[@name = 'app_area']/@content\").to_s rescue nil \n role = content_doc.xpath(\"/html/head/meta[@name = 'role']/@content\").to_s rescue nil\n edition = content_doc.xpath(\"/html/head/meta[@name = 'edition']/@content\").to_s rescue nil\n topic_type = content_doc.xpath(\"/html/head/meta[@name = 'topic_type']/@content\").to_s rescue nil\n technology = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.Technology']/@content\").to_s rescue nil\n\n # Add deliverable title and other metadata\n deliverable_title = deliverable_json['title'] rescue nil\n deliverable_type = deliverable_json['type'] rescue nil\n deliverable_pdf_name = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.RelatedPDF']/@content\").to_s rescue nil\n deliverable_pdf_url = content_doc.xpath(\"/html/head/meta[@name = 'SFDC.RelatedPDFURL']/@content\").to_s rescue nil\n deliverable_home = deliverable_json['default_topic'] rescue nil\n \n #scrub the table of data we don't need\n body_content = content_doc.xpath('/html/body/*')\n scrub_table(body_content)\n body_content = body_content.to_html\n \n\n # Create a document to add the searchable text. We have to create a\n # new document, we can't reuse content_doc. That's because nodesets\n # are queries of documents. In other words, if you do a\n # nodeset.xpath('//xpath').remove, it removes that xpath from all\n # nodesets created from a document, not just nodeset.\n search_doc = content_doc.dup\n \n # Remove items we don't want returned in the search snippet\n search_content=search_doc.xpath('/html/body')\n search_content.xpath('/html/body//table[contains(@class, \"permTable\") or contains(@class, \"editionTable\")]').remove\n search_content.xpath('/html/body//*[contains(@class, \"breadcrumb\")]').remove\n search_content.xpath('/html/body/h1[1]').remove\n \n # Encode the search_content, replacing unsafe codepoints. This allows search to find items like >\n coder = HTMLEntities.new\n search_content=coder.encode(search_content.children().inner_text()).strip\n \n #remove weird new line characters\n search_content = search_content.gsub(\"\\n\", ' ')\n search_content = HTMLEntities.new.decode(search_content)\n \n #doc fields to create, if needed\n newDoc = {\n '_id' => id,\n :name => filename,\n :locale => locale,\n :version => version,\n :title => title,\n :body_content => body_content,\n :app_area => app_area,\n :role => role,\n :edition => edition,\n :topic_type => topic_type,\n :technology => technology,\n :deliverable_title => deliverable_title,\n :deliverable_type => deliverable_type,\n :deliverable_pdf_name => deliverable_pdf_name,\n :deliverable_pdf_url => deliverable_pdf_url,\n :deliverable_home => deliverable_home,\n :search_content => search_content}\n \n #This content hash accounts for changes necessary from the deliverable metadata as well as changes to the xml document in general\n newDoc[:content_hash] = generateCheckSum(newDoc.inspect)\n \n #Dynamic content added after the hash\n newDoc[:updated] = Time.now.to_date.iso8601\n \n #upsert the document\n upsert_doc_via_checksum(@db, newDoc, [:locale, :version], @id_checksum_hash[id], @log)\n \n return id\n end",
"def new\n\t\t@article = Article.new\n\n\tend",
"def new\n\t\tdeny_access_unless(admin? || editor?)\n @article = Article.new\n\t\t@article.published = false\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @article }\n end\n end",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n\t\t@article = Article.new\n\tend",
"def new\n @article = Article.new\n \n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to articles_public_url, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_empty_page(p)\n cli.say 'Creating project page'\n FileUtils.mkdir_p(browse_file(p, '.'))\n %w[favicon-32.png style.css].each do |i|\n FileUtils.cp(template_file(i), browse_file(p, i))\n end\n write_file(p, 'about.html') do\n build_from_template('about.html', citation: MiGA::MiGA.CITATION)\n end\n end",
"def create\n\t\t#para mostrar lo que se esta enviando se hace con\n\t\t#render plain: params[:article].inspect\n\t\t\n\t\t#para hacer debug basta con escribir:\n\t\t#debugger \n\t\t#en la linea necesaria\n\t\t#para pasar a la siguiente linea se escribe n \n\t\t#y para terminar se ejecuta ctr+d\n\n\t\t@article = Article.new(article_params)\n\t\t#se añade usuario segun el usuario logueado\n\t\t@article.user = current_user\n\n\t\t#@article.save\n\t\t#redirecciona a la pagina del articulo cuando lo \n\t\t#halla creado.\n\t\t#consultando \"rake routes\" sabemos cual es la ruta\n\t\t#y se le pasa el articulo que se cargo en la \n\t\t#variable global.\n\t\t\n\t\tif @article.save\n\t\t\t#da el mensaje que se guardo bien\n\t\t\tflash[:success] = \"Se guardó correctamente!\"\n\t\t\tredirect_to article_path(@article)\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\n\tend",
"def create\r\n html=params[:page][:html]\r\n @page = Page.new(params[:page])\r\n respond_to do |format|\r\n if @page.save\r\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\r\n format.json { render json: @page, status: :created, location: @page }\r\n target = \"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\"\r\n if !File.directory?(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}\")\r\n Dir.mkdir(\"#{Rails.public_path}/#{@page.project_id}/images\")\r\n end\r\n File.open(target, \"w+\") do |f|\r\n f.write(html)\r\n end\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @page.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n # render plain: params[:article].inspect\n @article = Article.new(article_params)\n\n if @article.save\n flash[:notice] = \"Article created successfully.\"\n redirect_to @article\n else\n flash[:notice] = \"Error creating Article.\"\n end\n end",
"def createArqArticles (articles, arq)\n\t\tRails.logger.info \"aqui no articles\"\n\t\tRails.logger.info articles\n\t\tFile.open(arq, 'w') do | f2 |\n \t\t\tf2.puts articles\n \t\tend\n\tend",
"def create_item(content, attributes, identifier)\n # Get filenames\n base_path = 'content' + (identifier == '/' ? '/index' : identifier[0..-2])\n meta_filename = base_path + '.yaml'\n content_filename = base_path + '.html'\n\n # Notify\n Nanoc3::NotificationCenter.post(:file_created, meta_filename)\n Nanoc3::NotificationCenter.post(:file_created, content_filename)\n\n # Create files\n FileUtils.mkdir_p(File.dirname(meta_filename))\n File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.stringify_keys)) }\n File.open(content_filename, 'w') { |io| io.write(content) }\n end",
"def store_article_text(entry)\n puts \"storing data\"\n if(entry.link != '#')\n \n # Get html from link\n response = Net::HTTP.get(URI.parse(entry.link))\n if(response.downcase.include?(\"<h1>moved permanently</h1>\"))\n html = Nokogiri::HTML(response, nil, 'UTF-8')\n tag = html.css(\"a\")\n link = tag.attribute('href')\n response = Net::HTTP.get(URI.parse(link))\n end\n \n # Use readability to find text from html\n data = Readability::Document.new(response || \"\")\n if(data.content == nil || data.content.length < 15)\n new_data = entry.description\n else\n new_data = data.content.gsub(/<[^>]+>/,\"\").squeeze(\" \").strip.toutf8 || \"\"\n end\n \n else\n new_data = entry.description\n end\n \n # Save data if new\n if(!entry.data || entry.data != new_data)\n entry.data = new_data\n return true\n end\n return false\nend",
"def test_add_an_article\n $ie.link(:text, /Add an Article/).click\n $ie.text_field(:id, \"content_title\").set(\"a new article\")\n $ie.text_field(:id, \"content_teaser\").set(\"the new article teaser\")\n $ie.text_field(:id, \"content_body\").set(\"the new article body\")\n $ie.form(:id, \"new_article\").submit\n $ie.link(:text, \"a new article\").click\n assert $ie.h1(:text, \"a new article\").exist?\n assert $ie.p(:text, \"the new article teaser\").exist?\n assert $ie.div(:id, \"content_body\").text.include?(\"the new article body\")\n end",
"def create\n @article = Article.new(params[:article])\n flash[:notice] = t('actions.create.success', Article.model_name.human) if @article.save\n respond_with(@article)\n end",
"def create\n # @article = Article.new(params[:article])\n @article = Article.new(:title => params[:article][:title], :body => params[:article][:body])\n\n @article = Article.new(params[:article])\n\n # @article.title = params[:article][:title]\n # @article.body = params[:article][:body]\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.author = chive_user\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_blank_post(path, title)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n layout: post\n title: #{title}\n published: false\n ---\n\n EOS\n end\nend",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def faq_new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n setup_images()\n format.html { redirect_to @article, notice: '記事を作成しました。' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(file_path)\n\n @title, @abstract = \"\", \"\"\n @metadata = {}\n\n if file_path\n\n @file_path = File.expand_path(file_path)\n\n # Read the YAML front matter.\n convertible = OpenStruct.new.extend(Jekyll::Convertible)\n @metadata = convertible.read_yaml(File.dirname(@file_path), File.basename(@file_path))\n\n # Scrub the YAML out of the markdown.\n markdown = File.read(@file_path).sub(/---(.|\\n)*---/, '')\n\n # Parse the cleaned markdown.\n renderer = Redcarpet::Markdown.new(Redcarpet::Render::HTML)\n document = Nokogiri::HTML::fragment(renderer.render(markdown))\n\n # Set the title.\n header = document.at_css('h1')\n @title = header.text\n header.remove\n\n # Set the abstract.\n @abstract = document.to_s.strip\n\n end\n\n end",
"def create_blank_post(path, title)\n # Create the directories to this path if needed\n FileUtils.mkpath(File.dirname(path))\n\n # Write the template to the file\n File.open(path, \"w\") do |f|\n f << <<-EOS.gsub(/^ /, '')\n ---\n layout: post\n title: #{title}\n published: false\n categories:\n ---\n\n EOS\n end\nend",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end",
"def new\n @article = Article.new\n end"
] | [
"0.61457694",
"0.6118787",
"0.60177785",
"0.5986372",
"0.5852359",
"0.5848839",
"0.58251137",
"0.5803525",
"0.5782668",
"0.5684459",
"0.56733954",
"0.56634355",
"0.5658143",
"0.5653994",
"0.5652204",
"0.56326747",
"0.5624557",
"0.5617976",
"0.5595722",
"0.5589551",
"0.5570983",
"0.554612",
"0.5537994",
"0.5524855",
"0.5521631",
"0.54675347",
"0.54542327",
"0.54399514",
"0.54399514",
"0.54399514",
"0.5439707",
"0.54370725",
"0.54338354",
"0.54303384",
"0.540813",
"0.5406873",
"0.5403057",
"0.5399484",
"0.53879726",
"0.5386301",
"0.5376609",
"0.5376425",
"0.5372452",
"0.53689003",
"0.53689003",
"0.53573054",
"0.5357221",
"0.5357221",
"0.5351395",
"0.53490996",
"0.5344642",
"0.5338186",
"0.53267694",
"0.53096133",
"0.53082144",
"0.5301394",
"0.5294229",
"0.52849674",
"0.5283912",
"0.5276651",
"0.5267782",
"0.52556515",
"0.52556515",
"0.52556515",
"0.52556515",
"0.52556515",
"0.524995",
"0.5240018",
"0.5237559",
"0.5234546",
"0.521242",
"0.52039295",
"0.5196992",
"0.51959574",
"0.5190185",
"0.5181464",
"0.5177455",
"0.517371",
"0.51723534",
"0.51723534",
"0.51723534",
"0.51723534",
"0.51723534",
"0.51723534",
"0.51723534",
"0.51723534",
"0.5171078",
"0.51689357",
"0.5159543",
"0.51587164",
"0.5157617",
"0.51517695",
"0.51491594",
"0.5147443",
"0.51472163",
"0.51472163",
"0.51472163",
"0.51472163",
"0.51472163",
"0.51472163",
"0.51472163"
] | 0.0 | -1 |
TODO: Samme kode som i article... Bruk arv! | def content
content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' +
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' +
'<html xmlns="http://www.w3.org/1999/xhtml"><head><title>' + title + '</title>' +
' <link href="http://www.uio.no/profil/kupu/kupucontentstyles.css" type="text/css" rel="stylesheet"/>' +
'</head><body>'
if(body)
content += body
end
content += '</body></html>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def articles\n\n end",
"def title\n article.title\n end",
"def interpret(i)\n article = Article.new\n article.title = !i.title.nil? ? i.title : 'n/a'\n article.source = @source\n article.pub_date = !i.pubDate.nil? ? i.pubDate : nil\n\n name = !i.source.nil? ? i.source.content : 'n/a'\n article.author = (name[0..2] == 'By ') ? name.slice(3..name.size) : name\n\n article.link = !i.link.nil? ? i.link : 'n/a'\n article.summary = !i.description.nil? ? i.description : 'n/a'\n article.image = (!i.enclosure.nil? && i.enclosure.type == 'image/jpeg') ? i.enclosure.url : 'n/a' \n article\n end",
"def read_article\n\torig_article\n\tdancing_man\n\tin_chrome\n\tgo_back\n\tgo_back\nend",
"def entity content\n end",
"def private; end",
"def list_articles()\n\nend",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def render_article(p)\n r = \"\"\n r += p.authors.map {|a| a.abbreviated_name}.joined_by_comma_and_and + \". \"\n r += p.title.detex.titlecase + \". \"\n\n r += text_for_field(\"Journal\", p, :postfix => \", \").detex\n r += text_for_field(\"Volume\", p)\n r += text_for_field(\"Number\", p, :prefix => \"(\", :postfix => \")\").detex\n\n # TODO simplify this complex nested if structures that result from the conversion\n # from BibDesks abbrv template\n if field(p,\"Pages\") then # <$fields.Pages?>\n if field(p,\"Volume\") then # <$fields.Volume?>\n r += \":\"\n else # <?$fields.Volume?>\n if field(p,\"Number\") then #<$fields.Number?>\n r+= \":\"\n else # <?$fields.Number?>\n r += \"page \"\n end # </$fields.Number?>\n end # </$fields.Volume?>\n\n r += text_for_field(\"Pages\", p, :postfix => \", \").detex # <$fields.Pages/>,\n else # <?$fields.Pages?>\n if field(p,\"Volume\") then #<$fields.Volume?>\n r += \", \"\n else # <?$fields.Volume?>\n if field(p,\"Number\") then #<$fields.Number?>\n r += \", \"\n end #</$fields.Number?>\n end\n end #</$fields.Pages?>\n\n r += month_for_field(\"Month\", p, :postfix => \" \").detex\n r += text_for_field(\"Year\", p, :postfix => \". \").detex\n r += text_for_field(\"Note\", p, :postfix => \". \")\n return r\nend",
"def schubert; end",
"def zuruecksetzen()\n end",
"def suivre; end",
"def interest_in_article(article)\n \n end",
"def publication_place\n end",
"def headline; end",
"def articles\n @articles\n end",
"def entity content\r\n # Don't care\r\n end",
"def title\n \"#{self.article_revision.title}\"\n end",
"def extract_related_content\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def content\n end",
"def content\n end",
"def content\n end",
"def show\n #@article = Article.find(params[:id])\n #se sutituira por el uso de methodo set_article\n end",
"def author; end",
"def fetch_articles(url)\n req = open(url)\n response_body = req.read\n articles_json = JSON.parse(response_body)\n articles_array = articles_json[\"articles\"]\n last_articles = []\n articles_array.each do |a|\n article = Article.find_by(title:a[\"title\"])\n unless article #check if article is already in the database\n author = a[\"author\"].blank? ? a[\"source\"][\"name\"] : a[\"author\"]\n article = Article.new(title:a[\"title\"],author: author,source:a[\"source\"][\"name\"],url:a[\"url\"],date:a[\"publishedAt\"],content:a[\"content\"] || \"no content available\",image:a[\"urlToImage\"],description:a[\"description\"])\n article.publication_list.add(a[\"source\"][\"id\"])\n # extractor = Phrasie::Extractor.new\n # tagging = extractor.phrases(a[\"content\"],occur:1)\n # tags = tagging.each{|p|p[0]}\n # article.theme_list.add(tags)\n article.save!\n end\n end\nend",
"def process_article(art)\n this_pub = {}\n \n # if not table of figure or equation remove reference\n # a.zip(b) zipped lists\n both = art.xpath('//xref/@ref-type').zip(art.xpath('//xref'))\n both.each do |tag,elem| \n if tag.text != 'table' || tag.text != 'fig' || tag.text != 'fn' || tag.text != 'sec' || tag.text != 'disp-formula'\n elem.remove\n end\n end\n\n jrn_meta = art / \"article/front/journal-meta\"\n this_pub[:jrn_id] = (jrn_meta / \"journal-id[journal-id-type='nlm-ta']\").text\n art_meta = art / \"/article/front/article-meta\"\n\n this_pub[:pmid] = (art_meta / \"article-id[pub-id-type='pmid']\").text\n\n this_pub[:pmcid] = (art_meta / \"article-id[pub-id-type='pmc']\").text\n# this_pub[:doi] = (art_meta / \"article-id[pub-id-type='doi']\").text\n\n # title\n title_node = (art_meta / \"title-group/article-title\")\n \n # SDB Note 8/2016\n # Turns out that some of the article titles include footnotes or super/subscripts which occurred at the end of a title, \n # which are represented by embedded tags (e.g. <fn> or something like that),and calling .text on the title node was \n # including those (and messing stuff up in the process).\n # We thought that we only needed to worry about tags at the end of titles, and so for trec CDS 2016 we just used the first child node and called it good.\n # This turned out to be insufficient- in the latest PMC release, there are titles with italic text (cf. PMC1079931),\n # and the approach below fails in these cases. \n # TODO: a more robust title-parsing algorithm\n \n if title_node.children.size > 1\n this_pub[:title] = title_node.children.first.text.strip\n else\n this_pub[:title] = title_node.text.strip\n end\n\n # pub_year\n # if ppub, use that; else use collection\n ppub = (art_meta / \"pub-date[pub-type='ppub']/year\").text\n epub = (art_meta / \"pub-date[pub-type='epub']/year\").text\n year = nil\n if ppub.strip.length > 0\n year = ppub.strip\n else\n year = epub.strip\n end\n this_pub[:year] = year \n\n # abstract (if present)\n abst_node = art_meta / \"abstract\"\n \n this_pub[:abstract] = {}\n if abst_node.length == 0\n this_pub[:abstract][:full] = \"\"\n elsif (abst_node / \"sec\").size > 0 # structured abstract (inc. section headings)\n abstract_full = \"\" \n # go through each section, and get the parts out in some kind of order\n (abst_node / \"sec\").each do |s|\n # rm furmulas\n s.search('//p/disp-formula').each do |node|\n node.remove\n end \n s.search('//p/inline-formula').each do |node|\n node.remove\n end\n s.search('//title/disp-formula').each do |node|\n node.remove\n end\n s.search('//title/inline-formula').each do |node|\n node.remove\n end\n ti = (s / \"title\").text.strip\n body = (s / \"p\").text.strip\n # clean leftovers of xref\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\[-*\\]/, \"\")\n ti = ti.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\(-*\\)/, \"\")\n ti = ti.gsub(/\\[,*\\]/, \"\")\n abstract_full << ti << \"\\n\"\n abstract_full << body << \"\\n\"\n end\n this_pub[:abstract][:full] = abstract_full.strip\n end\n if (abst_node / \"p\").size > 0 # unstructured abstract\n abstract_full = this_pub[:abstract][:full].to_s\n (abst_node / \"p\").each do |s|\n s.search('//disp-formula').each do |node|\n node.remove\n end\n s.search('//inline-formula').each do |node|\n node.remove\n end\n abs = s.text.strip\n abs = abs.gsub(/\\[-*\\]/, \"\")\n abs = abs.gsub(/\\(,*\\)/, \"\")\n abs = abs.gsub(/\\(-*\\)/, \"\")\n abs = abs.gsub(/\\[,*\\]/, \"\")\n abstract_full << abs << \"\\n\"\n end\n this_pub[:abstract][:full] = abstract_full\n else\n STDERR.puts \"Other format found: \" + (art_meta / \"article-id[pub-id-type='pmc']\").text\n this_pub[:abstract][:full] = \"\"\n end\n \n # now do body- similar deal\n this_pub[:body] = {}\n body_node = art / \"/article/body\"\n \n if (body_node / \"sec\").size > 0\n body_full = \"\"\n (body_node / \"sec\").each do |s|\n # rm xref\n # rm furmulas\n s.search('//p/disp-formula').each do |node|\n node.remove\n end\n s.search('//p/inline-formula').each do |node|\n node.remove\n end\n s.search('//title/disp-formula').each do |node|\n node.remove\n end\n s.search('//title/inline-formula').each do |node|\n node.remove\n end\n s.search('//fig/caption/p/disp-formula').each do |node|\n node.remove\n end\n s.search('//fig/caption/p/inline-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/p/disp-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/p/inline-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/fn/disp-formula').each do |node|\n node.remove\n end\n s.search('//table-wrap/table-wrap-foot/fn/inline-formula').each do |node|\n node.remove\n end\n\n ti = (s / \"title\").text.strip\n body = (s / \"p\").text.strip\n fig_cap = (s / \"fig/caption/p\").text.strip\n tbl_cap = (s / \"table-wrap/table-wrap-foot/p\").text.strip\n tbl_fn = (s / \"table-wrap/table-wrap-foot/fn\").text.strip\n\n # clean leftovers of xref\n ti = ti.gsub(/\\[-*\\]/, \"\")\n ti = ti.gsub(/\\(,*\\)/, \"\")\n ti = ti.gsub(/\\(-*\\)/, \"\")\n ti = ti.gsub(/\\[,*\\]/, \"\")\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n fig_cap = fig_cap.gsub(/\\[-*\\]/, \"\")\n fig_cap = fig_cap.gsub(/\\(,*\\)/, \"\")\n fig_cap = fig_cap.gsub(/\\(-*\\)/, \"\")\n fig_cap = fig_cap.gsub(/\\[,*\\]/, \"\")\n tbl_cap = tbl_cap.gsub(/\\[-*\\]/, \"\")\n tbl_cap = tbl_cap.gsub(/\\(,*\\)/, \"\")\n tbl_cap = tbl_cap.gsub(/\\(-*\\)/, \"\")\n tbl_cap = tbl_cap.gsub(/\\[,*\\]/, \"\")\n tbl_fn = tbl_fn.gsub(/\\[-*\\]/, \"\")\n tbl_fn = tbl_fn.gsub(/\\(,*\\)/, \"\")\n tbl_fn = tbl_fn.gsub(/\\(-*\\)/, \"\")\n tbl_fn = tbl_fn.gsub(/\\[,*\\]/, \"\")\n body_full << ti << \"\\n\"\n body_full << body << \"\\n\"\n body_full << fig_cap << \"\\n\"\n body_full << tbl_cap << \"\\n\"\n body_full << tbl_fn << \"\\n\"\n end\n this_pub[:body][:full] = body_full.strip\n end\n\n if (body_node / \"p\").size > 0 # found the sec and p can coexist 2660466.nxml\n body_full = this_pub[:body][:full].to_s\n (body_node / \"p\").each do |s|\n s.search('//disp-formula').each do |node|\n node.remove\n end\n s.search('//inline-formula').each do |node|\n node.remove\n end\n body = s.text.strip\n body = body.gsub(/\\[-*\\]/, \"\")\n body = body.gsub(/\\(,*\\)/, \"\")\n body = body.gsub(/\\(-*\\)/, \"\")\n body = body.gsub(/\\[,*\\]/, \"\")\n body_full << body << \"\\n\"\n end\n this_pub[:body][:full] = body_full \n else\n STDERR.puts \"Serious weirdness in body: \"+ (art_meta / \"article-id[pub-id-type='pmc']\").text\n end\n \n \n return this_pub\nend",
"def eplore\n end",
"def articles\r\n ARTICLE[@climate_service.clothes]\r\n end",
"def header article\n \"title, summary, source, date, guid, isPermaLink\"\n end",
"def content\n raise \"Must be implemented.\" \n end",
"def get_content()\n return super()\n end",
"def article_title\n self.part_title_by_type('Article')\n end",
"def show\n extract_nxt_prv(@article)\n end",
"def news_body\n body\n end",
"def content_id; end",
"def herebody_s; end",
"def content_methods; end",
"def random_article\n path_to_article \"/wiki/Special:Random\"\n end",
"def content=(_); end",
"def footnote_content; end",
"def url\n \"/article/#{self.to_param}\"\n end",
"def enhance_referent(body, request) \n doc = Nokogiri::XML(body)\n return unless cite = doc.at(\"PubmedArticleSet/PubmedArticle/MedlineCitation\") # Nothing of interest here\n \n return unless article = cite.at(\"Article\") # No more useful metadata \n if abstract = article.at(\"Abstract/AbstractText\")\n request.add_service_response( \n :service=>self,\n :display_text => \"Abstract from #{@display_name}\",\n :content => abstract.inner_text,\n :service_type_value => 'abstract') unless abstract.inner_text.blank? \n end\n \n if journal = article.at(\"Journal\")\n if issn = journal.at('ISSN')\n if issn.attributes['issntype']==\"Print\" \n request.referent.enhance_referent('issn', issn.inner_html)\n else \n request.referent.enhance_referent('eissn', issn.inner_html) \n end\n end\n if jrnlissue = journal.at('JournalIssue')\n if volume = jrnlissue.at('Volume')\n request.referent.enhance_referent('volume', volume.inner_text)\n end\n if issue = jrnlissue.at('Issue')\n request.referent.enhance_referent('issue', issue.inner_text)\n end \n if date = jrnlissue.at('PubDate') \n \n request.referent.enhance_referent('date', openurl_date(date))\n \n end \n end\n \n if jtitle = journal.at('Title')\n request.referent.enhance_referent('jtitle', jtitle.inner_text) \n end\n if stitle = journal.at('ISOAbbreviation')\n request.referent.enhance_referent('stitle', stitle.inner_text)\n end \n \n if atitle = article.at('ArticleTitle')\n request.referent.enhance_referent('atitle', atitle.inner_text)\n end \n \n if pages = article.at('Pagination/MedlinePgn')\n page_str = pages.inner_text\n request.referent.enhance_referent('pages', page_str)\n if spage = page_str.split(\"-\")[0]\n request.referent.enhance_referent('spage', spage.strip)\n end\n end \n \n if author = article.at('AuthorList/Author')\n if last_name = author.at('LastName')\n request.referent.enhance_referent('aulast', last_name.inner_text)\n end\n if first_name = author.at('ForeName')\n request.referent.enhance_referent('aufirst', first_name.inner_text)\n end \n if initials = author.at('Initials')\n request.referent.enhance_referent('auinit', initials.inner_text)\n end \n end \n end \n \n end",
"def entities; end",
"def article(cps_id)\n @client.request(:get, \"articles/#{cps_id}\")[\"article\"]\n end",
"def article_feed\n \tArticle.all\n end",
"def author; @author; end",
"def author; @author; end",
"def main_description; end",
"def feruchemist; end",
"def is_article\n infopageable_type == 'Article'\n end",
"def links; end",
"def links; end",
"def make_articles\n EndangeredSpecies::Scraper.new.make_articles\n end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def top_news_sources\n\n end",
"def feed_explanation\n end",
"def article_representation article\n # Get the hash table which contains information\n hash_source = article.attributes\n \n # Get the key arrays of the hash table\n key_arr = hash_source.keys\n len = key_arr.length\n \n # Start with article tag \n result = \" <article>\\n\"\n \n # Iterate the keys\n # Set 'count' variable to make this loop stop at 5th attribute\n count = 0\n key_arr.each do |ele|\n # If the first 4 attributes are done, break this loop\n if(count>5)\n break\n end\n \n # If the value is not nil then put it into result\n if(hash_source[ele] != nil)\n # convert inappropriate symbols into entities\n key = convertEntities(ele)\n value = convertEntities(hash_source[ele])\n temp = \" <#{key}>#{value}</#{key}>\\n\"\n result+=temp\n end\n count+=1\n end\n \n #put guid and isPermaLink in one tag as the original source\n guid = hash_source[key_arr[len-1]]\n isPermaLink = hash_source[key_arr[len-2]]\n result += \" <guid isPermaLink=\\\"#{guid}\\\">\"\n result+=\"#{isPermaLink}</guid>\\n\"\n \n # Return the representation with closing article tag \n result += \" </article>\\n\"\n end",
"def article\n Journal::Article.find_by_articleid self.articleid\n end",
"def show\n @title = \"#{@press_release.title} - Think India NITR club\"\n @description = ActionController::Base.helpers.strip_tags(@press_release.article)[0..200] \n end",
"def show\n\n\t#@article = Article.find(params[:id])#params es un hash que tiene todos los parametros que se mandaron al servidor web. busca el elemento LINEA DE CODIGO REPETIDA, SOLO BASTA CON TENERLA EN EL METODO SET_ARTICLE \n\t#where BUSQUEDAS\n\t#Article.where(\" body LIKE ? \",\"%hola%\")\n\t#Article.where(\" id = ? \",params[:id])#este solo devolvera un elemento\n\t#Article.where(\" id = ? AND title = ?\",params[:id],params[:title])#,multiples condiciones\n\t#Article.where(\" id = ? OR title = ?\",params[:id],params[:title])#,multiples condiciones\n\t#Article.where.not(\" id = ?\",params[:id])#busqueda de todos los articulos que el id sea diferente del que el usuario paso como parametros\n\n\t\t@article.update_visits_count#va aumentando el visits_count con la ayuda de un metodo en el modelo, llamado update_visits_count, y el set visits count, junto con el before_save\n\t\t@comment = Comment.new#NESTED RESOURCE inicializamos un nuevo comentario\n\n\n\tend",
"def interpret(d)\n article = Article.new\n article.title = !d['webTitle'].nil? ? d['webTitle'] : 'n/a'\n article.source = @source\n article.pub_date = !d['webPublicationDate'].nil? ? (DateTime.parse d['webPublicationDate']) : nil\n article.author = !d['fields']['byline'].nil? ? d['fields']['byline'] : 'n/a'\n article.link = !d['webUrl'].nil? ? d['webUrl'] : 'n/a'\n\n re = /<(\"[^\"]*\"|'[^']*'|[^'\">])*>/\n summary = !d['fields']['body'].nil? ? d['fields']['body'] : 'n/a'\n summary.gsub!(re, '')\n article.summary = summary[0...126] + '...'\n\n article.image = !d['fields']['thumbnail'].nil? ? d['fields']['thumbnail'] : 'n/a'\n article\n end",
"def show # show => display individual article as requested\n # @variable is an instance variable supaya bisa dipake di html.erb\n end",
"def generate_excerpt?; end",
"def description; @doc['description']; end"
] | [
"0.67581767",
"0.6578359",
"0.64982694",
"0.6421189",
"0.63319725",
"0.6311412",
"0.6307622",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.6181088",
"0.61421597",
"0.6097521",
"0.6085915",
"0.60858035",
"0.60247624",
"0.6019931",
"0.5977735",
"0.5972834",
"0.59723043",
"0.59696454",
"0.5962978",
"0.5962978",
"0.5962978",
"0.5962978",
"0.59545594",
"0.59545594",
"0.59545594",
"0.59452534",
"0.5927099",
"0.5926448",
"0.59093016",
"0.59075433",
"0.5876543",
"0.58573544",
"0.58464706",
"0.5821388",
"0.5819754",
"0.5817888",
"0.58028746",
"0.57815367",
"0.57680196",
"0.5767838",
"0.5755315",
"0.5755151",
"0.57456666",
"0.57401407",
"0.5737935",
"0.57376033",
"0.57321656",
"0.57273537",
"0.5715862",
"0.5715862",
"0.5714169",
"0.57047313",
"0.57011056",
"0.5694941",
"0.5694941",
"0.5687141",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5679925",
"0.5678975",
"0.5676229",
"0.56753045",
"0.5673522",
"0.5673006",
"0.56665874",
"0.56649506",
"0.56641924",
"0.5653829",
"0.5651462"
] | 0.0 | -1 |
Create an article Options: :title => "Title" mandatory | def initialize(options={})
options.each{|k,v|send("#{k}=",v)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @article = Article.new\n @article.title = params[:title]\n @article.description = params[:description]\n @article.save\n redirect_to article_path(@article)\n end",
"def create(title, content, options={})\n form_data = {'action' => 'edit', 'title' => title, 'text' => content, 'summary' => (options[:summary] || \"\"), 'token' => get_token('edit', title)}\n if @options[:bot]\n form_data['bot'] = '1'\n form_data['assert'] = 'bot'\n end\n form_data['minor'] = '1' if options[:minor]\n form_data['notminor'] = '1' if options[:minor] == false or options[:notminor]\n form_data['createonly'] = \"\" unless options[:overwrite]\n form_data['section'] = options[:section].to_s if options[:section]\n make_api_request(form_data)\n end",
"def create\n logger.debug \"request: #{params.inspect}\"\n vari = params.require(:article).permit(:text, :title)\n logger.debug \"SOLO LOS ARTICLES : #{vari}\"\n @article = Article.new(vari)\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n logger.debug \"New article: #{@article.attributes.inspect}\"\n logger.debug \"Article should be valid: #{@article.valid?}\"\n end",
"def add_article(title, magazine)\n #going to create a new article when\n # given title and magazine\n #I have to be sure that when creating\n #an article I give it a title,author,magazine\n Article.new(title, magazine,author)\n end",
"def create\n # @article = Article.new\n # @article.title = params[:article][:title] # pull title from the request and insert into article object\n # @article.body = params[:article][:body] # pull body from the request and insert into article object\n \n @article = Article.new(article_params)\n \n @article.save\n\n flash.notice = \"Article '#{@article.title}' created!\"\n redirect_to article_path(@article)\n end",
"def article_params\n params.require(:article).permit(:title, :description)\n end",
"def create_new_section(title, options={})\n send_request('create_new_section', normalize_options(title, options))\n end",
"def create\n @article = Article.new(params[:article])\n\t\tdeny_access_unless(admin? || editor?)\n\t\t\n\t\topts = {}\n\t\topts[:as]=[]\n\t\t\n\t\topts = {}\n\t\topts = { :as => :editor } if editor?\n\t\topts = { :as => :admin } if admin?\n\t\t\n respond_to do |format|\n if @article.save(opts)\n\t\t\t\t@article.update_attributes(params[:article], opts)\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # @article = Article.new(params[:article])\n @article = Article.new(:title => params[:article][:title], :body => params[:article][:body])\n\n @article = Article.new(params[:article])\n\n # @article.title = params[:article][:title]\n # @article.body = params[:article][:body]\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t# pull out form data\n\t\t@article = Article.new(article_params)\n\t\t\t\n\t\t\t# redundant. input hash has same structure as output\n\t\t\t#title: params[:article][:title],\n\t\t\t#body: params[:article][:title])\n\t\t\n\t\t# alternate syntax\n\t\t#@article.title = params[:article][:title]\n\t\t#@article.body = params[:article][:body]\n\t\t\n\t\t@article.save\n\n\t\t#flash\n\t\tflash.notice = \"Article '#{@article.title}' Created!\"\n\n\t\t# don't want a view template for this action, redirect to show\n\t\tredirect_to article_path(@article)\n\tend",
"def article_params\n params.require(:article).permit(:title, :description)\n end",
"def article_params\n params.require(:article).permit(:title, :text)\n end",
"def article_params\n params.require(:article).permit(:title, :text)\n end",
"def article_params\n params.require(:article).permit(:title, :text)\n end",
"def article_params\n params.require(:article).permit(:title, :text)\n end",
"def article_params\n params.require(:article).permit(:title, :text)\n end",
"def article_params\n params.require(:article).permit(:title, :description) \n end",
"def create\n @article = Article.new(article_params)\n if !params[:workflow].blank?\n @workflow_state = WorkflowState.where(workflow_id: params[:workflow].to_i, start_point: 2).first\n @article.workflow_state_id = @workflow_state.id\n end\n @article.save\n params.each do |param|\n if param[0].include?('_title_type')\n @h = param[0].split('_')[0]\n if !params[\"#{@h}_other_title\"].blank?\n @title_type = TitleType.find_by_id(param[1].to_i)\n Titling.create(title_type_id: @title_type.id, article_id: @article.id, content: params[\"#{@h}_other_title\"] )\n end\n end\n end\n respond_to do |format|\n format.html { redirect_to '/articles/'+@article.id.to_s , notice: :article_is_created }\n end\n end",
"def article_params\n\n params.require(:article).permit(:title, :description)\n\n end",
"def article_params\n params.require(:article).permit(:title, :text)\n end",
"def article_format_params\n params.require(:article_format).permit(:title, :description)\n end",
"def article_format_params\n params.require(:article_format).permit(:title, :description)\n end",
"def article_params\n params.require(:article).permit(:title, :text)\n end",
"def create_new_section(title, options={})\n send_audit(:kind => :new_section, :text => title, :category => options[:category])\n end",
"def article_params\n params.permit(:title, :subtitle, :body)\n end",
"def article_params\n params.require(:article).permit(:url, :title, :date, :html_body)\n end",
"def article_params\n params.require(:article).permit(:title, :description) \n end",
"def article_params\n params.require(:article).permit(:title, :abstract, :url, :edition_id)\n end",
"def article_params\n\t\tparams.require(:article).permit(:title, :description)\n\tend",
"def input_for_create( ctx, ** )\n { title: ctx[:title] }\n end",
"def article_params\n params.require(:article).permit(:title, :content)\n end",
"def article_params_for_create\n params.require(:article).permit(:title, :body, :blog_id)\n end",
"def create\n @article = Article.new(article_params)\n if params[:article][:draft] === \"false\"\n labels = params[:article].delete(:labels).to_s\n initialize_or_create_labels(labels)\n add_category(params[:article][:category])\n end\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to [:admin, @article], notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n definir_selects\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def article_params\n params.require(:article).permit(:title, :text) \n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n # Format HTML representa o padrão de projeto Template, que redefine partes do algoritmo\n # sem mudar a estrutura do codigo.\n format.html { redirect_to @article, notice: 'Artigo criado com sucesso.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_article(magazine, title)\n Article.new(magazine, title)\n\n end",
"def article_params\n params.require(:article).permit(:title, :content)\n end",
"def article_params\n params.require(:article).permit(:title, :body)\n end",
"def article_params\n params.require(:article).permit(:title, :body)\n end",
"def article_params\n params.require(:article).permit(:title, :body)\n end",
"def article_params\n params.require(:article).permit(:title, :body)\n end",
"def article_params\n params.require(:article).permit(:title, :body)\n end",
"def article_params\n params.require(:article).permit(:title, :content, :language_id, :category_id)\n end",
"def initialize opts={}\n @title = opts[:title] || ''\n end",
"def create_article\n return unless request.method == \"POST\"\n\n return if flash_missing_title?\n article = Article.new(title: params[:article][:title],\n body: params[:article][:body],\n user_id: @user.id)\n article.save\n redirect_to(action: \"show_article\", id: article.id)\n end",
"def article_params\n params.require(:article).permit(:title, :body, :category)\n end",
"def article_params\r\n params.require(:article).permit(:title, :body)\r\n end",
"def create\n post = Post.new\n post.title = params[:title]\n post.description = params[:description]\n post.save\n end",
"def article options = {}\n Diffbot::APIClient::Article.new self, options\n end",
"def article_params\n params.require(:article).permit(:title, :body)\n end",
"def article_params\n params.require(:article).permit(:title, :content, :category, :draft)\n end",
"def article_params\n params.require(:article).permit(:title, :text, :image, :slug, :language, :category_id)\n end",
"def create\n # We have to define our permitted controller parameters to prevent wrongful mass assignment.\n # In this case, we want to both allow and require the title and text parameters for valid use of create.\n @article = Article.new(article_params)\n\n # save the model in the database\n if @article.save\n # redirect the user to the show action,\n redirect_to \"/articles/#{@article.id}\"\n else\n # The render method is used so that the @article object is passed back to the\n # new template when it is rendered. This rendering is done within the same request\n # as the form submission, whereas the redirect_to will tell the browser to issue another request.\n render :new\n end\n end",
"def article_params\n params.require(:article).permit(:title, :content, :editor)\n end",
"def article_params\n params.require(:article).permit(:pick, :title, :image, :headline, :published, :content, :category_id, :tag_list)\n end",
"def create\n @article = Article.new article_from_parameters\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n end",
"def article_params\n params.require(:article).permit(:title, :text, :img)\n end",
"def article_params\n params.require(:article).permit(:title, :body, :categories, :tags)\n end",
"def article_params\n params.require(:article).permit(:headline, :slug, :intro, :body, :admin_id)\n end",
"def article_params\n params.require(:article).permit(:title, :description, :image, :url, :material_id, :link_type, :position, :expiration_time, :support_promotion, :introduction)\n end",
"def article_params\n params[:article] = {}\n params[:article][:title] = params[:title]\n params[:article][:content] = params[:content]\n params[:article][:category_id] = params[:category_id]\n params.require(:article).permit(:title, :content, :category_id)\n end",
"def CreateArticle params = {}\n \n APICall(path: 'help_center/articles.json',method: 'POST',payload: params.to_json)\n \n end",
"def article_params\n params.require(:article).permit(:title, :summary, :content, :image, :publish, :remove_image)\n end",
"def article_params\n params.require(:article).permit(:title, :date, :summary, :author, :image, :link, :tag_list)\n end",
"def article_params\n params.require(:article).permit(:title, :content, :published)\n end",
"def create(options)\n item = build(options)\n item.save\n item\n end",
"def article_params\n params.permit(:name, :text, :article_type)\n end",
"def article_params\n params.require(:article).permit(:title_jp, :title_en, :title_fre, :title_ger, :title_chi, :title_ko, :body_jp, :body_en, :body_fre, :body_ger, :body_chi, :body_ko, :url, :genre_id, :integer, :contributor_name, :image)\n end",
"def article_params\n params.require(:article).permit(:title, :description, :author, :body, :imagelink)\n end",
"def set_seo_meta(title, options = {})\r\n #todo\r\n keywords = options[:keywords] || \"问答\"\r\n description = options[:description] || \"Kejian.TV 课件交流系统是中国最大的教育资源在线集散平台,同时,课件交流系统也是中国最专业的在线学习社区。\"\r\n\r\n if title.length > 0\r\n @seo[:title] = \"#{title}\"\r\n end\r\n @seo[:keywords] = keywords\r\n @seo[:description] = description\r\n end",
"def article_params\n params.require(:article).permit(:title, :string, :body, :text, :photo)\n end",
"def create_portal_post(options={})\n\t\t\tPortalPost.create({\n\t\t\tauthor: \"Author example\",\n\t\t\ttitle: \"Portal post title example\",\n\t\t\tbody: \"Portal post body example\"\n\t\t\t}.merge(options))\n\t\tend",
"def article_params\n params.require(:article).permit(:date, :title, :permalink, :content, :language, :published, :featured, :menu_id, :gallery_id)\n end",
"def article_params\n params.require(:article).permit(:title, :description, :image, :price, :category, :state, :creater)\n end",
"def article_params\n params.require(:article).permit(:title, :slug, :content, :status)\n end",
"def article_params\n params.require(:article).permit(:title, :category,:body,:summary)\n end",
"def permitted_params\n params.require(:article).permit(:title,:content,:caption)\n end",
"def create(_options)\n raise NotImplementedError\n end",
"def article_params\n params.require(:article).permit(:title, :body, :published)\n end",
"def article_params\n params.require(:article).permit(:title, :content, :category_id, :gallery_id)\n end",
"def article_params\n params.require(:article).permit(:title, :short_description, :content, :banner_id, :is_published, :is_featured, :published_at, :position)\n end",
"def create\n @article = article_create(params[:article])\n @article.save\n respond_with(@article)\n end",
"def article_params\n params.require(:article).permit(:type, :name, :text, :story_id)\n end",
"def initialize\n super(TITLE, DESCRIPTION, true)\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to [:edit, @article], notice: 'Nouvel article créé.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def article_params\r\n params.require(:article).permit(:title, :text,:Tags)\r\n end",
"def initialize(options={})\n @id = options[\"id\"]\n @name = options[\"name\"]\n @title = options[\"title\"]\n \n if @id != nil\n self.find_title\n end\n end",
"def article_params\n params.require(:article).permit(:title, :content, :published, :poster_image, :author, :blurb, :category_id, :issue_id, :color_scheme, :priority_order, :slug)\n end",
"def article_params\n params.require(:article).permit(\n :title,\n :slug,\n :content,\n :volume,\n :issue,\n :is_published,\n :section_id,\n :summary,\n :rank,\n :created_at\n )\n end",
"def article_params\n params.require(:article).permit(:title, :body, :category_id, :published)\n end",
"def article_params\n params.require(:article).permit(:title, :content, :description, :copy, :photo, :print, :editor)\n end",
"def article_params\n params.require(:article).permit(:title, :text, :image, :category_id)\n end",
"def article_params\n params.require(:article).permit(:url, :title, :byline, :excerpt, :readerable, :scraped_at, :content_html)\n end",
"def article_params\n params.require(:article).permit(:title,:body)\n end",
"def article_params\n params.require(:article).permit(:section_id, :title, :body, :user_id, :what_we_learn, :sequence)\n end",
"def article_params\n params.require(:article).permit(:title, :description, :link, :date, :feed_id)\n end",
"def article_params\n params.require(:article).permit(:title, :abstract, :content, :url, :slug,:workflow_state_id)\n end",
"def article_params\n params.require(:article).permit(:title, :description, :story, :views, :likes, :filename)\n end",
"def article_params\n params.require(:article).permit(:name, :content)\n end",
"def article_params\n params.require(:article).permit([:title, :description, :address, :price])\n end"
] | [
"0.6681014",
"0.662412",
"0.6427653",
"0.6411581",
"0.63047343",
"0.6303501",
"0.6295897",
"0.628313",
"0.6281996",
"0.62731016",
"0.626823",
"0.6265143",
"0.6265143",
"0.6265143",
"0.6265143",
"0.6265143",
"0.6263436",
"0.62480336",
"0.62203306",
"0.6214488",
"0.6212951",
"0.6212951",
"0.6211528",
"0.6204844",
"0.620059",
"0.61918616",
"0.61849177",
"0.6182748",
"0.6163028",
"0.615546",
"0.6149385",
"0.61476517",
"0.6132751",
"0.61216444",
"0.6115572",
"0.6110783",
"0.6106548",
"0.61039346",
"0.60832304",
"0.60832304",
"0.60832304",
"0.60832304",
"0.60832304",
"0.60802025",
"0.6078359",
"0.60724497",
"0.606238",
"0.60621053",
"0.60601157",
"0.60542953",
"0.60530275",
"0.6037138",
"0.6036958",
"0.6015883",
"0.6013593",
"0.60065144",
"0.6000903",
"0.5991774",
"0.5986021",
"0.5976604",
"0.5965367",
"0.59577364",
"0.59484196",
"0.59459126",
"0.59395736",
"0.5929813",
"0.5919331",
"0.59156215",
"0.591033",
"0.5908247",
"0.5904705",
"0.5897267",
"0.58968306",
"0.5896049",
"0.58918",
"0.58846724",
"0.587185",
"0.5869432",
"0.58674294",
"0.58628577",
"0.5858862",
"0.58526176",
"0.58470404",
"0.58448714",
"0.58445466",
"0.5843495",
"0.5842017",
"0.5838425",
"0.5838377",
"0.5810309",
"0.58047247",
"0.58031464",
"0.58025706",
"0.5799234",
"0.5799193",
"0.57979923",
"0.5797476",
"0.57836676",
"0.5776447",
"0.57753557",
"0.5772579"
] | 0.0 | -1 |
Utilities Convert norwegian date to Time object with a forgiven regexp TODO: Move this somewhere. Examples: t = norwegian_date('1.1.2010') t = norwegian_date('22.01.2010') t = norwegian_date('22.01.2010 12:15') t = norwegian_date('22.01.2010 12:15:20') | def norwegian_date(date)
if /\A\s*
(\d\d?).(\d\d?).(-?\d+)
\s?
(\d\d?)?:?(\d\d?)?:?(\d\d?)?
\s*\z/ix =~ date
year = $3.to_i
mon = $2.to_i
day = $1.to_i
hour = $4.to_i
min = $5.to_i
sec = $6.to_i
# puts "Debug: #{year} #{mon} #{day} #{hour}:#{min}:#{sec}"
usec = 0
usec = $7.to_f * 1000000 if $7
if $8
zone = $8
year, mon, day, hour, min, sec =
apply_offset(year, mon, day, hour, min, sec, zone_offset(zone))
Time.utc(year, mon, day, hour, min, sec, usec)
else
Time.local(year, mon, day, hour, min, sec, usec)
end
else
raise ArgumentError.new("invalid date: #{date.inspect}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_time(tt)\n tt = tt.force_encoding('utf-8')\n MONTHS.map{|k,v|\n tt.gsub!(/ #{k}/i, \" #{v.downcase}\")\n }\n case tt\n when /Demain.*/\n t = Time.parse(tt)+60*60*24\n else\n t = Time.parse(tt)\n end\n return t\nend",
"def localize_time_of_day(time)\n if time.nil?\n return I18n.localize(DateTime.new)\n .remove('01/01/-4712')\n .strip\n .gsub(/\\d/, '_')\n end\n\n I18n.localize(time)\n .remove('01/01/2000')\n .strip\n end",
"def to_time\n return self.to_i.to_time if self =~ DIGIT_ONLY_REGEX\n if self =~ US_DATE_REGEX\n Time.parse(us_date_to_iso_str)\n elsif self =~ JSON_DATE_REGEX\n json_date_to_time\n else\n Time.parse(self)\n end\n end",
"def parse_date(date)\n case date\n when /\\A\\s*(\\d+)-(\\d+)-(\\d+)(?:[ T](\\d+):(\\d+):(\\d+) *([-+]\\d\\d):?(\\d\\d))?\\b/\n Time.new($1, $2, $3, $4, $5, $6, (\"#{$7}:#{$8}\" if $7))\n when /\\A\\s*\\w{3}, +(\\d+) (\\w{3}) (\\d+) (\\d+):(\\d+):(\\d+) *(?:([-+]\\d\\d):?(\\d\\d))\\b/\n Time.new($3, $2, $1, $4, $5, $6, (\"#{$7}:#{$8}\" if $7))\n when /\\A\\s*\\w{3} (\\w{3}) +(\\d+) (\\d+) (\\d+):(\\d+):(\\d+) *(?:([-+]\\d\\d):?(\\d\\d))\\b/\n Time.new($3, $1, $2, $4, $5, $6, (\"#{$7}:#{$8}\" if $7))\n when /\\A\\s*\\w{3} (\\w{3}) +(\\d+) (\\d+):(\\d+):(\\d+) (\\d+)\\b/\n Time.new($6, $1, $2, $3, $4, $5)\n else\n raise ArgumentError, \"bad date: #{date}\"\n end\n end",
"def parse_date(aString)\n return Time.rfc822(aString) rescue Time.parse(aString)\nend",
"def str_to_time(st)\r\n ret = nil\r\n if st.is_a? Time then\r\n ret = st\r\n elsif st.is_a? String then \r\n begin\r\n self.allday = false\r\n ret = Time.iso8601(st) \r\n rescue \r\n self.allday = true if st =~ /\\d{4}-\\d{2}-\\d{2}/ # yyyy-mm-dd\r\n ret = Time.parse(st)\r\n end\r\n end\r\n ret\r\n end",
"def date_from_string(date)\n\n#remove st rd nd and th\n\nfirstParse = Chronic.parse(date)\nr1 = /[a-zA-Z]/\n\nif firstParse #check if chronic managed to find anything\n\n #daY Less than 12, assume chronic wrong, aslong as also no characters such as December, \n #where it would be right\n if firstParse.day <= 12 and !r1.match(date) \n\t\n\t #swap month with day\n\t firstParse = firstParse.change(:day => firstParse.month, :month => firstParse.day)\n\n end #of if <= 12\n\n return firstParse\n \n else\n \n\treturn Date.new\n \n end #of if firstParse\nend",
"def convert_date(date)\r\n if ( date == nil )\r\n return nil\r\n end\r\n string_date = date.to_s\r\n t = string_date.rindex('T')\r\n string_date = string_date.slice(0,t)\r\n string_date \r\nend",
"def convert_time(stime)\n begin\n if stime\n stime =~ /^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/;\n return Time.gm($1,$2,$3,$4,$5,$6)\n else\n return Time.now\n end\n rescue\n return Time.now\n end\nend",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def parse_accept_date(string)\n parts = string.split(/[\\/:.]/)\n Time.local(*parts.values_at(2, 1, 0, 3..6))\n end",
"def string_to_datetime(timestring)\n match = timestring[/(\\d{1,2})h(\\d{1,2})/]\n retour = DateTime.civil(2000,1,1,match[$1].to_i,match[$2].to_i,0)\n end",
"def get_yyyymmdd_hhnnss(s)\n return s.gsub('T', ' ').gsub('Z', '')\n end",
"def timeparse time\n tt ||= Time.rfc2822(time) rescue nil\n tt ||= Time.iso8601(time) rescue nil\n tt ||= Time.strptime(time, \"%Y-%m-%d %T %z\") rescue nil\n\n if !tt\n if $base_time\n begin\n # base_time has been set so try parsing a relative time\n # todo: I should be a lot stricter about parsing invalid times\n\n # work with \"Jan 7\" as well as \"7 Jan\"\n if time[/^\\s*([A-Za-z]+\\s*[0-9]+):/] # split \"Jan 7: \" off front and use it as base time\n nt = Time.parse($1, $base_time)\n nt = Time.new(nt.year+1, nt.month, nt.day, nt.hour, nt.min, nt.sec, nt.utc_offset) if $base_time.to_date.to_time > nt\n time = $'\n $base_time = nt\n end\n\n tt = Time.parse(time, $base_time) # try a relative time\n tt += 86400 if $base_time > tt # if base_time is 11:30 and tt is 00:00, tt needs to be bumped to the following day\n tt = Time.new(tt.year+1, tt.month, tt.day, tt.hour, tt.min, tt.sec, tt.utc_offset) if $base_time > tt\n log \"parsing #{time} against #{$base_time} and got #{tt}\"\n rescue\n $stderr.puts \"Time could not be parsed: '#{time}'\"\n raise\n end\n else\n raise \"the first time in the file must be rfc or iso: #{time}\"\n end\n end\n\n $base_time = tt\n\n raise \"Invalid time #{time}\" if tt.nil?\n time_floor(tt, 30); # magic value\nend",
"def time_for_string(time)\n time = time.scan(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/)[0].sub(' ','T')\n Time.xmlschema(time)\n end",
"def post_process_datetime( val )\n\t\t\treturn Time.parse( val )\n\t\trescue ArgumentError\n\t\t\treturn nil\n\t\tend",
"def makeDate date, time\n arrDate = date.split(\"-\")\n arrTime = time.tr('A-Za-z ', '').split(\":\")\n\n #checks if the time is in PM. If yes add 12 hours to it. Special case is when its 12 AM. Need to minus 12 hours.\n if (params[:time].include? \"A\") && arrTime[0] == \"12\"\n arrTime[0] = 0\n elsif (params[:time].include? \"P\") && arrTime[0] != \"12\"\n arrTime[0] = arrTime[0].to_i + 12\n end\n\n return Time.new(arrDate[2], arrDate[1], arrDate[0], arrTime[0], arrTime[1])\n end",
"def str_to_time(str) # :nodoc:\n unless str.nil?\n _r, mon, day, year, hour, min, sec =\n str.match(\"^(\\\\d+?)/(\\\\d+?)/(\\\\d+?) (\\\\d+?):(\\\\d+?):(\\\\d+?)$\").to_a\n end\n\n if str.nil? || mon.nil?\n raise ArgumentError, \"Invalid date format, expected MM/DD/YYYY HH24:MI:SS (got #{str})\"\n end\n\n Time.mktime(year, mon, day, hour, min, sec, 0)\n end",
"def strftime(str)\n replaces = {}\n res = \"#{str}\"\n \n str.scan(/(%%|%(\\^|)([A-z]))/) do |match|\n #The does the functionality of actually having a '%' in the string.\n if match[0] == \"%%\"\n replaces[\"%%\"] = \"%\"\n next\n end\n \n #Set up replace-hash for later replace.\n bigsign = match[1]\n letter = match[2]\n \n le = \"%#{bigsign}#{letter}\"\n \n #Skip if letter has already been set.\n next if replaces.key?(le)\n \n case letter\n when \"Y\"\n replaces[le] = @t_year\n when \"m\"\n replaces[le] = \"%02d\" % @t_month\n when \"d\"\n replaces[le] = \"%02d\" % @t_day\n when \"e\"\n replaces[le] = @t_day\n when \"H\"\n replaces[le] = \"%02d\" % @t_hour\n when \"k\"\n replaces[le] = @t_hour\n when \"l\"\n replaces[le] = self.hour_thc\n when \"I\"\n replaces[le] = \"%02d\" % self.hour_thc\n when \"M\"\n replaces[le] = \"%02d\" % @t_min\n when \"S\"\n replaces[le] = \"%02d\" % @t_sec\n when \"T\"\n replaces[le] = \"#{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec}\"\n when \"R\"\n replaces[le] = \"#{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}\"\n when \"r\"\n replaces[le] = \"#{\"%02d\" % self.hour_thc}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} #{self.ampm.upcase}\"\n when \"B\"\n replaces[le] = self.month_name\n when \"b\", \"h\"\n replaces[le] = self.month_name[0, 3]\n when \"j\"\n replaces[le] = self.day_of_year\n when \"A\"\n replaces[le] = self.day_name\n when \"a\"\n replaces[le] = self.day_name[0, 3]\n when \"w\"\n replaces[le] = self.day_in_week\n when \"u\"\n replaces[le] = self.day_in_week(:mfirst => true) + 1\n when \"s\"\n replaces[le] = self.to_i\n when \"p\"\n replaces[le] = self.ampm.upcase\n when \"P\"\n replaces[le] = self.ampm\n when \"V\"\n replaces[le] = self.week_no\n when \"W\"\n replaces[le] = self.week_no(:mfirst => true)\n end\n \n #Replace should be uppercase.\n if bigsign == \"^\" and replaces.key?(le)\n replaces[le] = replaces[le].to_s.upcase\n end\n end\n \n #Do the actual replaces.\n replaces.each do |key, val|\n res = res.gsub(key, val.to_s)\n end\n \n #Return the replaced string.\n return res\n end",
"def parse_date(str) \n Time.at(str[/([0-9]+)-([0-9]+)/,1].to_i/1000)\n end",
"def date_mathable(datestr)#i.e. '2011-02-20'\r\n date_time = datestr.split(\" \")\r\n if date_time.length == 1\r\n arg = datestr.split('-')\r\n arg = arg.length == 1 ? datestr.split('.') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n date = Time.local(y,m,d)\r\n return date\r\n elsif date_time.length == 2\r\n arg = date_time[0].split('-')\r\n arg = arg.length == 1 ? date_time[0].split('.') : arg\r\n arg = arg.length == 1 ? date_time[0].split('/') : arg\r\n y = Integer( trim_lead(arg[0],'0') )\r\n m = Integer( trim_lead(arg[1],'0') )\r\n d = Integer( trim_lead(arg[2],'0') )\r\n arg2 = date_time[1].split(':')\r\n hour = Integer( trim_lead(arg2[0],'0') )\r\n min = arg2[1] == '00' ? 0 : Integer( trim_lead(arg2[1],'0') )\r\n sec = arg2[2] == '00' ? 0 : Integer( trim_lead(arg2[2],'0') )\r\n date = y >= 1000 ? Time.local(y,m,d,hour,min,sec) : Time.local(d,y,m,hour,min,sec)\r\n return date\r\n end \r\n end",
"def validate(val)\n if ((val.is_a?(String)) &&\n # This could be expanded. @TODO\n (m = val.match(/([0-9]{4})-([0-9]{2})-([0-9]{2})/)))\n return Time.new(m[1], m[2], m[3])\n elsif (val.respond_to?(:to_time))\n return val.to_time\n elsif (val.is_a?(Time))\n return val\n else\n return nil\n end\n end",
"def parse_time(time)\n if time.is_a? Time\n return Time.parse time.httpdate\n elsif time.is_a String\n return Time.parse(Time.parse(time).httpdate)\n else\n raise \"Argument Error, #{time} is not a valid time\"\n end\n end",
"def string_to_time(string)\n super(handle_date_parse_input(string))\n end",
"def convert_time(stime)\n begin\n if stime\n stime =~ /^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/;\n return Time.gm($1,$2,$3,$4,$5,$6)\n else\n return 0\n end\n rescue\n return 0\n end\nend",
"def parse_date(s)\n begin\n if s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([2-9]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/19#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/([0-1]{1}\\d{1})$/\n date = DateTime.parse(\"#{$2}/#{$1}/20#{$3}\")\n elsif s =~ /^(\\d{1,2})\\/(\\d{1,2})\\/(\\d{4})$/\n date = DateTime.parse(\"#{$2}/#{$1}/#{$3}\")\n elsif s =~ /^(\\d\\d\\d\\d)-(\\d\\d)$/\n if (1...13).include?($2.to_i) and (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n elsif s =~ /^(\\d\\d\\d\\d)$/\n if (1000...3000).include?($1.to_i)\n return s\n else\n return nil\n end\n else\n date = DateTime.parse(s)\n end\n rescue\n return nil\n end\n return date.strftime(\"%Y-%m-%d\")\n end",
"def format_date(text)\n text.gsub(/(\\d\\d\\d\\d)([\\-\\/])(\\d\\d)\\2(\\d\\d)/, '\\4.\\3.\\1')\nend",
"def typecast_time(datetime) #:nodoc:\n datetime.sub!(%r|^(\\w{2})/(\\w{3})/(\\w{4})|, '\\2 \\1 \\3')\n datetime.sub!(':', ' ')\n Time.parse(datetime)\n end",
"def nyc_time(time)\n TZInfo::Timezone.get('America/New_York').local_to_utc(Time.parse(time))\nend",
"def format_date2(date)\n date.gsub(/\\A(\\d{4})([\\-\\/])(\\d\\d)([\\-\\/])(\\d\\d)\\z/, '\\5.\\3.\\1')\nend",
"def parse_date date\n\t\tunless date =~ /(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})Z/\n\t\t\treturn nil\n\t\tend\n\t\t\n\t\tyear = $1\n\t\tmonth = $2\n\t\tday = $3\n\t\thour = $4\n\t\tmin = $5\n\t\tsec = $6\n\n\t\treturn Time.mktime(year, month, day, hour, min, sec)\n\tend",
"def date_factory(time_object)\n {\n sakai: make_date(time_object),\n sakai_rounded: make_date(time_object).gsub!(/:\\d+/, \":#{Time.at(time_object.to_i/(5*60)*(5*60)).strftime(\"%M\")}\"), # Date with time rounded to nearest 5-minute mark.\n short_date: time_object.strftime(\"%b %-d, %Y\"), # => \"Oct 18, 2013\"\n samigo: time_object.strftime(\"%m/%d/%Y %I:%M:%S %p\"), # => \"10/30/2012 07:02:05 AM\"\n MON: time_object.strftime(\"%^b\"), # => \"DEC\"\n Mon: time_object.strftime(\"%b\"), # => \"Jan\"\n Month: time_object.strftime(\"%B\"), # => \"February\"\n month_int: time_object.month, # => 3\n day_of_month: time_object.day, # => 17 Note this is not zero-padded\n weekday: time_object.strftime(\"%A\"), # => \"Monday\"\n wkdy: time_object.strftime(\"%a\"), # => \"Tue\"\n year: time_object.year, # => 2013\n hour: time_object.strftime(\"%I\").to_i, # => \"07\" Zero-padded, 12-hour clock\n minute: time_object.strftime(\"%M\"), # => \"02\" Zero-padded\n minute_rounded: (Time.at(time_object.to_i/(5*60)*(5*60))).strftime(\"%M\"), # => \"05\" Zero-padded, rounded to 5-minute increments\n meridian: time_object.strftime(\"%P\"), # => \"pm\"\n MERIDIAN: time_object.strftime(\"%p\"), # => \"AM\"\n date_w_slashes: time_object.strftime(\"%m/%d/%Y\"), # => 02/08/2013\n custom: time_object # => Allows creation of a custom date string using the passed time value.\n }\n end",
"def german_time_format(date)\n date.strftime(\"%d.%m.%y - %H:%M\")\n end",
"def parse_filtered_time(time = nil)\n case time\n when String then Time.zone.parse(time)\n when nil then Time.zone.now\n when Time, ActiveSupport::TimeWithZone then time.in_time_zone\n else raise \"Invalid time: #{time.inspect}\"\n end\n end",
"def rfc2822(time)\n time.strftime('%a, %d %b %Y %T GMT')\n end",
"def convert_time(time_string)\n parts = time_string.to_s.split('/')\n return parts.length == 3 ? Time.new(parts[2].to_i, parts[0].to_i, parts[1].to_i) : nil\n end",
"def format_date(string)\n string.sub(/\\A(\\d{4})-(\\d{2})-(\\d{2})\\z/, '\\3.\\2.\\1')\nend",
"def format_date(string)\n string.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)/, '\\3.\\2.\\1')\nend",
"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 format_date(str)\n# str.gsub(/^(\\d\\d\\d\\d)[-|\\/](\\d\\d)[-|\\/](\\d\\d)$/, '\\3.\\2.\\1')\n str.sub(/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/, '\\3.\\2.\\1')\n .sub(/^(\\d\\d\\d\\d)\\/(\\d\\d)\\/(\\d\\d)$/, '\\3.\\2.\\1')\nend",
"def format_date(string)\n string.sub(/\\A(\\d{4})([\\-\\/])(\\d{2})\\2(\\d{2})\\z/, '\\4.\\3.\\1')\nend",
"def format_date(str)\n str.sub(/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/, '\\3.\\2.\\1')\nend",
"def convert_time_of_day(val)\n return val unless parse_integer(val).nil?\n\n if val == \"noon\"\n val = \"12pm\"\n elsif val == \"midnight\"\n val = \"12am\"\n elsif !(/a$/ =~ val).nil?\n val = val.gsub(/a$/, \"am\")\n elsif !(/p$/ =~ val).nil?\n val = val.gsub(/p$/, \"pm\")\n end\n hours = parse_integer(Time.zone.parse(val).strftime(\"%H\"))\n minutes = parse_integer(Time.zone.parse(val).strftime(\"%M\"))\n seconds = parse_integer(Time.zone.parse(val).strftime(\"%S\"))\n (hours * 3600 + minutes * 60 + seconds).to_s\n rescue\n val\n end",
"def livia_date_time(d)\n unless d.nil?\n d.to_time.strftime(\"%m/%d/%Y %H:%M\")\n else\n ''\n end\n end",
"def formalize_date(pubdate_str)\n # Allowed sample date formats: DEC 2:2021; 25-Dec:2019; Jul:2019; :2019\n wos_formats = ['%b %d:%Y', '%d-%b:%Y', '%b:%Y', ':%Y']\n parsed = nil\n wos_formats.each do |format|\n begin\n parsed = Date.strptime(pubdate_str, format)\n break\n rescue StandardError => e\n Rails.logger.warn \"Repository Work formalize date error #{e.message}\"\n nil\n end\n end\n return parsed.to_s\n end",
"def parse_usa_date(date, time_string = nil)\n date = date.to_s.strip\n\n # TODO: Many tests pass either a Date, a Time, or an YYYY-MM-DD formatted\n # string as a parameter. This conditional will handle those cases. We should\n # probably go through and clean up the tests at some point.\n date = format_usa_date(Date.parse(date)) if date =~ /\\A\\d{4}-\\d{2}-\\d{2}/\n\n return unless usa_formatted_date?(date)\n\n date_string = Date.strptime(date, \"%m/%d/%Y\").to_s\n date_string += \" #{time_string}\" if time_string\n\n Time.zone.parse(date_string)\n rescue ArgumentError\n nil\n end",
"def format_date(date)\n date.gsub(/^(\\d{4})-(\\d{2})-(\\d{2}$)/, '\\3.\\2.\\1') #capture groups make this way easier!\nend",
"def parse(tz_string); end",
"def formatted_time(text)\n return nil if text.blank?\n format = '%Y-%m-%dT%H:%M:%S%Z'\n ::Time.strptime(text, format)\n end",
"def format_date(original_date)\n original_date.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\z/, '\\3.\\2.\\1')\nend",
"def format_date(original_date)\n original_date.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\z/, '\\3.\\2.\\1')\nend",
"def format_date_nicely(date)\n\tn = Time.new(2013, 10, 31)\n\tn.strftime(\"%d/%m/%Y\")\nend",
"def format_date1(original_date)\n original_date.sub(/\\A(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\z/, '\\3.\\2.\\1')\nend",
"def fast_string_to_time(string)\n return unless string =~ Format::ISO_DATETIME\n microsec = (Regexp.last_match[7].to_r * 1_000_000).to_i\n new_time(Regexp.last_match[1].to_i,\n Regexp.last_match[2].to_i,\n Regexp.last_match[3].to_i,\n Regexp.last_match[4].to_i,\n Regexp.last_match[5].to_i,\n Regexp.last_match[6].to_i,\n microsec\n )\n end",
"def format_date(original_date_str)\n original_date_str.sub(%r{\\A(\\d{4})([-/])(\\d{2})\\2(\\d{2})\\z},'\\4.\\3.\\1')\nend",
"def extract_time(time_string,time=false)\n time_string = 'today' if time_string.nil?\n\n if time_string.match(/\\d{4}-\\d{2}-\\d{2}/)\n date = time_string \n date = Time.xmlschema(\"#{time_string}T00:00:00\") if time\n else\n timeleap = SycTimeleap::TimeLeap.new\n begin\n date = timeleap.send(time_string)\n date = date.to_s unless time\n rescue NoMethodError\n help_now! \"Arguments may be 'time distances', YYYY-MM-DD or <RETURN>\\n\"+\n \"\\ntime distances are:\\n\"+\n \"* yesterday|today|tomorrow\\n\"+\n \"* next|previous_monday|tuesday|...|sunday\\n\"+\n \"* in|back_10_days|weeks|months|years\\n\"+\n \"* monday|tuesday|...|sunday_in|back_1_day|week|month|year\\n\"+\n \"Short forms are also possible:\\n\"+\n \"* y|tod|tom\\n\"+\n \"* n|pmo|tu|we|th|fr|sa|su\\n\"+\n \"* i|b10d|w|m|y\\n\"+\n \"* mo|tu|we|th|fr|sa|sui|b1d|w|m|y\"\n end\n end\n date\n end",
"def datetime_pattern(field)\n pattern1 = field.scan(/[0-9]\\//)\n pattern2 = field.scan(/[0-9]\\-/)\n pattern3 = field.scan(/[0-9] /)\n pattern4 = field.scan(/[0-9] [A-Z][a-z][a-z] [0-9]|[0-9]-[A-Z][a-z][a-z]-[0-9]|[0-9] [a-z][a-z][a-z] [0-9]|[0-9]-[a-z][a-z][a-z]-[0-9]/)\n if(pattern1.size == 2||pattern2.size == 2||pattern3.size == 2||pattern4.size != 0)\n if(validate_year_date(field))\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def to_date\n return self.to_i.to_date if self =~ DIGIT_ONLY_REGEX\n if self =~ US_DATE_REGEX\n Date.strptime(self.tr(DATE_TR,'-'), US_DATE_FORMAT)\n elsif self =~ JSON_DATE_REGEX\n json_date_to_time.to_date\n else\n Date.strptime(self.tr(DATE_TR,'-'), ISO_DATE_FORMAT)\n end\n end",
"def timeConversion(s)\n meridiem = s.scan(/[A-Z]+/).first\n s.gsub!(/[A-Z]+/, '')\n hour_str = s.scan(/\\d\\d/).first\n return s if hour_str == '12' && meridiem == 'PM'\n hour_int = hour_str.to_i\n new_hour =\n if meridiem == 'PM'\n (hour_int + 12) % 24\n else\n (hour_int - 12) % 12\n end\n s.gsub(/^\\d\\d/, new_hour.to_s.rjust(2, '0'))\nend",
"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 format_registration_time(date_time)\n format_time = DateTime.strptime(date_time, '%m/%d/%y %H:%M')\nend",
"def convert_xanga_header_to_wordpress_date(str)\n arr = str.split(\" \") #split on spaces\n \n raise \"Error in convert_xanga_header_to_date with value=#{str}\" if arr.size != 4 \n \n #get rid of commas\n arr[0].chomp!(\",\") \n arr[2].chomp!(\",\")\n \n arr[0] = case arr[0]\n when \"Sunday\"\n Time::RFC2822_DAY_NAME[0]\n when \"Monday\"\n Time::RFC2822_DAY_NAME[1]\n when \"Tuesday\"\n Time::RFC2822_DAY_NAME[2]\n when \"Wednesday\"\n Time::RFC2822_DAY_NAME[3]\n when \"Thursday\"\n Time::RFC2822_DAY_NAME[4]\n when \"Friday\"\n Time::RFC2822_DAY_NAME[5]\n when \"Saturday\"\n Time::RFC2822_DAY_NAME[6]\n else\n raise \"Error in convert_xanga_header_to_date with value=#{arr[0]}\"\n end\n \n arr[1] = case arr[1]\n when \"January\"\n Time::RFC2822_MONTH_NAME[0]\n when \"February\"\n Time::RFC2822_MONTH_NAME[1]\n when \"March\"\n Time::RFC2822_MONTH_NAME[2]\n when \"April\"\n Time::RFC2822_MONTH_NAME[3]\n when \"May\"\n Time::RFC2822_MONTH_NAME[4]\n when \"June\"\n Time::RFC2822_MONTH_NAME[5]\n when \"July\"\n Time::RFC2822_MONTH_NAME[6]\n when \"August\"\n Time::RFC2822_MONTH_NAME[7]\n when \"September\"\n Time::RFC2822_MONTH_NAME[8]\n when \"October\"\n Time::RFC2822_MONTH_NAME[9]\n when \"November\"\n Time::RFC2822_MONTH_NAME[10]\n when \"December\"\n Time::RFC2822_MONTH_NAME[11] \n else\n #p \"Error in convert_xanga_header_to_date with value=#{arr[0]}\"\n raise \"Error in convert_xanga_header_to_date with value=#{arr[0]}\"\n end\n \n return \"#{arr[0]}, #{arr[2]} #{arr[1]} #{arr[3]} \"\n end",
"def normalize_date(date)\r\n if date.chars.length==3\r\n norm_date = Date.strptime(date, '%m-%d')\r\n else\r\n norm_date = Date.strptime(date, '%m-%d-%y')\r\n end\r\n norm_date = norm_date.to_s\r\nend",
"def format_date(string)\n string.sub(/\\A(\\d\\d\\d\\d)(\\-|\\/)(\\d\\d)(\\-|\\/)(\\d\\d)/, '\\5.\\3.\\1')\nend",
"def jira_date str\n DateTime.parse(str)\n rescue => e\n puts \"Can not parse #{ str }: #{ e }\"\n nil\n end",
"def formatdate(date)\n p date.gsub(/^(\\d{4})([-\\/])(\\d{2})([-\\/])(\\d{2}$)/, '\\5.\\3.\\1') \nend",
"def validateDate(date)\n\n year = '[1-2][90][0-9][0-9]'\n month = '0[1-9]|10|11|12'\n day = '[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1]'\n hour = '[0-1][0-9]|2[0-3]|[1-9]'\n minute = '[0-5][0-9]'\n second = '[0-5][0-9]'\n case date\n when /^(#{year})(#{month})(#{day})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' 00:00:00'\n when /^(#{year})(#{month})(#{day})(#{hour})(#{minute})(#{second})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' ' + $4 + ':' + $5 + ':' + $6\n when /^(#{year})[\\:|\\.|\\-](#{month})[\\:|\\.|\\-](#{day})\\s(#{hour})[\\:](#{minute})[\\:](#{second})$/\n identifiedDate = $1 + ':' + $2 + ':' + $3 + ' ' + $4 + ':' + $5 + ':' + $6\n when /^(#{year})[\\:|\\.|\\-](#{month})[\\:|\\.|\\-](#{day})$/\n day = \"%02d\" % $3\n month = \"%02d\" % $2\n\n # Return the identified string\n $1 + ':' + month + ':' + day + ' 00:00:00'\n\n else\n\n # This wasn't a date we recognize\n false\n\n end\n end",
"def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end",
"def format_date(date_str)\n ans = Date._parse(date_str, false).values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday)\n Time.mktime(*ans)\n end",
"def convert_time(t)\n case t\n when nil then nil\n when Date then t.to_time.utc.iso8601(3)\n when Time then t.utc.iso8601(3)\n when String then Time.parse(t).utc.iso8601(3)\n else raise \"Invalid time format '#{t.class}'. Valid options are Time, Date, or String\"\n end\n rescue StandardError => e\n raise \"Failed to parse time value '#{t}'. #{e.message}\"\n end",
"def time_converter(string)\n # need to convert to UTC first before converting to date\n date = Time.at(string.to_i).utc.to_date\nend",
"def parse_time(time)\n time = \"0#{time}\" if time.match(/^\\d:\\d\\d/)\n time = time.gsub(/u/, '') if utime?\n time = time.gsub(/s/, '') if stime?\n\n time\n end",
"def formatConvertor(inputFormat)\n\n inputFormat.sub! 'DD', '%d'\n inputFormat.sub! 'YYYY', '%Y'\n inputFormat.sub! 'YY', '%Y'\n inputFormat.sub! 'MM', '%m'\n inputFormat.sub! 'hh', '%H'\n inputFormat.sub! 'mm', '%M'\n inputFormat.sub! 'ss', '%S'\n inputFormat.sub! 'HH', '%I' # HH - for hour of the clock (12 hour)\n inputFormat.sub! 'A/P', '%p'\n inputFormat.sub! 'MON', '%b' # Jan/Feb etc\n #inputFormat.sub! 'TZ', '%z' # TimeZone\n\n\nend",
"def validate_time(time)\n time=~/^([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/\nend",
"def get_date(d)\n return nil if d.nil?\n return d.to_time if d.is_a? DateTime\n\n if d.is_a? String\n\n begin\n dt = DateTime.parse(d).to_time\n rescue Exception => e\n raise \"invalid param #{d} - date should be in yyyy-mm-dd format\"\n end\n end\n end",
"def test_convert_xanga_header_to_wordpress_date\n str = @scraper.convert_xanga_header_to_wordpress_date(\"Sunday, April 30, 2006\")\n assert_equal(str, \"Sun, 30 Apr 2006 \") \n\n str = @scraper.convert_xanga_header_to_wordpress_date(\"Monday, April 03, 2006\")\n assert_equal(str, \"Mon, 03 Apr 2006 \") \n \n #malformed entries\n #\n assert_raise(RuntimeError) do #missing year\n str = @scraper.convert_xanga_header_to_wordpress_date(\"Monday, April 03, \")\n end\n \n assert_raise(RuntimeError) do #no space between\n str = @scraper.convert_xanga_header_to_wordpress_date(\"Monday, April 03,2006\")\n end\n \n assert_raise(RuntimeError) do #malformed dayofweek\n str = @scraper.convert_xanga_header_to_wordpress_date(\"Mon, April 03, 2006\")\n end\n \n assert_raise(RuntimeError ) do #malformed month\n str = @scraper.convert_xanga_header_to_wordpress_date(\"Monday, Apr 03, 2006\")\n end \n end",
"def rfc1123_date(time)\n time.getgm.strftime(\"%a, %d %b %Y %T GMT\")\n end",
"def format_date(original_date)\n date_regex = /\\A(\\d\\d\\d\\d)([\\-\\/])(\\d\\d)\\2(\\d\\d)\\z/\n original_date.sub(date_regex, '\\4.\\3.\\1')\nend",
"def strptime(str, format, now = now())\n parts_to_time(DateTime._strptime(str, format), now)\n end",
"def dmy_date(date)\n Time.gm(date.year, date.month, date.day)\n end",
"def to_time(t)\n if t.is_a?(::Time) then t\n else from_string(to_string(t)) end\n end",
"def parse_i18n_date(date_str)\n Date.strptime(date_str, I18n.t('date.formats.default'))\n end",
"def format_date(date)\n date.sub(/(\\d\\d\\d\\d)([\\-\\/])(\\d\\d)\\2(\\d\\d)/, '\\4.\\3.\\1')\nend",
"def parse_date(date, format = '%b, %d %Y')\n date.to_time.strftime(format)\n end",
"def formattimeanddate(unformattedtime)\n unformattedtime.strftime('%I:%M:%S %p - %d %m %Y')\n end",
"def make_date(time_object)\n month = time_object.strftime(\"%b \")\n day = time_object.strftime(\"%-d\")\n year = time_object.strftime(\", %Y \")\n mins = time_object.strftime(\":%M %P\")\n hour = time_object.strftime(\"%l\").to_i\n return month + day + year + hour.to_s + mins\n end",
"def convert_from_date_to_time(x)\n if x.class == Date\n x.to_time + 12.hours\n elsif x.class == DateTime || x.class == Time\n x\n end\nend",
"def format_date(date_str)\n puts date_str.sub(/(\\d{4})([\\-\\/])(\\d{2})\\2(\\d{2})/, '\\4.\\3.\\1') \nend",
"def validate_time(time)\n\t\tif time.is_a? Time\n\t\t\treturn time\n\t\telse\n\t\t\treturn Time.parse(time)\n\t\tend\n\tend",
"def local_to_p4_server_time(str_local_time)\n\tif (@regexp_date =~ str_local_time) then\n\t\tlocaltime = DateTime.strptime(\"#{str_local_time} #{@local_zone}\", \"@%Y/%m/%d %z\")\n\t\tservertime = localtime.new_offset(@p4_server_timezone)\n\t\treturn servertime.strftime(\"@%Y/%m/%d:%H:%M:%S\")\n\telsif (@regexp_date_time =~ str_local_time) then\n\t\tlocaltime = DateTime.strptime(\"#{str_local_time} #{@local_zone}\", \"@%Y/%m/%d:%H:%M:%S %z\")\n\t\tservertime = localtime.new_offset(@p4_server_timezone)\n\t\treturn servertime.strftime(\"@%Y/%m/%d:%H:%M:%S\")\t\t\t\n\tend\n\tputs \"Invalid P4 Date/Time String: #{str_local_time}\"\n\treturn str_local_time\nend",
"def datetime_pattern(field)\n pattern1 = field.scan(/[0-9]\\//)\n pattern2 = field.scan(/[0-9]\\-/)\n pattern3 = field.scan(/[0-9] /)\n pattern4 = field.scan(/[0-9] [A-Z][a-z][a-z] [0-9]|[0-9]-[A-Z][a-z][a-z]-[0-9]|[0-9] [a-z][a-z][a-z] [0-9]|[0-9]-[a-z][a-z][a-z]-[0-9]/)\n if(pattern1.size == 2||pattern2.size == 2||pattern3.size == 2||pattern4.size != 0)\n return true\n else\n return false\n end\nend",
"def parse_date_str (d)\r\n\t\t## Preconditions:\r\n\t\t# check format of date\r\n\t\tdate_arr = d.split(DATE_SPLIT_REGEX)\r\n\t\trtassert(date_arr.size() == 3, ArgumentError,\r\n\t\t\t\"cant recognise format of date '#{d}'\")\r\n\t\t# convert to hyphens as Ruby gets confused with slashes\r\n\t\tdate_str = date_arr.join('-')\r\n\t\t## Main:\r\n\t\t# try each of the supplied date formats\r\n\t\tDATE_FMTS.each { |fmt|\r\n\t\t\tbegin\r\n\t\t\t\tdate_obj = Date.strptime(date_str, fmt)\r\n\t\t\t\treturn date_obj\r\n\t\t\trescue ArgumentError\r\n\t\t\t\t# pass\r\n\t\t\tend\r\n\t\t}\r\n\t\t# try a brute force approach\r\n\t\tbegin\r\n\t\t\tdate_obj = Date.parse(date_str)\r\n\t\t\treturn date_obj \r\n\t\trescue\r\n\t\t\tpp date_arr\r\n\t\t\traise ArgumentError, \"can't recognise format of date '#{d}'\" \r\n\t\tend\r\n\tend",
"def convert_datetime(date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return nil if self[attribute + '(1i)'].nil? || self[attribute + '(2i)'].nil? || self[attribute + '(3i)'].nil? || self[attribute + '(4i)'].nil? || self[attribute + '(5i)'].nil? \n return Time.local(self[attribute + '(1i)'].to_i, self[attribute + '(2i)'].to_i, self[attribute + '(3i)'].to_i, self[attribute + '(4i)'].to_i, self[attribute + '(5i)'].to_i) \n end",
"def fast_string_to_time(string)\n if string =~ Format::ISO_DATETIME\n microsec = ($7.to_f * 1_000_000).to_i\n res = new_time $1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, microsec\n res\n end\n end",
"def conforms_to_dateTime_format(str)\n dateTimeRegex = /\\A(?:(?!0000)\\d{4})(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\\d|3[0-1])(T([01]\\d|2[0-3]):[0-5]\\d:([0-5]\\d|60)(\\.\\d+)?(Z|(\\+|-)((0\\d|1[0-3]):[0-5]\\d|14:00)))?)?)?\\z/\n dateTimeRegex.match(str)\n end",
"def grabTime(str)\n if /(\\,\\s)(\\d.+\\.\\m\\.)/.match(str)\n /(\\,\\s)(\\d.+\\.\\m\\.)/.match(str)[2]\n else\n \"Ongoing\"\n end\n end",
"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 time_from_header(t)\n Time.httpdate(t).to_i if t\n rescue ArgumentError\n end",
"def parse_date\n REGEX_DATE.match(@request[FTIME]) ? Date.parse($1) : nil\n end",
"def parseTime(time)\n if(time.nil?)\n return nil ;\n elsif(time.is_a?(String))\n return Time.parse(time, DefaultDate) ;\n elsif(time.is_a?(Time))\n return time ;\n else\n raise \"can not convert to Time Object from :\" + time.inspect ;\n end\n end"
] | [
"0.5951585",
"0.5889467",
"0.58410645",
"0.57982683",
"0.5765599",
"0.57129186",
"0.5571597",
"0.55484813",
"0.5530741",
"0.55292076",
"0.55292076",
"0.5505673",
"0.5407936",
"0.5393655",
"0.53103215",
"0.52918607",
"0.52897197",
"0.528925",
"0.52817166",
"0.5250026",
"0.5245295",
"0.52443886",
"0.5224633",
"0.5219562",
"0.5212936",
"0.5180714",
"0.51674503",
"0.5166071",
"0.5154669",
"0.51410425",
"0.5123554",
"0.5120868",
"0.5115355",
"0.5111917",
"0.5107517",
"0.50965774",
"0.5087423",
"0.50633216",
"0.5053377",
"0.50418043",
"0.5030972",
"0.50270677",
"0.50229317",
"0.5022593",
"0.5012541",
"0.5006724",
"0.49946865",
"0.49884856",
"0.49816236",
"0.498153",
"0.498153",
"0.49680406",
"0.49517748",
"0.49511144",
"0.49495602",
"0.4947292",
"0.49243748",
"0.49206826",
"0.4919504",
"0.49189246",
"0.491379",
"0.49035734",
"0.49034578",
"0.48990119",
"0.4898911",
"0.489879",
"0.4896476",
"0.48924184",
"0.48908922",
"0.48855707",
"0.4885394",
"0.48853108",
"0.48843",
"0.48839846",
"0.48781756",
"0.48730385",
"0.48605034",
"0.48489857",
"0.48489577",
"0.48479792",
"0.48456508",
"0.48390853",
"0.48366937",
"0.48311123",
"0.48298484",
"0.4826334",
"0.4824191",
"0.48215675",
"0.48210713",
"0.48169664",
"0.48112145",
"0.48078102",
"0.4798087",
"0.47963846",
"0.47898802",
"0.47878024",
"0.47872338",
"0.47815865",
"0.4781005",
"0.47754946"
] | 0.69752795 | 0 |
Renders the HTML of the content area. Override this when subclassing. | def render
"<div id=\"#{self.area_type}_#{self.id}\">#{self.html}</div>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 render\n content\n end",
"def render\n @formatted_content.each &:render\n end",
"def contents\n rendered_contents\n end",
"def content\n View.render\n ensure\n self.class.reset\n end",
"def render\n raise NotImplementedError.new \"Please override 'render' in your \"+\n \"concrete implementation\"\n end",
"def render\n content\n end",
"def render\n content\n end",
"def render\n content\n end",
"def render\n raise NotImplementedError, \"Subclasses must implement a render method\"\n end",
"def render\n raise NotImplementedError, 'this should be overridden by concrete sub-class'\n end",
"def html\n content_tag(tag_name, content, @html_options)\n end",
"def render\n # To be implemented.\n end",
"def render\n raise NotImplementedError, \"#{self.class} must implement a `#render` method to format its output.\"\n end",
"def render\n raise NotImplementedError, \"#{self.class} must implement a `#render` method to format its output.\"\n end",
"def content\n require theme_path\n this = self # needed because Markaby is based on `instance_eval`\n @builder = Trinity::Builder.new(:indent => 2)\n @builder.instruct!\n @builder.declare! :DOCTYPE, :html, :PUBLIC, \"-//W3C//DTD XHTML+RDFa 1.0//EN\", \"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd\"\n @builder.html(:xmlns => 'http://www.w3.org/1999/xhtml') do\n head { this.render_html_head }\n body { this.render_html_body }\n end\n @builder.to_s\n end",
"def rendered; end",
"def content(data = {}, &block)\n @renderer.render(get_data(data), &block)\n end",
"def render_html_body\n # FIXME actually render the text\n renderer.new(body).to_html\n end",
"def to_s\n content_tag :div, id: @id, class: container_classes do\n @content.call(self)\n end\n end",
"def render\r\n if self.has_content?\r\n self.to_a.inject(''){|loop_str, i|\r\n loop_str += i.nodes.inject(''){|nodes_str, j|\r\n nodes_str += j.render\r\n }\r\n }\r\n else\r\n ''\r\n end\r\n end",
"def content\n\t\t@content\n\tend",
"def render *args\n @content\n end",
"def layout_contents\n layout.render(self)\n end",
"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 content\n return @content if @content\n rc = RedCloth.new(syntax_highlight(File.read(content_file)))\n rc.hard_breaks = false\n rc.no_span_caps = true\n @content = rc.to_html\n end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content\n @blocks.map {|b| b.render } * EOL\n end",
"def content\n end",
"def content\n end",
"def content\n end",
"def render\n end",
"def inner_html\n # This sets up the inner html for the to_html call\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 html_contents\n layout_contents\n end",
"def content\n @row.html\n end",
"def render\n raise NotImplementedError\n end",
"def body\n HTML.render render_md, options\n end",
"def content\n case @context\n when :preamble, :open\n @blocks.map {|b| b.render }.join\n # lists get iterated in the template (for now)\n # list items recurse into this block when their text and content methods are called\n when :ulist, :olist, :dlist, :colist\n @buffer\n when :listing, :literal\n apply_literal_subs(@buffer)\n when :pass\n apply_passthrough_subs(@buffer)\n when :admonition, :example, :sidebar, :quote, :verse\n if !@buffer.nil?\n apply_para_subs(@buffer)\n else\n @blocks.map {|b| b.render }.join\n end\n else\n apply_para_subs(@buffer)\n end\n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end",
"def inner_html(*args); end",
"def inner_html(*args); end",
"def body_content\n div(:id => :container, :class => container_classes().join(' ')) do\n header(:class => header_classes().join(' ')) do\n header_content()\n end\n div(:id => :main, :role => :main, :class => main_classes().join(' ')) do\n main_content()\n end\n footer(:class => footer_classes().join(' ')) do\n footer_content()\n end\n end\n #JavaScript at the bottom for fast page loading\n scripts()\n end",
"def to_s\n content_tag :div, id: @id, class: 'tab-content' + @class do\n @content.call(self)\n end\n end",
"def render\n Vedeu::Output::Viewport.render(current)\n end",
"def display_as_html(content, &block)\n content = content.presence || \"\"\n if content !~ /<\\w+[^>]>/\n content = content.gsub(\"\\n\", \"<br />\")\n end\n content_tag :div, :class => \"rtf\" do\n if block_given?\n concat(capture(&block))\n end\n concat(content.html_safe)\n end\n end",
"def display_as_html(content, &block)\n content = content.presence || \"\"\n if content !~ /<\\w+[^>]>/\n content = content.gsub(\"\\n\", \"<br />\")\n end\n content_tag :div, :class => \"rtf\" do\n if block_given?\n concat(capture(&block))\n end\n concat(content.html_safe)\n end\n end",
"def content\n @content\n end",
"def content\n h @content\n end",
"def content\n content = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" ' +\n '\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">' +\n '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>' + title + '</title>' +\n ' <link href=\"http://www.uio.no/profil/kupu/kupucontentstyles.css\" type=\"text/css\" rel=\"stylesheet\"/>' +\n '</head><body>'\n if(body)\n content += body\n end\n content += '</body></html>'\n end",
"def display\n @body\n end",
"def to_html\n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end",
"def render(_context)\n @browser_url = @attributes['url']\n render_header + render_contents + render_url + render_footer\n end",
"def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end",
"def html_content\n # Individual presenters may override to present content\n @object.content&.html_safe if @object.respond_to? :content\n end",
"def evaluate\n super\n content\n end",
"def content\n @content \n end",
"def render\n return \"\" if links.empty?\n\n # Loop through all but the last (current) link and build HTML of the fragments\n fragments = links[0..-2].map do |link|\n render_fragment(options[:fragment_tag], link.text, link.url, options[:semantic])\n end\n\n # The current link is handled a little differently, and is only linked if specified in the options\n current_link = links.last\n fragments << render_fragment(options[:fragment_tag], current_link.text, (options[:link_current] ? current_link.url : nil), options[:semantic], class: options[:current_class])\n\n # Build the final HTML\n html = (options[:pretext] + fragments.join(options[:separator]) + options[:posttext]).html_safe\n content_tag(options[:container_tag], html, id: options[:id], class: options[:class])\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 render\n Vedeu.render_output(output) if visible?\n end",
"def render\n raise NotImplementedError\n end",
"def body\n output = Renderer.render renderer_template, body_locals\n output = edit_body(output) if options[:editor]\n output\n end",
"def render_plain\n template_content\n end",
"def render\n @result_html = ''\n @result_html += \"<div class=\\\"rs-container #{self.class.name}\\\" id=\\\"#{@id}\\\">\"\n @result_html += render_controls.gsub(\"<option value=\\\"rs-#{@effect}\\\">\",\n \"<option value=\\\"rs-#{@effect}\\\" selected=\\\"selected\\\">\")\n @result_html += \"<div class=\\\"rs-wrapper\\\">\"\n @result_html += \"<div class=\\\"rs-shadow\\\"></div>\"\n @result_html += '<div class=\"rs-images\">'\n @images_urls.each do |url|\n @result_html += \"<img src=\\\"#{url}\\\"/>\"\n end\n @result_html += '</div>'\n @result_html += '<div class=\"rs-cover\">'\n @result_html += '<a class=\"rs-animation-command rs-pause\" href=\"javascript:void(0)\">Play/Pause</a>'\n @result_html += \"<img src=\\\"#{@images_urls.first}\\\"/>\"\n @result_html += '</div>'\n @result_html += '<div class=\"rs-transition\">'\n @result_html += render_flips\n @result_html += render_multi_flips\n @result_html += render_cubes\n @result_html += render_unfolds\n @result_html += '</div>'\n @result_html += '</div>'\n @result_html += render_bullets\n @result_html += '</div>'\n\n @result_html.html_safe\n end",
"def content\n call_block\n end",
"def render_show_page\n render_buffer current_theme.questions_show_html.read\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def content\n return @content\n end",
"def render(*)\n raise NotImplementedError.new(\"Implement a render function in a subclass\")\n end",
"def content\n MarkdownService.new.render(body).html_safe \n end",
"def to_html; end",
"def render\n generate_content\n @pdf.render\n end",
"def render\n Vedeu.renderers.render(output) if Vedeu.ready?\n end",
"def content_for(*args,&block)\n if block\n helpers.content_for(*args,&block)\n else\n rawtext(helpers.content_for(*args))\n ''\n end\n end",
"def jqm_content(&block)\n content_tag(:div, :'data-role' => \"content\", &block)\n end",
"def capture(*args)\n super.html_safe\n end",
"def content!\n @raw = nil # force to reload it\n self.content\n end",
"def content\n page.formatted_data\n end",
"def build_html\n ApplicationController.render(partial: partial, locals: locals)\n end",
"def render(props)\n # HTML.\n end"
] | [
"0.7233795",
"0.7211744",
"0.67436135",
"0.6694986",
"0.66359633",
"0.6602076",
"0.651752",
"0.651752",
"0.651752",
"0.644749",
"0.64197665",
"0.6363826",
"0.6309588",
"0.62979513",
"0.62979513",
"0.6270325",
"0.625531",
"0.6246514",
"0.6240853",
"0.6235164",
"0.62193274",
"0.61735266",
"0.6166072",
"0.61629",
"0.6141301",
"0.61256546",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.611653",
"0.6111938",
"0.6100207",
"0.6100207",
"0.6100207",
"0.60954297",
"0.6078971",
"0.6071936",
"0.60611296",
"0.603898",
"0.60359955",
"0.600341",
"0.5993208",
"0.5984952",
"0.59769326",
"0.59769326",
"0.5945326",
"0.59427583",
"0.59336567",
"0.5931393",
"0.5931393",
"0.59300077",
"0.5922024",
"0.5914459",
"0.59123063",
"0.5909052",
"0.5902704",
"0.5900761",
"0.5899375",
"0.58960897",
"0.5875392",
"0.5871008",
"0.58614296",
"0.58610636",
"0.5842567",
"0.58409363",
"0.5814786",
"0.58101916",
"0.5806981",
"0.57937396",
"0.57849264",
"0.5780966",
"0.5778245",
"0.5778245",
"0.5778245",
"0.5778245",
"0.5778245",
"0.5778245",
"0.5774738",
"0.5769559",
"0.5768654",
"0.57666314",
"0.57486194",
"0.5734189",
"0.5732267",
"0.5725522",
"0.5709608",
"0.5707337",
"0.5692267",
"0.5677153"
] | 0.6499691 | 10 |
A convenience for querying by class name. | def set_area_type
self.area_type = self.class.to_s.underscore
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_class_named name\n return self if full_name == name\n return self if @name == name\n\n @classes.values.find do |klass|\n next if klass == self\n klass.find_class_named name\n end\n end",
"def find_class_named name\n @classes_hash[name]\n end",
"def class_by_name name\n # http://stackoverflow.com/questions/14070369/how-to-instantiate-class-from-name-string-in-rails\n Object.const_get name.to_s\n\n end",
"def get_class(name)\n name.split(/::/).inject(Object) { |p, n| p.const_get(n) } \n end",
"def get_class(name)\n # 'self' -- the class from which get_class is called.\n self.const_get(name)\n end",
"def objects_of_class(name)\n find_all { |r| name === r['class'] }\n end",
"def get_class_by_name( name )\n raise \"get_class_by_name #{name}.#{name.class}\" unless name.is_a?(Symbol)\n c = classes[name]\n #puts \"MISS, no class #{name} #{name.class}\" unless c # \" #{classes}\"\n #puts \"CLAZZ, #{name} #{c.get_type.get_length}\" if c\n c\n end",
"def find(name)\n @@subclasses.fetch(name.to_s, nil)\n end",
"def find_by_trying(class_name)\n @namespaces.find do |namespace|\n begin\n break namespace.const_get(class_name)\n rescue NameError\n end\n end\n end",
"def find_by_trying(class_name)\n @namespaces.find do |namespace|\n begin\n break namespace.const_get(class_name)\n rescue NameError\n end\n end\n end",
"def findExactClassMatch(name)\n fname = name.tr(':', '_')\n return ClassIndex.classExists?(fname)\n end",
"def class_get class_name\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\tproviders.each do |p|\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\treturn p.class_get(class_name) \n\t\t\t\t\t\trescue NotExist;\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\traise \"Class '#{class_name}' doesn't exist!\"\n\t\t\t\tend\n\t\t\tend",
"def classByName(className)\r\n\t\t# we keep a blacklist of classes. For instance\r\n\t\t# if you are using say QT, you'll have constant references\r\n\t\t# to QObject, that is not in your tag files.\r\n\t\t# to avoid checking all the tags looking for this class\r\n\t\t# each time that I'm asked for it, I just blacklist it once for all.\r\n\t\t# this happened with KoRect in kword, and the time went from\r\n\t\t# 12 seconds to instantaneous...\r\n\t\t#return nil if @blacklist.include?(className)\r\n\t\t@classTags.each { |tag|\r\n\t\t\t\t#puts \"classByName: found \" + tag.name\r\n\t\t\tif (tag.name == className)\r\n\t\t\t\treturn tag\r\n\t\t\tend\r\n\t\t}\r\n\t\t\r\n\t\treturn nil\r\n\tend",
"def get_class(cname, mdl = Processor)\n mdl.const_get(cname.split(/[\\,\\_]/).map { |p| p.capitalize }.join)\n rescue NameError\n return nil\n end",
"def get_class(class_name)\n Module.const_get(class_name)\n rescue\n nil\n end",
"def find_class(class_name)\n begin\n klass = Module.const_get(class_name)\n return (klass.is_a?(Class) ? klass : nil)\n rescue NameError\n return nil\n end\n end",
"def class_from_string(class_name)\n parts = class_name.split('::')\n constant = Object\n parts.each do |part|\n constant = constant.const_get(part)\n end\n constant\nend",
"def get_class(class_name)\n klass = Module.const_get(class_name)\n return nil unless klass.is_a?(Class)\n return klass\n rescue NameError\n return nil\n end",
"def find_class_named_from name, from\n from = find_class_named from unless RDoc::Context === from\n\n until RDoc::TopLevel === from do\n return nil unless from\n\n klass = from.find_class_named name\n return klass if klass\n\n from = from.parent\n end\n\n find_class_named name\n end",
"def class_for_name qualified_name\n raise unless ::Class === (resolved = ::Object.const_get qualified_name, false)\n resolved\n rescue\n raise ::NameError, %(Could not resolve class for name: #{qualified_name})\n end",
"def find_by_id(class_name)\n class_name.find_by(id: params[:id])\n end",
"def findClassesThatMatch(name)\n fname = name.tr(':', '_')\n return ClassIndex.findClasses(fname)\n end",
"def klass(class_name)\n Atlas.const_get(class_name)\n end",
"def get(name)\n name = camelize(name) if name.downcase == name\n begin\n Object.const_get(name)\n rescue NameError\n nil\n end\n end",
"def find_by_name(name)\n find do |event|\n event.job_class_name == name.to_s\n end\n end",
"def class_of(short_name)\n fqn(short_name).constantize\n end",
"def lookup_class\r\n ObjectSpace.each_object(Class) do |obj|\r\n return obj if obj.ancestors.include?(Rails::Generator::Base) and\r\n obj.name.split('::').last == class_name\r\n end\r\n raise NameError, \"Missing #{class_name} class in #{class_file}\"\r\n end",
"def get_class_by_name!(name , super_class = :Object)\n c = get_class_by_name(name)\n return c if c\n create_class( name ,super_class)\n end",
"def find_class_or_module name\n name = $' if name =~ /^::/\n @classes_hash[name] || @modules_hash[name]\n end",
"def method_missing(name, *arguments)\n str_name = name.to_s\n\n if str_name =~ /\\w+\\?/ && Types::NAMES.include?(str_name.chop)\n klass_name = str_name.sub(/\\?/, '').capitalize\n self.class.class_name == klass_name\n else\n raise NoMethodError, \"undefined method: #{name}\"\n end\n end",
"def search_class\n klass = if args[1]\n target.eval(args[1])\n else\n target_self\n end\n\n klass.is_a?(Module) ? klass : klass.class\n end",
"def get_class_ref(class_name)\n klass = Kernel\n class_name.split(\"::\").each do |name|\n if klass.const_defined? name\n klass = klass.const_get(name)\n else\n return nil\n end\n end\n klass\n end",
"def class\n `$q(this.__native__.className)`\n end",
"def find_with_const_defined(class_name)\n @namespaces.find do |namespace|\n if namespace.const_defined?(class_name)\n break namespace.const_get(class_name)\n end\n end\n end",
"def find_with_const_defined(class_name)\n @namespaces.find do |namespace|\n if namespace.const_defined?(class_name)\n break namespace.const_get(class_name)\n end\n end\n end",
"def get_as_class_name ruby_class_name\n mapping = @ruby_mappings[ruby_class_name]\n return mapping.nil? ? nil : mapping.as\n end",
"def get_const_by_name(name)\n consts = name.split(\"::\")\n obj = Object\n begin\n consts.each{|const| \n obj = obj.const_get(const)\n }\n rescue\n Log.logger_for(:configuration).error(\"No such class defined: #{name}\")\n end\n return obj\n end",
"def name\n @class_name\n end",
"def find_class_or_module name\n @store.find_class_or_module name\n end",
"def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end",
"def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end",
"def check_class_by(check_name)\n Kernel.const_get(\n \"Ossert::Classifiers::Check::#{check_name.capitalize}\"\n )\n end",
"def get_type_by_class_name(name)\n clazz = get_class_by_name(name)\n return nil unless clazz\n clazz.instance_type\n end",
"def class_name\n fetch('heroes_of_the_storm.class_names')\n end",
"def class_from_name\n if model_name.to_s.include? \"_\"\n ns, *klass = model_name.to_s.split(\"_\").collect(&:camelize)\n begin\n \"#{ns}::#{klass.join(\"\")}\".constantize\n rescue NameError\n \"#{ns}#{klass.join(\"\")}\".constantize\n end\n else\n model_name.to_s.camelize.constantize\n end\n end",
"def class_for_path(path)\n path.split('::').inject(Kernel) do |scope, const_name|\n scope.const_get(const_name)\n end\n end",
"def find_by_name(name)\n end",
"def current_class( class_code )\n self.classes.select{|c| c.class_code == class_code }.first\n end",
"def lookup_task_klass(klass_name)\n if Object.const_defined?(klass_name)\n klass_name.constantize\n else\n Task.descendants.find do |descendant|\n descendant.name.demodulize == klass_name\n end\n end\n end",
"def chef_query_class\n @chef_query_class ||= ::Chef::Search::Query\n end",
"def class_name\n return @options[:class_name] if not @options[:class_name].nil?\n class_main_found = false\n @catalog['resources'].each_with_index do |r,i|\n if r['type'] == 'Class' and r['title'] == 'main'\n class_main_found = true\n next\n end\n if class_main_found and r['type'] == 'Class'\n return r['title'].downcase\n end\n end\n end",
"def clazz( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::ClassInfo.new( self, name )\n\t\t\tend",
"def select_by_class_exists(class_name)\n return select_by_class(class_name).exist?\nend",
"def determine_class_for names\n klass = names.first\n if AX.const_defined? klass, false\n AX.const_get klass\n else\n create_class *names\n end\n end",
"def has_class?(name)\n @class_syms ||= classes.map(&:to_sym)\n @class_syms.include?(name.to_sym)\n end",
"def object_class(klass)\n @object_classes[klass.to_s.tr('-', '_').downcase]\n end",
"def clazz\n Module.const_get(name)\n rescue NameError\n nil\n end",
"def class_name\n self.class == Class ? self.name : self.class.name\n end",
"def has_class?(c)\n find_all do |q|\n n=q.get_attribute(\"class\").split(\" \")\n n.index(c.to_s)\n end\n end",
"def find_by_name(name)\n types[name]\n end",
"def display_class(name)\n klass = class_cache[name]\n @display.display_class_info klass\n end",
"def find_by_name(name)\n binding.pry\n self.name\n end",
"def lookup_name(namecase = nil)\n if namecase == :underscore\n name(namecase)\n else\n @lookup_name ||= class_name.tr('::', '')\n end\n end",
"def name\n @klass\n end",
"def class_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 1]\n end",
"def class_name\n name = @klass.name\n name.name\n end",
"def find_by_name(name)\n raise TypeError, 'name must respond to #to_sym' unless name.respond_to?(:to_sym)\n name = name.to_sym\n \n all.find { |event_class| event_class.name == name }\n end",
"def find(name)\n instances.find { |instance| instance.name == (name) }\n end",
"def class_exists?(class_name)\n begin\n class_name.constantize\n true\n rescue NameError => ne\n false\n end\n end",
"def class_name\n @class_name ||= active_record.name\n end",
"def to_class(name)\n return name unless name.is_a? String\n\n # NOTE: DO NOT try to use const_defined? and const_get EVER.\n # This is Rails, use constantize\n name.constantize\n rescue NameError\n Logger.error \"`#{name}` is not a valid Class name.\"\n end",
"def class_exists?(classname)\n str = classname.to_s\n eval(\"defined?(#{str}) && #{str}.is_a?(Class)\") == true\nend",
"def class_exists? string\n\tc = Object.const_get string\n\treturn c.is_a? Class\nrescue NameError\n\treturn false\nend",
"def find_object(name); end",
"def get_class(dns_query, parsed_dns)\n RECORD_CLASS[get_rdata_value(dns_query, parsed_dns, SHORT_LENGTH).to_i]\n end",
"def instances_of(class_name, options = {})\n unless class_name.is_a?(Class)\n # class_name is actually an instance of the class to search for, not the class itself.\n class_name = class_name.class\n end\n @_componentable_container.select do |name, component|\n component.is_a?(class_name)\n end.keys\n end",
"def resource_klass(name)\n eval('RedboothRuby::' + camelize(name)) rescue nil\n end",
"def record_class(name, mod=ICloud::Records)\n sym = name.capitalize.sub(/s$/, \"\").to_sym\n mod.const_get(sym) if mod.const_defined?(sym)\n end",
"def classes(name = nil)\n if name\n classes.find(:name => name)\n else\n @classes.flatten\n end\n end",
"def find name\n object = objects.find { |o| o.name == name.to_s }\n end",
"def class_name\n self.class.name.split(\"::\").last.downcase\n end",
"def get_class(class_id)\n return GTBS.get_class_skill_name(class_id)\n end",
"def klass_for(name)\n @comparators ? @comparators[name] : nil\n end",
"def class_unqualified_name(clazz)\n name = clazz.name\n if name =~ /::([^:]+)$/\n $1\n else\n name\n end\n end",
"def class_exists?(class_name)\n klass = Module.const_get(class_name)\n return klass.is_a?(Class)\nrescue NameError\n return false\nend",
"def to_class(model_name)\r\n Kernel.const_get(model_name.to_s.camelize)\r\n end",
"def for(name, obj = nil)\n on(obj).where(:name => name.to_s.downcase)\n end",
"def class_from_cell_name(cell_name)\n \"#{cell_name}_cell\".classify.constantize\n end",
"def class_from_cell_name(cell_name)\n \"#{cell_name}_cell\".classify.constantize\n end",
"def resolve_class object\n ::Class === object ? object : (::String === object ? (class_for_name object) : nil)\n end",
"def query\n self.class.instances.each do |mod|\n return mod.properties if mod.name == name || mod.name.downcase == name\n end\n nil\n end",
"def full_class_name\n @class_names.join(\"::\")\n end",
"def find_by_name(name)\n find_by('name', name)\n end",
"def find_class_method_named(name)\n @method_list.find { |meth| meth.singleton && meth.name == name }\n end",
"def query(*names)\n Technology.where(\n type: get_all(*names).map { |klass| klass.to_s.demodulize }\n )\n end",
"def name_from_object(class_name)\n class_name.split('::').last\n end",
"def class_name\n self.class.name.split(\"::\").last\n end",
"def display_name(name)\n if class_cache.key? name then\n method_map = display_class name\n elsif name =~ /::|\\#|\\./ then\n method = nil\n klass, = parse_name name\n\n klass = expand_klass klass unless class_cache.key? klass\n\n orig_klass = klass\n orig_name = name\n\n loop do\n method = lookup_method name, klass\n\n break if method\n\n ancestor = lookup_ancestor klass, orig_klass\n\n break unless ancestor\n\n name = name.sub klass, ancestor\n klass = ancestor\n end\n\n raise NotFoundError, orig_name unless method\n\n display_method method\n else\n methods = select_methods(/#{name}/)\n\n if methods.size == 0\n raise NotFoundError, name\n elsif methods.size == 1\n display_method methods[0]\n else\n @display.display_method_list methods\n end\n end\n end",
"def name_and_class\n [name, self['class']].compact.join('.')\n end",
"def class_name(table_name = table_name) # :nodoc:\n # remove any prefix and/or suffix from the table name\n class_name = Inflector.camelize(table_name[table_name_prefix.length..-(table_name_suffix.length + 1)])\n class_name = Inflector.singularize(class_name) if pluralize_table_names\n return class_name\n end",
"def class_for(cls)\n return nil unless cls # superclass will return nil when none\n fqn = cls.qualified_type_name\n return classes[fqn] if classes[fqn]\n classes[fqn] = JClass.parse(self, cls)\n end"
] | [
"0.7398551",
"0.73979735",
"0.7224652",
"0.69953656",
"0.6864424",
"0.68186224",
"0.67606074",
"0.67433846",
"0.6677455",
"0.6677455",
"0.66496605",
"0.6623482",
"0.6602346",
"0.6549006",
"0.65239614",
"0.65157294",
"0.64798725",
"0.6367363",
"0.6359032",
"0.6351046",
"0.6342254",
"0.6311952",
"0.62901413",
"0.62277883",
"0.6214243",
"0.61739326",
"0.61566913",
"0.6109268",
"0.6045957",
"0.60453755",
"0.6043031",
"0.6042405",
"0.60321605",
"0.6022676",
"0.6022676",
"0.60211515",
"0.6020909",
"0.6014164",
"0.6007093",
"0.5988188",
"0.5988188",
"0.5986619",
"0.59865284",
"0.59802616",
"0.596936",
"0.596366",
"0.5955737",
"0.5947725",
"0.59409034",
"0.5935676",
"0.59320307",
"0.5931458",
"0.59306747",
"0.59284675",
"0.59232193",
"0.5922385",
"0.5904255",
"0.5890067",
"0.5865229",
"0.58192414",
"0.5804054",
"0.5793745",
"0.57886016",
"0.5780731",
"0.57765114",
"0.5776083",
"0.57759535",
"0.57753974",
"0.57749975",
"0.57730335",
"0.5769001",
"0.5768432",
"0.57648504",
"0.5758231",
"0.5727838",
"0.57257503",
"0.5723602",
"0.5713319",
"0.57089585",
"0.57013553",
"0.56862867",
"0.5681448",
"0.5672522",
"0.5672121",
"0.566538",
"0.564854",
"0.5645948",
"0.56228447",
"0.56228447",
"0.56181717",
"0.5616626",
"0.56157374",
"0.56130457",
"0.56101084",
"0.5606071",
"0.55989784",
"0.55955",
"0.55945456",
"0.55942076",
"0.55919546",
"0.5589236"
] | 0.0 | -1 |
Admin users can customize the prompt that is shown next to the checkbox that a committee member clicks to say whether or not they will participate for a given quarter. If the admins leave this value blank, then we return a default value of "I can participate for". | def active_action_text
read_attribute(:active_action_text).blank? ? "I can participate for" : read_attribute(:active_action_text)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quarterName\n qtrName = \"\"\n case self.enclaveQuarter\n when 1\n qtrName = \"First\"\n when 2\n qtrName = \"Second\"\n when 3\n qtrName = \"Third\"\n when 4\n qtrName = \"Fourth\"\n end\n qtrName\n end",
"def name () to_s unless quarter.blank? || year.blank? end",
"def quarter\n puts 'Dispensed quarter'\n end",
"def quarter\n puts 'Dispensed quarter'\n end",
"def title\n alternate_title.blank? ? quarter.title : alternate_title\n end",
"def required_value(form)\n # if form allows incompletes, question is required only if the answer to 'are there missing answers' is 'no'\n form.allow_incomplete? ? \"selected(/data/#{IR_QUESTION}, 'no')\" : \"true()\"\n end",
"def confirm(question, default_value)\n yn_opts = default_value ? \"Y/n\" : \"y/N\"\n value = ask \"#{question} (#{yn_opts}) \", nil\n\n # Convert to true/false\n dummy_option = Configuration::Option.new({})\n value = dummy_option.convert(value)\n\n return default_value if value.nil? || value.kind_of?(String)\n value\n end",
"def title\n title = \"#{name}\"\n title << \" #{quarter_offered.title}\" if quarter_offered\n title\n end",
"def ask_with_default(question, default='')\n user_answer = ask(\"#{question} (default: #{default.to_s})\").strip\n user_answer.empty? ? default : user_answer\nend",
"def current_quarter\n \n case self.month\n \n when 1..3 then 1\n when 4..6 then 2\n when 7..9 then 3\n else 4\n end\n \n end",
"def first_quarter\n return first_taken_quarter if any_taken_courses?\n return first_planned_quarter if any_planned_courses?\n nil\n end",
"def questioning\n return text\n end",
"def questioning\n return text\n end",
"def default_value\n return :not_applicable if c100.consent_order? || c100.child_protection_cases?\n\n GenericYesNo::NO\n end",
"def qts_award_year_answer\n year_for_answer = MathsAndPhysics.first_eligible_qts_award_year(claim_academic_year)\n year_for_answer -= 1 if awarded_qualified_status_before_cut_off_date?\n\n I18n.t(\"answers.qts_award_years.#{qts_award_year}\", year: year_for_answer.to_s(:long))\n end",
"def render_proquest_status(thesis)\n status = evaluate_proquest_status(thesis)\n return 'Opt-in status not reconciled' if status == 'conflict'\n return 'No opt-in status selected' if status.nil?\n return 'Yes' if status == true\n return 'No' if status == false\n end",
"def provide(prompt, options={})\n options.reverse_merge! required: true, default: nil\n required = options[:required] && !options[:default]\n\n prompt << \" (leave blank for #{options[:default]})\" if options[:default]\n prompt << \": \"\n\n response = ask(prompt.blue) { |q| q.validate = /\\S+/ if required }\n response.present? ? response : options[:default]\n end",
"def show_title paid\n paid ? 'Total Paid' : 'Total Due'\n end",
"def donation_request_explanation_with_default\n donation_request_explanation_without_default || Configuration.default_donation_message % owner.display_name\n end",
"def choice_option\n \"#{assigned_at.to_date.to_s} (#{user_name})\"\n end",
"def quarters_remaining\n return \"Degree Completed\" if degree_completed?\n return_block_or_error_message do\n Quarter.num_quarters_between(first_planned_quarter, last_planned_quarter)\n end\n end",
"def ask_question\n puts \"#{@current_player.name} what is the answer to: #{@a} #{@operator} #{@b} = ?\"\n end",
"def ask_questions\n super\n print \"What was your reason for joining? \"\n self.reason_for_joining = gets.strip.chomp\n end",
"def ask(question, default='')\n question = \"\\n\" + question.join(\"\\n\") if question.respond_to?(:uniq)\n answer = Capistrano::CLI.ui.ask(space(question)).strip\n answer.empty? ? default : answer\n end",
"def ask(question, default='')\n question = \"\\n\" + question.join(\"\\n\") if question.respond_to?(:uniq)\n answer = Capistrano::CLI.ui.ask(space(question)).strip\n answer.empty? ? default : answer\n end",
"def get_formatted_question_type\n type = self.type\n statement = ''\n if type == 'TrueFalse'\n statement = 'True/False'\n elsif type == 'MultipleChoiceCheckbox'\n statement = 'Multiple Choice - Checked'\n elsif type == 'MultipleChoiceRadio'\n statement = 'Multiple Choice - Radio'\n end\n statement\n end",
"def form_submit_button; @form_submit_button ||= 'Soumettre le quiz' end",
"def message_text\n user_option = user&.send(option_name(@option))\n\n user_option_text = if user_option\n \"_Current state:_ \" + user_option\n else\n 'This setting was not set for you yet.'\n end\n\n \"*#{option_button(@option)}*\\n#{user_option_text}\"\n end",
"def ask_questionaire\n alert_reserved_and_exit if git.reserved_branch?\n announce\n ask_title\n ask_label\n ask_pivotal_ids if config.use_pivotal_tracker\n ask_jira_ids if config.use_jira\n end",
"def current_quarter?\n self == Quarter.current_quarter\n end",
"def ask_with_default(question, color, default)\n question = (question.split(\"?\") << \" [#{default}]?\").join\n answer = ask(question, color)\n answer.to_s.strip.empty? ? default : answer\nend",
"def last_quarter\n return last_planned_quarter if any_planned_courses?\n return last_taken_quarter if any_taken_courses?\n nil\n end",
"def use_quarters?\n term_system == \"Quarters\"\n end",
"def admin_new_qual_label\n center_name = \"unspecified\"\n if !center.nil?\n center_name = center.name\n end\n \"#{program.name}: (#{course_provider}@#{center_name}) ##{id}\"\n end",
"def choice(message, choices)\n default = default(choices)\n message = message + \" [\" + choices.split('').join('/') + \"] ? \"\n if non_interactive and default.nil?\n raise \"--yes fails because '#{choices}' has no default value for question '#{message}'\"\n elsif non_interactive\n puts message + default\n return default.downcase\n else\n value = ask(message, String) { |q| q.in = choices.downcase.split(\"\"); }\n return value.downcase\n end\n end",
"def prompt(question, default: nil)\n answer = ask(question) \n answer.empty? ? default : answer\nend",
"def correctAnswerLabel(question)\n\tif question.input.is_a? org.concord.otrunk.ui.OTChoice\n\t\treturn choiceLabel(question.input, question.correctAnswer)\n\telse\n\t\treturn 'Not Available'\n\tend\nend",
"def correctAnswerLabel(question)\n\tif question.input.is_a? org.concord.otrunk.ui.OTChoice\n\t\treturn choiceLabel(question.input, question.correctAnswer)\n\telse\n\t\treturn 'Not Available'\n\tend\nend",
"def quarter\n case merch_month\n when 7,8,9\n return 1\n when 10,11,12\n return 2\n when 1,2,3\n return 3\n else\n return 4\n end\n end",
"def quiz(tally)\n if tally > 0\n \"Based off of your answers, you should decide yes.\"\n elsif tally < 0\n \"Based off of your answers, you should decide no.\"\n elsif tally == 0\n \"You seem to feel pretty equal about your sides, so you should talk to someone and have them help you with your decision.\"\n end\n end",
"def current?\n (quarter_offered == Quarter.current_quarter) || (year_offered == Time.now.year)\n end",
"def answer_humanized\n I18n.t(yes_no ? 'answer.yes' : 'answer.no')\n end",
"def display_question(player)\n puts \"#{player.name}'s turn:\"\n print \"Evaluate the following expression: \"\n puts create_question\n get_response\n puts \"The answer was #{validate_response(player)}.\"\n end",
"def answer\n @question = params[:question]\n if @question == 'I am going to work' then @answer = 'Great!'\n elsif @question.include? '?'\n then @answer = 'Silly question, get dressed and go to work'\n else @answer = \"I don't care, get dressed and go to work!\"\n end\n end",
"def check_prefecture\n if prefecture == \"--未選択--\"\n errors.add(:prefecture, \"選択して下さい\")\n end\n end",
"def answer_or_default( answer_string )\n if answer_string.length == 0 and not @default.nil?\n @default\n else\n answer_string\n end\n end",
"def verdict\n if self.is_complete?\n return self.status_str.titleize\n elsif self.ready_to_submit?\n return 'Ready to submit'\n elsif self.status_str == 'missing information'\n return \"Waiting on response from #{self.user.name || self.user.email} \"\n elsif ['unopened', 'in review' ].include? self.status_str\n return \"Waiting on response from #{self.current_reviewer.name || self.current_reviewer.email}\"\n elsif next_reviewer.nil?\n return \"Error\"\n else\n return \"Waiting on response from #{next_reviewer.name || next_reviewer.email}\"\n end\n end",
"def prompt msg, val=\"\"\n document.get_default_view.prompt(msg, val)\n end",
"def match_quarter\n @quarter ? { 'fiscal_quarter_id' => /#{@quarter}/i } : {}\n end",
"def ask_user(question, default = nil, answers = nil, force = false)\n ans = \" (#{answers.join(' / ')})\" unless answers.nil?\n dft = \" [#{default}]\" unless default.nil?\n print \"#{question}#{ans}#{dft} > \"\n if self[:auto] && !force\n puts ''\n else\n y = gets.chomp\n end\n y = default.to_s if y.nil? or y.empty?\n unless answers.nil? or answers.map(&:to_s).include?(y)\n warn \"Answer not recognized: '#{y}'\"\n return ask_user(question, default, answers, force)\n end\n y\n end",
"def append_default( )\n if @question =~ /([\\t ]+)\\Z/\n @question << \"|#{@default}|#{$1}\"\n elsif @question == \"\"\n @question << \"|#{@default}| \"\n elsif @question[-1, 1] == \"\\n\"\n @question[-2, 0] = \" |#{@default}|\"\n else\n @question << \" |#{@default}|\"\n end\n end",
"def confirm(prompt, default=false)\n raise RuntimeError, Trepan::NotImplementedMessage\n end",
"def player_response\n\n if compare_answer\n return puts \"#{@current_asker.name}: YES! You are correct.\"\n end\n\n puts \"#{@current_asker.name}: Seriously? No!\"\n\n end",
"def admin_yes_or_no(user)\n user.admin? ? \"Yes\" : \"No\"\n end",
"def questionCorrect (question)\n return nil unless question.correctAnswer\n\n return nil if question.input.is_a? org.concord.otrunk.ui.OTText\n\n if question.input.is_a? org.concord.otrunk.ui.OTChoice\n if question.input.currentChoice == nil\n return nil\n else\n\t return question.correctAnswer == question.input.currentChoice\n end\n end\nend",
"def asks(question: 'some default message', test: false)\n print question unless test\n test || gets.chomp\n end",
"def give_answer(question)\n if question.downcase == 'i am going to work'\n 'Great!'\n elsif question.chars[-1] == '?'\n 'Silly question, get dressed and go to work!'\n else\n 'I don\\'t care, get dressed and go to work!'\n end\n end",
"def default_value_noninteractive\n highline_question_type.call default_value\n end",
"def speak_to_grandma(question)\n if question != question.upcase\n return \"HUH?! SPEAK UP, SONNY!\"\n elsif question == \"I LOVE YOU GRANDMA!\"\n return \"I LOVE YOU TOO PUMKIN!\"\n else\n return \"NO, NOT SINCE 1938!\"\n end\nend",
"def yes_or_no(value = false)\n value ? \"Yes\" : \"No\"\n end",
"def prompt(msg, default)\n result = nil\n while not result\n display(msg)\n result = gets.strip\n if result.downcase == \"q\"\n throw :quit\n elsif result.downcase == \"i\"\n result = nil\n instructions\n elsif result.downcase == \"m\"\n display(\"Statistics can only be shown during a round!\")\n elsif result == \"\"\n return default.to_s\n else \n return result \n end\n end\n return result\n end",
"def quiz_owner_user\n unless quiz_owner?(params[:id])\n redirect_to quizzes_path\n flash[:error] = \"Step Off!! You don't own that quiz\"\n end\n end",
"def answer_for(options, q, default = nil)\n options[:answers][q] ? options[:answers][q] : default\n end",
"def ask_yes_no(question, default = nil)\n ui.ask_yes_no question, default\n end",
"def confirm(question)\n CLI::UI.confirm(question)\n end",
"def view_question_text\n nil\n end",
"def view_question_text\n nil\n end",
"def submission_confirmation(nominee_conf, client_conf, award_level_conf)\n puts \"You have successfully nominated: #{nominee_conf}\"\n puts \"Client: #{client_conf} and Level of Influence: #{award_level_conf}\"\n puts \"If this is incorrect, please refresh and try again.\"\nend",
"def experience_required\n experience = nil\n description = @description.downcase\n title = @title.downcase\n\n if description.include?('1+' || '0-2' || 'junior' || 'graduate') ||\n title.include?('junior' || 'entry' || 'graduate')\n experience = 'junior'\n elsif description.include?('3+' || '3-5' || 'mid-level' || 'experienced') ||\n title.include?('mid')\n experience = 'mid'\n elsif description.include?('5+' || '5-7' || 'senior' || 'highly') ||\n title.include?('senior')\n experience = 'senior'\n else\n experience = 'not_specified'\n end\n\n experience\n end",
"def pregnancy_to_confirm\n # TODO: add (Just to confirm) . . . if participant known to be pregnant\n \"A\"\n end",
"def gumball(quarters)\n if quarters == 0 || quarters == 1\n puts \"I don't have enough money for a gumball\"\n elsif quarters == 2 || quarters == 3\n puts \"I have enough money for a gumball\"\n end\nend",
"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 questionCorrect (question)\n return nil unless question.correctAnswer\n\n return nil if question.input.is_a? org.concord.otrunk.ui.OTText\n\n if question.input.is_a? org.concord.otrunk.ui.OTChoice\n choice = currentChoice(question.input)\n if choice == nil\n return nil\n else\n\t return question.correctAnswer == choice\n end\n end\nend",
"def get_tie_confirmation()\n return \"Both players tie with #{@player.get_weapon()}!\"\n end",
"def generate_question(player)\n\n question = Question.new\n\n operand_1 = generate_an_operand\n\n operator = generate_an_operator\n\n operand_2 = generate_an_operand\n\n # calculate actual_answer\n case\n when operator == \"plus\"\n question.actual_answer = operand_1.to_f + operand_2.to_f\n when operator == \"minus\"\n question.actual_answer = operand_1.to_f - operand_2.to_f\n when operator == \"times\"\n question.actual_answer = operand_1.to_f * operand_2.to_f\n when operator == \"divide by\"\n question.actual_answer = operand_1.to_f / operand_2.to_f\n else\n puts \"generate_question() method -- Error calculating actual_answer operator wrong #{operator}\"\n end\n\n # limit float to two decimal places\n question.actual_answer = question.actual_answer.round(2)\n\n question.text_of_question = \"#{player.name}: What does #{operand_1} #{operator} #{operand_2} equal?\"\n\n question\nend",
"def prompt_department\n prompt_by_index 0\n end",
"def quiz_answer(quiz)\n if quiz.answer_type == 'multi'\n show_multi_answer(quiz.answers.first.text, quiz.answer_input)\n elsif quiz.answer_type == 'check'\n show_check_answer(quiz.answers.first.text, quiz.answer_input)\n else\n quiz.answers.first.text\n end\n end",
"def prompt_to_buy_ticket_or_see_all_bands\n puts \"#{pastel.bright_cyan('Please make a selection:')}\"\n puts \" \"\n puts \"#{pastel.bright_cyan('buy')} - buy tickets to this concert.\"\n puts \"#{pastel.bright_cyan('1')} - see the concert list again.\"\n puts \"#{pastel.bright_cyan('2')} - see all top bands in the US.\"\n puts \"#{pastel.bright_cyan('exit')} - to quit the app.\"\n end",
"def ask_question(player)\n puts \"#{player.name}: What does #{@num1} plus #{@num2} equal?\"\n puts \" \"\n end",
"def cargo_recommended_msg\n cargo_msg('recommended (but not required)')\n end",
"def text\n respond_to?(:answerText) ? answerText : ''\n end",
"def confirm(prompt, default)\n default_str = default ? 'Y/n' : 'N/y'\n while true do\n begin\n response = readline('%s (%s) ' % [prompt, default_str])\n rescue EOFError\n return default\n end\n response = response.strip.downcase\n\n # We don't catch \"Yes, I'm sure\" or \"NO!\", but I leave that\n # as an exercise for the reader.\n break if YES_OR_NO.member?(response)\n msg \"Please answer 'yes' or 'no'. Try again.\"\n end\n return YES.member?(response)\n end",
"def get_formatted_question_type\n type = self.type\n\n if type == 'TrueFalse'\n return 'True/False'\n elsif type == 'MultipleChoiceCheckbox'\n return 'Multiple Choice - Checked'\n elsif type == 'MultipleChoiceRadio'\n return 'Multiple Choice - Radio'\n end\n end",
"def get_user_reponse(question, max_option)\n response = \"\"\n until response.to_i.between?(1, max_option) || response == \"00\"\n print question.blue\n response = gets.chomp\n end\n response\n end",
"def default_inquiries\n [[\"Rechtsschutzversicherung\", \"Allianz Versicherung\"]]\n end",
"def display_title(num = nil)\n question_num = default_title(num)\n return question_num if question.title.blank?\n\n I18n.t('activerecord.course/assessment/question.question_with_title',\n question_number: question_num, title: question.title)\n end",
"def general_q(question)\n p question\n gets.chomp\nend",
"def get_question\n\t\tquestion = \"Type your question and press the Enter key. \\n\\n: \"\n\t\tprint question\n\tend",
"def comments_prompt_text\n read_attribute(:comments_prompt_text).blank? ? \"Comments?\" : read_attribute(:comments_prompt_text)\n end",
"def get_draft_title_for_tutorial\n return self.draft == true ? \"DRAFT: #{self.title.upcase}\" : \"EDIT: #{self.title.upcase}\"\n end",
"def status_string\n if waiting_confirmation?\n return \"À confirmer\"\n elsif confirmed?\n return \"Confirmé\"\n elsif forgiven?\n return \"Pardonné\"\n else\n return \"Rejeté\"\n end\n end",
"def title_with_check\n check_string = checked? ? '✓ ' : ''\n \"#{check_string}#{title}\"\n end",
"def questionAnswer(question)\n answer = questionAnswerRaw(question)\n \n answer = \"No Answer\" if answer == nil\n truncate answer, 30\nend",
"def single_choice_question(text, points)\n question = SingleOptionQuestion.new(text, points)\n @errorReporter.register question\n @test.add_question question\nend",
"def display_title\n if !self.new_quote? && self.parent_quote.present?\n self.parent_quote.display_title + \" - v#{self.version_number}\"\n elsif self.new_quote? && self.title.present?\n self.title\n else\n 'No title'\n end\n end",
"def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend",
"def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend",
"def alert_preamble\n text = user ? user.email : ''\n text += \" [#{company.name}]\" if company\n text\n end",
"def working_equation\n default_equation || ''\n end",
"def make_task_name\n @selected_name = @prompt.ask(\"What do you want to name this task?\")\n due_date_year \nend",
"def active_for_quarter?(quarter, unit=nil)\n active_quarters(unit).include? quarter\n end"
] | [
"0.62311745",
"0.5909223",
"0.58993685",
"0.58993685",
"0.5886626",
"0.5855012",
"0.58474773",
"0.57334346",
"0.5718033",
"0.57133615",
"0.5678494",
"0.55566883",
"0.55566883",
"0.552581",
"0.55080014",
"0.5471089",
"0.5458149",
"0.545644",
"0.54558915",
"0.5436759",
"0.5435182",
"0.541861",
"0.54185903",
"0.5415493",
"0.5415493",
"0.5400691",
"0.53888714",
"0.53837675",
"0.53501433",
"0.5343511",
"0.5341942",
"0.5334622",
"0.5325822",
"0.53250813",
"0.5324245",
"0.53164923",
"0.5313605",
"0.5313605",
"0.53129864",
"0.52946836",
"0.52487904",
"0.5242066",
"0.5233219",
"0.5224843",
"0.52214754",
"0.5218676",
"0.5216084",
"0.5213757",
"0.5202176",
"0.5197105",
"0.5174653",
"0.51639116",
"0.5160069",
"0.5156761",
"0.5149994",
"0.5142546",
"0.51283693",
"0.5125774",
"0.51201016",
"0.51177573",
"0.5109379",
"0.5108609",
"0.5101216",
"0.50902116",
"0.5069446",
"0.5053719",
"0.5053286",
"0.5050151",
"0.50476944",
"0.5044394",
"0.5038984",
"0.5023121",
"0.5021378",
"0.5013824",
"0.5013529",
"0.50050294",
"0.4999663",
"0.4997412",
"0.4996914",
"0.499396",
"0.49928495",
"0.49922508",
"0.4991285",
"0.498898",
"0.4988018",
"0.49795294",
"0.49736357",
"0.49710706",
"0.4969956",
"0.49668345",
"0.4966245",
"0.49650168",
"0.49625805",
"0.49622145",
"0.49587464",
"0.49581945",
"0.49581945",
"0.49519637",
"0.4949818",
"0.49429557",
"0.49396265"
] | 0.0 | -1 |
When changing the response_reset_date, we must go through and update the status_cache for all members of the committee. | def update_member_status_caches!
if response_reset_date_changed?
members.find_in_batches do |member_group|
member_group.each {|member| member.update_status_cache! }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_lifetime_date\n response_reset_date || CommitteeMember::DEFAULT_RESPONSE_LIFETIME.ago\n end",
"def create_reset_digest\n update_attribute(:reset_sent_at, Time.zone.now)\n update_attribute(:reset_token, TokenGenerator.new_token)\n end",
"def update_task_completion_status_caches!\n return nil if completion_criteria.blank? && context_object_completion_criteria.blank?\n logger.info { \"Updating task completion status cache for OfferingAdminPhaseTask id #{id}\" }\n for r in relevant_records\n r.update_task_completion_status_cache!(self)\n r.save\n end\n end",
"def create_reset_digest\n self.reset_token = Member.new_token\n update_attribute(:reset_digest, Member.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def reset\n set_last_update_at\n end",
"def reset_since_id_counters\n reset!\n reset_since_id\n reset_since_id_reply\n reset_since_id_home_timeline\n reset_since_id_dm\n end",
"def create_reset_digest\n # self.reset_token = Chef.new_token\n # update_attribute(:reset_digest, Chef.digest(reset_token))\n #update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = Organization.new_token\n update_attribute(:reset_digest, Organization.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def monthly_reset(db, user_name)\r\n add_to_cache(db, user_name)\r\n reset_actual_income(db, user_name)\r\n reset_expenses(db, user_name)\r\nend",
"def create_reset_digest\n self.reset_token = Staff.new_token\n update_attribute(:reset_digest, Staff.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n\t\tself.reset_token = Member.new_token\n\t\tupdate_attribute(:reset_digest, Member.digest(reset_token))\n\t\tupdate_attribute(:reset_sent_at, Time.zone.now)\n\tend",
"def create_reset_digest\n self.reset_token=User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at,Time.zone.now)\nend",
"def create_reset_digest\n self.reset_token=User.new_token\n update_attribute(:reset_digest,User.digest(reset_token))\n update_attribute(:reset_send_at,Time.zone.now)\n \n end",
"def update_account_status_cached\n update(account_status_cached: calculate_account_status)\n account_status_cached\n end",
"def create_reset_digest\r\n update_attribute(:reset_password_sent_at, Time.zone.now)\r\n end",
"def recalculate_report_status\n self.status = 'pending' if resource_statuses.any? {|rs| rs.status == 'pending' } &&\n resource_statuses.none? {|rs| rs.status == 'failed'}\n self.status = 'failed' if self.logs.any? {|l| l.level == 'err' }\n end",
"def reset!\n config[:since_id] = 1\n config[:since_id_reply] = 1\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update reset_digest: User.digest(reset_token),\n reset_sent_at: Time.zone.now\n end",
"def create_reset_digest\n self.reset_token = AdminUser.new_token\n update_attribute(:reset_digest, AdminUser.digest(reset_token))\n update_attribute(:reset_sent_at, Time)\n end",
"def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end",
"def create_reset_digest\n self.reset_token=User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n\tself.reset_token = User.new_token\n\tupdate_attribute(:reset_digest, User.digest(reset_token))\n\tupdate_attribute(:reset_sent_at, Time.zone.now)\nend",
"def create_reset_digest\n self.reset_token = Doctor.new_token\n update_attribute(:reset_digest, Doctor.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def revalidate_cached_response(not_modified_response)\n logger.info(\" Resource not modified\")\n cached_response.revalidate!(not_modified_response)\n cached_response\n end",
"def reset\n self.update_attribute(:refresh_at, 1.years.ago)\n end",
"def create_reset_digest\n self.reset_token = User.generate_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def munge\n add_status_to_resource_status\n add_missing_metrics\n recalculate_report_status\n self\n end",
"def create_reset_digest\r\n self.reset_token = User.new_token\r\n update_attribute(:reset_digest,User.digest(reset_token))\r\n update_attribute(:reset_sent_at,Time.zone.now)\r\n end",
"def create_reset_digest\n self.reset_token = Admin.new_token\n update_attribute(:reset_digest, Admin.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = Admin.new_token\n update_attribute(:reset_digest, Admin.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def retry_change_requests=(retry_change_requests); end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.now)\n end",
"def create_reset_digest\n self.reset_token = ApplicationController.new_token\n update_attribute(:reset_digest, ApplicationController.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def after_update_challenge\n send_email_after_canceled_reactive\n send_email_after_change_start_date\n end",
"def create_reset_digest\n self.reset_token = LocalIdentity.new_token\n update_attribute(:reset_digest, LocalIdentity.digest(self.reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = Person.new_token\n update_attribute(:reset_digest, Person.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = Golfer.new_token\n update_attribute(:reset_digest, Golfer.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def hook_recalculate_status(_hook_args, _event_args)\n recalculate_status\n end",
"def create_reset_digest\n @reset_token = SecureRandom.urlsafe_base64(48)\n self.reset_token = @reset_token\n update_attribute(:reset_digest, @reset_token)\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_digest = SecureRandom.urlsafe_base64.to_s\n update_attribute(:reset_digest, reset_digest)\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def send_reset_request\n create_security_key if security_key.nil?\n LifecycleMailer.deliver_reset_request(self)\n end",
"def create_reset_digest\n self.reset_token = Lawfirm.new_token\n update_attribute(:reset_digest, Lawfirm.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = Band.new_token\n update_attribute(:reset_digest, Band.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end",
"def create_reset_digest\n self.reset_code = User.new_code\n update_columns(reset_digest: User.digest(reset_code), \n reset_sent_at: Time.zone.now)\n end",
"def create_reset_digest\n self.reset_token = Member.new_token\n update_columns(reset_digest: Member.digest(reset_token), reset_sent_at: Time.zone.now)\n end",
"def after_update(resume) \n expire_cache_for(resume) \n end"
] | [
"0.5993426",
"0.5752831",
"0.5661639",
"0.5633851",
"0.5619514",
"0.5545357",
"0.5545073",
"0.5531888",
"0.55239874",
"0.55159336",
"0.55092955",
"0.5499759",
"0.5486579",
"0.54748523",
"0.5471356",
"0.5462431",
"0.5450764",
"0.5449242",
"0.54428774",
"0.5428965",
"0.5428867",
"0.54282135",
"0.54213417",
"0.5402401",
"0.54005945",
"0.5398898",
"0.53932214",
"0.53932214",
"0.53932214",
"0.53932214",
"0.53932214",
"0.53932214",
"0.53932214",
"0.53932214",
"0.53932214",
"0.53932214",
"0.5392282",
"0.5392282",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5391691",
"0.5382026",
"0.5371979",
"0.5371825",
"0.5371825",
"0.5362903",
"0.53500503",
"0.53458786",
"0.5344647",
"0.53385144",
"0.5330011",
"0.5323209",
"0.53187585",
"0.53187585",
"0.53119147",
"0.530392",
"0.5288377",
"0.52873766",
"0.52862453",
"0.52855104",
"0.5282641",
"0.5272871",
"0.5265021",
"0.5263453",
"0.5263333"
] | 0.77870595 | 0 |
If this Committee has the response_reset_date set, return that. Otherwise, calculate this based on the DEFAULT_LIFETIME_RESPONSE. | def response_lifetime_date
response_reset_date || CommitteeMember::DEFAULT_RESPONSE_LIFETIME.ago
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago # date helpers\n\tend",
"def password_reset_not_expired?\n self.reset_sent_at > 2.hours.ago\n end",
"def password_reset_expired?\n \treset_sent_at < 2.hours.ago\n \tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\t\t\n\tend",
"def password_reset_expired?\n\t\tself.reset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n reset_sent_at.nil? || reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n self.reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n \tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\n\tend",
"def reminder_date_time\n return @reminder_date_time\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago # reset_sent_at db polje datetime\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n # TODO: the '2' hour expiration should be defined in an app constant\n self.password_reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\r\n reset_sent_at < 2.hours.ago\r\n end",
"def password_reset_expired?\n \t\treset_sent_at < 3.hours.ago\n \tend",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 24.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago rescue true\n end"
] | [
"0.59531075",
"0.5941943",
"0.59131",
"0.59000325",
"0.5871361",
"0.5870025",
"0.58453834",
"0.5808049",
"0.5792284",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57785374",
"0.5749551",
"0.57486004",
"0.57486004",
"0.57486004",
"0.57486004",
"0.57486004",
"0.57486004",
"0.57486004",
"0.57486004",
"0.57419735",
"0.5739816",
"0.57350135",
"0.5728606",
"0.5706544",
"0.56963474",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.56758666",
"0.5651507",
"0.56364954"
] | 0.81713873 | 0 |
GET /success_cases GET /success_cases.xml | def index
@success_cases = SuccessCase.all.paginate(:page => params[:page], :per_page => 10)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @success_cases }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cases = Case.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cases }\n end\n end",
"def show\n @success_case = SuccessCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @success_case }\n end\n end",
"def index\n @testcases = Testcase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @testcases }\n end\n end",
"def new\n @success_case = SuccessCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @success_case }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def show\n @test_case = TestCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_case }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def index\n\t\tif @cases.present?\n \t\trender json: { success: true, response: @cases.as_json(\"case_media\") },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end\n\tend",
"def show\n @case = Case.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @case }\n end\n end",
"def index\n @published = Showcase.published\n @showcases = Showcase.find(:all, :order=>'publish_date desc')\n\t\t@page_title = \"Showcases\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @showcases }\n end\n end",
"def show\n @test_case_entry = TestCaseEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_case_entry }\n end\n end",
"def show\n @security_case = SecurityCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @security_case }\n end\n end",
"def index\n @contests = Contest.find(:all, :order => 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def index\n @course_taken_statuses = CourseTakenStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @course_taken_statuses }\n end\n end",
"def index\n @support_cases = SupportCase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_cases }\n end\n end",
"def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end",
"def index\n @cst_icms = CstIcm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_icms }\n end\n end",
"def index\n\t\t# get the current surgeon of the all case details\n\t\tcases = current_user.cases.order_by(:schedule_date=> :asc).collect{|surgery_case| surgery_case if (surgery_case.schedule.schedule_date.to_date.past? || surgery_case.schedule.schedule_date.to_date.today?)}.reject(&:blank?).take(10)\n\t\tif cases.present?\n\t render json: { success: true, response: cases.map{ |f| CaseSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Cases are not present\" },:status=> 203\n\t end \n\tend",
"def index\n @countdowns = Countdown.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @countdowns }\n end\n end",
"def index\n @labs = @course.labs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @labs }\n end\n end",
"def index\n @certs = Cert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @certs }\n end\n end",
"def show\n @course_taken_status = CourseTakenStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_taken_status }\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end",
"def cyberstock\n @classifieds = Cyberstock.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end",
"def show\n #REQUIRES: existence of contest with :id\n #EFFECTS: allows rendering of one particular contest and its properties\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def create\n @success_case = SuccessCase.new(params[:success_case])\n\n respond_to do |format|\n if @success_case.save\n format.html { redirect_to(@success_case, :notice => 'Success case was successfully created.') }\n format.xml { render :xml => @success_case, :status => :created, :location => @success_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end",
"def index\n @contests = Contest.paginate(:order => 'date_from DESC', :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cv }\n end\n end",
"def index\n @training_facilities = TrainingFacility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @training_facilities }\n end\n end",
"def index\n @tests = TkdTest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tests }\n end\n end",
"def index\n @states = @country.states.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @states }\n end\n end",
"def show\n @req_breakdown = ReqBreakdown.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @req_breakdown }\n end\n end",
"def index\n @estatus = Estatu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estatus }\n end\n end",
"def index\n @cases = Case.all\n end",
"def index\n @cases = Case.all\n end",
"def index\n @cst_ipis = CstIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_ipis }\n end\n end",
"def new\n @test_case = TestCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case }\n end\n end",
"def show\n @lab = @course.labs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @lab }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def index\n @contracts = @project.contracts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contracts }\n end\n end",
"def index\n @segment_details = SegmentDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @segment_details }\n end\n end",
"def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end",
"def index\n @criancas = Crianca.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criancas }\n end\n end",
"def get_substrates()\n\tputs \"Getting list of substrates.\"\n\tresponse = request_get('/api/partner/substrate')\n\tputs response.body\nend",
"def index\n @citas = Cita.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @citas }\n end\n end",
"def show\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @constituency }\n end\n end",
"def show\n @estados_civil = EstadosCivil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estados_civil }\n end\n end",
"def expired\n @classifieds = Cyberstock.expired.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end",
"def index\n @matches = @contest.matches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @matches }\n end\n end",
"def list\n\t @complaints = Complaint.find(:all, :conditions => \"approved = 0\")\n\t\trespond_to do |format|\t\t\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @complaints }\t#Render to XML File\n\t\tend\n\t end",
"def index\n @statuses = Status.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @statuses }\n end\n end",
"def show\n @clenum = Clenum.find(params[:ids])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clenum }\n end\n end",
"def test_articlerss\n get :articlerss, :id => 1 \n assert_response :success\n assert_nothing_raised do\n assert REXML::Document.new(@response.body)\n end\n end",
"def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_suite }\n end\n end",
"def show\n @cst_icm = CstIcm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_icm }\n end\n end",
"def get_ci(id)\n xml = RestClient.get \"#{@base_url}/ci/#{id}\", {:accept => :xml, :content_type => :xml}\n return XmlSimple.xml_in(xml)\n end",
"def show\n @countdown = Countdown.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countdown }\n end\n end",
"def index\n @sf_cases = SFCase.all\n end",
"def show\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def show\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def test_generate_request_xml_successful\n assert AxAccount.request_xml(\"CU 0100000\")\n end",
"def index\n\n @critical_success_factors = CriticalSuccessFactor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_success_factors }\n end\n end",
"def new\n @testcase = Testcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testcase }\n end\n end",
"def index\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_cases = @test_suite.test_cases\n end",
"def show\n @testing = Testing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @testing }\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calibration }\n end\n end",
"def show\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @concert }\n end\n end",
"def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end",
"def index\n @project_costs = ProjectCost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @project_costs }\n end\n end",
"def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end",
"def show\n @cst_ipi = CstIpi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_ipi }\n end\n end",
"def show\n giftCert = GiftCert.find_by_activiation_code(params[:code])\n\n respond_to do |format|\n \tif giftCert != nil \n \t\tformat.xml { render :xml => giftCert }\n \telse\n \t\tformat.xml { render :xml => errorRsp( \"invalid activiation code\") }\n \tend\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @challenges }\n end\n end",
"def index\n @disciplinas = Disciplina.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @disciplinas }\n end\n end",
"def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_plan }\n end\n end",
"def index\n @commission_days = CommissionDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @commission_days }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ciclos }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @unapproved_project }\n end\n end",
"def show\n \n begin\n @topic_activity_summaries = \n TopicActivitySummary.find_all_by_student_id_and_grade(params[:id], params[:grade])\n rescue Exception => e \n respond_to do |format|\n format.xml { render :xml => errorRsp( e.message) }\n end\n return\n end\n\t \n respond_to do |format|\n format.xml { render :xml => @topic_activity_summaries.to_xml(:dasherize => false) }\n end\n end",
"def index\n @local_plans = LocalPlan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @local_plans }\n end\n end",
"def show\n @countdown_ipp = CountdownIpp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countdown_ipp }\n end\n end",
"def index\n @success_criterions = SuccessCriterion.all\n end",
"def index\n @camps = Camp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @camps }\n end\n end",
"def show\n @citystatistic = Citystatistic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @citystatistic }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @issued }\n end\n end",
"def index\n @race_disciplines = RaceDiscipline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @race_disciplines }\n end\n end",
"def index\n @patient_encounters = PatientEncounter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patient_encounters }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @countries }\n end\n end",
"def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end",
"def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n end",
"def index\n @lookup_cohorts = LookupCohort.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_cohorts }\n end\n end",
"def index\n @check_details = CheckDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @check_details }\n end\n end",
"def internships\n respond_to do |format|\n format.html # internships.html.erb\n format.xml { render :xml => nil }\n end\n end",
"def show\n @estacion = Estacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def new\n @security_case = SecurityCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @security_case }\n end\n end"
] | [
"0.69023097",
"0.68591547",
"0.6672036",
"0.6409081",
"0.6260781",
"0.6158841",
"0.6017537",
"0.59043026",
"0.5888606",
"0.58763474",
"0.5809218",
"0.58088917",
"0.58007836",
"0.5791762",
"0.57827497",
"0.5757698",
"0.5744602",
"0.5732726",
"0.5732242",
"0.56842464",
"0.56647384",
"0.56595236",
"0.56374514",
"0.5632637",
"0.5631721",
"0.5624892",
"0.5624892",
"0.5624892",
"0.5611609",
"0.55812",
"0.5555318",
"0.5549851",
"0.5520188",
"0.5508089",
"0.5507295",
"0.5497657",
"0.5493728",
"0.54898834",
"0.54898834",
"0.5489008",
"0.54889154",
"0.548887",
"0.54828626",
"0.5477458",
"0.5477246",
"0.54749674",
"0.54745287",
"0.5470224",
"0.5467037",
"0.5464408",
"0.5460957",
"0.5454075",
"0.5448002",
"0.54440105",
"0.5441725",
"0.54408157",
"0.5435002",
"0.54331464",
"0.54320556",
"0.54310477",
"0.5427896",
"0.5425344",
"0.54185337",
"0.54185337",
"0.5418441",
"0.54145616",
"0.54106575",
"0.5408247",
"0.5404197",
"0.5402143",
"0.5400987",
"0.5395716",
"0.5393899",
"0.5388229",
"0.5386733",
"0.53827196",
"0.53820175",
"0.53811127",
"0.53735685",
"0.5364916",
"0.5361203",
"0.5357015",
"0.5356861",
"0.5353724",
"0.5353292",
"0.5352149",
"0.5345448",
"0.53445256",
"0.53434324",
"0.5343387",
"0.5343101",
"0.53420115",
"0.5340408",
"0.53395456",
"0.533895",
"0.5338239",
"0.5337596",
"0.533653",
"0.5335403",
"0.5331272"
] | 0.70646626 | 0 |
GET /success_cases/1 GET /success_cases/1.xml | def show
@success_case = SuccessCase.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @success_case }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @success_cases = SuccessCase.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @success_cases }\n end\n end",
"def index\n @cases = Case.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cases }\n end\n end",
"def index\n @testcases = Testcase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @testcases }\n end\n end",
"def show\n @test_case = TestCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_case }\n end\n end",
"def new\n @success_case = SuccessCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @success_case }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def show\n @case = Case.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @case }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @security_case = SecurityCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @security_case }\n end\n end",
"def show\n @test_case_entry = TestCaseEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_case_entry }\n end\n end",
"def index\n @published = Showcase.published\n @showcases = Showcase.find(:all, :order=>'publish_date desc')\n\t\t@page_title = \"Showcases\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @showcases }\n end\n end",
"def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end",
"def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end",
"def show\n @req_breakdown = ReqBreakdown.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @req_breakdown }\n end\n end",
"def show\n #REQUIRES: existence of contest with :id\n #EFFECTS: allows rendering of one particular contest and its properties\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def index\n @contests = Contest.find(:all, :order => 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def show\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @constituency }\n end\n end",
"def show\n @course_taken_status = CourseTakenStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_taken_status }\n end\n end",
"def show\n @xml_sample = XmlSample.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def index\n @countdowns = Countdown.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @countdowns }\n end\n end",
"def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_suite }\n end\n end",
"def show\n @clenum = Clenum.find(params[:ids])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clenum }\n end\n end",
"def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def show\n @status = Status.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def show\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def show\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def show\n @cst_ipi = CstIpi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_ipi }\n end\n end",
"def index\n @certs = Cert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @certs }\n end\n end",
"def index\n @cst_icms = CstIcm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_icms }\n end\n end",
"def show\n @lab = @course.labs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @lab }\n end\n end",
"def show\n @testing = Testing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @testing }\n end\n end",
"def get_ci(id)\n xml = RestClient.get \"#{@base_url}/ci/#{id}\", {:accept => :xml, :content_type => :xml}\n return XmlSimple.xml_in(xml)\n end",
"def show\n @countdown = Countdown.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countdown }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cv }\n end\n end",
"def index\n @segment_details = SegmentDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @segment_details }\n end\n end",
"def show\n \n begin\n @topic_activity_summaries = \n TopicActivitySummary.find_all_by_student_id_and_grade(params[:id], params[:grade])\n rescue Exception => e \n respond_to do |format|\n format.xml { render :xml => errorRsp( e.message) }\n end\n return\n end\n\t \n respond_to do |format|\n format.xml { render :xml => @topic_activity_summaries.to_xml(:dasherize => false) }\n end\n end",
"def show\n @countdown_ipp = CountdownIpp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countdown_ipp }\n end\n end",
"def show\n @citystatistic = Citystatistic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @citystatistic }\n end\n end",
"def index\n @estatus = Estatu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estatus }\n end\n end",
"def test_generate_request_xml_successful\n assert AxAccount.request_xml(\"CU 0100000\")\n end",
"def show\n @visit_stat = VisitStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end",
"def show\n @lookup_scantask = LookupScantask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end",
"def show\n @lab_rack = LabRack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lab_rack }\n end\n end",
"def new\n @test_case = TestCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case }\n end\n end",
"def show\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_testcase_xref }\n end\n end",
"def index\n @course_taken_statuses = CourseTakenStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @course_taken_statuses }\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end",
"def show\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @concert }\n end\n end",
"def index\n @labs = @course.labs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @labs }\n end\n end",
"def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end",
"def new\n @testcase = Testcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testcase }\n end\n end",
"def show\n @visarequest = Visarequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @visarequest }\n end\n end",
"def show\n @estacion = Estacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def show\n @certificate = Certificate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @certificate }\n end\n end",
"def ping\n @status = Status.find(:first)\n respond_to do |format|\n format.html\n format.xml { render :xml => @status }\n end \n end",
"def index\n @check_details = CheckDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @check_details }\n end\n end",
"def show\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def show\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def show\n @cst_icm = CstIcm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_icm }\n end\n end",
"def index\n @cst_ipis = CstIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_ipis }\n end\n end",
"def show \n @doc = \"Nothing\"\n @scenario = Scenario.find(params[:id])\n\tdir_name = \"#{Rails.root}/data/#{session[:session_id]}\"\n\tDir.mkdir(dir_name) unless File.exists?(dir_name)\n\n\tbuild_xml()\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scenario }\n end\n end",
"def show\n @estados_civil = EstadosCivil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estados_civil }\n end\n end",
"def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_plan }\n end\n end",
"def dummy_data_fuse_response_xml\n path=\"#{Rails.root}/test/data_fuse_example.xml\"\n File.open(path, \"rb\").read\n end",
"def index\n @statuses = Status.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @statuses }\n end\n end",
"def create\n @success_case = SuccessCase.new(params[:success_case])\n\n respond_to do |format|\n if @success_case.save\n format.html { redirect_to(@success_case, :notice => 'Success case was successfully created.') }\n format.xml { render :xml => @success_case, :status => :created, :location => @success_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @suite = Suite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suite }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calibration }\n end\n end",
"def show\n @crawl_result = Crawl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crawl_result }\n end\n end",
"def show\n @project_status = ProjectStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project_status }\n end\n end",
"def show\n @decision = Decision.find(params[:id])\n\t@project = Project.find(params[:project_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @decision }\n end\n end",
"def index\n @criancas = Crianca.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criancas }\n end\n end",
"def cyberstock\n @classifieds = Cyberstock.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end",
"def show\n @convenio = Convenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @convenio }\n end\n end",
"def show\n @analysis = Analysis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @analysis }\n end\n end",
"def show\n @reqinfo = Reqinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end",
"def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @criterion }\n end\n end",
"def show\n @security_case_medium = SecurityCaseMedium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @security_case_medium }\n end\n end",
"def show\n @capitalrecovery = Capitalrecovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @capitalrecovery }\n end\n end",
"def index\n @contests = Contest.paginate(:order => 'date_from DESC', :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @traffic }\n end\n end",
"def show\n return false unless authorize(permissions = [\"view_casefile\"])\n\n @case_file = CaseFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @case_file }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ciclo }\n end\n end",
"def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end",
"def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end",
"def test_articlerss\n get :articlerss, :id => 1 \n assert_response :success\n assert_nothing_raised do\n assert REXML::Document.new(@response.body)\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @finish }\n end\n end",
"def show\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @absence_request }\n end\n end",
"def show\n @crna = Crna.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crna }\n end\n end",
"def show\n @labour = Labour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @labour }\n end\n end",
"def index\n @patient_encounters = PatientEncounter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patient_encounters }\n end\n end",
"def show\n @stop = Stop.where(:short_name => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stop.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.kml\n end\n end",
"def index\n @training_facilities = TrainingFacility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @training_facilities }\n end\n end",
"def index\n @support_cases = SupportCase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_cases }\n end\n end"
] | [
"0.6960763",
"0.68474066",
"0.66321915",
"0.6408574",
"0.6388847",
"0.6146108",
"0.614035",
"0.61117876",
"0.6077934",
"0.6006697",
"0.59975284",
"0.5864014",
"0.58488",
"0.57850105",
"0.5768482",
"0.57328653",
"0.57265514",
"0.570103",
"0.5697091",
"0.56942356",
"0.5686374",
"0.56727636",
"0.5660392",
"0.5658622",
"0.5658622",
"0.5658622",
"0.5651669",
"0.5651669",
"0.56455207",
"0.5643187",
"0.5641756",
"0.56404454",
"0.56383455",
"0.56179035",
"0.561366",
"0.5610697",
"0.56036735",
"0.56036735",
"0.56036735",
"0.56003827",
"0.5598678",
"0.55907935",
"0.5590053",
"0.5587087",
"0.55839336",
"0.55817413",
"0.55811185",
"0.558061",
"0.55805403",
"0.557928",
"0.5574355",
"0.5570421",
"0.5561685",
"0.55556214",
"0.55542964",
"0.555302",
"0.55526024",
"0.5551017",
"0.5546072",
"0.55433375",
"0.5542554",
"0.55425084",
"0.5538551",
"0.5538551",
"0.5533927",
"0.5530798",
"0.5525281",
"0.5523145",
"0.5522641",
"0.5522308",
"0.5521512",
"0.5518952",
"0.55115616",
"0.5509231",
"0.55020034",
"0.55013084",
"0.5499768",
"0.5488228",
"0.5483514",
"0.5481492",
"0.5480514",
"0.5473307",
"0.54660475",
"0.54650337",
"0.5464101",
"0.54627496",
"0.545853",
"0.5457746",
"0.5455379",
"0.54507214",
"0.5450656",
"0.54489756",
"0.54475373",
"0.5444424",
"0.5443653",
"0.5440749",
"0.5440095",
"0.54399496",
"0.54387695",
"0.5434375"
] | 0.69731224 | 0 |
GET /success_cases/new GET /success_cases/new.xml | def new
@success_case = SuccessCase.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @success_case }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @test_case = TestCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case }\n end\n end",
"def new\n @testcase = Testcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testcase }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @security_case = SecurityCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @security_case }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @test_case_entry = TestCaseEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case_entry }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def new\n @suite = Suite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suite }\n end\n end",
"def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end",
"def create\n @success_case = SuccessCase.new(params[:success_case])\n\n respond_to do |format|\n if @success_case.save\n format.html { redirect_to(@success_case, :notice => 'Success case was successfully created.') }\n format.xml { render :xml => @success_case, :status => :created, :location => @success_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ciclo }\n end\n end",
"def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_plan }\n end\n end",
"def new\n @project_status = ProjectStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_status }\n end\n end",
"def new\n @convenio = Convenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @convenio }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_request }\n end\n end",
"def new\n @req_breakdown = ReqBreakdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @req_breakdown }\n end\n end",
"def new\n @conseq = Conseq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conseq }\n end\n end",
"def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end",
"def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end",
"def new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @cst_ipi = CstIpi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cst_ipi }\n end\n end",
"def new\n @capitalrecovery = Capitalrecovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @capitalrecovery }\n end\n end",
"def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end",
"def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n return false unless authorize(permissions = [\"create_casefile\"])\n\n @case_file = CaseFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @case_file }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @copy = Copy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @copy }\n end\n end",
"def new\n @estados_civil = EstadosCivil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estados_civil }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @visarequest = Visarequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visarequest }\n end\n end",
"def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end",
"def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end",
"def new\n @atest = Atest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atest }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @constituency = Constituency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @constituency }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @finish }\n end\n end",
"def new\n @bug_status = BugStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bug_status }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @compliance }\n end\n end",
"def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @good }\n end\n end",
"def new\n @ccl = Ccl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ccl }\n end\n end",
"def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_suite }\n end\n end",
"def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end",
"def new\n @source = Source.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @source }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @get_started_page }\n end\n end",
"def new\n @visit_stat = VisitStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end",
"def new\n @scenario = Scenario.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scenario }\n end\n end",
"def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end",
"def new\n @cap = Cap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cap }\n end\n end",
"def new\n @cap = Cap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cap }\n end\n end",
"def new\n @labour = Labour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @labour }\n end\n end",
"def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"def new\n @new_project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project }\n end\n end",
"def new\n @sti = Sti.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sti }\n end\n end",
"def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @index = Indice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @page }\n end\n end",
"def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end",
"def new\n @case = Case.new\n\n respond_to do |format|\n format.js \n format.xml { render :xml => @case }\n end\n end",
"def new\n @countdown = Countdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countdown }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @school }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"def new\n @title = \"New income classification\"\n @incomeclassification = Incomeclassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incomeclassification }\n end\n end",
"def new\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n @incidenttype = Incidenttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incidenttype }\n end\n end",
"def new\n @countries = Countries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countries }\n end\n end",
"def new\n\t\teval(\"@#{controller_name.singularize} = #{controller_name.classify}.new\")\n\t\t\n\t\tnew_callback\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => eval(\"@#{controller_name}\") }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end",
"def new\n @security_case_medium = SecurityCaseMedium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @security_case_medium }\n end\n end",
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template }\n end\n end",
"def new\n new_prc\n\n setup_campuses_and_semesters\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prc }\n end\n end",
"def new\n @cv = Cv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cv }\n end\n end",
"def new\n @curnit = Curnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curnit }\n end\n end",
"def new\n @checkpoint = Checkpoint.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @checkpoint }\n end\n end",
"def new\n @court = Court.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @court }\n end\n end",
"def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end",
"def new\n @current = Current.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @current }\n end\n end",
"def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end",
"def new\n @temp = Temp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @temp }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new\n @proj_detail = ProjDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proj_detail }\n end\n end",
"def new\n @cadd = Cadd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cadd }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @borrow }\n end\n end",
"def new\n @clenum = Clenum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clenum }\n end\n end"
] | [
"0.7379976",
"0.7356432",
"0.7132841",
"0.7100511",
"0.70228857",
"0.70228857",
"0.70228857",
"0.6960621",
"0.68580955",
"0.68580955",
"0.68580955",
"0.68343794",
"0.67580044",
"0.67448777",
"0.67371255",
"0.6714657",
"0.6698058",
"0.6698058",
"0.669793",
"0.66870165",
"0.66869694",
"0.6683703",
"0.6681959",
"0.6681085",
"0.6678666",
"0.66773826",
"0.66699296",
"0.6669544",
"0.6657274",
"0.66555995",
"0.66317326",
"0.6624499",
"0.6623623",
"0.6623623",
"0.6623623",
"0.6621165",
"0.6615203",
"0.6612783",
"0.6612783",
"0.6611721",
"0.66076034",
"0.66064984",
"0.6588185",
"0.65857995",
"0.65840954",
"0.65768474",
"0.6576313",
"0.65744174",
"0.6573987",
"0.65668255",
"0.656291",
"0.65596235",
"0.655406",
"0.6552288",
"0.65505797",
"0.6545522",
"0.6545522",
"0.6543916",
"0.65377706",
"0.65341324",
"0.6530535",
"0.6529245",
"0.65292215",
"0.65292215",
"0.6520205",
"0.6519544",
"0.65194196",
"0.6517727",
"0.6516767",
"0.6515956",
"0.65149295",
"0.65128785",
"0.6510421",
"0.6504567",
"0.650184",
"0.649917",
"0.6498938",
"0.6496074",
"0.64956796",
"0.6494954",
"0.64941555",
"0.6492556",
"0.6491809",
"0.6489017",
"0.6489003",
"0.6485878",
"0.64839894",
"0.64803493",
"0.647994",
"0.6478964",
"0.64769834",
"0.6476766",
"0.647002",
"0.6469906",
"0.64686704",
"0.6468625",
"0.6467516",
"0.64674973",
"0.64564437",
"0.645595"
] | 0.79590297 | 0 |
POST /success_cases POST /success_cases.xml | def create
@success_case = SuccessCase.new(params[:success_case])
respond_to do |format|
if @success_case.save
format.html { redirect_to(@success_case, :notice => 'Success case was successfully created.') }
format.xml { render :xml => @success_case, :status => :created, :location => @success_case }
else
format.html { render :action => "new" }
format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @test_case = TestCase.new(params[:test_case])\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully created.') }\n format.xml { render :xml => @test_case, :status => :created, :location => @test_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def posttestrail(runId, caseId, statusId, versionId, elapsedseconds)\r\n\r\n uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=#{runId}&case_id=#{caseId}&status_id=#{statusId}&version=#{versionId}&elapsed_seconds=#{elapsedseconds}&sharedSecret=thI5iSourSHAREDsecret\"\r\n #uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=110324&case_id=665022&status_id=1&version=Test&elapsed_seconds=12&sharedSecret=thI5iSourSHAREDsecret\"\r\n\r\n uri = uri.gsub(\" \", \"%20\")\r\n xml_data = open(uri).read\r\n if(xml_data.include? '\"test_id\":')\r\n recorded = xml_data.split('\"test_id\":')[1]\r\n testID = recorded.split(',\"status_id\"')[0]\r\n puts \"TestID:\"+testID\r\n else\r\n puts xml_data\r\n fail \"Cannot Post result to Testrail, check Webservice\"\r\n end\r\n\r\n timeStamp = Time.now.strftime (\"posted at %H:%M %d/%m/%Y\")\r\n files = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEAresultupdatelog.txt\"\r\n f = File.open(files,'a')\r\n f.write \"#{testID} #{timeStamp}\"\r\n f.close\r\nend",
"def new\n @success_case = SuccessCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @success_case }\n end\n end",
"def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n flash[:notice] = 'Testcase was successfully created.'\n format.html { redirect_to(@testcase) }\n format.xml { render :xml => @testcase, :status => :created, :location => @testcase }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @test_case_entry = TestCaseEntry.new(params[:test_case_entry])\n\n respond_to do |format|\n if @test_case_entry.save\n format.html { redirect_to(@test_case_entry, :notice => 'Test case entry was successfully created.') }\n format.xml { render :xml => @test_case_entry, :status => :created, :location => @test_case_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_case_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def sendclaim\n require 'net/http'\n require 'uri'\n\n @visit = Visit.find(params[:id])\n @patient = Patient.find(@visit.patient_id)\n @patient.fname = @patient.full_sex unless @patient.fname.present?\n @doctor = Doctor.find(@visit.doc_id)\n @xml = render_to_string \"show.xml\"\n\n uri = URI.parse(CABMDURL)\n http= Net::HTTP.new(uri.host,uri.port)\n http.use_ssl = true\n \n req = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/xml'})\n req.body = @xml\n\n res = http.request(req)\n @xmlhash = JSON.parse(res.body)\n# {\"success\"=>true, \"errors\"=>[], \"messages\"=>[], \"reference_id\"=>\"332933\", \"accounting_number\"=>\"0004MZ4Z\"}\n \n if @xmlhash['success'] \n\t acc_num = @xmlhash['accounting_number']\n flash[:info] = \"Claim #{acc_num} sent to cab.md \" \n @visit.update_attribute(:status, BILLED)\n @visit.update_attribute(:billing_ref, acc_num)\n else\n\t errors = @xmlhash['errors']\n\t messages = @xmlhash['messages']\n\t flash[:danger] = \"Error sending claim : #{@xmlhash}\"\n @visit.update_attribute(:status, READY)\n\t @visit.update_attribute(:billing_ref, errors.join(',')) if errors.present?\n end\n\n respond_to(:html)\n redirect_to patient_visit_path\n end",
"def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_case = TestCase.new(test_case_params)\n\n respond_to do |format|\n if @test_case.save\n TestMailer.admin_new_test_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully added.' }\n format.json { render action: 'show', status: :created, location: @test_case }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params.permit!\n @security_case = SecurityCase.new(params[:security_case])\n\n respond_to do |format|\n if @security_case.save\n format.html { redirect_to(@security_case, :notice => 'Security case was successfully created.') }\n format.xml { render :xml => @security_case, :status => :created, :location => @security_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @security_case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n @test_case = TestCase.new(test_case_params)\n @test_suite = TestSuite.find(params[:test_suite_id])\n\n #Make sure the tc is linked to the ts\n @test_case.test_suite_id=@test_suite.id\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to test_suite_test_case_path(@test_suite,@test_case), notice: 'Test case was successfully created.' }\n format.json { render :show, status: :created, location: @test_case }\n else\n format.html { render :new }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to(@contest, :notice => 'Contest was successfully created.') }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n flash[:notice] = 'Contest was successfully created.'\n format.html { redirect_to(@contest) }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cases_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_generate_request_xml_successful\n assert AxAccount.request_xml(\"CU 0100000\")\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def post\n j :pass\nlabel :fail\n RVTEST_FAIL()\nlabel :pass\n RVTEST_PASS()\n RVTEST_CODE_END()\n end",
"def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def create\n @clientcase = Clientcase.new(params[:clientcase])\n\n respond_to do |format|\n if @clientcase.save\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully created.' }\n format.json { render :json => @clientcase, :status => :created, :location => @clientcase }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @clientcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @test_plan = TestPlan.new(params[:test_plan])\n\n respond_to do |format|\n if @test_plan.save\n format.html { redirect_to(@test_plan, :notice => 'Test plan was successfully created.') }\n format.xml { render :xml => @test_plan, :status => :created, :location => @test_plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n mytimestamp = Time.now.localtime.strftime(\"%y%m%d-%H%M%S\")\n mytime = \"%s\" % Time.now.to_i\n\n @case = Case.new(params[:case])\n\t@case.caseid = mytimestamp\n\t\n respond_to do |format|\n if @case.save\n format.js \n format.xml { render :xml => @case, :status => :created, :location => @case }\n else\n\t puts \"ERRORS ! ! ! ! ! ! : \"\n\t puts @case.errors.count\n\t\tputs @case.errors.full_messages\n format.js { render :controller => \"application\", :action => \"errdisplay\" }\n format.xml { render :xml => @loc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def do_submission(path, xml = nil)\n if xml.nil?\n form = create(:form, question_types: %w(integer integer))\n form.publish!\n xml = build_odk_submission(form)\n end\n\n # write xml to file\n require 'fileutils'\n FileUtils.mkpath('test/fixtures')\n fixture_file = Rails.root.join('test/fixtures/', ODK_XML_FILE)\n File.open(fixture_file.to_s, 'w') { |f| f.write(xml) }\n\n # Upload and do request.\n uploaded = fixture_file_upload(fixture_file, 'text/xml')\n post(path, {:xml_submission_file => uploaded, :format => 'xml'}, 'HTTP_AUTHORIZATION' => encode_credentials(@user.login, 'password'))\n assigns(:response)\n end",
"def create\n @case_request = CaseRequest.new(case_request_params)\n\n respond_to do |format|\n if @case_request.save\n format.html { redirect_to @case_request, notice: 'Case request was successfully created.' }\n format.json { render :show, status: :created, location: @case_request }\n else\n format.html { render :new }\n format.json { render json: @case_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assessment_insti_test = AssessmentInstiTest.new(params[:assessment_insti_test])\n respond_to do |format|\n if@assessment_insti_test.save\n #if@assessment_insti_test.rb.status == 1\n Content.send_message_to_est(false,current_user,@assessment_insti_test)\n #end\n format.html { redirect_to@assessment_insti_test, notice: 'AssessmentInstiTest was successfully created.' }\n format.json { render json:@assessment_insti_test, status: :created, location:@assessment_insti_test }\n else\n format.html { render action: \"new\" }\n format.json { render json:@assessment_insti_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t# creating the cases with particular surgeon\n\t\tsurgery_case = current_user.cases.create(case_params)\n\t\t# Updating the patient to the particular case\n\t\tsurgery_case.update_attributes(patient_id: params[:patient_id])\n\t\t# redirect to the case index page\n\t\tif surgery_case.present?\n \t# response to the JSON\n\t \trender json: { success: true,message: \"Case Successfully Created.\", response: CaseSerializer.new(surgery_case).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: surgery_case.errors },:status=> 203\n\t end\n\tend",
"def create\n @contest = Contest.new(params[:contest])\n @contest.user_id = current_user.id\n parse_and_create_teams(params[:teams]) if params[:teams]\n \n respond_to do |format|\n if @contest.save\n create_open_post\n flash[:notice] = 'Contest was successfully created.'\n format.html { redirect_to(contests_path) }\n format.xml { render :xml => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @test_case_result = TestCaseResult.new(test_case_result_params)\n\n respond_to do |format|\n if @test_case_result.save\n format.html { redirect_to @test_case_result, notice: 'Test case result was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_case_result }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case_result.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def test_accueil_et_inscription\n\t\tpost '/accueil', identifiant: '2', date_naiss: '1915-12-19'\n\t\tassert last_response.body.include? 'son inscription'\n\tend",
"def post_ruby\n \n code = params[:code]\n step = params[:step]\n @step = Step.find(step)\n @valid = 0\n @testCount = @step.code_tests.count\n @step.code_tests.each do |test|\n code = validateCode(code)\n @testcode = code + \"\\n print \" + test.input \n testResult = testResult(@testcode)\n logger.info\"..............................#{testResult}\"\n if testResult.to_s == test.output \n @valid += 1 \n end\n \n \n end\n @message = \"#{@valid} out of #{@testCount} testcases passed\"\n render json: {status: 'SUCCESS', testPass: @valid, testCount: @testCount, message:@message },status: :ok\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end",
"def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def success\n [200, { 'Content-Type' => 'text/plain'}, ['OK']]\n end",
"def index\n @success_cases = SuccessCase.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @success_cases }\n end\n end",
"def create\n @contest_entry = ContestEntry.new(params[:contest_entry])\n\n respond_to do |format|\n if @contest_entry.save\n format.html { redirect_to new_contest_entry_path, :notice => 'Contest was successfully entered.' }\n format.xml { render :xml => @contest_entry, :status => :created, :location => @contest_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to(@test_suite, :notice => 'Test suite was successfully created.') }\n format.xml { render :xml => @test_suite, :status => :created, :location => @test_suite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_suite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def commit(xml)\n url = (test? ? test_url : live_url)\n\n response = parse(ssl_post(url, post_data(xml), 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'))\n\n Response.new(\n success_from(response),\n message_from(response),\n response,\n authorization: authorization_from(response),\n test: test?,\n error_code: error_code_from(response)\n )\n end",
"def new\n @test_case = TestCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case }\n end\n end",
"def test_index \n post :index \n assert_response :success \n end",
"def create\n @xmcoun = Xmcoun.new(xmcoun_params)\n\n respond_to do |format|\n if @xmcoun.save\n format.html { redirect_to xmcouns_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @xmcoun }\n else\n format.html { render :new }\n format.json { render json: @xmcoun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts \"My assert Attributes: #{params[:assert]}\"\n @assert = Assert.new(params[:assert])\n\n respond_to do |format|\n if @assert.save\n format.html { redirect_to @assert, notice: 'Assert was successfully created.' }\n format.json { render json: @assert, status: :created, location: @assert }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end",
"def test_should_create_project_via_API_XML\r\n get \"/logout\"\r\n post \"/projects.xml\", :api_key=>'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n end",
"def create\n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.new(params[:xml_sample])\n if @xml_sample.save\n redirect_to @xml_sample, notice: 'Xml sample was successfully created.'\n else\n render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n @xml_sample = XmlSample.new(attr[\"xmlsample\"])\n if @xml_sample.save\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end",
"def create\n @test = TkdTest.new(params[:tkd_test])\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to(:back, :notice => 'Test was successfully created.') }\n format.xml { render :xml => @test, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @req_breakdown = ReqBreakdown.new(params[:req_breakdown])\n\n respond_to do |format|\n if @req_breakdown.save\n flash[:notice] = 'ReqBreakdown was successfully created.'\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { render :xml => @req_breakdown, :status => :created, :location => @req_breakdown }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @req_breakdown.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.build(params[:absence_request])\n\n respond_to do |format|\n if @absence_request.save\n format.html { redirect_to taskrequest_process_step_url(@step.taskrequest), :notice => 'Aanvraag Afwezigheid was succesvol verstuurd.' }\n format.xml { render :xml => @absence_request, :status => :created, :location => @absence_request }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @success_case = SuccessCase.find(params[:id])\n @success_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(success_cases_url) }\n format.xml { head :ok }\n end\n end",
"def create\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Nces06School\n @nces06_school = Portal::Nces06School.new(portal_nces06_school_strong_params(params[:nces06_school]))\n\n respond_to do |format|\n if @nces06_school.save\n flash['notice'] = 'Portal::Nces06School was successfully created.'\n format.html { redirect_to(@nces06_school) }\n format.xml { render :xml => @nces06_school, :status => :created, :location => @nces06_school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nces06_school.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sf_case = SFCase.create(sf_case_params.to_h.symbolize_keys)\n respond_to do |format|\n if @sf_case.sf_valid?\n set_success_flash_message(\"Case was successfully created.\")\n format.html { redirect_to @sf_case}\n format.json { render :show, status: :created, location: @sf_case.Id }\n else\n set_flash_error_message\n format.html { render :new }\n format.json { render json: @sf_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @case_doc = CaseDoc.new(case_doc_params)\n\n respond_to do |format|\n if @case_doc.save\n format.html { redirect_to @case_doc, notice: 'Case doc was successfully created.' }\n format.json { render :show, status: :created, location: @case_doc }\n else\n format.html { render :new }\n format.json { render json: @case_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\r\n end",
"def test_no_death_type_required \n copy = Copy.find(2001)\n assert_equal(copy.death_type_id, nil)\n\n get :start\n\n assert_response :success \n assert_template 'start'\n assert_equal(2001, assigns[\"inventory\"][\"startID\"])\n\n post(:start, \"inventory\" => { \"startID\" => \"2001\", \"endID\" => \"2005\"})\n get :in_progress\n\n ret = post :scan_dvd, \"barcode\" => \"2001\"\n assert ret.body.match(\"2001 - here\")\n \n end",
"def post\n resource.post(request, response)\n end",
"def create\n @user_testcase_xref = UserTestcaseXref.new(params[:user_testcase_xref])\n\n respond_to do |format|\n if @user_testcase_xref.save\n format.html { redirect_to(@user_testcase_xref, :notice => 'User testcase xref was successfully created.') }\n format.xml { render :xml => @user_testcase_xref, :status => :created, :location => @user_testcase_xref }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_testcase_xref.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def create\n @case_support = CaseSupport.new(case_support_params)\n\n respond_to do |format|\n if @case_support.save\n format.html { redirect_to @case_support, notice: 'Case support was successfully created.' }\n format.json { render :show, status: :created, location: @case_support }\n else\n format.html { render :new }\n format.json { render json: @case_support.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clinica = Clinica.new(clinica_params)\n @clinica.estatus = \"A\" \n respond_to do |format|\n if @clinica.save\n format.html { redirect_to @clinica, notice: 'La clinica fue registrada exitosamente.' }\n format.json { render :show, status: :created, location: @clinica }\n else\n format.html { render :new }\n format.json { render json: @clinica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit\n\t\tcontest_id = get_params[:contest_id]\n\t\tstudent_id = current_student.id\n\t\tcproblem_id = get_params[:cproblem_id]\n\t\tstatus = get_params[:status]\n\t\tCproblem.submit(contest_id, cproblem_id, student_id, status)\n\t\trender json: {}\n\tend",
"def create\n @assert = Assert.new(params[:assert])\n\n respond_to do |format|\n if @assert.save\n format.html { redirect_to @assert, notice: 'Assert was successfully created.' }\n format.json { render json: @assert, status: :created, location: @assert }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_test = TestTest.new(params[:test_test])\n\n respond_to do |format|\n if @test_test.save\n format.html { redirect_to(@test_test, :notice => 'TestTest was successfully created.') }\n format.xml { render :xml => @test_test, :status => :created, :location => @test_test }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end",
"def create\n @suc = Suc.new(params[:suc])\n\n respond_to do |format|\n if @suc.save\n format.html { redirect_to @suc, notice: 'Suc was successfully created.' }\n format.json { render json: @suc, status: :created, location: @suc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @suc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generatesingletestplan\n\trelease = params[:release]\n\tpriority = params[:priority]\n\texectype = params[:exectype]\n\ttimelimit = params[:timelimit]\n\t# получаем с сервера нужные данные\n\tmds = Hash.new()\n\tTCPSocket.open('172.20.5.130', 2000){ |client|\n\t\t# say Hello to server\n\t\tclient.puts \"MasterOnline\"\n\t\tclient.gets\n\t\tclient.puts \"master_set get_singletestplan #{release} #{priority} #{exectype} #{timelimit}\"\n\t\tmds = JSON.parse(client.gets)\n\t\tclient.puts \"master_set close_connection\"\n\t}\n\t# подготавливаем данные для отправки на веб страницу\n\tnewTree = mds\n\t#newTree = newTree[\"TestItem\"][0]\n\t# новое дерево\n\t# вводим фиктивную вершину\n\tvalue = Hash.new()\n\tvalue[:data] = \"Тестирование \" + release\n\t\tfalseAttr = Hash.new()\n\t\tfalseAttr[:class] = \"jstree-checked\"\n\t\tfalseAttr[:id] = \"0001\"\n\t\tfalseAttr[:MethodName] = \"\"\n\t\tfalseAttr[:UnitName] = \"\"\n\tvalue[:attr] = falseAttr\n\t# получаем дерево\n\tchildrens = Array.new()\n\tnewTree[\"TestItem\"].each do |x|\n\t\ttree = createTreeForView(x)\n\t\tchildrens.push(tree)\n\tend\n\tvalue[:children] = childrens\n\trawarray = { :data => value}\n\tmds_for_send = rawarray.to_json\n\trender :text => mds_for_send\n end",
"def index\n @testcases = Testcase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @testcases }\n end\n end",
"def post; end",
"def create\n @patentcase = Patentcase.new(params[:patentcase])\n\n respond_to do |format|\n if @patentcase.save\n format.html { redirect_to @patentcase, :notice => 'Patentcase was successfully created.' }\n format.json { render :json => @patentcase, :status => :created, :location => @patentcase }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @patentcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n a = \"http://67.215.224.75/billing/api/login?u=#{params[:session][:email]}&p=#{params[:session][:password]}\" \n \n # Nokogiri Gem is used to Catch the XML response from the MOR & call the appropriate action on the received status\n \n doc = Nokogiri::XML(open(a))\n doc.xpath('/action/status').each do |link| \n @abc = link.content\n end \n \n # Condition to check whether the received response is 'Ok' or 'Failed' \n \n if @abc == 'failed'\n \n flash[:notice] = \"Invalid Username/Password\" # If condition is failed redirect to root page\n redirect_to '/' \n else\n \t\t# if condition is 'ok' redirect to MOR user dashboard\n \t\t\n redirect_to \"http://67.215.224.75/billing/api/login?u=#{params[:session][:email]}&p=#{params[:session][:password]}\"\n end \n end",
"def create\n @it_case = ItCase.new(params[:it_case])\n @it_case.user_id=current_user.id\n @it_case.ipaddress=request.remote_ip\n @it_case.status=ItCase::STATUSES['Waiting']\n @it_case.opened_time=Time.now\n @it_case.created_type='web'\n @it_case.creator_id=current_user.id\n respond_to do |format|\n if @it_case.save\n format.html { redirect_to mycases_path, notice: '工单已建立' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n @step = Step.new(params[:step])\n @test_case = TestCase.find(params[:test_case_id])\n @step.test_case_id = @test_case.id\n\n if @step.save\n flash[:notice] = \"Successfully created step.\"\n end\n respond_with @step\n end",
"def create\n @test_plant = TestPlant.new(params[:test_plant])\n\n respond_to do |format|\n if @test_plant.save\n format.html { redirect_to(:action => :index, :notice => CREATE_MSG) }\n format.xml { render :xml => @test_plant, :status => :created, :location => @test_plant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_plant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n contest = contest_params[:contest]\n puts contest\n @contest = Contests.create(contest_params)\n respond_to do |format|\n unless @contest.nil?\n @contest[:createContest] = @contest[\"createContest\"]\n format.html { redirect_to \"/contests/view/#{@contest[:createContest]}\" }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @post157 = Post157.new(params[:post157])\n\n respond_to do |format|\n if @post157.save\n format.html { redirect_to(@post157, :notice => 'Post157 was successfully created.') }\n format.xml { render :xml => @post157, :status => :created, :location => @post157 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post157.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def validate_order() \n\tputs \"Validating order\" \n\tdata = create_order()\n\tresponse = request_post(\"/api/order/validate\", data)\n\tputs response.body\nend",
"def new\n @testcase = Testcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testcase }\n end\n end",
"def postSuccessResult(caseId)\n puts \"----------------------------------------------------------------------------------\"\n puts \"\"\n @testRailUtility.postResult(caseId,\"Pass\",1,@runId)\n @passedLogs = @objRollbar.addLog(\"[Result ] Success\")\nend",
"def test_client_post\n client = CoAP::Client.new\n answer = client.post('coap.me', 5683, '/test', 'TD_COAP_CORE_04')\n assert_equal(2, answer.mcode[0])\n assert_equal(1, answer.mcode[1])\n assert_equal('POST OK', answer.payload)\n end",
"def create\n @invest = Invest.new(params[:invest])\n\n respond_to do |format|\n if @invest.save\n format.html { redirect_to(@invest, :notice => 'Invest was successfully created.') }\n format.xml { render :xml => @invest, :status => :created, :location => @invest }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @estados_civil = EstadosCivil.new(params[:estados_civil])\n\n respond_to do |format|\n if @estados_civil.save\n flash[:notice] = 'EstadosCivil was successfully created.'\n format.html { redirect_to(@estados_civil) }\n format.xml { render :xml => @estados_civil, :status => :created, :location => @estados_civil }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estados_civil.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @code_case = CodeCase.new(code_case_params)\n\n respond_to do |format|\n if @code_case.save\n format.html { redirect_to design_cases_path, notice: 'Code case was successfully created.' }\n format.json { render :show, status: :created, location: @code_case }\n else\n format.html { render :new }\n format.json { render json: @code_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_steps(test_case,id)\n testrail_api_client.send_post(\"update_case/#{id}\",test_case_data(test_case))\n end",
"def create\n ActiveRecord::Base.transaction do\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'El Estado se creó exitosamente.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @success_case = SuccessCase.find(params[:id])\n\n respond_to do |format|\n if @success_case.update_attributes(params[:success_case])\n format.html { redirect_to(@success_case, :notice => 'Success case was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_new_case(project_id,suite_id,sub_section_id,test_case)\n testrail_api_client.send_post(\"add_case/#{sub_section_id || suite_id}\",test_case_data(test_case))\n end",
"def success\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_post(data_xml,url)\r\n result = @client.post(self.target_uri(url), :body => data_xml , :head => {'Content-Type' => 'application/xml'} ) \r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200') \r\n #reply = Reply.from_xml(result.http_body)\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end",
"def create\n @casefile = Casefile.new(casefile_params)\n\n respond_to do |format|\n if @casefile.save\n format.html { redirect_to @casefile, notice: 'Casefile was successfully created.' }\n format.json { render :show, status: :created, location: @casefile }\n else\n format.html { render :new }\n format.json { render json: @casefile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def create\n @computer_case = ComputerCase.new(computer_case_params)\n\n respond_to do |format|\n if @computer_case.save\n format.html { redirect_to @computer_case, notice: 'Computer case was successfully created.' }\n format.json { render :show, status: :created, location: @computer_case }\n else\n format.html { render :new }\n format.json { render json: @computer_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end",
"def create\n @trial = Trial.new(params[:trial])\n\n respond_to do |format|\n if @trial.save\n format.html { redirect_to(@trial, :notice => 'Trial was successfully created.') }\n format.xml { render :xml => @trial, :status => :created, :location => @trial }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trial.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def incident_create(statuspage_id, incident_name, incident_details, infrastructure_affected, current_status, current_state, notifications = 0, all_infrastructure_affected = \"0\", message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_name'] = incident_name\n data['incident_details'] = incident_details\n data['infrastructure_affected'] = infrastructure_affected\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['message_subject'] = message_subject\n\n request :method => :post,\n \t :url => @url + 'incident/create',\n \t :payload => data\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def create\n @support_case = current_user.support_cases.build(support_case_params)\n\n respond_to do |format|\n if @support_case.save\n format.html { redirect_to @support_case, notice: 'Support case was successfully created.' }\n format.json { render :show, status: :created, location: @support_case }\n else\n format.html { render :new }\n format.json { render json: @support_case.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6223572",
"0.6124578",
"0.6041465",
"0.59874254",
"0.58132744",
"0.5776564",
"0.57702976",
"0.57531375",
"0.5610341",
"0.5606711",
"0.5603246",
"0.5596353",
"0.55935186",
"0.5586568",
"0.55494636",
"0.55362743",
"0.54992384",
"0.5491635",
"0.54849863",
"0.5481841",
"0.5481231",
"0.54783505",
"0.5471104",
"0.545756",
"0.5457101",
"0.54361665",
"0.542731",
"0.5425568",
"0.5403277",
"0.53925717",
"0.5389531",
"0.5379522",
"0.53675824",
"0.53632694",
"0.53632694",
"0.5345626",
"0.5340282",
"0.5339966",
"0.53121513",
"0.53114665",
"0.5307659",
"0.52803344",
"0.5272241",
"0.5258867",
"0.5248272",
"0.5238131",
"0.52342844",
"0.52292395",
"0.52165747",
"0.5207536",
"0.52048224",
"0.51947194",
"0.51931506",
"0.51677704",
"0.5165287",
"0.51649773",
"0.5162464",
"0.51564246",
"0.514567",
"0.5138596",
"0.512975",
"0.51269144",
"0.5124124",
"0.5122439",
"0.51211256",
"0.5119246",
"0.51166385",
"0.51155937",
"0.5112005",
"0.51080775",
"0.51062346",
"0.51051396",
"0.50998807",
"0.50994897",
"0.5096737",
"0.50960666",
"0.5094779",
"0.5093579",
"0.5087594",
"0.50862867",
"0.5074234",
"0.50686306",
"0.50681484",
"0.50650096",
"0.50583434",
"0.5057286",
"0.50499064",
"0.50476956",
"0.5043488",
"0.5043488",
"0.5043488",
"0.50357115",
"0.50343484",
"0.5033971",
"0.5031664",
"0.5030941",
"0.5029937",
"0.50262076",
"0.50238836",
"0.5023397"
] | 0.6777465 | 0 |
PUT /success_cases/1 PUT /success_cases/1.xml | def update
@success_case = SuccessCase.find(params[:id])
respond_to do |format|
if @success_case.update_attributes(params[:success_case])
format.html { redirect_to(@success_case, :notice => 'Success case was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @test_case = TestCase.find(params[:id])\n\n respond_to do |format|\n if @test_case.update_attributes(params[:test_case])\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def 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 update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n flash[:notice] = 'Testcase was successfully updated.'\n format.html { redirect_to(@testcase) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def 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 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\n @test_case_entry = TestCaseEntry.find(params[:id])\n\n respond_to do |format|\n if @test_case_entry.update_attributes(params[:test_case_entry])\n format.html { redirect_to(@test_case_entry, :notice => 'Test case entry was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_case_entry.errors, :status => :unprocessable_entity }\n end\n end\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\")\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 @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n else\n return render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n if @xml_sample.update_attributes(attr[\"xmlsample\"])\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n params.permit!\n @security_case = SecurityCase.find(params[:id])\n\n respond_to do |format|\n if @security_case.update_attributes(params[:security_case])\n format.html { redirect_to(@security_case, :notice => 'Security case was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @security_case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to(@contest, :notice => 'Contest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n flash[:notice] = 'Contest was successfully updated.'\n format.html { redirect_to(@contest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\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\n @case = Case.find(params[:id])\n \n\t\n respond_to do |format|\n if @case.update_attributes(params[:case])\n\t \n format.js \n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n flash[:notice] = 'Contest was successfully updated.'\n format.html { redirect_to(contests_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\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 => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update_case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"cases/#{id}\",options)\n response.case\n end",
"def update\n @it_case = ItCase.find(params[:id])\n\n respond_to do |format|\n if @it_case.update_attributes(params[:it_case])\n format.html { redirect_to mycases_path, notice: '已完成评价' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @it_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n if @clientcase.update_attributes(params[:clientcase])\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @clientcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find_by(path: params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to contest_path(@contest.path)+'/upload' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_change_status\n expected = 200\n post_id = 1\n data = {\n status: 1\n }\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s+'/status')\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n respond_to do |format|\n if @case_doc.update(case_doc_params)\n format.html { redirect_to @case_doc, notice: 'Case doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_doc }\n else\n format.html { render :edit }\n format.json { render json: @case_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: updates the database with info about contest with \"id provided by user via 'edit.'\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n flash[:notice] = 'Contest was successfully updated.'\n format.html { redirect_to(@contest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @casefile.update(casefile_params)\n format.html { redirect_to @casefile, notice: 'Casefile was successfully updated.' }\n format.json { render :show, status: :ok, location: @casefile }\n else\n format.html { render :edit }\n format.json { render json: @casefile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n\n respond_to do |format|\n if @user_testcase_xref.update_attributes(params[:user_testcase_xref])\n format.html { redirect_to(@user_testcase_xref, :notice => 'User testcase xref was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_testcase_xref.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def update\n @test_cancel = TestCancel.find(params[:id])\n\n respond_to do |format|\n if @test_cancel.update_attributes(params[:test_cancel])\n format.html { redirect_to(@test_cancel, :notice => 'TestCancel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_cancel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to cases_path, notice: 'Case was successfully updated.' }\n format.json { render action: 'index' }\n else\n format.html { render action: 'edit' }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return false unless authorize(permissions = [\"update_casefile\"])\n\n @case_file = CaseFile.find(params[:id])\n\n respond_to do |format|\n if @case_file.update_attributes(params[:case_file])\n flash.now[:notice] = t(\"case_file.messages.update_success\")\n format.html { redirect_to patient_case_file_path(:patient_id => params[:patient_id], :id => params[:id]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @case_file.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.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 update\n @step = Step.find(params[:id])\n @test_case = TestCase.find(params[:test_case_id])\n @step.test_case_id = @test_case.id\n\n if @step.update_attributes(params[:step])\n flash[:notice] = 'Step was successfully updated.'\n end\n respond_with @step\n end",
"def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end",
"def update\n @test_obj2 = TestObj2.find(params[:id])\n\n respond_to do |format|\n if @test_obj2.update_attributes(params[:test_obj2])\n format.html { redirect_to(@test_obj2, :notice => 'Test obj2 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_obj2.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def updateStatus\n\n storyURI = @details['Assets']['Asset']['href']\n\n statusXml = '<Asset>\n <Attribute name=\"Custom_JIRAIntStatus\" act=\"set\">' + @mapping.SendToJiraMap['Resolved in JIRA'] + '</Attribute>\n </Asset>'\n\n r_status = self.class.post(\"#{storyURI}\", :body => statusXml,\n :headers => {\"content_type\" => \"application/xml\"}, :verify => false)\n\n if r_status['Error']\n p r_status['Error']\n else\n @persist.updateDefectStatus(@story)\n return 1\n end\n return 0\n end",
"def update\n @use_case = UseCase.find(params[:id])\n @use_case.data = params[:data].to_json\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n\n if params[:subaction]==\"step\"\n format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case, :type=>\"step\"), notice: 'Use case was successfully updated.' }\n else\n format.html { redirect_to project_use_case_path(@project, @use_case), notice: 'Use case was successfully updated.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @success_case = SuccessCase.new(params[:success_case])\n\n respond_to do |format|\n if @success_case.save\n format.html { redirect_to(@success_case, :notice => 'Success case was successfully created.') }\n format.xml { render :xml => @success_case, :status => :created, :location => @success_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @test_suite = TestSuite.find(params[:test_suite_id])\n respond_to do |format|\n if @test_case.update(test_case_params)\n format.html { redirect_to test_suite_test_cases_path(@test_suite,@test_case), notice: 'Test case was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_case }\n else\n format.html { render :edit }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to @case, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to @case, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fault_type = FaultType.find(params[:id])\n\n respond_to do |format|\n if @fault_type.update_attributes(params[:fault_type])\n format.html { redirect_to(@fault_type, :notice => 'FaultType was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fault_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n if @nossos_servico.update_attributes(params[:nossos_servico])\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @reqinfo = Reqinfo.find(params[:id])\n\n respond_to do |format|\n if @reqinfo.update_attributes(params[:reqinfo])\n flash[:notice] = 'Reqinfo was successfully updated.'\n format.html { redirect_to(@reqinfo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reqinfo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vdocs_requirement = VdocsRequirement.find(params[:id])\n\t@contract = @vdocs_requirement.contract\n\n respond_to do |format|\n if @vdocs_requirement.update_attributes(params[:vdocs_requirement])\n flash[:notice] = 'VdocsRequirement was successfully updated.'\n format.html { redirect_to(@vdocs_requirement) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vdocs_requirement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @test_test = TestTest.find(params[:id])\n\n respond_to do |format|\n if @test_test.update_attributes(params[:test_test])\n format.html { redirect_to(@test_test, :notice => 'TestTest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to cases_path, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @defect = Defect.find(params[:id])\n\n respond_to do |format|\n if @defect.update_attributes(params[:defect])\n flash[:notice] = 'Defect was successfully updated.'\n format.html { redirect_to(@defect) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @defect.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @lab_rack = LabRack.find(params[:id])\n\n respond_to do |format|\n if @lab_rack.update_attributes(params[:lab_rack])\n format.html { redirect_to(@lab_rack, :notice => 'Lab rack was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lab_rack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n if @test_plan.update_attributes(params[:test_plan])\n format.html { redirect_to(@test_plan, :notice => 'Test plan was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[:investment])\n\n format.xml \n else\n\n format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n if @test_suite.update_attributes(params[:test_suite])\n format.html { redirect_to(@test_suite, :notice => 'Test suite was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_suite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end",
"def update\n @atest = Atest.find(params[:id])\n\n respond_to do |format|\n if @atest.update_attributes(params[:atest])\n flash[:notice] = 'Atest was successfully updated.'\n format.html { redirect_to(@atest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @testmethod = Testmethod.find(params[:id])\n\n respond_to do |format|\n if @testmethod.update_attributes(params[:testmethod])\n format.html { redirect_to(@testmethod, :notice => 'Test Method was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testmethod.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def update\n logger.debug \"---------------------\"\n logger.debug \"---------------------\"\n @testing = Testing.find(params[:id])\n\n respond_to do |format|\n if @testing.update_attributes(params[:testing])\n format.html { redirect_to(@testing, :notice => 'Testing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @case.update(case_params)\n format.html { redirect_to back_url, notice: 'Case was successfully updated.' }\n format.json { render :show, status: :ok, location: @case }\n else\n format.html { render :edit }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sti = Sti.find(params[:id])\n\n respond_to do |format|\n if @sti.update_attributes(params[:sti])\n flash[:notice] = 'Sti was successfully updated.'\n format.html { redirect_to(@sti) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sti.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @success_case = SuccessCase.find(params[:id])\n @success_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(success_cases_url) }\n format.xml { head :ok }\n end\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update\n @testament = Testament.find(params[:id])\n\n respond_to do |format|\n if @testament.update_attributes(params[:testament])\n flash[:notice] = 'Testament was successfully updated.'\n format.html { redirect_to(@testament) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testament.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def updateX\n @server = Server.find(params[:id])\n\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to(@server, :notice => 'Server was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @server.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_update\n\n doc_one = document_types(:doc_one)\n document_type = DocumentType.find(doc_one.id)\n document_type.name = 'Test'\n\n get(:update, { :document_type => document_type.attributes }, cathy_admin_session)\n assert_equal('Update recorded', flash['notice'])\n assert_equal('Test', document_type.name)\n assert_redirected_to(:action => 'edit', :id => document_type.id)\n \n end",
"def update\n @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n if @test_file.update_attributes(params[:test_file])\n format.html { redirect_to @test_file, notice: 'Test file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @colonoscopytest = Colonoscopytest.find(params[:id])\n\n respond_to do |format|\n if @colonoscopytest.update_attributes(params[:colonoscopytest])\n format.html { redirect_to(@colonoscopytest, :notice => 'Colonoscopytest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @colonoscopytest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @city = City.find(params[:id])\n if @city.update_attributes(:name=>params[:body][:name],:step=>\"1\")\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@city.errors)\n end\n end",
"def update\n @cst_ipi = CstIpi.find(params[:id])\n\n respond_to do |format|\n if @cst_ipi.update_attributes(params[:cst_ipi])\n flash[:notice] = 'S.T. para Ipi atualizada.'\n format.html { redirect_to(@cst_ipi) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cst_ipi.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, :notice => 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_case.update(test_case_params)\n TestMailer.admin_test_updated_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @t1 = T1.find(params[:id])\n\n respond_to do |format|\n if @t1.update_attributes(params[:t1])\n flash[:notice] = 'T1 was successfully updated.'\n format.html { redirect_to(@t1) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @t1.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @assert = Assert.find(params[:id])\n\n respond_to do |format|\n if @assert.update_attributes(params[:assert])\n format.html { redirect_to @assert, notice: 'Assert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @checkpoint = Checkpoint.find(params[:id])\n respond_to do |format|\n if @checkpoint.update_attributes(params[:checkpoint])\n ##format.html { redirect_to(@checkpoint, :notice => 'Checkpoint was successfully updated.') }\n ##format.xml { head :ok }\n format.html { redirect_to(:action => :index) }\n format.xml { redirect_to(:action => :index) }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @checkpoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n if @csosn.update_attributes(params[:csosn])\n format.html { redirect_to @csosn, notice: 'Csosn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @task = context.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(redirect, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { redirect_to(redirect, :notice => 'Please try again') }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end",
"def update\n @incidenttype = Incidenttype.find(params[:id])\n\n respond_to do |format|\n if @incidenttype.update_attributes(params[:incidenttype])\n flash[:notice] = 'Incidenttype was successfully updated.'\n format.html { redirect_to(@incidenttype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incidenttype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ai_contest = AiContest.find(params[:id])\n\n respond_to do |format|\n if @ai_contest.update_attributes(ai_contest_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end",
"def update\n @assert = Assert.find(params[:id])\n\n respond_to do |format|\n if @assert.update_attributes(params[:assert])\n format.html { redirect_to @assert, notice: 'Assert was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assert.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.64020705",
"0.63010824",
"0.6277032",
"0.61977327",
"0.6163166",
"0.60461843",
"0.60460335",
"0.5972965",
"0.5959552",
"0.58750653",
"0.5868366",
"0.5858697",
"0.58387727",
"0.5832719",
"0.58182806",
"0.5773983",
"0.57547796",
"0.57533574",
"0.5734928",
"0.5732424",
"0.57191336",
"0.57188463",
"0.57157546",
"0.5692076",
"0.5689955",
"0.5683403",
"0.56812733",
"0.5679294",
"0.56704545",
"0.56578606",
"0.56489635",
"0.56413853",
"0.5623492",
"0.5623477",
"0.5618825",
"0.5618255",
"0.5611379",
"0.5610938",
"0.5610739",
"0.5604937",
"0.5570653",
"0.5570653",
"0.5567573",
"0.5563579",
"0.55512416",
"0.55475664",
"0.554725",
"0.55414104",
"0.5534364",
"0.5534364",
"0.55299705",
"0.55252606",
"0.55238104",
"0.55102754",
"0.550972",
"0.5493714",
"0.54793024",
"0.5478883",
"0.5476453",
"0.5476001",
"0.5465632",
"0.5461879",
"0.54583615",
"0.5455747",
"0.5446275",
"0.54358274",
"0.543242",
"0.54257005",
"0.54229563",
"0.54225487",
"0.54207706",
"0.5416986",
"0.541153",
"0.541153",
"0.541153",
"0.54092616",
"0.5401422",
"0.5394954",
"0.53926736",
"0.5388694",
"0.53772956",
"0.53765625",
"0.53741467",
"0.53738904",
"0.53721577",
"0.53706336",
"0.53642297",
"0.53640383",
"0.5361049",
"0.5360382",
"0.53557235",
"0.53557235",
"0.53496313",
"0.53494143",
"0.5348941",
"0.53412396",
"0.53397506",
"0.5338457",
"0.5335975",
"0.5335051"
] | 0.67778033 | 0 |
DELETE /success_cases/1 DELETE /success_cases/1.xml | def destroy
@success_case = SuccessCase.find(params[:id])
@success_case.destroy
respond_to do |format|
format.html { redirect_to(success_cases_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test_case = TestCase.find(params[:id])\n @test_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_cases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_case = current_user.test_cases.find(params[:id])\n @test_case.logical_delete\n \n respond_to do |format|\n format.html { redirect_to(test_cases_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(testcases_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @case = Case.find(params[:id])\n @case.destroy\n\n respond_to do |format|\n format.html { redirect_to(cases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @security_case = SecurityCase.find(params[:id])\n @security_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(security_cases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def destroy\n @test_case_entry = TestCaseEntry.find(params[:id])\n @test_case_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_case_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @colonoscopytest = Colonoscopytest.find(params[:id])\n @colonoscopytest.destroy\n\n respond_to do |format|\n format.html { redirect_to(colonoscopytests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @showcase = Showcase.find(params[:id])\n @showcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(showcases_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\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 destroy\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: deletes the information in the database of the contest with :id\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @atest = Atest.find(params[:id])\n @atest.destroy\n\n respond_to do |format|\n format.html { redirect_to(atests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @file_attachment = FileAttachment.find(params[:id])\n @test_case = @file_attachment.test_case\n @file_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(@test_case || file_attachments_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_suites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @visarequest = Visarequest.find(params[:id])\n @visarequest.destroy\n\n respond_to do |format|\n format.html { redirect_to(visarequests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return false unless authorize(permissions = [\"destroy_casefile\"])\n\n @case_file = CaseFile.find(params[:id])\n @case_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(patient_case_files_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_test = TestTest.find(params[:id])\n @test_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_tests_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test = TkdTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @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.xml { head :ok }\n end\n end",
"def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @upload_file = UploadFile.find(params[:id])\n doc_no=@upload_file.doc_no\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to upload_files_url(:doc_no=>doc_no) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_obj2 = TestObj2.find(params[:id])\n @test_obj2.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_obj2s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @segment_detail = SegmentDetail.find(params[:id])\n @segment_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(segment_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @suite = Suite.find(params[:id])\n @suite.destroy\n\n respond_to do |format|\n format.html { redirect_to(suites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @suite = Suite.find(params[:id])\n @suite.destroy\n\n respond_to do |format|\n format.html { redirect_to(suites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @convenio = Convenio.find(params[:id])\n @convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to(convenios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuss_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test = Test.find_by_id(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to user_subject_tests_path }\n format.xml { head :ok }\n end\n end",
"def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @test = Mg::Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(mg_tests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expectation = RiGse::Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to(expectations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sampleunit = Sampleunit.find(params[:id])\n @sampleunit.destroy\n\n respond_to do |format|\n format.html { redirect_to(sampleunits_url) }\n format.xml { head :ok }\n end\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conseq = Conseq.find(params[:id])\n @conseq.destroy\n\n respond_to do |format|\n format.html { redirect_to(conseqs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @normal_example = NormalExample.find(params[:id])\n @normal_example.destroy\n\n respond_to do |format|\n format.html { redirect_to(normal_examples_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stepsix = Stepsix.find(params[:id])\n @stepsix.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepsixes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cv.destroy\n\n respond_to do |format|\n format.html { redirect_to(cvs_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feefile = Feefile.find(params[:id])\n directory= \"uploads\"\n path =File.join(directory,@feefile.feefilename)\n File.delete(path)\n @feefile.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(feefiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @casefile.destroy\n respond_to do |format|\n format.html { redirect_to casefiles_url, notice: 'Casefile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @draft_investment = DraftInvestment.find(params[:id])\n @draft_investment.destroy\n\n respond_to do |format|\n\n format.xml { head :ok }\n end\n end",
"def destroy\n @finca = Finca.find(params[:id])\n @finca.destroy\n\n respond_to do |format|\n format.html { redirect_to(fincas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @raw_data_file = RawDataFile.find(params[:id])\n @raw_data_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(raw_data_files_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @breakdown = Breakdown.find(params[:id])\n @breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def delete\n @res = DialResult.find(params[:id])\n\t@res.destroy\n respond_to do |format|\n format.html { redirect_to :action => 'index' }\n format.xml { head :ok }\n end\n end",
"def destroy\n @certidao = Certidao.find(params[:id])\n @certidao.destroy\n\n respond_to do |format|\n format.html { redirect_to(certidaos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @concert = Concert.find(params[:id])\n @concert.destroy\n\n respond_to do |format|\n format.html { redirect_to(concerts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testing = Testing.find(params[:id])\n @testing.destroy\n\n respond_to do |format|\n format.html { redirect_to(testings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @certificado = Certificado.find(params[:id])\n @certificado.destroy\n\n respond_to do |format|\n format.html { redirect_to(certificados_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @centru = Centru.find(params[:id])\n @centru.destroy\n\n respond_to do |format|\n format.html { redirect_to(centrus_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end",
"def delete_test\n @project = Project.find(params[:id])\n @testk= @project.testxes.find(params[:test_id])\n if @testk\n @project.testxes.delete(@testk)\n end\n redirect_to :action => 'analyses'\n end",
"def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @accordion = Accordion.find(params[:id])\n @accordion.destroy\n\n respond_to do |format|\n format.html { redirect_to(accordions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @case_doc.destroy\n respond_to do |format|\n format.html { redirect_to case_docs_url, notice: 'Case doc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @dcf = Dcf.find(params[:id])\r\n @dcf.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(dcfs_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n #FIXME: Double check auth is working for deletion. Also, maybe should only delete if not associated with any experiments.\n @data_file.destroy\n \n respond_to do |format|\n format.html { redirect_to(data_files_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_test = Admin::Test.find(params[:id])\n @admin_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @case_test.destroy\n respond_to do |format|\n format.html { redirect_to case_tests_url, notice: 'Case test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @asignacionexa = Asignacionlabexa.find(params[:id])\r\n @asignacionexa.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacionlabexas_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @correspondenciasclase = Correspondenciasclase.find(params[:id])\n @correspondenciasclase.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondenciasclases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sa = Sa.find(params[:id])\n @sa.destroy\n\n respond_to do |format|\n format.html { redirect_to(sas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testament = Testament.find(params[:id])\n @testament.destroy\n\n respond_to do |format|\n format.html { redirect_to(testaments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @decision = Decision.find(params[:id])\n @decision.destroy\n\n respond_to do |format|\n format.html { redirect_to(decisions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dataset.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(datasets_url) }\n wants.xml { head :ok }\n end\n end",
"def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @step2 = Proce.find(params[:id])\n @step2.destroy\n\n respond_to do |format|\n format.html { redirect_to(step2s_url) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\"}'}\n end\n end"
] | [
"0.7005719",
"0.6901507",
"0.68910986",
"0.6741006",
"0.66881853",
"0.65945673",
"0.65445304",
"0.6529602",
"0.6526828",
"0.6489677",
"0.6485505",
"0.64402807",
"0.63797367",
"0.6323074",
"0.63193613",
"0.6314524",
"0.6300124",
"0.62943196",
"0.62943196",
"0.62943196",
"0.6288023",
"0.6273194",
"0.6273029",
"0.6266415",
"0.62557715",
"0.624243",
"0.6230218",
"0.6228924",
"0.6228367",
"0.62257123",
"0.62102675",
"0.6209044",
"0.6193015",
"0.61898994",
"0.61876184",
"0.61558074",
"0.613474",
"0.61087286",
"0.60948443",
"0.609078",
"0.6088579",
"0.6078311",
"0.60754687",
"0.60649425",
"0.6062931",
"0.6062931",
"0.60602033",
"0.60592455",
"0.60538965",
"0.60447884",
"0.60398746",
"0.6036957",
"0.6033223",
"0.60326415",
"0.60303116",
"0.60284096",
"0.6027808",
"0.60166264",
"0.60148394",
"0.6014513",
"0.60072184",
"0.60009396",
"0.59998006",
"0.5999377",
"0.5996045",
"0.59920985",
"0.5989394",
"0.59832424",
"0.59799725",
"0.59771776",
"0.59722656",
"0.59685284",
"0.59681517",
"0.5965423",
"0.5964478",
"0.59616274",
"0.59592706",
"0.59586465",
"0.5958639",
"0.59514314",
"0.5950296",
"0.594739",
"0.5947106",
"0.5947106",
"0.5946193",
"0.5945808",
"0.5944287",
"0.59427637",
"0.5941476",
"0.5936267",
"0.593272",
"0.5931309",
"0.5929411",
"0.59270847",
"0.592581",
"0.5924803",
"0.59247625",
"0.5924685",
"0.5923434",
"0.59212816"
] | 0.7248163 | 0 |
GET /book_pages GET /book_pages.json | def index
@book_pages = @book.book_pages
respond_to do |format|
format.html # index.html.erb
format.json { render json: @book_pages }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end",
"def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @books }\r\n end\r\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @title = \"List Books\"\n @books = Book.paginate :page=>params[:page], :per_page => 100, :order => 'title'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @books = Book.all\n render json: @books\n end",
"def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end",
"def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.json { render json: @pages }\n format.xml { render xml: @pages }\n end\n end",
"def pages\n get(\"v1/event/#{@id}/pages\")\n end",
"def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def index\n @pages = @offering.pages.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end",
"def get_page\n render_page_sections_json\n end",
"def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def get_pages(options = nil)\n @client.raw('get', '/content/pages', options)\n end",
"def index\n authorize! :query, Book\n @books = Book.order(:title)\n respond_to do |format|\n format.html\n format.json {render text: @books.to_json}\n format.xml {render text: @books.to_xml}\n end\n end",
"def new\n @book_page = @book.book_pages.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_page }\n end\n end",
"def book\n @book = Book.published.find(params[:id])\n render json: @book\n end",
"def show\n @page = @chapter.pages.find_by_number(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n @books = Book.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n end",
"def booking\n page = @site.pages.where(order: 2).first\n unless page\n head 404\n else\n render json: { content: Content.where(page_id: page.id, order: 0).first }\n end\n end",
"def pages\n get(\"v1/account/#{@email}/pages\")\n end",
"def index\n @books = Book.page(params[:page]) # utilise le helper du gem kaminari pour faire la pagination des livres automatiquement\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 @memos = @book.memos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @memos }\n end\n end",
"def index\n @enq_pages = EnqPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enq_pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format| \n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n\n end",
"def index\n @books = @collection.books\n #original: @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def show\n render json: @book\n end",
"def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end",
"def index\n @book_steps = @book.book_steps.all\n @book = @book\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_steps }\n end\n end",
"def pages\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end",
"def index\n @books = Book.order('created_at DESC').page(params[:page]).per_page(10).search(params[:search], params[:id])\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def index\n respond_with(pages)\n end",
"def index\n @pages = Page.all\n\n respond_with @pages\n end",
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def index\n @pages = Page.all\n respond_with(@pages)\n end",
"def index\n @pages = Page.all\n respond_with(@pages)\n end",
"def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end",
"def index\n #Page.all is fine for small sets of data, for larger sets pagination would be best\n @pages = data_cache('pages', 10.minutes) do\n Page.all\n end\n respond_to do |format|\n format.json { render action: 'index', status: :ok, location: api_pages_url(@pages) }\n format.xml { render xml: @pages, location: api_pages_url(@pages) }\n end\n end",
"def index\n @user_books = UserBook.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_books }\n end\n end",
"def index\n @ideas = current_user.ideas.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @chapters = @book.chapters\n @chapter_list = @chapters.to_json(:only => [:name, :chapter_start, :chapter_end]) if @chapters.present?\n respond_to do |format|\n format.html\n format.json { \n render_json(@chapter_list)\n }\n end\n end",
"def index\n books = current_user.books.all\n render json: { books: books }\n end",
"def index\n @bookmark_stats = BookmarkStat.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bookmark_stats }\n end\n end",
"def index\n @phrasebooks = Phrasebook.all\n\n render json: @phrasebooks\n end",
"def index\n @page = Page.find(params[:page_id])\n @revisions = @page.revisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revisions }\n end\n end",
"def index\n @books = Book.page(params[:page]).order(id: :desc)\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end",
"def index\n @pages = Page.all\n respond_with(@pages)\n end",
"def index\n @kidandparentbooks = Kidandparentbook.search(params[:search]).paginate(:per_page => 18, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kidandparentbooks }\n end\n end",
"def index\n @books = Book.all\n do_response @books\n #\n #respond_to do |format|\n # format.html # index.html.erb\n #format.json { render :json => @books }\n #end\n end",
"def index\n @guides = Guide.page(1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:guides => @guides.as_json} }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def book_pages\n\t\t@book = {\n\t\t\t\t\"sketch\" =>\n\t\t\t\t\"\t\t\t\t------------------------------------------\n\t\t\t\t| |\n\t\t\t\t| ----- |\n\t\t\t\t| / _ \\\\ |\n\t\t\t\t| / | | \\\\ |\n\t\t\t\t| --------- |\n\t\t\t\t| |\n\t\t\t\t| ____ _____ |\n\t\t\t\t| / \\\\____ /| \\\\__ |\n\t\t\t\t| / \\\\_____/ | \\\\_______ |\n\t\t\t\t| _____ |____ |\n\t\t\t\t| / \\\\____ /* \\\\__ |\n\t\t\t\t| / \\\\_____/ \\\\_______ |\n\t\t\t\t| |\n\t\t\t\t| |\n\t\t\t\t| _ |\n\t\t\t\t| / \\\\__ ___ |\n\t\t\t\t| /__/ \\\\/ \\\\ |\n\t\t\t\t| /____\\\\____\\\\ |\n\t\t\t\t| |\n\t\t\t\t| |\n\t\t\t\t ------------------------------------------\",\n\n\t\t\t\t \"page1\" =>\n\t\t\t \t\"\t\t\t\t------------------------------------------\n\t\t\t\t| |\n\t\t\t\t| |\n\t\t\t\t| -oday-- met a ------------- loca- |\n\t\t\t\t| trib----- confirme------uspicions. |\n\t\t\t\t| Now I kn---how---------tr--sur-----. |\n\t\t\t\t| |\n\t\t\t\t| ---gh- |\n\t\t\t\t| m---? |\n\t\t\t\t| |\n\t\t\t\t| R----R--Y----B- |\n\t\t\t\t ------------------------------------------\",\n\n\t\t\t}\n\tend",
"def index\n @pages = @user.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @businessbooks = Businessbook.search(params[:search]).paginate(:per_page => 18, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @businessbooks }\n end\n end",
"def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @publishers = Publisher.order(\"id DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publishers }\n end\n end",
"def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n # you can use meta fields from your model instead (e.g. browser_title)\n # by swapping @page for @book in the line below:\n present(@page)\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end",
"def show\n render json: @page\n end",
"def index\n @notebooks = Notebook.all\n render json: @notebooks\n end",
"def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end",
"def pages; end",
"def index\n\n @books = Book.paginate(:page => params[:page], :per_page => 2)\n\n end",
"def index\n @books = Book.order('id').paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n @books = Book.extended_details\n\n render json: @books.as_json(\n only: [:id, :title, :author, :created_at, :total_income_cents, :copies_count, :remaining_copies_count, :loaned_copies_count]\n )\n end",
"def index\n @books = Book.order(\"year DESC\").paginate(page: params[:page], per_page: params[:per_page] ? params[:per_page] : 10)\n @books_all = @books\n\n if params[:type]\n if params[:type] == 'collections'\n @books = @books.where('book_type NOT IN (?)', ['Monograph', 'Monograph in a serial'])\n elsif params[:type] == 'monographs'\n @books = @books.where('book_type IN (?)', ['Monograph', 'Monograph in a serial'])\n end\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n @library_books = Library::Book.all.paginate(:page => params[:page], :per_page => 10)\n end",
"def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def get_pages\n @pages << base_gallery_url\n (@doc/\"a\").select{|a| a[\"href\"] =~ /ndxpage/}.each do |e|\n @pages << base_gallery_url_prefix + e[\"href\"]\n end\n puts \"got pages!\"\n puts @pages.inspect\n puts \"---\"\n end"
] | [
"0.7726357",
"0.7343921",
"0.72196895",
"0.7119161",
"0.710017",
"0.70552915",
"0.70552915",
"0.70552915",
"0.70552915",
"0.70552915",
"0.70552915",
"0.70552915",
"0.6990951",
"0.69235164",
"0.68995583",
"0.6894337",
"0.68879795",
"0.6860878",
"0.6841784",
"0.6833286",
"0.6749079",
"0.6727177",
"0.6726294",
"0.6715316",
"0.6711309",
"0.67103493",
"0.67103493",
"0.6706866",
"0.6684812",
"0.6672913",
"0.6635737",
"0.6612734",
"0.66043204",
"0.660021",
"0.65809625",
"0.65636986",
"0.6561401",
"0.65585446",
"0.6527638",
"0.6522545",
"0.65194595",
"0.65150845",
"0.650976",
"0.6508157",
"0.6507257",
"0.6499228",
"0.6499228",
"0.6499228",
"0.64954686",
"0.6481155",
"0.64794093",
"0.6477593",
"0.64757526",
"0.64606255",
"0.64606255",
"0.6448626",
"0.64368176",
"0.6428125",
"0.64200145",
"0.6416837",
"0.6416722",
"0.64114493",
"0.6407771",
"0.63885856",
"0.63872814",
"0.6383811",
"0.63774896",
"0.6361802",
"0.6351002",
"0.6341661",
"0.6338814",
"0.6338814",
"0.6338814",
"0.6338814",
"0.6338814",
"0.6338814",
"0.6338814",
"0.6338814",
"0.6338814",
"0.6331397",
"0.6319456",
"0.63185096",
"0.63185096",
"0.6306983",
"0.62926036",
"0.6289894",
"0.6286734",
"0.6284476",
"0.6283954",
"0.62778634",
"0.62770003",
"0.62767327",
"0.62759614",
"0.62674236",
"0.626276",
"0.62560636",
"0.6251177",
"0.624737",
"0.62416685",
"0.62358886"
] | 0.8323856 | 0 |
GET /book_pages/1 GET /book_pages/1.json | def show
@book_page = @book.book_pages.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @book_page }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end",
"def show\n @page = @chapter.pages.find_by_number(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @books }\r\n end\r\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @title = \"List Books\"\n @books = Book.paginate :page=>params[:page], :per_page => 100, :order => 'title'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def book\n @book = Book.published.find(params[:id])\n render json: @book\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def new\n @book_page = @book.book_pages.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_page }\n end\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def booking\n page = @site.pages.where(order: 2).first\n unless page\n head 404\n else\n render json: { content: Content.where(page_id: page.id, order: 0).first }\n end\n end",
"def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n @books = Book.all\n render json: @books\n end",
"def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def get_page\n render_page_sections_json\n end",
"def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end",
"def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def show\n render json: @book\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.json { render json: @pages }\n format.xml { render xml: @pages }\n end\n end",
"def show\n @title = \"Show Book\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def index\n @chapters = @book.chapters\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chapters }\n end\n end",
"def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end",
"def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end",
"def show\n @document_page = DocumentPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_page }\n end\n end",
"def index\n authorize! :query, Book\n @books = Book.order(:title)\n respond_to do |format|\n format.html\n format.json {render text: @books.to_json}\n format.xml {render text: @books.to_xml}\n end\n end",
"def index\n @pages = @offering.pages.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end",
"def show\n @page = Page.find(params[:id])\n @version = @page.versions.last\n @author = User.all\n page = {\n :version => @version.changeset,\n :body => @page.body,\n :author => @author\n }\n respond_to do |format|\n format.html\n format.json { render json: page.to_json }\n end\n end",
"def index\n @memos = @book.memos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @memos }\n end\n end",
"def index\n @books = Book.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n end",
"def index\n @page = Page.find(params[:page_id])\n @revisions = @page.revisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revisions }\n end\n end",
"def index\n @books = @collection.books\n #original: @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend",
"def show\n render json: @page\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\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 @bookmark_stats = BookmarkStat.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bookmark_stats }\n end\n end",
"def index\n @book_steps = @book.book_steps.all\n @book = @book\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_steps }\n end\n end",
"def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @books = Book.page(params[:page]) # utilise le helper du gem kaminari pour faire la pagination des livres automatiquement\n end",
"def index\n @books = Book.order('created_at DESC').page(params[:page]).per_page(10).search(params[:search], params[:id])\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def show\n render json: @api_book\n end",
"def new\n @document_page = DocumentPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_page }\n end\n end",
"def index\n @notebooks = Notebook.all\n render json: @notebooks\n end",
"def new\r\n @page_title = '書籍情報作成'\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def new\n @title = 'New Page'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n @phrasebooks = Phrasebook.all\n\n render json: @phrasebooks\n end",
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def show\n @Page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @Page }\n end\n end",
"def index\n @ideas = current_user.ideas.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def pages\n get(\"v1/event/#{@id}/pages\")\n end",
"def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end",
"def index\n @guides = Guide.page(1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:guides => @guides.as_json} }\n end\n end",
"def download_page(page_number)\n print '.'\n JSON.parse(Net::HTTP.get(URI(@url + \"page/#{page_number}/\")))\n end",
"def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end",
"def index\n @notebooks = Notebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end",
"def index\n @books = Book.page(params[:page]).order(id: :desc)\n end",
"def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format| \n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n\n end",
"def index\n @enq_pages = EnqPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enq_pages }\n end\n end",
"def index\n @publishers = Publisher.order(\"id DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publishers }\n end\n end",
"def index\n @user_books = UserBook.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_books }\n end\n end",
"def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end",
"def new\n @book = Book.new\n @publishers = Publisher.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end",
"def index\n # you can use meta fields from your model instead (e.g. browser_title)\n # by swapping @page for @book in the line below:\n present(@page)\n end",
"def index\n @books = Book.extended_details\n\n render json: @books.as_json(\n only: [:id, :title, :author, :created_at, :total_income_cents, :copies_count, :remaining_copies_count, :loaned_copies_count]\n )\n end"
] | [
"0.80614024",
"0.70933026",
"0.7073454",
"0.6975017",
"0.6960861",
"0.6908995",
"0.6851252",
"0.6851252",
"0.6851252",
"0.6851252",
"0.6851252",
"0.6851252",
"0.6851252",
"0.68386227",
"0.6830326",
"0.68099904",
"0.6799294",
"0.6797875",
"0.676943",
"0.67532647",
"0.6724757",
"0.67241",
"0.6666071",
"0.6666071",
"0.6666071",
"0.6666071",
"0.6666071",
"0.6666071",
"0.6666071",
"0.6666071",
"0.6666071",
"0.6648247",
"0.6648247",
"0.66414976",
"0.6625516",
"0.6619884",
"0.6616042",
"0.66151804",
"0.6607605",
"0.65909666",
"0.65711004",
"0.65653473",
"0.6558511",
"0.65558493",
"0.65558493",
"0.65295935",
"0.65050155",
"0.6473447",
"0.64684844",
"0.6460353",
"0.6460012",
"0.64580905",
"0.6456094",
"0.64474267",
"0.64116454",
"0.6398402",
"0.6397955",
"0.63881725",
"0.63881725",
"0.63881725",
"0.63881725",
"0.63881725",
"0.63881725",
"0.63881725",
"0.63776875",
"0.6367101",
"0.6356772",
"0.6350604",
"0.6345731",
"0.6345731",
"0.6345731",
"0.63394266",
"0.6333428",
"0.63289",
"0.63205284",
"0.6314003",
"0.63074434",
"0.6305495",
"0.62942207",
"0.6293199",
"0.6291924",
"0.6291597",
"0.6282764",
"0.6278215",
"0.6276304",
"0.6272372",
"0.6270321",
"0.626409",
"0.626409",
"0.62640375",
"0.6243488",
"0.62415224",
"0.62341714",
"0.62257105",
"0.62182593",
"0.62158036",
"0.6212909",
"0.6212108",
"0.6206467",
"0.6199291"
] | 0.7899805 | 1 |
GET /book_pages/new GET /book_pages/new.json | def new
@book_page = @book.book_pages.build
respond_to do |format|
format.html # new.html.erb
format.json { render json: @book_page }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\r\n @page_title = '書籍情報作成'\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end",
"def new\r\n @page = Page.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @page }\r\n end\r\n end",
"def new\n\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @title = 'New Page'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @Page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @Page }\n end\n end",
"def new\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @page_type = PageType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_type }\n end\n end",
"def new\n\t\t@book = Book.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @book }\n\t\tend\n\tend",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.json { render json: @page }\n format.xml { render xml: @page }\n end\n end",
"def new\n @page_template = PageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_template }\n end\n end",
"def new\n @document_page = DocumentPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_page }\n end\n end",
"def new\n @page = @offering.pages.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.json {render json: @page}\n format.xml {render xml: @page}\n end\n end",
"def new\n @page = ContentPage.new\n @blocks = nil\n #@newBlock = PageBlock.new\n @form_action = \"create_page\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @nested_page = Nested::Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nested_page }\n end\n end",
"def new\n\t\t@page = Page.new\n\n\t\trespond_to do |format|\n\t\t\tif @page.save\n\t\t\t\tformat.html { redirect_to @page, notice: 'Boom, page created.' }\n\t\t\t\tformat.json { render json: @page, status: :created, location: @page }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"Create new page\"}\n\t\t\t\tformat.json { render json: @page.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @book }\n format.json { render json: @book }\n end\n end",
"def new\n @mypage = Mypage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mypage }\n end\n end",
"def new\n @book_of_class = BookOfClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_of_class }\n end\n end",
"def new\n @library_book = LibraryBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @library_book }\n end\n end",
"def new\n @pages_article = PagesArticle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pages_article }\n end\n end",
"def new\n @book = Book.new\n @publishers = Publisher.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = current_user.books.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @current_book = Book.find_by_id(params[:book_id])\n @chapter = Chapter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :json => @chapter }\n end\n end",
"def create\n @book_page = @book.book_pages.build(params[:book_page])\n\n respond_to do |format|\n if @book_page.save\n format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book), \n notice: 'Book page was successfully created.' }\n format.json { render json: @book_page, status: :created, location: @book_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @page = @chapter.pages.build\n\n gon.manga_id = @manga.slug\n gon.chapter_id = @chapter.number\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @about_page = AboutPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @about_page }\n end\n end",
"def new\n @page = Page.new\n respond_with(@page)\n end",
"def new\n @page = Page.new\n respond_with(@page)\n end",
"def new\n @pageType = \"new\"\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @cook_book = CookBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cook_book }\n end\n end",
"def new\n new_object Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :layout => \"default\" }\n end\n end",
"def new\n @look_book = LookBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @look_book }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @bookwork = Bookwork.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bookwork }\n end\n end",
"def new\n @authors_book = AuthorsBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @authors_book }\n end\n end",
"def new\n # @collection = Collection.find(params[:collection_id])\n @book = @collection.books.build\n #original: @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @search_page = SearchPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search_page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n \n end\n end",
"def new\n @structure_page = Structure::Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @structure_page }\n end\n end",
"def new\n @chapter.book = Book.find params[:book]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chapter }\n end\n end",
"def new\n @info_page = InfoPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_page }\n end\n end",
"def handle_new\n obj = model.new(request.params[model.link], request)\n model.hook(:before_new, request, obj)\n new_page(obj)\n end",
"def new\n @test_page = TestPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_page }\n end\n end",
"def new\n @page = Page.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @page = Page.new\n end",
"def new\n @pages = Page.new\n #renders new.html.erb\n end",
"def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book_step = BookStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_step }\n end\n end",
"def new\n respond_with(@page = Page.new)\n end",
"def new\n @oasis_page = OasisPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @oasis_page }\n end\n end",
"def new\n @words_page = WordsPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @words_page }\n end\n end",
"def new\n @profilepage = Profilepage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profilepage }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book_shelf = BookShelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_shelf }\n end\n end",
"def new\n @page = current_cms.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @root_pages = [fetch_root_page].flatten\n if request.post?\n @page = ComatosePage.new params[:page]\n @page.author = fetch_author_name\n if @page.save\n flash[:notice] = \"Created page '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n else\n @page = ComatosePage.new :title=>'New Page', :parent_id=>(params[:parent] || nil)\n end\n end",
"def new\n @usersbook = Usersbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usersbook }\n end\n end",
"def new\n @businessbook = Businessbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @businessbook }\n end\n end",
"def new\n @page = Page.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n \n @page = Page.new\n @page.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @ebook = Ebook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ebook }\n end\n end",
"def new_page\n page = Page.new\n page.url = params[:id] if Page.url?(params[:id]) && params[:id] != 'new-page'\n page\n end",
"def new\n \n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n \n end",
"def new\n @page = @site.pages.new\n @page.parts << PagePart.new(:name => \"body\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n\t\t@page = Page.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @page }\n\t\tend\n\tend",
"def new\n @page = Page.new\n # render :new app/views/pages/new.html.erb\n end",
"def new\n @page = Page.new\n @page.build_business\n @business = Business.select('id, title')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end"
] | [
"0.78558946",
"0.777031",
"0.777031",
"0.777031",
"0.777031",
"0.777031",
"0.77518016",
"0.7743865",
"0.7743865",
"0.7714941",
"0.7714616",
"0.77012134",
"0.76933473",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.76214236",
"0.7615904",
"0.7601484",
"0.759711",
"0.75330716",
"0.7510739",
"0.7476493",
"0.74430954",
"0.74161875",
"0.7396013",
"0.7395414",
"0.739364",
"0.7316669",
"0.72514695",
"0.71945286",
"0.7172511",
"0.7164811",
"0.7160655",
"0.71541554",
"0.7132443",
"0.71291804",
"0.71233976",
"0.71189415",
"0.7111294",
"0.7104272",
"0.70957404",
"0.7089037",
"0.7078137",
"0.7072466",
"0.7072466",
"0.7067437",
"0.7062459",
"0.7057022",
"0.7046265",
"0.7044663",
"0.7044663",
"0.7044663",
"0.7044663",
"0.7044663",
"0.7044663",
"0.7042902",
"0.7030865",
"0.70307034",
"0.7021502",
"0.7018133",
"0.70135325",
"0.70135206",
"0.70132214",
"0.69983",
"0.6994112",
"0.69862825",
"0.69856185",
"0.69856185",
"0.69856185",
"0.6985351",
"0.6977413",
"0.6975698",
"0.69717085",
"0.6964761",
"0.69643974",
"0.6960934",
"0.69505996",
"0.6947904",
"0.69284576",
"0.6928444",
"0.6914391",
"0.6911994",
"0.6911251",
"0.6908131",
"0.6906664",
"0.6886336",
"0.6880755",
"0.68755054",
"0.6872987",
"0.68722856",
"0.6868248"
] | 0.8079944 | 0 |
POST /book_pages POST /book_pages.json | def create
@book_page = @book.book_pages.build(params[:book_page])
respond_to do |format|
if @book_page.save
format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book),
notice: 'Book page was successfully created.' }
format.json { render json: @book_page, status: :created, location: @book_page }
else
format.html { render action: "new" }
format.json { render json: @book_page.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @book_page = @book.book_pages.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_page }\n end\n end",
"def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end",
"def create\n @page = Page.new(page_params)\n\n if @page.save\n render json: @page, status: :created, location: @page\n else\n render json: @page.errors, status: :unprocessable_entity\n end\n end",
"def create\n @nested_page = Nested::Page.new(params[:nested_page])\n\n respond_to do |format|\n if @nested_page.save\n format.html { redirect_to @nested_page, notice: 'Page was successfully created.' }\n format.json { render json: @nested_page, status: :created, location: @nested_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nested_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n if @page.save\n respond_with(@page, location: api_pages_url)\n else\n respond_with(@page)\n end\n end",
"def create\n respond_to do |format|\n begin\n @page = Page.create_page!\n format.html { redirect_to \"/#{@page.request_id}/inspect\", notice: t('pages.create.success') }\n format.json { render action: 'show', status: :created, location: @page }\n rescue => e\n format.html { render action: 'index' }\n format.json { render json: {:message => \"create page error\"}, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n @page_title = '書籍情報作成'\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.json { render json: @page, status: :created, location: [:api, @page] }\n format.xml { render xml: @page, status: :created, location: [:api, @page] }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n \n if @page.save\n respond_to do |format|\n format.json { render :json => @page, :status => :created }\n format.xml { render :xml => @page, :status => :created }\n end\n else\n respond_to do |format|\n format.json { raise Palani::Api::InvalidRecordJSONException }\n format.xml { raise Palani::Api::InvalidRecordXMLException }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to pages_path, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @document_page = DocumentPage.new(params[:document_page])\n\n respond_to do |format|\n if @document_page.save\n format.html { redirect_to @document_page, notice: 'Document page was successfully created.' }\n format.json { render json: @document_page, status: :created, location: @document_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @document_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n respond_to do |format|\n if @page.save\n self.build_pages_tree\n format.html { redirect_to @pages_tree[@page.id], notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #Each Page could be tied to an ApiKey or set of ApiKeys for security\n @page = Page.new(page_params)\n #Render the object created or errors\n respond_to do |format|\n if @page.save\n #Cache bust pages\n Rails.cache.delete(\"pages\")\n format.json { render action: 'show', status: :created, location: api_page_url(@page) }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n if @page.save\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @document_page = DocumentPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_page }\n end\n end",
"def create\n @page = @notebook.pages.build(page_params)\n\n if @page.save\n redirect_to notebook_page_path(@notebook, @page), notice: 'Page was successfully created.' \n else\n render :new \n end\n end",
"def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def create\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @nested_page = Nested::Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nested_page }\n end\n end",
"def new\n @page = @chapter.pages.build\n\n gon.manga_id = @manga.slug\n gon.chapter_id = @chapter.number\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n params[:page].except!(:map_info) unless params[:page][:map_info].present?\n @page = current_user.pages.new(params[:page])\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n @business = Business.select('id, title')\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @books }\r\n end\r\n end",
"def create\n @page_page = PagePage.new(page_page_params)\n\n respond_to do |format|\n if @page_page.save\n format.html { redirect_to @page_page, notice: 'Page page was successfully created.' }\n format.json { render :show, status: :created, location: @page_page }\n else\n format.html { render :new }\n format.json { render json: @page_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response = @page.parse_url\n render json: response\n end",
"def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to [:admin, @page], notice: 'Страница успешно создана.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\r\n @page = Page.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @page }\r\n end\r\n end",
"def page_params\n params.require(:page).permit(:month, :day, :thought, :book_id)\n end",
"def new\n\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def book_pages\n\t\t@book = {\n\t\t\t\t\"sketch\" =>\n\t\t\t\t\"\t\t\t\t------------------------------------------\n\t\t\t\t| |\n\t\t\t\t| ----- |\n\t\t\t\t| / _ \\\\ |\n\t\t\t\t| / | | \\\\ |\n\t\t\t\t| --------- |\n\t\t\t\t| |\n\t\t\t\t| ____ _____ |\n\t\t\t\t| / \\\\____ /| \\\\__ |\n\t\t\t\t| / \\\\_____/ | \\\\_______ |\n\t\t\t\t| _____ |____ |\n\t\t\t\t| / \\\\____ /* \\\\__ |\n\t\t\t\t| / \\\\_____/ \\\\_______ |\n\t\t\t\t| |\n\t\t\t\t| |\n\t\t\t\t| _ |\n\t\t\t\t| / \\\\__ ___ |\n\t\t\t\t| /__/ \\\\/ \\\\ |\n\t\t\t\t| /____\\\\____\\\\ |\n\t\t\t\t| |\n\t\t\t\t| |\n\t\t\t\t ------------------------------------------\",\n\n\t\t\t\t \"page1\" =>\n\t\t\t \t\"\t\t\t\t------------------------------------------\n\t\t\t\t| |\n\t\t\t\t| |\n\t\t\t\t| -oday-- met a ------------- loca- |\n\t\t\t\t| trib----- confirme------uspicions. |\n\t\t\t\t| Now I kn---how---------tr--sur-----. |\n\t\t\t\t| |\n\t\t\t\t| ---gh- |\n\t\t\t\t| m---? |\n\t\t\t\t| |\n\t\t\t\t| R----R--Y----B- |\n\t\t\t\t ------------------------------------------\",\n\n\t\t\t}\n\tend",
"def create\n @notebook = current_user.notebooks.find(params[:notebook_id])\n @page = @notebook.pages.find(params[:page_id])\n\n @page.paragraphs.create\n redirect_to notebook_page_path(@notebook, @page)\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"/books\", notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pages\n end",
"def create\n @page = @offering.pages.new(params[:page])\n\n respond_to do |format|\n if @page.save\n flash[:notice] = 'OfferingPage was successfully created.'\n format.html { redirect_to offering_page_url(@offering, @page) }\n format.xml { render :xml => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def create\n @title = \"Create New Book\"\n\n process_publisher\n\n all_book_params= params[:book]\n\n @book = Book.new(params[:book])\n\n process_authors\n\n process_subjects\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to edit_book_path(@book), notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n # format.html { redirect_to @page, notice: 'Page was successfully created.' }\n # format.json { render json: @page, status: :created, location: @page }\n\n format.html { redirect_to action: \"edit\", id: @page.id, notice: 'Page was successfully created.' }\n format.json { head :no_content }\n\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.create( params[:book] )\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n \n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_with(@page = Page.create(params[:page]), :status => :created)\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def create\n begin\n ActiveRecord::Base.transaction do\n @page = Page.new(\n page_slug: params[\"page\"][\"page_slug\"],\n title: params[\"page\"][\"title\"],\n tag_list: params[\"page\"][\"tags\"]\n )\n @page.save!\n @version = Version.new(body: params[\"page\"][\"body\"], page: @page)\n @version.save!\n end\n respond_to do |format|\n format.html { redirect_to action: \"show\", slug: page_params[:page_slug] , notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n end\n rescue => @err\n respond_to do |format|\n @page.body = params[\"page\"][\"body\"]\n format.html { render :new }\n format.json { render json: @err, status: :unprocessable_entity }\n end\n end\n end",
"def book_params\n params.require(:book).permit(:title, :page_count, :description)\n end",
"def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def create\n @page = Page.new(page_params)\n respond_to do |format|\n if @page.save\n format.html { redirect_to page_path(@page), notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n flash[:notice] = @page.errors.full_messages.to_sentence\n format.html { render action: 'new' }\n format.json { render json: [@page.errors.full_messages.to_sentence], status: :unprocessable_entity }\n end\n end\n end",
"def create(params)\n put(\"v1/fundraising/pages\", {:basic_auth => true}.merge(params))\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @title = \"List Books\"\n @books = Book.paginate :page=>params[:page], :per_page => 100, :order => 'title'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"def new\n @book = Book.new\n @publishers = Publisher.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @Page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @Page }\n end\n end",
"def new\n @title = 'New Page'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.json { render json: @page }\n format.xml { render xml: @page }\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to manage_books_path, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def create\n\t\t@page = Page.new(params[:page])\n\n\t\trespond_to do |format|\n\t\t\tif @page.save\n\t\t\t\tformat.html { redirect_to @page, notice: 'Boom, page created.' }\n\t\t\t\tformat.json { render json: @page, status: :created, location: @page }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"Create new page\"}\n\t\t\t\tformat.json { render json: @page.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n @page = Page.new(params[:page])\n \n\n respond_to do |format|\n if @page.save\n @page.update_attribute('published_at', Time.now) if params[:commit] == 'Publish'\n \n if params[:commit] == 'Publish'\n format.html { redirect_to root_page_path(@page), notice: 'Page was successfully published.' }\n else\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully created.' }\n end\n format.json { render json: @page, status: :created, location: @page, :only => [:title, :content] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(page_params)\n\n respond_to do |format|\n if @page.save\n# format.html { redirect_to @page, notice: 'Page was successfully created.' }\n# format.json { render :show, status: :created, location: @page }\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: edit_page_path(@page) }\n else\n format.html { render :new }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book }\n format.json { render action: 'show', status: :created, location: @book }\n else\n format.html { render action: 'new' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\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 create\n\n\n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n puts @book.as_json \n format.json { render :show, status: :created, location: @book }\n else\n \n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end"
] | [
"0.717884",
"0.6961408",
"0.6532633",
"0.6449121",
"0.63141894",
"0.62800825",
"0.62715197",
"0.6227736",
"0.6213138",
"0.6167685",
"0.6164547",
"0.6153755",
"0.6140232",
"0.6140142",
"0.61047333",
"0.61047333",
"0.61047333",
"0.61047333",
"0.61047333",
"0.61047333",
"0.6098696",
"0.6097238",
"0.60955715",
"0.6036866",
"0.6035663",
"0.6028072",
"0.6027771",
"0.60194385",
"0.6015079",
"0.6002918",
"0.5994553",
"0.59939367",
"0.5987178",
"0.59816974",
"0.5975099",
"0.59729654",
"0.59729654",
"0.59729654",
"0.59729654",
"0.59729654",
"0.59538627",
"0.593706",
"0.59336084",
"0.5927238",
"0.5925731",
"0.5924186",
"0.5924186",
"0.592233",
"0.592233",
"0.592233",
"0.5918472",
"0.5913396",
"0.5910609",
"0.5906887",
"0.5903458",
"0.58973944",
"0.58915716",
"0.5873367",
"0.5868499",
"0.5867903",
"0.5867857",
"0.5867857",
"0.5867857",
"0.5867857",
"0.5867857",
"0.5867857",
"0.5867857",
"0.5866208",
"0.58566684",
"0.58521426",
"0.58488494",
"0.58386177",
"0.5826646",
"0.5826646",
"0.5826646",
"0.5826646",
"0.5826646",
"0.5823475",
"0.5820573",
"0.5818532",
"0.5802303",
"0.5793926",
"0.5790974",
"0.5788324",
"0.5788324",
"0.57795006",
"0.5776903",
"0.57758486",
"0.5774386",
"0.57577527",
"0.5757539",
"0.5755843",
"0.57444614",
"0.57444596",
"0.57434577",
"0.5742526",
"0.5742526",
"0.5742526",
"0.5742526",
"0.5742526"
] | 0.7337405 | 0 |
PUT /book_pages/1 PUT /book_pages/1.json | def update
@book_page = @book.book_pages.find(params[:id])
respond_to do |format|
if @book_page.update_attributes(params[:book_page])
format.html { redirect_to book_series_collection_book_book_page_url(@book_series, @collection, @book, @book_page), notice: 'Book page was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @book_page.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if page_params[:body]\n @page.versions << Version.new(body: page_params[:body], title: page_params[:title]).save\n page_params.delete :body\n end\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to controller: \"pages\", action: \"show\", slug: @page[:page_slug], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t\t@book.titlelong = book.title\n\t\t\t@book.description = strip_tags(book.description)\n\t\t\t@book.title = book.work.original_title\n\t\t\t@book.pages = book.num_pages\n\t\t\t@book.bookrating = book.average_rating\n\t\t\t@book.author = book.authors.author.name\n\t\t\t@book.publisher = book.publisher\n\t\t\t@book.save\n\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\tformat.json { render :show, status: :ok, location: @book }\n\t\tend\n end",
"def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n add_title_to_book\n end",
"def book_update\n if params[:token] != ENV['UPDATE_TOKEN']\n return render :text => 'nope'\n end\n\n lang = params[:lang]\n chapter = params[:chapter].to_i\n section = params[:section].to_i\n chapter_title = params[:chapter_title]\n section_title = params[:section_title]\n content = params[:content].force_encoding(\"UTF-8\")\n\n # create book (if needed)\n book = Book.where(:code => lang).first_or_create\n\n # create chapter (if needed)\n chapter = book.chapters.where(:number => chapter).first_or_create\n chapter.title = chapter_title\n chapter.save\n\n # create/update section\n section = chapter.sections.where(:number => section).first_or_create\n section.title = section_title\n section.html = content\n section.save\n\n render :text => 'ok'\n end",
"def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @document_page = DocumentPage.find(params[:id])\n\n respond_to do |format|\n if @document_page.update_attributes(params[:document_page])\n format.html { redirect_to @document_page, notice: 'Document page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: \"Page was successfully updated. #{undo_link}\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, sucess: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @pages_tree[(@page.id).to_s], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n @page.update_attributes(params[:page])\n respond_with(@page)\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n @page.update_attributes(params[:page])\n respond_with(@page, :status => :updated)\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to page_path(@page), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to manage_books_path, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def update\n book = Book.find(params[:id])\n book.update_attributes(params[:book])\n redirect_to(book)\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end",
"def update \n # looking for a page with a specific id \n @pages = Page.find(params[:id])\n\n # updates with new information\n if @page.update(pages_params)\n redirect_to pages_path\n else \n render :edit \n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n debugger\n chapter.book = book\n if chapter.save\n redirect_to(book_chapter_path([book, chapter]), notice: 'Chapter was successfully updated.')\n else\n render action: 'edit'\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n @book.update(book_params)\n redirect_to root_path\n end",
"def new\n @book_page = @book.book_pages.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_page }\n end\n end",
"def update\n @nested_page = Nested::Page.find(params[:id])\n\n respond_to do |format|\n if @nested_page.update_attributes(params[:nested_page])\n format.html { redirect_to @nested_page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nested_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @page.update_attributes(params[:page])\n respond_with(@page)\n else\n respond_with(@page)\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.xml { head :ok }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Render the object created or errors\n respond_to do |format|\n if @page.update(page_params)\n #Cache bust pages and updated page. With pagination we would only bust the cache of the page that was updated.\n Rails.cache.delete(\"pages\")\n Rails.cache.delete(\"page-#{@page.id}\")\n format.json { render action: 'show', status: :ok, location: api_page_url(@page) }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def changeBook\n getBook(params[:book_id])\n if @book.blank? \n return false;\n end\n @playdate.page_num = params[:page_num]\n @playdate.save\n Pusher[@playdate.pusher_channel_name].trigger('change_book', {\n :data => @book.to_json(:include => :pages),\n :book => @book.id,\n :player => current_user.id,\n :page => params[:page_num]\n })\n end",
"def update\n @page = @offering.pages.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n flash[:notice] = 'OfferingPage was successfully updated.'\n format.html { redirect_to offering_page_url(@offering, @page) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book_page = @book.book_pages.build(params[:book_page])\n\n respond_to do |format|\n if @book_page.save\n format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book), \n notice: 'Book page was successfully created.' }\n format.json { render json: @book_page, status: :created, location: @book_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ajax_book_update\r\n @book = Book.find(params[:id])\r\n @book.isbn = params[:isbn]\r\n @book.title = params[:title]\r\n @book.save\r\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to all_pages_path(:magazine_id=>@page.magazine_id), notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to [:admin, @page], notice: 'Страница успешно создана.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @page.update(page_params)\n redirect_to notebook_page_path(@notebook, @page), notice: 'Page was successfully updated.' \n else\n render :edit\n end\n end",
"def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n # format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.html { redirect_to action: \"edit\", id: params[:id], notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @book.update(book_params)\r\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @book }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n @page.section_id = params[:section_id] unless params[:section_id].nil? \n @page.title = params[:title] unless params[:title].nil? \n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n #ormat.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find_by_slug(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n @page.update_attribute('published_at', Time.now) if params[:commit] == 'Publish'\n @page.update_attribute('published_at', nil) if params[:commit] == 'Unpublish'\n \n if params[:commit] == 'Publish'\n format.html { redirect_to root_page_path(@page), notice: 'Page was successfully published.' }\n else\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully updated.' }\n end\n \n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = current_site.pages.find(params[:id])\n @site = @page.site\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }\n format.json { respond_with_bip(@page) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@page) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @page = Page.new(page_params)\n\n # @page.components.build\n # @page.update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6517577",
"0.6477979",
"0.64186496",
"0.63226795",
"0.6307765",
"0.62953144",
"0.6287904",
"0.62863904",
"0.62825817",
"0.62793595",
"0.6258501",
"0.62165517",
"0.6196754",
"0.61891025",
"0.61538744",
"0.61494046",
"0.61468184",
"0.6140256",
"0.61393017",
"0.6130775",
"0.61266434",
"0.6126359",
"0.6126359",
"0.6126359",
"0.6126359",
"0.6126359",
"0.6126359",
"0.6126359",
"0.6126359",
"0.6126359",
"0.61206496",
"0.61206496",
"0.6119532",
"0.6115334",
"0.6115334",
"0.61080027",
"0.61067575",
"0.6104758",
"0.60981876",
"0.6095032",
"0.60905623",
"0.60876137",
"0.60860676",
"0.6084893",
"0.60795534",
"0.60713935",
"0.6071161",
"0.6053026",
"0.6042696",
"0.60304934",
"0.60244083",
"0.602187",
"0.6016365",
"0.6015315",
"0.601433",
"0.60135967",
"0.601241",
"0.601098",
"0.6007487",
"0.59949034",
"0.5987033",
"0.59858775",
"0.5977335",
"0.5972885",
"0.5972885",
"0.5970953",
"0.59705716",
"0.5967038",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5965288",
"0.5961901",
"0.5960253",
"0.59568894",
"0.59568894",
"0.5953373",
"0.5946416",
"0.594639"
] | 0.7505768 | 0 |
DELETE /book_pages/1 DELETE /book_pages/1.json | def destroy
@book_page = @book.book_pages.find(params[:id])
@book_page.destroy
respond_to do |format|
format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_book.destroy\n\n head :no_content\n end",
"def destroy\n @book.destroy\n head :no_content\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @page = @chapter.pages.find_by_number(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to manga_chapter_url(@manga, @chapter) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end \n end",
"def destroy\n @title = \"Destroy Book\"\n\n # @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n \n format.json { render json: @book, status: :created, location: @book }\n end\n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n book = Book.find(params[:id])\n book.destroy\n \n render json: {}, status: 204\n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document_page = DocumentPage.find(params[:id])\n @document_page.destroy\n\n respond_to do |format|\n format.html { redirect_to document_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chapter.destroy\n\n respond_to do |format|\n format.html { redirect_to book_path(@chapter.book_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end \n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page.destroy\n respond_to do |format|\n format.html { redirect_to pages_url, :notice => \"Successfully deleted page. #{undo_link}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to book_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book1.destroy\n respond_to do |format|\n format.html { redirect_to book1s_url, notice: \"Book1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end",
"def destroy\n @ebook.destroy\n respond_to do |format|\n format.html { redirect_to ebooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_uri, notice: '本を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to user_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to admin_books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to admin_books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_info.destroy\n respond_to do |format|\n format.html { redirect_to book_infos_url }\n format.json { head :no_content }\n end\n \n @book_detail.destroy\n respond_to do |format|\n format.html { redirect_to book_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: '削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_path, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_progress.destroy\n respond_to do |format|\n format.html { redirect_to book_progresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: '書籍が削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to pages_url }\n format.json { head :ok }\n end\n end"
] | [
"0.7497998",
"0.7271345",
"0.7245735",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.71561724",
"0.71561724",
"0.71351784",
"0.7133411",
"0.7116328",
"0.7114229",
"0.7108456",
"0.7092909",
"0.70775926",
"0.7059944",
"0.7051364",
"0.70461607",
"0.7039455",
"0.7039455",
"0.7031384",
"0.7030301",
"0.69419783",
"0.69419783",
"0.69419783",
"0.69419783",
"0.6940637",
"0.69333214",
"0.6920475",
"0.6912882",
"0.69094354",
"0.6906802",
"0.68997395",
"0.68996805",
"0.68996805",
"0.6899022",
"0.6899022",
"0.6899022",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.68976253",
"0.6897348",
"0.6896028",
"0.68928987",
"0.68928987",
"0.68928987",
"0.68928987",
"0.68928987",
"0.68928987",
"0.68928987",
"0.68928987",
"0.68918025",
"0.68872184",
"0.6885853",
"0.68816304",
"0.6881368",
"0.68801314",
"0.6877454"
] | 0.76314765 | 0 |
get_book: converts the book_id given by the routing to | def get_book
@book_series = BookSeries.find(params[:book_series_id])
@book_series_1 = BookSeries.first
@collection = @book_series.collections.find(params[:collection_id])
@book = @collection.books.find(params[:book_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_book\n @book = Book.find(params[:book_id])\n end",
"def get_book\n @book = Book.where(id: params[:book_id]).first\n end",
"def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', :response_group => 'Large,Reviews,Similarities' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return parse_item( item )\n end\n end",
"def find_book\n\t@book = Book.find(params[:id])\nend",
"def load_book\n @book = Book.find(params[:id])\n end",
"def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', \n :response_group => 'Large,Reviews,Similarities,AlternateVersions' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return Book.new( item )\n end\n return nil\n end",
"def set_book\n @book = Book.friendly.find(params[:id])\n end",
"def get_book(book_num)\n return @books_list[book_num]\n end",
"def index\n @book = Book.find(params[:book_id])\n end",
"def set_book\n @book = current_author.books.friendly.find(params[:id])\n end",
"def book(id)\n\t\t\tresponse = request('/book/show', :id => id)\n\t\t\tHashie::Mash.new(response['book'])\n\t\tend",
"def set_book\n @book = Book.find_by_slug(params[:id])\n end",
"def book\n @books=Book.all\n @book=Book.find(params[:id])\n end",
"def order_book(params)\n Client.current.get(\"#{resource_url}/book\", params)\n end",
"def show\n @book = Book.where(id: params[:id]).first\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def current_book\n @current_book ||= books.find_by!(:slug => params[:book_slug] || params[:book_book_slug])\n end",
"def book\n sql = \"SELECT * FROM books WHERE books.id = $1\"\n values = [@book_id]\n book_data = SqlRunner.run(sql, values)\n book = Book.map_items(book_data).first\n return book\n end",
"def set_book\n if params[:id].present?\n @book = Book.find(params[:id])\n else\n @book = Book.find(params[:book_id])\n end\n end",
"def display_resource(book)\n book.title\n end",
"def get_book(book_isbn)\n plsql.books.first :book_isbn => book_isbn\n end",
"def show\n @book = Book.find params[:id]\n end",
"def show\n @book=Book.find(params[:id])\n\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def show\n\t\t@book=Book.find(params[:id])\n\tend",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\nend",
"def book\n fetch('harry_potter.books')\n end",
"def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"def book\n @book = Book.published.find(params[:id])\n render json: @book\n end",
"def set_book\r\n @book = Book.find(params[:id])\r\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end"
] | [
"0.76608276",
"0.76537764",
"0.7085379",
"0.70534086",
"0.70118964",
"0.70098287",
"0.6801759",
"0.67968833",
"0.6724013",
"0.6697518",
"0.66624",
"0.66175157",
"0.66023767",
"0.6516869",
"0.64862424",
"0.643488",
"0.643488",
"0.643488",
"0.643488",
"0.643488",
"0.643488",
"0.643488",
"0.64317656",
"0.64306754",
"0.6412714",
"0.63640195",
"0.63603765",
"0.635903",
"0.63493556",
"0.6334947",
"0.6322646",
"0.6318842",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63188016",
"0.63111883",
"0.6305693",
"0.62951803",
"0.62772936",
"0.62717396",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613",
"0.62574613"
] | 0.6441945 | 16 |
Use callbacks to share common setup or constraints between actions. | def set_material_management
@material_management = MaterialManagement.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 |
GET /posts GET /posts.xml | def index
@posts = Post.paginate(:all, :page => params[:page], :per_page => 20, :order => "posts.created_on desc, comments.created_on", :include => [ :comments, :user ])
@title = "rawdod"
# @hotness = Post.find(:all, :order => "commented_on desc", :limit => 8, :conditions => ["commented_on is NOT NULL"])
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @posts.to_xml }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.find(:all, :order=>'created_on DESC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @posts.to_xml }\n end\n end",
"def index\n @posts = Post.find(:all, :order => :created_at)\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @posts.to_xml }\n end\n end",
"def index\n @posts = Post.find_list(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def feed\r\n @posts = Post.all(:order => \"created_at DESC\")\r\n respond_to do |format|\r\n format.rss\r\n end\r\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def list\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n\r\n format.html # list.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n format.rss { render :layout => false }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts,:layout => false }\n end\n end",
"def index\n @posts = Post.published.page(params[:page]).per(5).ordered\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @post.to_xml }\n end\n end",
"def index\n @posts = Post.paginate(:page=>params[:page], :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def list_posts(api_object)\r\n puts \"Current Post:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n contents= doc.xpath('posts/post/content').collect {|e| e.text }\r\n puts contents.join(\", \")\r\n puts \"\"\r\nend",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def index\n @posts = Post.find(:all,:order => 'created_at DESC').paginate(:per_page => 5, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n\t\t@post = Post.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml { render:xml => @post}\n\t\tend\n\tend",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n# format.xml { render :xml => @post.to_xml }\n end\n end",
"def index\n @posts = Post.all\n\n @title = \"Blog Management\"\n\n respond_to do |format| \n format.html { render :index }\n format.xml { render :xml => @posts.to_xml}\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end",
"def show\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end \n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def index\n respond_with(@posts) do |format|\n format.html do\n return redirect_to blog_path, :status => 301 if request.path =~ /^\\/posts(\\/?)$/ && flash.empty?\n\n @posts = user_signed_in? ? Post.latest : Post.published.latest\n @posts = @posts.paginate :page => params[:page], :per_page => Post.per_page\n end\n\n format.rss { @posts = Post.published.latest }\n end\n end",
"def index\n authorize! :read, Post\n @posts = Post.accessible_by(current_ability).order('created_at DESC').paginate(:per_page => 15, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.rss { render :layout => false } \n end\n end",
"def index\r\n # @posts = Post.all(:order => \"created_at DESC\")\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end",
"def index\n @title = \"Home\"\n @posts = Post.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.json { render :json => @posts }\n format.atom # index.atom.builder\n end\n end",
"def index\n # @posts = Post.paginate :page => params[:page]\n @posts = Post.paginate :page => params[:page], :per_page => 2\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def show\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post251 }\n end\n end",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def index\n @posts = if params[:tag]\n Post.tagged_with(params[:tag])\n else\n Post.scoped\n end\n @posts = @posts.where(:published => true).order(\"created_at DESC\")\n @posts = @posts.paginate(:page => params[:page], :per_page => 4) unless params[:count] == \"all\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.rss { render :layout => false }\n format.xml { render :xml => @posts }\n end\n end",
"def show\n #render :template => 'posts/show.xml.builder', :layout => false\n render :json => @post, :layout => false\n end",
"def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end",
"def show\n provides :xml, :json\n \n @post = Post[params[:id]]\n \n if content_type == :html\n render\n else\n display @post\n end\n end",
"def index\n respond_to do |format|\n format.html { \n @posts = Post.search(params[:search_title], params[:search_tags], params[:page])\n }\n \n format.rss { \n @posts = Post.all(:limit => RSS_ITEM_LIMIT, :order => \"created_at DESC\")\n render :layout => false \n }\n\n format.xml { \n @posts = Post.all\n render :xml => @posts\n }\n \n format.json { \n @posts = Post.all\n render :json => @posts\n }\n end\n end",
"def index\n\t@posts = list_posts\n end",
"def index \n authorize! :read, Post\n @posts = Post.find(:all, :order => \"created_at DESC\")\n respond_to do |format|\n format.html\n format.atom\n end\n\n end",
"def rss\n @events = Post.find(:all, {:conditions=> \"status=public\"},:order => \"id DESC\")\n render :layout => false\n headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end",
"def show\n @post134 = Post134.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post134 }\n end\n end",
"def index\n @posts = PostService.getAllPosts\n end",
"def show\n @post125 = Post125.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post125 }\n end\n end",
"def show\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post101 }\n end\n end",
"def index\n\n\t\t# GET ALL THE BLOG POSTS\n @posts = Post.find(:all, :limit => 5)\n @downloads = Download.find(:all, :limit => 5, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n @post246 = Post246.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post246 }\n end\n end",
"def show\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post78 }\n end\n end",
"def show\n @post99 = Post99.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post99 }\n end\n end",
"def show\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post120 }\n end\n end",
"def show\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post57 }\n end\n end",
"def index\n if params[:all]\n @posts = Post.all\n elsif\n @posts = Post.tagged_with(\"blog\")\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def index\n @post_categories = PostCategory.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @post_categories }\n end\n end",
"def show\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post181 }\n end\n end",
"def index\n @feeds = Feed.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feeds.to_xml }\n end\n end",
"def index\n options = {:page => params[:page] || 1, :per_page => 2}\n @posts = (params[:tag].blank? ? Post.published.search(params[:search], options) : Post.published.paginate_tagged_with(params[:tag], options))\n respond_to do |format|\n format.html{}\n format.xml{ render :xml => @posts }\n end\n end",
"def show\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post253 }\n end\n end",
"def show\n @post342 = Post342.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post342 }\n end\n end",
"def show\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post75 }\n end\n end",
"def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end",
"def show\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post81 }\n end\n end",
"def show\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post182 }\n end\n end",
"def index\n @posts = Post.search(params[:search], params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.js\n format.atom\n end\n end",
"def show\n @post55 = Post55.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post55 }\n end\n end",
"def show\n @post77 = Post77.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post77 }\n end\n end",
"def show\n @post257 = Post257.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post257 }\n end\n end",
"def show\n @post445 = Post445.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post445 }\n end\n end",
"def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @feed.to_xml }\n end\n end",
"def show\n @post66 = Post66.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post66 }\n end\n end",
"def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_post }\n end\n end",
"def show\n @post107 = Post107.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post107 }\n end\n end",
"def show\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post321 }\n end\n end",
"def show\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post231 }\n end\n end",
"def show\n @post105 = Post105.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post105 }\n end\n end",
"def index\n @articles = Article.published\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def index\n # TODO: implement listing all posts\n end",
"def index\n @page[:per_page] = params[:limit] || 5\n @blog_posts = BlogPost.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blog_posts, callback: params[:callback] }\n format.xml { render xml: @blog_posts }\n format.rss { render 'feed' }\n end\n end",
"def show\n @post109 = Post109.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post109 }\n end\n end",
"def show\n @post184 = Post184.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post184 }\n end\n end",
"def show\n @post74 = Post74.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post74 }\n end\n end",
"def show\n @post117 = Post117.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post117 }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end",
"def show\n @post10 = Post10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post10 }\n end\n end",
"def show\n @post = Post.find(params[:id], :include => [:blog, :comments, :user, :tags])\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @post }\n end\n end",
"def index\n @posts = Post.all\n @title=\"All LitwakRecommends Posts\"\n\t@metadescription = \"Listing of all Posts for LitwakRecommends travel blog\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end"
] | [
"0.73163414",
"0.72102565",
"0.72102565",
"0.70133805",
"0.69922805",
"0.69905823",
"0.6946224",
"0.68449396",
"0.6825624",
"0.68239427",
"0.67839086",
"0.67474705",
"0.6744808",
"0.67014694",
"0.66831535",
"0.66570085",
"0.66536814",
"0.6641173",
"0.6569632",
"0.6569632",
"0.6569632",
"0.6569632",
"0.6569632",
"0.6569632",
"0.6569632",
"0.6569632",
"0.6569632",
"0.6569632",
"0.6569632",
"0.65689623",
"0.6562864",
"0.6548791",
"0.65417695",
"0.65400404",
"0.6532962",
"0.6532095",
"0.6509035",
"0.6509035",
"0.6451045",
"0.6432708",
"0.6423995",
"0.64157194",
"0.64118004",
"0.6391085",
"0.63896364",
"0.63731444",
"0.63691884",
"0.6361821",
"0.6360292",
"0.63583076",
"0.63511515",
"0.6342905",
"0.6339071",
"0.63336664",
"0.63287073",
"0.6324601",
"0.63148195",
"0.6311334",
"0.6296899",
"0.6286889",
"0.62864393",
"0.62858725",
"0.62757164",
"0.62744164",
"0.6268504",
"0.6262129",
"0.6247976",
"0.6244519",
"0.6240205",
"0.6239487",
"0.6233154",
"0.6226862",
"0.62248725",
"0.6223015",
"0.62088597",
"0.62063754",
"0.6198131",
"0.6196574",
"0.6194646",
"0.61905736",
"0.6187951",
"0.6187811",
"0.6174592",
"0.617229",
"0.6170761",
"0.61688745",
"0.61672014",
"0.6162086",
"0.616047",
"0.6160359",
"0.6157711",
"0.6154687",
"0.6154447",
"0.61543655",
"0.61533695",
"0.615046",
"0.61485565",
"0.6146997",
"0.6145814",
"0.61350554",
"0.61348975"
] | 0.0 | -1 |
GET /posts/1 GET /posts/1.xml | def show
@post = Post.find(params[:id])
@title = @post.title
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @post.to_xml }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def index\n @posts = Post.find(:all, :order=>'created_on DESC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @posts.to_xml }\n end\n end",
"def index\n @posts = Post.find(:all, :order => :created_at)\n\n respond_to do |format|\n format.html # index.rhtml\n# format.xml { render :xml => @posts.to_xml }\n end\n end",
"def index\n @posts = Post.find_list(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @post.to_xml }\n end\n end",
"def show\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end \n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n format.rss { render :layout => false }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def feed\r\n @posts = Post.all(:order => \"created_at DESC\")\r\n respond_to do |format|\r\n format.rss\r\n end\r\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts,:layout => false }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n\t\t@post = Post.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml { render:xml => @post}\n\t\tend\n\tend",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n# format.xml { render :xml => @post.to_xml }\n end\n end",
"def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post251 }\n end\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def show\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post101 }\n end\n end",
"def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end",
"def index\n @posts = Post.published.page(params[:page]).per(5).ordered\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n @post257 = Post257.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post257 }\n end\n end",
"def index\n @posts = Post.paginate(:page=>params[:page], :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n @post134 = Post134.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post134 }\n end\n end",
"def show\n @post246 = Post246.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post246 }\n end\n end",
"def index\n @posts = Post.find(:all,:order => 'created_at DESC').paginate(:per_page => 5, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n @post99 = Post99.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post99 }\n end\n end",
"def show\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post57 }\n end\n end",
"def show\n @post78 = Post78.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post78 }\n end\n end",
"def show\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post181 }\n end\n end",
"def show\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post253 }\n end\n end",
"def list_posts(api_object)\r\n puts \"Current Post:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n contents= doc.xpath('posts/post/content').collect {|e| e.text }\r\n puts contents.join(\", \")\r\n puts \"\"\r\nend",
"def list\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n\r\n format.html # list.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end",
"def show\n @post342 = Post342.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post342 }\n end\n end",
"def show\n @post125 = Post125.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post125 }\n end\n end",
"def show\n provides :xml, :json\n \n @post = Post[params[:id]]\n \n if content_type == :html\n render\n else\n display @post\n end\n end",
"def index\n\n\t\t# GET ALL THE BLOG POSTS\n @posts = Post.find(:all, :limit => 5)\n @downloads = Download.find(:all, :limit => 5, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post231 }\n end\n end",
"def show\n @post77 = Post77.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post77 }\n end\n end",
"def show\n @post75 = Post75.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post75 }\n end\n end",
"def index\n @posts = Post.all\n\n @title = \"Blog Management\"\n\n respond_to do |format| \n format.html { render :index }\n format.xml { render :xml => @posts.to_xml}\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end",
"def show\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post321 }\n end\n end",
"def show\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post120 }\n end\n end",
"def show\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post81 }\n end\n end",
"def index\n @title = \"Home\"\n @posts = Post.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n format.json { render :json => @posts }\n format.atom # index.atom.builder\n end\n end",
"def show\n @post107 = Post107.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post107 }\n end\n end",
"def show\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post182 }\n end\n end",
"def show\n @post66 = Post66.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post66 }\n end\n end",
"def show\n @post227 = Post227.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post227 }\n end\n end",
"def show\n @post105 = Post105.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post105 }\n end\n end",
"def show\n @post445 = Post445.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post445 }\n end\n end",
"def show\n @post55 = Post55.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post55 }\n end\n end",
"def show\n @post117 = Post117.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post117 }\n end\n end",
"def show\n @post10 = Post10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post10 }\n end\n end",
"def show\n @post74 = Post74.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post74 }\n end\n end",
"def show\n @post109 = Post109.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post109 }\n end\n end",
"def show\n @post275 = Post275.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post275 }\n end\n end",
"def show\n @post129 = Post129.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post129 }\n end\n end",
"def show\n @post273 = Post273.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post273 }\n end\n end",
"def show\n @post197 = Post197.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post197 }\n end\n end",
"def show\n @post157 = Post157.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post157 }\n end\n end",
"def index\n # @posts = Post.paginate :page => params[:page]\n @posts = Post.paginate :page => params[:page], :per_page => 2\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\n @post245 = Post245.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post245 }\n end\n end",
"def show\n @post483 = Post483.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post483 }\n end\n end",
"def show\n @post139 = Post139.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post139 }\n end\n end",
"def show\n @post267 = Post267.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post267 }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def show\n @post284 = Post284.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post284 }\n end\n end",
"def index\r\n # @posts = Post.all(:order => \"created_at DESC\")\r\n @posts = Post.paginate :page => params[:page], :per_page => 24, :order => \"created_at DESC\"\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @posts }\r\n end\r\n end",
"def show\n #render :template => 'posts/show.xml.builder', :layout => false\n render :json => @post, :layout => false\n end",
"def show\n @post149 = Post149.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post149 }\n end\n end",
"def show\n @post143 = Post143.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post143 }\n end\n end",
"def show\n @post54 = Post54.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post54 }\n end\n end",
"def show\n @post249 = Post249.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post249 }\n end\n end",
"def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @feed.to_xml }\n end\n end",
"def show\n @post184 = Post184.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post184 }\n end\n end",
"def show\n @post110 = Post110.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post110 }\n end\n end",
"def index\n respond_with(@posts) do |format|\n format.html do\n return redirect_to blog_path, :status => 301 if request.path =~ /^\\/posts(\\/?)$/ && flash.empty?\n\n @posts = user_signed_in? ? Post.latest : Post.published.latest\n @posts = @posts.paginate :page => params[:page], :per_page => Post.per_page\n end\n\n format.rss { @posts = Post.published.latest }\n end\n end",
"def show\n @post221 = Post221.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post221 }\n end\n end",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def show\n @post168 = Post168.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post168 }\n end\n end",
"def show\n @post328 = Post328.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post328 }\n end\n end",
"def show\n @post85 = Post85.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post85 }\n end\n end",
"def show\n @post193 = Post193.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post193 }\n end\n end",
"def show\n @post459 = Post459.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post459 }\n end\n end"
] | [
"0.72230846",
"0.7073397",
"0.7073397",
"0.6978713",
"0.69539315",
"0.69031423",
"0.6797454",
"0.67764527",
"0.67728055",
"0.6706541",
"0.67029274",
"0.66985327",
"0.6677388",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.6663551",
"0.6656949",
"0.66288304",
"0.6618437",
"0.66177785",
"0.66030884",
"0.65995765",
"0.65995765",
"0.6577797",
"0.6566537",
"0.65630615",
"0.65579927",
"0.65578336",
"0.6544128",
"0.6539112",
"0.6530588",
"0.65284926",
"0.65253115",
"0.65229887",
"0.65225196",
"0.6517227",
"0.6515897",
"0.65139264",
"0.6505048",
"0.64923406",
"0.6483094",
"0.6479985",
"0.6479292",
"0.64685667",
"0.64624375",
"0.64611727",
"0.6459169",
"0.6458951",
"0.6454094",
"0.6453434",
"0.64464176",
"0.6445181",
"0.6432302",
"0.6414653",
"0.6414241",
"0.64125043",
"0.64087236",
"0.6407182",
"0.6406997",
"0.63986886",
"0.63946235",
"0.63945794",
"0.6389463",
"0.6386865",
"0.6377745",
"0.6377232",
"0.6374512",
"0.63651",
"0.635975",
"0.63542426",
"0.63538253",
"0.635154",
"0.6347047",
"0.6345173",
"0.63446015",
"0.6344131",
"0.6341661",
"0.634062",
"0.6338945",
"0.6338542",
"0.63380927",
"0.63370776",
"0.63336074",
"0.6331987",
"0.6328752",
"0.6325661",
"0.6322075",
"0.6314908",
"0.63121307",
"0.6310085",
"0.63082105"
] | 0.6329106 | 93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.