query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns an empty string, because this chunk should always be empty.
def content ChunkyPNG::Datastream.empty_bytearray end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_text\n \"\"\n end", "def final\n \"\"\n end", "def final\n \"\"\n end", "def empty!\n self.replace(\"\")\n end", "def content\n ''\n end", "def clear\n ''\n end", "def noop\n \"\"\n end", "def empty?\n to_s.empty?\n end", "def excl\n \"\"\n end", "def contents_or_blank\n\t\tcontents\n\trescue Rush::DoesNotExist\n\t\t\"\"\n\tend", "def value_when_finished # mimic behaviour of ruby File object.\n return nil if @hasReturnedEmptyString\n @hasReturnedEmptyString=true\n return \"\"\n end", "def to_s\n \"\"\n end", "def to_s\n ''\n end", "def to_s\n ''\n end", "def to_s\n ''\n end", "def contents_or_blank\n\t\tcontents\n\trescue Crush::DoesNotExist\n\t\t\"\"\n\tend", "def empty_content_for(symbol)\n content = content_clear(symbol)\n content_for symbol, 0.chr\n return content\n end", "def content\n \"\".b\n end", "def nothing?\n\t\tjoin('').strip.empty?\n\tend", "def nothing_text\n nil\n end", "def quick_body\n @raw[1..-1] || \"\"\n end", "def blank_line\n output \"\"\n end", "def size; '' end", "def render; ''; end", "def empty()\n @s1.length == 0\n end", "def empty_line\n end", "def to_s\n \"\"\n end", "def to_s\n \"\"\n end", "def to_s\n output || content || \"\"\n end", "def header_str\n \"\"\n end", "def string\n @fragments.join(\" \")\n end", "def to_s\n output || content || \"NO CONTENT\"\n end", "def to_s\n\t\t\"\"\n\tend", "def strip_empty?\n @strip_empty\n end", "def compact_blank; end", "def empty?\n @text.empty?\n end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty!; end", "def to_s()\r\n\t\ts = \"\"\r\n\t\tif @cuerpo != nil\r\n\t\t\ts << @cuerpo.to_s(0) + \"\\n\"\r\n\r\n\t\telse\r\n\t\t\ts = \"Block\"\r\n\t\tend\r\n\t\treturn s\r\n\tend", "def to_s()\r\n\t\ts = \"\"\r\n\t\tif @cuerpo != nil\r\n\t\t\ts << @cuerpo.to_s(0) + \"\\n\"\r\n\r\n\t\telse\r\n\t\t\ts = \"Block\"\r\n\t\tend\r\n\t\treturn s\r\n\tend", "def blank\n @string.gsub(/\\e\\[[0-9]+m/,'')\n end", "def blank?\n self.strip.size == 0\n end", "def empty?\n content.empty?\n end", "def uploaded_data\n return \"\"\n end", "def blank?\n buffer.last == \"\\n\"\n end", "def empty?\n `return self.length == 0 ? Qtrue : Qfalse;`\n end", "def empty?\n `return self.length == 0 ? Qtrue : Qfalse;`\n end", "def tpl_text; ''; end", "def tpl_text; ''; end", "def tpl_text; ''; end", "def empty?\n @content.empty?\n end", "def empty?\n @contents.nil?\n \n \n \n \n end", "def body\n return \"\"\n end", "def empty()\n \n end", "def blank?\n self.strip.length === 0\n end", "def empty?\n self.length == 0\n end", "def render_empty_template\n @empty_template ||= \"<p> Sorry there were no records found. </p>\"\n return @empty_template\n end", "def strip!\n \"\"\n end", "def empty?()\n @string.length <= @index\n end", "def client_empty_message\n BSON::Binary.new('')\n end", "def compact_blank!; end", "def empty?\n line.empty?\n end", "def blank?\n self.strip.empty?\n end", "def textilize_without_paragraphs\n\t\tunless self.nil? or self.empty?\n\t\t string = self.textilize\n\t\t string = string[3..-1]\n\t\t string = string[0..-5]\n\t\telse\n\t\t \"\"\n\t end\n\tend", "def null_finish\n file.write(\"\\r\" + ' ' * @last_printed_length + \"\\r\")\n end", "def body\n \"\"\n end", "def body\n \"\"\n end", "def empty_line\n puts\" \" * 70\nend", "def blank_from_pos?\n\t# The string @content[@pos..-1] may be nil, which justify the #to_s\n\t@content[@pos..-1].to_s.blank?\n end", "def empty?\n @output.empty?\n end", "def sb(s)\r\n (s == '(none)' || s == '') ? '' : s\r\n end", "def empty?\n serialize.empty?\n end", "def blank?\n if content.respond_to?(:empty?)\n content.empty?\n else\n content.nil?\n end\n end", "def default\n ''\n end", "def body\n ''\n end", "def empty?\n return self.length == 0\n end", "def empty?\n return self.length == 0\n end", "def empty?\n self.length == 0\n end", "def raw\n @raw ||= ''\n end", "def empty?() end", "def empty?() end", "def empty?() end", "def clear\n @data = \"O\" * size\n end", "def empty?; false; end", "def empty?; false; end", "def summarize_content (char_num)\n if self.content.length <= char_num\n return self.content\n else return self.content[0..(char_num-1)] + \"...\"\n end\n end", "def to_s\n res = \"\"\n self.each {|current| res << \" ( #{current.data} ) -> \" }\n res << \"nil\"\n end", "def to_s; nil; end", "def string_message2(string)\n return \"It's an empty string!\" if string.empty?\n return \"The string is nonempty.\"\n end", "def get_string\n\n zero_byte = @buffer.index(\"\\0\",@position)\n\n if zero_byte == nil\n string = ''\n else\n string = get(zero_byte-@position)\n @position+=1\n end\n\n string\n\n\t\t\n\n end" ]
[ "0.71633136", "0.6880981", "0.6793156", "0.67802614", "0.6735104", "0.6601575", "0.6471702", "0.6464944", "0.6405512", "0.63493043", "0.63448894", "0.6324027", "0.6300541", "0.6300541", "0.6300541", "0.6296618", "0.6273017", "0.62568784", "0.6227967", "0.62270397", "0.6212054", "0.62013865", "0.61394906", "0.6133468", "0.6127783", "0.6104463", "0.6102869", "0.6102869", "0.6058462", "0.60529935", "0.6032192", "0.60277516", "0.6022693", "0.6013249", "0.5965169", "0.5964865", "0.5948377", "0.5948377", "0.5948377", "0.5948377", "0.5948377", "0.5948377", "0.5948377", "0.5948377", "0.5948377", "0.5948377", "0.5948377", "0.5948377", "0.59359384", "0.5933896", "0.5933896", "0.5888362", "0.58833283", "0.58785176", "0.5842036", "0.58408207", "0.5807385", "0.5807385", "0.58047044", "0.58047044", "0.58047044", "0.57991844", "0.5789968", "0.57840437", "0.57811767", "0.5780487", "0.57721114", "0.5770333", "0.575834", "0.5751248", "0.57484615", "0.5747895", "0.5732655", "0.57239586", "0.57115185", "0.57024246", "0.568853", "0.568853", "0.5679451", "0.567629", "0.5663528", "0.5649581", "0.56458193", "0.5643581", "0.5642814", "0.5641649", "0.56392336", "0.5636634", "0.563641", "0.56351465", "0.5628021", "0.5628021", "0.5628021", "0.5624358", "0.56242514", "0.56242514", "0.56230295", "0.56200796", "0.56179374", "0.5606378", "0.5604628" ]
0.0
-1
Creates the content to write to the stream, by concatenating the keyword with the value, joined by a null character.
def content [keyword, value].pack('Z*a*') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_tag(tag,value)\n @io << \"<value><#{tag}>#{text(value)}</#{tag}></value>\"\n end", "def put(text)\n ostream << text\n ostream.flush\n end", "def text(value)\n attributes[:streams] << { text: value }\n end", "def placeholder\n s = \"\"\n buffer << s\n s\n end", "def content\n [keyword, value].pack(\"Z*a*\")\n end", "def content(text)\n@out << text.to_s\nnil\nend", "def << (value)\n @input << value.strip\n end", "def append_cmd\n sprintf 'echo \"%s%s\" >> %s', key_set_string, @config[:value], @file\n end", "def write_marker_value # :nodoc:\n return unless @default_marker\n\n @writer.empty_tag('c:marker', [['val', 1]])\n end", "def write_elem(tag, value)\n @io << \"<#{tag}>#{text(value)}</#{tag}>\"\n end", "def text(value)\n @doc << {:type => :text, :value => value}\n nil\n end", "def emit_text value\n # don't bother emitting empty strings\n return if value.empty?\n\n # combine adjacent statements to reduce code size\n if prev = insertion_point.last and prev.type == :text\n prev.value << value\n else\n statement :text, value\n end\n end", "def content(text)\n @out << text.to_s\n nil\n end", "def write!( string )\n @stream << string\n end", "def write_fragment(key, content, options = T.unsafe(nil)); end", "def write(text, nullable = T.unsafe(nil)); end", "def to_s\n text = \"#{keyword} #{self.text}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end", "def write(value)\n # pass\n end", "def <<(value)\n connection.rpush key_label, value\n end", "def add_to_buffer(value, key_type = nil)\n value = $1 if value =~ /^\"(.*)\"/\n value.gsub(/\\\\\"/, '\"')\n\n if key_type.nil?\n @buffer[@last_key_type] += value\n else\n @buffer[key_type] = value\n @last_key_type = key_type\n end\n end", "def write!(val)\n if val != nil\n if @buffer[@youngest..-1].any? { |val| val == nil }\n write(val)\n else\n @buffer[@oldest] = val\n @youngest = @oldest\n @oldest = increment_oldest(@buffer.size)\n end\n end\n end", "def write_marker_value # :nodoc:\n style = @default_marker\n\n return unless style\n\n attributes = ['val', 1]\n\n @writer.empty_tag('c:marker', attributes)\n end", "def write(name, value, options = nil)\n options ||= {}\n name = expanded_key name\n if options.delete(:raw)\n options[:format] = :plain\n value = value.to_s\n value.force_encoding(Encoding::BINARY) if defined?(Encoding)\n end\n\n instrument(:write, name, options) do |payload|\n write_entry(name, value, options)\n end\n end", "def write_plain_on(op, value_hash)\n esc = proc {|str| str}\n op << write_common(value_hash, esc)\n end", "def text(string)\n @builder << string.to_s\n nil\n end", "def text(string)\n target << string\n end", "def append(value = '')\n @source += value\n end", "def text_token text, kind\n @out << text\n end", "def appendtext(value)\n merge(appendtext: value.to_s)\n end", "def <<(str)\n (@stored_body ||= '') << str\n old_write_to(str)\n end", "def write(key, content)\n set(key.to_s, content.to_json)\n end", "def add_string(tag, value)\n value = value.to_s\n write_tag(tag, Type::STRING)\n Varint.serialize(@io, value.bytesize)\n @io << value\n\n self\n end", "def s3_write(key, value)\n @s3.put_object(bucket: ENV.fetch(\"AWS_BUCKET\"), key: key, body: value,\n content_type: \"text/plain; charset=utf-8\")\n end", "def to_s\n text = \"#{keyword} #{base}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end", "def create_value(val)\n val ? \"\\\"#{val}\\\"\" : \"\"\n end", "def text!(content)\n build! do\n @_crafted << Tools.escape(content.to_s)\n end\n end", "def write(what)\n @body = \"\" if !@body\n @body += what.to_s if what && what.class\n end", "def <<(string = nil)\n message = \"\"\n message << delimiter\n message << string if string\n message << \"\\n\" unless message[-1] == ?\\n\n @buffer << message\n flush if @auto_flush\n\n message\n end", "def const(name, value)\n @data << \"#{name}\\tequ #{value}\"\n end", "def write(string)\n self << string\n end", "def write string\n end", "def xml_value(tag_name, value, properties = {})\n tag = XML::Node.new(tag_name.to_s) \n properties.each do |k, v|\n tag[k.to_s] = v.to_s\n end\n tag << as_cdata(value)\n tag\n end", "def literal_string_append(sql, v)\n sql << APOS << db.synchronize{|c| c.escape_string(v)} << APOS\n end", "def out text\n @fileBuffer << text << \"\\n\"\nend", "def <<(value); end", "def write(val)\n @file.seek(@address)\n @file.putc(val)\n @file.flush\n end", "def write_external(out_stream)\n # out.writeShort (fieldNumber);\n # out.writeUTF (value);\n puts value.to_s\n end", "def emit(tag)\n output << tag.to_s\n end", "def <<(string); end", "def <<(string); end", "def write_tex_on(op, value_hash)\n esc = proc do |str|\n str.\n gsub(/&lt;/, '<').\n gsub(/&gt;/, '>').\n gsub(/&amp;/) { '\\\\&' }.\n gsub(/([$&%\\#{}_])/) { \"\\\\#$1\" }.\n gsub(/>/, '$>$').\n gsub(/</, '$<$')\n end\n str = \"\"\n \n str << write_common(value_hash, esc)\n $stderr.puts str.inspect\n op << str\n end", "def to_s; \"#@keyword:#@key; #@sourceRef\" end", "def set_Keyword(value)\n set_input(\"Keyword\", value)\n end", "def set_Keyword(value)\n set_input(\"Keyword\", value)\n end", "def write(value)\n record.send(\"#{name}_data=\", value)\n end", "def write(str)\n writing { write0 str }\n end", "def write(key, value)\n perform_update(:write, key, value.to_s)\n end", "def write_string(val, *ignored)\n\t\treturn TagLib::MP4::Item.from_string_list([val.to_s])\n\tend", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def write_tx_value(title) # :nodoc:\n @writer.tag_elements('c:tx') { write_v(title) }\n end", "def write_tx_value(title) # :nodoc:\n @writer.tag_elements('c:tx') { write_v(title) }\n end", "def set_string(offset, value)\n @contents.pos = offset\n @contents << value\n end", "def write_header(title)\n @openfile.write %Q{<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <kml xmlns=\"http://www.opengis.net/kml/2.2\">\n <Document>\n <name>\n #{title}\n </name>\n }\n end", "def produce_record(stream, key, value)\n r = ::Concord::Thrift::Record.new\n r.meta = ::Concord::Thrift::RecordMetadata.new\n r.key = key\n r.data = value\n r.userStream = stream\n transaction.records.push(r)\n end", "def << (s)\n do_write(s)\n self\n end", "def text(value)\n merge(text: value.to_s)\n end", "def <<(text)\r\n if @text.length > 0 && @text[-1..-1] != \" \" && text[0..0] != \" \"\r\n @text += \" \"\r\n end\r\n @text += text\r\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def write_string(*text); end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s + \" \"\n @output.text = @input\n end", "def write(val)\n @writer.call(@address, val)\n end", "def custom_writer(key, value, convert = T.unsafe(nil)); end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def <<(v)\n @c.add(v.to_s, v)\n end", "def build_xml(target, type, value)\n <<-EOF.gsub(/^ {8}/, '')\n <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\n <entry\n xml:base=\"/p/p.svc/\"\n xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\"\n xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"\n xmlns=\"http://www.w3.org/2005/Atom\">\n <id></id>\n <title type=\"text\"></title>\n <updated>#{@time}</updated>\n <author><name /></author>\n <category term=\"pomegranateModel.Asset\" scheme=\"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme\" />\n <content type=\"application/xml\">\n <m:properties>\n <d:AssetID>--</d:AssetID>\n <d:AssetData>#{type === \"TEXT\" ? escape_xml(value) : value}</d:AssetData>\n <d:AssetType>#{type}</d:AssetType>\n <d:AssetMeta></d:AssetMeta>\n <d:AssetRecordID>#{@record_id}</d:AssetRecordID>\n <d:Target>#{target}</d:Target>\n <d:Client>#{@client_id}</d:Client>\n <d:Status>#{@client_id == \"P0\" ? \"UPLOADED\" : \"APPROVED\"}</d:Status>\n </m:properties>\n </content>\n </entry>\n EOF\n end", "def text(value)\n if value.is_a? Widget\n widget value\n else\n output.concat(value.html_escape)\n end\n @at_start_of_line = false\n nil\n end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless (description.nil? || description.empty?)\n text << \"\\n\" unless (steps.empty? || description.nil? || description.empty?)\n text << \"\\n\" + steps_output_string unless steps.empty?\n text << \"\\n\\n\" + examples_output_string unless examples.empty?\n\n text\n end", "def add(term)\n root.add Buffer.new(normalize(term) + delimiter), term\n end", "def append_field_value(value)\n return unless current_field && value\n current_value << value.gsub(/\\s+/, ' ')\n end", "def print_var(str, name, val)\n return if val.nil?\n return if val.class == String && val.empty?\n\n str << \"#{name}=\\\"#{val}\\\"\\n\"\n end", "def <<(buf)\n return write(buf.to_s)\n end", "def write(text)\n content.send @opts[:write], text\n end", "def text( text )\n @buffer << encode(text.to_s)\n end", "def write(str)\n return if noop?\n FileUtils.mkdir_p(File.dirname(file)) #unless File.file?(file)\n File.open(file, 'w'){ |f| f << str }\n end", "def write(value)\n update_buffer(value)\n\n render\n\n self\n end", "def write(string)\n @buffer << string\n self\n end", "def write(val)\n if val != nil\n raise BufferFullException if @buffer.all? { |val| val != nil }\n @youngest = increment_youngest(@buffer.size)\n @buffer[@youngest] = val\n end\n end", "def compose_header(key, value)\n Util.escape_zero_byte(\"#{key}: #{value}\")\n end", "def write_to(stream)\n stream.write_int(TAG)\n end", "def write_to(stream)\n stream.write_int(TAG)\n end", "def write_to(stream)\n stream.write_int(TAG)\n end", "def []=(name, value)\n merge(\"#{name}=#{Rack::Utils.escape(value)}\")\n end", "def append(key, value)\n perform(:append, key, value.to_s)\n end", "def <<(string)\n\t\t\t\twrite(string)\n\t\t\t\t\n\t\t\t\treturn self\n\t\t\tend", "def build_param(k,v)\n \"#{escape(k)}=#{escape(v)}\"\n end", "def write_tag(content, tag)\n write_html(\"<#{tag}>\\n\")\n write_text(content)\n write_html(\"</#{tag}>\\n\")\n end", "def write(s)\n @data += s\n end", "def set(key, value)\n @content[key] = ActiveSupport::SafeBuffer.new(value.to_s)\n end" ]
[ "0.6020991", "0.57742596", "0.56495965", "0.56188476", "0.54598397", "0.541934", "0.54093075", "0.5350565", "0.5346245", "0.5327916", "0.5304636", "0.5288337", "0.5221924", "0.52182883", "0.51878977", "0.5112828", "0.50705177", "0.50633025", "0.5058929", "0.50537354", "0.5046039", "0.5031056", "0.50279397", "0.5008443", "0.5007201", "0.4978499", "0.4973498", "0.49494877", "0.49404714", "0.4939982", "0.48972574", "0.48866543", "0.4859447", "0.48505306", "0.48448297", "0.48383832", "0.4817232", "0.4810591", "0.47763708", "0.4752143", "0.47510716", "0.47445562", "0.473884", "0.47207057", "0.47146204", "0.46995115", "0.46935168", "0.46917558", "0.4690763", "0.4690763", "0.46884015", "0.46883613", "0.4681676", "0.4681676", "0.46735373", "0.46712264", "0.46690485", "0.46657914", "0.46602336", "0.46602336", "0.46602336", "0.46412537", "0.46412537", "0.46383527", "0.46297565", "0.46247646", "0.4621301", "0.46201837", "0.46176314", "0.46132976", "0.4609759", "0.45962787", "0.45927963", "0.45799714", "0.45794666", "0.45743012", "0.45714813", "0.45608023", "0.4558572", "0.45561618", "0.45549804", "0.4553977", "0.45536515", "0.4552086", "0.45496827", "0.4548191", "0.45371303", "0.45296305", "0.45264763", "0.45246282", "0.45165372", "0.45165372", "0.45165372", "0.45144662", "0.45138764", "0.45100263", "0.45018134", "0.4499828", "0.4494425", "0.44744062" ]
0.5457247
5
Creates the content to write to the stream, by concatenating the keyword with the deflated value, joined by a null character.
def content [keyword, ChunkyPNG::COMPRESSION_DEFAULT, Zlib::Deflate.deflate(value)].pack('Z*Ca*') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def placeholder\n s = \"\"\n buffer << s\n s\n end", "def write_tag(tag,value)\n @io << \"<value><#{tag}>#{text(value)}</#{tag}></value>\"\n end", "def write(what)\n @body = \"\" if !@body\n @body += what.to_s if what && what.class\n end", "def write(text, nullable = T.unsafe(nil)); end", "def write_fragment(key, content, options = T.unsafe(nil)); end", "def content(text)\n@out << text.to_s\nnil\nend", "def put(text)\n ostream << text\n ostream.flush\n end", "def to_s\n text = \"#{keyword} #{self.text}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end", "def to_s\n text = \"#{keyword} #{base}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end", "def emit_text value\n # don't bother emitting empty strings\n return if value.empty?\n\n # combine adjacent statements to reduce code size\n if prev = insertion_point.last and prev.type == :text\n prev.value << value\n else\n statement :text, value\n end\n end", "def content(text)\n @out << text.to_s\n nil\n end", "def text!(content)\n build! do\n @_crafted << Tools.escape(content.to_s)\n end\n end", "def content\n [keyword, value].pack(\"Z*a*\")\n end", "def content\n [keyword, value].pack('Z*a*')\n end", "def text_token text, kind\n @out << text\n end", "def text(string)\n target << string\n end", "def write_marker_value # :nodoc:\n return unless @default_marker\n\n @writer.empty_tag('c:marker', [['val', 1]])\n end", "def concat_to_template(text=\"\")\n self.output_buffer << text if is_type? && text\n nil\n end", "def text(value)\n @doc << {:type => :text, :value => value}\n nil\n end", "def write_tex_on(op, value_hash)\n esc = proc do |str|\n str.\n gsub(/&lt;/, '<').\n gsub(/&gt;/, '>').\n gsub(/&amp;/) { '\\\\&' }.\n gsub(/([$&%\\#{}_])/) { \"\\\\#$1\" }.\n gsub(/>/, '$>$').\n gsub(/</, '$<$')\n end\n str = \"\"\n \n str << write_common(value_hash, esc)\n $stderr.puts str.inspect\n op << str\n end", "def text(string)\n @builder << string.to_s\n nil\n end", "def <<(str)\n (@stored_body ||= '') << str\n old_write_to(str)\n end", "def write_plain_on(op, value_hash)\n esc = proc {|str| str}\n op << write_common(value_hash, esc)\n end", "def _text(text)\n @target << text\n end", "def to_s; \"#@keyword:#@key; #@sourceRef\" end", "def write!( string )\n @stream << string\n end", "def append_cmd\n sprintf 'echo \"%s%s\" >> %s', key_set_string, @config[:value], @file\n end", "def text(value)\n attributes[:streams] << { text: value }\n end", "def write_elem(tag, value)\n @io << \"<#{tag}>#{text(value)}</#{tag}>\"\n end", "def write(text)\n content.send @opts[:write], text\n end", "def write_header(title)\n @openfile.write %Q{<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <kml xmlns=\"http://www.opengis.net/kml/2.2\">\n <Document>\n <name>\n #{title}\n </name>\n }\n end", "def write string\n end", "def write_string(*text); end", "def write_marker_value # :nodoc:\n style = @default_marker\n\n return unless style\n\n attributes = ['val', 1]\n\n @writer.empty_tag('c:marker', attributes)\n end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless (description.nil? || description.empty?)\n text << \"\\n\" unless (steps.empty? || description.nil? || description.empty?)\n text << \"\\n\" + steps_output_string unless steps.empty?\n text << \"\\n\\n\" + examples_output_string unless examples.empty?\n\n text\n end", "def emit(tag)\n output << tag.to_s\n end", "def write(str)\n writing { write0 str }\n end", "def const(name, value)\n @data << \"#{name}\\tequ #{value}\"\n end", "def keyword\n\t\t\tlegal = legal_record_type_id == 0 ? legal_record_type.name : custom_legal_record_type\n\t\t\talley = is_alley == 1 ? 'Hẻm' : 'Mặt tiền'\n\n\t\t\tkeyword = \n\t\t\t\t\"#{name}, #{purpose.name} #{real_estate_type.name} quận #{district.name}, #{real_estate_type.name} #{legal}, #{real_estate_type.name} #{alley}, #{alley} quận #{district.name}, #{street.name} quận #{district.name}, #{purpose.name}, #{province.name}, #{real_estate_type.name}, #{legal}\"\n\t\tend", "def define_variable(name)\n emit_section :data\n emit \"#{name}: .long 0x0\\n\"\n emit_section :text\nend", "def define_variable(name)\n emit_section :data\n emit \"#{name}: .long 0x0\\n\"\n emit_section :text\nend", "def _gestalt_build_tag(name, attr = {}, text = [])\n @out << \"<#{name}\"\n @out << attr.map{|(k,v)| %[ #{k}=\"#{_gestalt_escape_entities(v)}\"] }.join\n if text != [] or block_given?\n @out << \">\"\n @out << _gestalt_escape_entities([text].join)\n if block_given?\n text = yield\n @out << text.to_str if text != @out and text.respond_to?(:to_str)\n end\n @out << \"</#{name}>\"\n else\n @out << ' />'\n end\n end", "def emit_literal\n ts, te = literal.first[1], literal.last[2]\n text = literal.map {|t| t[0]}.join\n\n text.force_encoding('utf-8') if text.respond_to?(:force_encoding)\n\n self.literal = nil\n emit(:literal, :literal, text, ts, te)\n end", "def emit_literal\n ts, te = literal.first[1], literal.last[2]\n text = literal.map {|t| t[0]}.join\n\n text.force_encoding('utf-8') if text.respond_to?(:force_encoding)\n\n self.literal = nil\n emit(:literal, :literal, text, ts, te)\n end", "def p_term(resource, position)\n #log_debug(\"p_term\") {\"#{resource.to_sxp}, #{position}\"}\n l = if resource.is_a?(RDF::Query::Variable)\n \"?#{resource.name}\"\n elsif resource == RDF.nil\n \"()\"\n else\n format_term(resource, **options)\n end\n @output.write(l)\n end", "def content\n \"alias #{@name}=#{@val}\"\n end", "def emit_literal\n text = literal.join\n self.literal = nil\n emit(:literal, :literal, text)\n end", "def write_tag(content, tag)\n write_html(\"<#{tag}>\\n\")\n write_text(content)\n write_html(\"</#{tag}>\\n\")\n end", "def createtemplate\r\n\t\t chars_num = @secretword.length\r\n\t\t line = \"\"\r\n\t\t line_char = \"_\"\r\n\t\t while chars_num > 0 do\r\n\t\t \tline += line_char\r\n\t\t \tchars_num -= 1\r\n\t\t end\r\n\t\t templ = \"[#{line}]\"\r\n\t\t return templ\r\n\t\t end", "def output\n parent.set(@var_name, @var_value)\n return \"\"\n end", "def build_xml(target, type, value)\n <<-EOF.gsub(/^ {8}/, '')\n <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\n <entry\n xml:base=\"/p/p.svc/\"\n xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\"\n xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"\n xmlns=\"http://www.w3.org/2005/Atom\">\n <id></id>\n <title type=\"text\"></title>\n <updated>#{@time}</updated>\n <author><name /></author>\n <category term=\"pomegranateModel.Asset\" scheme=\"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme\" />\n <content type=\"application/xml\">\n <m:properties>\n <d:AssetID>--</d:AssetID>\n <d:AssetData>#{type === \"TEXT\" ? escape_xml(value) : value}</d:AssetData>\n <d:AssetType>#{type}</d:AssetType>\n <d:AssetMeta></d:AssetMeta>\n <d:AssetRecordID>#{@record_id}</d:AssetRecordID>\n <d:Target>#{target}</d:Target>\n <d:Client>#{@client_id}</d:Client>\n <d:Status>#{@client_id == \"P0\" ? \"UPLOADED\" : \"APPROVED\"}</d:Status>\n </m:properties>\n </content>\n </entry>\n EOF\n end", "def content=(string); end", "def content=(string); end", "def to_s\n text = ''\n\n text << \"#{tag_output_string}\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\" unless rows.empty? || no_description_to_output?\n text << \"\\n#{parameters_output_string}\" if parameter_row\n text << \"\\n#{rows_output_string}\" unless argument_rows.empty?\n\n text\n end", "def to_s\n text = ''\n\n text << \"#{tag_output_string}\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\\n#{background_output_string}\" if background\n text << \"\\n\\n#{tests_output_string}\" unless tests.empty?\n\n text\n end", "def add_word(word, definition)\r\n @word << {Word: word, Definition: definition}\r\n # puts \"This is @word: #{@word}\"\r\n end", "def render_text(text)\n @out << text\n end", "def write(str)\n return if noop?\n FileUtils.mkdir_p(File.dirname(file)) #unless File.file?(file)\n File.open(file, 'w'){ |f| f << str }\n end", "def out text\n @fileBuffer << text << \"\\n\"\nend", "def write( &block )\n compile!( :write!, &block )\n end", "def custom_writer(key, value, convert = T.unsafe(nil)); end", "def <<(text)\r\n if @text.length > 0 && @text[-1..-1] != \" \" && text[0..0] != \" \"\r\n @text += \" \"\r\n end\r\n @text += text\r\n end", "def literal_string_append(sql, v)\n sql << APOS << db.synchronize{|c| c.escape_string(v)} << APOS\n end", "def write(key, content)\n set(key.to_s, content.to_json)\n end", "def write(value)\n # pass\n end", "def add_word_default(w)\n add_word(w, \"#{w}r\", \"#{w}p\", \"#{w}m\")\n \n end", "def replace_string keyword, user_word\n #loop through keywords here\n @story_template.gsub(\"[#{keyword}]\", user_word) # We have to add the [] staples back in so that the story_template function below works \n end", "def write(string, *smth)\n #This is a stub, used for indexing\n end", "def write_footer\n @openfile.write(\"\\n</Document>\\n</kml>\")\n end", "def write!(val)\n if val != nil\n if @buffer[@youngest..-1].any? { |val| val == nil }\n write(val)\n else\n @buffer[@oldest] = val\n @youngest = @oldest\n @oldest = increment_oldest(@buffer.size)\n end\n end\n end", "def write; end", "def write; end", "def print_var(str, name, val)\n return if val.nil?\n return if val.class == String && val.empty?\n\n str << \"#{name}=\\\"#{val}\\\"\\n\"\n end", "def write(fragment); end", "def show\n\n puts keyword_stream\n puts tweet_text\n puts tweet_url\n puts user_name\n puts user_image\n # if defined? keyword_stream\n # @keyword_stream = keyword_stream\n # else\n # @keyword_stream = \"nothing to see here\"\n # end\n\n end", "def content text\n @xml << text.to_s\n nil\n end", "def write_tag\n file.seek(tag_start, IO::SEEK_SET)\n file.write(raw)\n file.truncate(file.pos)\n @has_tag = true\n end", "def final\n \"\"\n end", "def output_word\n end", "def write(name, value, options = nil)\n options ||= {}\n name = expanded_key name\n if options.delete(:raw)\n options[:format] = :plain\n value = value.to_s\n value.force_encoding(Encoding::BINARY) if defined?(Encoding)\n end\n\n instrument(:write, name, options) do |payload|\n write_entry(name, value, options)\n end\n end", "def __emit(str)\n __writer.flush\n end", "def content\n text_field = text.encode(\"utf-8\")\n text_field = compressed == ChunkyPNG::COMPRESSED_CONTENT ? Zlib::Deflate.deflate(text_field) : text_field\n\n [keyword, compressed, compression, language_tag, translated_keyword.encode(\"utf-8\"), text_field].pack(\"Z*CCZ*Z*a*\")\n end", "def to_s\n text = ''\n\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\" unless steps.empty? || no_description_to_output?\n text << \"\\n#{steps_output_string}\" unless steps.empty?\n\n text\n end", "def add_to_doc(str)\n @out_doc << str\n end", "def create_file_with_content(file_path: '/tmp/temp_file.ext', content: '')\n File.open(file_path, 'w') { |f| f.write(content) }\n LoggerHelper.print_to_log(\"Created file: #{file_path} with content: #{content}\")\n file_path\n end", "def <<(string = nil)\n message = \"\"\n message << delimiter\n message << string if string\n message << \"\\n\" unless message[-1] == ?\\n\n @buffer << message\n flush if @auto_flush\n\n message\n end", "def write_tx_value(title) # :nodoc:\n @writer.tag_elements('c:tx') { write_v(title) }\n end", "def write_tx_value(title) # :nodoc:\n @writer.tag_elements('c:tx') { write_v(title) }\n end", "def <<(string); end", "def <<(string); end", "def create_value(val)\n val ? \"\\\"#{val}\\\"\" : \"\"\n end", "def write text=\"\"\n\t\t@message.text = @msg = text.to_s\n\tend", "def createUserContent(url,tag,content) \n #puts \"content: #{content}\"\n document = Hpricot(content) \n DocumentUtil::instance.removeTags document,[\"style\",\"script\"]\n docText = DocumentUtil::instance.textOnly document \n # Write contents for user out to a file... \n #puts \"Write content for user to file...\"\n #File.open(userFile,\"a\") do |outputFile|\n data = \"\" \n docText.each do |line|\n text = line.to_s.strip \n # Write non-empty lines to user file.\n if ! text.empty?\n #outputFile.puts text\n text = DocumentUtil::instance.removePunctuation text\n text = text.downcase\n text.split(/\\b/).each do |term|\n if term.match(/\\w/) && ! DocumentUtil::instance.isStopWord(term)\n data += term + \"\\n\"\n end\n end\n end\n end\n #end\n Content.new(url,tag,data)\n end", "def create\n\t\twrite('')\n\t\tself\n\tend", "def create\n\t\twrite('')\n\t\tself\n\tend", "def create_body\n @body = @suntime_text.text.concat(\"\\n\")\n @body.concat(@temperature_text.text).concat(\"\\n\")\n @body.concat(@wind_text.text).concat(\"\\n\")\n @body.concat(@rain_text.text)\n nil\n end", "def final\n \"\"\n end", "def writer\n :\"#{reader}=\"\n end", "def writer\n :\"#{reader}=\"\n end", "def add(term)\n root.add Buffer.new(normalize(term) + delimiter), term\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s + \" \"\n @output.text = @input\n end" ]
[ "0.5974092", "0.5621466", "0.5335463", "0.5313048", "0.530541", "0.5302922", "0.52708167", "0.5269492", "0.52402574", "0.52182275", "0.52003795", "0.5197329", "0.5185728", "0.5176349", "0.5139975", "0.5128909", "0.5115096", "0.5062138", "0.5033676", "0.49404284", "0.49229267", "0.49014822", "0.48984647", "0.48613104", "0.48553142", "0.48484507", "0.4830737", "0.480468", "0.48008028", "0.4795174", "0.4759819", "0.4755093", "0.4750074", "0.4749704", "0.47045103", "0.46839276", "0.4682531", "0.4680104", "0.46765628", "0.4672985", "0.4672985", "0.46458313", "0.46404275", "0.46404275", "0.4633678", "0.46092772", "0.459314", "0.45920527", "0.45914248", "0.45793897", "0.45730528", "0.45681286", "0.45681286", "0.45673794", "0.45650876", "0.45547122", "0.4554043", "0.4552685", "0.45516357", "0.45483932", "0.45462337", "0.45287102", "0.45271963", "0.45248473", "0.45211768", "0.45192945", "0.45165893", "0.45110753", "0.45104444", "0.4507336", "0.44954437", "0.44954437", "0.44906455", "0.44898748", "0.44870576", "0.44863313", "0.4484242", "0.44836918", "0.4483257", "0.4482748", "0.44816154", "0.44791386", "0.44775292", "0.44774184", "0.4473666", "0.44563138", "0.4449868", "0.4449868", "0.44471723", "0.44471723", "0.44454926", "0.44449288", "0.4444713", "0.44439828", "0.44439828", "0.44386283", "0.4431194", "0.4427812", "0.4427812", "0.44275656", "0.44264877" ]
0.0
-1
Always call this function last in the multiple conditional check so that the checkpoint message does not being echoed unnecessarily
def timeup quiet = false, cutoff_time = ENV['RELEASE_TAG'] ? 60.0 : 45.0 unless File.exists?('start_time.log') system 'touch start_time.log split_time.log' if ENV['CI'] return nil end current_time = Time.now elapsed_time = (current_time - File.atime('start_time.log')) / 60.0 unless quiet lap_time = (current_time - File.atime('split_time.log')) / 60.0 system 'touch split_time.log' puts "\n=== elapsed time: #{elapsed_time.to_i} minutes #{((elapsed_time - elapsed_time.to_i) * 60.0).round} seconds, lap time: #{lap_time.to_i} minutes #{((lap_time - lap_time.to_i) * 60.0).round} seconds ===\n\n" unless File.exists?('already_timeup.log'); $stdout.flush end return system('touch already_timeup.log') if elapsed_time > cutoff_time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkpoint_helper(checkpointer, sequence_number = nil)\n checkpointer.checkpoint(sequence_number)\n rescue Aws::KCLrb::CheckpointError => e\n # Here, we simply retry once.\n # More sophisticated retry logic is recommended.\n checkpointer.checkpoint(sequence_number) if sequence_number\n end", "def checkpoint_helper(checkpointer, sequence_number=nil)\n begin\n checkpointer.checkpoint(sequence_number)\n rescue Aws::KCLrb::CheckpointError => e\n # Here, we simply retry once.\n # More sophisticated retry logic is recommended.\n checkpointer.checkpoint(sequence_number) if sequence_number\n end\n end", "def checkpoint_helper(checkpointer, sequence_number = nil)\n begin\n checkpointer.checkpoint(sequence_number)\n rescue Aws::KCLrb::CheckpointError => e\n # Here, we simply retry once.\n # More sophisticated retry logic is recommended.\n checkpointer.checkpoint(sequence_number) if sequence_number\n end\n end", "def result_of_checking; end", "def precheck\n end", "def run_checks\n # check that backup cron script exits success\n [s_one, s_two].each do |server|\n chk1 = probe(server, \"/usr/local/bin/pgsql-binary-backup.rb --if-master --max-snapshots 10 -D 4 -W 1 -M 1 -Y 1\")\n \n chk2 = probe(server, \"/usr/local/bin/pgsql-binary-backup.rb --if-slave --max-snapshots 10 -D 4 -W 1 -M 1 -Y 1\")\n \n raise \"CRON BACKUPS FAILED TO EXEC, Aborting\" unless (chk1 || chk2) \n end\n end", "def checks; end", "def when_checkpoint_is_ready(&block)\n ready_blocks << block\n end", "def multi_check\n raise NotImplementedError\n end", "def checkpoint\n ask_user_for_input\n user_input = gets.chomp.downcase\n center_focus_simulation if user_input == 'c'\n user_choice_simulation if user_input == 't'\n instructions if user_input == 'i'\n return if user_input == 'q'\n end", "def take_checkpoint\n puts \"*** USER TAKING CHECKPOINT ***\"\n invalid = false\n \n begin\n @checkpoint_user = CheckpointUser.find(params[:id]) \n puts \"invalid checkpoint_user - bad ID!\"\n rescue ActiveRecord::RecordNotFound \n invalid = true \n end\n \n if (!invalid && @checkpoint_user.is_complete?) then invalid = true end\n \n if (invalid || (current_user.id != @checkpoint_user.user_id))\n puts \"checkpoint ID mismatch: actual #{current_user.id} expected: #{@checkpoint_user.user_id}}!\"\n flash[:error] = \"You cannot access this checkpoint.\"\n redirect_to checkpoints_path\n else\n # these objects go to the view\n @responses = @checkpoint_user.responses.all\n puts @responses\n end\n end", "def ready_save_and_check_summary\n\t\tself.finished_and_ready = true\n\t\tself.save!\n\t\t@round = Round.find(self.round_id)\n\t\t@round.prefs.each do |p|\n\t\t\tif !p.finished_and_ready\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t\n\tend", "def reach_checkpoint(name)\n scenario_indent = ' ' * 4\n step_indent = ' ' * 6\n\n step 'a computer'\n if VM.snapshot_exists?(name)\n $vm.restore_snapshot(name)\n else\n checkpoint = CHECKPOINTS[name]\n checkpoint_description = checkpoint[:description]\n parent_checkpoint = checkpoint[:parent_checkpoint]\n steps = checkpoint[:steps]\n if parent_checkpoint\n if VM.snapshot_exists?(parent_checkpoint)\n $vm.restore_snapshot(parent_checkpoint)\n else\n reach_checkpoint(parent_checkpoint)\n end\n post_snapshot_restore_hook(parent_checkpoint)\n end\n debug_log(scenario_indent + \"Checkpoint: #{checkpoint_description}\",\n color: :white, timestamp: false)\n step_action = 'Given'\n if parent_checkpoint\n parent_description = CHECKPOINTS[parent_checkpoint][:description]\n debug_log(step_indent + \"#{step_action} #{parent_description}\",\n color: :green, timestamp: false)\n step_action = 'And'\n end\n steps.each do |s|\n begin\n step(s)\n rescue StandardError => e\n debug_log(scenario_indent +\n \"Step failed while creating checkpoint: #{s}\",\n color: :red, timestamp: false)\n raise e\n end\n debug_log(step_indent + \"#{step_action} #{s}\",\n color: :green, timestamp: false)\n step_action = 'And'\n end\n $vm.save_snapshot(name)\n end\n # VM#save_snapshot restores the RAM-only snapshot immediately\n # after saving it, in which case post_snapshot_restore_hook is\n # useful to ensure we've reached a good starting point, so we run\n # it in all cases, including even when've just saved a new snapshot.\n post_snapshot_restore_hook(name)\nend", "def check_ending(_result)\n end", "def continue\n @proceed = true\n end", "def verify_noop (noop_fc=0)\n \n result = false\n\t \n cmd_valid_cnt = tlm(\"#{@app.target_hk_str} #{Osk::TLM_STR_CMD_VLD}\")\n cmd_error_cnt = tlm(\"#{@app.target_hk_str} #{Osk::TLM_STR_CMD_ERR}\")\n seq_cnt = tlm(\"#{@app.target_hk_str} #{Ccsds::PRI_HDR_SEQUENCE}\")\n event_seq_cnt = tlm(\"CFE_EVS EVENT_MSG_PKT CCSDS_SEQUENCE\")\n \n cmd(\"#{@app.target} #{Osk::CMD_STR_NOOP} with #{Ccsds::PRI_HDR_STREAMID} #{@app.cmd_mid}, #{Ccsds::PRI_HDR_SEQUENCE} 0, #{Ccsds::PRI_HDR_LENGTH} 1, #{Ccsds::SEC_HDR_CHECKSUM} 0, #{Ccsds::SEC_HDR_FUNCCODE} #{noop_fc}\")\n wait(\"#{@app.target_hk_str} #{Osk::TLM_STR_CMD_VLD} == #{cmd_valid_cnt}+1\", 10) # Delay until updated cmd valid count or timeout. \n\t\n #~~puts tlm(\"#{@target_hk_str} CMD_VALID_COUNT\")\n if ( (tlm(\"#{@app.target_hk_str} #{Osk::TLM_STR_CMD_VLD}\") == (cmd_valid_cnt + 1)) && \n (tlm(\"#{@app.target_hk_str} #{Osk::TLM_STR_CMD_ERR}\") == cmd_error_cnt))\n \n # TODO - Add utility to queue recent events so they can be queried \n event_seq_cnt_delta = tlm(\"CFE_EVS EVENT_MSG_PKT CCSDS_SEQUENCE\") - event_seq_cnt\n event_app = tlm(\"CFE_EVS EVENT_MSG_PKT APP_NAME\")\n event_type = tlm(\"CFE_EVS EVENT_MSG_PKT EVENT_TYPE\")\n event_msg = tlm(\"CFE_EVS EVENT_MSG_PKT MESSAGE\")\n puts \"event_seq_cnt_delta = #{event_seq_cnt_delta}\\n\"\n if (event_seq_cnt_delta == 1)\n if ((event_app == @app.target) and (event_type == Fsw::Const::CFE_EVS_INFORMATION) and (event_msg.include? @app.version))\n result = true\n end\n else\n puts \"#{@app.target} NOOP test warning: Unable to verify event message. Event message sequence count changed by #{event_seq_cnt_delta}\" \n result = true\n end\n \n else\n if ( tlm(\"#{@app.target_hk_str} #{Osk::TLM_STR_CMD_VLD}\") == seq_cnt)\n raise \"#{@app.target} NOOP test failed: HK telemetry packet not received\"\n end\n raise \"#{@app.target} NOOP test failed: Command counters\"\n end\n\t\n return result\n \n end", "def proceed!; end", "def proceed!; end", "def check ; true ; end", "def break_after_print\n checked_puts if @prev_printed\n end", "def postConditionalNextOPlanStage\n # find two random agents. They should be allowed to communicate\n # if they are not in the attack node\n agent1 = nil\n agent2 = nil\n @run.society.each_agent { |agent|\n if (agent.node.get_facet(\"attacker\") == nil)\n if (agent1 == nil) \n agent1 = agent\n else\n if (agent1.node != agent.node) \n agent2 = agent\n break\n end\n end\n end\n }\n\n testMessageSuccess(agent1.name, agent2.name, \n 'Stress3a101', \"Send message successfully\")\n end", "def continue?; end", "def check\n \n end", "def check\n \n end", "def check_state\n EM.stop if @setup.report_state.content =~ /operational|stranded/\n end", "def evaluate_next_step_on_change?\n false\n end", "def has_checkpoint?\n checkpoint_users.each do |check_user|\n return true if !check_user.is_complete?\n end\n return false\n end", "def check_all_here\n end", "def success_threshold; end", "def perform_action(message, multiline, mark_fn, on_fail_msg, tally_on_fail, abort_on_fail)\n line = \"#{message}... \"\n endline = \"...#{message} \"\n if multiline\n puts line\n else\n print line\n end\n $stdout.flush\n result = yield\n mark = mark_fn.nil? ? \"\" : mark_fn.call(result)\n # if multiline, put checkmark at full width\n print endline if multiline\n puts mark.to_s.rjust(WIDTH - line.length, \" \")\n unless result\n puts on_fail_msg unless on_fail_msg.nil?\n @failure_count += 1 if tally_on_fail\n # print out error messaging here if we've captured it\n terminate if abort_on_fail\n end\n result\nend", "def check_starting(_lang_result)\n end", "def verify_all_checks\n \n now = Time.now\n\n self.trim_checklist_for_design_type\n self.design_checks each do | design_check |\n if design_check.check.is_peer_check?\n design_check.auditor_result = 'Verified'\n design_check.auditor_checked_on = now\n end\n if design_check.check.is_self_check?\n design_check.designer_result = 'Verified'\n design_check.designer_checked_on = now\n end\n design_check.save\n end\n\n completed_checks = self.completed_check_count\n self.auditor_completed_checks = completed_checks[:peer]\n self.auditor_complete = true\n self.designer_completed_checks = completed_checks[:self]\n self.designer_complete = true\n self.save\n\n end", "def checkpoint\n remove_processed_tx_files\n Modsec::Tailer.write_resume_file(@logfile)\n end", "def run_succeeded; end", "def distribute\n\n puts \"\\n[DISTRIBUTE CHECKPOINT]===============================================\"\n successful_checkpoints = 0; \n\n # Get the checkpoint and it's checkpoint_organizations\n @checkpoint = Checkpoint.find(params[:id]) # the checkpoint\n @organizations = @checkpoint.organizations # target organizations\n\n # Verify that this checkpoint isn't yet distributed\n if (@checkpoint.distributed)\n flash[:error] = \"This checkpoint has already been distributed. It can't be distributed again.\" \n redirect_to :back\n end\n\n # compute the subset of participants who need to receive this checkpoint.\n # only consider participants in the organizations specified by the checkpoint.\n # use a set to avoid duplication of students who belong to multiple organizations.\n @student_set = Set.new\n puts \"\\nComputing participant set...\"\n @organizations.each do |org|\n if (org == nil) then puts \"ERROR: invalid org ID...\"; next end # ignore bad organization ID's\n puts \"==> adding participants for: #{org.name}\"\n @users = org.users.reject{ |u| (!u.is_participant?) } # non-participants don't get checkpoints\n @student_set.merge(@users) # add users not already in the set\n end\n\n # iterate through student set and determine which students actually need to get checkpoints.\n # a student needs a checkpoint if they've been to a new event since their last checkpoint.\n # make a checkpoint_user for students who are eligible for a new checkpoint.\n puts \"\\nProcessing student set...\"\n @student_set.each do |stu|\n\n # check eligibility of the student\n print \"==> #{stu.full_name} \"\n @stu_checkpt_events = stu.events_since_last_checkpoint\n if (@stu_checkpt_events.empty?) then puts \"[INELIGIBLE]\"; next end # skip students with no \"new\" events\n print \"[ELIGIBLE]\" \n\n # save a checkpoint_user record \n @cp_usr_obj = CheckpointUser.new({ # save a checkpoint_user record\n \"checkpoint_id\" => @checkpoint.id,\n \"user_id\" => stu.id,\n })\n @cp_usr_obj.save!\n \n # determine set of relevant measurements for this checkpoint\n # use a set to avoid duplication of the measurements.\n @measurement_set = Set.new\n @stu_checkpt_events.map{|ce| @measurement_set.merge(ce.measurements)}\n\n # determine the entire set of questions relevant to these measurements\n # sort the questions randomly and choose at most Checkpoint.MAX_CHECKPOINT_QUESTIONS to give.\n @questions = @measurement_set.to_a.map{|meas| meas.questions}.flatten.sort_by{rand}.first(Checkpoint::MAX_CHECKPOINT_QUESTIONS)\n questions_assigned = @questions.size\n\n # create empty responses for each question assigned to this participant.\n @questions.each do |question|\n @newresp = Response.new({\n \"checkpoint_user_id\" => @cp_usr_obj.id,\n \"user_id\" => stu.id,\n \"question_id\" => question.id,\n \"response_value\" => Response::EMPTY_RESPONSE_VALUE\n })\n @newresp.save!\n puts \"assigned question: #{@newresp.question.content}\"\n end\n \n # destroy the checkpoint_user if no questions could be assigned to the student.\n # when this happens, the student doesn't need to complete anything.\n if (questions_assigned == 0)\n @cp_usr_obj.destroy\n else\n successful_checkpoints += 1\n end\n puts \" - received #{questions_assigned} questions\"\n end\n\n # notify the user of what happened\n if (successful_checkpoints > 0)\n @checkpoint.distributed = true\n flash[:notice] = \"Thank you! Your checkpoint has been distributed to the participants.\"\n puts \"\\nSuccessful Distribution!\"\n else\n @checkpoint.distributed = false\n flash[:warning] = \"We're sorry, but we didn't have enough information to build checkpoints for these students. <br />\" +\n \"Please try again when the students have attended more events.\"\n puts \"\\nUnable to Assign! Insufficient students, measurements, events, or questions\"\n end\n\n # save the checkpoint to finalize it, and redirect back to the show page\n @checkpoint.save!\n redirect_to :action => 'show', :id => @checkpoint.id\n puts \"\\n[CHECKPOINT DISTRIBUTED]==============================================\" \n end", "def check_completed\n\t\tend", "def generate_check\n Output835.log.info \"\\n\\nCheck number : #{@check.check_number} undergoing processing\"\n transaction_segments =[ transaction_set_header, financial_info, reassociation_trace]\n\n transaction_segments << ref_ev_loop if @facility_output_config.details[:ref_ev_batchid]\n transaction_segments += [reciever_id, date_time_reference, payer_identification_loop,\n payee_identification_loop, reference_identification]\n transaction_segments << claim_loop if !@check.interest_only_check\n transaction_segments << provider_adjustment\n\n\n transaction_segments = transaction_segments.flatten.compact\n @se01[0] = transaction_segments.length + 1 if @se01\n transaction_segments << transaction_set_trailer(transaction_segments.length + 1)\n transaction_segments\n end", "def reset_checks\n @checks_remaining = 3\n end", "def has_checkpoint?(vm_name, checkpoint_name) \n\n if !ENV['UPLF_NO_VAGRANT_CHECKPOINTS'].nil?\n _log.info(\"#{vm_name}: [-] provision checkpoint: #{checkpoint_name} (UPLF_NO_VAGRANT_CHECKPOINTS is set)\")\n \n return false \n end\n \n file_name = \".vagrant/machines/#{vm_name}/virtualbox/.uplift/.checkpoint-#{checkpoint_name}\"\n exists = File.exist?(file_name)\n \n if exists == true \n _log.info_light(\"#{vm_name}: [+] provision checkpoint: #{checkpoint_name}\")\n else \n _log.info(\"#{vm_name}: [-] provision checkpoint: #{checkpoint_name}\")\n end\n \n return exists\n end", "def failed?; failed_to_start? || (@success == false) end", "def perform_action(message, multiline, on_fail_msg, abort_on_fail)\n line = \"#{message}... \"\n endline = \"...#{message} \"\n if multiline\n puts line\n else\n print line\n end\n result = yield\n mark = result ? \"✓\" : \"✗\"\n # if multline, put checkmark at full width\n print endline if multiline\n puts mark.rjust(WIDTH - line.length, \" \")\n unless result\n puts on_fail_msg unless on_fail_msg.nil?\n @failure_count += 1\n # print out error messaging here if we've captured it\n terminate if abort_on_fail\n end\n result\nend", "def before_validate\n self.previous_output :alias => 'PREVOUT' unless self.previous_output\n self.outputs<< output(0) if self.outputs.empty?\n super\n end", "def warn_no_continuations; end", "def check_OLD\n # Check if we are configured to skip all backup checks\n if @backup_skip_all\n incstatus(\"OK\")\n @short=@backup_skip_all\n return\n end\n\n ## Not skipped, we check backups\n @objects=readObjects(\"backup\")\n\n # Create logdir if it doesn't exist\n FileUtils.mkdir_p @log_dir unless File.directory? @log_dir\n\n ## Initialize to OK since we may skip everything\n incstatus(\"OK\")\n\n ## CHECK CODE \n entries=Hash.new\n # Add mount entries\n entries=get_mounts_to_backup(entries) unless @backup_skip_mounts\n entries=get_lvs_to_backup(entries) unless @backup_skip_lvscan\n puts YAML.dump(entries) if @debug\n entries.values.each do |entry|\n check_entry(entry)\n end\n\n # Set Messages if OK and empty messages\n if status == \"OK\" and @short == \"\"\n @short=\"Everything OK\"\n end\n end", "def startup_config_check\n\t\tfw_connect\n\t\t# they are ALL stale right now...\n\t\tcheck_config_freshness\n\t\tpending = get_pending_commits\n\t\tdo_pending_commits(pending) if pending != 0\n\t\tfw_exit\n\tend", "def check_if_round_part_b_ready_to_start\n self.creator_preferences.each do |creator_preference|\n # return false if !creator_preference.is_ready\n return false if !creator_preference.finished_round\n end\n self.donor_preferences.each do |donor_preference|\n return false if !donor_preference.is_ready\n end\n self.part_b_started = true\n self.start_time = DateTime.now\n self.save!\n end", "def exit_if_all_pipelines_passing\n exit 0 if @all_pipelines_passing.values.all? { |passing| passing == true }\nend", "def check_followup fup\n if fup\n if ( fup.current_stage + 1 ).even?\n # OFFx: Trigger only on no signals in candidate beam\n trigger_followup(fup, nil, false) if signal_groups.count == 0 \n else\n # ONx: Trigger on highest confidence valid signal\n confidence = 0\n sig_grp_best = nil\n signal_groups.each do |sig_grp|\n real = sig_grp.is_real? \n if real && ( sig_grp.confidence > confidence )\n sig_grp_best = sig_grp\n confidence = sig_grp.confidence\n end\n end\n trigger_followup( fup, sig_grp_best, true ) if sig_grp_best\n end\n else\n # ON: Trigger on all valid signals\n signal_groups.each do |sig_grp|\n trigger_followup( Followup.new(), sig_grp, true ) if sig_grp.is_real?\n end\n end\n end", "def only_one_ability_at_the_same_time\n unless self.player.trainings.not_finished.count == 0\n self.errors[:base] = I18n.t('training.errors.already_training')\n end\n end", "def set_checkpoint\n #@checkpoint = Checkpoint.find(params[:id])\n @checkpoint = Level.find(params[:level_id]).checkpoints.find(params[:id]) \n end", "def previously_ran?; end", "def previously_ran?; end", "def success?() end", "def run\n # Run all the steps below. Stop as soon as one of them returns\n # false or throws an error.\n true &&\n fetch_internal_date_and_size &&\n check_for_really_old_internal_date &&\n check_for_pre_creation_internal_date &&\n check_for_relapsed_internal_date &&\n check_for_big_messages &&\n fetch_uid_envelope_rfc822 &&\n update_user_mark_email_processed &&\n handle_tracer_email &&\n check_for_duplicate_message_id &&\n check_for_duplicate_sha1 &&\n create_mail_log &&\n deploy_webhook &&\n update_daemon_stats\n ensure\n clean_up\n end", "def timer_checkpoints\n t = self.time_remaining\n if @timer_checkpoint_hash[30] < 3 && t <= 40\n @timer_checkpoint_hash[30] += 1\n tab; \"#{@time_remaining} seconds left.\\n\".typing\n elsif @timer_checkpoint_hash[120] == 0 && t.between?(60, 140)\n @timer_checkpoint_hash[120] += 1\n tab; \"Cutting it close, #{codename}\".typing\n elsif @timer_checkpoint_hash[180] == 0 && t.between?(140, 180)\n @timer_checkpoint_hash[180] += 1\n tab; \"3 minutes. Finish the job.\\n\".typing\n elsif @timer_checkpoint_hash[240] == 0 && t.between?(200, 240)\n @timer_checkpoint_hash[240] += 1\n tab; \"Doing good. 4 minutes left.\\n\".typing\n end\n end", "def skipped?; end", "def skipped?; end", "def skipped?; end", "def skipped?; end", "def print_result_and_exit(success, failmsg, checkpoints, response=nil)\n output_data = {}\n output_data[\"checkpoints\"] = checkpoints\n output_data[\"response\"] = response unless response.nil?\n output_data[\"success\"] = success\n output_data[\"message\"] = failmsg\n puts JSON.pretty_generate(output_data)\n exit(success ? 0 : 1)\nend", "def run_warned; end", "def run\n Precheck.config.load_configuration_file(Precheck.precheckfile_name)\n\n FastlaneCore::PrintTable.print_values(config: Precheck.config,\n hide_keys: [:output_path],\n title: \"Summary for precheck #{Fastlane::VERSION}\")\n\n unless Spaceship::Tunes.client\n UI.message(\"Starting login with user '#{Precheck.config[:username]}'\")\n Spaceship::Tunes.login(Precheck.config[:username])\n Spaceship::Tunes.select_team\n\n UI.message(\"Successfully logged in\")\n end\n\n UI.message(\"Checking app for precheck rule violations\")\n\n ensure_app_exists!\n\n processor_result = check_for_rule_violations(app: app, app_version: latest_app_version)\n\n if processor_result.items_not_checked?\n print_items_not_checked(processor_result: processor_result)\n end\n\n if processor_result.has_errors_or_warnings?\n summary_table = build_potential_problems_table(processor_result: processor_result)\n puts(summary_table)\n end\n\n if processor_result.should_trigger_user_error?\n UI.user_error!(\"precheck 👮‍♀️ 👮 found one or more potential problems that must be addressed before submitting to review\")\n return false\n end\n\n if processor_result.has_errors_or_warnings?\n UI.important(\"precheck 👮‍♀️ 👮 found one or more potential metadata problems, but this won't prevent fastlane from completing 👍\".yellow)\n end\n\n if !processor_result.has_errors_or_warnings? && !processor_result.items_not_checked?\n UI.message(\"precheck 👮‍♀️ 👮 finished without detecting any potential problems 🛫\".green)\n end\n\n return true\n end", "def wrap_if check, msg, &block\n if check\n self.wrap msg, &block\n else\n self.step msg + ' - skipping'\n end\n end", "def validate_step\n\n r = fetch_eth_ost_balance(true)\n return r unless r.success?\n\n r = super\n return r unless r.success?\n\n if is_client_step_one_complete? && is_client_step_two_complete?\n\n success\n\n elsif is_client_step_one_complete?\n error_with_go_to(\n 'e_tss_sth_1',\n 'token_setup_not_complete',\n GlobalConstant::GoTo.economy_planner_step_two\n )\n else\n error_with_go_to(\n 'e_tss_sth_2',\n 'token_setup_not_complete',\n GlobalConstant::GoTo.economy_planner_step_one\n )\n end\n\n end", "def step_check_fixes(step,\n target,\n listoffixes)\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')\n #\n mine_this_step_hash = mine_this_step(step, target)\n packaging_date_of_fixes = {}\n if mine_this_step_hash[false].nil?\n Log.log_debug('Doing mine_this_step (target=' + target +\n ') checking now prerequisites for this listoffixes')\n # Check level prereq\n common_efixes_dirname = get_flrtvc_name(:common_efixes)\n listofkeptfixes = []\n #\n efix_ct_for_this_target = 0\n efix_nb_for_this_target = listoffixes.length\n #\n lppminmax_of_fixes_hash = mine_this_step('lppminmax_of_fixes',\n 'all')\n\n @lppminmax_of_fixes = if lppminmax_of_fixes_hash[false].nil?\n {}\n else\n lppminmax_of_fixes_hash[false]\n end\n #\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')' +\n ' Starting with ' + @lppminmax_of_fixes.length.to_s +\n ' lppminmax_of_fixes') if @lppminmax_of_fixes.length > 0\n @lppminmax_of_fixes.each do |lppminmax_of_fix|\n Log.log_debug(' ' + lppminmax_of_fix.to_s)\n end\n #\n listoffixes.each do |fix|\n Log.log_debug('Flrtvc step : ' + step.to_s + ' (target=' + target + ') fix=' + fix)\n efix_ct_for_this_target += 1\n existing_lppminmax_of_fixes = @lppminmax_of_fixes[fix]\n lpps_minmax_of_fix = {}\n if existing_lppminmax_of_fixes.nil? || existing_lppminmax_of_fixes.empty?\n # If not found, we parse the fix to get all lpp, min, max\n # (one fix may contain several lpps)\n lpps_minmax_of_fix = min_max_level_prereq_of(::File.join(common_efixes_dirname,\n fix))\n if !lpps_minmax_of_fix.nil? && !lpps_minmax_of_fix.empty?\n @lppminmax_of_fixes[fix] = lpps_minmax_of_fix\n end\n else\n Log.log_debug(' Existing lppminmax_of_fixes=' +\n existing_lppminmax_of_fixes.to_s)\n # If found, we take the already found values\n lpps_minmax_of_fix = existing_lppminmax_of_fixes\n end\n #\n # Then we check against the lpp level of this target\n kept_fix_for_this_target = true\n unless lpps_minmax_of_fix.empty?\n lpps_minmax_of_fix.keys.each do |lpp|\n (min, max) = lpps_minmax_of_fix[lpp]\n if level_prereq_ok?(target, lpp, min, max)\n else\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')' +\n ' fix=' + fix +\n ' (' + efix_ct_for_this_target.to_s + '/' +\n efix_nb_for_this_target.to_s + ') cannot be applied.')\n kept_fix_for_this_target = false\n break\n end\n end\n end\n #\n next unless kept_fix_for_this_target\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')' +\n ' fix=' + fix +\n ' (' + efix_ct_for_this_target.to_s + '/' +\n efix_nb_for_this_target.to_s + ') can be applied.')\n listofkeptfixes << fix\n end\n #\n Log.log_info('Flrtvc step : ' + listofkeptfixes.length.to_s + ' ' + step.to_s + ' (target=' + target + ')')\n listofkeptfixes.each do |keptfix|\n Log.log_info(' ' + keptfix)\n end\n #\n # persist to yaml the matching between fixes/lpp/min&max\n lppminmax_of_fixes_yml_file = get_flrtvc_name(:YML,\n 'all',\n 'lppminmax_of_fixes')\n Log.log_debug(' Persisting into ' +\n lppminmax_of_fixes_yml_file +\n ' @lppminmax_of_fixes.length=' +\n @lppminmax_of_fixes.length.to_s)\n File.write(lppminmax_of_fixes_yml_file, @lppminmax_of_fixes.to_yaml)\n #\n # Sort the fixes by packaging date\n Log.log_info(' Into step_check_fixes (target=' + target +\n ') Sort the fixes by packaging date')\n listofkeptfixes.each do |keptfix|\n packaging_date = packaging_date_of(::File.join(common_efixes_dirname,\n keptfix))\n packaging_date_of_fixes[packaging_date] = keptfix\n end\n packaging_date_of_fixes = packaging_date_of_fixes.sort.to_h\n packaging_date_of_fixes = packaging_date_of_fixes.sort.reverse.to_h\n #\n # persist to yaml match between fix and packaging date\n target_yml_file = get_flrtvc_name(:YML, target, step)\n File.write(target_yml_file, packaging_date_of_fixes.to_yaml)\n else\n Log.log_debug('NOT Doing mine_this_step for target=' +\n target +\n ' step=' +\n step.to_s)\n packaging_date_of_fixes = mine_this_step_hash[false]\n packaging_date_of_fixes = packaging_date_of_fixes.sort.to_h\n packaging_date_of_fixes = packaging_date_of_fixes.sort.reverse.to_h\n end\n #\n Log.log_debug('Flrtvc step : ' + packaging_date_of_fixes.length.to_s + ' ' + step.to_s + ' (target=' + target + ')')\n packaging_date_of_fixes.each do |packaging_date_of_fix|\n Log.log_debug(' packaging_date_of_fix=' +\n packaging_date_of_fix.to_s)\n end\n packaging_date_of_fixes\n end", "def checkpoint()\n @checkpoints << self.pos\n return self\n end", "def check_multiple_data(data:, warn_msg:, ok_msg:)\n if data\n warn_msg(warn_msg)\n else\n ok_msg(ok_msg)\n end\n end", "def check_target(target) \n # Default warning_limit\n warning_limit=@warning_limit\n # Default critical_limit\n critical_limit=@critical_limit\n # Default nobackup_status\n nobackup_status=@nobackup_status\n\n puts \"Checking target: #{target}\" if @verbose\n\n if @objects.has_key?(target)\n # Return if target marked as skip\n return if @objects[target].has_key?(:skip)\n\n # Set target limits if given\n warning_limit=@objects[target][:warning_limit] if @objects[target].has_key? :warning_limit\n puts \" warning_limit for #{target} is #{warning_limit}\" if @debug\n critical_limit=@objects[target][:critical_limit] if @objects[target].has_key? :critical_limit\n puts \" critical_limit for #{target} is #{critical_limit}\" if @debug\n nobackup_status=@objects[target][:nobackup_status] if @objects[target].has_key? :nobackup_status\n puts \" nobackup_status for #{target} is #{nobackup_status}\" if @debug\n end\n # Check backup age\n check_time=Time.now\n last_backup=current_mirror(target)\n if last_backup\n if check_time < last_backup + warning_limit.to_i\n incstatus(\"OK\")\n elsif check_time >= last_backup + warning_limit.to_i and check_time < last_backup + critical_limit.to_i\n @short+=\"#{target} OLD, \"\n @long+=\"#{target} is too OLD\\n\"\n incstatus(\"WARNING\")\n elsif check_time >= last_backup + critical_limit.to_i\n @short+=\"#{target} OLD, \"\n @long+=\"#{target} is too OLD\\n\"\n incstatus(\"CRITICAL\")\n end\n else\n @short+=\"no backups for #{target}, \"\n @long+=\"No backups found for target #{target}\\n\"\n incstatus(nobackup_status)\n end\n end", "def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end", "def check_dat(val, nice, noway)\n unless val\n system(\"echo '\\n\\033[31m----- Tests Failed -----\\033[0m\\n'\")\n system(\"echo \\\"#{noway.sample}\\\" | lolcat\")\n puts ''\n exit(1)\n end\n system(\"echo '\\n\\033[32m----- Tests OK -----\\033[0m\\n'\")\n system(\"echo \\\"Et Jésus déclara: #{nice.sample}\\\" | lolcat\")\n puts ''\n exit(0)\nend", "def success?; terminal_flag == :success end", "def success?; terminal_flag == :success end", "def call_check_multi\n\t\t\t\t$log.debug \"calling: #{$plugin_path}/check_multi -s libexec=#{$plugin_path} -s WARN=#{$warning} -s CRIT=#{$critical} #{$multi_opts} -t 20 -f #{$config_path}/#{@host}_disks.cfg\"\n\t\t\t\tdata = `#{$plugin_path}/check_multi -s libexec=#{$plugin_path} -s WARN=#{$warning} -s CRIT=#{$critical} #{$multi_opts} -t 20 -f #{$config_path}/#{@host}_disks.cfg`\n\t\t\t\t$status = $? >> 8\n\t\t\t\t$log.debug \"return code of check_multi was #{$status}\"\n\t\t\t\treturn data.gsub(\"\\n\", \"<br />\") if $html == true\n\t\t\t\treturn data if $html == false\n\t\tend", "def succeeded?; state == 'succeeded'; end", "def succeeded?; state == 'succeeded'; end", "def reset_checks\n @checks_used = 0\n puts \"Checks used: #{@checks_used}\"\n end", "def assert_consistent test\n test.flunk unless state == A or state == Enter\n end", "def reset_checks\n @counter = 0\n end", "def perform_checks\n # tests & checks are only meaningful if the input can be varied\n return unless @input_can_change\n @checks.each_with_index do |check, i|\n output, time, error = run_with_benchmark(check[:input])\n @checks[i].merge!({ output: output, time: time, error: error })\n end\n @checks\n end", "def check_config\n data = merge_yaml_data(@@config_dir)\n @rule_data = merge_yaml_data(@@rule_config_dir)\n actual = make_key_chain(data)\n expect = make_key_chain(@rule_data)\n diff = diff_arr(expect, actual)\n make_message(diff)\n end", "def wrap_if! check, msg, &block\n if check\n self.wrap! msg, &block\n else\n self.step msg + ' - skipping'\n end\n end", "def ready?; peek_current_state && (peek_current_state != :PRE_OPERATIONAL) end", "def test_check_bad_prev_hash\n assert_raises SystemExit do\n assert_output 'Line 1: Previous hash was 1, should be 0\\nBLOCKCHAIN INVALID' do\n p_hash = '0'\n line_num = '1'\n block_p_hash = ['1']\n hash = '1'\n @verify.check_prev_hash(p_hash, block_p_hash, hash, line_num)\n end\n end\n end", "def task_check_error\n # nochannel job failure should not result in any state changes\n return if is_nochannel?\n\n policies = Push::Policy.policies_for_errata(errata, {:mandatory => true}).select(&:push_applicable?)\n push_jobs = policies.map(&:push_job_since_last_push_ready).compact\n\n # nochannel jobs never count toward whether advisory push is considered\n # to have failed\n push_jobs.reject!(&:is_nochannel?)\n\n failed_jobs = push_jobs.select(&:failed?)\n active_jobs = push_jobs.select(&:in_progress?)\n\n # Move the status of errata to PUSH_READY if:\n # - no more active push jobs are running\n # - and there is at least one failed push job.\n if active_jobs.empty? && failed_jobs.any?\n comment = \"Mandatory push job(s) have failed: #{failed_jobs.map(&:id).join(', ')}\"\n error comment\n move_advisory_to_push_ready(comment)\n end\n end", "def after_save_user\n if self.opml_import_job_state.blank?\n self.create_opml_import_job_state state: OpmlImportJobState::NONE\n Rails.logger.debug \"User #{self.email} has no OpmlImportJobState, creating one with state NONE\"\n end\n\n if self.opml_export_job_state.blank?\n self.create_opml_export_job_state state: OpmlExportJobState::NONE\n Rails.logger.debug \"User #{self.email} has no OpmlExportJobState, creating one with state NONE\"\n end\n\n if saved_change_to_quick_reading? || saved_change_to_open_all_entries? ||\n saved_change_to_show_main_tour? || saved_change_to_show_mobile_tour? ||\n saved_change_to_show_feed_tour? || saved_change_to_show_entry_tour? ||\n saved_change_to_show_kb_shortcuts_tour? || saved_change_to_kb_shortcuts_enabled?\n update_column :config_updated_at, Time.zone.now\n end\n end", "def done?\n\t\treturn @num_valid == @max_block\n\tend", "def at_least_one_indicator_target_exist \n #when not even 1 set exist(indicator_desc+target+achievement+progress )\n if half==2 && (indicator_desc_quality.blank? && target_quality.blank? && achievement_quality.blank? && progress_quality.blank?) && (indicator_desc_time.blank? && target_time.blank? && achievement_time.blank? && progress_time.blank?) && (indicator_desc_quantity.blank? && target_quantity.blank? && achievement_quantity.blank? && progress_quantity.blank?) && (indicator_desc_cost.blank? && target_cost.blank? && achievement_cost.blank? && progress_cost.blank?)\n return false \n errors.add(\"aa\",\"error la\")\n# elsif id.nil? && half==2 \n# \n# #when user selected 'Sent to PPP for Report' - with INCOMPLETE NEWly inserted xtvt(not yet saved) - (render fields although record not yet saved due to errors)\n# #RESTRICTIONS : requires 'Target fields' to be completed for repeating fields to be rendered when error occurs\n# if ( !indicator_desc_quality.blank? && !target_quality.blank? && !achievement_quality.blank? && !progress_quality.blank?)\n# return true\n# else\n# return false\n# end\n# if ( !indicator_desc_time.blank? && !target_time.blank? && !achievement_time.blank? && !progress_time.blank?)\n# return true\n# else\n# return false\n# end\n# if ( !indicator_desc_quantity.blank? && !target_quantity.blank? && !achievement_quantity.blank? && progress_quantity.blank?)\n# return true\n# else\n# return false\n# end\n# if ( !indicator_desc_cost.blank? && !target_cost.blank? && !achievement_cost.blank? && !progress_cost.blank?)\n# return true\n# else\n# return false\n# end\n\n elsif half==1 && (indicator_desc_quality.blank? && target_quality.blank?) && (indicator_desc_time.blank? && target_time.blank?) && (indicator_desc_quantity.blank? && target_quantity.blank?) && (indicator_desc_cost.blank? && target_cost.blank?)\n return false\n end\n end", "def pbBikeCheck\n if $PokemonGlobal.surfing ||\n (!$PokemonGlobal.bicycle && pbGetTerrainTag==PBTerrain::TallGrass)\n Kernel.pbMessage(_INTL(\"Can't use that here.\"))\n return false\n end\n# if $game_player.pbHasDependentEvents?\n# Kernel.pbMessage(_INTL(\"It can't be used when you have someone with you.\"))\n# return false\n# end\n if $PokemonGlobal.bicycle\n if pbGetMetadata($game_map.map_id,MetadataBicycleAlways)\n Kernel.pbMessage(_INTL(\"You can't dismount your Bike here.\"))\n return false\n end\n return true\n else\n val=pbGetMetadata($game_map.map_id,MetadataBicycle)\n val=pbGetMetadata($game_map.map_id,MetadataOutdoor) if val==nil\n if !val\n Kernel.pbMessage(_INTL(\"Can't use that here.\"))\n return false\n end\n return true\n end\nend", "def pbAllFainted\n return $Trainer.ablePokemonCount==0\nend", "def check_for_implication_loops\n # actually this is tricky\n end", "def finish_step?\n return !goto_true && !goto_false\n end", "def acked?; all_status?(:ack); end", "def check!\n check\n save\n end", "def process checkup\n ##\n # => Load seed.\n #\n begin\n rescue Exception => e\n \tServices::Slog.exception e\n end\n \n ## this should be simpler!!!\n begin\n \ti = 0\n \t#AgentMapping.where(:agent_id => id).each do |mapping|\n \t\t#Integration.where(:id => mapping.integration_id).each do |integration|\n self.integrations.each do |integration|\n \t\t\tintegration.templates.each do |t|\n \t\t\t\tServices::Slog.debug({:message => \"Sending #{identifier} for delivery by #{t.identifier}\", :module => \"Agent\", :task => \"process\", :extra => {:agent => identifier, :template => t.identifier, :payload => checkup[:payload].to_s, :destination => \"#{ENV[\"APP_HOST\"]}postman/deliver/#{t.identifier}.js\"}})\n \t\t\t\tcheckup[:payload].each do |payload|\n \t\t\t\t\tresponse = RestClient.post \"#{ENV[\"APP_HOST\"]}postman/deliver/#{t.identifier}.js\", payload\n \t\t\t\t\tcase response.code\n \t\t\t\t\twhen 200\n \t\t\t\t\t\ti = i + 1\n \t\t\t\t\t\t@event = Event.new({:payload => payload, :status => 100, :agent => self})\n \t\t\t\t\t\t@event.save\n \t\t\t\t\telse\n \t\t\t\t\t\tServices::Slog.warn({:message => \"Delivery failed for #{identifier} in #{t.identifier}\", :module => \"Agent\", :task => \"process\", :extra => {:agent => identifier, :template => t.identifier}})\n \t\t\t\t\tend \n \t\t\t\tend\n \t\t\tend\n \t\t#end\n \tend\n \tRestClient.post(\"#{ENV[\"APP_HOST\"]}fluxcapacitor/agents/#{id}/update_meta\", {:events_count => events_count + i, :last_check_at => Time.now}) if i > 1\n rescue Exception => e\n \tServices::Slog.exception e\n end\n \nend", "def check_down=(_arg0); end", "def precheck\n if !BinarySolo.dir_valid?\n puts \"this is not a binary_solo directoy => better run $ binarysolo init\".colorize(:red)\n false\n elsif !BinarySolo.config_valid?\n puts \"your config is invalid - but I dont have any details for you (yet)\".colorize(:red)\n false\n else\n true\n end\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 continue; end", "def continue; end", "def next_preprocessing(save = false)\n first = first_preprocessing(save) or return nil\n @@PREPROCESSING_TASKS[@@PREPROCESSING_TASKS.index(first)..-1].find do |t|\n if ignore_task? t\n false\n elsif add_result(t, save).nil?\n if (metadata[\"_try_#{t}\"] || 0) > (project.metadata[:max_try] || 10)\n inactivate! \"Too many errors in step #{t}\"\n false\n else\n true\n end\n end\n end\n end", "def print_check\n @five_s = \"#{@stamp2} piecu centu markas\"\n @three_s = \"#{@stamp1} trīs centu markas\"\n if @stamp2 == '1' || @stamp2.end_with?('1') && !@stamp2.end_with?('11')\n @five_s = \"#{@stamp2} piecu centu marka\"\n end\n if @stamp1 == '1' || @stamp1.end_with?('1') && !@stamp1.end_with?('11')\n @three_s = \"#{@stamp1} trīs centu marka\"\n end\n end" ]
[ "0.6073494", "0.6037517", "0.5995766", "0.57341397", "0.56962556", "0.56442785", "0.55990016", "0.5571417", "0.55065423", "0.54880387", "0.5450922", "0.5434581", "0.53777516", "0.5346586", "0.53455484", "0.53273976", "0.53257525", "0.53257525", "0.53256047", "0.53194064", "0.53143847", "0.52954507", "0.5293968", "0.5293968", "0.5292591", "0.52763516", "0.5263979", "0.52590656", "0.5258861", "0.5246063", "0.523464", "0.52320504", "0.5225782", "0.52056557", "0.5199919", "0.51990443", "0.51940453", "0.5189089", "0.5180268", "0.51712304", "0.516771", "0.51611775", "0.51606435", "0.5156221", "0.51517737", "0.51434916", "0.51318777", "0.51317084", "0.5128256", "0.51281697", "0.5127989", "0.5127989", "0.51101613", "0.51003635", "0.50863606", "0.50784653", "0.50784653", "0.50784653", "0.50784653", "0.507842", "0.5067179", "0.5064395", "0.50595784", "0.50484633", "0.50481975", "0.5047057", "0.50445926", "0.50440705", "0.5042394", "0.5029573", "0.5022519", "0.5022519", "0.5021423", "0.5019446", "0.5019446", "0.50148344", "0.50106984", "0.5008169", "0.5001896", "0.4999522", "0.49990565", "0.4997422", "0.49929458", "0.49901915", "0.49858764", "0.4985817", "0.49817896", "0.4977686", "0.49770784", "0.4971787", "0.4969437", "0.4961742", "0.49610117", "0.4959877", "0.4959851", "0.49577415", "0.49574333", "0.49560013", "0.49560013", "0.49543753", "0.49423558" ]
0.0
-1
update database with latest Marvel releases
def update_marvel(date) release_date = date publisher = Publisher.find_or_create_by_name("Marvel") while release_date <= date + 4.months do log("retrieving marvel data for #{release_date.strftime('%Y-%m-%d')}") doc = Hpricot(open("#{URL_Marvel}/catalog/?date=#{release_date.strftime('%Y-%m-%d')}")) books = (doc/"a[@class=title_link]") books = books.each { |book| fetch_title_marvel(publisher, book.innerHTML.strip, "#{URL_Marvel}#{book.attributes['href']}", release_date) } release_date += 1.week end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @repo.reset_hard\n @repo.pull_rebase\n log << \"Database updated. Now at: #{version}\"\n end", "def update_db\n require \"#{File.dirname(__FILE__)}/../conf/db_schema.rb\"\n Knj::Db::Revision.new.init_db(\"debug\" => false, \"db\" => @db, \"schema\" => Openall_time_applet::DB_SCHEMA)\n end", "def upgrade(version)\n \n end", "def update_db\n ## Sequel\n drop_table\n create_table\n db.transaction do\n table.delete_sql\n install_manual\n install_updates\n end\n ## AR\n # self.transaction do\n # self.delete_all\n # self.install_manual\n # self.install_updates\n # end\n end", "def add_latest_data\n @db = Macroval.find_year_month(2010..2020)\n end", "def add_release_version( dbh, rlsid, pkgid )\n #puts \"Deleting existing entry: DELETE FROM package_version_releases WHERE release_id = '#{rlsid}' AND package_version_id = '#{pkgid}'\"\n dbh.query( \"DELETE FROM package_version_releases WHERE release_id = '#{rlsid}' AND package_version_id = '#{pkgid}'\" )\n #puts \"Adding new entry with: INSERT INTO package_version_releases(release_id, package_version_id) VALUES( '#{rlsid}', '#{pkgid}')\"\n dbh.query( \"INSERT INTO package_version_releases(release_id, package_version_id) VALUES( '#{rlsid}', '#{pkgid}')\" )\nend", "def bump_minor_version; end", "def bump_major_version; end", "def bump_patch_version; end", "def publish_latest_version \n publish_version(latest_version)\n end", "def auto_minor_version_upgrade\n data[:auto_minor_version_upgrade]\n end", "def auto_minor_version_upgrade\n data[:auto_minor_version_upgrade]\n end", "def update_version\n if (VersionControl.any?) \n obj = VersionControl.all.first\n else\n obj = VersionControl.create(version: 3.0)\n end\n\n obj.version += 0.1\n obj.save\n end", "def check_db_version(full_account_log_file)\n # this will check to see what user_version of the acounting sqlite database that is now present\n # if it detects an older version it will upgrade it to the new version\n if !File.exist?(full_account_log_file)\n return\n end\n puts \"acc_log #{full_account_log_file}\"\n db = SQLite3::Database.open full_account_log_file\n result = db.execute(\"PRAGMA user_version;\")\n #puts \"#{result[0][0]}\"\n if result[0][0] == 0\n puts \"old version of account db detected will upgrade to version 1 from 0\" \n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Chip_Mult REAL;\") \n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Stellar TEXT;\")\n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Audio TEXT;\")\n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Loop_Time INT;\")\n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Mode INT;\")\n result = db.execute(\"UPDATE Configs SET Chip_Mult = '1'\")\n result = db.execute(\"UPDATE Configs SET Stellar = 'Enable'\")\n result = db.execute(\"UPDATE Configs SET Audio = 'Disable'\")\n result = db.execute(\"UPDATE Configs SET Loop_Time = '2'\")\n result = db.execute(\"UPDATE Configs SET Mode = 'Standard'\")\n result = db.execute(\"PRAGMA user_version = 1;\") \n else\n puts \"new accounting version checked ok with version #{result[0][0]}\"\n #result = db.execute(\"PRAGMA user_version = '0';\")\n end\nend", "def update\n @dbman.update\n end", "def releases\n repo.releases(changelog.changes)\n end", "def new_version\n @version = Time.now.to_i\n end", "def set_version\n self.version ||= latest_version + 1\n end", "def migrate version = nil\n if @migrations\n schema = meta_schema\n version = __check_migration_version(version)\n __create_meta_data_table_for(schema)\n\n s = schema.first || schema.new(version: 0)\n unless s.version == version\n @migrations.sort_by { |migration| migration.version }.each do |m|\n m.migrate(:up) if s.version < m.version and m.version <= version\n\n if s.version >= m.version and m.version > version\n m.migrate(:down)\n else # Handle migrate(0)\n m.migrate(:down) if s.version >= m.version and version.zero?\n end\n end\n s.update_attribute :version, version\n end\n version = s.version\n end\n version\n end", "def add_version(version); GuidesGenerator::Migrator::migrated_versions.push(version); version end", "def db_insert_releases(db, org, repo, releases)\n db.transaction do\n releases.each do |release|\n db[\n \"DELETE FROM releases WHERE org=? AND repo=? AND id::int=?\", org, repo, release.id].delete\n\n # Sometimes there is no author. Instead, fill in the data with the first file's uploader\n if(release.author)\n author=release.author.login\n else\n if(release.assets and release.assets[0] and release.assets[0].uploader)\n author=release.assets[0].uploader.login\n # puts \"Unable to find an author for #{release.html_url}; using uploader: #{author}\"\n else\n author=nil\n # puts \"Unable to find an author or uploader for #{release.html_url}\"\n end\n end\n\n\t # only include releases that were published\n\t if(release.published_at)\n\t db[\n \t \"INSERT INTO releases (\n\t org, repo, id, html_url, tarball_url, zipball_url, tag_name, name, body, created_at, published_at, author\n\t )\n\t VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\",\n\t org, repo, release.id, release.html_url, release.tarball_url, release.zipball_url, release.tag_name, release.name, release.body, release.created_at.to_s,\n\t release.published_at.to_s, author].insert\n\t end\n end\n end\n end", "def set_schema_version(version)\n ActiveRecord::Base.connection.update(<<-ESQL\n UPDATE #{self.class.schema_info_table_name} \n SET version = #{down? ? version.to_i - 1 : version.to_i} \n WHERE plugin_name = '#{self.current_plugin.name}'\n ESQL\n )\n end", "def auto_update_release_date\n if update_release_date\n self.release_date = default_release_date\n end\n end", "def preview_latest_version\n load_attributes_from_version(latest_version)\n end", "def update_version_method(version)\nend", "def update\n install\n end", "def pre_migrate_database\n old_schema_version = get_schema_version\n new_schema_version = File.read(File.join(source_directory,'db','schema_version')).to_i\n \n return unless old_schema_version > 0\n \n # Are we downgrading?\n if old_schema_version > new_schema_version\n message \"Downgrading schema from #{old_schema_version} to #{new_schema_version}\"\n \n in_directory install_directory do\n unless system(\"rake -s migrate VERSION=#{new_schema_version}\")\n raise InstallFailed, \"Downgrade migrating from #{old_schema_version} to #{new_schema_version} failed.\"\n end\n end\n end\n end", "def db_version=(version)\n Neo4j::Transaction.run do\n migration_meta_node[:_db_version] = version\n end\n end", "def outdated; end", "def update\n push_to_db\n end", "def update\n push_to_db\n end", "def add_last_version_field\n logger.info \"Adding #{name}._last_version audit field...\"\n db.query(\"ALTER TABLE #{audit} ADD `_last_version` BIGINT NULL\") \n end", "def db_version\n migration_meta_node[:_db_version]\n end", "def update() end", "def auto_minor_version_upgradeable?\n @dbi.auto_minor_version_upgrade\n end", "def auto_minor_version_upgradeable?\n @dbi.auto_minor_version_upgrade\n end", "def requires_auto_minor_engine_version_upgrade\n data.requires_auto_minor_engine_version_upgrade\n end", "def update_data_version\n\t\t\t@data_version += 1\n\t\tend", "def target_mysql_version=(_arg0); end", "def update ; end", "def latest_version\n (Release.where(:manifest_id => manifest_id).max(:version) || 0)\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 outdated?; end", "def update_version_to_next\n super\n info \"Current version is now #{extract_version}\"\n Hg.commit File.basename(version_file), message\n Hg.push if Hg.remote\n end", "def update_release(stuff, release, fields)\r\n\trelease.update(fields)\r\nend", "def target_mariadb_version=(_arg0); end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update!(**args)\n @database_version = args[:database_version] if args.key?(:database_version)\n @instance_host = args[:instance_host] if args.key?(:instance_host)\n @sql_engine = args[:sql_engine] if args.key?(:sql_engine)\n end", "def latest_alchemy_version\n versions = get_alchemy_versions\n return \"\" if versions.blank?\n\n # reject any non release version\n versions.reject! { |v| v =~ /[a-z]/ }\n versions.max\n end", "def update\n self.install\n end", "def update\n self.install\n end", "def update\n self.install\n end", "def update!(**args)\n @app_connection = args[:app_connection] if args.key?(:app_connection)\n @recent_mig_vms = args[:recent_mig_vms] if args.key?(:recent_mig_vms)\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 update\n Puppet.debug \"Attempting to upgrade #{@resource[:name]}\"\n install unless mas_app\n mas('upgrade')\n end", "def test_bump_preview_to_release\n value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :preview)\n value_ = value_.bump(:release_type)\n assert_equal(2, value_.major)\n assert_equal(0, value_.minor)\n assert_equal(1, value_.tiny)\n assert_equal(0, value_.tiny2)\n assert_equal(:final, value_.release_type)\n assert_equal(0, value_.patchlevel)\n assert_equal(0, value_.patchlevel_minor)\n end", "def latest_version\n self.versions.order(\"revision_date DESC\").first\n end", "def update!(**args)\n @version = args[:version] if args.key?(:version)\n end", "def new_version\n %w(major minor patch).each do |level|\n changes = git_changelog.select(&\"#{level}?\".to_sym)\n return [ last_release.send(\"#{level}!\"), changes ] if changes.size > 0\n end\n raise \"No commit since last release (#{last_release})\"\n end", "def release\n \n latest_release = Checklist.latest_release\n\n self.minor_rev_number = 0\n self.major_rev_number = latest_release.major_rev_number + 1\n self.released = 1\n self.released_on = Time.now\n self.new_design_self_check_count = self.full_review_self_check_count\n self.new_design_peer_check_count = self.full_review_peer_check_count\n self.bareboard_design_self_check_count = self.partial_review_self_check_count\n self.bareboard_design_peer_check_count = self.partial_review_peer_check_count\n\n if self.save\n return 'Checklist successfully released'\n else\n return 'Checklist release failed - Contact DTG.'\n end\n\n end", "def set_new_version\n @saving_version = new_record? || save_version?\n self.send(\"#{self.class.version_column}=\", next_version) if new_record? || (!locking_enabled? && save_version?)\n end", "def target_mysql_version; end", "def upgrade\n project.run \"apk upgrade\"\n end", "def update_db(rss_url, new_source, collection, response, rss_url_nice = rss_url)\n rss = MRSS.parse(response)\n\n begin @dbi.transaction do\n # update source\n if new_source\n @dbi.execute \"INSERT INTO sources (collection, rss, last, title, link, description) VALUES (?, ?, ?, ?, ?, ?)\",\n collection, rss_url, response['Last-Modified'], rss.title, rss.link, rss.description\n info rss_url_nice + \"Added as source\"\n else\n @dbi.execute \"UPDATE sources SET last=?, title=?, link=?, description=? WHERE collection=? AND rss=?\",\n response['Last-Modified'], rss.title, rss.link, rss.description, collection, rss_url\n debug rss_url_nice + \"Source updated\"\n end\n\n # update items\n items_new, items_updated = 0, 0\n rss.items.each { |item|\n description = item.description\n\n # Link mangling\n begin\n link = URI::join((rss.link.to_s == '') ? URI.parse(rss_url).to_s : rss.link.to_s, item.link || rss.link).to_s\n rescue URI::Error\n link = item.link\n end\n\n # Push into database\n db_title, = *@dbi.execute(\"SELECT title FROM items WHERE rss=? AND link=?\", rss_url, link).fetch\n\n if db_title.nil? || db_title.empty? # item is new\n begin\n @dbi.execute \"INSERT INTO items (rss, title, link, date, description) VALUES (?, ?, ?, ?, ?)\",\n rss_url, item.title, link, item.date.to_s, description\n items_new += 1\n #rescue DBI::ProgrammingError\n # puts description\n # puts \"#{$!.class}: #{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n end\n else\n @dbi.execute \"UPDATE items SET title=?, description=?, date=? WHERE rss=? AND link=?\",\n item.title, description, item.date.to_s, rss_url, link\n items_updated += 1\n end\n\n # Remove all enclosures\n @dbi.execute \"DELETE FROM enclosures WHERE rss=? AND link=?\", rss_url, link\n\n # Re-add all enclosures\n item.enclosures.each do |enclosure|\n href = URI::join((rss.link.to_s == '') ? link.to_s : rss.link.to_s, enclosure['href']).to_s\n @dbi.execute \"INSERT INTO enclosures (rss, link, href, mime, title, length) VALUES (?, ?, ?, ?, ?, ?)\",\n rss_url, link, href, enclosure['type'], enclosure['title'],\n !enclosure['length'] || enclosure['length'].empty? ? 0 : enclosure['length']\n end\n }\n info rss_url_nice + \"#{ items_new } new items, #{ items_updated } updated\"\n end; end\n end", "def update_db\n\n db = Sequel.sqlite(dbfilename)\n @db_update_data.each do |key,value|\n md5sum = {:md5sum => key}\n file_tupel = md5sum.merge(value)\n db[:pdfmd_documents].insert_conflict(:replace).insert(file_tupel)\n end\n\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update_database!\n ActiveRecord::Base.transaction do\n org = Org.create!(\n admin: @user,\n name: new_org_name,\n handle: orgname,\n singular: true,\n state: \"complete\",\n )\n\n @user.update!(org: org)\n raw_update_user_baseline_charges!(@user, @user_api)\n end\n end", "def bump_minor\n @minor += 1\n @patch = 0\n self.save\n end", "def release_version!\n projects.each { |project| project.release_version!(tag_full_name) }\n print_log 'Versions released'\n slack_notifier.ping(release_message, icon_emoji: ':see_no_evil:')\n end", "def bump_minor_version()\n Juwelier::Commands::Version::BumpMinor.build_for(self).run\n end", "def update_version( result )\n self.id = result['id'].gsub(/\\A_design\\//, '')\n self.rev = result['rev']\n end", "def updateVersion\n # We add 1 because the next commit is probably one more - though this is a race\n commits = %x[git log #{$0} | grep '^commit ' | wc -l].to_i + 1\n vers = \"1.%0.3d\" % commits\n\n t = File.read($0)\n t.gsub!(/^MYVERSION = '(.*)'$/, \"MYVERSION = '#{vers}'\")\n bak = $0+'.bak'\n File.open(bak,'w') { |f| f.puts t }\n perm = File.stat($0).mode & 0xfff\n File.rename(bak,$0)\n File.chmod(perm,$0)\n exit\nend", "def register\n session.call \"INSERT INTO rom.migrations (version)\" \\\n \" VALUES ('#{version}');\"\n end", "def save(bump=false)\n now = Time.now\n\n if exists?\n if bump\n # archive current version\n h = self.values.dup \n h.delete(:id)\n history = self.class.new(h)\n history.archive = id\n history.save\n end\n else\n self.created = now\n end\n\n if bump\n self.version = version.to_i + 1\n end\n\n self.modified = now\n\n super()\n end", "def migrate(version = nil)\n pending = ->(_) { File.pending.map(&:version).include?(_) }\n migrated = ->(_) { File.migrated.map(&:version).include?(_) }\n\n case version\n when nil\n files = File.pending\n Migrate::Up.new(files).perform\n\n when pending\n files = File.pending.select { |f| f.version <= version }\n Migrate::Up.new(files).perform\n\n when migrated\n files = File.migrated.select { |f| f.version > version }.reverse\n Migrate::Down.new(files).perform\n\n else\n out.puts(\"Invalid Version: #{version} does not exist.\")\n end\n end", "def test_bump_alpha_to_beta\n value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :alpha)\n value_ = value_.bump(:release_type)\n assert_equal(2, value_.major)\n assert_equal(0, value_.minor)\n assert_equal(1, value_.tiny)\n assert_equal(0, value_.tiny2)\n assert_equal(:beta, value_.release_type)\n assert_equal(1, value_.beta_version)\n assert_equal(0, value_.beta_minor)\n end", "def is_latest_version?\n current_relation.version == version\n end", "def upgrade\n self.field('Upgrade')\n end", "def updates\n display \"Populating updates...\"\n TrelloStandup::Trello.generate_updates\n display \"Completed.\"\n end", "def update_cache(lastupdate)\n client = TheTvDbParty::Client.new(ENV['TVDB_API_KEY'])\n timeDelta = (Time.new()-lastupdate).to_i\n timeframe = \"day\"\n if timeDelta>86400\n timeframe = \"week\"\n if timeDelta>604800\n timeframe = \"month\"\n if timeDelta>2592000\n timeframe = \"all\"\n end\n end\n end\n update = client.get_updates_by_timeframe(timeframe)\n subscribedSeries = Array.new\n SeriesSubscription.all.group(:seriesid).find_each do |series|\n subscribedSeries.push(series.seriesid)\n end\n seriesToUpdate = Array.new\n # Look at the edited series and add them to our update list\n for series in update.series\n if(series[:updatetime].to_i>lastupdate && subscribedSeries.index(series[:seriesid].to_i).nil? == false)\n seriesToUpdate.push(series[:seriesid])\n end\n end\n if(update.episodes.nil? == false )\n # Look at the edited episodes and determine if we should update their series\n for episode in update.episodes\n if(episode[:updatetime].to_i>lastupdate && subscribedSeries.index(episode[:seriesid].to_i).nil? == false && seriesToUpdate.index(episode[:seriesid]).nil? == true)\n seriesToUpdate.push(episode[:seriesid])\n end\n end\n end\n\n for seriesid in seriesToUpdate\n # Get information about the show\n full_record = client.get_series_all(seriesid).full_series_record\n seriesInformation = SeriesInformation.find_by seriesid: seriesid\n if(seriesInformation.nil?)\n seriesInformation = new_series_information_from_series_record(full_record)\n end\n changed = false\n if(seriesInformation.seriesname != full_record.seriesname)\n seriesInformation.seriesname = full_record.seriesname\n changed = true\n end\n if(seriesInformation.overview != full_record.overview)\n seriesInformation.overview = full_record.overview\n changed = true\n end\n if(seriesInformation.genres != full_record.genres)\n seriesInformation.genres = full_record.genres\n changed = true\n end\n if(changed)\n seriesInformation.save\n end\n # Remove all episodes we have about the show\n EpisodeInformation.where(seriesid: seriesid).destroy_all\n \n # Go through the data and add in new episodes\n for j in 1..(full_record.episodes.length)\n if(full_record.episodes[full_record.episodes.length-j].firstaired)\n if(full_record.episodes[full_record.episodes.length-j].firstaired > Date.today.prev_day)\n # If we find an episode which hasn't aired yet, or airs today, add it to the list.\n new_episode_information_from_episode_record(full_record.episodes[full_record.episodes.length-j])\n else\n # As we go backwards through the episodes array we can break on the first episode which has already aired\n break\n end\n end\n end\n end\n end", "def minor_version; end", "def launch_get_db\n name = params[:name]\n version = params[:version]\n Thread.new do\n require 'miga/cli'\n\n # Get current registered version\n project = Project.find_by(path: name)\n if project && project.miga\n project.miga.metadata[:release] =\n \"#{project.miga.metadata[:release]} (currently updating)\"\n project.miga.save\n end\n\n # Download\n error =\n MiGA::Cli.new([\n 'get_db', '-n', name, '--db-version', version,\n '--local-dir', Settings.miga_projects, '--no-progress'\n ]).launch\n raise(error) if error.is_a? Exception\n\n # Register in the database\n project ||= current_user.projects.create(path: name)\n project.update(reference: true)\n f = File.join(Settings.miga_projects, \"#{name}_#{version}.tar.gz\")\n File.unlink(f) if File.exist? f\n ActiveRecord::Base.connection.close\n end\n\n sleep(10) # <- Hopefully this is enough to start the download\n flash[:success] = 'Downloading database in the background'\n redirect_to get_db_path\n end", "def update!(**args)\n @deprecated_version = args[:deprecated_version] if args.key?(:deprecated_version)\n @mid = args[:mid] if args.key?(:mid)\n end", "def upgrade_version!\n raise \"standard forms should not be versioned\" if is_standard?\n\n if current_version\n self.current_version = current_version.upgrade\n else\n self.build_current_version(:form_id => id)\n end\n\n # since we've upgraded, we can lower the upgrade flag\n self.upgrade_needed = false\n\n # reset downloads since we are only interested in downloads of present version\n self.downloads = 0\n\n save(:validate => false)\n end", "def update_version( result ) \n self.id = result['id']\n self.rev = result['rev']\n end", "def version\n '1.5.1.2' # Version number <major>.<minor>.<patch>.<monthly commit>\n end", "def clean_db(prev_versions)\nputs \"CLEAN DB CALLED\"\n if Version.count > prev_versions\n to_remove = Version.count - prev_versions\n puts \"Removing #{to_remove} old versions from database\"\n Version.all(:limit => to_remove, :order => [ :processed.asc ]).each do |old_version|\n old_version.units.all.each do |old_unit|\n #old_unit.images.all.each do |old_image|\n # old_image.destroy\n #end\n old_unit.destroy\n end\n old_version.destroy\n end\n end\n end", "def migration_version\n @migration_version ||= DateTime.now.to_i.to_s(36)\n end", "def patch_version; end", "def update_metadata_from(new_source)\n # update to new version\n @metadata[:version] = new_source.version\n @metadata[:release] = \"1%{?dist}\"\n\n # add changelog entry\n changelog_entry = <<EOS\n* #{Time.now.strftime(\"%a %b %d %Y\")} #{RPM::Spec.current_author} - #{@metadata[:version]}-1\n- Update to version #{new_source.version}\nEOS\n @metadata[:changelog_entries] ||= []\n @metadata[:changelog_entries].unshift changelog_entry.rstrip\n end", "def latest_version\n\t\treturn versions.order(\"number DESC\").last\n\tend" ]
[ "0.7226418", "0.68371224", "0.63962847", "0.6271625", "0.6250466", "0.6135049", "0.6130336", "0.61087954", "0.6043331", "0.60410076", "0.59804314", "0.59804314", "0.5936887", "0.5878966", "0.5860137", "0.5838325", "0.58333063", "0.5807955", "0.5782101", "0.5777962", "0.5762225", "0.574545", "0.5723036", "0.5699578", "0.5683099", "0.56805587", "0.5675745", "0.5666662", "0.5659642", "0.5656547", "0.5656547", "0.5650159", "0.5643584", "0.5637485", "0.5634826", "0.5634826", "0.5632599", "0.5616497", "0.56148076", "0.5577918", "0.55695665", "0.55456126", "0.55444884", "0.55327183", "0.5530119", "0.5525332", "0.55199605", "0.55199605", "0.55199605", "0.55199605", "0.55199605", "0.55199605", "0.55199605", "0.55199605", "0.5519956", "0.55157465", "0.55130327", "0.551289", "0.551289", "0.55086136", "0.5506478", "0.55033296", "0.5485586", "0.5473085", "0.5471617", "0.5470839", "0.5450726", "0.5447754", "0.54348046", "0.54335964", "0.543314", "0.54315376", "0.54307806", "0.54307806", "0.54307806", "0.54301506", "0.54218453", "0.54129446", "0.5405973", "0.5405742", "0.5404162", "0.5399437", "0.5398774", "0.53878784", "0.5372916", "0.5363349", "0.53615415", "0.53584814", "0.53536874", "0.53484637", "0.534338", "0.5342533", "0.5341982", "0.53414124", "0.53391236", "0.533834", "0.5337371", "0.53329295", "0.53295237", "0.53252596" ]
0.57670367
20
update database with latest DC releases
def update_dc(date) release_date = date publisher = Publisher.find_or_create_by_name("DC") while release_date <= date + 4.months do log("retrieving dc data for #{release_date.strftime('%Y%m%d')}") doc = Hpricot(open("#{URL_DC}?dat=#{release_date.strftime('%Y%m%d')}")) books = doc/"a[@href*='\?cm\=']" books = books.each { |book| fetch_title_dc(publisher, book.innerHTML.strip, "#{URL_DC}#{book.attributes['href']}") } release_date += 1.month # dc listings by month end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @repo.reset_hard\n @repo.pull_rebase\n log << \"Database updated. Now at: #{version}\"\n end", "def update_db\n require \"#{File.dirname(__FILE__)}/../conf/db_schema.rb\"\n Knj::Db::Revision.new.init_db(\"debug\" => false, \"db\" => @db, \"schema\" => Openall_time_applet::DB_SCHEMA)\n end", "def add_latest_data\n @db = Macroval.find_year_month(2010..2020)\n end", "def update\n @dbman.update\n end", "def add_release_version( dbh, rlsid, pkgid )\n #puts \"Deleting existing entry: DELETE FROM package_version_releases WHERE release_id = '#{rlsid}' AND package_version_id = '#{pkgid}'\"\n dbh.query( \"DELETE FROM package_version_releases WHERE release_id = '#{rlsid}' AND package_version_id = '#{pkgid}'\" )\n #puts \"Adding new entry with: INSERT INTO package_version_releases(release_id, package_version_id) VALUES( '#{rlsid}', '#{pkgid}')\"\n dbh.query( \"INSERT INTO package_version_releases(release_id, package_version_id) VALUES( '#{rlsid}', '#{pkgid}')\" )\nend", "def check_db_version(full_account_log_file)\n # this will check to see what user_version of the acounting sqlite database that is now present\n # if it detects an older version it will upgrade it to the new version\n if !File.exist?(full_account_log_file)\n return\n end\n puts \"acc_log #{full_account_log_file}\"\n db = SQLite3::Database.open full_account_log_file\n result = db.execute(\"PRAGMA user_version;\")\n #puts \"#{result[0][0]}\"\n if result[0][0] == 0\n puts \"old version of account db detected will upgrade to version 1 from 0\" \n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Chip_Mult REAL;\") \n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Stellar TEXT;\")\n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Audio TEXT;\")\n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Loop_Time INT;\")\n result = db.execute(\"ALTER TABLE Configs ADD COLUMN Mode INT;\")\n result = db.execute(\"UPDATE Configs SET Chip_Mult = '1'\")\n result = db.execute(\"UPDATE Configs SET Stellar = 'Enable'\")\n result = db.execute(\"UPDATE Configs SET Audio = 'Disable'\")\n result = db.execute(\"UPDATE Configs SET Loop_Time = '2'\")\n result = db.execute(\"UPDATE Configs SET Mode = 'Standard'\")\n result = db.execute(\"PRAGMA user_version = 1;\") \n else\n puts \"new accounting version checked ok with version #{result[0][0]}\"\n #result = db.execute(\"PRAGMA user_version = '0';\")\n end\nend", "def update_db\n\n db = Sequel.sqlite(dbfilename)\n @db_update_data.each do |key,value|\n md5sum = {:md5sum => key}\n file_tupel = md5sum.merge(value)\n db[:pdfmd_documents].insert_conflict(:replace).insert(file_tupel)\n end\n\n end", "def update_data_version\n\t\t\t@data_version += 1\n\t\tend", "def publish_latest_version \n publish_version(latest_version)\n end", "def update_version\n if (VersionControl.any?) \n obj = VersionControl.all.first\n else\n obj = VersionControl.create(version: 3.0)\n end\n\n obj.version += 0.1\n obj.save\n end", "def auto_update_release_date\n if update_release_date\n self.release_date = default_release_date\n end\n end", "def outdated; end", "def update_cache(lastupdate)\n client = TheTvDbParty::Client.new(ENV['TVDB_API_KEY'])\n timeDelta = (Time.new()-lastupdate).to_i\n timeframe = \"day\"\n if timeDelta>86400\n timeframe = \"week\"\n if timeDelta>604800\n timeframe = \"month\"\n if timeDelta>2592000\n timeframe = \"all\"\n end\n end\n end\n update = client.get_updates_by_timeframe(timeframe)\n subscribedSeries = Array.new\n SeriesSubscription.all.group(:seriesid).find_each do |series|\n subscribedSeries.push(series.seriesid)\n end\n seriesToUpdate = Array.new\n # Look at the edited series and add them to our update list\n for series in update.series\n if(series[:updatetime].to_i>lastupdate && subscribedSeries.index(series[:seriesid].to_i).nil? == false)\n seriesToUpdate.push(series[:seriesid])\n end\n end\n if(update.episodes.nil? == false )\n # Look at the edited episodes and determine if we should update their series\n for episode in update.episodes\n if(episode[:updatetime].to_i>lastupdate && subscribedSeries.index(episode[:seriesid].to_i).nil? == false && seriesToUpdate.index(episode[:seriesid]).nil? == true)\n seriesToUpdate.push(episode[:seriesid])\n end\n end\n end\n\n for seriesid in seriesToUpdate\n # Get information about the show\n full_record = client.get_series_all(seriesid).full_series_record\n seriesInformation = SeriesInformation.find_by seriesid: seriesid\n if(seriesInformation.nil?)\n seriesInformation = new_series_information_from_series_record(full_record)\n end\n changed = false\n if(seriesInformation.seriesname != full_record.seriesname)\n seriesInformation.seriesname = full_record.seriesname\n changed = true\n end\n if(seriesInformation.overview != full_record.overview)\n seriesInformation.overview = full_record.overview\n changed = true\n end\n if(seriesInformation.genres != full_record.genres)\n seriesInformation.genres = full_record.genres\n changed = true\n end\n if(changed)\n seriesInformation.save\n end\n # Remove all episodes we have about the show\n EpisodeInformation.where(seriesid: seriesid).destroy_all\n \n # Go through the data and add in new episodes\n for j in 1..(full_record.episodes.length)\n if(full_record.episodes[full_record.episodes.length-j].firstaired)\n if(full_record.episodes[full_record.episodes.length-j].firstaired > Date.today.prev_day)\n # If we find an episode which hasn't aired yet, or airs today, add it to the list.\n new_episode_information_from_episode_record(full_record.episodes[full_record.episodes.length-j])\n else\n # As we go backwards through the episodes array we can break on the first episode which has already aired\n break\n end\n end\n end\n end\n end", "def update() end", "def db_insert_releases(db, org, repo, releases)\n db.transaction do\n releases.each do |release|\n db[\n \"DELETE FROM releases WHERE org=? AND repo=? AND id::int=?\", org, repo, release.id].delete\n\n # Sometimes there is no author. Instead, fill in the data with the first file's uploader\n if(release.author)\n author=release.author.login\n else\n if(release.assets and release.assets[0] and release.assets[0].uploader)\n author=release.assets[0].uploader.login\n # puts \"Unable to find an author for #{release.html_url}; using uploader: #{author}\"\n else\n author=nil\n # puts \"Unable to find an author or uploader for #{release.html_url}\"\n end\n end\n\n\t # only include releases that were published\n\t if(release.published_at)\n\t db[\n \t \"INSERT INTO releases (\n\t org, repo, id, html_url, tarball_url, zipball_url, tag_name, name, body, created_at, published_at, author\n\t )\n\t VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\",\n\t org, repo, release.id, release.html_url, release.tarball_url, release.zipball_url, release.tag_name, release.name, release.body, release.created_at.to_s,\n\t release.published_at.to_s, author].insert\n\t end\n end\n end\n end", "def update_db(rss_url, new_source, collection, response, rss_url_nice = rss_url)\n rss = MRSS.parse(response)\n\n begin @dbi.transaction do\n # update source\n if new_source\n @dbi.execute \"INSERT INTO sources (collection, rss, last, title, link, description) VALUES (?, ?, ?, ?, ?, ?)\",\n collection, rss_url, response['Last-Modified'], rss.title, rss.link, rss.description\n info rss_url_nice + \"Added as source\"\n else\n @dbi.execute \"UPDATE sources SET last=?, title=?, link=?, description=? WHERE collection=? AND rss=?\",\n response['Last-Modified'], rss.title, rss.link, rss.description, collection, rss_url\n debug rss_url_nice + \"Source updated\"\n end\n\n # update items\n items_new, items_updated = 0, 0\n rss.items.each { |item|\n description = item.description\n\n # Link mangling\n begin\n link = URI::join((rss.link.to_s == '') ? URI.parse(rss_url).to_s : rss.link.to_s, item.link || rss.link).to_s\n rescue URI::Error\n link = item.link\n end\n\n # Push into database\n db_title, = *@dbi.execute(\"SELECT title FROM items WHERE rss=? AND link=?\", rss_url, link).fetch\n\n if db_title.nil? || db_title.empty? # item is new\n begin\n @dbi.execute \"INSERT INTO items (rss, title, link, date, description) VALUES (?, ?, ?, ?, ?)\",\n rss_url, item.title, link, item.date.to_s, description\n items_new += 1\n #rescue DBI::ProgrammingError\n # puts description\n # puts \"#{$!.class}: #{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n end\n else\n @dbi.execute \"UPDATE items SET title=?, description=?, date=? WHERE rss=? AND link=?\",\n item.title, description, item.date.to_s, rss_url, link\n items_updated += 1\n end\n\n # Remove all enclosures\n @dbi.execute \"DELETE FROM enclosures WHERE rss=? AND link=?\", rss_url, link\n\n # Re-add all enclosures\n item.enclosures.each do |enclosure|\n href = URI::join((rss.link.to_s == '') ? link.to_s : rss.link.to_s, enclosure['href']).to_s\n @dbi.execute \"INSERT INTO enclosures (rss, link, href, mime, title, length) VALUES (?, ?, ?, ?, ?, ?)\",\n rss_url, link, href, enclosure['type'], enclosure['title'],\n !enclosure['length'] || enclosure['length'].empty? ? 0 : enclosure['length']\n end\n }\n info rss_url_nice + \"#{ items_new } new items, #{ items_updated } updated\"\n end; end\n end", "def update_release(stuff, release, fields)\r\n\trelease.update(fields)\r\nend", "def update_db\n ## Sequel\n drop_table\n create_table\n db.transaction do\n table.delete_sql\n install_manual\n install_updates\n end\n ## AR\n # self.transaction do\n # self.delete_all\n # self.install_manual\n # self.install_updates\n # end\n end", "def upgrade(version)\n \n end", "def update_course_revisions\n log_message 'Importing revisions and articles for soon-to-end courses'\n Course.ready_for_short_update.each { |course| UpdateCourseRevisions.new(course) }\n end", "def update ; end", "def update_db(cont)\n db = File.open('./database', 'w')\n db.write(Marshal.dump(cont))\n db.close\n end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update_database!\n ActiveRecord::Base.transaction do\n org = Org.create!(\n admin: @user,\n name: new_org_name,\n handle: orgname,\n singular: true,\n state: \"complete\",\n )\n\n @user.update!(org: org)\n raw_update_user_baseline_charges!(@user, @user_api)\n end\n end", "def update!(**args)\n @mysql_databases = args[:mysql_databases] if args.key?(:mysql_databases)\n end", "def update!(**args)\n @mysql_rdbms = args[:mysql_rdbms] if args.key?(:mysql_rdbms)\n @oracle_rdbms = args[:oracle_rdbms] if args.key?(:oracle_rdbms)\n @postgresql_rdbms = args[:postgresql_rdbms] if args.key?(:postgresql_rdbms)\n end", "def version_publish \n begin\n translations = Translation.join_to_cavs_tls_arr(calmapp_version.id)\n count = translations.count \n # This removes all key value pairs from the db\n pool.with{|con| \n con.flushdb \n translations.each{ |t| \n publish_one_translation(t)#, con) \n }\n # save what you have jsut written to redis (in background) \n con.bgsave\n }\n rescue StandardError => se\n raise se\n ensure\n #con.quit\n end \n #return count\n end", "def update_version( result )\n self.id = result['id'].gsub(/\\A_design\\//, '')\n self.rev = result['rev']\n end", "def outdated?; end", "def update!(**args)\n @database_version = args[:database_version] if args.key?(:database_version)\n @instance_host = args[:instance_host] if args.key?(:instance_host)\n @sql_engine = args[:sql_engine] if args.key?(:sql_engine)\n end", "def update\n push_to_db\n end", "def update\n push_to_db\n end", "def update\n # cyber-dojo.sh does actual [update]\nend", "def release\n \n latest_release = Checklist.latest_release\n\n self.minor_rev_number = 0\n self.major_rev_number = latest_release.major_rev_number + 1\n self.released = 1\n self.released_on = Time.now\n self.new_design_self_check_count = self.full_review_self_check_count\n self.new_design_peer_check_count = self.full_review_peer_check_count\n self.bareboard_design_self_check_count = self.partial_review_self_check_count\n self.bareboard_design_peer_check_count = self.partial_review_peer_check_count\n\n if self.save\n return 'Checklist successfully released'\n else\n return 'Checklist release failed - Contact DTG.'\n end\n\n end", "def index_versions!\n Rails.logger.info \"Updating Solr docs with Version data at #{Time.zone.now}\"\n Version.all.each do |version|\n names = (version.imported_metadata['related_name_display'] || []) + (version.imported_metadata['author_display'] || []).uniq\n update_related_names(version.book.digital_cico_number, names) if names.present?\n end\n solr.commit\n Rails.logger.info \"Done updating Solr docs with Version data at #{Time.zone.now}\"\n end", "def bump_major_version; 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 db_version=(version)\n Neo4j::Transaction.run do\n migration_meta_node[:_db_version] = version\n end\n end", "def reconcile_old_releases\n excluded_from_sync = release_ids_from_cluster << last_release(@project).id\n\n scope = @project.kubernetes_releases.excluding(excluded_from_sync)\n\n scope.not_dead.update_all(status: :dead)\n scope.with_not_dead_release_docs.distinct.each { |rel| rel.release_docs.update_all(status: :dead) }\n end", "def clean_db(prev_versions)\nputs \"CLEAN DB CALLED\"\n if Version.count > prev_versions\n to_remove = Version.count - prev_versions\n puts \"Removing #{to_remove} old versions from database\"\n Version.all(:limit => to_remove, :order => [ :processed.asc ]).each do |old_version|\n old_version.units.all.each do |old_unit|\n #old_unit.images.all.each do |old_image|\n # old_image.destroy\n #end\n old_unit.destroy\n end\n old_version.destroy\n end\n end\n end", "def update\n library\n end", "def auto_minor_version_upgrade\n data[:auto_minor_version_upgrade]\n end", "def auto_minor_version_upgrade\n data[:auto_minor_version_upgrade]\n end", "def updateEdOrgs(dbName)\n @db = @conn[dbName]\n @edorg_collection = @db[EDORG_COLLECTION]\n nupdated = 0\n @edorg_collection.find.each do |row|\n did_update = 0\n if row[TYPE_FIELD] != TYPE_VALUE_EDORG\n @edorg_collection.update({\"_id\" => row[\"_id\"]},{\"$set\" => {TYPE_FIELD => TYPE_VALUE_EDORG}})\n did_update = 1\n end\n body = row[BODY_FIELD]\n unless body[PARENT_REF_FIELD].nil?\n parent_refs = [ body[PARENT_REF_FIELD] ]\n @edorg_collection.update({\"_id\" => row[\"_id\"]},{\"$set\" => {BODY_FIELD+\".\"+PARENT_REF_FIELD => parent_refs}})\n did_update = 2\n end\n nupdated += 1 if did_update > 0\n end\n puts \"Updated \" + nupdated.to_s + \" document(s)\"\nend", "def new_version\n @version = Time.now.to_i\n end", "def update\n install\n end", "def update_year_published_entry(db, year_pubished, id)\n\tdb.execute(\"UPDATE books SET year_pubished=? WHERE id=?\", [year_pubished, id])\nend", "def sdb_update(attr_group)\n valid_length = SDB_CACHE_VALIDITY_LENGTH[attr_group]\n self.fetch_sdb_updates if valid_length.nil? || sdb_update_at.nil? || Time.now - sdb_update_at > valid_length\n end", "def releases\n repo.releases(changelog.changes)\n end", "def db_update_item_year(database,updated_year,item_id)\n execution_code = \"UPDATE wine_cellar SET year='#{updated_year}' WHERE id=#{item_id}\" # REFACTOR?: The only thing changing in this list is the updated_* code bit!\n database.execute(execution_code)\nend", "def flushdb; end", "def update_db(all_infos, no_db_commits)\n\n # We want to end up with an array of hashes f out of all this\n case all_infos.class.inspect\n when \"Array\" then\n # Assume it's the array of hashes we want.\n f = all_infos\n when \"String\" then\n # Assume it's a path to either marshal or marshal list\n f = make_geoid_info_from_marshal_list(all_infos)\n when \"Hash\" then\n # Assume it's an info hash and array it up\n f = [all_infos]\n else\n fr_error \"Can't extract Geo ID information from #{all_infos.inspect}.\"\n return nil\n end\n\n if f.nil? then\n fr_error \"Can't extract Geo ID information from #{all_infos.inspect}!\"\n return nil\n end\n\n # Connect to database\n dbinfo = self.database\n db = DBI.connect(dbinfo[:dsn], dbinfo[:user], dbinfo[:password])\n db.execute(\"BEGIN TRANSACTION\") if no_db_commits\n \n attached_geoids = Array.new\n \n # for each line, add the info to the DB\n f.each{|info|\n pid = info[:pid]\n geo_header_col = info[:geo_header_col]\n geo_record = info[:geo_record]\n previous_protocol_name = info[:previous_protocol_name]\n\n # Save the most recent set of geoids processed (or only, if not batchmode) to return later\n attached_geoids = geo_record.values\n\n # Database!\n db_set_search_path(db, pid)\n \n if (geo_header_col) then\n\n fr_puts \" Found an existing GEO datum; updating it and creating new ones as necessary\" \n geo_id_data = db_get_existing_record(db, pid, geo_header_col.heading, geo_header_col.name)\n\n # How many geo record datums already exist?\n unique_data = geo_id_data.map { |r| r[\"data_id\"] }.uniq\n\n # Are there multiple geoIDs that could be collapsed to match the # of applied protocols?\n # For example, 4 APs and given geoIDs: A A B B C C A A (nonunique is okay here.)\n num_geoids = attached_geoids.length\n num_aps = geo_id_data.map { |r| r[\"applied_protocol_id\"] }.uniq.length\n # If there are more geoids than applied protocols, but it's a multiple therof \n if (num_geoids > num_aps) && ((num_geoids % num_aps) == 0)then\n dupefactor = num_geoids / num_aps\n deduped_geoids = []\n cant_dedupe_geoids = false\n current_geoid = nil\n attached_geoids.each_index{|idx|\n if (idx % dupefactor) == 0 then # Expecting a new GEO id\n current_geoid = attached_geoids[idx]\n deduped_geoids << current_geoid\n elsif ( current_geoid != attached_geoids[idx] ) then\n # Whoops, the geo ids don't line up like we expected\n # This will be caught lower down.\n cant_dedupe_geoids = true\n break\n end\n }\n unless (cant_dedupe_geoids) then\n fr_puts \" Found #{num_geoids} GEO ids for #{num_aps} applied protocols, but was\" +\n \" able to remove duplicates and reduce length to #{deduped_geoids.length}!\"\n fr_puts \" Previous GEO ids : \\n#{attached_geoids.pretty_inspect}\"\n fr_puts \" Reduced GEO ids : \\n#{deduped_geoids.pretty_inspect}\"\n attached_geoids = deduped_geoids\n end\n end\n\n if geo_id_data.size == attached_geoids.size || geo_id_data.size == attached_geoids.uniq.size then\n # Set the values in geo_id_data to be the geoIDs we want to put in the DB; clear data_id if \n # we need to make a new datum.\n\n if geo_id_data.size == attached_geoids.uniq.size then\n attached_geoids.uniq!\n end\n\n if unique_data.size != 1 then\n if unique_data.size == attached_geoids.size then\n attached_geoids.each_index { |i| geo_id_data[i][\"value\"] = attached_geoids[i] }\n else\n # Are the IDs already in there?\n values = geo_id_data.map { |d| d[\"value\"] }\n if values.sort == attached_geoids.sort then\n fr_puts \" All GEO IDs already in this submission!\" \n next\n else\n # Ok, the number of datums doesn't match up. Does the number of applied protocols\n # match up, and there are TOO FEW datums?\n unique_aps = geo_id_data.map { |r| r[\"applied_protocol_id\"] }.uniq\n if (unique_data.size < attached_geoids.size) && (unique_aps.size == attached_geoids.size) then\n # need to resort geo_id_data because data_id order is unusable since there are datums re-used\n geo_id_data.sort!{|a, b| a[\"applied_protocol_id\"].to_i <=> b[\"applied_protocol_id\"].to_i }\n\n # Update the geoID for each;\n # if it's a repeat data_id, clear it--new datum is needed\n geo_id_data.each_index {|i|\n geo_id_data[i][\"value\"] = attached_geoids[i]\n current_data_id = geo_id_data[i][\"data_id\"]\n if geo_id_data.index{|j| j[\"data_id\"] == current_data_id} < i then\n geo_id_data[i][\"data_id\"] = nil\n end\n }\n # Get current attributes of the existing datum if we're adding new datums.\n if geo_id_data.map{|i| i[\"data_id\"]}.include? nil then\n sth_get_datum = db.prepare(\"SELECT * FROM data WHERE data_id = ?\")\n sth_get_datum.execute(geo_id_data.first[\"data_id\"])\n data_info = sth_get_datum.fetch_hash\n sth_get_datum.finish\n end\n else\n # Give up \n fr_puts \" ERROR! Couldn't figure out how to map GeoIDs to the existing datums!\" \n error_in_submission(pid, :more_than_one_unique_datum) # throws\n next # skip this submission, if we choose not to throw an error\n end\n end\n end\n else\n attached_geoids.each_index { |i| geo_id_data[i][\"value\"] = attached_geoids[i] }\n # Update the existing one and add some more\n # 1. Get current attributes of the existing datum\n sth_get_datum = db.prepare(\"SELECT * FROM data WHERE data_id = ?\")\n sth_get_datum.execute(geo_id_data.first[\"data_id\"])\n data_info = sth_get_datum.fetch_hash\n sth_get_datum.finish\n # 2. Remove data_id from all but first data entry\n geo_id_data[1..-1].each { |d| d[\"data_id\"] = nil }\n end\n\n # Insert and/or update\n sth_create = db.prepare(\"INSERT INTO data (name, heading, value, type_id, dbxref_id) VALUES(?, ?, ?, ?, ?)\")\n sth_update = db.prepare(\"UPDATE data SET value = ? WHERE data_id = ?\")\n sth_last_data_id = db_prepare_last_data_id(db) \n sth_update_applied_protocol_data = db.prepare(\"UPDATE applied_protocol_data SET data_id = ? WHERE applied_protocol_data_id = ?\")\n n=0\n geo_id_data.each { |d|\n if d[\"data_id\"].nil? then\n # Create new datum\n fr_puts \" Creating datum for #{d[\"value\"]}\" \n sth_create.execute(data_info[\"name\"], data_info[\"heading\"], d[\"value\"], data_info[\"type_id\"], data_info[\"dbxref_id\"]) unless no_db_commits\n sth_last_data_id.execute unless no_db_commits\n last_id = sth_last_data_id.fetch_hash[\"last_value\"] unless no_db_commits\n sth_update_applied_protocol_data.execute(last_id, d[\"applied_protocol_data_id\"]) unless no_db_commits\n else\n # Update existing datum\n fr_puts \" Updating existing datum for #{d[\"value\"]}\" \n sth_update.execute(d[\"value\"], d[\"data_id\"]) unless no_db_commits\n end\n n += 1\n }\n sth_create.finish\n sth_update.finish\n sth_last_data_id.finish\n sth_update_applied_protocol_data.finish\n else\n fr_puts \" More (or fewer) applied protocols using a GEO ID than GEO IDs to attach.\" \n sth_update = db.prepare(\"UPDATE data SET value = ? WHERE data_id = ?\")\n if unique_data.size == attached_geoids.size then\n fr_puts \" However, there are as many unique datum(s) as GEO IDs to attach.\" \n sorted_data_ids = unique_data.sort\n sorted_data_ids.each_index { |i|\n data_id = sorted_data_ids[i]\n v = attached_geoids[i]\n fr_puts \" Updating datum to #{v}.\" \n sth_update.execute(v, data_id) unless no_db_commits\n }\n elsif attached_geoids.uniq.size == 1\n fr_puts \" However, there is only 1 GEO ID to attach, so it is the same for all of them.\" \n sorted_data_ids = unique_data.sort\n v = attached_geoids.first\n if geo_id_data.first[\"value\"] == v then\n fr_puts \" Actually, that ID is already in the DB\" \n else\n sorted_data_ids.each { |data_id|\n fr_puts \" Updating datum to #{v}.\" \n sth_update.execute(v, data_id) unless no_db_commits\n }\n end\n else\n fr_puts \" Fewer applied protocols for the datum than we expected:\" \n fr_puts geo_id_data.pretty_inspect \n fr_puts \"!=!=!=\" \n fr_puts attached_geoids.pretty_inspect \n error_in_submission(pid, :wtf_they_dont_line_up) # throws\n next\n end\n sth_update.finish\n end\n else\n fr_puts \" No existing GEO datum, creating it/them\" \n existing_aps = db_find_protocol(db, pid, previous_protocol_name)\n\n if existing_aps.size == attached_geoids.size then\n # Sweet, there are as many APs as geo records\n use_these_gsms = attached_geoids\n elsif existing_aps.size == attached_geoids.uniq.size then\n # Okay, but it works for unique ones\n use_these_gsms = attached_geoids.uniq\n elsif attached_geoids.uniq.size == 1 then\n # Okay, there's only one GSM so we apply it to all APs\n gsm = attached_geoids.first\n use_these_gsms = existing_aps.map { gsm }\n else\n fr_puts \" #{existing_aps.size} APs for #{attached_geoids.size} GEO records\" \n error_in_submission(pid, :ap_size_differs_from_geo_record_count ) # throws\n next\n end\n # Create a new datum for each geo record in order and attach it to each applied_protocol as an output\n if use_these_gsms.size != existing_aps.size then\n error_in_submission(pid, :wtf_i_thought_i_just_set_ap_sizes) # throws\n next\n end\n\n geo_type_id = get_geo_type_id(db) unless no_db_commits\n\n sth_create_data = db.prepare(\"INSERT INTO data (heading, name, value, type_id) VALUES(?, ?, ?, ?)\")\n sth_create_apd = db.prepare(\"INSERT INTO applied_protocol_data (applied_protocol_id, data_id, direction) VALUES(?, ?, 'output')\")\n sth_last_data_id = db_prepare_last_data_id(db) \n sth_datum_exists = db.prepare(\"SELECT data_id FROM data WHERE (name = 'geo record' or name = 'GEO id') AND value = ?\")\n sth_apd_exists = db.prepare(\"SELECT applied_protocol_data_id FROM applied_protocol_data WHERE applied_protocol_id = ? AND data_id = ?\")\n\n existing_aps.each_index { |i|\n ap = existing_aps[i]\n gsm = use_these_gsms[i]\n sth_datum_exists.execute(gsm)\n data_row = sth_datum_exists.fetch_hash\n if data_row then\n fr_puts \" Already a datum for #{gsm}\" \n data_id = data_row[\"data_id\"]\n else\n fr_puts \" Creating a datum for #{gsm}\" \n sth_create_data.execute(\"Result Value\", \"geo record\", gsm, geo_type_id) unless no_db_commits\n sth_last_data_id.execute unless no_db_commits\n data_id = sth_last_data_id.fetch_hash[\"last_value\"] unless no_db_commits\n end\n sth_apd_exists.execute(ap[\"applied_protocol_id\"], data_id)\n if sth_apd_exists.fetch_hash then\n fr_puts \" Already and applied_protocol_datum for #{gsm} and #{ap[\"applied_protocol_id\"]}\" \n else\n fr_puts \" Creating applied_protocol_data entry for #{gsm} and #{ap[\"applied_protocol_id\"]}\" \n sth_create_apd.execute(ap[\"applied_protocol_id\"], data_id) unless no_db_commits\n end\n }\n sth_create_data.finish\n sth_create_apd.finish\n sth_last_data_id.finish\n sth_datum_exists.finish\n sth_apd_exists.finish\n end\n \n } \n\n db.execute(\"ROLLBACK\") if no_db_commits\n db.disconnect\n\n return attached_geoids\n end", "def update\n \n end", "def update\n is_valid_project\n $VERBOSE = !options[:verbose].nil?\n name = File.basename(CURR_DIR)\n project_dir = CURR_DIR\n overwrite_config = !options[:overwrite_config].nil?\n version = options[:version]\n unless version == nil or OK_OBD_VERSIONS.include?(version)\n throw \"Specified version \\\"#{version}\\\" isn't supported.\\nTry one of the following:\\n #{OK_OBD_VERSIONS.join(\"\\n \")}\"\n end\n rebuild = !options[:rebuild].nil?\n download_openbd(version, rebuild) unless version.nil?\n update_project(name, version, false, overwrite_config, true) \n display \"#{name} updated to OpenBD #{version}\" unless version.nil?\n end", "def update_db(struct)\n File.write('app/services/db/database.json', JSON.generate(struct))\n end", "def twenty_pct_release_date=(rd=Time.now)\n update_values([:twenty_pct_release_date] => rd.beginning_of_day.utc.xmlschema)\n content_will_change!\n end", "def update_local_outdated\n update(:l, @outdated) if outdated?\n end", "def add_release( dbh, name )\n\n # Return the release's id value if it is found in the db\n e = get_release(dbh, name )\n return e if e\n\n stmtb = \"INSERT INTO releases(name, description, created_at, updated_at) VALUES('#{name}', 'Package release for #{name}', NOW(), NOW())\"\n rsb = dbh.query( stmtb )\n rsa = dbh.query( \"SELECT id AS count FROM releases WHERE name = '#{name}'\" )\n row = rsa.first\n return row['count']\nend", "def refresh\n update_databases()\n render json: {message: \"Information will be updated shortly\"}, status: :ok\n end", "def update!(**args)\n @app_connection = args[:app_connection] if args.key?(:app_connection)\n @recent_mig_vms = args[:recent_mig_vms] if args.key?(:recent_mig_vms)\n end", "def lastest_package_release\n self.packages.where(:latest => 1).order(:release_date => :desc).first\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 flushdb\n end", "def date() updated; end", "def bump_patch_version; end", "def get_db\n manif = Project.miga_online_manif\n @downloadable = manif[:databases].map do |name, i|\n local = Project.find_by(path: name)\n local_v = (local.miga.metadata[:release] || 'unknown') if local && local.miga\n latest = i[:versions][i[:latest].to_sym]\n file = File.join(Settings.miga_projects, latest[:path])\n downloading = File.size(file) * 100 / latest[:size] if File.exist?(file)\n i.merge(name: name, local: local_v, downloading: downloading)\n end\n end", "def update_version_to_next\n super\n info \"Current version is now #{extract_version}\"\n Hg.commit File.basename(version_file), message\n Hg.push if Hg.remote\n end", "def save\n update_dc\n super \n end", "def db_version\n migration_meta_node[:_db_version]\n end", "def bump_minor_version; end", "def latest_version\n (Release.where(:manifest_id => manifest_id).max(:version) || 0)\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def set_version\n self.version ||= latest_version + 1\n end", "def push_fedora(cx)\n\tComponent.reset_counters( cx.id, :master_files )\n\ttitle = (cx.title or cx.content_desc.strip)\n\tputs \"[#{cx.id}]: #{title}\"\n\tFedora.create_or_update_object( cx, title )\n\tcx.update_attribute( :date_dl_ingest, Time.now ) if cx.date_dl_ingest.nil? \n\tcx.update_metadata('allxml')\n\tcx.save! \n\tcx.master_files.each { |mf| mf.update_metadata( 'allxml' ); mf.save! } \nend", "def release_version!\n projects.each { |project| project.release_version!(tag_full_name) }\n print_log 'Versions released'\n slack_notifier.ping(release_message, icon_emoji: ':see_no_evil:')\n end", "def database(value)\n update_query(:database => value)\n end", "def related_releases\n Rails.cache.fetch(\"releases/release-#{id}\", :expires_in => 1.hour) do\n real_releases.all(:order => 'date DESC', :limit => 15)\n end\n end", "def launch_get_db\n name = params[:name]\n version = params[:version]\n Thread.new do\n require 'miga/cli'\n\n # Get current registered version\n project = Project.find_by(path: name)\n if project && project.miga\n project.miga.metadata[:release] =\n \"#{project.miga.metadata[:release]} (currently updating)\"\n project.miga.save\n end\n\n # Download\n error =\n MiGA::Cli.new([\n 'get_db', '-n', name, '--db-version', version,\n '--local-dir', Settings.miga_projects, '--no-progress'\n ]).launch\n raise(error) if error.is_a? Exception\n\n # Register in the database\n project ||= current_user.projects.create(path: name)\n project.update(reference: true)\n f = File.join(Settings.miga_projects, \"#{name}_#{version}.tar.gz\")\n File.unlink(f) if File.exist? f\n ActiveRecord::Base.connection.close\n end\n\n sleep(10) # <- Hopefully this is enough to start the download\n flash[:success] = 'Downloading database in the background'\n redirect_to get_db_path\n end", "def updates\n display \"Populating updates...\"\n TrelloStandup::Trello.generate_updates\n display \"Completed.\"\n end", "def update\n \t\n end", "def update\n \t\n end", "def scd_latest_version_field\n configuration[:scd][:latest_version_field] || :latest_version if scd?\n end", "def update!(**args)\n @version = args[:version] if args.key?(:version)\n end", "def latest_version\n self.versions.order(\"revision_date DESC\").first\n end", "def update!(**args)\n @deprecated_version = args[:deprecated_version] if args.key?(:deprecated_version)\n @mid = args[:mid] if args.key?(:mid)\n end", "def update_marvel(date)\n release_date = date\n publisher = Publisher.find_or_create_by_name(\"Marvel\")\n \n while release_date <= date + 4.months do\n log(\"retrieving marvel data for #{release_date.strftime('%Y-%m-%d')}\")\n doc = Hpricot(open(\"#{URL_Marvel}/catalog/?date=#{release_date.strftime('%Y-%m-%d')}\"))\n books = (doc/\"a[@class=title_link]\")\n books = books.each { |book| fetch_title_marvel(publisher, book.innerHTML.strip, \"#{URL_Marvel}#{book.attributes['href']}\", release_date) }\n release_date += 1.week\n end\n end", "def update_version_method(version)\nend", "def prod_db2dev\n exit_if_production\n prod_db_backup\n prod_db_pull\n prod_db_load\n end", "def update(branches)\n ApplicationUtils.acquiring_lock_file('updating') do\n started_at = Time.now\n ncommits = 0\n\n git_fetch\n pulled_at = Time.now\n\n if names_mapping_updated = names_mapping_updated?\n logger.info(\"there's a new names mapping\")\n else\n logger.info(\"same names mapping than in last repo update\")\n end\n\n Commit.transaction do\n ncommits = import_new_commits(branches)\n logger.info(\"#{ncommits} new commits imported into the database\")\n\n break if ncommits.zero? && !names_mapping_updated\n\n only_for_new_commits = !names_mapping_updated\n contributor_names_per_commit = compute_contributor_names_per_commit(only_for_new_commits)\n manage_gone_contributors(contributor_names_per_commit.values.flatten.uniq) if names_mapping_updated\n\n logger.info(\"updating database\")\n assign_contributors(contributor_names_per_commit)\n update_ranks\n end\n\n if cache_needs_expiration?(ncommits, names_mapping_updated)\n logger.info(\"expiring cache\")\n expire_caches\n else\n logger.info(\"current cache is valid\")\n end\n\n ended_at = Time.now\n\n logger.info(\"update completed in %.1f seconds\" % [ended_at - started_at])\n RepoUpdate.create(\n :ncommits => ncommits,\n :started_at => started_at,\n :pulled_at => pulled_at,\n :ended_at => ended_at\n )\n end\n end", "def update_version( result ) \n self.id = result['id']\n self.rev = result['rev']\n end", "def update(dir, name = nil)\n since = Changelog.last_sha(@releases)\n release = Release.new(name)\n release.update(dir, since)\n add_release(release)\n end" ]
[ "0.6908217", "0.67002493", "0.6228074", "0.60424894", "0.5885806", "0.58501494", "0.5846386", "0.5713005", "0.5710732", "0.56965053", "0.56934655", "0.56775665", "0.5656161", "0.5651178", "0.56465024", "0.56109184", "0.5606278", "0.559021", "0.5578266", "0.5572297", "0.550931", "0.54749364", "0.54303056", "0.54303056", "0.54303056", "0.54303056", "0.54303056", "0.54303056", "0.54303056", "0.54303056", "0.54088914", "0.5407205", "0.54054517", "0.5381346", "0.53669", "0.53600395", "0.53509253", "0.53382", "0.53382", "0.530232", "0.52883136", "0.52843654", "0.52743644", "0.52710795", "0.52656984", "0.52516246", "0.5243765", "0.52161586", "0.5205708", "0.5205708", "0.5198499", "0.519492", "0.5189852", "0.5181457", "0.51771015", "0.51757556", "0.5172487", "0.51711696", "0.51680464", "0.5161763", "0.51617193", "0.516073", "0.5157535", "0.5148987", "0.5146647", "0.5145127", "0.5142147", "0.51307833", "0.51280427", "0.5125327", "0.51163036", "0.511576", "0.5115464", "0.5112709", "0.5110959", "0.5109044", "0.5107462", "0.51072276", "0.51008636", "0.51008636", "0.51008636", "0.51006174", "0.51001775", "0.509614", "0.50961185", "0.5093621", "0.50912553", "0.5083797", "0.50828147", "0.50828147", "0.5080808", "0.50783837", "0.5077074", "0.5073654", "0.50693864", "0.5067724", "0.5062376", "0.50611496", "0.5057453", "0.5055503" ]
0.65218115
2
fetch details and create/update model for a particular DC title
def fetch_title_dc(publisher, title, url, date = nil) log("retrieving title information for [#{title}]", :debug) doc = Hpricot(open(url)) # span.display_talent = "Written by, Art by... " # span.display_copy = "A final confrontation pits..." # span.display_data = "DC Universe &nbsp;|&nbsp;32pg. &nbsp;|&nbsp;&nbsp;Color &nbsp;|&nbsp;&nbsp;$2.99&nbsp;US" # span.display_copy = "On sale June 6, 2007" display_talent = ((doc/"#content-col2")/"p:first strong").innerHTML display_copy = (doc/"#content-col2").innerHTML display_date = ((doc/"#content-col2")/"p:last").innerHTML title = RubyPants.new(title, -1).to_html display_name, display_number = title.split('#') display_name = check_title(display_name) display_number = display_number.split(' ')[0] unless display_number.nil? new_record = false if display_number.nil? # SoloBook model = SoloBook.find_by_name(display_name) if model.nil? model = SoloBook.new(:name => display_name, :publisher => publisher) new_record = true end else # Episode series = Series.find_by_name(display_name) if series.nil? # Series doesn't exist, create new Series series = Series.create!(:name => display_name, :publisher => publisher) log("created new series [#{display_name}]", :info) model = series.episodes.build({ :number => display_number }) new_record = true else # Add episode to existing series if series.find_episode(display_number).nil? model = series.episodes.build({ :number => display_number }) new_record = true else model = series.find_episode(display_number) end end end model.talent = html2text(display_talent) model.description = html2text(display_copy) model.published_on = Date.parse(display_date.downcase.sub('on sale', '').gsub(/\s+/, ' ').strip) model.save! new_record ? log("created new book [#{title}]", :info) : log("updated existing book [#{title}]", :debug) if model.cover_image.nil? # get cover image (if we don't have one already) image_element = (doc/"img").select { |elem| elem.attributes['src'].match(/media\/product\/.*180x270.jpg/) } image_url = nil unless image_element.empty? image_url = image_element[0].attributes['src'] image_url = "#{URL_DC_Media}#{image_url.gsub(/180x270/,'400x600')}" # full size art end get_cover_image(model, image_url) end rescue ActiveRecord::RecordInvalid => e log("failed to create or update book [#{title}]", :info) log("errors: #{model.errors.full_messages.join(', ')}", :info) return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_title_marvel(publisher, title, url, date = nil) \n log(\"retrieving title information for [#{title}]\", :debug)\n doc = Hpricot(open(url))\n \n display_description = (doc/\"font[@class=plain_text]\").innerHTML\n\n title = RubyPants.new(title, -1).to_html\n display_name, display_number = title.split('#')\n display_name = check_title(display_name)\n display_number = display_number.split(' ')[0] unless display_number.nil?\n \n new_record = false\n \n if display_number.nil?\n # SoloBook\n model = SoloBook.find_by_name(display_name)\n \n if model.nil?\n model = SoloBook.new(:name => display_name, \n :publisher => publisher)\n new_record = true\n end\n \n else\n # Episode\n series = Series.find_by_name(display_name)\n \n if series.nil?\n # Series doesn't exist, create new Series\n series = Series.create!(:name => display_name, \n :publisher => publisher)\n log(\"created new series [#{display_name}]\", :info)\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n # Add episode to existing series\n if series.find_episode(display_number).nil?\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n model = series.find_episode(display_number)\n end\n end\n end\n \n display_talent, display_description = display_description.split(\"<strong>THE STORY:</strong>\")\n display_description ||= \"\" # if description was empty make sure it's non-nil\n display_description = display_description.split(\"<strong>PRICE:</strong>\")[0]\n \n model.talent = html2text(display_talent).strip.titleize\n model.description = html2text(display_description).strip\n model.published_on = date\n \n model.save!\n new_record ? log(\"created new book [#{title}]\", :info) : log(\"updated existing book [#{title}]\", :debug)\n \n if model.cover_image.nil?\n # get cover image (if we don't have one already)\n image_element = (doc/\"img\").select { |elem| elem.attributes['src'].match(/thumb/) }\n image_url = nil\n \n unless image_element.empty?\n image_url = image_element[0].attributes['src']\n image_url = \"#{URL_Marvel}#{image_element[0].attributes['src'].gsub('_thumb', '_full')}\" # full size art\n end\n \n get_cover_image(model, image_url)\n end\n \n rescue ActiveRecord::RecordInvalid => e\n log(\"failed to create book [#{title}]\", :info)\n log(\"errors: #{model.errors.full_messages.join(', ')}\", :info)\n return false\n end", "def update_title\n title_params = { year: params[:year],\n min_bid_reserve: params[:min_bid_reserve],\n pre_accident_value: params[:pre_accident_value],\n buy_now: params[:buy_now],\n sale_doc_application_date: params[:sale_doc_application_date],\n sale_doc_at_copart_date: params[:sale_doc_at_copart_date],\n sale_doc_given_to_buyer_date: params[:sale_doc_given_to_buyer_date] }\n if @vehicle.homeowner_group?\n title_params.merge!(vehicle_description: params[:vehicle_description])\n else\n title_params.merge!(license_plate_num: params[:license_plate_num],\n vehicle_registration_num: params[:vehicle_registration_num],\n registration_certificate_num: params[:registration_certificate_num],\n verify_vehicle_identification_num: params[:verify_vehicle_identification_num],\n ownership_transfer_type_id: params[:ownership_transfer_type].present? ? params[:ownership_transfer_type][:id] : nil,\n original_doc_country_id: params[:original_doc_country].present? ? params[:original_doc_country][:id] : nil,\n original_doc_type_id: params[:original_doc_type].present? ? params[:original_doc_type][:id] : nil,\n documented_odometer_hour: params[:documented_odometer_hour],\n documented_odometer_unit_id: params[:documented_odometer_unit].present? ? params[:documented_odometer_unit][:id] : nil,\n original_odometer_brand_id: params[:original_odometer_brand].present? ? params[:original_odometer_brand][:id] : nil,\n documented_odometer_brand_id: params[:documented_odometer_brand].present? ? params[:documented_odometer_brand][:id] : nil,\n sale_doc_country_id: params[:sale_doc_country].present? ? params[:sale_doc_country][:id] : nil,\n sale_doc_type_id: params[:sale_doc_type].present? ? params[:sale_doc_type][:id] : nil,\n original_doc_state: params[:original_doc_state],\n sale_doc_state: params[:sale_doc_state],\n original_odometer_hour: params[:original_odometer_hour],\n original_odometer_unit_id: params[:original_odometer_unit].present? ? params[:original_odometer_unit][:id] : nil)\n if @vehicle.marine_or_recreational_or_industrial_or_homeowner_group?\n title_params.merge!(custom_make: params[:custom_make],\n custom_model: params[:custom_model], custom_trim: params[:custom_trim])\n end\n end\n # Replace masking value with the original\n title_params.keys.each do |key|\n replace_value = replace_mask_val_with_orginal(key.to_s, @vehicle)\n title_params[key] = replace_value if !replace_value.nil?\n end\n @vehicle.update_attributes(title_params)\n @vehicle.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT,\n I18n.t(\"system_notes.user_activity.ownership_transfer_update\"),\n current_employee, true)\n\n if @vehicle.save\n @vehicle.reload\n respond_to do |format|\n format.html { redirect_to @vehicle }\n format.json { render json: { vehicle: @vehicle.as_json(include_all: \"yes\") }, \n status: :created, \n location: @vehicle }\n end\n else\n logger.info(\"Errors exist: #{@vehicle.errors.messages}\")\n respond_to do |format|\n format.html { render action: :new }\n format.json { render json: { errors: @vehicle.errors }, \n status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity = Entity.find_my_title( entity_params[:title] )\n\n if @entity.nil?\n @entity = Entity.new(entity_params)\n else\n @entity.update(entity_params)\n end\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to '/', notice: 'Entidad creada.' }\n format.json { render action: 'show', status: :created, location: @entity }\n else\n format.html { render action: 'new' }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n if !params[:model][:title].blank?\r\n params[:model][:title] = params[:model][:title].upcase\r\n code = params[:model][:title].delete(' ')[0..8]\r\n params[:model][:code] = code\r\n else\r\n code = Time.now.strftime(\"%Y%d%m%H%M%S\")[0..8]\r\n params[:model][:code] = code\r\n end\r\n\r\n @model = Model.new(model_params)\r\n if @model.save\r\n redirect_to edit_model_path(@model)\r\n else\r\n render :new\r\n end\r\n end", "def load_model(mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_model_info\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n model = Dynamicloud::API::Model::RecordModel.new mid\n model.name = json['name']\n model.description = json['description']\n\n model\n end", "def find_movie_by_title(arg)\n query_response = RestClient.get(\"http://www.omdbapi.com/?t=#{arg}&apikey=a2d3299b\") #query the database\n parsed_response = JSON.parse(query_response) #parse the response into a useable hash\n movie_deets_hash = #extract relevant details from the hash\n {\"Title\" => parsed_response[\"Title\"],\n \"Released\" => parsed_response[\"Released\"].slice(-4..).to_i,\n \"Genre\" => parsed_response[\"Genre\"],\n \"Director\" => parsed_response[\"Director\"]}\n add_movie_to_database(movie_deets_hash) #create a movie_object for the selected movie, if it doesn't already exist\n end", "def start\n @model = params[:model]\n titles = { 'Assignment' => 'Grades', 'CourseParticipant' => 'Course Participants', 'AssignmentTeam' => 'Teams',\n 'CourseTeam' => 'Teams', 'User' => 'Users', 'Question' => 'Questions' }\n @title = titles[@model]\n @id = params[:id]\n end", "def set_title\r\n @title = Title.find(params[:id])\r\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def save_comic(comic_title, u1)\n comic = find_or_create_comic(comic_title)\n find_or_create_reading_list(u1.id, comic.id)\n end", "def set_distro\n if params[:name]\n @distro = Distro.where(:name => params[:name]).first\n else\n @distro = Distro.find(params[:id])\n end\n end", "def update_title\n\t\tday = Day.from_identifier(post_params[:day])\n\t\tdocument = Document.for_user(@user.id, day.year, day.month, day.day).first\n\t\traise \"Unknown document\" unless document\n\t\tdocument.title = post_params[:title]\n\t\tdocument.save!\n\t\trender_ok\n\tend", "def set_model_name\n @model_name = ModelName.find(params[:id])\n end", "def set_detail_model\n @detail_model = DetailModel.find(params[:id])\n end", "def set_name_title\n @name_title = NameTitle.find(params[:id])\n end", "def update_metadata\n Socop::Ontology.parse(DATADIR.join \"ontologies.xml\").each do |ontology|\n if onto_ontology = Ontology.where(repository_id: repository.id, basepath: ontology['abbreviation']).first\n onto_ontology.update_attributes \\\n name: ontology['displayLabel'],\n description: ontology['description']\n end\n end\n end", "def updateTitle(id, title)\n item = Todo.find(id)\n item.title = title\n item.save\nend", "def handle_foreign_key_element(cs, element, new_model)\n # finds the current model matching the single found parameter or creates a new one\n foreign_resource = cs.foreign_data_resource\n\n if element.nil?\n logger.info 'NIL ELEMENT for foreign key'\n return\n end\n\n content_model = foreign_resource.minimal_current_or_new(element.text)\n content_model[:institution_id] = cs.scrape_resource.institution_id\n\n # models for foreign key content must be saved just as any other model, if they existed previously nothing happens\n validate_and_save(content_model)\n # logger.info \"found content_model for selector cs.id: #{content_model.inspect}\"\n new_model.assign_attributes(cs.column_name => content_model.id)\n # category must always be assigned to indicate which foreign resource type is related\n new_model.assign_attributes(category: foreign_resource.resource_type.resource_name)\n end", "def set_saved_title\n @saved_title = SavedTitle.find(params[:id])\n end", "def show\n\n \tbegin\n \t@company = Company.find(COMPANY_ID)\n rescue ActiveRecord::RecordNotFound\n \t@company = Company.create({:description => ''})\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end \n end", "def define_title\n @title = @deal.title\n @description = @deal.title + ' - ' + Deal.i18n_category(@deal.category)\n end", "def fetch_model\n model_name.camelize.constantize.find( params[:id] )\n end", "def create\n @title = Title.new(title_params)\n \n respond_to do |format|\n if @title.save\n format.html { redirect_to titles_url(search: @title.title), notice: 'Title was successfully created.' }\n format.json { render :show, status: :created, location: @title }\n else\n format.html { render :new }\n format.json { render json: @title.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n end", "def save\n if id\n update(name: name, organization_id: organization)\n else\n new_instance = self.class.create(client, name: name, organization_id: organization)\n refresh_data(new_instance)\n end\n end", "def fetch\n if self.rdf_subject.to_s.include?('spar')\n uri = self.rdf_subject.to_s\n xml_url = uri.sub 'https://w3id.org/spar/', 'http://www.sparontologies.net/'\n xml_url.concat('.rdf')\n\n response = RestClient.get xml_url, {accept: :xml}\n xmldoc = Nokogiri::XML(response)\n new_label = xmldoc.at_xpath(\"/rdf:RDF/rdf:Description/rdfs:label/text()\")\n\n self << RDF::Statement.new(rdf_subject, RDF::SKOS.prefLabel, new_label)\n\n persist!\n else\n super\n end\n end", "def title=(title)\n t = Title.new\n t.content = title\n self.dc_titles = [t]\n title\n end", "def set_model\n @model = ClientService.find(params[:id])\n end", "def get_details_from_model(authorname=\"Undefined\")\n file_OK = false\n if @file_data\n begin\n model = T2Flow::Parser.new.parse(@file_data)\n @file_data.rewind\n if !model.nil?\n self.name = model.name\n if model.annotations.titles.join.to_s != \"\"\n self.title = model.annotations.titles.join.to_s\n else\n self.title = \"No title provided\"\n end\n if model.annotations.authors.join.to_s != \"\"\n self.author = model.annotations.authors.join.to_s\n else\n self.author = authorname\n end\n self.description = model.annotations.descriptions.join.to_s\n end\n file_OK = true\n rescue\n file_OK = false\n ensure\n @file_data.rewind\n return file_OK\n end\n end\n end", "def model_title\n model_name.titleize\n end", "def update\n @title = Title.find(params[:id])\n\n if @title.update(title_params)\n head :no_content\n else\n render json: @title.errors, status: :unprocessable_entity\n end\n end", "def update_title( doc_id:, title: )\n send_request :post, \"document/#{@app}/#{doc_id}/title/#{URI.escape title}\", {}, :json\n end", "def new\n @title = Title.new :your_number => @company.drawee_code\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @title }\n end\n end", "def set_title2\n @title2 = Title2.find(params[:id])\n end", "def save\n #see if PID is not yet specified in DC. Note that according the rest of the code, the PID is put in DC when the object is first saved. \n #That means the below expression becomes true only if this is the object is saved first time.\n update_dc_id = get_dc.identifier == \"\"\n \n #Save the object. This generates the PID if this is a new object.\n status = super\n \n dc = get_dc\n if update_dc_id && status\n \n dc.identifier = self.pid\n \n #We need to set up the following field at some point.\n dc.creator = \"TODO\" if dc.creator == \"\"\n dc.created = \"TODO\" if dc.created == \"\"\n \n #Since the DC is updated, let's save the object again.\n status = super \n end\n \n #Return the save status.\n return status\n end", "def update\n @title = Title.find(params[:id])\n if @title.update_attributes(params[:title])\n @titles = Title.all\n flash[:notice] = \"You've updated the title!\"\n render 'results'\n else\n #FIXME\n end\n end", "def find_or_create_by_name(title)\n find_by_name(title) || self.new(title) # + self.save ?\n end", "def save\n update_dc\n super \n end", "def set_description_name\n @trip = Trip.find_by_name(params[:trip_id])\n @folder = @trip.folders.find_by_name(params[:folder_id]) \n @description = @folder.descriptions.find_by_title(params[:id])\n @model_link = \"description\"\n end", "def model(model_type, name, attributes = {})\n if model_exists?(model_type, name)\n get_model(model_type, name)\n else\n put_model(model_type, name, attributes)\n end\n end", "def set_criterion_detail\n @criterion_detail = CriterionDetail.find(params[:id])\n end", "def set_title(new_title, opts={})\n if self.datastreams.has_key?(\"descMetadata\")\n desc_metadata_ds = self.datastreams[\"descMetadata\"]\n if desc_metadata_ds.respond_to?(:title_values)\n desc_metadata_ds.title_values = new_title\n else\n desc_metadata_ds.title = new_title\n end\n end\n end", "def set_model\r\n @model = Model.find(params[:id])\r\n end", "def create_models\n @name = name.singularize.downcase\n @name_plural = @name.pluralize\n @attributes = attributes\n template(\"./templates/model.erb\", \"./models/#{@name}.rb\")\n end", "def set_dispersion\n @dispersion = Dispersion.find(params[:id])\n end", "def set_software_record\n @software_record = SoftwareRecord.find(params[:id])\n end", "def update\n o = Designation.find(params[:id])\n \n if o.update_attributes(:title => params[:title], :desc => params[:desc], \n :note => params[:note])\n render :json => { :success => 1, \n :message => 'Job Title was successfully updated.' }\n \n else\n render :json => DesignationHelper.get_errors(o.errors)\n end\n end", "def update_title\n return if params[:design_id].nil?\n\n @design = Design.find(params[:design_id])\n @design.title = params[:design_title]\n\n respond_to do |format|\n if @design.save\n format.html { redirect_to :back }\n format.js { render template: 'singles/update_title.js.erb' }\n else\n format.html { redirect_to root_path, notice: 'Erro ao atualizar o titulo do design.' }\n end\n end\n end", "def updateItem(id, title, description)\n item = List.find(id)\n item.title = title\n item.description = description\n item.save\n end", "def title\n attributes.fetch(:title)\n end", "def title\n attributes.fetch(:title)\n end", "def quick_create\n @client = (current_user && current_user.has_role?('admin', 'staff')) ? Client.find(params[:client_id]) : current_user\n @listing = params[:id] ? Listing.find(params[:id]) : @client.listings.build(:title => params[:title], :storage_types => 'self storage')\n \n if (@listing.new_record? ? @listing.save(false) : @listing.update_attribute(:title, params[:title]))\n render :json => { :success => true, :data => { :listing_id => @listing.id } }\n else\n render :json => { :success => false, :data => model_errors(@listing) }\n end\n end", "def make_title_searchable\n address = create_title_addressbase_data(@title)\n create_elasticsearch_addressbase_data(address)\n sleep($ELASTICSEARCH_SLEEP.to_f) # elasticsearch changes take a moment\n create_lr_urpn_mapping_data(@title[:lr_uprns])\nend", "def set_recipe_title\n @recipe_title = RecipeTitle.find(params[:id])\n end", "def save\n if id\n update(title: title, description: description, file: file)\n else\n new_instance = self.class.create(sys[:space].id, fields: instance_variable_get(:@fields))\n refresh_data(new_instance)\n end\n end", "def create\n @title = Title.new(title_params)\n\n if @title.save\n redirect_to edit_title_path(@title), :flash => { :success => t('titles.titles') + \" \"+ t('commons.create_success')}\n else\n render :new, status: :unprocessable_entity\n end\n\n end", "def create\n @title = @medium.titles.new(title_params)\n @title.creator = current_user.person\n respond_to do |format|\n if @title.save\n flash[:notice] = ts('new.successful', :what => Title.model_name.human.capitalize)\n format.html { redirect_to edit_medium_url(@medium, :anchor => 'titles') }\n format.xml { render :xml => @title, :status => :created, :location => medium_title_url(@medium, @title) }\n else\n @languages = ComplexScripts::Language.order('title')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @title.errors, :status => :unprocessable_entity }\n end\n end\n end", "def import_to\n begin\n study = Study.find(params[:study_id])\n \n unless study.user_id != session[:user_id] || study.active == true\n sparql = SPARQL::Client.new(\"http://dbpedia.org/sparql\")\n \n category = params[:category_name].gsub ' ', '_'\n \n items = sparql.query(\"SELECT ?name ?description ?link ?image\n WHERE {\n ?name <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:#{category}> .\n ?name <http://www.w3.org/2000/01/rdf-schema#comment> ?description . \n ?name <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?link .\n ?name <http://xmlns.com/foaf/0.1/depiction> ?image .\n FILTER (LANG(?description) = 'en')\n }\")\n \n unless items.size < 1\n items.each do |item|\n description = item[:description].to_s\n link = item[:link].to_s\n image = item[:image].to_s\n \n name = link.split(\"\\n\").grep(/http:\\/\\/en.wikipedia.org\\/wiki\\/(.*)/){$1}[0]\n name = name.gsub '_', ' '\n \n i = Item.new\n i.study_id = params[:study_id]\n i.name = name\n i.description = description\n i.link = link\n i.image = image\n i.save\n end\n end\n \n items = sparql.query(\"SELECT ?name ?description ?link ?image\n WHERE {\n ?name <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:#{category}> .\n ?name <http://www.w3.org/2000/01/rdf-schema#comment> ?description . \n ?name <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?link .\n FILTER (LANG(?description) = 'en')\n }\")\n \n if items.size > 0\n items.each do |item|\n description = item[:description].to_s\n link = item[:link].to_s\n \n name = link.split(\"\\n\").grep(/http:\\/\\/en.wikipedia.org\\/wiki\\/(.*)/){$1}[0]\n name = name.gsub '_', ' '\n \n unless Item.where(name: name).size > 0\n i = Item.new\n i.study_id = params[:study_id]\n i.name = name\n i.description = description\n i.link = link\n i.save\n end\n end\n else\n flash[:error] = \"Please enter a valid Wikipedia category.\"\n end\n end\n rescue\n \n ensure\n redirect_to(edit_study_path(params[:study_id]))\n end\n end", "def set_title_and_description\n \t\tresp = get_resp(self.url)\n \t\tself.title = resp.match(/<title>(.+)<\\/title>/)[1]\n \t\tself.description = resp.match(/<meta name=\"description\" content=\"([^\\\"]*)/)[1]\n \t\tself.save!\n \tend", "def by_title(title)\n Categories::Finder.by_title(title)\n end", "def title\n \n title = \"Cutlist for: #{@model.title}\"\n \n puts \"[Cutlist.title]: #{title}\" if $cutlister_debug\n \n title\n \n end", "def title_fields\n %i[dc_title]\n end", "def title_exist(title)\n \n if Title.find_by(name: title) == nil\n Title.create(name: title)\n end\n (Title.find_by name: title).id\nend", "def car_title(title_text,model_text)\n\ttitle = title_text.strip!\n\ttitle = title.gsub(model_text, \"\")\n\treturn title\nend", "def set_model\n @model = Response.find(params[:id])\n end", "def title\n model.name.titleize\n end", "def set_description\n @company = Company.find(params[:company_id])\n @description = @company.description\n end", "def creat_discipline(json)\n # Create Discipline\n discipline = Discipline.new(:name => json[\"disciplin\"], :year => \"1.1.2013\")\n # save query in vars for Discipline joins\n sp = Sport.find_by_name(json[\"disc_group\"])\n cat = Category.find_by_name(json[\"category\"])\n ge = Gender.find_by_sex(json[\"gender\"])\n # when no unit set\n if json[\"req_unit\"].nil?\n un = Unit.find_by_name(\"bestanden\")\n else\n un = Unit.find_by_name(json[\"req_unit\"])\n end\n # joins Diciplines\n sp.disciplines << discipline\n cat.disciplines << discipline\n un.disciplines << discipline\n ge.disciplines << discipline\n # save Discipline\n discipline.save\nend", "def update\n @title = Title.find(params[:id])\n respond_to do |format|\n if @title.update_attributes(title_params)\n flash[:notice] = ts('edit.successful', :what => Title.model_name.human.capitalize)\n format.html { redirect_to edit_medium_url(@medium, :anchor => 'titles') }\n format.xml { head :ok }\n else\n @languages = ComplexScripts::Language.all.order('title')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @title.errors, :status => :unprocessable_entity }\n end\n end\n end", "def run\n super\n\n # Attach to the corpwatch service & search\n x = Client::Corpwatch::CorpwatchService.new\n corps = x.search @entity.name\n\n corps.each do |corp|\n # Create a new organization entity & attach a record\n o = create_entity Entities::Organization, { \n :name => corp.name, \n :data => corp.to_s\n }\n \n create_entity(Entities::PhysicalLocation, {\n :name => corp.address,\n :address => corp.address, \n :state => corp.state,\n :country => corp.country }\n )\n end\nend", "def update!(**args)\n @attribution_model = args[:attribution_model] if args.key?(:attribution_model)\n @data_driven_model_status = args[:data_driven_model_status] if args.key?(:data_driven_model_status)\n end", "def perform(data)\n title = ''\n res = Faraday.get(data[:url])\n substr = res.body.scan(/<title>.+<\\/title>/i)\n if substr.length > 0\n substr = substr[0].downcase\n title = substr.gsub(\"<title>\", \"\").gsub(\"</title>\", \"\")\n else\n title = 'No Title Located'\n end\n DB[:url_mappings].where(id: data[:id]).update(title: title)\n end", "def create\n @title = Title.new(title_params)\n\n if @title.save\n render json: @title, status: :created, location: @title\n else\n render json: @title.errors, status: :unprocessable_entity\n end\n end", "def create\n search_term = params[\"query\"][\"search_term\"]\n results = api_request_results(search_term)\n\n #movie = OwnedMovie.create(title: response[\"title\"], poster: response[\"poster_path\"], description: response[\"overview\"])\n\n #movie.save!\n\n results.each do |result|\n print result['title'] + \"\\n\"\n end \n\n @results = results\n\n\n redirect_to \"/\"\n end", "def find_content content_title\n self.content_title_field = content_title\n apply\n end", "def get_development_application(page, da_container)\n\n #Get detail page of da\n\n detail_page = get_da_detail_page(page, da_container)\n\n \n\n #Get da summary\n\n da_summary = get_da_summary(page, da_container, detail_page)\n\n \n\n #Create a record that includes da_summary and detail_page to save to the database\n\n record = da_summary\n\n record['page_content'] = detail_page.body.to_s.force_encoding('utf-8')\n\n \n\n #Save record to database\n\n save_record_to_database(record)\n\nend", "def get_development_application(page, da_container)\n\n #Get detail page of da\n\n detail_page = get_da_detail_page(page, da_container)\n\n \n\n #Get da summary\n\n da_summary = get_da_summary(page, da_container, detail_page)\n\n \n\n #Create a record that includes da_summary and detail_page to save to the database\n\n record = da_summary\n\n record['page_content'] = detail_page.body.to_s.force_encoding('utf-8')\n\n \n\n #Save record to database\n\n save_record_to_database(record)\n\nend", "def create\n @title = Title.new(params[:title])\n if @title.save\n @titles = Title.order(\"created_at DESC\").all\n flash[:notice] = \"You've created a new title!\"\n render 'results'\n else\n @title.errors.each do |attribute, errors_array|\n field_errors = attribute.to_s + \" \" + errors_array\n flash[:error] = field_errors\n end\n @titles = Title.all\n render 'titles/search.js.erb'\n #format.json { render :json => @issue.errors, :status => :unprocessable_entity }\n end\n end", "def by_title(title)\n Products::Categories::Finder.by_title(title)\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def update\n respond_to do |format|\n if @title.update(title_params)\n format.html { redirect_to titles_url(search: @title.title), notice: 'Title was successfully updated.' }\n format.json { render :show, status: :ok, location: @title }\n else\n format.html { render :edit }\n format.json { render json: @title.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def ctitle(title)\n self.title = title\n end", "def show\n @title = @company.titles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @title }\n end\n end", "def freebase\n require 'net/http'\n begin\n @movie = Movie.find(params[:id])\n \n # if we get a slug, we update the row\n if params[:freebase_slug]\n @movie.update_attribute('freebase', params[:freebase_slug])\n end\n \n # TODO : put that in model\n url = 'http://www.freebase.com/experimental/topic/standard' + @movie.freebase\n resp = Net::HTTP.get_response( URI.parse(url) )\n json = JSON.parse(resp.body)\n @result = json['result']\n raise unless @result\n\n # see example of json to parse : http://www.freebase.com/experimental/topic/standard/m/09k56b7\n @movie.alt_title = @result['text']\n @movie.country = @result['properties']['/film/film/country']['values'][0]['text']\n @movie.body = @result['description']\n @movie.genre_list = @result['properties']['/film/film/genre']['values'].map{|g| g['text']} #.join(',')\n @movie.year = @result['properties']['/film/film/initial_release_date']['values'][0]['value'].split('-')[0]\n @movie.director = @result['properties']['/film/film/directed_by']['values'].map{|g| g['text']}.join(', ')\n @movie.cast = @result['properties']['/film/film/starring']['values'].map{|g| g['text'].split('-')[0].rstrip}.join(', ')\n \n @result['webpage'].each{|p|\n @movie.url_imdb = p['url'] if p['text'] == 'IMDB Title Page'\n @movie.apple_url = p['url'] if p['url'] =~ /trailers\\.apple\\.com/i\n @movie.youtube_url = p['url'] if p['text'] =~ /youtube/i\n @movie.wikipedia_url = p['url'] if p['text'] == 'Wikipedia'\n }\n\n if params[:save]=='true'\n @movie.save\n redirect_to(@movie, :notice => 'Data updated with ' + url)\n return\n end\n \n=begin\n if @movie.freebase\n # its way better to have the code\n slug = '/m/' + @movie.freebase.split('/').last\n else\n slug = '/en/' + @movie.title.rstrip.gsub(/\\s/,'_').downcase\n end\n @resource = Ken.get(slug)\n raise if @resource.nil?\n @movie.director = @resource.attribute('/film/film/directed_by') unless @movie.director\n @movie.year = @resource.attribute('/film/film/initial_release_date').to_s.split('-').first\n @movie.country = @resource.attribute('/film/film/country').to_s.split(/\\n/).first\n @movie.plot = @resource.attribute('/film/film/tagline')\n \n puts @resource.attribute('/film/film/initial_release_date').to_s.split('-').first\n puts @resource.attribute('/film/film/country')\n puts @resource.attribute('/film/film/tagline')\n #render 'edit'\n=end\n #rescue\n # redirect_to(@movie, :notice => 'No data found on Freebase, you could change freebase code : ' + @movie.freebase)\n end \n end", "def set_entidade\n @entidade = Entidade.find(params[:id])\n @title = @entidade.nome\n end", "def create_search\n\t\t@search = Search.where(:search_id => self.id,:search_model => self.class.name).first\n\t\tunless @search.present?\n\t\t\t@search = Search.new\n\t\t\t@search.name = self.name\n\t\t\t@search.search_id = self.id\n\t\t\t@search.search_model = self.class.name\n\t\t\t@search.save!\n\t\telse\n\t\t\t@search.name = self.name\n\t\t\t@search.save!\n\t\tend\n\tend", "def perform\n params = Hash.new\n db = Mdb.open('/myapp/cotizaC.mdb')\n #db = Mdb.open(ruta absoluta)\n scs = db[:sc]\n scs.each do |row|\n #p Sc.all\n if Sc.where(:siv_id => row[:numsiv]).empty?\n p \"VERDADERO\"\n params[:siv_id] = row[:numsiv]\n params[:qad_id] = row[:codigoqad]#row[:numqad]\n params[:rut] = row[:rutc]\n params[:client_name] = row[:cliente]\n params[:name] = row[:producto]\n params[:sku] = row[:sku]\n params[:umx] = row[:umx]\n params[:siv_code] = row[:codigoqad]\n params[:kind] = row[:tipoxx]\n params[:sub_kind] = row[:subtipoxx]\n params[:materials] = row[:materiales]\n params[:structure] = row[:estructurap]\n params[:fechacreacion] = row[:fechacrea]\n params[:fechaval] = row[:fechaval]\n Sc.create(params)\n end\n end\n end", "def create_proper_content_model_with_selections\n results = true\n\n print \"[Start] Creating Full ContentProfile Data Model: \"\n Rails.logger.info \"#{self.class.name}##{__method__}(START) Creating Full ContentProfile Data Model.\"\n ## Begin Good Work\n\n ContentType.create!([\n {name: \"Experience\", description: \"Monthly Experience Reports and Files\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"1\" => {value: \"*.pdf\", type_name: \"Experience\", description: \"Document store Experience PDF Type\" }}\n },\n {name: \"Commission\", description: \"Monthly Commission Reports and Files\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"0\" => {value: \"*.pdf\", type_name: \"Commission\", description: \"Document store Commision Document Type ID\" },\n \"1\" => {value: \"*.csv\", type_name: \"Commission\", description: \"Document store Commision CSV Document Type ID\" } }\n },\n {name: \"Notification\", description: \"Email Notification of Related Events\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"0\" => {value: \"AdvCancel\", type_name: \"Notification\", description: \"Advance Cancel\" },\n \"1\" => {value: \"FutCancel\", type_name: \"Notification\", description: \"Future Cancel\" },\n \"2\" => {value: \"Cancel\", type_name: \"Notification\", description: \"Cancel\" } }\n },\n {name: \"LicensedStates\", description: \"Business Operational Metric\", value_data_type: \"Integer\",\n content_type_opts_attributes: {\n \"0\"=>{:value=>\"54\", :type_name=>\"LicensedStates\", :description=>\"Alaska\"},\n \"1\"=>{:value=>\"1\", :type_name=>\"LicensedStates\", :description=>\"Alabama\"},\n \"2\"=>{:value=>\"3\", :type_name=>\"LicensedStates\", :description=>\"Arkansas\"},\n \"3\"=>{:value=>\"2\", :type_name=>\"LicensedStates\", :description=>\"Arizona\"},\n \"4\"=>{:value=>\"4\", :type_name=>\"LicensedStates\", :description=>\"California\"},\n \"5\"=>{:value=>\"5\", :type_name=>\"LicensedStates\", :description=>\"Colorado\"},\n \"6\"=>{:value=>\"6\", :type_name=>\"LicensedStates\", :description=>\"Connecticut\"},\n \"7\"=>{:value=>\"8\", :type_name=>\"LicensedStates\", :description=>\"Washington Dc\"},\n \"8\"=>{:value=>\"7\", :type_name=>\"LicensedStates\", :description=>\"Delaware\"},\n \"9\"=>{:value=>\"9\", :type_name=>\"LicensedStates\", :description=>\"Florida\"},\n \"10\"=>{:value=>\"10\", :type_name=>\"LicensedStates\", :description=>\"Georgia\"},\n \"11\"=>{:value=>\"52\", :type_name=>\"LicensedStates\", :description=>\"Hawaii\"},\n \"12\"=>{:value=>\"14\", :type_name=>\"LicensedStates\", :description=>\"Iowa\"},\n \"13\"=>{:value=>\"11\", :type_name=>\"LicensedStates\", :description=>\"Idaho\"},\n \"14\"=>{:value=>\"12\", :type_name=>\"LicensedStates\", :description=>\"Illinois\"},\n \"15\"=>{:value=>\"13\", :type_name=>\"LicensedStates\", :description=>\"Indiana\"},\n \"16\"=>{:value=>\"15\", :type_name=>\"LicensedStates\", :description=>\"Kansas\"},\n \"17\"=>{:value=>\"16\", :type_name=>\"LicensedStates\", :description=>\"Kentucky\"},\n \"18\"=>{:value=>\"17\", :type_name=>\"LicensedStates\", :description=>\"Louisiana\"},\n \"19\"=>{:value=>\"20\", :type_name=>\"LicensedStates\", :description=>\"Massachusetts\"},\n \"20\"=>{:value=>\"19\", :type_name=>\"LicensedStates\", :description=>\"Maryland\"},\n \"21\"=>{:value=>\"18\", :type_name=>\"LicensedStates\", :description=>\"Maine\"},\n \"22\"=>{:value=>\"21\", :type_name=>\"LicensedStates\", :description=>\"Michigan\"},\n \"23\"=>{:value=>\"22\", :type_name=>\"LicensedStates\", :description=>\"Minnesota\"},\n \"24\"=>{:value=>\"24\", :type_name=>\"LicensedStates\", :description=>\"Missouri\"},\n \"25\"=>{:value=>\"23\", :type_name=>\"LicensedStates\", :description=>\"Mississippi\"},\n \"26\"=>{:value=>\"25\", :type_name=>\"LicensedStates\", :description=>\"Montana\"},\n \"27\"=>{:value=>\"32\", :type_name=>\"LicensedStates\", :description=>\"North Carolina\"},\n \"28\"=>{:value=>\"33\", :type_name=>\"LicensedStates\", :description=>\"North Dakota\"},\n \"29\"=>{:value=>\"26\", :type_name=>\"LicensedStates\", :description=>\"Nebraska\"},\n \"30\"=>{:value=>\"28\", :type_name=>\"LicensedStates\", :description=>\"New Hampshire\"},\n \"31\"=>{:value=>\"29\", :type_name=>\"LicensedStates\", :description=>\"New Jersey\"},\n \"32\"=>{:value=>\"30\", :type_name=>\"LicensedStates\", :description=>\"New Mexico\"},\n \"33\"=>{:value=>\"27\", :type_name=>\"LicensedStates\", :description=>\"Nevada\"},\n \"34\"=>{:value=>\"31\", :type_name=>\"LicensedStates\", :description=>\"New York\"},\n \"35\"=>{:value=>\"34\", :type_name=>\"LicensedStates\", :description=>\"Ohio\"},\n \"36\"=>{:value=>\"35\", :type_name=>\"LicensedStates\", :description=>\"Oklahoma\"},\n \"37\"=>{:value=>\"36\", :type_name=>\"LicensedStates\", :description=>\"Oregon\"},\n \"38\"=>{:value=>\"37\", :type_name=>\"LicensedStates\", :description=>\"Pennsylvania\"},\n \"39\"=>{:value=>\"38\", :type_name=>\"LicensedStates\", :description=>\"Rhode Island\"},\n \"40\"=>{:value=>\"39\", :type_name=>\"LicensedStates\", :description=>\"South Carolina\"},\n \"41\"=>{:value=>\"40\", :type_name=>\"LicensedStates\", :description=>\"South Dakota\"},\n \"42\"=>{:value=>\"41\", :type_name=>\"LicensedStates\", :description=>\"Tennessee\"},\n \"43\"=>{:value=>\"42\", :type_name=>\"LicensedStates\", :description=>\"Texas\"},\n \"44\"=>{:value=>\"43\", :type_name=>\"LicensedStates\", :description=>\"Utah\"},\n \"45\"=>{:value=>\"45\", :type_name=>\"LicensedStates\", :description=>\"Virginia\"},\n \"46\"=>{:value=>\"44\", :type_name=>\"LicensedStates\", :description=>\"Vermont\"},\n \"47\"=>{:value=>\"46\", :type_name=>\"LicensedStates\", :description=>\"Washington\"},\n \"48\"=>{:value=>\"48\", :type_name=>\"LicensedStates\", :description=>\"Wisconsin\"},\n \"49\"=>{:value=>\"47\", :type_name=>\"LicensedStates\", :description=>\"West Virginia\"},\n \"50\"=>{:value=>\"49\", :type_name=>\"LicensedStates\", :description=>\"Wyoming\"},\n \"51\"=>{:value=>\"58\", :type_name=>\"LicensedStates\", :description=>\"Puerto Rico\"},\n \"52\"=>{:value=>\"81\", :type_name=>\"LicensedStates\", :description=>\"A F Americas\"},\n \"53\"=>{:value=>\"82\", :type_name=>\"LicensedStates\", :description=>\"A F Europe\"},\n \"54\"=>{:value=>\"83\", :type_name=>\"LicensedStates\", :description=>\"A F Pacific\"},\n \"55\"=>{:value=>\"84\", :type_name=>\"LicensedStates\", :description=>\"American Samoa\"},\n \"56\"=>{:value=>\"85\", :type_name=>\"LicensedStates\", :description=>\"Micronesia\"},\n \"57\"=>{:value=>\"86\", :type_name=>\"LicensedStates\", :description=>\"Guam\"},\n \"58\"=>{:value=>\"87\", :type_name=>\"LicensedStates\", :description=>\"Marshall Isl\"},\n \"59\"=>{:value=>\"88\", :type_name=>\"LicensedStates\", :description=>\"N Mariana Isl\"},\n \"60\"=>{:value=>\"89\", :type_name=>\"LicensedStates\", :description=>\"Palau\"},\n \"61\"=>{:value=>\"99\", :type_name=>\"LicensedStates\", :description=>\"Not Found\"} }\n },\n {name: \"Activity\", description: \"Partner Relationship Reports\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"0\" => {value: \"*.pdf\", type_name: \"Activity\", description: \"Document store Project Status Report Document Type ID\"}\n }\n },\n {name: \"FileDownload\", description: \"Project Related Resources\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"0\" => {value: \"*.png\", type_name: \"FileDownload\", description: \"Project Related by Document Type PNG\"},\n \"1\" => {value: \"*.jpg\", type_name: \"FileDownload\", description: \"Project Related by Document Type JPEG\"},\n \"2\" => {value: \"*.pdf\", type_name: \"FileDownload\", description: \"Project Related by Document Type PDF\"},\n \"3\" => {value: \"*.log\", type_name: \"FileDownload\", description: \"Project Related by Document Type LOG\"}\n }\n }\n ])\n\n TopicType.create!([\n {name: \"Branch\", description: \"Branch Actions for a specific branch\", value_based_y_n: \"N\",\n topic_type_opts_attributes: {\n \"0\" => {value: \"0034\", type_name: \"Branch\", description: \"South Branch Number\"},\n \"1\" => {value: \"0037\", type_name: \"Branch\", description: \"North Branch Number\"},\n \"2\" => {value: \"0040\", type_name: \"Branch\", description: \"West Branch Number\"} }\n },\n {name: \"Partner\", description: \"This Corporate Account\", value_based_y_n: \"N\",\n topic_type_opts_attributes: {\n \"0\" => {value: \"0099\", type_name: \"Partner\", description: \"Skoona Consulting\"}}\n },\n {name: \"UserGroups\", description: \"Shared access to project working files\", value_based_y_n: \"N\",\n topic_type_opts_attributes: {\n \"0\" => {value: \"Manager\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"1\" => {value: \"EmployeePrimary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"2\" => {value: \"EmployeeSecondary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"3\" => {value: \"VendorPrimary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"4\" => {value: \"VendorSecondary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"5\" => {value: \"BranchPrimary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"6\" => {value: \"BranchSecondary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"7\" => {value: \"Developer\", type_name: \"UserGroups\", description: \"Project Workfiles\"}\n }\n }\n ])\n\n cpe_developer = []\n [\n ['Experience', ['*.pdf'], 'Branch', ['0034'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0034'], 'Access Branch Commission PDF Files'],\n ['Notification', ['AdvCancel'], 'Branch', ['0034'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['21'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['LicensedStates', ['12'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['LicensedStates', ['13'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['Activity', ['*.pdf'], 'Partner', ['0099'], 'Partner Relationship Reports'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0037'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0037'], 'Access Branch Commission CSV Files'],\n ['Notification', ['Cancel'], 'Branch', ['0037'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['34'], 'Branch', ['0037'], 'Licensed to operate in state'],\n ['LicensedStates', ['37'], 'Branch', ['0037'], 'Licensed to operate in state'],\n ['LicensedStates', ['31'], 'Branch', ['0037'], 'Licensed to operate in state'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0040'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0040'], 'Access Branch Commission PDF Files'],\n ['Notification', ['FutCancel'], 'Branch', ['0040'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['24'], 'Branch', ['0040'], 'Licensed to operate in state'],\n ['LicensedStates', ['14'], 'Branch', ['0040'], 'Licensed to operate in state'],\n ['LicensedStates', ['3'], 'Branch', ['0040'], 'Licensed to operate in state'],\n\n ['FileDownload', ['*.pdf'], 'UserGroups', ['Developer'], 'Shared access to project working files'],\n ['FileDownload', ['*.png'], 'UserGroups', ['Developer'], 'Shared access to project working files'],\n ['FileDownload', ['*.jpg'], 'UserGroups', ['Developer'], 'Shared access to project working files'],\n ['FileDownload', ['*.log'], 'UserGroups', ['Developer'], 'Shared access to project working files']\n\n ].each do |req|\n cchoice = selections_choose_for(req[1], selections_for_content_type(req[0], true))\n tchoice = selections_choose_for(req[3], selections_for_topic_type(req[2], true))\n cpe_developer << create_content_profile_entry_for(req.last, tchoice, cchoice)\n end\n\n cpe_primary = []\n [\n ['Experience', ['*.pdf'], 'Branch', ['0034'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0034'], 'Access Branch Commission PDF Files'],\n ['Notification', ['AdvCancel'], 'Branch', ['0034'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['21'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['LicensedStates', ['12'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['LicensedStates', ['13'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['Activity', ['*.pdf'], 'Partner', ['0099'], 'Partner Relationship Reports'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0037'], 'Branch Experience Statements'],\n ['Commission', ['*.csv'], 'Branch', ['0037'], 'Access Branch Commission CSV Files'],\n ['Notification', ['Cancel'], 'Branch', ['0037'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['34'], 'Branch', ['0037'], 'Licensed to operate in state'],\n ['LicensedStates', ['37'], 'Branch', ['0037'], 'Licensed to operate in state'],\n ['LicensedStates', ['31'], 'Branch', ['0037'], 'Licensed to operate in state'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0040'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0040'], 'Access Branch Commission PDF Files'],\n ['Notification', ['FutCancel'], 'Branch', ['0040'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['24'], 'Branch', ['0040'], 'Licensed to operate in state'],\n ['LicensedStates', ['14'], 'Branch', ['0040'], 'Licensed to operate in state'],\n ['LicensedStates', ['3'], 'Branch', ['0040'], 'Licensed to operate in state'],\n\n ['FileDownload', ['*.pdf'], 'UserGroups', ['EmployeePrimary'], 'Shared access to project working files'],\n ['FileDownload', ['*.png'], 'UserGroups', ['EmployeePrimary'], 'Shared access to project working files'],\n ['FileDownload', ['*.jpg'], 'UserGroups', ['EmployeePrimary'], 'Shared access to project working files'],\n ['FileDownload', ['*.log'], 'UserGroups', ['EmployeePrimary'], 'Shared access to project working files']\n\n ].each do |req|\n cchoice = selections_choose_for(req[1], selections_for_content_type(req[0], true))\n tchoice = selections_choose_for(req[3], selections_for_topic_type(req[2], true))\n cpe_primary << create_content_profile_entry_for(req.last, tchoice, cchoice)\n end\n\n cpe_sec = []\n [\n ['Experience', ['*.pdf'], 'Branch', ['0034'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0034'], 'Access Branch Commission PDF Files'],\n ['Notification', ['AdvCancel'], 'Branch', ['0034'], 'Notify Branch of Policy Events'],\n ['Activity', ['*.pdf'], 'Partner', ['0099'], 'Partner Relationship Reports'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0040'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0040'], 'Access Branch Commission PDF Files'],\n ['Notification', ['FutCancel'], 'Branch', ['0040'], 'Notify Branch of Policy Events'],\n\n ['FileDownload', ['*.pdf'], 'UserGroups', ['EmployeeSecondary'], 'Shared access to project working files'],\n ['FileDownload', ['*.pdf'], 'UserGroups', ['BranchPrimary'], 'Shared access to project working files']\n\n ].each do |req|\n cchoice = selections_choose_for(req[1], selections_for_content_type(req[0], true))\n tchoice = selections_choose_for(req[3], selections_for_topic_type(req[2], true))\n cpe_sec << create_content_profile_entry_for(req.last, tchoice, cchoice)\n end\n\n cpe_vendor = []\n [\n ['Activity', ['*.pdf'], 'Partner', ['0099'], 'Partner Relationship Reports'],\n ['FileDownload', ['*.log'], 'UserGroups', ['VendorPrimary'], 'Shared access to project working files']\n\n ].each do |req|\n cchoice = selections_choose_for(req[1], selections_for_content_type(req[0], true))\n tchoice = selections_choose_for(req[3], selections_for_topic_type(req[2], true))\n cpe_vendor << create_content_profile_entry_for(req.last, tchoice, cchoice)\n end\n\n # loop thru users\n res = Secure::UserProfile.page_users.each do |u|\n next if u.user_options.empty? or u.user_options.include?(\"VendorSecondary\")\n\n cp = create_content_profile_for(u, u.assigned_groups.first)\n\n entries = case u.assigned_groups.first\n when 'Developer'\n cpe_developer\n when 'Manager', 'EmployeePrimary'\n cpe_primary\n when 'EmployeeSecondary', 'BranchPrimary'\n cpe_sec\n else\n cpe_vendor\n end\n\n assign_content_profile_entry_to(cp, entries)\n\n end\n\n\n ## End Good Work\n puts \"[Success!]\"\n Rails.logger.info \"#{self.class.name}##{__method__}(SUCCESS) Creating Full ContentProfile Data Model.\"\n results\n rescue Exception => e\n Rails.logger.error \"#{self.class.name}.#{__method__}(FAILED) Creating Full ContentProfile Data Model; Klass: #{e.class.name}, Cause: #{e.message} #{e.backtrace[0..4]}\"\n puts \"[Failed!]\"\n false\n end" ]
[ "0.55922514", "0.55852306", "0.55035514", "0.5496427", "0.54549944", "0.5409511", "0.5382595", "0.53744924", "0.5301359", "0.5301359", "0.5301359", "0.5301359", "0.5301359", "0.52581793", "0.52512264", "0.5244808", "0.5237615", "0.52089113", "0.51761216", "0.51709807", "0.5087033", "0.5075584", "0.5062992", "0.5055137", "0.50499725", "0.50361925", "0.5030608", "0.50023776", "0.50023776", "0.50019425", "0.49947613", "0.49903747", "0.49658218", "0.49621132", "0.49428076", "0.49406627", "0.49374557", "0.49213317", "0.49199036", "0.49078655", "0.48922208", "0.48904306", "0.48875248", "0.4880547", "0.48752397", "0.48749435", "0.48747817", "0.4872542", "0.48652363", "0.4856944", "0.48559123", "0.4849986", "0.48484936", "0.4848085", "0.48409176", "0.48409176", "0.48345605", "0.48342553", "0.48312056", "0.48283207", "0.48263985", "0.4825825", "0.48185414", "0.48167652", "0.48163554", "0.48157424", "0.48139784", "0.48121142", "0.48120952", "0.48060992", "0.48041478", "0.47881946", "0.47878224", "0.47812104", "0.47810048", "0.47809306", "0.4780623", "0.4775435", "0.47730705", "0.47719413", "0.47716236", "0.47716236", "0.4769867", "0.47549063", "0.47530663", "0.47530663", "0.47530663", "0.47530663", "0.47530663", "0.47530663", "0.47527406", "0.47523707", "0.47523707", "0.4752135", "0.47402725", "0.4739448", "0.47351995", "0.4734813", "0.4734396", "0.47335625" ]
0.6131278
0
fetch details and create/update model for a particular DC title
def fetch_title_marvel(publisher, title, url, date = nil) log("retrieving title information for [#{title}]", :debug) doc = Hpricot(open(url)) display_description = (doc/"font[@class=plain_text]").innerHTML title = RubyPants.new(title, -1).to_html display_name, display_number = title.split('#') display_name = check_title(display_name) display_number = display_number.split(' ')[0] unless display_number.nil? new_record = false if display_number.nil? # SoloBook model = SoloBook.find_by_name(display_name) if model.nil? model = SoloBook.new(:name => display_name, :publisher => publisher) new_record = true end else # Episode series = Series.find_by_name(display_name) if series.nil? # Series doesn't exist, create new Series series = Series.create!(:name => display_name, :publisher => publisher) log("created new series [#{display_name}]", :info) model = series.episodes.build({ :number => display_number }) new_record = true else # Add episode to existing series if series.find_episode(display_number).nil? model = series.episodes.build({ :number => display_number }) new_record = true else model = series.find_episode(display_number) end end end display_talent, display_description = display_description.split("<strong>THE STORY:</strong>") display_description ||= "" # if description was empty make sure it's non-nil display_description = display_description.split("<strong>PRICE:</strong>")[0] model.talent = html2text(display_talent).strip.titleize model.description = html2text(display_description).strip model.published_on = date model.save! new_record ? log("created new book [#{title}]", :info) : log("updated existing book [#{title}]", :debug) if model.cover_image.nil? # get cover image (if we don't have one already) image_element = (doc/"img").select { |elem| elem.attributes['src'].match(/thumb/) } image_url = nil unless image_element.empty? image_url = image_element[0].attributes['src'] image_url = "#{URL_Marvel}#{image_element[0].attributes['src'].gsub('_thumb', '_full')}" # full size art end get_cover_image(model, image_url) end rescue ActiveRecord::RecordInvalid => e log("failed to create book [#{title}]", :info) log("errors: #{model.errors.full_messages.join(', ')}", :info) return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_title_dc(publisher, title, url, date = nil)\n log(\"retrieving title information for [#{title}]\", :debug)\n doc = Hpricot(open(url))\n \n # span.display_talent = \"Written by, Art by... \"\n # span.display_copy = \"A final confrontation pits...\"\n # span.display_data = \"DC Universe &nbsp;|&nbsp;32pg. &nbsp;|&nbsp;&nbsp;Color &nbsp;|&nbsp;&nbsp;$2.99&nbsp;US\"\n # span.display_copy = \"On sale June 6, 2007\"\n \n display_talent = ((doc/\"#content-col2\")/\"p:first strong\").innerHTML\n display_copy = (doc/\"#content-col2\").innerHTML\n display_date = ((doc/\"#content-col2\")/\"p:last\").innerHTML\n \n title = RubyPants.new(title, -1).to_html\n display_name, display_number = title.split('#')\n display_name = check_title(display_name)\n display_number = display_number.split(' ')[0] unless display_number.nil?\n \n new_record = false\n \n if display_number.nil?\n # SoloBook\n model = SoloBook.find_by_name(display_name) \n\n if model.nil?\n model = SoloBook.new(:name => display_name, \n :publisher => publisher)\n new_record = true\n end\n \n else\n # Episode\n series = Series.find_by_name(display_name)\n \n if series.nil?\n # Series doesn't exist, create new Series\n series = Series.create!(:name => display_name, \n :publisher => publisher)\n log(\"created new series [#{display_name}]\", :info)\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n # Add episode to existing series\n if series.find_episode(display_number).nil?\n model = series.episodes.build({ :number => display_number })\n new_record = true\n else\n model = series.find_episode(display_number)\n end\n end\n end\n \n model.talent = html2text(display_talent)\n model.description = html2text(display_copy)\n model.published_on = Date.parse(display_date.downcase.sub('on sale', '').gsub(/\\s+/, ' ').strip)\n \n model.save!\n new_record ? log(\"created new book [#{title}]\", :info) : log(\"updated existing book [#{title}]\", :debug)\n \n if model.cover_image.nil?\n # get cover image (if we don't have one already)\n image_element = (doc/\"img\").select { |elem| elem.attributes['src'].match(/media\\/product\\/.*180x270.jpg/) }\n image_url = nil\n\n unless image_element.empty?\n image_url = image_element[0].attributes['src']\n image_url = \"#{URL_DC_Media}#{image_url.gsub(/180x270/,'400x600')}\" # full size art\n end\n\n get_cover_image(model, image_url)\n end\n \n rescue ActiveRecord::RecordInvalid => e\n log(\"failed to create or update book [#{title}]\", :info)\n log(\"errors: #{model.errors.full_messages.join(', ')}\", :info)\n return false\n end", "def update_title\n title_params = { year: params[:year],\n min_bid_reserve: params[:min_bid_reserve],\n pre_accident_value: params[:pre_accident_value],\n buy_now: params[:buy_now],\n sale_doc_application_date: params[:sale_doc_application_date],\n sale_doc_at_copart_date: params[:sale_doc_at_copart_date],\n sale_doc_given_to_buyer_date: params[:sale_doc_given_to_buyer_date] }\n if @vehicle.homeowner_group?\n title_params.merge!(vehicle_description: params[:vehicle_description])\n else\n title_params.merge!(license_plate_num: params[:license_plate_num],\n vehicle_registration_num: params[:vehicle_registration_num],\n registration_certificate_num: params[:registration_certificate_num],\n verify_vehicle_identification_num: params[:verify_vehicle_identification_num],\n ownership_transfer_type_id: params[:ownership_transfer_type].present? ? params[:ownership_transfer_type][:id] : nil,\n original_doc_country_id: params[:original_doc_country].present? ? params[:original_doc_country][:id] : nil,\n original_doc_type_id: params[:original_doc_type].present? ? params[:original_doc_type][:id] : nil,\n documented_odometer_hour: params[:documented_odometer_hour],\n documented_odometer_unit_id: params[:documented_odometer_unit].present? ? params[:documented_odometer_unit][:id] : nil,\n original_odometer_brand_id: params[:original_odometer_brand].present? ? params[:original_odometer_brand][:id] : nil,\n documented_odometer_brand_id: params[:documented_odometer_brand].present? ? params[:documented_odometer_brand][:id] : nil,\n sale_doc_country_id: params[:sale_doc_country].present? ? params[:sale_doc_country][:id] : nil,\n sale_doc_type_id: params[:sale_doc_type].present? ? params[:sale_doc_type][:id] : nil,\n original_doc_state: params[:original_doc_state],\n sale_doc_state: params[:sale_doc_state],\n original_odometer_hour: params[:original_odometer_hour],\n original_odometer_unit_id: params[:original_odometer_unit].present? ? params[:original_odometer_unit][:id] : nil)\n if @vehicle.marine_or_recreational_or_industrial_or_homeowner_group?\n title_params.merge!(custom_make: params[:custom_make],\n custom_model: params[:custom_model], custom_trim: params[:custom_trim])\n end\n end\n # Replace masking value with the original\n title_params.keys.each do |key|\n replace_value = replace_mask_val_with_orginal(key.to_s, @vehicle)\n title_params[key] = replace_value if !replace_value.nil?\n end\n @vehicle.update_attributes(title_params)\n @vehicle.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT,\n I18n.t(\"system_notes.user_activity.ownership_transfer_update\"),\n current_employee, true)\n\n if @vehicle.save\n @vehicle.reload\n respond_to do |format|\n format.html { redirect_to @vehicle }\n format.json { render json: { vehicle: @vehicle.as_json(include_all: \"yes\") }, \n status: :created, \n location: @vehicle }\n end\n else\n logger.info(\"Errors exist: #{@vehicle.errors.messages}\")\n respond_to do |format|\n format.html { render action: :new }\n format.json { render json: { errors: @vehicle.errors }, \n status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity = Entity.find_my_title( entity_params[:title] )\n\n if @entity.nil?\n @entity = Entity.new(entity_params)\n else\n @entity.update(entity_params)\n end\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to '/', notice: 'Entidad creada.' }\n format.json { render action: 'show', status: :created, location: @entity }\n else\n format.html { render action: 'new' }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n if !params[:model][:title].blank?\r\n params[:model][:title] = params[:model][:title].upcase\r\n code = params[:model][:title].delete(' ')[0..8]\r\n params[:model][:code] = code\r\n else\r\n code = Time.now.strftime(\"%Y%d%m%H%M%S\")[0..8]\r\n params[:model][:code] = code\r\n end\r\n\r\n @model = Model.new(model_params)\r\n if @model.save\r\n redirect_to edit_model_path(@model)\r\n else\r\n render :new\r\n end\r\n end", "def load_model(mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_model_info\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n model = Dynamicloud::API::Model::RecordModel.new mid\n model.name = json['name']\n model.description = json['description']\n\n model\n end", "def find_movie_by_title(arg)\n query_response = RestClient.get(\"http://www.omdbapi.com/?t=#{arg}&apikey=a2d3299b\") #query the database\n parsed_response = JSON.parse(query_response) #parse the response into a useable hash\n movie_deets_hash = #extract relevant details from the hash\n {\"Title\" => parsed_response[\"Title\"],\n \"Released\" => parsed_response[\"Released\"].slice(-4..).to_i,\n \"Genre\" => parsed_response[\"Genre\"],\n \"Director\" => parsed_response[\"Director\"]}\n add_movie_to_database(movie_deets_hash) #create a movie_object for the selected movie, if it doesn't already exist\n end", "def start\n @model = params[:model]\n titles = { 'Assignment' => 'Grades', 'CourseParticipant' => 'Course Participants', 'AssignmentTeam' => 'Teams',\n 'CourseTeam' => 'Teams', 'User' => 'Users', 'Question' => 'Questions' }\n @title = titles[@model]\n @id = params[:id]\n end", "def set_title\r\n @title = Title.find(params[:id])\r\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def save_comic(comic_title, u1)\n comic = find_or_create_comic(comic_title)\n find_or_create_reading_list(u1.id, comic.id)\n end", "def set_distro\n if params[:name]\n @distro = Distro.where(:name => params[:name]).first\n else\n @distro = Distro.find(params[:id])\n end\n end", "def update_title\n\t\tday = Day.from_identifier(post_params[:day])\n\t\tdocument = Document.for_user(@user.id, day.year, day.month, day.day).first\n\t\traise \"Unknown document\" unless document\n\t\tdocument.title = post_params[:title]\n\t\tdocument.save!\n\t\trender_ok\n\tend", "def set_model_name\n @model_name = ModelName.find(params[:id])\n end", "def set_detail_model\n @detail_model = DetailModel.find(params[:id])\n end", "def set_name_title\n @name_title = NameTitle.find(params[:id])\n end", "def update_metadata\n Socop::Ontology.parse(DATADIR.join \"ontologies.xml\").each do |ontology|\n if onto_ontology = Ontology.where(repository_id: repository.id, basepath: ontology['abbreviation']).first\n onto_ontology.update_attributes \\\n name: ontology['displayLabel'],\n description: ontology['description']\n end\n end\n end", "def updateTitle(id, title)\n item = Todo.find(id)\n item.title = title\n item.save\nend", "def handle_foreign_key_element(cs, element, new_model)\n # finds the current model matching the single found parameter or creates a new one\n foreign_resource = cs.foreign_data_resource\n\n if element.nil?\n logger.info 'NIL ELEMENT for foreign key'\n return\n end\n\n content_model = foreign_resource.minimal_current_or_new(element.text)\n content_model[:institution_id] = cs.scrape_resource.institution_id\n\n # models for foreign key content must be saved just as any other model, if they existed previously nothing happens\n validate_and_save(content_model)\n # logger.info \"found content_model for selector cs.id: #{content_model.inspect}\"\n new_model.assign_attributes(cs.column_name => content_model.id)\n # category must always be assigned to indicate which foreign resource type is related\n new_model.assign_attributes(category: foreign_resource.resource_type.resource_name)\n end", "def set_saved_title\n @saved_title = SavedTitle.find(params[:id])\n end", "def show\n\n \tbegin\n \t@company = Company.find(COMPANY_ID)\n rescue ActiveRecord::RecordNotFound\n \t@company = Company.create({:description => ''})\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end \n end", "def define_title\n @title = @deal.title\n @description = @deal.title + ' - ' + Deal.i18n_category(@deal.category)\n end", "def fetch_model\n model_name.camelize.constantize.find( params[:id] )\n end", "def create\n @title = Title.new(title_params)\n \n respond_to do |format|\n if @title.save\n format.html { redirect_to titles_url(search: @title.title), notice: 'Title was successfully created.' }\n format.json { render :show, status: :created, location: @title }\n else\n format.html { render :new }\n format.json { render json: @title.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n end", "def save\n if id\n update(name: name, organization_id: organization)\n else\n new_instance = self.class.create(client, name: name, organization_id: organization)\n refresh_data(new_instance)\n end\n end", "def fetch\n if self.rdf_subject.to_s.include?('spar')\n uri = self.rdf_subject.to_s\n xml_url = uri.sub 'https://w3id.org/spar/', 'http://www.sparontologies.net/'\n xml_url.concat('.rdf')\n\n response = RestClient.get xml_url, {accept: :xml}\n xmldoc = Nokogiri::XML(response)\n new_label = xmldoc.at_xpath(\"/rdf:RDF/rdf:Description/rdfs:label/text()\")\n\n self << RDF::Statement.new(rdf_subject, RDF::SKOS.prefLabel, new_label)\n\n persist!\n else\n super\n end\n end", "def title=(title)\n t = Title.new\n t.content = title\n self.dc_titles = [t]\n title\n end", "def set_model\n @model = ClientService.find(params[:id])\n end", "def get_details_from_model(authorname=\"Undefined\")\n file_OK = false\n if @file_data\n begin\n model = T2Flow::Parser.new.parse(@file_data)\n @file_data.rewind\n if !model.nil?\n self.name = model.name\n if model.annotations.titles.join.to_s != \"\"\n self.title = model.annotations.titles.join.to_s\n else\n self.title = \"No title provided\"\n end\n if model.annotations.authors.join.to_s != \"\"\n self.author = model.annotations.authors.join.to_s\n else\n self.author = authorname\n end\n self.description = model.annotations.descriptions.join.to_s\n end\n file_OK = true\n rescue\n file_OK = false\n ensure\n @file_data.rewind\n return file_OK\n end\n end\n end", "def model_title\n model_name.titleize\n end", "def update\n @title = Title.find(params[:id])\n\n if @title.update(title_params)\n head :no_content\n else\n render json: @title.errors, status: :unprocessable_entity\n end\n end", "def update_title( doc_id:, title: )\n send_request :post, \"document/#{@app}/#{doc_id}/title/#{URI.escape title}\", {}, :json\n end", "def new\n @title = Title.new :your_number => @company.drawee_code\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @title }\n end\n end", "def set_title2\n @title2 = Title2.find(params[:id])\n end", "def save\n #see if PID is not yet specified in DC. Note that according the rest of the code, the PID is put in DC when the object is first saved. \n #That means the below expression becomes true only if this is the object is saved first time.\n update_dc_id = get_dc.identifier == \"\"\n \n #Save the object. This generates the PID if this is a new object.\n status = super\n \n dc = get_dc\n if update_dc_id && status\n \n dc.identifier = self.pid\n \n #We need to set up the following field at some point.\n dc.creator = \"TODO\" if dc.creator == \"\"\n dc.created = \"TODO\" if dc.created == \"\"\n \n #Since the DC is updated, let's save the object again.\n status = super \n end\n \n #Return the save status.\n return status\n end", "def update\n @title = Title.find(params[:id])\n if @title.update_attributes(params[:title])\n @titles = Title.all\n flash[:notice] = \"You've updated the title!\"\n render 'results'\n else\n #FIXME\n end\n end", "def find_or_create_by_name(title)\n find_by_name(title) || self.new(title) # + self.save ?\n end", "def save\n update_dc\n super \n end", "def set_description_name\n @trip = Trip.find_by_name(params[:trip_id])\n @folder = @trip.folders.find_by_name(params[:folder_id]) \n @description = @folder.descriptions.find_by_title(params[:id])\n @model_link = \"description\"\n end", "def model(model_type, name, attributes = {})\n if model_exists?(model_type, name)\n get_model(model_type, name)\n else\n put_model(model_type, name, attributes)\n end\n end", "def set_criterion_detail\n @criterion_detail = CriterionDetail.find(params[:id])\n end", "def set_title(new_title, opts={})\n if self.datastreams.has_key?(\"descMetadata\")\n desc_metadata_ds = self.datastreams[\"descMetadata\"]\n if desc_metadata_ds.respond_to?(:title_values)\n desc_metadata_ds.title_values = new_title\n else\n desc_metadata_ds.title = new_title\n end\n end\n end", "def set_model\r\n @model = Model.find(params[:id])\r\n end", "def create_models\n @name = name.singularize.downcase\n @name_plural = @name.pluralize\n @attributes = attributes\n template(\"./templates/model.erb\", \"./models/#{@name}.rb\")\n end", "def set_dispersion\n @dispersion = Dispersion.find(params[:id])\n end", "def set_software_record\n @software_record = SoftwareRecord.find(params[:id])\n end", "def update\n o = Designation.find(params[:id])\n \n if o.update_attributes(:title => params[:title], :desc => params[:desc], \n :note => params[:note])\n render :json => { :success => 1, \n :message => 'Job Title was successfully updated.' }\n \n else\n render :json => DesignationHelper.get_errors(o.errors)\n end\n end", "def update_title\n return if params[:design_id].nil?\n\n @design = Design.find(params[:design_id])\n @design.title = params[:design_title]\n\n respond_to do |format|\n if @design.save\n format.html { redirect_to :back }\n format.js { render template: 'singles/update_title.js.erb' }\n else\n format.html { redirect_to root_path, notice: 'Erro ao atualizar o titulo do design.' }\n end\n end\n end", "def updateItem(id, title, description)\n item = List.find(id)\n item.title = title\n item.description = description\n item.save\n end", "def title\n attributes.fetch(:title)\n end", "def title\n attributes.fetch(:title)\n end", "def quick_create\n @client = (current_user && current_user.has_role?('admin', 'staff')) ? Client.find(params[:client_id]) : current_user\n @listing = params[:id] ? Listing.find(params[:id]) : @client.listings.build(:title => params[:title], :storage_types => 'self storage')\n \n if (@listing.new_record? ? @listing.save(false) : @listing.update_attribute(:title, params[:title]))\n render :json => { :success => true, :data => { :listing_id => @listing.id } }\n else\n render :json => { :success => false, :data => model_errors(@listing) }\n end\n end", "def make_title_searchable\n address = create_title_addressbase_data(@title)\n create_elasticsearch_addressbase_data(address)\n sleep($ELASTICSEARCH_SLEEP.to_f) # elasticsearch changes take a moment\n create_lr_urpn_mapping_data(@title[:lr_uprns])\nend", "def set_recipe_title\n @recipe_title = RecipeTitle.find(params[:id])\n end", "def save\n if id\n update(title: title, description: description, file: file)\n else\n new_instance = self.class.create(sys[:space].id, fields: instance_variable_get(:@fields))\n refresh_data(new_instance)\n end\n end", "def create\n @title = Title.new(title_params)\n\n if @title.save\n redirect_to edit_title_path(@title), :flash => { :success => t('titles.titles') + \" \"+ t('commons.create_success')}\n else\n render :new, status: :unprocessable_entity\n end\n\n end", "def create\n @title = @medium.titles.new(title_params)\n @title.creator = current_user.person\n respond_to do |format|\n if @title.save\n flash[:notice] = ts('new.successful', :what => Title.model_name.human.capitalize)\n format.html { redirect_to edit_medium_url(@medium, :anchor => 'titles') }\n format.xml { render :xml => @title, :status => :created, :location => medium_title_url(@medium, @title) }\n else\n @languages = ComplexScripts::Language.order('title')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @title.errors, :status => :unprocessable_entity }\n end\n end\n end", "def import_to\n begin\n study = Study.find(params[:study_id])\n \n unless study.user_id != session[:user_id] || study.active == true\n sparql = SPARQL::Client.new(\"http://dbpedia.org/sparql\")\n \n category = params[:category_name].gsub ' ', '_'\n \n items = sparql.query(\"SELECT ?name ?description ?link ?image\n WHERE {\n ?name <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:#{category}> .\n ?name <http://www.w3.org/2000/01/rdf-schema#comment> ?description . \n ?name <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?link .\n ?name <http://xmlns.com/foaf/0.1/depiction> ?image .\n FILTER (LANG(?description) = 'en')\n }\")\n \n unless items.size < 1\n items.each do |item|\n description = item[:description].to_s\n link = item[:link].to_s\n image = item[:image].to_s\n \n name = link.split(\"\\n\").grep(/http:\\/\\/en.wikipedia.org\\/wiki\\/(.*)/){$1}[0]\n name = name.gsub '_', ' '\n \n i = Item.new\n i.study_id = params[:study_id]\n i.name = name\n i.description = description\n i.link = link\n i.image = image\n i.save\n end\n end\n \n items = sparql.query(\"SELECT ?name ?description ?link ?image\n WHERE {\n ?name <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:#{category}> .\n ?name <http://www.w3.org/2000/01/rdf-schema#comment> ?description . \n ?name <http://xmlns.com/foaf/0.1/isPrimaryTopicOf> ?link .\n FILTER (LANG(?description) = 'en')\n }\")\n \n if items.size > 0\n items.each do |item|\n description = item[:description].to_s\n link = item[:link].to_s\n \n name = link.split(\"\\n\").grep(/http:\\/\\/en.wikipedia.org\\/wiki\\/(.*)/){$1}[0]\n name = name.gsub '_', ' '\n \n unless Item.where(name: name).size > 0\n i = Item.new\n i.study_id = params[:study_id]\n i.name = name\n i.description = description\n i.link = link\n i.save\n end\n end\n else\n flash[:error] = \"Please enter a valid Wikipedia category.\"\n end\n end\n rescue\n \n ensure\n redirect_to(edit_study_path(params[:study_id]))\n end\n end", "def set_title_and_description\n \t\tresp = get_resp(self.url)\n \t\tself.title = resp.match(/<title>(.+)<\\/title>/)[1]\n \t\tself.description = resp.match(/<meta name=\"description\" content=\"([^\\\"]*)/)[1]\n \t\tself.save!\n \tend", "def by_title(title)\n Categories::Finder.by_title(title)\n end", "def title\n \n title = \"Cutlist for: #{@model.title}\"\n \n puts \"[Cutlist.title]: #{title}\" if $cutlister_debug\n \n title\n \n end", "def title_fields\n %i[dc_title]\n end", "def title_exist(title)\n \n if Title.find_by(name: title) == nil\n Title.create(name: title)\n end\n (Title.find_by name: title).id\nend", "def car_title(title_text,model_text)\n\ttitle = title_text.strip!\n\ttitle = title.gsub(model_text, \"\")\n\treturn title\nend", "def set_model\n @model = Response.find(params[:id])\n end", "def title\n model.name.titleize\n end", "def set_description\n @company = Company.find(params[:company_id])\n @description = @company.description\n end", "def creat_discipline(json)\n # Create Discipline\n discipline = Discipline.new(:name => json[\"disciplin\"], :year => \"1.1.2013\")\n # save query in vars for Discipline joins\n sp = Sport.find_by_name(json[\"disc_group\"])\n cat = Category.find_by_name(json[\"category\"])\n ge = Gender.find_by_sex(json[\"gender\"])\n # when no unit set\n if json[\"req_unit\"].nil?\n un = Unit.find_by_name(\"bestanden\")\n else\n un = Unit.find_by_name(json[\"req_unit\"])\n end\n # joins Diciplines\n sp.disciplines << discipline\n cat.disciplines << discipline\n un.disciplines << discipline\n ge.disciplines << discipline\n # save Discipline\n discipline.save\nend", "def update\n @title = Title.find(params[:id])\n respond_to do |format|\n if @title.update_attributes(title_params)\n flash[:notice] = ts('edit.successful', :what => Title.model_name.human.capitalize)\n format.html { redirect_to edit_medium_url(@medium, :anchor => 'titles') }\n format.xml { head :ok }\n else\n @languages = ComplexScripts::Language.all.order('title')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @title.errors, :status => :unprocessable_entity }\n end\n end\n end", "def run\n super\n\n # Attach to the corpwatch service & search\n x = Client::Corpwatch::CorpwatchService.new\n corps = x.search @entity.name\n\n corps.each do |corp|\n # Create a new organization entity & attach a record\n o = create_entity Entities::Organization, { \n :name => corp.name, \n :data => corp.to_s\n }\n \n create_entity(Entities::PhysicalLocation, {\n :name => corp.address,\n :address => corp.address, \n :state => corp.state,\n :country => corp.country }\n )\n end\nend", "def update!(**args)\n @attribution_model = args[:attribution_model] if args.key?(:attribution_model)\n @data_driven_model_status = args[:data_driven_model_status] if args.key?(:data_driven_model_status)\n end", "def perform(data)\n title = ''\n res = Faraday.get(data[:url])\n substr = res.body.scan(/<title>.+<\\/title>/i)\n if substr.length > 0\n substr = substr[0].downcase\n title = substr.gsub(\"<title>\", \"\").gsub(\"</title>\", \"\")\n else\n title = 'No Title Located'\n end\n DB[:url_mappings].where(id: data[:id]).update(title: title)\n end", "def create\n @title = Title.new(title_params)\n\n if @title.save\n render json: @title, status: :created, location: @title\n else\n render json: @title.errors, status: :unprocessable_entity\n end\n end", "def create\n search_term = params[\"query\"][\"search_term\"]\n results = api_request_results(search_term)\n\n #movie = OwnedMovie.create(title: response[\"title\"], poster: response[\"poster_path\"], description: response[\"overview\"])\n\n #movie.save!\n\n results.each do |result|\n print result['title'] + \"\\n\"\n end \n\n @results = results\n\n\n redirect_to \"/\"\n end", "def find_content content_title\n self.content_title_field = content_title\n apply\n end", "def get_development_application(page, da_container)\n\n #Get detail page of da\n\n detail_page = get_da_detail_page(page, da_container)\n\n \n\n #Get da summary\n\n da_summary = get_da_summary(page, da_container, detail_page)\n\n \n\n #Create a record that includes da_summary and detail_page to save to the database\n\n record = da_summary\n\n record['page_content'] = detail_page.body.to_s.force_encoding('utf-8')\n\n \n\n #Save record to database\n\n save_record_to_database(record)\n\nend", "def get_development_application(page, da_container)\n\n #Get detail page of da\n\n detail_page = get_da_detail_page(page, da_container)\n\n \n\n #Get da summary\n\n da_summary = get_da_summary(page, da_container, detail_page)\n\n \n\n #Create a record that includes da_summary and detail_page to save to the database\n\n record = da_summary\n\n record['page_content'] = detail_page.body.to_s.force_encoding('utf-8')\n\n \n\n #Save record to database\n\n save_record_to_database(record)\n\nend", "def create\n @title = Title.new(params[:title])\n if @title.save\n @titles = Title.order(\"created_at DESC\").all\n flash[:notice] = \"You've created a new title!\"\n render 'results'\n else\n @title.errors.each do |attribute, errors_array|\n field_errors = attribute.to_s + \" \" + errors_array\n flash[:error] = field_errors\n end\n @titles = Title.all\n render 'titles/search.js.erb'\n #format.json { render :json => @issue.errors, :status => :unprocessable_entity }\n end\n end", "def by_title(title)\n Products::Categories::Finder.by_title(title)\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def update\n respond_to do |format|\n if @title.update(title_params)\n format.html { redirect_to titles_url(search: @title.title), notice: 'Title was successfully updated.' }\n format.json { render :show, status: :ok, location: @title }\n else\n format.html { render :edit }\n format.json { render json: @title.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def set_model\n @model = Model.find(params[:id])\n end", "def ctitle(title)\n self.title = title\n end", "def show\n @title = @company.titles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @title }\n end\n end", "def freebase\n require 'net/http'\n begin\n @movie = Movie.find(params[:id])\n \n # if we get a slug, we update the row\n if params[:freebase_slug]\n @movie.update_attribute('freebase', params[:freebase_slug])\n end\n \n # TODO : put that in model\n url = 'http://www.freebase.com/experimental/topic/standard' + @movie.freebase\n resp = Net::HTTP.get_response( URI.parse(url) )\n json = JSON.parse(resp.body)\n @result = json['result']\n raise unless @result\n\n # see example of json to parse : http://www.freebase.com/experimental/topic/standard/m/09k56b7\n @movie.alt_title = @result['text']\n @movie.country = @result['properties']['/film/film/country']['values'][0]['text']\n @movie.body = @result['description']\n @movie.genre_list = @result['properties']['/film/film/genre']['values'].map{|g| g['text']} #.join(',')\n @movie.year = @result['properties']['/film/film/initial_release_date']['values'][0]['value'].split('-')[0]\n @movie.director = @result['properties']['/film/film/directed_by']['values'].map{|g| g['text']}.join(', ')\n @movie.cast = @result['properties']['/film/film/starring']['values'].map{|g| g['text'].split('-')[0].rstrip}.join(', ')\n \n @result['webpage'].each{|p|\n @movie.url_imdb = p['url'] if p['text'] == 'IMDB Title Page'\n @movie.apple_url = p['url'] if p['url'] =~ /trailers\\.apple\\.com/i\n @movie.youtube_url = p['url'] if p['text'] =~ /youtube/i\n @movie.wikipedia_url = p['url'] if p['text'] == 'Wikipedia'\n }\n\n if params[:save]=='true'\n @movie.save\n redirect_to(@movie, :notice => 'Data updated with ' + url)\n return\n end\n \n=begin\n if @movie.freebase\n # its way better to have the code\n slug = '/m/' + @movie.freebase.split('/').last\n else\n slug = '/en/' + @movie.title.rstrip.gsub(/\\s/,'_').downcase\n end\n @resource = Ken.get(slug)\n raise if @resource.nil?\n @movie.director = @resource.attribute('/film/film/directed_by') unless @movie.director\n @movie.year = @resource.attribute('/film/film/initial_release_date').to_s.split('-').first\n @movie.country = @resource.attribute('/film/film/country').to_s.split(/\\n/).first\n @movie.plot = @resource.attribute('/film/film/tagline')\n \n puts @resource.attribute('/film/film/initial_release_date').to_s.split('-').first\n puts @resource.attribute('/film/film/country')\n puts @resource.attribute('/film/film/tagline')\n #render 'edit'\n=end\n #rescue\n # redirect_to(@movie, :notice => 'No data found on Freebase, you could change freebase code : ' + @movie.freebase)\n end \n end", "def set_entidade\n @entidade = Entidade.find(params[:id])\n @title = @entidade.nome\n end", "def create_search\n\t\t@search = Search.where(:search_id => self.id,:search_model => self.class.name).first\n\t\tunless @search.present?\n\t\t\t@search = Search.new\n\t\t\t@search.name = self.name\n\t\t\t@search.search_id = self.id\n\t\t\t@search.search_model = self.class.name\n\t\t\t@search.save!\n\t\telse\n\t\t\t@search.name = self.name\n\t\t\t@search.save!\n\t\tend\n\tend", "def perform\n params = Hash.new\n db = Mdb.open('/myapp/cotizaC.mdb')\n #db = Mdb.open(ruta absoluta)\n scs = db[:sc]\n scs.each do |row|\n #p Sc.all\n if Sc.where(:siv_id => row[:numsiv]).empty?\n p \"VERDADERO\"\n params[:siv_id] = row[:numsiv]\n params[:qad_id] = row[:codigoqad]#row[:numqad]\n params[:rut] = row[:rutc]\n params[:client_name] = row[:cliente]\n params[:name] = row[:producto]\n params[:sku] = row[:sku]\n params[:umx] = row[:umx]\n params[:siv_code] = row[:codigoqad]\n params[:kind] = row[:tipoxx]\n params[:sub_kind] = row[:subtipoxx]\n params[:materials] = row[:materiales]\n params[:structure] = row[:estructurap]\n params[:fechacreacion] = row[:fechacrea]\n params[:fechaval] = row[:fechaval]\n Sc.create(params)\n end\n end\n end", "def create_proper_content_model_with_selections\n results = true\n\n print \"[Start] Creating Full ContentProfile Data Model: \"\n Rails.logger.info \"#{self.class.name}##{__method__}(START) Creating Full ContentProfile Data Model.\"\n ## Begin Good Work\n\n ContentType.create!([\n {name: \"Experience\", description: \"Monthly Experience Reports and Files\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"1\" => {value: \"*.pdf\", type_name: \"Experience\", description: \"Document store Experience PDF Type\" }}\n },\n {name: \"Commission\", description: \"Monthly Commission Reports and Files\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"0\" => {value: \"*.pdf\", type_name: \"Commission\", description: \"Document store Commision Document Type ID\" },\n \"1\" => {value: \"*.csv\", type_name: \"Commission\", description: \"Document store Commision CSV Document Type ID\" } }\n },\n {name: \"Notification\", description: \"Email Notification of Related Events\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"0\" => {value: \"AdvCancel\", type_name: \"Notification\", description: \"Advance Cancel\" },\n \"1\" => {value: \"FutCancel\", type_name: \"Notification\", description: \"Future Cancel\" },\n \"2\" => {value: \"Cancel\", type_name: \"Notification\", description: \"Cancel\" } }\n },\n {name: \"LicensedStates\", description: \"Business Operational Metric\", value_data_type: \"Integer\",\n content_type_opts_attributes: {\n \"0\"=>{:value=>\"54\", :type_name=>\"LicensedStates\", :description=>\"Alaska\"},\n \"1\"=>{:value=>\"1\", :type_name=>\"LicensedStates\", :description=>\"Alabama\"},\n \"2\"=>{:value=>\"3\", :type_name=>\"LicensedStates\", :description=>\"Arkansas\"},\n \"3\"=>{:value=>\"2\", :type_name=>\"LicensedStates\", :description=>\"Arizona\"},\n \"4\"=>{:value=>\"4\", :type_name=>\"LicensedStates\", :description=>\"California\"},\n \"5\"=>{:value=>\"5\", :type_name=>\"LicensedStates\", :description=>\"Colorado\"},\n \"6\"=>{:value=>\"6\", :type_name=>\"LicensedStates\", :description=>\"Connecticut\"},\n \"7\"=>{:value=>\"8\", :type_name=>\"LicensedStates\", :description=>\"Washington Dc\"},\n \"8\"=>{:value=>\"7\", :type_name=>\"LicensedStates\", :description=>\"Delaware\"},\n \"9\"=>{:value=>\"9\", :type_name=>\"LicensedStates\", :description=>\"Florida\"},\n \"10\"=>{:value=>\"10\", :type_name=>\"LicensedStates\", :description=>\"Georgia\"},\n \"11\"=>{:value=>\"52\", :type_name=>\"LicensedStates\", :description=>\"Hawaii\"},\n \"12\"=>{:value=>\"14\", :type_name=>\"LicensedStates\", :description=>\"Iowa\"},\n \"13\"=>{:value=>\"11\", :type_name=>\"LicensedStates\", :description=>\"Idaho\"},\n \"14\"=>{:value=>\"12\", :type_name=>\"LicensedStates\", :description=>\"Illinois\"},\n \"15\"=>{:value=>\"13\", :type_name=>\"LicensedStates\", :description=>\"Indiana\"},\n \"16\"=>{:value=>\"15\", :type_name=>\"LicensedStates\", :description=>\"Kansas\"},\n \"17\"=>{:value=>\"16\", :type_name=>\"LicensedStates\", :description=>\"Kentucky\"},\n \"18\"=>{:value=>\"17\", :type_name=>\"LicensedStates\", :description=>\"Louisiana\"},\n \"19\"=>{:value=>\"20\", :type_name=>\"LicensedStates\", :description=>\"Massachusetts\"},\n \"20\"=>{:value=>\"19\", :type_name=>\"LicensedStates\", :description=>\"Maryland\"},\n \"21\"=>{:value=>\"18\", :type_name=>\"LicensedStates\", :description=>\"Maine\"},\n \"22\"=>{:value=>\"21\", :type_name=>\"LicensedStates\", :description=>\"Michigan\"},\n \"23\"=>{:value=>\"22\", :type_name=>\"LicensedStates\", :description=>\"Minnesota\"},\n \"24\"=>{:value=>\"24\", :type_name=>\"LicensedStates\", :description=>\"Missouri\"},\n \"25\"=>{:value=>\"23\", :type_name=>\"LicensedStates\", :description=>\"Mississippi\"},\n \"26\"=>{:value=>\"25\", :type_name=>\"LicensedStates\", :description=>\"Montana\"},\n \"27\"=>{:value=>\"32\", :type_name=>\"LicensedStates\", :description=>\"North Carolina\"},\n \"28\"=>{:value=>\"33\", :type_name=>\"LicensedStates\", :description=>\"North Dakota\"},\n \"29\"=>{:value=>\"26\", :type_name=>\"LicensedStates\", :description=>\"Nebraska\"},\n \"30\"=>{:value=>\"28\", :type_name=>\"LicensedStates\", :description=>\"New Hampshire\"},\n \"31\"=>{:value=>\"29\", :type_name=>\"LicensedStates\", :description=>\"New Jersey\"},\n \"32\"=>{:value=>\"30\", :type_name=>\"LicensedStates\", :description=>\"New Mexico\"},\n \"33\"=>{:value=>\"27\", :type_name=>\"LicensedStates\", :description=>\"Nevada\"},\n \"34\"=>{:value=>\"31\", :type_name=>\"LicensedStates\", :description=>\"New York\"},\n \"35\"=>{:value=>\"34\", :type_name=>\"LicensedStates\", :description=>\"Ohio\"},\n \"36\"=>{:value=>\"35\", :type_name=>\"LicensedStates\", :description=>\"Oklahoma\"},\n \"37\"=>{:value=>\"36\", :type_name=>\"LicensedStates\", :description=>\"Oregon\"},\n \"38\"=>{:value=>\"37\", :type_name=>\"LicensedStates\", :description=>\"Pennsylvania\"},\n \"39\"=>{:value=>\"38\", :type_name=>\"LicensedStates\", :description=>\"Rhode Island\"},\n \"40\"=>{:value=>\"39\", :type_name=>\"LicensedStates\", :description=>\"South Carolina\"},\n \"41\"=>{:value=>\"40\", :type_name=>\"LicensedStates\", :description=>\"South Dakota\"},\n \"42\"=>{:value=>\"41\", :type_name=>\"LicensedStates\", :description=>\"Tennessee\"},\n \"43\"=>{:value=>\"42\", :type_name=>\"LicensedStates\", :description=>\"Texas\"},\n \"44\"=>{:value=>\"43\", :type_name=>\"LicensedStates\", :description=>\"Utah\"},\n \"45\"=>{:value=>\"45\", :type_name=>\"LicensedStates\", :description=>\"Virginia\"},\n \"46\"=>{:value=>\"44\", :type_name=>\"LicensedStates\", :description=>\"Vermont\"},\n \"47\"=>{:value=>\"46\", :type_name=>\"LicensedStates\", :description=>\"Washington\"},\n \"48\"=>{:value=>\"48\", :type_name=>\"LicensedStates\", :description=>\"Wisconsin\"},\n \"49\"=>{:value=>\"47\", :type_name=>\"LicensedStates\", :description=>\"West Virginia\"},\n \"50\"=>{:value=>\"49\", :type_name=>\"LicensedStates\", :description=>\"Wyoming\"},\n \"51\"=>{:value=>\"58\", :type_name=>\"LicensedStates\", :description=>\"Puerto Rico\"},\n \"52\"=>{:value=>\"81\", :type_name=>\"LicensedStates\", :description=>\"A F Americas\"},\n \"53\"=>{:value=>\"82\", :type_name=>\"LicensedStates\", :description=>\"A F Europe\"},\n \"54\"=>{:value=>\"83\", :type_name=>\"LicensedStates\", :description=>\"A F Pacific\"},\n \"55\"=>{:value=>\"84\", :type_name=>\"LicensedStates\", :description=>\"American Samoa\"},\n \"56\"=>{:value=>\"85\", :type_name=>\"LicensedStates\", :description=>\"Micronesia\"},\n \"57\"=>{:value=>\"86\", :type_name=>\"LicensedStates\", :description=>\"Guam\"},\n \"58\"=>{:value=>\"87\", :type_name=>\"LicensedStates\", :description=>\"Marshall Isl\"},\n \"59\"=>{:value=>\"88\", :type_name=>\"LicensedStates\", :description=>\"N Mariana Isl\"},\n \"60\"=>{:value=>\"89\", :type_name=>\"LicensedStates\", :description=>\"Palau\"},\n \"61\"=>{:value=>\"99\", :type_name=>\"LicensedStates\", :description=>\"Not Found\"} }\n },\n {name: \"Activity\", description: \"Partner Relationship Reports\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"0\" => {value: \"*.pdf\", type_name: \"Activity\", description: \"Document store Project Status Report Document Type ID\"}\n }\n },\n {name: \"FileDownload\", description: \"Project Related Resources\", value_data_type: \"String\",\n content_type_opts_attributes: {\n \"0\" => {value: \"*.png\", type_name: \"FileDownload\", description: \"Project Related by Document Type PNG\"},\n \"1\" => {value: \"*.jpg\", type_name: \"FileDownload\", description: \"Project Related by Document Type JPEG\"},\n \"2\" => {value: \"*.pdf\", type_name: \"FileDownload\", description: \"Project Related by Document Type PDF\"},\n \"3\" => {value: \"*.log\", type_name: \"FileDownload\", description: \"Project Related by Document Type LOG\"}\n }\n }\n ])\n\n TopicType.create!([\n {name: \"Branch\", description: \"Branch Actions for a specific branch\", value_based_y_n: \"N\",\n topic_type_opts_attributes: {\n \"0\" => {value: \"0034\", type_name: \"Branch\", description: \"South Branch Number\"},\n \"1\" => {value: \"0037\", type_name: \"Branch\", description: \"North Branch Number\"},\n \"2\" => {value: \"0040\", type_name: \"Branch\", description: \"West Branch Number\"} }\n },\n {name: \"Partner\", description: \"This Corporate Account\", value_based_y_n: \"N\",\n topic_type_opts_attributes: {\n \"0\" => {value: \"0099\", type_name: \"Partner\", description: \"Skoona Consulting\"}}\n },\n {name: \"UserGroups\", description: \"Shared access to project working files\", value_based_y_n: \"N\",\n topic_type_opts_attributes: {\n \"0\" => {value: \"Manager\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"1\" => {value: \"EmployeePrimary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"2\" => {value: \"EmployeeSecondary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"3\" => {value: \"VendorPrimary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"4\" => {value: \"VendorSecondary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"5\" => {value: \"BranchPrimary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"6\" => {value: \"BranchSecondary\", type_name: \"UserGroups\", description: \"Project Workfiles\"},\n \"7\" => {value: \"Developer\", type_name: \"UserGroups\", description: \"Project Workfiles\"}\n }\n }\n ])\n\n cpe_developer = []\n [\n ['Experience', ['*.pdf'], 'Branch', ['0034'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0034'], 'Access Branch Commission PDF Files'],\n ['Notification', ['AdvCancel'], 'Branch', ['0034'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['21'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['LicensedStates', ['12'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['LicensedStates', ['13'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['Activity', ['*.pdf'], 'Partner', ['0099'], 'Partner Relationship Reports'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0037'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0037'], 'Access Branch Commission CSV Files'],\n ['Notification', ['Cancel'], 'Branch', ['0037'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['34'], 'Branch', ['0037'], 'Licensed to operate in state'],\n ['LicensedStates', ['37'], 'Branch', ['0037'], 'Licensed to operate in state'],\n ['LicensedStates', ['31'], 'Branch', ['0037'], 'Licensed to operate in state'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0040'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0040'], 'Access Branch Commission PDF Files'],\n ['Notification', ['FutCancel'], 'Branch', ['0040'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['24'], 'Branch', ['0040'], 'Licensed to operate in state'],\n ['LicensedStates', ['14'], 'Branch', ['0040'], 'Licensed to operate in state'],\n ['LicensedStates', ['3'], 'Branch', ['0040'], 'Licensed to operate in state'],\n\n ['FileDownload', ['*.pdf'], 'UserGroups', ['Developer'], 'Shared access to project working files'],\n ['FileDownload', ['*.png'], 'UserGroups', ['Developer'], 'Shared access to project working files'],\n ['FileDownload', ['*.jpg'], 'UserGroups', ['Developer'], 'Shared access to project working files'],\n ['FileDownload', ['*.log'], 'UserGroups', ['Developer'], 'Shared access to project working files']\n\n ].each do |req|\n cchoice = selections_choose_for(req[1], selections_for_content_type(req[0], true))\n tchoice = selections_choose_for(req[3], selections_for_topic_type(req[2], true))\n cpe_developer << create_content_profile_entry_for(req.last, tchoice, cchoice)\n end\n\n cpe_primary = []\n [\n ['Experience', ['*.pdf'], 'Branch', ['0034'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0034'], 'Access Branch Commission PDF Files'],\n ['Notification', ['AdvCancel'], 'Branch', ['0034'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['21'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['LicensedStates', ['12'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['LicensedStates', ['13'], 'Branch', ['0034'], 'Licensed to operate in state'],\n ['Activity', ['*.pdf'], 'Partner', ['0099'], 'Partner Relationship Reports'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0037'], 'Branch Experience Statements'],\n ['Commission', ['*.csv'], 'Branch', ['0037'], 'Access Branch Commission CSV Files'],\n ['Notification', ['Cancel'], 'Branch', ['0037'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['34'], 'Branch', ['0037'], 'Licensed to operate in state'],\n ['LicensedStates', ['37'], 'Branch', ['0037'], 'Licensed to operate in state'],\n ['LicensedStates', ['31'], 'Branch', ['0037'], 'Licensed to operate in state'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0040'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0040'], 'Access Branch Commission PDF Files'],\n ['Notification', ['FutCancel'], 'Branch', ['0040'], 'Notify Branch of Policy Events'],\n ['LicensedStates', ['24'], 'Branch', ['0040'], 'Licensed to operate in state'],\n ['LicensedStates', ['14'], 'Branch', ['0040'], 'Licensed to operate in state'],\n ['LicensedStates', ['3'], 'Branch', ['0040'], 'Licensed to operate in state'],\n\n ['FileDownload', ['*.pdf'], 'UserGroups', ['EmployeePrimary'], 'Shared access to project working files'],\n ['FileDownload', ['*.png'], 'UserGroups', ['EmployeePrimary'], 'Shared access to project working files'],\n ['FileDownload', ['*.jpg'], 'UserGroups', ['EmployeePrimary'], 'Shared access to project working files'],\n ['FileDownload', ['*.log'], 'UserGroups', ['EmployeePrimary'], 'Shared access to project working files']\n\n ].each do |req|\n cchoice = selections_choose_for(req[1], selections_for_content_type(req[0], true))\n tchoice = selections_choose_for(req[3], selections_for_topic_type(req[2], true))\n cpe_primary << create_content_profile_entry_for(req.last, tchoice, cchoice)\n end\n\n cpe_sec = []\n [\n ['Experience', ['*.pdf'], 'Branch', ['0034'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0034'], 'Access Branch Commission PDF Files'],\n ['Notification', ['AdvCancel'], 'Branch', ['0034'], 'Notify Branch of Policy Events'],\n ['Activity', ['*.pdf'], 'Partner', ['0099'], 'Partner Relationship Reports'],\n\n ['Experience', ['*.pdf'], 'Branch', ['0040'], 'Branch Experience Statements'],\n ['Commission', ['*.pdf'], 'Branch', ['0040'], 'Access Branch Commission PDF Files'],\n ['Notification', ['FutCancel'], 'Branch', ['0040'], 'Notify Branch of Policy Events'],\n\n ['FileDownload', ['*.pdf'], 'UserGroups', ['EmployeeSecondary'], 'Shared access to project working files'],\n ['FileDownload', ['*.pdf'], 'UserGroups', ['BranchPrimary'], 'Shared access to project working files']\n\n ].each do |req|\n cchoice = selections_choose_for(req[1], selections_for_content_type(req[0], true))\n tchoice = selections_choose_for(req[3], selections_for_topic_type(req[2], true))\n cpe_sec << create_content_profile_entry_for(req.last, tchoice, cchoice)\n end\n\n cpe_vendor = []\n [\n ['Activity', ['*.pdf'], 'Partner', ['0099'], 'Partner Relationship Reports'],\n ['FileDownload', ['*.log'], 'UserGroups', ['VendorPrimary'], 'Shared access to project working files']\n\n ].each do |req|\n cchoice = selections_choose_for(req[1], selections_for_content_type(req[0], true))\n tchoice = selections_choose_for(req[3], selections_for_topic_type(req[2], true))\n cpe_vendor << create_content_profile_entry_for(req.last, tchoice, cchoice)\n end\n\n # loop thru users\n res = Secure::UserProfile.page_users.each do |u|\n next if u.user_options.empty? or u.user_options.include?(\"VendorSecondary\")\n\n cp = create_content_profile_for(u, u.assigned_groups.first)\n\n entries = case u.assigned_groups.first\n when 'Developer'\n cpe_developer\n when 'Manager', 'EmployeePrimary'\n cpe_primary\n when 'EmployeeSecondary', 'BranchPrimary'\n cpe_sec\n else\n cpe_vendor\n end\n\n assign_content_profile_entry_to(cp, entries)\n\n end\n\n\n ## End Good Work\n puts \"[Success!]\"\n Rails.logger.info \"#{self.class.name}##{__method__}(SUCCESS) Creating Full ContentProfile Data Model.\"\n results\n rescue Exception => e\n Rails.logger.error \"#{self.class.name}.#{__method__}(FAILED) Creating Full ContentProfile Data Model; Klass: #{e.class.name}, Cause: #{e.message} #{e.backtrace[0..4]}\"\n puts \"[Failed!]\"\n false\n end" ]
[ "0.6131278", "0.55852306", "0.55035514", "0.5496427", "0.54549944", "0.5409511", "0.5382595", "0.53744924", "0.5301359", "0.5301359", "0.5301359", "0.5301359", "0.5301359", "0.52581793", "0.52512264", "0.5244808", "0.5237615", "0.52089113", "0.51761216", "0.51709807", "0.5087033", "0.5075584", "0.5062992", "0.5055137", "0.50499725", "0.50361925", "0.5030608", "0.50023776", "0.50023776", "0.50019425", "0.49947613", "0.49903747", "0.49658218", "0.49621132", "0.49428076", "0.49406627", "0.49374557", "0.49213317", "0.49199036", "0.49078655", "0.48922208", "0.48904306", "0.48875248", "0.4880547", "0.48752397", "0.48749435", "0.48747817", "0.4872542", "0.48652363", "0.4856944", "0.48559123", "0.4849986", "0.48484936", "0.4848085", "0.48409176", "0.48409176", "0.48345605", "0.48342553", "0.48312056", "0.48283207", "0.48263985", "0.4825825", "0.48185414", "0.48167652", "0.48163554", "0.48157424", "0.48139784", "0.48121142", "0.48120952", "0.48060992", "0.48041478", "0.47881946", "0.47878224", "0.47812104", "0.47810048", "0.47809306", "0.4780623", "0.4775435", "0.47730705", "0.47719413", "0.47716236", "0.47716236", "0.4769867", "0.47549063", "0.47530663", "0.47530663", "0.47530663", "0.47530663", "0.47530663", "0.47530663", "0.47527406", "0.47523707", "0.47523707", "0.4752135", "0.47402725", "0.4739448", "0.47351995", "0.4734813", "0.4734396", "0.47335625" ]
0.55922514
1
update cover image for a specified model
def get_cover_image(book, url) if not url.nil? name = book.name || "#{book.series.name} \##{book.number}" log("attempting to retrieve cover art [#{url}]", :debug) cover_image = book.build_cover_image(:uploaded_data => UrlUpload.new(url)) if cover_image.save log("successfully added cover art [#{name}]", :debug) else log("unable to add cover art [#{name}]", :debug) end else log("invalid URL for cover art [#{name}]", :debug) end rescue OpenURI::HTTPError log("cover art not found [#{name}]", :debug) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\r\n @album = Album.find(params[:id])\r\n if params[:album][:coverpage]\r\n tem_coverPage = upload_file(params[:album][:coverpage],\"app/assets/images/album_images\")\r\n params[:album][:coverpage] = \"album_images/\"+tem_coverPage\r\n end\r\n\r\n respond_to do |format|\r\n\r\n if @album.update_attributes(params[:album])\r\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @album.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n if params.has_key?(:cover) and params[:cover].has_key?(:file_attachment_original_w)\n #params[:cover][:file_attachment_box_w] = 1000\n if params[:cover][:file_attachment_original_w].to_f > 1000\n scale_factor = params[:cover][:file_attachment_original_w].to_f / 1000\n params[:cover][:file_attachment_crop_x] = params[:cover][:file_attachment_crop_x].to_f * scale_factor\n params[:cover][:file_attachment_crop_y] = params[:cover][:file_attachment_crop_y].to_f * scale_factor\n params[:cover][:file_attachment_crop_w] = params[:cover][:file_attachment_crop_w].to_f * scale_factor\n params[:cover][:file_attachment_crop_h] = params[:cover][:file_attachment_crop_h].to_f * scale_factor\n end\n end\n\n respond_to do |format|\n if @cover.update_attributes(cover_params)\n format.html { redirect_to current_user, notice: 'Cover Pic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cover.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_cover_image\n @cover_image = CoverImage.find(params[:id])\n end", "def update\n @album = current_user.albums.find(params[:cover][:album_id])\n @cover = @album.covers.first\n if @cover.update_attributes(params[:cover])\n redirect_to \"/albums/\" + params[:cover][:album_id], :notice => \"Successfully changed cover.\" \n else\n @album = current_user.albums.find(params[:cover][:album_id])\n render :action => 'edit'\n end\n end", "def set_as_cover\n if imageable_type == \"Album\"\n self.imageable.photos.where(is_cover_photo: true).update_all(is_cover_photo: false)\n self.update(is_cover_photo: true)\n end\n end", "def update\n if params[:item][:cover].present?\n @item.cover.attach(params[:item][:cover])\n end\n\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to edit_item_path(@item), notice: \"El producto ha sido actualizado.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_db_record\n img_file = file.to_file\n img = ::Magick::Image::read(img_file).first\n model.height = img.rows\n model.width = img.columns\n \n new_filename = model.imageable.filename( file.extension )\n new_file = file.copy_to(type_dir + new_filename)\n model.url = access_dir + new_filename\n model.save\n end", "def update\n if @event.update(event_params)\n if cover_photo_params[:image]\n image = Paperclip.io_adapters.for(cover_photo_params[:image])\n image.original_filename = \"#{cover_photo_params[:filename]}\"\n @event.cover_photo = image\n end\n @event.address.update(address_params)\n @event.save\n @event\n else\n @event.errors\n end\n end", "def add_cover_image\n enforce_permissions!('manage_collection', params[:id])\n\n @object = retrieve_object!(params[:id])\n\n if params[:batch].present? && [:cover_image].present?\n cover_image = params[:batch][:cover_image]\n else\n raise DRI::Exceptions::BadRequest, t('dri.views.exceptions.file_not_found')\n end\n\n @object.object_version ||= '1'\n @object.increment_version\n\n if cover_image.present?\n saved = Storage::CoverImages.validate_and_store(cover_image, @object)\n end\n\n if saved\n # Do the preservation actions\n preservation = Preservation::Preservator.new(@object)\n preservation.preserve(false, false, ['properties'])\n end\n\n # purge params from update action\n purge_params\n\n respond_to do |format|\n if saved\n flash[:notice] = t('dri.flash.notice.updated', item: params[:id])\n else\n flash[:error] = t('dri.flash.error.cover_image_not_saved')\n end\n format.html { redirect_to controller: 'my_collections', action: 'show', id: @object.id }\n end\n end", "def update\n @cover = Cover.find(params[:id])\n\n respond_to do |format|\n if @cover.update_attributes(params[:cover])\n format.html { redirect_to @cover, notice: 'cover was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cover.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_cover\n @cover = Cover.find(params[:id])\n end", "def set_cover\n @cover = Cover.find(params[:id])\n end", "def set_cover\n @cover = Cover.find(params[:id])\n end", "def update_cover_image(params = {})\n response = post('account/update_cover_image.json', params)\n Croudia::Object::User.new(response)\n end", "def create\n if params[:cover][:special_attribute] == 'covershot'\n @current_user_cover_pics = current_user.covers.where(upload_type: 'cover')\n @current_user_cover_pics.each do |s|\n if s.special_attribute == 'covershot'\n s.update_attribute(:special_attribute, '')\n s.save\n end\n end \n end\n \n @cover = Cover.new(cover_params)\n @cover.user_id = current_user.id\n @cover.save\n\n render 'crop'\n end", "def update\n respond_to do |format|\n if @cover.update(cover_params)\n format.html { redirect_to @cover, notice: 'Cover was successfully updated.' }\n format.json { render :show, status: :ok, location: @cover }\n else\n format.html { render :edit }\n format.json { render json: @cover.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @highlight = @celebration.highlights.find(params[:id])\n\n respond_to do |format|\n if @highlight.update_attributes(params[:highlight])\n if params[:highlight][:cover_photo].present?\n format.html {render :crop}\n else\n crop\n \n format.html { redirect_to [@celebration,@highlight], notice: 'Highlight was successfully updated.' }\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: [@celebration,@highlight].errors, status: :unprocessable_entity }\n end\n end\n end", "def add_cover_image\n enforce_permissions!('manage_collection', params[:id])\n\n @object = retrieve_object!(params[:id])\n\n if params[:digital_object].present? && params[:digital_object][:cover_image].present?\n cover_image = params[:digital_object][:cover_image]\n else\n raise DRI::Exceptions::BadRequest, t('dri.views.exceptions.file_not_found')\n end\n\n @object.increment_version\n cover_url = Storage::CoverImages.validate_and_store(cover_image, @object)\n\n if cover_url\n @object.cover_image = cover_url\n @object.save\n\n record_version_committer(@object, current_user)\n\n # Do the preservation actions\n preservation = Preservation::Preservator.new(@object)\n preservation.preserve\n\n flash[:notice] = t('dri.flash.notice.updated')\n else\n flash[:error] = t('dri.flash.error.cover_image_not_saved')\n end\n\n respond_to do |format|\n format.html { redirect_to controller: 'my_collections', action: 'show', id: @object.alternate_id }\n end\n end", "def update\n respond_to do |format|\n if album_params.has_key?(:cover_original_w)\n #params[:album][:cover_box_w] = 1000\n if album_params[:cover_original_w].to_f > 1000\n scale_factor = album_params[:cover_original_w].to_f / 1000\n album_params[:cover_crop_x] = album_params[:cover_crop_x].to_f * scale_factor\n album_params[:cover_crop_y] = album_params[:cover_crop_y].to_f * scale_factor\n album_params[:cover_crop_w] = album_params[:cover_crop_w].to_f * scale_factor\n album_params[:cover_crop_h] = album_params[:cover_crop_h].to_f * scale_factor\n end\n end\n\n if @album.update_attributes(album_params)\n format.html { \n if album_params.has_key?(:cover)\n render 'crop' \n else \n redirect_to @album, notice: 'Portfolio was successfully updated.' \n end \n }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comic.update_comic_cover_picture update_image_params[\"photo\"] unless update_image_params.nil?\n if @comic.errors.empty? && @comic.update_attributes(update_comic_params)\n redirect_to user_comics_path(@user)\n else\n render :edit\n end\n end", "def cover=(photo)\n\n id = (photo.respond_to?(:id) ? photo.id : photo)\n\n if p = self.photos.find_by(id: id)\n self.photos.where(cover: true).update_all(cover: false)\n p.cover = true\n p.save\n p\n end\n end", "def save_book_cover_image\n view = Openlibrary::View\n return unless self.isbn_10.present?\n book = view.find_by_isbn(self.isbn_10)\n if(!self.image.present?)\n if book.thumbnail_url.present?\n self.remote_image_url = book.thumbnail_url \n self.save\n end\n end\n end", "def save_book_cover_image\n view = Openlibrary::View\n return unless self.isbn_10.present?\n book = view.find_by_isbn(self.isbn_10)\n if(!self.image.present?)\n if book.thumbnail_url.present?\n self.remote_image_url = book.thumbnail_url \n self.save\n end\n end\n end", "def update\n @book.update_book_cover_picture update_image_params[\"photo\"] unless update_image_params.nil?\n if @book.errors.empty? && @book.update_attributes(update_book_params)\n redirect_to user_books_path(@user)\n else\n render :edit\n end\n end", "def profile_cover\n @updated = current_user.update(params.require(:user).permit(:cover))\n end", "def update\n @image = @album.images.find(params[:id])\n @image.update(image_params)\n redirect_to album_path(@image.album.id)\n end", "def make_default\n @picture = Picture.find(params[:id])\n @artwork = Artwork.find(params[:artwork_id])\n\n @artwork.cover = @picture.id\n @artwork.save\n end", "def update_thumbs\n File.open(self.cover_art) do |f|\n self.default_cover_art = f\n self.default_cover_art.recreate_versions!\n self.save!\n end\n end", "def representative_image(monograph, cover_noid)\n acquire_lock_for(monograph.id) do\n monograph.representative_id = cover_noid\n monograph.thumbnail_id = cover_noid\n monograph.save!\n end\n end", "def update_image(image)\n self.avatar = image\n save!\n end", "def update\n @moto_cover_image_uid = MotoCoverImageUid.find(params[:id])\n\n respond_to do |format|\n if @moto_cover_image_uid.update_attributes(params[:moto_cover_image_uid])\n format.html { redirect_to(@moto_cover_image_uid, :notice => 'Moto cover image uid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @moto_cover_image_uid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @album = current_user.albums.find(params[:id])\n @cover = @album.covers.first\n \n if @cover.nil?\n @cover = Cover.new\n end \n end", "def update\n @highlight.assign_attributes(highlight_params)\n @highlight.build_desktop_image(file: params[:highlight][:desktop_img]) if params[:highlight][:desktop_img]\n @highlight.build_mobile_image(file: params[:highlight][:mobile_img]) if params[:highlight][:mobile_img]\n if @highlight.save\n if params[:\"input-preview\"] == \"1\"\n redirect_to action: :show, id: @highlight.id\n else\n redirect_to action: :index\n end\n else\n render :edit\n end\n end", "def update!(**args)\n @stable_image = args[:stable_image] if args.key?(:stable_image)\n @target_image = args[:target_image] if args.key?(:target_image)\n end", "def update\n @idea = Idea.find(params[:id])\n @idea.name = params[:name]\n @idea.description = params[:description]\n repo_path = \"#{Rails.root}/public/data/repository/#{current_user.id}/#{@idea.name}\"\n cover_img_path = \"/data/repository/#{current_user.id}/#{@idea.name}\"\n\n if params[:cover_img]\n @idea.cover_img = params[:cover_img]\n DataFile.save(params[:cover_img], cover_img_path)\n\t\t\t@git = GitHelper.init(repo_path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Changed cover image.\")\n end\n\n if @idea.save\n\t\t\trender json: @idea\n\t\telse\n\t\t\trender json: {error: \"Failed to update idea\"}, status: :unauthorized\n end\n end", "def update\n photo = Photo.find(params[:id])\n\n needRecreate = false\n\n if params[:crop_x]\n if photo.crop_x != params[:crop_x] or photo.crop_y != params[:crop_y] or photo.crop_h != params[:crop_h] or photo.crop_w != params[:crop_w]\n needRecreate = true\n end\n end\n\n created = photo.update_attributes({ :caption => params[:caption], :crop_h => params[:crop_h], :crop_y => params[:crop_y], :crop_x => params[:crop_x], :crop_w => params[:crop_w], :position => params[:position], :useAsArticlePhoto => params[:useAsArticlePhoto], :useAsFrontpagePhoto => params[:useAsFrontpagePhoto], :widescreenCaption => params[:widescreenCaption]})\n\n Rails.logger.debug \"Update photo #{created}\"\n p \"Update photo #{created}\"\n\n photo.photo.recreate_versions! if needRecreate\n\n respond_with photo\n end", "def update\n\n respond_to do |format|\n if @photo.update(photo_params)\n if @photo.rate!=0\n @photo.sum_of_assessments+=@photo.rate\n @photo.num_of_assessments+=1\n @photo.average_rating=@photo.sum_of_assessments.to_f/@photo.num_of_assessments.to_f\n TableOfAssesment.create(owner_id: @current_owner.id, rate: @photo.rate, photo_id:@photo.id)\n @photo.rate=0\n @photo.save\n end\n if @photo.position!=0\n @album=@photo.album\n if Photo.where(id: @album.cover).load.map{|x| x}.size>0\n p1=Photo.where(id: @album.cover).load.map{|x| x}[0]\n p1.position=0\n p1.save\n end\n @album.cover=@photo.id\n @album.save!\n end\n format.html { redirect_to @photo, notice: 'Фотография успешно изменена.' }\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 @raw_image.update(raw_image_params)\n redirect_to admin_raw_images_path\n\n end", "def assignCoverPicture(inputParams)\n pictureIds = articlePictureIds(inputParams[:content])\n if pictureIds.length == 0\n articleIds = Article.where.not(:id => inputParams[:id]).where(:category_name => inputParams[:category_name]).limit(10000).pluck(:id)\n if articleIds.length == 0\n articleIds = Article.where.not(:id => inputParams[:id]).limit(10000).pluck(:id)\n end\n if articleIds.length > 0\n article = Article.select(\"cover_picture_id, content\").find(articleIds.sample)\n pictureIds = articlePictureIds(article.content, article.cover_picture_id)\n if pictureIds.length > 0\n samplePicture = Picture.find(pictureIds.sample)\n coverPicture = Picture.new\n coverPicture.src = samplePicture.src\n coverPicture.article_id = inputParams[:id]\n if coverPicture.save\n inputParams[:cover_picture_id] = coverPicture.id\n inputParams[:cover_picture_url] = coverPicture.src.url(:thumb)\n inputParams[:cover_picture_imported] = true\n end\n end\n end\n else\n coverPicture = Picture.find(pictureIds.sample)\n inputParams[:cover_picture_id] = coverPicture.id\n inputParams[:cover_picture_url] = coverPicture.src.url(:thumb)\n inputParams[:cover_picture_imported] = false\n end\n end", "def update\r\n \r\n unless request.xhr? || params[:c] == \"true\"\r\n o_name = @album.name\r\n @album.name = params[:album_name]\r\n @album.description = params[:album_description]\r\n end\r\n \r\n # validate the cover photo\r\n cover_photo_changed = false\r\n old_cover_photo_id = @album.cover_photo_id\r\n @album.cover_photo_id = params[:album_cover_photo_id]\r\n if @album.cover_photo_id && @album.cover_photo_id != old_cover_photo_id\r\n photo = @album.cover_photo\r\n if photo && photo.album_id == @album.id\r\n @cover_photo = photo\r\n cover_photo_changed = true\r\n else\r\n @album.cover_photo_id = old_cover_photo_id\r\n end\r\n end\r\n \r\n if @album.save\r\n @album.set_cover_photo_cache(@cover_photo) if cover_photo_changed\r\n flash.now[:message] = \"已成功保存\"\r\n else\r\n flash.now[:error_msg] = \"操作失败, 再试一次吧\"\r\n @old_name = o_name\r\n end\r\n \r\n render(:action => \"edit\")\r\n end", "def update\n @benthic_cover = BenthicCover.find(params[:id])\n\n respond_to do |format|\n if @benthic_cover.update_attributes!(benthic_cover_params)\n format.html { redirect_to benthic_covers_path, notice: 'Benthic cover was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @benthic_cover.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @image = args[:image] if args.key?(:image)\n end", "def set_image_as_unique_cover\n return unless media_type == 'image'\n cover_file = MediaFile\n .where(attachable: self.attachable, cover: true)\n .where.not(id: id)\n\n if cover?\n cover_file.update_all(cover: false)\n elsif cover_file.blank?\n self.cover = true\n end\n end", "def cover_image\n end", "def update\n\t\t@user = User.find(params[:id])\n\t\tif params[:avatar_photo]\n\t\t\t@user.avatar_id = params[:avatar_photo].to_i\n\t\telsif params[:cover_photo]\n\t\t\t@user.cover_photo_id = params[:cover_photo].to_i\n\t\tend\n\n\t\tif @user.save\n\t\t\tflash[:success] = \"Photo Set!\"\n\t\t\tredirect_to request.referrer\n\t\telse\n\t\t\tflash[:error] = \"Couldn't set photo!\"\n\t\t\tredirect_to request.referrer\n\t\tend\n\tend", "def update_profile_photo\n\t\t# update the profile update images like cover photo and profile photo\n\t\t if @user.update_attributes(profile_image: params[:profile_image],cover_image: params[:cover_image])\n\t\t# response to the JSON\n\t\t\trender json: { success: true,message: \"Profile photo Successfully Updated.\", response: {cover_image: @user.cover_image.as_json, profile_image: @user.profile_image.as_json } },:status=>200\n\t else\n\t render :json=> { success: false, message: @user.errors },:status=> 203\n\t end\t\n\tend", "def update\n respond_to do |format|\n if @movie.update(movie_params)\n if params[:covers].present?\n params[:covers]['path'].each do |cover|\n @movie.covers.create!(:path => cover, :movie_id => @movie.id)\n end\n end\n format.html { redirect_back_or_default root_url, notice: 'Movie was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie }\n else\n format.html { render :edit }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_or_update_embedded_image(params)\r\n return if params.blank? || params[:uploaded_data].blank?\r\n raise \"Method only works for subclasses\" unless self.respond_to?(:embedded_image)\r\n\r\n #set existing embedded image free \r\n embedded_image.update_attribute(:downloadable_album_id, nil) if embedded_image\r\n\r\n folder = self.user.find_or_create_folder_for_pictures_from_notes\r\n ei = CoverArt.new(params)\r\n ei.user_id = self.user_id\r\n ei.user = self.user\r\n ei.cat_id = Content::CATEGORIES[:cover_art][:id]\r\n ei.is_in_startpage = false\r\n ei.is_in_gallery = true\r\n ei.author_id = self.author_id\r\n ei.created_by_id = self.author_id\r\n ei.relationshiptype_id = folder.relationshiptype_id\r\n self.embedded_image = ei\r\n ei.downloadable_album_id = self.id\r\n ei.title = self.title(40)\r\n ei.save!\r\n\r\n ei.albums << folder\r\n end", "def update\n car = Car.find params[:id]\n car.update(\n manufacturer: params[:manufacturer],\n model: params[:model],\n engine: params[:engine],\n car_class: params[:car_class],\n image: params[:image]\n )\n\n redirect_to car_path(car.id)\n end", "def save_cover_photo event\n image = Paperclip.io_adapters.for(cover_photo_params[:image])\n image.original_filename = \"#{cover_photo_params[:filename]}\"\n @event.cover_photo = image\n\n respond_to do |format|\n if @event.save\n format.html {}\n format.json do\n render json: @event\n end\n else\n format.html {}\n format.json { render json: {errors: {cover_photo: ['não foi possível salvar']}}.to_json }\n end\n end\n end", "def update\n @showcase = Showcase.find(params[:showcase_id])\n @showcase_image = ShowcaseImage.find(params[:id])\n\n if @showcase_image.update_attributes(params[:showcase_image])\n redirect_to edit_showcase_url(@showcase)\n else\n render :action => \"edit\"\n end\n end", "def update\n if @image_target.update(image_target_params)\n redirect_to @image_target, notice: \"#{t('notice.updated',{model: \"#{t('activerecord.models.admin/image_target')}\"})}\"\n else\n render :edit\n end\n end", "def add_image \n image = CARMD.image(self.vin)\n if image == \"\"\n image = \"http://clipart-library.com/img/2050778.png\"\n end\n self.auto_image = image \n self.save \n end", "def update\n parameters = gallery_params\n cover = parameters.delete(:cover)\n\n # Handle the cover image\n if (cover)\n gi = GalleryItem.find(cover)\n\n if (gi)\n # Remove any previous cover\n @gallery.gallery_items.each do |item|\n if (item.cover)\n item.cover = false\n item.save\n end\n end\n\n # Set the current cover\n gi.cover = true\n gi.save\n end\n end\n\n # Remove the selected images\n items = params[:gallery][:gallery_items]\n\n if items\n items.each do |item_id|\n GalleryItem.find(item_id).destroy\n end\n end\n\n respond_to do |format|\n if @gallery.update(parameters)\n format.html { redirect_to @gallery, notice: 'Gallery was successfully updated.' }\n format.json { render :show, status: :ok, location: @gallery }\n else\n format.html { render :edit }\n format.json { render json: @gallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @background_type = args[:background_type] if args.key?(:background_type)\n @collage = args[:collage] if args.key?(:collage)\n @cropping = args[:cropping] if args.key?(:cropping)\n @model_type = args[:model_type] if args.key?(:model_type)\n @nfs = args[:nfs] if args.key?(:nfs)\n @object_count = args[:object_count] if args.key?(:object_count)\n @overlay = args[:overlay] if args.key?(:overlay)\n @selfie = args[:selfie] if args.key?(:selfie)\n @text_overlay = args[:text_overlay] if args.key?(:text_overlay)\n @version = args[:version] if args.key?(:version)\n end", "def revise_cover_status\n if self.cover?\n Plant.find(self.plant_id).pictures.each do |picture|\n if (picture.cover? && picture.id != self.id)\n picture.cover = false\n picture.save\n end\n end\n end\n end", "def update\n par = img_properties\n logger.info(\"parameters: #{par.inspect}\")\n valid = true\n\n # find by user associated to app key, not by user from request parameter!\n @image = Image.editable_by(@user).find_by_guid(params[:id])\n\n return not_found if !@image\n\n # set these variables back to nil if they were in the request but blank\n if par[:ref]\n @image.ref = par[:ref].blank? ? nil : par[:ref]\n end\n if par[:name]\n @image.name = par[:name].blank? ? nil : par[:name]\n end\n if par[:page_url]\n @image.page_url = par[:page_url].blank? ? nil : par[:page_url]\n end\n @image.private = par[:private] if par[:private]\n\n # update calibration data if specified\n if !par[:calibrate_length].blank?\n @image.calibrate_length = par[:calibrate_length].to_f\n @image.calibrate_unit = par[:calibrate_unit].to_i if !par[:calibrate_unit].blank?\n @image.calibrate_coords = par[:calibrate_coords] if !par[:calibrate_coords].blank?\n @image.ppi = calculate_ppi(@image)\n end\n\n orig_url = par[:original_url] || par[:url]\n begin\n # this may fail\n if !orig_url.blank? && orig_url != @image.original_url\n # url was updated\n @image.remote_upload_url = orig_url\n @image.original_url = orig_url\n end\n rescue CarrierWave::DownloadError\n @image.errors.add(:remote_upload_url, \"^This url doesn't appear to be valid\")\n valid = false\n rescue CarrierWave::IntegrityError\n @image.errors.add(:remote_upload_url, \"^This url does not appear to point to a valid image\")\n valid = false\n rescue StandardError\n @image.errors.add(:remote_upload_url, \"There does not appear to be an image at this url\")\n valid = false\n end\n\n if valid && @image.save\n # update product if set\n @image.user_product = par[:product] if par[:product]\n\n image_data = @image.js_serialize\n # if the user hit the 'save and next' button, include the guid of the next image in the response.\n # The client side will redirect to the edit page for that image. \n if params[:commit] == 'save and next'\n image = Image.find_most_recent_uncalibrated(current_user.id)\n image_data['nextImage'] = image.guid if image\n end\n render :json => image_data, :callback => params[:callback]\n else\n render :json => { :error => 403, :messages => prepare_errors(@image), :callback => params[:callback] }, :status => 200\n end\n end", "def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_image image\n temp_path = @image_folder.detect{|image_string| image_string.downcase == \"#{@image_path}/#{image.image_file_name}\".downcase}\n filename = File.basename(temp_path)\n image.image_number = @img_count\n\n @img_count += 1\n if temp_path.blank?\n InputBatch::Log.status_log.error \">>>>>>>>Image #{filename} not found<<<<<<<<<\"\n puts \">>>>>>>>>>>>Image #{filename} not found\"\n InputBatch::Log.error_log.error \"Error on line #{@row_index} : Image #{filename} not found\"\n else\n InputBatch::Log.status_log.info \"Image #{filename} found\"\n image.page_count = %x[identify #{temp_path}].split(filename).length-1 rescue nil\n end\n\n rename_image image if facility.index_file_parser_type == \"WellsFargo_bank\"\n return image\n end", "def update\n @listing = Listing.find(params[:listing])\n picture = params[:photo]\n if picture != nil\n file = File.new(Rails.root.join('app', 'assets', 'images', picture.original_filename), 'wb')\n file.write(picture.read)\n submission_hash = {\"name\" => params[:name],\n \"description\" => params[:description],\n \"dates\" => params[:dates],\n \"city\" => params[:city],\n \"category\" => params[:category],\n \"address\" => params[:address],\n \"photo\" => picture.original_filename}\n @listing.update_attributes(submission_hash)\n render :action => 'crop' \n else\n submission_hash = {\"name\" => params[:name],\n \"description\" => params[:description],\n \"dates\" => params[:dates],\n \"city\" => params[:city],\n \"address\" => params[:address],\n \"category\" => params[:category]}\n @listing.update_attributes(submission_hash)\n redirect_to :action => :listing, :id => @listing.id\n end\n end", "def update\n prevent_browser_caching\n # update the uploaded images\n update_uploaded_images @furniture, :admin_furniture_furniture\n # if the user removed the cover image? reset the cover index\n @furniture.cover_details[:index] = 0 if ((params[:admin_furniture_furniture][:images_to_delete] and params[:admin_furniture_furniture][:images_to_delete].include? @furniture.cover_details['index']) or @furniture.cover_details['index'].to_i >= @furniture.images.length)\n\n respond_to do |format|\n if @furniture.update(furniture_params)\n format.html { redirect_to redirection_url, notice: 'محصول «<b>%s</b>» با موفقیت ویرایش شد.' %@furniture.name }\n format.json { render json: @furniture, status: :ok, location: redirection_url }\n else\n format.html { render :edit }\n format.json { render json: @furniture.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_house_image\n @house_image = HouseImage.find(params[:id])\n end", "def update\n nombreImagen = SecureRandom.uuid + File.extname(contest_params[:banner].original_filename)\n carpeta = File.join(Rails.public_path, \"uploaded_images\", Time.now.strftime(\"%Y-%m-%d\"))\n rutaAbsoluta = File.join(carpeta, nombreImagen)\n FileUtils.mkdir_p(carpeta)\n File.open(rutaAbsoluta, 'wb') do |f|\n f.write(contest_params[:banner].read)\n end\n \n params[:contest][:banner] = \"/uploaded_images/\" + Time.now.strftime(\"%Y-%m-%d\") + \"/\" + nombreImagen\n params[:contest][:url] = \"http://\" + request.host + \":\" + (request.port.to_s) +\"/contests/join/\" + params[:contest][:url]\n\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { render :show, status: :ok, location: @contest }\n else\n format.html { render :edit }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_img\n @post = Post.find(self.id)\n image = @post.image.url(:gallery)\n image = '/public' + image.gsub(/\\?.*/, '')\n\n if !@post.meme_text.nil?\n if File.exists? Rails.root.to_s + image\n PostsHelper.image_writer(image, @post.meme_text, @post.meme_position)\n end\n end\n end", "def set_img\n @img = Img.find(params[:id])\n end", "def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @image = args[:image] unless args[:image].nil?\n end", "def update!(**args)\n @enhanced_image = args[:enhanced_image] if args.key?(:enhanced_image)\n @feature_graphic = args[:feature_graphic] if args.key?(:feature_graphic)\n @screenshot = args[:screenshot] if args.key?(:screenshot)\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n unless params[:draft_img].blank?\n attachment = Attachment.create(attachment_entity_type: \"Article\",attachment_entity_id: @article.id , path: params[:draft_img], created_by: 1 ) \n @article.cover_img = attachment.id\n @article.save\n end\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.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 if params[:book][:cover]\n @book.attachment.destroy if @book.attachment\n Attachment.create(:attachment => params[:book][:cover], :attachmenttable => @book)\n end\n format.html { redirect_to @book, notice: I18n.t(\"flash.actions.update.notice\") }\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!(**args)\n @image_style = args[:image_style] if args.key?(:image_style)\n @image_url = args[:image_url] if args.key?(:image_url)\n @subtitle = args[:subtitle] if args.key?(:subtitle)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @image_style = args[:image_style] if args.key?(:image_style)\n @image_url = args[:image_url] if args.key?(:image_url)\n @subtitle = args[:subtitle] if args.key?(:subtitle)\n @title = args[:title] if args.key?(:title)\n end", "def update!(**args)\n @image_style = args[:image_style] if args.key?(:image_style)\n @image_url = args[:image_url] if args.key?(:image_url)\n @subtitle = args[:subtitle] if args.key?(:subtitle)\n @title = args[:title] if args.key?(:title)\n end", "def update\n enforce_permissions!('manage_collection', params[:id])\n\n @object = retrieve_object!(params[:id])\n # If a cover image was uploaded, remove it from the params hash\n cover_image = params[:digital_object]&.delete(:cover_image)\n\n @institutes = Institute.all\n @inst = Institute.new\n\n supported_licences\n\n @object.assign_attributes(update_params)\n unless @object.valid?\n flash[:alert] = t('dri.flash.alert.invalid_object', error: @object.errors.full_messages.inspect)\n render :edit\n return\n end\n\n @object.increment_version\n\n if cover_image.present?\n url = Storage::CoverImages.validate_and_store(cover_image, @object)\n if url\n @object.cover_image = url\n else\n flash[:error] = t('dri.flash.error.cover_image_not_saved')\n end\n end\n\n respond_to do |format|\n if save_and_index\n post_save do\n mint_or_update_doi(@object, doi) if doi\n end\n\n flash[:notice] = t('dri.flash.notice.updated')\n format.html { redirect_to controller: 'my_collections', action: 'show', id: @object.alternate_id }\n format.json { render json: @object }\n else\n flash[:alert] = t('dri.flash.error.unable_to_persist')\n format.html { render action: 'edit' }\n end\n end\n end", "def charcoal\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.charcoal(0.0, 1.0)\n img.write('public' + @photo.attachment_url)\n end", "def update\n @boat_cover_image_name = BoatCoverImageName.find(params[:id])\n\n respond_to do |format|\n if @boat_cover_image_name.update_attributes(params[:boat_cover_image_name])\n format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat_cover_image_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_image_conmment\n @image_conmment = ImageConmment.find(params[:id])\n end", "def update_remote_photo!\r\n return if @values[:image_url].blank?\r\n \r\n photo = @product.remote_photos.from_source(@source).first\r\n photo ||= RemotePhoto.new :source => @source, :owner => @product\r\n \r\n photo.url = @values[:image_url]\r\n photo.caption = @product.title\r\n \r\n # We don't get image size (:x and :y) just a URL, so I've hard coded this to 100x100.\r\n photo.x = photo.y = 100\r\n photo.save!\r\n end", "def image_cover_save\n result = RestaurantManage.image_cover_save(@restaurant, params[:cover_id])\n get_restaurant()\n render json: result\n end", "def update\n @cover_cat = CoverCat.find(params[:id])\n\n respond_to do |format|\n if @cover_cat.update_attributes(params[:cover_cat])\n format.html { redirect_to @cover_cat, notice: 'Cover cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cover_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image.update(image_params)\n redirect_to '/images'\n end", "def set_img\n\n end", "def upload_photo(cocktail_id)\n cocktailloader = Cocktailloader.find_by(mrcock_id: cocktail_id)\n cocktail = Cocktail.find(cocktail_id)\n img = cocktailloader.strDrinkThumb if cocktailloader\n cocktail.remote_photo_url = img if img\n puts \"photo saved\"\n cocktail.save\nend", "def set_im\n @im = Im.find(params[:id])\n end", "def cover\n\t\tself.image.blank? ? \"default.jpg\" : self.image\n\tend", "def update\n \n @album = @user.albums.find(params[:id])\n respond_to do |format|\n format.js { render 'new' }\n format.html{\n if @album.update_attributes params[:album]\n @album.avatar.reprocess!\n flash[:notice] = 'User was successfully updated.'\n if params[:album][:avatar].blank?\n redirect_to @album\n else\n \n render :action => 'cropping'\n end\n else\n render :action => \"edit\"\n end}\n end\n end", "def update!(**args)\n @discretized_style_image_type_confidence = args[:discretized_style_image_type_confidence] if args.key?(:discretized_style_image_type_confidence)\n @style_image_type = args[:style_image_type] if args.key?(:style_image_type)\n end", "def update\n @property = Property.find(params[:id])\n\n if params[:type_is] == \"photo_gallery\"\n #Cover Image Save\n if params[\"property\"][\"prop_cover_img\"]\n @property_cover_img = @property.property_cover_image.present? ? @property.property_cover_image : @property.build_property_cover_image\n @property_cover_img.upload_image(params[\"property\"][\"prop_cover_img\"])\n end\n\n #Other images\n if params[\"property\"][\"prop_imgs\"]\n params[\"property\"][\"prop_imgs\"].each do |img|\n @property.property_images.new.upload_image(img) if img\n end\n end\n\n respond_to do |format|\n # flash[:success] = \"New Images Successfully Uploaded.</br><a href='#{properties_path(active_id: @property.id)}'>Show in List</a>\"\n format.html { redirect_to edit_property_path(@property.key, type_is: params[:type_is]) }\n format.json { render action: 'show', status: :created, location: @property }\n end\n else\n prior_property_name = @property.title\n @property.assign_attributes(property_params)\n if params[:use_current_rent] == false\n @property.lease_base_rent = @property.current_rent\n end\n\n if !(@property.owner_person_is.nil? || @property.owner_person_is==0)\n if @property.owner_person_is == 1 && !@property.owner_entity_id_indv.nil?\n @property.owner_entity_id = @property.owner_entity_id_indv\n end\n else\n @property.owner_entity_id = @property.owner_entity_id_indv = 0\n end\n\n if @property.rent_table_version.nil?\n @property.rent_table_version = 1\n else\n @property.rent_table_version = @property.rent_table_version + 1\n end\n\n respond_to do |format|\n if @property.save\n\n # finally remove the old upload\n # Cloudinary::Uploader.destroy(public_id) unless public_id.blank?\n \n if @property.can_create_rent_table?\n rent_table_version = @property.rent_table_version\n\n base_rent = @property.lease_base_rent\n duration = @property.lease_duration_in_years\n extension_percentage = @property.lease_rent_increase_percentage || 0\n base_percentage = @property.base_rent_increase_percentage || 0\n slab = @property.lease_rent_slab_in_years || 1\n\n rent = base_rent\n @property.rent_tables.create(version: rent_table_version, rent: base_rent, description: 'Base Annual Rent')\n @property.rent_tables.create(version: rent_table_version, rent: base_rent / 12.00, description: 'Base Monthly Rent (approx.)')\n @property.rent_tables.create(version: rent_table_version, rent: base_rent/ 365.00, description: 'Base Daily Rent (approx.)')\n prev_rent = rent\n rent_start = @property.rent_commencement_date || Time.now\n rent_start = Time.now if @property.rent_commencement_date_details == 'Date not certain'\n start_year = rent_start.year\n end_year = 0\n\n count = 0\n\n if @property.lease_is_pro_rated && @property.rent_commencement_date_details != 'Date not certain'\n d = rent_start\n\n # 0 fill in the pro rated fields for the property and save\n @property.pro_rated_month = d.month\n @property.pro_rated_month_name = Date::MONTHNAMES[d.month]\n @property.pro_rated_day = d.day\n @property.pro_rated_year = d.year\n @property.pro_rated_day_date = d.to_date\n @property.pro_rated_day_rent = (base_rent / 365.00)\n @property.pro_rated_month_rent = (base_rent / 12.00) - ((d.day - 1) * @property.pro_rated_day_rent)\n @property.save\n\n @property.rent_tables.create(version: rent_table_version, rent: @property.pro_rated_month_rent,\n description: \"Pro-rated Rent for :#{Date::MONTHNAMES[d.month]} #{d.year}\")\n\n # 1 - calculate the pro-rated rent for year 1\n rent_first_year = rent * (((Date.parse(\"31/12/#{d.year}\") - d.to_date).to_i) * 1.00/(d.year % 4 == 0 ? 366.00 : 365.00))\n # 2 - add the rent table entry\n @property.rent_tables.create(version: rent_table_version, start_year: d.year, end_year: d.year, rent: rent_first_year)\n # 3 - decrease the duration by 1 and update rent\n duration = duration - 1\n start_year = d.year + 1\n count = slab - 1\n slab = slab - 1\n end\n\n\n while start_year <= rent_start.year + duration - 1\n if count == 0\n slab = @property.lease_rent_slab_in_years || 1\n else\n count = 0\n end\n end_year = start_year + slab - 1\n\n if end_year >= rent_start.year + duration - 1\n end_year = rent_start.year + duration - 1\n end\n\n prev_rent = rent\n @property.rent_tables.create(version: rent_table_version, start_year: start_year, end_year: end_year, rent: rent)\n\n start_year = end_year + 1\n if @property.rent_increase_in_base_term_status\n rent = rent + rent * base_percentage / 100\n end\n end\n\n if @property.number_of_option_period && @property.length_of_option_period &&\n @property.number_of_option_period > 0 && @property.length_of_option_period > 0\n duration = @property.number_of_option_period * @property.length_of_option_period\n start_year = end_year + 1\n rent_start = Date.parse(\"01/01/#{start_year}\")\n rent = prev_rent\n slab = @property.length_of_option_period\n count = 1\n while start_year <= rent_start.year + duration - 1\n end_year = start_year + slab - 1\n\n if end_year >= rent_start.year + duration - 1\n end_year = rent_start.year + duration - 1\n end\n\n prev_rent = rent\n @property.rent_tables.create(version: rent_table_version,\n start_year: start_year, end_year: end_year, rent: rent,\n is_option: true, option_slab: count)\n\n start_year = end_year + 1\n rent = rent + rent * extension_percentage / 100\n count = count + 1\n end\n end\n\n end\n\n flash[:success] = \"Congratulations, you have just made a change in the record for #{prior_property_name}\"\n\n if params[:lease_sub].blank?\n format.html { redirect_to edit_property_path(@property.key, type_is: params[:type_is]) }\n else\n format.html { redirect_to edit_property_path(@property.key, type_is: params[:type_is], lease_sub: params[:lease_sub]) }\n end\n format.js { render json: @property.to_json, status: :ok }\n format.json { render action: 'show', status: :created, location: @property }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n if @carousel.update(carousel_params)\n @carousel.src.attach(carousel_params[:src])\n flash[:success] = '创建成功'\n redirect_to carousels_path\n else\n flash.now[:error] = '创建失败'\n render new\n end\n end", "def update!(**args)\n @style_image_type_predictions = args[:style_image_type_predictions] if args.key?(:style_image_type_predictions)\n @version = args[:version] if args.key?(:version)\n end", "def update\r\n @cat1 = Cat1.find(params[:id])\r\n name = params[:cat1][:pic1].original_filename if params[:cat1][:pic1]\r\n directory = 'public/img'\r\n directory_1c = 'public/images_1c'\r\n path = File.join(directory, name) if params[:cat1][:pic1]\r\n path_1c = File.join(directory_1c, name) if params[:cat1][:pic1]\r\n # if params[:cat1][:pic1].instance_of?(Tempfile)\r\n # FileUtils.cp(params[:cat1][:pic1].local_path, path)\r\n # else\r\n File.open(path, \"wb\") { |f| f.write(params[:cat1][:pic1].read) } if params[:cat1][:pic1]\r\n FileUtils.cp(path, path_1c) if params[:cat1][:pic1]\r\n # end\r\n\r\n\r\n\r\n respond_to do |format|\r\n if @cat1.update_attributes(params[:cat1])\r\n pic = name[0..-5] if name\r\n @cat1.pic1 = pic if params[:cat1][:pic1]\r\n @cat1.save\r\n flash[:notice] = 'Сохранено.'\r\n format.html { redirect_to(:back) }\r\n end\r\n end\r\n end", "def update\n @category_image = CategoryImage.find(params[:id])\n\n respond_to do |format|\n if @category_image.update_attributes(params[:category_image])\n format.html { redirect_to @category_image, notice: 'Category image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n #byebug\n respond_to do |format|\n if @item.update!(item_params)\n if params[:item][:image].present?\n format.html {render :crop , notice: 'Now, crop your image.' }\n else\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n end\n else\n flash[:error] = \"Couldnt update\"\n flash[:model] = @item\n flash[:model_errors] = @item.errors\n format.html { redirect_to :action => :edit } \n end\n end\n end", "def update\n @web_display_car_image = WebDisplayCarImage.find(params[:id])\n\n if@web_display_car_image.update(web_display_car_image_params)\n head :no_content\n else\n render json:@web_display_car_image.errors, status: :unprocessable_entity\n end\n end", "def update\n @banner_img = BannerImg.find(params[:id])\n\n respond_to do |format|\n if @banner_img.update_attributes(params[:banner_img])\n format.html { redirect_to @banner_img, notice: 'Banner img was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @banner_img.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @picture.update(picture_params)\n create_image_tumb(@picture)\n format.html { redirect_to @picture, notice: 'Picture was successfully updated.' }\n format.json { render :show, status: :ok, location: @picture }\n else\n format.html { render :edit }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n if !params[:model].nil?\r\n @model.update_attributes(model_params)\r\n end\r\n\r\n if !params[:model_attachments].nil?\r\n maintain_model_attachments\r\n end\r\n\r\n flash[:notice] = \"Saved!\"\r\n redirect_to edit_model_path(@model)\r\n end", "def update\n if current_user.nil?\n redirect_to(log_in_path) and return\n end\n\n @persona_vinculada = PersonaVinculada.find(params[:id])\n \n# img_orig = Magick::Image.read(params[:persona_vinculada][:foto]).first\n# archivo = img_orig.resize_to_fit(x,75) \n \n# image_orig.change_geometry!(\"640x480\") { |cols, rows, img|\n# newimg = img.resize(cols, rows)\n# newimg.write(\"newfilename.jpg\")\n# }\n \n# if !params[:persona_vinculada][:foto].nil?\n# archivo = params[:persona_vinculada][:foto]\n# name = params[:persona_vinculada][:tipo_documento].to_s.rjust(3, \"0\") + params[:persona_vinculada][:numero_documento].rjust(10, \"0\") + archivo.original_filename[-4, 4]\n# directory = \"app/assets/images\"\n# path = File.join(directory, name) \n#\n# params[:persona_vinculada][:foto] = name\n# end\n\n respond_to do |format|\n if @persona_vinculada.update_attributes(params[:persona_vinculada])\n# if !archivo.nil?\n# File.open(path, \"wb\") { |f| f.write(archivo.read) }\n# end\n format.html { redirect_to @persona_vinculada, notice: 'Persona vinculada fue actualizada satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona_vinculada.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n if @imagem.update_attributes(params[:imagem])\n format.html { redirect_to @imagem, notice: 'Imagem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @imagem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image_section = ImageSection.find(params[:id])\n ci = @image_section.combined_image\n\n respond_to do |format|\n if @image_section.update_attribute(:sketchpad_json, params[:drawn_json])\n format.html { redirect_to edit_image_section_path(ci.image_sections.sample), \n notice: 'Image section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n bookapi = Book.for(@book.name)\n book1 = bookapi[0]\n bookcover = book1[\"volumeInfo\"][\"imageLinks\"][\"smallThumbnail\"] \n bookdescription = book1[\"volumeInfo\"][\"description\"]\n @book.update(coverimage: bookcover, description: bookdescription) \n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n \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" ]
[ "0.6791484", "0.6707012", "0.67048645", "0.6671547", "0.656356", "0.65613914", "0.6477551", "0.64714533", "0.644548", "0.63592976", "0.634392", "0.634392", "0.634392", "0.6308377", "0.6270875", "0.62613964", "0.626087", "0.61981976", "0.6153218", "0.61379963", "0.61192554", "0.61142874", "0.61142874", "0.6112456", "0.609747", "0.60927296", "0.6086586", "0.6070817", "0.6064819", "0.6011554", "0.60060924", "0.5984735", "0.5958663", "0.5955303", "0.5952072", "0.5949347", "0.5941245", "0.59393305", "0.5937378", "0.5905389", "0.5892419", "0.5871993", "0.5864011", "0.5842745", "0.58386236", "0.5838243", "0.58294165", "0.58179706", "0.58157873", "0.580716", "0.5789228", "0.5787791", "0.57858133", "0.577482", "0.57680166", "0.5758957", "0.57586265", "0.57584786", "0.57486063", "0.5747233", "0.5744711", "0.57274365", "0.5725121", "0.5717326", "0.5716947", "0.57129705", "0.5708696", "0.569753", "0.5697488", "0.56949925", "0.5693481", "0.5693481", "0.5693481", "0.56892127", "0.5688215", "0.56780624", "0.56766707", "0.56765044", "0.5671099", "0.5667693", "0.5661563", "0.5652992", "0.5649381", "0.56489146", "0.5639866", "0.5634545", "0.5628266", "0.5617239", "0.56131464", "0.56003106", "0.559564", "0.5589437", "0.55872005", "0.557266", "0.5572404", "0.5572365", "0.5559617", "0.5558591", "0.5551705", "0.5546673", "0.5545649" ]
0.0
-1
replace name with the converted value in TITLE_CONVERSION_LIST if it's been flagged for modification (due to an improper solicitation, etc)
def check_title(name) # titleize without the botched 'S (apostrophe-s) issue name = name.humanize.strip.squeeze(' ').gsub(/\b([a-z])/) { $1.capitalize }.gsub(/\'S/, '\'s') match = TITLE_CONVERSION_LIST.keys.select { |t| name.match(/#{Regexp.escape(t)}/i) } unless match.empty? match = match.sort.reverse[0] # select the longest match (most accurate) name = TITLE_CONVERSION_LIST[match] end log("checked display name is [#{name}]", :debug) name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def titleize_proper_names\n self.author = self.author.titleize\n self.editor = self.editor.titleize if self.editor\n self.buyed_from = self.buyed_from.titleize if self.buyed_from\n end", "def parameterize_title_for_name\n self.name = title.parameterize if title\n end", "def titleize\n dup.tap(&:titleize!)\n end", "def convert_name\n self.name = I18n.transliterate(self.name).upcase\n end", "def convert_name\n self.name = I18n.transliterate(self.name).upcase\n end", "def fillin_translations\n collection_types = Hyrax::CollectionType.all\n collection_types.each do |c|\n next unless c.title =~ /^translation missing/\n oldtitle = c.title\n c.title = I18n.t(c.title.gsub(\"translation missing: en.\", ''))\n c.save\n Rails.logger.debug \"#{oldtitle} changed to #{c.title}\"\n end\n end", "def titleize\n @collection.dictionary.each do |id, data|\n next unless File.basename(data['id']) =~ /^untitled/\n new_name = Ruhoh::StringFormat.clean_slug(data['title'])\n new_file = \"#{new_name}#{File.extname(data['id'])}\"\n old_file = File.basename(data['id'])\n next if old_file == new_file\n\n FileUtils.cd(File.dirname(data['pointer']['realpath'])) {\n FileUtils.mv(old_file, new_file)\n }\n Ruhoh::Friend.say { green \"Renamed #{old_file} to: #{new_file}\" }\n end\n end", "def titleize!\n replace titleize\n end", "def transform_control_title (title)\n title.gsub(/^\\(L1\\) /, '').gsub(/[()',.&:]/, '').gsub(/.scr/, '').gsub(/\\s+/, '_').gsub(/[\\\\%-]/, '_').gsub(/_+/,'_').downcase\nend", "def titleize\n lambda do |_rec, acc|\n acc.collect!(&:titleize)\n end\n end", "def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end", "def format_name\n if target\n target.format_name\n else\n orphan_title.sub(/ (\\d+)$/, \"\")\n end\n end", "def prepare_label_for_translator(label)\n validate_language_rule\n \n substitution_value = \"\" \n substitution_value << sanitized_name if allowed_in_translation?\n substitution_value << \" \" unless substitution_value.blank?\n substitution_value << language_rule.default_transform(self, piped_params)\n \n label.gsub(full_name, substitution_value) \n end", "def titleize_name\r\n self.name = name.titleize\r\n end", "def titleize_name\n self.name = self.name.titleize unless self.name.blank?\n end", "def standardize_name(name)\n @team_data['aliases'].fetch(name, name)\n end", "def update_research_name\n res_name = I18n.transliterate(Tag.sanitize_name(self.name)).to_s\n self.update_column(:research_name, res_name)\n end", "def title=(new_title)\n new_title.capitalize!\n arr = ['over', 'the', 'and', 'in', 'of', 'a', 'an']\n @title = new_title.split(' ').map! { |word| arr.include?(word) ? word : word.capitalize }.join(' ')\n end", "def converttitles()\n merge(converttitles: 'true')\n end", "def titleize\n arr = %w(a an the by to)\n upcase_arr = %w(DX EDA AEDG LPD COP)\n r = gsub('_', ' ').gsub(/\\w+/) do |match|\n match_result = match\n if upcase_arr.include?(match.upcase)\n match_result = upcase_arr[upcase_arr.index(match.upcase)]\n elsif arr.include?(match)\n match_result = match\n else\n match_result = match.capitalize\n end\n match_result\n end\n\n r\n end", "def apply_updates_title(title)\n return if title.to_s.empty?\n\n wrap_length = MAX_LINE_LENGTH - WORD_WRAP_INDENT\n\n @control_string.sub!(\n /title\\s+(((\").*?(?<!\\\\)\")|((').*?(?<!\\\\)')|((%q{).*?(?<!\\\\)[}])|(nil))\\n/m,\n \"title %q{#{title}}\".word_wrap(wrap_length).indent(WORD_WRAP_INDENT)\n )\n end", "def change_character_names(story)\n self.archetype === \"hero\" ? story.content.gsub!(\"HERO\", self.name) : false\n self.archetype === \"shadow\" ? story.content.gsub!(\"SHADOW\", self.name) : false\n self.archetype === \"friend\" ? story.content.gsub!(\"FRIEND\", self.name) : false\n self.archetype === \"lover\" ? story.content.gsub!(\"LOVER\", self.name) : false\n self.archetype === \"mentor\" ? story.content.gsub!(\"MENTOR\", self.name) : false\n self.archetype === \"trickster\" ? story.content.gsub!(\"TRICKSTER\", self.name) : false\n end", "def titleize!(title)\n title.split.map { |word| word.gsub(word[0],word[0].upcase) }.join(' ')\nend", "def regulate_title\n self.title = self.title.strip\n self.title.downcase!\n end", "def set_formats_for_name_and_filename\n self.name = self.name.tr(' ', '_')\n self.filename = self.filename.tr(' ', '_')\n end", "def titleize\n#\t\thumanize(underscore(self)).gsub(/\\b('?[a-z])/) { $1.capitalize }\n#\t\thumanize(self.underscore).gsub(/\\b('?[a-z])/) { $1.capitalize }\n\t\tself.underscore.humanize.gsub(/\\b('?[a-z])/) { $1.capitalize }\n\tend", "def populate_title\n if self.title.blank?\n self.title = self.file_file_name.blank? ? \"\" : self.file_file_name.gsub(/_/, \" \").capitalize\n end\n\tend", "def change_name!\n @project[:name] = \"#{@project[:name]}-PR#{@number}\" if @project[:name]\n @project[:value][:name] = \"#{@project[:value][:name]}-PR#{@number}\" if @project[:value][:name]\n end", "def localizeSkillName(name)\n #Remove 'effect' from translated\n effectPattern = /(?<=\\s)((?:E|e)ffect)/\n name = name.gsub(effectPattern, '')\n\n #Remove space between arrow symbol\n arrowPattern = /(\\s+)(#{CommonFields::BUFF_SYMBOL})/\n if (arrowPattern.match(name))\n lastMatch = Regexp.last_match\n spaceIdxB = lastMatch.begin(1)\n spaceIdxE = lastMatch.end(1)\n name = \"#{name[0..(spaceIdxB-1)]}#{name[lastMatch.begin(2)]}\"\n end\n\n #Replacement for localization (lightning, blast)\n name = name.gsub( /(?:L|l)ightning/, 'Thunder')\n name = name.gsub(/(?:E|e)xplosion/, 'Blast')\n\n #Capitalize every word inside parenthesis\n nameArray = name.split(/\\s+/)\n (nameArray.map do |v| \n if v.length > 2 \n v.capitalize\n else\n v \n end\n end).join(' ').gsub(/\\r|\\R|\\n/, '').strip\n end", "def change_name_description(object, symbol, params, activity_params = {})\n authorize object\n\n new_name = params[:name]\n new_description = params[:description]\n old_description = object.description\n old_name = object.name\n\n change_description(object, symbol, old_description, new_description, activity_params)\n change_name(object, symbol, old_name, new_name, activity_params)\n end", "def replize_title(title)\n if /^re:/i =~ title\n title\n else\n 'RE: ' + title\n end\n end", "def titleize_names\n self.first_name = self.first_name.titleize\n self.last_name = self.last_name.titleize\n end", "def setName\n self.name.nil? ? \"invalid\" : self.name.upcase\n self.second_name.nil? ? \"\" : self.second_name.titleize\n # self.name = self.name.upcase if not self.name.nil?\n # self.second_name = self.second_name.titleize if not self.second_name.nil?\n end", "def marc_sortable_title\n lambda do |record, accumulator|\n st = Marc21Semantics.get_sortable_title(record)\n accumulator << st if st\n end\n end", "def upcased_title\n title.upcase\n end", "def upcased_title\n title.upcase\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def format_title_description\n if description.present? && title.present?\n self.description = description.strip.capitalize\n self.title = title.strip.capitalize\n end\n end", "def capitalize_names!\n @artist_name = StringUtils.mixed_case(@artist_name)\n @name = StringUtils.mixed_case(@name)\n @subtitle = StringUtils.mixed_case(@subtitle)\n @genre = StringUtils.mixed_case(@genre)\n @mixer = StringUtils.mixed_case(@mixer)\n @version_name = StringUtils.mixed_case(@version_name)\n @version_name.gsub!(/(\\A|\\s)(Version|Release)\\b/) {|string| string.downcase} if @version_name\n end", "def update_name\n # update the name so it includes the standard_template string\n name_array = [@standard_template]\n name_array << get_building_type\n @building_sections.each do |bld_tp|\n name_array << bld_tp.standards_building_type\n end\n name_array << @name if !@name.nil? && !@name == ''\n @name = name_array.join('|').to_s\n end", "def reformat_twofaced_names(card)\n end", "def process_names(total)\n names = self.feature.names\n prioritized_names = self.feature.prioritized_names\n delete_feature_names = self.fields.delete('feature_names.delete')\n association_notes = self.feature.association_notes\n name_added = false\n name_changed = false\n if !delete_feature_names.blank? && delete_feature_names.downcase == 'yes'\n names.clear\n association_notes.delete(association_notes.where(:association_type => 'FeatureName'))\n end\n replace_feature_names = self.fields.delete('feature_names.replace')\n if !replace_feature_names.blank?\n name = names.find_by(name: replace_feature_names)\n if name.nil?\n self.say \"Feature name to be replaced #{replace_feature_names} does not exist for feature #{self.feature.pid}\"\n else\n name_str = self.fields.delete('feature_names.name')\n if name_str.blank?\n self.say \"No name specified to replace #{replace_feature_names} for feature #{self.feature.pid}.\"\n else\n name.update_attributes(name: name_str, skip_update: true)\n name_changed = true\n end\n end\n end\n name_positions_with_changed_relations = Array.new\n relations_pending_save = Array.new\n delete_is_primary = self.fields.delete('feature_names.is_primary.delete')\n if !delete_is_primary.blank? && delete_is_primary.downcase == 'yes'\n names.where(:is_primary_for_romanization => true).each do |name|\n name_changed = true if !name_changed\n name.update_attributes(:is_primary_for_romanization => false, :skip_update => true)\n end\n end \n # feature_names.note can be used to add general notes to all names of a feature\n 0.upto(3) do |i|\n feature_names_note = self.fields.delete(i==0 ? 'feature_names.note' : \"feature_names.#{i}.note\")\n if !feature_names_note.blank?\n note = association_notes.find_by(association_type: 'FeatureName', content: feature_names_note)\n if note.nil?\n note = association_notes.create(:association_type => 'FeatureName', :content => feature_names_note)\n self.spreadsheet.imports.create(:item => note) if note.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n end\n self.say \"Feature name note #{feature_names_note} could not be saved for feature #{self.feature.pid}\" if note.nil?\n end\n end\n name = Array.new(total)\n 1.upto(total) do |i|\n n = i-1\n name_tag = \"#{i}.feature_names\"\n name_str = self.fields.delete(\"#{name_tag}.name\")\n if name_str.blank?\n name_str = self.fields.delete(\"#{name_tag}.existing_name\")\n next if name_str.blank?\n name[n] = names.find_by(name: name_str)\n existing = true\n else\n existing = false\n end\n relationship_system_code = self.fields.delete(\"#{i}.feature_name_relations.relationship.code\")\n if !relationship_system_code.blank?\n relationship_system = SimpleProp.get_by_code(relationship_system_code)\n if relationship_system.nil?\n self.say \"Phonetic or orthographic system with code #{relationship_system_code} was not found for feature #{self.feature.pid}.\"\n else\n if relationship_system.instance_of? OrthographicSystem\n orthographic_system = relationship_system\n elsif relationship_system.instance_of? PhoneticSystem\n phonetic_system = relationship_system\n elsif relationship_system.instance_of? AltSpellingSystem\n alt_spelling_system = relationship_system\n else\n self.say \"Relationship #{relationship_system_code} has to be either phonetic or orthographic for feature #{self.feature.pid}.\"\n end\n end\n else\n begin\n orthographic_system = OrthographicSystem.get_by_code_or_name(self.fields.delete(\"#{i}.orthographic_systems.code\"), self.fields.delete(\"#{i}.orthographic_systems.name\"))\n rescue Exception => e\n self.say e.to_s\n end\n begin\n phonetic_system = PhoneticSystem.get_by_code_or_name(self.fields.delete(\"#{i}.phonetic_systems.code\"), self.fields.delete(\"#{i}.phonetic_systems.name\"))\n rescue Exception => e\n self.say e.to_s\n end\n end\n if !existing\n conditions = {:name => name_str}\n begin\n language = Language.get_by_code_or_name(self.fields.delete(\"#{i}.languages.code\"), self.fields.delete(\"#{i}.languages.name\"))\n rescue Exception => e\n self.say e.to_s\n end\n begin\n writing_system = WritingSystem.get_by_code_or_name(self.fields.delete(\"#{i}.writing_systems.code\"), self.fields.delete(\"#{i}.writing_systems.name\"))\n conditions[:writing_system_id] = writing_system.id if !writing_system.nil?\n rescue Exception => e\n self.say e.to_s\n end\n begin\n alt_spelling_system = AltSpellingSystem.get_by_code_or_name(self.fields.delete(\"#{i}.alt_spelling_systems.code\"), self.fields.delete(\"#{i}.alt_spelling_systems.name\"))\n rescue Exception => e\n self.say e.to_s\n end\n # if language is not specified it may be inferred.\n if language.nil?\n if phonetic_system.nil?\n language = Language.get_by_code('zho') if !writing_system.nil? && (writing_system.code == 'hant' || writing_system.code == 'hans')\n else\n language = Language.get_by_code('bod') if phonetic_system.code=='ethnic.pinyin.tib.transcrip' || phonetic_system.code=='tib.to.chi.transcrip'\n end\n end\n etymology = self.fields.delete(\"#{name_tag}.etymology\")\n conditions[:language_id] = language.id if !language.nil?\n name[n] = names.find_by(conditions)\n is_primary = self.fields.delete(\"#{i}.feature_names.is_primary\")\n conditions[:is_primary_for_romanization] = is_primary.downcase=='yes' ? 1 : 0 if !is_primary.blank?\n conditions[:etymology] = etymology if !etymology.blank?\n \n # now deal with relationships\n relation_conditions = Hash.new\n relation_conditions[:orthographic_system_id] = orthographic_system.id if !orthographic_system.nil?\n relation_conditions[:phonetic_system_id] = phonetic_system.id if !phonetic_system.nil?\n relation_conditions[:alt_spelling_system_id] = alt_spelling_system.id if !alt_spelling_system.nil?\n position = self.fields.delete(\"#{i}.feature_names.position\")\n if name[n].nil? || !relation_conditions.empty? && name[n].parent_relations.find_by(relation_conditions).nil?\n conditions[:position] = position if !position.blank?\n name[n] = names.create(conditions.merge({:skip_update => true}))\n if !name[n].id.nil?\n self.spreadsheet.imports.create(:item => name[n]) if name[n].imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n name_added = true if !name_added\n end\n else\n name[n].position = position if !position.blank?\n name[n].etymology = etymology if !etymology.blank?\n if name[n].changed?\n name[n].save!\n self.spreadsheet.imports.create(:item => name[n]) if name[n].imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n name_changed = true\n end\n end\n if name[n].id.nil?\n self.say \"Name #{name_str} could not be added to feature #{self.feature.pid}. #{name[n].errors.messages.to_s}\"\n next\n end\n end\n 0.upto(4) do |j|\n prefix = j==0 ? \"#{i}.feature_names\" : \"#{i}.feature_names.#{j}\"\n self.add_date(prefix, name[n])\n self.add_info_source(prefix, name[n])\n self.add_note(prefix, name[n])\n end\n is_translation_str = self.fields.delete(\"#{i}.feature_name_relations.is_translation\")\n is_translation = is_translation_str.downcase=='yes' ? 1: 0 if !is_translation_str.blank?\n parent_node_str = self.fields.delete(\"#{i}.feature_name_relations.parent_node\")\n parent_name_str = self.fields.delete(\"#{i}.feature_name_relations.parent_node.name\") if parent_node_str.blank?\n # for now is_translation is the only feature_name_relation that can be specified for a present or missing (inferred) parent.\n # if no parent is specified, it is possible to infer the parent based on the relationship to an already existing name.\n if parent_node_str.blank? && parent_name_str.blank?\n # tibetan must be parent\n if !phonetic_system.nil? && (phonetic_system.code=='ethnic.pinyin.tib.transcrip' || phonetic_system.code=='tib.to.chi.transcrip')\n parent_name = FeatureExtensionForNamePositioning::HelperMethods.find_name_for_writing_system(prioritized_names, WritingSystem.get_by_code('tibt').id)\n if parent_name.nil?\n self.say \"No tibetan name was found to associate #{phonetic_system.code} to #{name_str} for feature #{self.feature.pid}.\"\n else\n name_relation = name[n].parent_relations.find_by(parent_node_id: parent_name.id)\n if name_relation.nil?\n name_relation = name[n].parent_relations.create(:skip_update => true, :parent_node_id => parent_name.id, :phonetic_system_id => phonetic_system.nil? ? nil : phonetic_system.id, :is_phonetic => 1, :is_translation => is_translation)\n if name_relation.nil?\n self.say \"Could not associate #{name_str} to Tibetan name for feature #{self.feature.pid}.\"\n else\n parent_name.update_hierarchy\n name_positions_with_changed_relations << n if !name_positions_with_changed_relations.include? n\n end\n else\n name_relation.update_attributes(:phonetic_system_id => phonetic_system.nil? ? nil : phonetic_system.id, :is_phonetic => 1, :orthographic_system_id => nil, :is_orthographic => 0, :is_translation => is_translation)\n end\n self.spreadsheet.imports.create(:item => name_relation) if name_relation.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n end \n end\n # now check if there is simplified chinese and make it a child of trad chinese\n writing_system = name[n].writing_system\n if !writing_system.nil? && writing_system.code=='hant'\n simp_chi_name = FeatureExtensionForNamePositioning::HelperMethods.find_name_for_writing_system(prioritized_names, WritingSystem.get_by_code('hans').id)\n if !simp_chi_name.nil?\n name_relation = simp_chi_name.parent_relations.first\n if name_relation.nil?\n name_relation = name[n].child_relations.create(:skip_update => true, :is_orthographic => 1, :orthographic_system_id => OrthographicSystem.get_by_code('trad.to.simp.ch.translit').id, :is_translation => is_translation, :child_node_id => simp_chi_name.id)\n self.spreadsheet.imports.create(:item => name_relation) if name_relation.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n if name_relation.nil?\n self.say \"Could not make #{name_str} a parent of simplified chinese name for feature #{self.feature.pid}\"\n else\n simp_chi_name.update_hierarchy\n name_positions_with_changed_relations << n if !name_positions_with_changed_relations.include? n\n end\n elsif !phonetic_system.nil? && phonetic_system.code=='tib.to.chi.transcrip'\n # only update if its tibetan\n name_relation.update_attributes(:phonetic_system_id => nil, :is_phonetic => 0, :orthographic_system_id => OrthographicSystem.get_by_code('trad.to.simp.ch.translit').id, :is_orthographic => 1, :is_translation => is_translation, :parent_node_id => name[n].id)\n self.spreadsheet.imports.create(:item => name_relation) if name_relation.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n end\n # pinyin should be a child of the traditional and not the simplified chinese\n name_relation = simp_chi_name.child_relations.find_by(phonetic_system_id: PhoneticSystem.get_by_code('pinyin.transcrip').id)\n if !name_relation.nil?\n name_relation.update_attribute(:parent_node_id, name[n].id)\n self.spreadsheet.imports.create(:item => name_relation) if name_relation.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n end\n end\n end\n else\n conditions = {:skip_update => true, :phonetic_system_id => phonetic_system.nil? ? nil : phonetic_system.id, :orthographic_system_id => orthographic_system.nil? ? nil : orthographic_system.id, :is_translation => is_translation, :alt_spelling_system_id => alt_spelling_system.nil? ? nil : alt_spelling_system.id}\n is_phonetic = self.fields.delete(\"#{i}.feature_name_relations.is_phonetic\")\n if is_phonetic.blank?\n conditions[:is_phonetic] = phonetic_system.nil? ? 0 : 1\n else\n conditions[:is_phonetic] = is_phonetic.downcase=='yes' ? 1 : 0\n end\n is_orthographic = self.fields.delete(\"#{i}.feature_name_relations.is_orthographic\")\n if is_orthographic.blank?\n conditions[:is_orthographic] = orthographic_system.nil? ? 0 : 1\n else\n conditions[:is_orthographic] = is_orthographic.downcase=='yes' ? 1: 0\n end\n is_alt_spelling = self.fields.delete(\"#{i}.feature_name_relations.is_alt_spelling\")\n if is_alt_spelling.blank?\n conditions[:is_alt_spelling] = is_alt_spelling.nil? ? 0 : 1\n else\n conditions[:is_alt_spelling] = is_alt_spelling.downcase=='yes' ? 1: 0\n end\n if parent_node_str.blank?\n if !parent_name_str.blank?\n parent_name = prioritized_names.detect{|fn| fn.name==parent_name_str}\n if parent_name.nil?\n self.say \"Parent name #{parent_name_str} of #{name[n].name} for feature #{self.feature.pid} not found.\"\n else\n name << parent_name\n parent_position = name.size - 1\n end\n end\n else\n parent_position = parent_node_str.to_i-1\n end \n relations_pending_save << { :relation => name[n].parent_relations.build(conditions), :parent_position => parent_position }\n name_positions_with_changed_relations << n if !name_positions_with_changed_relations.include? n\n name_positions_with_changed_relations << parent_position if !name_positions_with_changed_relations.include? parent_position\n end\n end\n relations_pending_save.each do |item|\n pending_relation = item[:relation]\n parent_node = name[item[:parent_position]]\n if parent_node.nil?\n self.say \"Parent name #{item[:parent_position]} of #{pending_relation.child_node.id} for feature #{self.feature.pid} not found.\"\n else\n relation = pending_relation.child_node.parent_relations.find_by(parent_node_id: parent_node.id)\n if relation.nil?\n pending_relation.parent_node = parent_node\n relation = pending_relation.save\n self.say \"Relation between names #{relation.child_note.name} and #{relation.parent_node.name} for feature #{self.feature.pid} could not be saved.\" if relation.nil? \n end \n end\n end\n\n # running triggers for feature_name\n if name_added\n views = self.feature.update_name_positions\n views = self.feature.update_cached_feature_names if views.blank? && name_changed\n end\n\n # running triggers for feature_name_relation\n name_positions_with_changed_relations.each{|pos| name[pos].update_hierarchy if !name[pos].nil?}\n return name_changed || name_added\n end", "def word_replace word, first_word\n if word =~ /^[A-Z]*$/ then\n \"_PROPER_\"#proper names\n elsif word =~ /^[A-Z|\\.]*$/ then\n if first_word then\n \"_FIRST_\"\n else\n \"_FNOCO_\" #first name or companies\n end\n elsif word =~ /^[A-Z].+$/ then\n if first_word then\n \"_FIRST_NAME_\"\n else\n \"_NAME_\"\n end\n elsif word =~ /^[0-9|\\-]*$/ then\n \"_NUM_\" #number\n else\n \"_RARE_\"\n end\nend", "def title(value)\n merge(letitle: value.to_s)\n end", "def fix_name(title)\n result = String.new( title )\n # Replace all invalid characters\n for substitution in $INVALID_CHARS_FOR_FILENAME\n result.gsub!(substitution[0], substitution[1])\n end\n result\nend", "def change_name(original)\n original.gsub!(' ','_')\n INVALID_CHARS.split('').each do |char|\n original.gsub!(char,'')\n end\n original.downcase\n end", "def titleize(title) \r\n title.en.titlecase\r\nend", "def translateName( nameValArr )\n name = \"\"\n nameValArr.each { |nameVal|\n index = nameVal.floor\n val = nameVal - index\n name = name + translateFromFillValue( val, index )\n }\n newName = (name[0..7] + \",\" + name[8] + \",\" + name[9..16])\n newName\n end", "def set_title(new_title, opts={})\n if self.datastreams.has_key?(\"descMetadata\")\n desc_metadata_ds = self.datastreams[\"descMetadata\"]\n if desc_metadata_ds.respond_to?(:title_values)\n desc_metadata_ds.title_values = new_title\n else\n desc_metadata_ds.title = new_title\n end\n end\n end", "def titleize(s)\n#Nous créons un tableau avec tous les petits mots “end” ‘and’ ‘the’\nl_w = %w(end and the)\n\n#On met en majuscule chaque première lettre des mots entrées\nreturn s.capitalize.gsub(/(\\w+)/) do |word|\n#Met en maj les mots qui ne sont pas dans le tableau l_w\n l_w.include?(word) ? word : word.capitalize\n end\n end", "def titlecase_title\n self.title = self.title.titlecase\n end", "def titlecase_title\n self.title=(title().titlecase())\n end", "def title_with_multilingual=(val)\n self.title_without_multilingual = val.is_a?(Hash) ? val['English'] : val\n end", "def retitle(retitle)\n @o_title = title\n @title = retitle.upcase\n conf_message(@o_title, \"retitled\")\n end", "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end", "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end", "def set_fund_item_title\n return if @set_fund_item_title\n if title? && ( perspective == PERSPECTIVES.first )\n fund_item.title = title if title? && fund_item.title != title\n @set_fund_item_title = true\n fund_item.save\n @set_fund_item_title = false\n end\n end", "def title(value)\n merge(title: value.to_s)\n end", "def titleize(title)\n sm_words = ['a', 'and', 'of', 'over', 'the']\n title.capitalize.split(\" \").map{ |wrd| sm_words.include?(wrd) ? wrd : wrd.capitalize }.join(\" \")\nend", "def preprocessInfo(info)\n [:artist, :album, :title].each do |key|\n val = info[key]\n # downcase and remove whitespace and single quotes\n val = val.downcase.strip.gsub(/\"/, \"'\")\n # convert all spaces to a single $separator\n val.gsub!(/\\s+/, $separator)\n # TODO check better way to capitalize each word\n val = val.split($separator).map { |s| s.capitalize }.join($separator)\n\n # sanitize any remaining bad characters\n val.gsub!($invalid_characers, \"\")\n\n info[key] = val\n end\nend", "def captionize\n res = titleize\n Settings::CaptionAcronyms.each do |acronym|\n res = res.gsub(/(?<![\\w\\d])(#{acronym})(?![\\w\\d])/i, acronym)\n end\n res\n end", "def titlecase!\n replace(titlecase)\n end", "def rename_album(album)\n album_title = FXInputDialog.getString(album.title, self,\n \"Rename Album\", \"Name:\")\n if album_title\n while true\n album.attribute_set(:title, album_title)\n if album.save\n return album_title\n else\n s=[]\n s << \"There were problems with that title.\"\n album.errors.each do |e|\n s << \" - #{e}\"\n end\n album_title = FXInputDialog.getString(album.title, self,\n \"Oops! \", s.join(\"\\n\"))\n return nil if album_title.nil?\n end\n end\n end\n end", "def fix_names(w)\n row = 2\n changed = 0\n until (name = w[row, 2]).empty?\n fixed = fix_name(name)\n if fixed != name\n puts '%-3s: %s\\n %s' % [row, name, fixed]\n w[row, 2] = fixed\n changed += 1\n end\n row += 1\n end\n puts 'changed %s' % changed\nend", "def cleanup_page_titles\n pages.each do |p|\n new_title = p.title.sub(/^page\\s*/i, '').strip\n p.title = new_title\n end\n\n pages.each do |p|\n if p.title.empty?\n if p.image_filename # we need to be able to make the assumption this exists\n p.title = file_name(p.image_filename)\n end\n end\n end\n\n seen = {}\n sequence = 1\n problems = []\n pages.each do |p|\n if p.title.empty?\n p.title = sequence.to_s\n end\n if seen[p.title]\n p.title += \" (#{sequence})\"\n problems.push p.title\n end\n seen[p.title] = true\n sequence += 1\n end\n\n if not problems.empty?\n warning \"Some page labels were not unique; the sequence number was appended: '\" + problems.join(\"', '\") + \"'.\"\n end\n end", "def fix_title\r\n # Remove quotes if the user thought they needed them\r\n self.title = self.title.gsub(/^(?:'|\")(.*)(?:'|\")$/, '\\1')\r\n end", "def _RefTitle\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_RefTitleSingle)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_RefTitleDouble)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_RefTitleParens)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_EmptyTitle)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_RefTitle unless _tmp\n return _tmp\n end", "def normalize_titles\n normalized_rt_title\n normalized_tz_title\n self\n end", "def sentencize (text, change)\n\n\treturn change ? text.capitalize! : text\n\nend", "def title=(s)\n \tsuper s.titleize\n\tend", "def normalize_name(name)\n return name.to_s if !name.is_a?(String) && !name.is_a?(MatchData)\n name = name.captures.compact.join('-') if name.is_a?(MatchData)\n name.split('-').map { |s| s[/\\A[0-9]\\Z/].nil? ? s : \"0#{s}\" }.join('-').upcase\nrescue\n name.to_s\nend", "def titleize(name)\n lowercase_words = %w{a an the and but or for nor of over}\n name.split.each_with_index.map{|x, index| lowercase_words.include?(x) && index > 0 ? x : x.capitalize }.join(\" \")\nend", "def capitalize_description_if_needed(description)\n return description if description.match(/\\p{Lower}/) # Some lowercase in there, do nothing\n description = UnicodeUtils.downcase(description) # There's no capitalize method!?\n description[0] = UnicodeUtils.upcase(description[0])\n description\nend", "def capitalize_names!\n @artist_name = StringUtils.mixed_case(@artist_name)\n @name = StringUtils.mixed_case(@name)\n @genre = StringUtils.mixed_case(@genre)\n \n @remix = capitalize_remix_name(@remix)\n\n @featured_artists.collect! { |artist| StringUtils.mixed_case(artist) }\n end", "def format_title_and_ref(doc_info)\n unless doc_info.title\n @nof_missing_titles += 1\n doc_info.title = \"NO TITLE FOUND (#{@nof_missing_titles}) !\"\n end\n\n # Manipulate the doc title if we have a doc id\n title = if !doc_info.doc_id.nil? && @manage_docid\n \"#{doc_info.doc_id} - #{doc_info.title}\"\n else\n doc_info.title\n end\n\n [title, \"<<#{doc_info.rel_path}#,#{title}>>\",\n \"<<#{Giblish.to_valid_id(doc_info.title)},details>>\\n\"]\n end", "def update_contributor(header, val, processed)\n key = header.to_sym\n processed[key] ||= []\n processed[key] << { name: [val.strip] }\n end", "def titleize(title)\n\ttitle_split = title.split(\" \")\n\ttitle_split.map do |word|\n\t\tif word == \"over\"\n\t\t\t#word = word\n\t\t\treturn word\n\t\telsif word == \"and\"\n\t\t\t#word = word\n\t\t\treturn word\n\t\telsif word == \"the\" && title_split[0] != word\n\t\t\t#word = word\n\t\t\treturn word\n\t\telse\n\t\t\treturn word.capitalize\n\t\tend\n\tend\nend", "def prepare_label_for_suggestion(label, index)\n validate_language_rule\n label.gsub(full_name, language_rule.default_transform(self, piped_params)) \n end", "def human_title_name(action, options = {})\n defaults = lookup_ancestors.map do |klass|\n :\"#{self.i18n_scope}.titles.#{klass.model_name.i18n_key}.#{action}\"\n end\n \n defaults << :\"titles.#{action}\"\n defaults << options.delete(:default) if options[:default]\n defaults << action.to_s.humanize\n \n options.reverse_merge! :default => defaults\n I18n.translate(defaults.shift, options)\n end", "def title_case(title, minor_words = \"\")\n if title == nil\n return nil\n else \n minor_words_array = minor_words.split(' ').map do |word|\n word.downcase\n end \n title_array = title.split(\" \").map do |word|\n word.downcase\n end \n titled = title_array.map do |word| \n if !minor_words_array.include?(word)\n word.capitalize \n else \n word.downcase \n end\n end \n titled[0] = titled[0].capitalize \n titled.join(\" \")\n binding.pry\n end\nend", "def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end", "def format_name\n title\n end", "def fix_title\n # Remove quotes if the user thought they needed them\n self.title = self.title.gsub(/^(?:'|\")(.*)(?:'|\")$/, '\\1')\n end", "def sanitised(title)\n title.delete(',') # ignore, commas\n .sub(/[?!']$/, '') # ignore ? and ! and ' at the end of the title!\n .gsub(\"' \", ' ') # ignore ' at the endin' of a word\n .sub('Feat. ', 'Feat ')\n end", "def titleize(s)\n\ttitle = s.capitalize\n\ttitle = title.split.map {|x| ((x != \"the\") && (x != \"and\") && (x != \"over\")) ?\n\t\t\tx.capitalize : x}.join(\" \")\nend", "def title=(value)\n write_attribute(:title, value.capitalize)\n end", "def title=(new_title)\n @title= Book.titleize(new_title)\n end", "def title=(title)\n\t little_words = %w{a an and if in or of over the}\n\t split_str = title.split(\" \")\n\t#shortcut for creating arrays found in beginningruby\n\tsplit_str.map! do |x|\n\t\tif x == split_str.first\n\t\t\tx.capitalize\n\t\t\telsif little_words.include?(x)\n\t\t\t\tx\n\t\t\t\telse\n\t\t\t\t\tx.capitalize\n\t\t\t\tend\n\t\t\tend\n\t\t\t@title = split_str.join(\" \")\n\t\tend", "def title\n default = \"[TITLE UNKNOWN]\"\n m245 = source_record['245']\n\n return default unless m245\n\n title = m245['a'] || m245['k']\n\n return default unless title\n\n title = title.sub(/\\s*[[:punct:]]+\\s*$/, '')\n\n subtitle = [m245['b'], m245['n'], m245['p'], m245['s']].compact.join('')\n subtitle = nil if subtitle.empty?\n subtitle = subtitle.sub(/\\s*[[:punct:]]+\\s*$/, '') if subtitle\n\n return [title, subtitle].compact.join(\": \")\n end", "def update\n @category_event.eng_title=Translit.convert(params[:category_event][:ru_title]).gsub(\"ü\",\"u\")\n respond_to do |format|\n if @category_event.update(category_event_params)\n format.html { redirect_to admin_category_event_path(@category_event), notice: 'Category event was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_event }\n else\n format.html { render :edit }\n format.json { render json: @category_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def check_title\n if title.to_s == '' && audio_file.present?\n str = File.basename(audio_file_url).gsub(/[_]/, ' ') \n self.title = str.gsub(/[.mp3]/, '')\n self.save\n end\n end", "def title_case(title, minor_words='')\n\ttitle_array = title.downcase.split(' ')\n\tminor_words_array = minor_words.downcase.split(' ')\n\ttitle_array.map!{|e|\n\t\tif minor_words_array.include?(e) == false || title_array[0] == e\n\t\t\te.capitalize\n\t\telse \n\t\t\te\n\t\tend \n\t} \n\ttitle_array.join(' ')\nend", "def merge_info_name(info, val)\n\t\tmerge_info_string(info, 'Name', val, ', ', true)\n\tend", "def titleize(title)\n\n result = []\n\n excluded = ['a', 'and', 'of', 'over', 'the']\n arr = title.split\n\n arr.each_index {|i|\n if excluded.include?(arr[i]) && i != 0\n result << arr[i]\n else\n result << arr[i].capitalize\n end\n }\n\n result.join(\" \")\nend", "def titleize\n self[0].upcase!\n return self\n end", "def original_title\n details.at(\"div.originalTitle\").children.first.text.gsub('\"', '').strip rescue nil\n end", "def titleize\n\t\tif @title.nil?\n\t\t\tmeta = @source.titleize metadata\n\t\t\t@title = \"#{@settings.title || @origin_id} - #{meta}\"\n\t\tend\n\t\treturn @title\n\tend", "def prepare_name(name)\n name.to_s.upcase\n end", "def change_lowercase\n self.title.downcase! if self.title\n self.author.downcase! if self.author\n end" ]
[ "0.64437896", "0.59596187", "0.59278756", "0.58932835", "0.58932835", "0.5821976", "0.5809699", "0.5759938", "0.5744363", "0.572556", "0.5718931", "0.5718462", "0.57045025", "0.56232184", "0.5615835", "0.5611629", "0.55944186", "0.55754536", "0.5556236", "0.5552546", "0.5531159", "0.55303776", "0.5529186", "0.551573", "0.54978275", "0.5399929", "0.53996176", "0.53734326", "0.5365364", "0.5360334", "0.53447", "0.53432876", "0.5338224", "0.5337944", "0.5321713", "0.5321713", "0.5316443", "0.53156453", "0.53156453", "0.5311143", "0.5301541", "0.5301219", "0.5300719", "0.5299879", "0.5298178", "0.52860546", "0.5285685", "0.5265113", "0.5262309", "0.5229124", "0.5228256", "0.5225538", "0.5223277", "0.5223085", "0.52156776", "0.5214054", "0.52138895", "0.52087295", "0.5202734", "0.5200212", "0.5195373", "0.5188635", "0.5187098", "0.5153462", "0.5152936", "0.5150401", "0.5146716", "0.51439524", "0.51435083", "0.5141487", "0.5140335", "0.51355743", "0.5132111", "0.5126209", "0.512476", "0.512464", "0.5123427", "0.5121098", "0.5119376", "0.5114417", "0.511412", "0.5111445", "0.5109466", "0.5106621", "0.51062626", "0.5102932", "0.5101917", "0.5099136", "0.50975364", "0.5096824", "0.5092314", "0.50907755", "0.5088461", "0.5084361", "0.5080016", "0.5077277", "0.50714254", "0.5068017", "0.5067161", "0.506372" ]
0.5975166
1
convert issue description data from html to text TODO: this method is a mess. clean it up.
def html2text(html) html ||= "" # ensure string is non-nil text = html. gsub(/(&nbsp;|\n|\s)+/im, ' ').squeeze(' ').strip. gsub(/<([^\s]+)[^>]*(src|href)=\s*(.?)([^>\s]*)\3[^>]*>\4<\/\1>/i, '\4') linkregex = /<[^>]*(src|href)=\s*(.?)([^>\s]*)\2[^>]*>\s*/i while linkregex.match(text) text.sub!(linkregex, "") end text = CGI.unescapeHTML( text. gsub(/<(script|style)[^>]*>.*<\/\1>/im, ''). gsub(/<!--.*-->/m, ''). gsub(/<hr(| [^>]*)>/i, "___\n"). gsub(/<li(| [^>]*)>/i, "\n* "). gsub(/<blockquote(| [^>]*)>/i, '> '). gsub(/<(br)(| [^>]*)>/i, "\n"). gsub(/<(\/h[\d]+|p)(| [^>]*)>/i, "\n\n"). gsub(/<[^>]*>/, '') ).lstrip.gsub(/\n[ ]+/, "\n") + "\n" converted = [] text.split(//).collect { |c| converted << ( c[0] > 127 ? "&##{c[0]};" : c ) } converted.join('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description_html\n convert_html description\n end", "def description_text\n\t\t\tif @data[\"description\"] \n\t\t\t\thtml_data = @data[\"description\"][\"text\"] \n\t\t\t\tparsed_data = Nokogiri::HTML(html_data)\n\t\t\t\tparsed_data.text\n\t\t\tend\n\t\tend", "def prepare_description(description)\n # replace all the new line equivalents in html with \\n's\n desc = description.gsub(/<br\\/?>/, \"\\n\")\n desc = desc.gsub(\"<p></p>\", \"\\n\")\n \n # strip out all the rest of html tags\n desc = desc.gsub(/<\\/?[^>]*>/, \"\")\n desc = desc.gsub(\"&nbsp;\", \"\")\n \n # decode all special character symbols back into text\n return CGI::unescapeHTML(desc)\n end", "def to_markdown(html, _options = {})\n cleaned = html.scrub\n cleaned = pre_sanitize(cleaned)\n cleaned = Sanitize.fragment(cleaned, HTML_SANITIZATION_CONFIG)\n Kramdown::Document.new(cleaned, input: :html).to_kramdown.strip\n rescue\n 'The description could not be imported, the most likely cause of this is that it contained illegal HTML markup'\n end", "def html_description2\n ::Util.simple_format(self.description2)\n end", "def get_description(tds)\n return CGI::unescapeHTML(clean_whitespace(tds[3].at('span').inner_text))\nend", "def get_description(tds)\n return CGI::unescapeHTML(clean_whitespace(tds[3].at('span').inner_text))\nend", "def parsed_description\n @parsed_description ||= Nokogiri::HTML(description) \n end", "def description_html\n Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(description)\n end", "def description_html\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :no_links => true, :hard_wrap => true)\n markdown.render(description).html_safe\n end", "def description_html\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :no_links => true, :hard_wrap => true)\n markdown.render(description).html_safe\n end", "def html2text\n doc = self.scrape.hdoc\n text = node_to_text(doc)\n# text.gsub!(NamedCharRegex){|s| \"#{lookup_named_char(s)}\"}\n # clean up white space\n text.gsub!(\"\\r\",\" \")\n text.squeeze!(\" \")\n text.strip!\n ret = ''\n text.split(/\\n/).each do |l|\n l.strip!\n next if l == ''\n next if l =~ /^\\?+$/\n ret += \"#{l}\\n\"\n end\n return ret\n end", "def strip_html_from_description\n self.description = ActionView::Base.full_sanitizer.sanitize(description)\n end", "def convert_html(html)\n converter = AhaServices::JiraWikiConverter.new\n converter.convert_html_from_aha(html)\n end", "def html_description\n if long_description.nil?\n paragraphs = []\n else\n paragraphs = long_description.delete(\"\\r\").gsub(\"\\n\\n\", \"\\n\").split(\"\\n\")\n end\n\n str = paragraphs.map { |x| \"<p>#{x}</p>\" }.join\n\n str += \"\\n<!--product-details-->\\n\"\n bullets = []\n\n (1..10).each do |x|\n point = get_property(\"Bullet #{x}\")\n bullets << point unless point.blank?\n end\n\n if bullets.length > 0\n str += \"<ul>\"\n str += bullets.map { |x| \"<li>#{x}</li>\" }.join\n str += \"</ul>\"\n end\n\n str += \"\\n<!--sizing-->\\n\"\n str += get_property(\"Sizing Info\")\n\n str += \"\\n<!--care-instructions-->\\n\"\n str += \"<p>\" + get_property(\"Care Instructions\") + \"</p>\"\n end", "def html_to_text html, charset\n ## ignore charset. html2text produces output in the system charset.\n #puts \"; forced to decode html. running #{HTML_CONVERSION_CMD} on #{html.size}b mime part...\"\n content = begin\n Timeout.timeout(HTML_CONVERSION_TIMEOUT) do\n Heliotrope.popen3(HTML_CONVERSION_CMD) do |inn, out, err|\n inn.print html\n inn.close\n out.read\n end\n end\n rescue Timeout::Error\n $stderr.puts \"; warning: timeout when converting message from html to text\"\n \"[html conversion failed on this command (htmlconversionfailure)]\"\n end\n [content, SYSTEM_CHARSET]\n end", "def html_to_text html, charset\n ## ignore charset. html2text produces output in the system charset.\n #puts \"; forced to decode html. running #{HTML_CONVERSION_CMD} on #{html.size}b mime part...\"\n content = begin\n Timeout.timeout(HTML_CONVERSION_TIMEOUT) do\n Heliotrope.popen3(HTML_CONVERSION_CMD) do |inn, out, err|\n inn.print html\n inn.close\n out.read\n end\n end\n rescue Timeout::Error\n $stderr.puts \"; warning: timeout when converting message from html to text\"\n \"[html conversion failed on this command (htmlconversionfailure)]\"\n end\n [content, SYSTEM_CHARSET]\n end", "def process_markdown\n self.data = self.class.convert_markdown(self.data)\n sanitize_html\n end", "def description\n document.at(\"[@id='description']/span[1]\").innerHTML.goodreads_strip_tags.goodreads_strip_bad_description_content rescue nil\n end", "def description_html\n @description_html ||= RDiscount.new(original.body).to_html\n end", "def process_description_body(description)\r\n if !description.eql?(\"\") then\r\n description_html = Nokogiri::HTML(description, 'UTF-8') do | config |\r\n config.strict\r\n end\r\n this_html = description_html.search('html').first\r\n this_body = this_html.search('body').first\r\n body_content = this_body.children.to_s.gsub(\"\\n\", \"\")\r\n else\r\n body_content = \"\"\r\n end\r\n return body_content\r\n end", "def scrape_course_description(parsed_html)\n parsed_html.css('div.desc')[0].children.text.strip\n end", "def html_to_rss_description(input)\n html = Loofah.fragment(input)\n html.scrub!(Scrubber.new)\n html.to_s\n end", "def md_to_html\n options = {\n filter_html: true,\n link_attributes: {\n rel: \"nofollow\",\n target: \"_blank\"\n }\n }\n\n extensions = {\n space_after_headers: true,\n autolink: true\n }\n\n renderer = Redcarpet::Render::HTML.new(options)\n markdown = Redcarpet::Markdown.new(renderer, extensions)\n\n self.description = markdown.render(self.description_md)\n end", "def html_markup_text(text); end", "def text_to_issue(issue, options={})\n title = nil\n subject = nil\n text = options[:tracker] == false ? \"##{issue.id}\" : \"#{issue.tracker} ##{issue.id}\"\n if options[:subject] == false\n title = issue.subject.truncate(60)\n else\n subject = issue.subject\n if truncate_length = options[:truncate]\n subject = subject.truncate(truncate_length)\n end\n end\n only_path = options[:only_path].nil? ? true : options[:only_path]\n s = text\n s << h(\": #{subject}\") if subject\n s = h(\"#{issue.project} - \") + s if options[:project]\n s\n end", "def html_text\n \"<p class='story-comment-text'>\" + self.text.split(\"\\n\").join(\"</p><p class='story-comment-text'>\") + \"</p>\"\n end", "def html_to_text(text)\n return nil if text.nil? || text.empty?\n text.gsub! /<br( \\/)?>/i, \"\\n\"\n\n string = Nokogiri::HTML.parse(text.to_s).css('body').text\n string.gsub! /[[:blank:]]/, ' '\n string = string.split(\"\\n\").collect{ |line| line.strip }.join(\"\\n\")\n string.gsub! /(\\n{1,})\\n/ do |match|; $1; end # convert x\\n to (x-1)\\n\n string.strip!\n string\n end", "def text\n text = [title, abstract].join(\"\\n\")\n\n Misc.fixutf8(text)\n end", "def as_html_deprecated #use TextEncoder.convert_to_html instead.\n return self if self.blank?\n mytext = self\n #mytext = CGI.escapeHTML(mytext)\n mytext.gsub!(NpbConstants::URL_DETECTION){|web_link| %{ <a href=\"#{web_link.strip}\">#{web_link.strip}</a> }}\n #mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{\\1<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(NpbConstants::EMAIL_DETECTION){|email| %{#{$1}<a href=\"mailto:#{email.strip}\">#{email.strip}</a>}}\n mytext.gsub!(/\\A +/) {|l_spaces| (\"&nbsp;\"*l_spaces.size)} \n mytext.gsub!(/\\n +/) {|l_spaces| (\"\\n\" + (\"&nbsp;\"*(l_spaces.size-1)))}\n mytext.gsub!(/\\n{2,}/,'</p><p>')\n mytext.gsub!(/(\\n)([^\\n])/, '<br/>\\2')\n mytext\n end", "def decode_html html\n coder = HTMLEntities.new\n coder.decode html\n end", "def formatted_description\n CGI.escapeHTML(description).split(/\\n|\\r\\n?/).join(\"<br />\").html_safe\n end", "def html2text(html)\n\n result = ''\n begin\n web_doc = Hpricot(html)\n web_doc.search(\"//comment()\").remove\n web_doc.search(\"script\").remove\n web_doc.search(\"style\").remove\n web_doc.search(\"noscript\").remove\n web_doc.search(\"object\").remove\n web_doc.search(\"embed\").remove\n web_doc.search(\"head\").remove\n\n web_doc.traverse_text do |e| \n\n begin\n if e.content\n result += e.content+\"\\n\"\n end\n rescue\n # ignore errors\n end\n end\n rescue Exception => e\n # ignore errors\n warn \"html2text() - Exception '#{e.message}' trying to parse '#{html}'\"\n end\n\n if result == ''\n # Use a simple regular-expression approach to remove all tags\n result = html.gsub(/<[^>]*>/, '')\n end\n\n coder = HTMLEntities.new\n result = coder.decode(result)\n\n result.gsub!(/\\n[\\r\\n \\t]*/, \"\\n\")\n\n result\nend", "def fix(text)\n NLP.htmlentities.decode text\n end", "def set_meta_description\n html = html_overview || html_content || ''\n\n self.meta_description =\n html.\n gsub(/<\\/?[^>]*>/, ' '). # replace HTML tags with spaces\n gsub(/&\\w{1,9};|\"/, ''). # remove HTML special chars and double quotes\n gsub(/\\n+/, \" \"). # remove new lines\n gsub(/\\s+/, ' '). # remove duplicated spaces\n strip[0..200] # strip spaces and get first 200 chars\n end", "def text\n text = @tag_data[:text]\n # convert_newlines_to_br\n text.gsub!(\"\\r\\n\", \"\\n\")\n text.gsub!(\"\\n\", \"\\n\")\n text\n end", "def description\n desc = details.at(\"div.summary_text[itemprop='description']\").text.strip.clean_description rescue nil\n (desc.nil? || desc.empty?) ? nil : desc\n end", "def extract_description\n\t\tparts = self.readme&.parts or return nil\n\t\tdesc_para = parts.find {|part| part.is_a?(RDoc::Markup::Paragraph) }&.text or return nil\n\t\tformatter = RDoc::Markup::ToHtml.new( RDoc::Options.new )\n\t\thtml = formatter.convert( desc_para )\n\n\t\treturn html.gsub( /<.*?>/, '' ).strip\n\tend", "def fix(text)\n NLP.htmlentities.decode text\n end", "def fix(text)\n NLP.htmlentities.decode text\n end", "def issues_text\n if (issues.count > 0)\n r = \"\"\n issues.each do |issue|\n r += \", \"\n r += issue.description\n end\n r[2,r.length-2] # lose starting comma-space\n else\n \"No issues yet\"\n end\n end", "def markdown(text)\n sanitize BlueCloth::new(text).to_html\n end", "def description_markdown\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, space_after_headers: true)\n markdown.render(description).html_safe\n end", "def get_description(n)\n description = Nokogiri::HTML(super(n)).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[0]\n description = description.split(\" \")[3..-1].join(\" \") # remove \"by 'author name'\"\n description.slice!(\"[ Subscribe to the comments on this story ] \")\n description\n else\n nil\n end\n end", "def html_markup_markdown(text); end", "def html_to_markdown\n html_decoded = ConverterMachine.html_markdown(self)\n\n # Update the work.\n unless self.update_attributes!(file_content_md: html_decoded)\n errors.add(\"There was an error updating MD for work id: #{self.id}\")\n end\n end", "def getPostDescription article\n\t\treturn article.gsub(/<[^>]*>/,'').gsub(/&nbsp;/,' ').slice(0,60)+'...'\n\tend", "def html_markup_html(text); end", "def nice_html_to_text(html_text)\n doc = Hpricot(html_text)\n doc.search(\"//text()\").text\n end", "def get_description(detail_page, tds)\n table = detail_page.search('table')[31]\n\n tr = table.search('tr')[3]\n\n tds_detail_description = tr.search('td')\n\n description = \"\"\n\n if !tds_detail_description[1].at('span').nil? \n\n description = clean_whitespace(tds_detail_description[1].at('span').text)\n\n else\n\n description = clean_whitespace(tds_detail_description[1].text)\n\n end\n return description\nend", "def get_description(detail_page, tds)\n table = detail_page.search('table')[31]\n\n tr = table.search('tr')[3]\n\n tds_detail_description = tr.search('td')\n\n description = \"\"\n\n if !tds_detail_description[1].at('span').nil? \n\n description = clean_whitespace(tds_detail_description[1].at('span').text)\n\n else\n\n description = clean_whitespace(tds_detail_description[1].text)\n\n end\n return description\nend", "def entity_desc(desc_text)\n return desc_text unless desc_text.start_with?(MARKDOWN_COMMENT)\n Kramdown::Document.new(desc_text.sub(MARKDOWN_COMMENT, \"\")).to_html\n end", "def site_description\n headings = @doc.xpath(\"//h3[@class='clearl']\")\n content_sections = @doc.xpath(\"//h3[@class='clearl']/following-sibling::p[1]\")\n content = \"\"\n headings.zip(content_sections).each do |h, c| \n unless (c.to_s().squeeze().empty?)\n content << \"<h3>#{sanitize(h.to_s)}</h3>\" \n content << \"<p>#{sanitize(c.to_s)}\"\n end\n end\n rhtml = IO.read(File.expand_path(\"site_description.rhtml\", File.dirname(__FILE__)))\n content_html = Erubis::Eruby.new(rhtml)\n content_html.result(:content => content)\n end", "def raw_description\n if self.description\n Helper.strip_html(self.description).gsub(/\\s+/,\" \").strip\n else\n nil\n end\n end", "def textilize_me\n text = self.blurb || ''\n if text && text.respond_to?(:to_s)\n doc = RedCloth.new( text.to_s )\n doc.to_html\n self.converted_to_html = RedCloth.new(doc).to_html\n end\n end", "def to_description(text)\n text.strip.gsub(/\\s+/, ' ')\n end", "def text2html(text)\n return nl2br(escape_xml(text.to_s).gsub(/ /, ' &nbsp;'))\n end", "def plain_text_summary\n summary_html && Utils::HTMLToText.convert(summary_html)\n end", "def process_markdown\n self.explanation_html = Kramdown::Document.new(explanation_md || '').to_html.gsub(/[\\r\\n]+/, '')\n end", "def to_html text\n html = (''.encode text.encoding).dup\n\n encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]\n\n s = StringScanner.new text\n insquotes = false\n indquotes = false\n after_word = nil\n\n until s.eos? do\n case\n when s.scan(/<(tt|code)>.*?<\\/\\1>/) then # skip contents of tt\n html << s.matched.gsub('\\\\\\\\', '\\\\')\n when s.scan(/<(tt|code)>.*?/) then\n warn \"mismatched <#{s[1]}> tag\" # TODO signal file/line\n html << s.matched\n when s.scan(/<[^>]+\\/?s*>/) then # skip HTML tags\n html << s.matched\n when s.scan(/\\\\(\\S)/) then # unhandled suppressed crossref\n html << s[1]\n after_word = nil\n when s.scan(/\\.\\.\\.(\\.?)/) then\n html << s[1] << encoded[:ellipsis]\n after_word = nil\n when s.scan(/\\(c\\)/i) then\n html << encoded[:copyright]\n after_word = nil\n when s.scan(/\\(r\\)/i) then\n html << encoded[:trademark]\n after_word = nil\n when s.scan(/---/) then\n html << encoded[:em_dash]\n after_word = nil\n when s.scan(/--/) then\n html << encoded[:en_dash]\n after_word = nil\n when s.scan(/&quot;|\"/) then\n html << encoded[indquotes ? :close_dquote : :open_dquote]\n indquotes = !indquotes\n after_word = nil\n when s.scan(/``/) then # backtick double quote\n html << encoded[:open_dquote]\n after_word = nil\n when s.scan(/(?:&#39;|'){2}/) then # tick double quote\n html << encoded[:close_dquote]\n after_word = nil\n when s.scan(/`/) then # backtick\n if insquotes or after_word\n html << '`'\n after_word = false\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n when s.scan(/&#39;|'/) then # single quote\n if insquotes\n html << encoded[:close_squote]\n insquotes = false\n elsif after_word\n # Mary's dog, my parents' house: do not start paired quotes\n html << encoded[:close_squote]\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n\n after_word = nil\n else # advance to the next potentially significant character\n match = s.scan(/.+?(?=[<\\\\.(\"'`&-])/) #\"\n\n if match then\n html << match\n after_word = match =~ /\\w$/\n else\n html << s.rest\n break\n end\n end\n end\n\n html\n end", "def display(text, html_options = nil)\n if html_options\n html_options = html_options.stringify_keys\n tag_options = tag_options(html_options)\n else\n tag_options = nil\n end\n #sanitize(text).to_html.gsub(\"<p>\", \"<p#{tag_options}>\")\n markdown(sanitize(text.gsub(\"\\n\",\"<br/>\"))).gsub(\"<p>\", \"<p#{tag_options}>\")\n end", "def html_decode\n require 'htmlentities'\n \n coder = HTMLEntities.new\n \n ret = coder.decode(self)\n \n return ret\n end", "def html_markup_textile(text); end", "def parse_description\n skip_tkspace\n\n tk = get_tk\n\n @desc = tk.text[1..-2]\n end", "def markdown(text)\n sanitize(BlueCloth::new(text).to_html)\n end", "def clean_description(description)\n description.sub(/^<p>/, \"\").sub(/<\\/p> ?(\\n)?$/, \"\")\n end", "def prepare_text\n feed_url = FeedUrl.where(:language_id => language_id).order(\"RANDOM()\").limit(1).first.try(:url)\n if feed_url && (feed = FeedNormalizer::FeedNormalizer.parse(feed_url))\n feed_text = feed.entries[0..3].map(&:content)\n self.text = ''\n feed_text.each do |ft|\n self.text += content_tag(:p, sanitize(HTMLEntities.new.decode(ft), :tags => \"\", :attributes => \"\"))\n end\n end\n end", "def convert_html(text)\n auto_html text do\n html_escape :map => {\n '&' => '&amp;',\n '>' => '&gt;',\n '<' => '&lt;',\n '\"' => '\"'\n }\n image\n youtube :width => 510, :height => 332\n vimeo :width => 510, :height => 332\n link :target => :_blank\n redcarpet :target => :_blank\n end\n end", "def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end", "def extract_description(document)\n node = document.css('div.well>p')\n @description = node.inner_html\n end", "def change_description_of_issue(issue_name, description_text)\n\tissue = @client.Issue.find(issue_name)\n\tissue.save({\"fields\"=>{\"description\"=>description_text}})\nend", "def text_to_html( content )\r\n content = case @markup_type\r\n when :markdown\r\n markdown_to_html( content )\r\n when :textile\r\n textile_to_html( content )\r\n when :rest\r\n rest_to_html( content )\r\n end\r\n content\r\n end", "def convert_text(el, opts)\n if opts[:raw_text]\n el.value\n else\n el.value.gsub(/\\A\\n/) do\n opts[:prev] && opts[:prev].type == :br ? '' : \"\\n\"\n end#.gsub(/\\s+/, ' ').gsub(ESCAPED_CHAR_RE) { \"\\\\#{$1 || $2}\" }\n end\n end", "def conv_html(txt)\n txt.\n gsub(/&gt;/, '>').\n gsub(/&lt;/, '<').\n gsub(/&quot;/, '\"').\n gsub(/&amp;/, '&')\n \n end", "def fix_html(ary)\n text = \"\"\n\n ary.each do |s|\n temp = s.gsub('<', '&lt;').gsub('>', '&gt;')\n temp = temp.gsub('&b', '<b>').gsub('&/b', '</b>')\n temp = temp.gsub('&i', '<i>').gsub('&/i', '</i>')\n\n text += \" &nbsp;&nbsp;&nbsp;&nbsp;#{temp}<br />\\n\"\n end\n\n return text\nend", "def html_markup_org(text); end", "def format_track_description(text)\n return \"\" unless text\n\n nofollowize(CommonMarker.render_doc(text, :SMART, [:autolink]).to_html(:HARDBREAKS)).html_safe\n end", "def ticket_description(ticket)\n simple_format(ticket.description)\n end", "def plain_text(html)\n HtmlToPlainText.plain_text(html)\n end", "def html raw_text\n EscapeUtils.escape_html(decode_html(raw_text))\n end", "def to_html\n CGI.unescapeHTML(Riki::Base.api_request({'action' => 'parse', 'page' => @title}).first.find('/m:api/m:parse/m:text/text()').first.to_s)\n end", "def summary\n self.content.gsub(/\\r?\\n\\r?\\n(.*)/m, '') # break after the first paragraph\n end", "def run_clean_short_description\n self.short_description = HtmlMaid.clean_short_description(self.short_description)\n end", "def html_content\n\t\t\treturn \"\" if content.blank? \n\t\t\tstr = content.gsub(/<(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\#{$1}>\" }\n\t\t\tstr = str.gsub(/<\\/(\\s*)(\\w+)(\\s*)>/){ |s| \"<\\/>\" }\n\t\t\tstr = str.gsub(/\\r\\n/, \"<br/>\") \n\t\t\tstr = str.gsub(/(\\s)/, \"&nbsp;\")\n\t\t\tstr = str.gsub(/\\[bold\\]/, \"<b>\")\n\t\t\tstr = str.gsub(/\\[-bold\\]/, \"</b>\")\n\t\t\tstr = str.gsub(/\\[italic\\]/, \"<i>\")\n\t\t\tstr = str.gsub(/\\[-italic\\]/, \"</i>\")\n\t\t\tstr = str.gsub(/\\[color:(#.{6})\\]/){ |s| \"<span style=\\\"color:#{$1}\\\">\" }\n\t\t\tstr = str.gsub(/\\[-color\\]/, \"</span>\")\n\t\t\tstr = str.gsub(/\\[(\\w+)\\]/) do |s|\n\t\t\t\temotion = EMOTIONS.index($1)\n\t\t\t\temotion.nil? ? \"[#{$1}]\": \"<img src=\\\"/assets/emotions/#{emotion}.gif\\\" />\" \n\t\t\tend\n\t\t\treturn str\n\t\tend", "def parse_markdown\n self.body_html = markdown.render(body_markdown.to_s)\n self.summary_html = markdown.render(summary_markdown.to_s)\n end", "def convert_markdown\n self.html_content = Raptor::Markdown.render(self.content)\n end", "def conv_html(txt)\n case txt\n when Array\n txt.join.\n gsub(/&gt;/, '>').\n gsub(/&lt;/, '<').\n gsub(/&quot;/, '\"').\n gsub(/&amp;/, '&')\n else # it's a String\n txt.\n gsub(/&gt;/, '>').\n gsub(/&lt;/, '<').\n gsub(/&quot;/, '\"').\n gsub(/&amp;/, '&')\n end\n end", "def html2csv(data)\r\n dbg= data.gsub! \"\\n\", \"\"\r\n dbg= data.gsub! \"\\xA0\", \" \"\r\n dbg= data.gsub! \"\\r\", \"\"\r\n dbg = data.gsub! /<br>/, \"\\n\"\r\n dbg = data.gsub! /<\\/p>/, \"\\n\"\r\n dbg = data.gsub! /<\\/div>/, \"\\n\"\r\n dbg = data.gsub! /<ul[^>]*>/, \"\\n\"\r\n dbg = data.gsub! /<li[^>]*>/, \"\\x95 \"\r\n dbg = data.gsub! /<\\/li>/, \"\\n\"\r\n dbg = data.gsub! /<\\/?\\??\\w+[^>]*>/, \"\"\r\n dbg = data.gsub! /[ ]{2,}/, \" \"\r\n dbg = data.gsub! /(\\s?\\n\\s?){2,}/, \"\\n\"\r\n dbg = data.strip!\r\n return data\r\n end", "def text\n html.gsub(REGEX_TAGS, \"\")\n end", "def html_decode(html)\n if use_htmlentities\n HTMLEntities.new.decode(html)\n else\n CGI.unescapeHTML(html)\n end\n end", "def decode_html()\n return self.gsub('&lt;', '<').gsub('&gt;', '>').gsub('&amp;', '&')\n end", "def format_description\r\n description.gsub(':)', '![alternative text](/images/smileys/smile.gif)').gsub(':D', '![alternative text](/images/smileys/laugh.gif)').\r\n gsub(':(', '![alternative text](/images/smileys/disappointed.gif)').gsub(':O', '![alternative text](/images/smileys/shocked.gif)').\r\n gsub(\":,(\", '![alternative text](/images/smileys/sad.gif)').gsub(':/', '![alternative text](/images/smileys/double_minded.gif)').\r\n gsub('8)', '![alternative text](/images/smileys/cool.gif)').gsub(':crazy:', '![alternative text](/images/smileys/crazy.gif)').\r\n gsub(':yeah:', '![alternative text](/images/smileys/yeah.gif)')\r\n end", "def update_html_for_abstract\n return unless details\n self.details_filtered = textile_to_html( details )\n end", "def content_from(html, url)\n \n def extract_pre_from(html)\n regex = /<pre.*?>.*?<\\/pre>/m\n pre_list = html.scan regex\n html.gsub! regex, 'DUMMY-STRING'\n [pre_list, html]\n end\n\n def add_domain(html, domain)\n html.gsub! /a href=\\\"(\\/.*?\\\")/, \"a href=\\\"#{domain}\\\\1\"\n html.gsub! /img src=\\\"(\\/.*?\\\")/, \"img src=\\\"#{domain}\\\\1\"\n html\n end\n\n def add_pre(html, pre_list)\n pre_list.each do |p|\n html.sub!('DUMMY-STRING', p)\n end\n html\n end\n \n pre_list, replaced = extract_pre_from html\n params = { :tags => %w[div span p a b i pre h1 h2 h3 h4 h5 h6 strong small em\n blockquote ul ol li img],\n :attributes => %w[href src] }\n html = HtmlPress.press Readability::Document.new(replaced, params).content\n domain = domain_of url\n output = add_pre(add_domain(html, domain), pre_list)\n output = sanitize_with_img output\n output.gsub /<img /, \"<img onError=\\\"this.style.display='none';\\\" \"\n \n end", "def to_s\n MarkdownService.markdown_as_text(md_title, true)\n end", "def to_md\n # Usually ruby is extremely readable, but I think \"-1\" means \"give me all the \n # trailing blank lines\" is surprisingly opaque. That's what the -1 does...\n lines = @text.split(\"\\n\", -1)\n lines.collect do |line|\n result = line\n \n # Leave lines that start with 4 spaces alone. These are code blocks and\n # should pass through unchanged.\n unless result =~ /^\\s{4,}/\n \n # Convert headers\n result.sub!(/^(=){1,6}/) { |s| \"#\" * s.length} unless result =~ /^={7,}/\n \n # Convert strong to have two stars\n # The matching pair of stars should start with a single star that is either at\n # the beginning of the line or not following a backslash, have at least one\n # non-star and non-backslash in between, then end in one star\n result.gsub!(/(\\A|[^\\\\\\*])\\*([^\\*]*[^\\*\\\\])\\*/, '\\1**\\2**')\n\n # Convert inline code spans to use backticks\n result.gsub!(/(\\A|[^\\\\])\\+([^\\+]+)\\+/, '\\1`\\2`')\n\n # Convert bare http:, mailto: and ftp: links\n result.gsub!(/(\\A|\\s)(http:|https:|mailto:|ftp:)(\\S*)/, '\\1[\\2\\3](\\2\\3)')\n\n # Convert bare www to an http: link\n result.gsub!(/(\\A|\\s)www\\.(\\S*)/, '\\1[www.\\2](http://www.\\2)')\n\n # Convert link: links to refer to local files\n result.gsub!(/(\\A|\\s)link:(\\S*)/, '\\1[\\2](\\2)')\n\n # Convert multi word labels surrounded by {} with a url\n result.gsub!(/\\{([^\\}]*)\\}\\[(\\S*)\\]/, '[\\1](\\2)')\n\n # Convert one word labels with a url\n result.gsub!(/(\\A|\\s)([^\\{\\s]\\S*)\\[(\\S*)\\]/, '\\1[\\2](\\3)')\n\n end\n \n result\n end.join(\"\\n\")\n end", "def content_based_description\n first_long_paragraph = parsed_search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end", "def jira_summary_formatting(message)\n message = message.gsub('&lt;', '<')\n .gsub('u0026lt;', '<')\n .gsub('&gt;', '>')\n .gsub('u0026gt;', '>')\n .gsub('&amp;', '&')\n .gsub('u0026amp;', '&')\n\n message = message[0..250]\n end", "def formatted_scenario_description(description)\n # First check if the description has a div matching the current locale,\n # indicating that a localized version is available.\n localized = Loofah.fragment(description).css(\".#{I18n.locale}\")\n\n rendered = RDiscount.new(\n localized.inner_html.presence || description,\n :no_image, :smart\n ).to_html\n\n Rails::Html::SafeListSanitizer.new.sanitize(\n strip_external_links(rendered)\n ).html_safe\n end", "def storyline\n details.at(\"#titleStoryLine div[itemprop='description'] p\").text.strip.clean_description rescue nil\n end" ]
[ "0.7353803", "0.68599296", "0.68399286", "0.65262973", "0.6502272", "0.6481965", "0.6481965", "0.64485556", "0.64310735", "0.6406984", "0.6406984", "0.63582337", "0.6242538", "0.6217766", "0.6200403", "0.6194629", "0.6194629", "0.61676276", "0.6107801", "0.6098693", "0.6077089", "0.60097474", "0.59944457", "0.5981455", "0.5980849", "0.59734887", "0.59706616", "0.59471834", "0.59338623", "0.5929637", "0.592671", "0.5917123", "0.5905253", "0.5904877", "0.5886276", "0.5880628", "0.5877393", "0.58758277", "0.58750534", "0.58750534", "0.5869179", "0.58580226", "0.58472276", "0.58436006", "0.58410543", "0.5836592", "0.5824361", "0.5811272", "0.5807113", "0.5795337", "0.5795337", "0.5783095", "0.5780816", "0.5780217", "0.57591355", "0.5753713", "0.5744632", "0.57334167", "0.5724505", "0.5717486", "0.57085824", "0.56995183", "0.5696048", "0.5694345", "0.5685479", "0.5676794", "0.5673912", "0.5672246", "0.56473446", "0.5647002", "0.56450236", "0.5641211", "0.5640732", "0.56404144", "0.5631627", "0.56281483", "0.56198573", "0.5613293", "0.5610679", "0.5610631", "0.55815697", "0.55739146", "0.5571987", "0.55654025", "0.5561704", "0.555821", "0.5531126", "0.5530465", "0.5530347", "0.553006", "0.55260134", "0.5525127", "0.55224353", "0.5522127", "0.5521031", "0.5519767", "0.5517249", "0.5514171", "0.551282", "0.55095446" ]
0.5788015
51
log to standard logger facility and dump to stdout too
def log(msg, level = :info) puts("ZapUpdater: " + msg) RAILS_DEFAULT_LOGGER.info("ZapUpdater: " + msg) @mail_log << msg + "<br/>\r\n" if level == :info end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_to_stdout\n log_to STDOUT\n end", "def log\n @@log ||= Logger.new($stdout)\n end", "def log_write(msg)\n puts msg\n end", "def log(message)\n STDOUT.puts message\nend", "def log\n @log ||= Logger.new($stdout)\n end", "def log(*args)\n @out.puts(*args)\n end", "def log(msg)\r\n STDERR.puts msg\r\n end", "def log_standard_outputs\n [STDOUT, STDERR].each do |output|\n (class << output; self; end).class_eval do\n alias __write__ write\n\n def write string\n Wmiirc::LOG << string\n __write__ string\n end\n\n alias << write\n end\n end\n end", "def use_std_logger(level = default_level, output = $stderr)\n use_logger create_logger(level, output)\n end", "def logger_output; end", "def log_stdout(type: :info, message:)\n $stdout.puts log_entry(type, message)\n end", "def logger\n logger = Logger.new(STDOUT)\nend", "def log\n @log ||= Logger.new(STDOUT)\n end", "def log(msg)\n STDERR.puts msg\n end", "def log(msg)\n puts msg if @verbose\n end", "def log(msg)\n puts msg if @verbose\n end", "def puts_and_logs(msg)\n @@logger.puts_and_logs msg\n end", "def log(msg)\n\t\tSyslog.info(msg) if @verbose\n\tend", "def log(msg)\n puts msg\n $stdout.flush\n end", "def log(message)\n puts \">> #{message}\"\n end", "def log(msg)\n @logger.write(msg) if @logger\n end", "def log(msg)\n puts msg\n $stdout.flush\n end", "def log(msg)\n puts msg\n end", "def log(msg)\n # puts msg\n $stdout.write(\"#{msg}\\n\")\n end", "def log\n @test_mode ? LogHelper::Redirect.instance.file : STDOUT\n end", "def logger\n @logger ||= ::Logger.new($stdout)\n end", "def log(msg)\n STDERR.puts msg if $verbose\nend", "def log(msg)\n STDERR.puts msg if $verbose\nend", "def log\n out.sync = true\n @log ||= Logger.new(out)\n\n @log.formatter = proc do |severity, datetime, progname, msg|\n if verbose\n string = \"#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%2N')}]: \"\n else\n string = \"[#{datetime.strftime('%H:%M:%S')}]: \"\n end\n\n string += \"#{msg}\\n\"\n\n string\n end\n @log\n end", "def log_handler\n @log_handler ||= ::Logger.new(STDOUT)\n end", "def log(message); logger.info(message); end", "def initialize\n @logger = Logger.new(STDOUT)\n super(@logger)\n end", "def log(msg)\n STDERR.print \"** \", msg, \"\\n\"\n end", "def logging( log_str )\n begin\n file = open(File.expand_path('../_log_posts',__FILE__),'a')\n file.print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = true\n print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = false\n ensure\n file.close\n end\nend", "def autoflush_log; end", "def autoflush_log; end", "def logging_io\n @logging_io = nil if @logging_io&.closed?\n @logging_io ||=\n if path = Resqued::Logging.log_file\n File.open(path, \"a\").tap do |f|\n f.sync = true\n f.close_on_exec = true\n # Make sure we're not holding onto a stale filehandle.\n $stdout.reopen(f)\n $stderr.reopen(f)\n end\n else\n $stdout\n end\n end", "def log_stuff\r\n log.info(\"TestLogger is here to log stuff.\")\r\n log.warn(\"TestLogger is finishged logging. Be careful.\")\r\n end", "def log(msg)\n print \" \" if $trace && $verbose\n $stderr.puts msg if $verbose\n end", "def stream_out(msg)\n if ($gTest_params[\"verbosity\"] != \"quiet\")\n print msg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(msg)\n end\nend", "def setup_logging( level=Logger::FATAL )\n\n\t\t# Turn symbol-style level config into Logger's expected Fixnum level\n\t\tif RoninShell::Loggable::LEVEL.key?( level )\n\t\t\tlevel = RoninShell::Loggable::LEVEL[ level ]\n\t\tend\n\n\t\tlogger = Logger.new( $stderr )\n\t\tRoninShell.logger = logger\n\t\tRoninShell.logger.level = level\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tThread.current['logger-output'] = []\n\t\t\tlogdevice = ArrayLogger.new( Thread.current['logger-output'] )\n\t\t\tRoninShell.logger = Logger.new( logdevice )\n\t\t\t# RoninShell.logger.level = level\n\t\t\tRoninShell.logger.formatter = RoninShell::HtmlLogFormatter.new( logger )\n\t\tend\n\tend", "def log (msg, **kwargs) Log.write(msg, :info, kwargs) end", "def log\n STDOUT\n# @log_file ||= File.new(LOG_PATH, \"w\") # System.Text.Encoding.Unicode)\nend", "def logger\n self.configuration.logger || Logger.new($stdout)\n end", "def logging( log_str )\n begin\n file = open(File.expand_path('../_log_watcher2',__FILE__),'a')\n file.print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = true\n print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = false\n ensure\n file.close\n end\nend", "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 stream_out(msg)\n if ($gTest_params[\"verbosity\"] != \"quiet\")\n print msg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(msg)\n end\nend", "def log(s)\n log_stream.puts(s)\n end", "def init_logger\n l = Logger.new(STDOUT)\n l.level = Logger::INFO\n Log.logger = l\nend", "def initialize_log(log_target = STDOUT)\n oldlogger ||= nil\n @logger = Logger.new(log_target)\n @logger.level = Logger::INFO\n oldlogger.close if oldlogger && !$TESTING # don't want to close testing's STDOUT logging\n @logger\n end", "def fancy_log\n\n @log.collect { |msg| fancy_print(msg) }\n end", "def lputs(msg)\n logger = RAILS_DEFAULT_LOGGER\n logger.info msg\n puts msg\nend", "def log what=nil, &block\n Lux.config.logger_stdout.call what || block\n end", "def log(s)\n @logger.info(s) if @verbose\n end", "def logger=(writer); end", "def logger=(writer); end", "def logger=(writer); end", "def logger=(writer); end", "def logger=(writer); end", "def logger!(_output)\n @logger = Logger.new(_output)\n end", "def write(msg)\n @logger.info msg\n end", "def debug(log)\n output.puts log if log_level <= DEBUG\n end", "def log(level, message)\n @outputter.call(level, message)\n end", "def autoflush_log=(_arg0); end", "def autoflush_log=(_arg0); end", "def do_log( msg )\n log( msg )\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 log(message)\n SystemdMon::Logger.puts \"#{me}: #{message}\"\n end", "def logger ; @log end", "def logger\n @logger ||= Logger.new(STDOUT)\n end", "def logger_func()\n\t########TO DO########\n# logging configuration\n# logger = Logger.new(STDOUT)\n# log_file = File.open(\"/Users/rubenalberto/Desktop/my-output.log\", \"a\")\n# logger = Logger.new(TeeRb::IODelegate.new(log_file, STDOUT))\n#logger = Logger.new(log_file)\nend", "def logger\n @logger ||= ::Logger.new STDOUT\n end", "def logger\n @logger ||= ::Logger.new STDOUT\n end", "def logger\n @logger ||= ::Logger.new STDOUT\n end", "def default_logger\n Logger.new(STDOUT)\n end", "def logger\n # HACK -- the logfile argument only gets used on the first invocation\n SnapEbs.logger options.logfile\n end", "def setup_logging( level=:fatal )\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tlogarray = []\n\t\t\tThread.current['logger-output'] = logarray\n\t\t\tLoggability.output_to( logarray )\n\t\t\tLoggability.format_as( :html )\n\t\t\tLoggability.level = :debug\n\t\telse\n\t\t\tLoggability.level = level\n\t\tend\n\tend", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log(msg)\n print \" \" if $trace && $verbose\n puts msg if $verbose\n end", "def logger\n ::Logger.new($stdout).tap do |log|\n log.formatter = proc do |severity, _datetime, _progname, msg|\n prep = ' ' * (severity.size + 3)\n message = msg.lines.map.with_index do |str, i|\n next str if i.zero?\n\n str.strip.empty? ? str : prep + str\n end\n color = severity.downcase.to_sym\n msg = +\"[#{SeccompTools::Util.colorize(severity, t: color)}] #{message.join}\"\n msg << \"\\n\" unless msg.end_with?(\"\\n\")\n msg\n end\n end\n end", "def logger\n @logger ||= defined?(Rails) ? Rails.logger : ::Logger.new($stdout)\n end", "def initialize\n self.logger = Logger.new(STDOUT)\n reset!\n end", "def log\n end", "def log!(msg)\n log_info(msg)\n puts(msg)\nend", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end" ]
[ "0.7931657", "0.692836", "0.69221705", "0.69119364", "0.68880635", "0.6869514", "0.6722475", "0.66870356", "0.6676261", "0.6675951", "0.6673436", "0.66717297", "0.66601485", "0.6658912", "0.6641645", "0.6641645", "0.6602516", "0.65761954", "0.65761495", "0.65702075", "0.65270203", "0.651435", "0.65116894", "0.6486949", "0.64797926", "0.6459019", "0.6455989", "0.6455989", "0.6455564", "0.6447927", "0.64466083", "0.64451796", "0.64201206", "0.6414255", "0.6411471", "0.6411471", "0.6396831", "0.6392252", "0.6342763", "0.634177", "0.6333967", "0.63309634", "0.6326934", "0.63185775", "0.63001734", "0.62929124", "0.62886393", "0.62885106", "0.6287037", "0.62820077", "0.6269946", "0.626726", "0.6266695", "0.6266392", "0.6250711", "0.6250711", "0.6250711", "0.6250711", "0.6250711", "0.6250463", "0.6227394", "0.6213033", "0.6210432", "0.62095803", "0.62095803", "0.6205862", "0.6192949", "0.6184673", "0.6174277", "0.6167454", "0.6160837", "0.6158424", "0.6158424", "0.6158424", "0.61564094", "0.6136103", "0.611763", "0.6116564", "0.6116564", "0.6116564", "0.6116564", "0.6116564", "0.6116564", "0.6116564", "0.6116564", "0.6116415", "0.61153734", "0.6112583", "0.61125267", "0.6107376", "0.61055225", "0.6103255", "0.6103255", "0.6103255", "0.6103255", "0.6103255", "0.6103255", "0.6103255", "0.6103255", "0.6103255", "0.6103255" ]
0.0
-1
Log metadata about this ruleset to the currently running deployment
def notify {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n print_debug 'In #run'\n audit self.class.payloads, self.class.options\n end", "def record_to_statsd\n # Only record production deployments in production graphite\n if self.environment == \"production\"\n key = \"deploys.#{self.application.shortname}\"\n STATSD.increment(key)\n end\n end", "def write_metadata; end", "def log\n ::Deployable::Log.log\n end", "def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end", "def write_metadata(variable_set: nil)\n end", "def format_rule_process\n XES::Trace.new.tap do |trace|\n trace.concept_name = \"rule_process %s\" % Util::UUID.generate\n trace.attributes << XES.string(\"pione:traceType\", \"rule_process\")\n trace.events = @rule_process_log.records.map do |record|\n XES::Event.new.tap do |event|\n # standard attributes\n event.concept_name = record.name\n event.org_resource = record.caller\n event.time_timestamp = record.timestamp\n event.lifecycle_transition = record.transition\n\n # pione extension attributes\n event.attributes << XES.string(\"pione:ruleType\", record.rule_type)\n end\n end\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"ruleName\", @rule_name)\n writer.write_collection_of_object_values(\"scheduledActionConfigurations\", @scheduled_action_configurations)\n end", "def activity_logging\n %w(write delete).each do |event|\n observer = @ts.notify(event, [:name, nil, DRbObject, nil])\n activity_output(observer)\n end\n end", "def log_changes(action)\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n case action\n when :save\n if saved_change_to_attribute?(:created_at)\n logger.info \"Created redundant-type assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n end\n when :destroy\n logger.info \"Removed redundant-type assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n end\n end\n end", "def setup_log\r\n logfile = File.open(\"/home/englandk/rails_apps/reminders/log/auto_enquiry.log\", 'a')\r\n \r\n @log = AuditLogger.new(logfile)\r\n @log.level = Logger::INFO\r\n @log.debug \"Started auto response email run\"\r\n end", "def logs\n end", "def log\n @deps.log\n end", "def output\n App.settings.log_output\n end", "def logs\n @runner.log\n end", "def set_audit_informations\n self.event_id = routing_key.split('.')[-3, 2].join(':')\n self.log_type = routing_key.split('.').slice(1, 2).join('.')\n self.routing_type = routing_key.split('.')[3]\n end", "def log_configuration_information\n Mako.logger.info \"Configuration File: #{Mako.config.config_file}\"\n Mako.logger.info \"Theme: #{Mako.config.theme}\"\n Mako.logger.info \"Destination: #{Mako.config.destination}\"\n end", "def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end", "def logs\n\n end", "def dynflow_logger\n ::Rails.logger\n end", "def log_metadata(**values)\n @_context[:_metadata] ||= {}\n @_context[:_metadata].merge!(values)\n end", "def log_action_summary(event)\n env = event.payload\n info do\n \"[#{req_id(env)}] #{req_origin(env)} -> #{res_result(env)} \" \\\n \"(#{event.duration.round(1)}ms)\"\n end\n end", "def command(rule, vars)\n raise \"Invalid rule name '#{rule}'.\" unless valid_id(rule)\n @file.write(\"rule #{rule}\\n description = #{rule}\\n\")\n var_set(vars)\n end", "def rule_set_artifacts\n @rule_set_artifacts ||= []\n end", "def log_writer; end", "def activity_log_create\n write_activity_log(:create)\n end", "def log_to_mixpanel\n mixpanel_log_props = get_job_analytics\n # log job properties to Mixpanel\n MetricsService.log(mixpanel_event_name, mixpanel_log_props, user)\n end", "def set_audit_log_data\n @audit_log.auditable = @product_section if @audit_log\n end", "def log\n instance.options[:log]\n end", "def log\n instance.options[:log]\n end", "def log\n @log\n end", "def metadata\n get_ingest_run.metadata\n end", "def result_log\n end", "def result_log\n end", "def result_log\n end", "def apply_summary\n file = @file ? File.basename(@file) : 'SIMP server <host>.yaml'\n \"Setting of PuppetDB master server & port in #{file} #{@applied_status}\"\n end", "def audit\n Rails.logger.info \"**************inside audit log************\"\n study_name, subject_name = study.name, subject.name\n \n Rake::Task['hello:process'].invoke\n \n file = File.join(File.dirname(__FILE__), 'audit.txt')\n File.open(file, 'a') { |f| f.puts \"A subject named #{subject_name} , enrolled to a Study named #{study_name} with priority 0\" }\n end", "def log(severity, message)\n timestamp = Time.now.strftime('%m-%d %H:%M:%S')\n formatted = \"[%s] %s | %s\" % [timestamp, self.class.name, message]\n RDFMapper::Logger::Configuration.target.add(severity, formatted)\n end", "def log\n end", "def log\n advanced[:log]\n end", "def output_metadata\n @output_metadata ||= {}\n end", "def error_log\n end", "def error_log\n end", "def error_log\n end", "def log_changes(action)\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n case action\n when :save\n if created_at_changed?\n logger.info \"Created assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n else\n # RoleAssignments should really only be created or destroyed, not updated.\n logger.error \"log_changes called for existing RoleAssignment. This shouldn't happen. Assignment is between #{entity.log_identifier} and #{role.log_identifier}.\"\n end\n when :destroy\n logger.info \"Removed assignment between #{entity.log_identifier} and #{role.log_identifier}.\"\n else\n logger.warn \"Unknown action in log_changes #{action}.\"\n end\n end\n end", "def log()\n return @log unless @log.nil?\n @flow.log()\n end", "def log_create\n if self.class.name == 'ParticipantsSportEntry'\n model = self.sport_entry\n action = 'UPDATE'\n else\n model = self\n action = 'CREATE'\n end\n\n ModelAuditJob.perform_now(model, action, audit_user_id)\n end", "def metadata\n configuration.metadata\n end", "def writeHistory()\n\t\t$target_stats.each do |k,v|\n\t\t\t@result.push({k=>v})\n\t\tend\n\tend", "def add_email_log\n @@logs[@logname].outputters << EmailOutputter.new('email_out', # TODO (8) Make GUI for these prefs\n :server=>'heltenkelt.se',\n :port=>25,\n :domain=>'heltenkelt.se',\n :from=>'itunesfeeder@heltenkelt.se',\n :to=>'tommy@heltenkelt.se',\n :subject=>'Report from iTunesFeeder')\n end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log\n logger.info \"Apply migration #{version}\\n\"\n end", "def record\n head = \"argument\\n\\n\"\n body = \"title #{@title}\\n\"\n @premises.each do |p|\n body += \"premise #{p.sha1}\\n\"\n end\n body += \"conclusion #{@conclusion.sha1}\\n\"\n record = head + body\n end", "def store_logger_name\n @config.connection.sadd(@config.log_set_key, @config.stream_name)\n rescue StandardError => exception\n @error_logger.warn \"unable to store name of log: #{exception}\"\n end", "def own_meta_log\n meta_logs.first\n end", "def task_details_for_log\n \"Node #{@puppet_mclient.node_id}, task #{@task}, manifest \"\\\n \"#{@puppet_mclient.manifest}\"\n end", "def log_output()\n prefix = @global_opts[:prefix] ? (@global_opts[:prefix] + \"-\") : \"\"\n t = Time.now.strftime(\"%Y%m%d%H%M%S\")\n\n # Check for any returned records\n if (@successes > 0 and not [\"set\", \"unset\", \"check\"].include?(@cmd))\n any_records = true\n else\n any_records = false\n end\n\n # Data\n if any_records\n data_filename = prefix + \"wc-\" + @cmd + \"-\" + t + \".xml\"\n data = File.new(data_filename, \"w+:UTF-8\")\n data.write(@response_data)\n data.close\n end\n\n status_extension = @global_opts[:csv] ? \".csv\" : \".txt\"\n status_filename = prefix + \"wc-\" + @cmd + \"-\" + t + \"-log\" + status_extension\n\n # Summary\n summary = \"\"\n summary << <<~SUMMARY\n OCLC WorldCat Metadata API: #{@cmd.capitalize} operation\n #{PAST_TENSE[@cmd].capitalize} #{@successes.to_s} #{@successes != 1 ? \"records\" : \"record\"} and #{@failures.to_s} failed\n #{\"Records written to \" + data_filename if any_records}\n Log written to #{status_filename}\n SUMMARY\n\n # Status log\n status = File.new(status_filename, \"w+:UTF-8\")\n status.write(@debug_info) if @global_opts[:debug]\n status.write(summary + \"\\n\")\n status.write(@response_status)\n status.close\n\n puts summary\n end", "def rss_log\n self\n end", "def rss_log\n self\n end", "def log_file; end", "def final_metrics\n Rails.logger.info(\"\\n \\n Priority sync finished at #{Time.zone.now} \\n \\n EPs attempted to sync: #{@run_log.size} \\n EPs successfully synced: #{@run_log.size - @error_log.size} \\n EPs errored: #{@error_log.size} \\n\")\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def log_changes(action)\n Rails.logger.tagged \"ApplicationOperatorship #{id}\" do\n case action\n when :save\n if saved_change_to_attribute?(:created_at)\n logger.info \"Created application operatorship between #{entity.log_identifier} and #{application.log_identifier}.\"\n else\n # ApplicationOperatorships should really only be created or destroyed, not updated.\n logger.error \"log_changes called for existing ApplicationOperatorship. This shouldn't happen. Operatorship is between #{entity.log_identifier} and #{application.log_identifier}.\"\n end\n when :destroy\n logger.info \"Removed application operatorship between entity (ID #{entity_id}, #{entity&.log_identifier}) and application (ID: #{application_id}, #{application&.log_identifier}).\"\n else\n logger.warn \"Unknown action in log_changes #{action}.\"\n end\n end\n end", "def logger_output; end", "def log_tags; end", "def log_tags; end", "def log_tags; end", "def log_environment\n ::NewRelic::Agent.logger.info(\"Environment: #{NewRelic::Control.instance.env}\")\n end", "def record_hit(klass, data)\n system(\"echo '#{data}' >> #{get_log_file_name(klass)}\")\n end", "def notify\n {\n \"log_group_name\" => @config[\"log_group_name\"],\n \"log_stream_name\" => @config[\"log_stream_name\"]\n }\n end", "def start_logging\n @log = Logging.logger[self.class]\n @log.debug \"starting autosign validator: \" + self.name.to_s\n end", "def autolog_created\n autolog_event(:created)\n end", "def inspect\n \"<AuditLogs::Entry id=#{@id} action=#{@action} reason=#{@reason} action_type=#{@action_type} target_type=#{@target_type} count=#{@count} days=#{@days} members_removed=#{@members_removed}>\"\n end", "def log\n Engines.log\n end", "def autoflush_log; end", "def autoflush_log; end", "def audit\n conf['dashboard']['audit']\n end", "def print_rule(rule)\n unless rule.file_exists\n log_red \" #{rule.file}:\", false\n log_red \" '#{rule.before_pattern}' (file not found)\"\n\n return\n end\n\n log \" #{rule.file}:\", false\n\n unless rule.pattern_exists\n log_red \" '#{rule.before_pattern}' (pattern not found)\"\n\n return\n end\n\n log_green \" '#{rule.before_pattern}'\"\n end", "def metadata\n @metadata\n end", "def log_file\n end", "def log\n Engine.logger\n end", "def log_update\n (glossary_terms + observations).each do |object|\n object.log(:log_image_updated, name: log_name, touch: false)\n end\n end", "def log \n\t\t\tArrow::Logger[ self.class ]\n\t\tend", "def update_operations_metrics(save_asset = true)\n\n Rails.logger.info \"Updating the recorded operations metrics for asset = #{object_key}\"\n # nothing to do for now\n\n end", "def setup_log_message\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n text = @acts[1].gsub(/<name>/i) { self.name }\n text.gsub!(/<target>/) { target.name rescue \"\" }\n get_scene.log_window.add_text(text)\n end", "def log_production\n #@log.outputters << Outputter.stdout\n set_dir_and_logfilename(Time.now.to_i)\n FileOutputter.new('coregame_log', :filename=> @out_log_name) \n myApacheLikeFormat = PatternFormatter.new(:pattern => \"[%d] %m\") # questo usa [data] <testo>\n mybaseApacheLikeLog = RollingFileOutputter.new 'coregame_log', \n :maxsize => 999999999, \n :maxtime => 86400 * 7, # tempo in secondi (1 * 14 giorni). Dopo 14 giorni avviene il rollout e \n # quindi viene creato un nuovo file\n :filename => out_log_name, \n :trunc => false, # se true viene usato 'w' in File.open, altrimenti con false 'a' \n # voglio 'a' in quanto ogni volta che viene chiamato lo script, devo avere un append\n :formatter => myApacheLikeFormat\n\n \n Log4r::Logger['coregame_log'].add 'coregame_log'\n Log4r::Logger['coregame_log'].level = INFO\n end" ]
[ "0.54689825", "0.535538", "0.53269994", "0.5161476", "0.51572037", "0.5146851", "0.5136871", "0.51100266", "0.5036239", "0.5034545", "0.50262606", "0.5020156", "0.49960792", "0.4988747", "0.49785566", "0.4966656", "0.49507624", "0.4945704", "0.49307033", "0.4916723", "0.49162096", "0.49118268", "0.4892541", "0.48909", "0.48824126", "0.48797098", "0.48744103", "0.48684052", "0.48679796", "0.48679796", "0.48475608", "0.48453113", "0.48411742", "0.48411742", "0.48411742", "0.4828114", "0.4813566", "0.48127258", "0.48085016", "0.48017392", "0.47974095", "0.47928172", "0.47928172", "0.47928172", "0.47735894", "0.4769578", "0.47674856", "0.47608003", "0.4760066", "0.47593614", "0.4752756", "0.4752756", "0.4752756", "0.4752756", "0.4752756", "0.4752756", "0.4752756", "0.47463644", "0.47463644", "0.47463644", "0.47463644", "0.47463644", "0.47463644", "0.47463644", "0.47463644", "0.47299278", "0.47234103", "0.47233638", "0.4721345", "0.47118646", "0.4711113", "0.4709527", "0.4709527", "0.47084832", "0.47060484", "0.47001895", "0.47001895", "0.46987873", "0.46932054", "0.46888956", "0.46888956", "0.46888956", "0.4683747", "0.46800572", "0.46780676", "0.46763828", "0.4653413", "0.46506038", "0.46397865", "0.46373248", "0.46373248", "0.46352434", "0.46300334", "0.46157944", "0.46151996", "0.46061468", "0.46057752", "0.45994884", "0.4594129", "0.45882428", "0.45679098" ]
0.0
-1
Insert a rule into an existing security group.
def addRule(hosts, proto: "tcp", port: nil, egress: false, port_range: "0-65535" ) rule = Hash.new rule["proto"] = proto if hosts.is_a?(String) rule["hosts"] = [hosts] else rule["hosts"] = hosts end if port != nil port = port.to_s if !port.is_a?(String) rule["port"] = port else rule["port_range"] = port_range end ec2_rule = convertToEc2([rule]) begin if egress MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_egress( group_id: @cloud_id, ip_permissions: ec2_rule ) else MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_ingress( group_id: @cloud_id, ip_permissions: ec2_rule ) end rescue Aws::EC2::Errors::InvalidPermissionDuplicate => e MU.log "Attempt to add duplicate rule to #{@cloud_id}", MU::DEBUG, details: ec2_rule end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_group(group, rule)\n return false unless rule.is_a?(Rule)\n @groups ||= {}\n (@groups[group] ||= []) << rule\n end", "def add_rule(key, rule = nil, &block)\n key = key.to_sym\n if rules[key].nil?\n rule ||= Rule.new(key, &block)\n rules[key] = rule\n else\n raise Error, \"Rule with key '#{key}' already exists on this permission\"\n end\n end", "def add_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})\n requires :network_acl_id\n\n service.create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options)\n true\n end", "def add_rule(rule)\n @rulebook.add_rule rule\n end", "def add_rule_group(rule_group)\n options = { :body => {\n :Rules => rule_group }.to_json }\n post \"rules\", options\n end", "def add_rule( rule )\n type_check( rule, Elements::Rule )\n assert( !name_defined?(rule.name), \"name [#{rule.name}] is already in use\" )\n \n @rules[rule.name] = rule\n end", "def add_rule(rule)\n new_rules = rules.dup\n new_rules << rule\n @rules = new_rules.uniq.freeze\n validate_rules!\n self\n end", "def add_rule(rule)\n @rules << rule\n LOGGER.info \"Adding rule: #{rule.readable}\"\n end", "def add_production_rule(rule)\n @production_rules << rule\n end", "def add_rule(name, rule, &action)\n m = @rules.find {|r| r.name == name}\n action = @default_action if action.nil?\n if m.nil?\n @rules << Rule.new(name, rule, action)\n else\n m.rule = rule\n m.action = action\n end\n end", "def add_policy(_sec, ptype, rule)\n db[table_name].insert(policy_line(ptype, rule))\n end", "def add(rule); end", "def add_rule(rule, keys, options, callback)\n @rules[rule] = Rule.new(rule, keys, options, callback) \n end", "def << rule\n rules << rule\n nil\n end", "def add_rule(pattern, replace = nil, &proc)\n\t\t\tif replace\n\t\t\t\t@rules << @rule.new(pattern, replace)\n\t\t\telse\n\t\t\t\t@rules << @rule.new(pattern, proc)\n\t\t\tend\n\t\tend", "def add_rule request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::AddRuleSecurityPolicyRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/addRule\"\n body = request_pb.security_policy_rule_resource.to_json\n\n result_json = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::Operation.decode_json result_json[:body], { ignore_unknown_fields: true }\n end", "def update_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})\n requires :network_acl_id\n\n service.replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options)\n true\n end", "def push(rule, dest=@rules)\n rule = rule.parse_rule if rule.kind_of? String\n if @rules.has_key? rule.head\n @rules[rule.head].push(rule.daughters)\n else\n @rules[rule.head] = [rule.daughters]\n end\n end", "def add_rule request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/addRule\"\n body = request_pb.security_policy_rule_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def add_group!( group )\n save if add_group( group )\n end", "def add_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n add_rule(rule_number, protocol, rule_action, cidr_block, false, options)\n end", "def rules=(new_rules)\n Fog::Logger.deprecation('#rules= is deprecated. Use the Fog::OpenStack::Compute::SecurityGroupRules collection to create new rules.')\n attributes[:security_group_rules] = new_rules\n end", "def content_rules_rule_group_name_put(authorization, web_application_name, rule_group_name, rule_group, opts = {})\n data, status_code, headers = content_rules_rule_group_name_put_with_http_info(authorization, web_application_name, rule_group_name, rule_group, opts)\n [data, status_code, headers]\n end", "def add_test(example, rule)\n set_rspec_ids(example, rule)\n @tests.example_groups.push(example)\n end", "def addRule(value, tag=nil)\n #Gotta have a rule value, but tag is optional.\n rule = Hash.new\n rule[:value] = value\n if not tag.nil? then\n rule[:tag] = tag\n end\n #Add rule to rules array.\n @rules << rule\n end", "def add_rule(rule)\n if rule.is_a? Axlsx::ConditionalFormattingRule\n @rules << rule\n elsif rule.is_a? Hash\n @rules << ConditionalFormattingRule.new(rule)\n end\n end", "def new_rule(rule)\n Rule.new(rule)\n end", "def add_rule(key, rule)\n if ValidationProfiler::Rules::Manager.instance.nil?\n ValidationProfiler::Rules::Manager.new\n end\n\n ValidationProfiler::Rules::Manager.instance.add_rule(key, rule)\n end", "def add_rule(params)\n response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n params.to_json,\n @@headers)\n\n check_rest_response(response)\n end", "def addTeamRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def add_item_routing_rule(rule)\n @item_routing_rules << rule\n end", "def add_rule(rhs)\n nonterm = '~[' + @nonterm.succ! + ']'\n @rules[nonterm] = rhs\n nonterm\n end", "def <<(rule); end", "def addRule(s, d, t)\r\n invalidMsg = CFG.ruleInvalid(s, d, t)\r\n unless invalidMsg.nil?\r\n return \"Rule invalid:\\n\" + invalidMsg\r\n else\r\n @rules[s.to_sym] = [] unless @rules[s.to_sym]\r\n @rules[s.to_sym].push([d,t])\r\n end\r\n end", "def add_to_group(group)\n self.memberships.create(group_id: group.id)\n end", "def lex_group start_state, regexp, action = nil\n rule = Rule.new(start_state, regexp, action)\n rule.group = group\n self.group << rule\n end", "def add(fw_rule)\n Dnet.fw_add @handle, fw_rule\n end", "def security_group=(new_cidr_block)\n new_cidr_block = new_cidr_block + '/32' unless new_cidr_block.include? \"/\"\n @environment.vpc.security_groups.each do |sg|\n @security_group = sg if sg.group_name == 'SshSecurityGroup' + new_cidr_block\n end\n\n # only create security group if it does not exist\n if @security_group.nil?\n ec2 = Aws::EC2::Resource.new(region: 'us-west-2')\n\n @security_group = ec2.create_security_group(\n group_name: 'SshSecurityGroup' + new_cidr_block,\n description: 'Enable SSH access via port 22',\n vpc_id: @environment.vpc.id\n )\n\n @security_group.authorize_egress(\n ip_permissions: [\n ip_protocol: 'tcp',\n from_port: 22,\n to_port: 22,\n ip_ranges: [\n cidr_ip: new_cidr_block\n ]\n ]\n )\n end\n end", "def add_outbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n add_rule(rule_number, protocol, rule_action, cidr_block, true, options)\n end", "def apply_rule(rule, position, events)\n rule.exec(self, events)\n end", "def node_rule rule:\n label = make_label rule.values\n attrs = rule # assign all rule attributes\n\n add_node :Rule, label, attrs\n end", "def create_rule(name, script, order = nil, enabled = true, stage = 'login_success')\n raise Auth0::InvalidParameter, 'Must supply a valid name' if name.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid script' if script.to_s.empty?\n request_params = {\n name: name,\n enabled: enabled,\n script: script,\n order: order,\n stage: stage\n }\n post(rules_path, request_params)\n end", "def add_group(key)\n key = key.to_sym\n if group_or_permission(key).nil?\n @groups[key] = PermissionGroup.new(@schema, self, key)\n else\n raise Error, \"Group or permission with key of #{key} already exists\"\n end\n end", "def create_or_replace_gateway_rule(domain_id, gateway_policy_id, rule_id, rule, opts = {})\n data, _status_code, _headers = create_or_replace_gateway_rule_with_http_info(domain_id, gateway_policy_id, rule_id, rule, opts)\n data\n end", "def add_seg_rule(seg_name, flavor)\n raise \"no openstack instance\" if @openstack.nil?\n seg_id = seg_name_to_id(seg_name)\n\n case flavor\n when BOSH_FLAVOR\n add_ing_rule(seg_id, 53, 'udp')\n add_ing_rule(seg_id, 68, 'udp')\n add_ing_rule(seg_id, 53, 'tcp')\n add_ing_rule(seg_id, 4222, 'tcp')\n add_ing_rule(seg_id, 6868, 'tcp')\n add_ing_rule(seg_id, 25250, 'tcp')\n add_ing_rule(seg_id, 25555, 'tcp')\n @openstack.create_security_group_rule(seg_id, 'tcp', 1, 65535, \"0.0.0.0/0\", seg_id)\n when SSH_FLAVOR\n add_ing_rule(seg_id, 22, 'tcp')\n add_ing_rule(seg_id, 68, 'udp')\n when CF_PUB_FLAVOR\n add_ing_rule(seg_id, 22, 'tcp')\n add_ing_rule(seg_id, 80, 'tcp')\n add_ing_rule(seg_id, 443, 'tcp')\n add_ing_rule(seg_id, 68, 'udp')\n when CF_PRI_FLAVOR\n add_ing_rule(seg_id, 22, 'tcp')\n add_ing_rule(seg_id, 68, 'udp')\n @openstack.create_security_group_rule(seg_id, 'tcp', 1, 65535, \"0.0.0.0/0\", seg_id)\n else\n raise \"unsupported flavor\"\n end\n end", "def setRules(rules, add_to_self: false, ingress: true, egress: false)\n return if rules.nil? or rules.size == 0\n\n if add_to_self\n rules.each { |rule|\n if rule['sgs'].nil?\n new_rule = rule.clone\n new_rule.delete('hosts')\n rule['sgs'] = Array.new if rule['sgs'].nil?\n rule['sgs'] << { \"Ref\" => @cfm_name }\n end\n }\n end\n\n ec2_rules = convertToEc2(rules)\n\n # Creating an empty security group is ok, so don't freak out if we get\n # a null rule list.\n if !ec2_rules.nil?\n ec2_rules.each { |rule|\n next if rule.nil? or rule[:ip_ranges].nil? # XXX whaaat\n rule[:ip_ranges].each { |cidr|\n MU::Cloud::CloudFormation.setCloudFormationProp(\n @cfm_template[@cfm_name],\n \"SecurityGroupIngress\",\n {\n \"IpProtocol\" => rule[:ip_protocol],\n \"FromPort\" => rule[:from_port],\n \"ToPort\" => rule[:to_port],\n \"CidrIp\" => cidr[:cidr_ip]\n }\n )\n }\n }\n end\n\n end", "def add_group(group_id)\n\t\t\n\t\t# ADD ERROR CHECKING HERE FOR INVALID GROUP -> TEST\n\n\t\tself.group_list |= [group_id]\n\t\tself.update_attribute(:group_list, self.group_list)\n\t\t\n\tend", "def <<(group) \n @groups[group.name] = group\n end", "def add_permission group, acl\n modify_permission(group, acl) { |perm|\n [perm.acl.to_s.split(\"\"), acl.split(\"\")].flatten.map(&:strip).\n uniq.sort.join\n }\n end", "def add_rule_in_section(section_id, firewall_rule, opts = {})\n data, _status_code, _headers = add_rule_in_section_with_http_info(section_id, firewall_rule, opts)\n data\n end", "def rule=(rule)\n write_attribute :rule_id, case rule\n when ReputationRule\n rule.id\n else \n ReputationRule.find_by_name( rule ).try(:id)\n end\n end", "def add_address(ipaddress, rule)\n return false unless rule.is_a?(Rule)\n @addresses ||= {}\n (@addresses[ipaddress] ||= []) << rule\n rule\n end", "def add *rules\n self.set(self, *rules)\n end", "def add_rule(subject, clauses)\n options = { :body => {\n :Subject => subject,\n :Clauses => clauses }.to_json }\n response = @create_send.post \"/segments/#{segment_id}/rules.json\", options\n end", "def insert_group(group, opts = {})\n data, _status_code, _headers = insert_group_with_http_info(group, opts)\n data\n end", "def add_group(group, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{group}\\\"\", 'destructive') {\n\t\t\t\t\t# Only add the group if it's not already there\n\t\t\t\t\tif !group?(group)\n\t\t\t\t\t\tif(gid == nil)\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}'`\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}' -g #{gid.to_i()}`\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend", "def add_to_group(group_path, group_name)\n group = RubyAem::Resources::Group.new(@client, group_path, group_name)\n group.add_member(@call_params[:name])\n end", "def push(rule)\n raise TypeError, \"expected Artifactory::Cleaner::ArtifactFilterRule, got #{rule.class.name}\" unless rule.is_a? Artifactory::Cleaner::ArtifactFilterRule\n @rules.push rule\n @sorted = false\n self\n end", "def add_rule(tag, data, id)\n @rules ||= {}\n @rules[tag] ||= {}\n @rules[tag][id] ||= data.each_with_object({}) do |(key, value), style|\n if value.is_a? Hash\n handle_rule_raw_hash tag, key, value\n else\n style[key] = value\n end\n end\n end", "def add_rule(opts)\n opts = check_params(opts,[:rules])\n super(opts)\n end", "def add_rule(rule_object)\n\n # store the rule\n @rules[rule_object.name] = rule_object\n\n case\n\n # rule which asserts facts without conditions or questions\n when rule_object.matcher.nil? && rule_object.questions.empty?\n\n # add the rule to the fact rules array, contains rules with only facts\n @fact_rules << rule_object\n\n when rule_object.matcher.nil? && rule_object.questions.count > 0\n\n # rules can be triggered directly\n @start_rules << rule_object\n\n else\n\n # get the matcher\n matcher = rule_object.matcher\n\n # get the matcher type (any / all)\n matcher_type = matcher.type\n\n # generate the ruleby conditions based on the matcher conditions\n conditions = create_conditions matcher.conditions\n\n # switch statement for the matcher type\n case matcher_type\n\n # all the conditions must match\n when :all\n\n # star to convert array to arguments\n rule AND *conditions do |v|\n\n # when rule is applicable, add to possible rules\n rule_handler rule_object\n\n end\n\n # one of the conditions must match\n when :any\n\n # star to convert array to arguments\n rule OR *conditions do |v|\n\n # when rule is applicable, add to possible rules\n rule_handler rule_object\n\n end\n\n else\n raise \"Unknown matcher type #{matcher.type}\"\n\n end\n\n end\n\n end", "def add_to_group(group)\n raise 'InvalidGroup' unless group.respond_to?(:add_user)\n # just be lazy and hand off to the group to do the work...\n group.add_user(self)\n end", "def add_rules(rules)\n rules.each do |rule|\n add_rule rule\n end\n end", "def create\n @security = OpenStack::Nova::Compute::SecurityGroup.new();\n @security.name = params[:name]\n @security.description = params[:description]\n @security.save\n \n # TODO\n params[:rules].each do |k, v|\n @rule = OpenStack::Nova::Compute::Rule.new\n @rule.ip_protocol = v[:ip_protocol]\n @rule.from_port = v[:from_port]\n @rule.to_port = v[:to_port]\n @rule.cidr = v[:cidr]\n @rule.parent_group = @security\n @security.rule = @rule\n @rule.save\n @security.rule = @rule\n end\n\n respond_to do |format|\n format.json { render json: { status: 0 } }\n end\n\n # respond_to do |format|\n # if @security.save\n # format.html { redirect_to @security, notice: 'Security was successfully created.' }\n # format.json { render json: @security, status: :created, location: @security }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @security.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def set_rule\n @rule = Rule.find_by id: params[:id], user: current_user\n end", "def include_rule(key_or_existing_rule, options = {}, &block)\n if key_or_existing_rule.is_a?(IncludedRule)\n key = key_or_existing_rule.key\n included_rule = key_or_existing_rule\n else\n key = key_or_existing_rule.to_sym\n included_rule = nil\n end\n\n if included_rules[key].nil?\n included_rule ||= begin\n new_rule = IncludedRule.new(key, &block)\n new_rule.condition = options[:if]\n new_rule\n end\n included_rules[key] = included_rule\n else\n raise Error, \"Rule with key '#{key}' already been included on this permission\"\n end\n end", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def create\n ::ActiveRecord::Base.transaction do\n if group.save!\n membership = add_creator_as_group_admin!\n @side_effects << membership\n end\n end\n rescue ActiveRecord::RecordInvalid => _exception\n raise if group.valid?\n group\n end", "def add_option(rule, key, value)\n return unless include?(rule)\n @rules[rule].options[key] = value\n end", "def add_permission(key)\n key = key.to_sym\n if group_or_permission(key).nil?\n @permissions[key] = Permission.new(self, key)\n else\n raise Error, \"Group or permission with key of #{key} already exists\"\n end\n end", "def apply_rule(type=nil)\n unless rule_exists?\n ufw_command = \"ufw \"\n ufw_command += \"insert #{@new_resource.position} \" if @new_resource.position\n ufw_command += \"#{type} \"\n ufw_command += \"#{@new_resource.direction} \" if @new_resource.direction\n if @new_resource.interface\n if @new_resource.direction\n ufw_command += \"on #{@new_resource.interface} \"\n else\n ufw_command += \"in on #{@new_resource.interface} \"\n end\n end\n ufw_command += \"#{@new_resource.logging} \" if @new_resource.logging\n ufw_command += \"proto #{@new_resource.protocol} \" if @new_resource.protocol\n if @new_resource.source\n ufw_command += \"from #{@new_resource.source} \"\n else\n ufw_command += \"from any \"\n end\n ufw_command += \"port #{@new_resource.dest_port} \" if @new_resource.dest_port\n if @new_resource.destination\n ufw_command += \"to #{@new_resource.destination} \"\n else\n ufw_command += \"to any \"\n end\n ufw_command += \"port #{@new_resource.port} \" if @new_resource.port\n\n Chef::Log.debug(\"ufw: #{ufw_command}\")\n shell_out!(ufw_command)\n\n Chef::Log.info(\"#{@new_resource} #{type} rule added\")\n shell_out!(\"ufw status verbose\") # purely for the Chef::Log.debug output\n @new_resource.updated_by_last_action(true)\n else\n Chef::Log.debug(\"#{@new_resource} #{type} rule exists..skipping.\")\n end\n end", "def rewrite rule, &proc\n rewrite_rules << [rule, proc] if proc\n end", "def check_and_log_managed_rule?(new_rule)\n existing_rule = parse_firewall_rule(new_rule['name'])\n return true if log_system_rule_error?(existing_rule, new_rule)\n return true if log_group_policy_error?(existing_rule, new_rule)\n return false\n end", "def new_sync_rule(audience_id, sync_period, nonsecure_add_url, nonsecure_remove_url, secure_add_url, secure_remove_url)\n post(\"audiences/#{audience_id}/sync_rules?#{\n {\n \"audience_id\" => audience_id,\n \"sync_period\" => sync_period,\n \"nonsecure_add_pixel_url\" => nonsecure_add_url,\n \"secure_add_pixel_url\" => secure_add_url,\n \"nonsecure_remove_pixel_url\" => nonsecure_remove_url,\n \"secure_remove_pixel_url\" => secure_remove_url\n }.url_encode\n }\")\n end", "def create_or_replace_gateway_rule_0(domain_id, gateway_policy_id, rule_id, rule, opts = {})\n data, _status_code, _headers = create_or_replace_gateway_rule_0_with_http_info(domain_id, gateway_policy_id, rule_id, rule, opts)\n data\n end", "def addGroup(groupName)\n\n groups = YAML.load_file(@GROUPSFILE)\n groups[groups.size.next] = groupName\n File.write(@GROUPSFILE, groups.to_yaml)\n return true\n end", "def add_group( group )\n type_check( group, Elements::Group )\n assert( !name_defined?(name), \"name [#{name}] is already in use\" )\n \n @groups[group.name] = group\n end", "def content_rules_post(authorization, web_application_name, rule_group, opts = {})\n data, status_code, headers = content_rules_post_with_http_info(authorization, web_application_name, rule_group, opts)\n [data, status_code, headers]\n end", "def add_group(group_name, filter_argument = T.unsafe(nil), &filter_proc); end", "def update_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n update_rule(rule_number, protocol, rule_action, cidr_block, false, options)\n end", "def add_route( rule, output_channel )\n validate_arguments( binding() )\n routes.push( RouteSpecification.new( rule, output_channel ) )\n end", "def add_group_as_member(group)\n self.groups.push group\n end", "def add_group(group, gid=nil)\n\t\t\tend", "def add_to_group plugin, group:\n group_sym = group.to_sym\n @groups[group_sym] ||= {}\n @groups[group_sym][plugin.to_s] = plugin\n end", "def add_item_compilation_rule(rule)\n @item_compilation_rules << rule\n end", "def create_firewall_rule(rule_hash, firewall_name)\n script_code = +'netsh advfirewall firewall add rule'\n rule_hash.each do |key, val|\n filter_or_append_rule_field(script_code, key, val)\n end\n @@creation_script_cache[firewall_name] = [] if @@creation_script_cache[firewall_name].nil?\n @@creation_script_cache[firewall_name].push(script_code)\n cmd = log_powershell_out('creation', script_code)\n validate_creation_output(cmd.stdout)\n end", "def contact_add_to_group(contact_id, group_id)\n response = xmlrpc('ContactService.addToGroup', contact_id, group_id)\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def create_style_rule(rule); end", "def add_user_to_group(user, group)\n\t\t\tend", "def add_rules(rules)\n options = {request: []}\n rules.each do |rule|\n options[:request] << rule.attributes\n end\n response = nil\n if @parent.class == Profitbricks::LoadBalancer\n response = Profitbricks.request :add_firewall_rules_to_load_balancer, options.merge(load_balancer_id: @parent.id)\n self.reload\n else\n response = Profitbricks.request :add_firewall_rules_to_nic, options.merge(nic_id: self.nic_id)\n self.reload\n end\n \n end", "def save_rule!(objectID, rule, forward_to_replicas = false, request_options = {})\n res = save_rule(objectID, rule, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n edit_security_group( :authorize, name, :from_port => from_port, :to_port => to_port, :protocol => protocol, :cidr_ip => cidr_ip )\n end", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n edit_security_group( :authorize, name, :from_port => from_port, :to_port => to_port, :protocol => protocol, :cidr_ip => cidr_ip )\n end", "def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end", "def rule(val); @rule = val; self; end", "def edge_security rule:\n # Only link access rules related to `podsecuritypolicies` resource, scoped to specific psp \n if rule[:resource] == 'podsecuritypolicies' && !rule[:resource_name].nil?\n rule_label = make_label rule.values\n psp_label = make_label 'psp', rule[:resource_name] # prepare label for PSP based on resource_name\n\n add_relation rule_label, :SECURITY, psp_label\n end\n end", "def rule=(nu_rule)\n unless RULES.include?(nu_rule)\n str = %(\"#{nu_rule}\")\n str << ' is not one of '\n str << RULES.map(&:inspect).join(', ')\n\n raise ArgumentError, str\n end\n\n @rule = nu_rule\n end" ]
[ "0.6768331", "0.66592056", "0.6553603", "0.64926904", "0.6476545", "0.64582264", "0.6352097", "0.6234922", "0.6197109", "0.61785495", "0.6114273", "0.6113903", "0.59489554", "0.59410363", "0.59260315", "0.5871608", "0.58088213", "0.5715657", "0.56822675", "0.5634673", "0.5618818", "0.5616811", "0.56157094", "0.5594414", "0.5584029", "0.55426854", "0.5521781", "0.55209225", "0.5519709", "0.5517407", "0.5477821", "0.54464436", "0.53846484", "0.5367117", "0.5363839", "0.5360883", "0.53604347", "0.5313486", "0.5306273", "0.52713203", "0.5193217", "0.51859134", "0.51829433", "0.51688874", "0.5160717", "0.51300514", "0.5109313", "0.50930995", "0.50788724", "0.50713205", "0.50665474", "0.5040573", "0.50372356", "0.50321907", "0.5020799", "0.5009751", "0.5000061", "0.49906644", "0.4980311", "0.49785173", "0.4965869", "0.49624923", "0.49582696", "0.49553838", "0.4955109", "0.4954736", "0.49487674", "0.49431905", "0.49320447", "0.4928069", "0.49208996", "0.4920119", "0.49170277", "0.49067652", "0.49029356", "0.48971674", "0.48816836", "0.48786104", "0.4867147", "0.48638386", "0.48565102", "0.4850665", "0.48493752", "0.48189703", "0.48065928", "0.48039624", "0.47997245", "0.47995445", "0.47995445", "0.47995445", "0.47991338", "0.47914532", "0.47907484", "0.47819257", "0.4769644", "0.4769644", "0.4764016", "0.47502393", "0.47380483", "0.47341827" ]
0.5647617
19
Manufacture an EC2 security group. The second parameter, rules, is an "ingress_rules" structure parsed and validated by MU::Config.
def setRules(rules, add_to_self: false, ingress: true, egress: false) return if rules.nil? or rules.size == 0 if add_to_self rules.each { |rule| if rule['sgs'].nil? new_rule = rule.clone new_rule.delete('hosts') rule['sgs'] = Array.new if rule['sgs'].nil? rule['sgs'] << { "Ref" => @cfm_name } end } end ec2_rules = convertToEc2(rules) # Creating an empty security group is ok, so don't freak out if we get # a null rule list. if !ec2_rules.nil? ec2_rules.each { |rule| next if rule.nil? or rule[:ip_ranges].nil? # XXX whaaat rule[:ip_ranges].each { |cidr| MU::Cloud::CloudFormation.setCloudFormationProp( @cfm_template[@cfm_name], "SecurityGroupIngress", { "IpProtocol" => rule[:ip_protocol], "FromPort" => rule[:from_port], "ToPort" => rule[:to_port], "CidrIp" => cidr[:cidr_ip] } ) } } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertToEc2(rules)\n ec2_rules = []\n if rules != nil\n rules.each { |rule|\n ec2_rule = Hash.new\n rule['proto'] = \"tcp\" if rule['proto'].nil? or rule['proto'].empty?\n ec2_rule[:ip_protocol] = rule['proto']\n\n p_start = nil\n p_end = nil\n if rule['port_range']\n p_start, p_end = rule['port_range'].split(/\\s*-\\s*/)\n elsif rule['port']\n p_start = rule['port']\n p_end = rule['port']\n elsif rule['proto'] != \"icmp\"\n raise MuError, \"Can't create a TCP or UDP security group rule without specifying ports: #{rule}\"\n end\n if rule['proto'] != \"icmp\"\n if p_start.nil? or p_end.nil?\n raise MuError, \"Got nil ports out of rule #{rule}\"\n end\n ec2_rule[:from_port] = p_start.to_i\n ec2_rule[:to_port] = p_end.to_i\n else\n ec2_rule[:from_port] = -1\n ec2_rule[:to_port] = -1\n end\n\n if (!defined? rule['hosts'] or !rule['hosts'].is_a?(Array)) and\n (!defined? rule['sgs'] or !rule['sgs'].is_a?(Array)) and\n (!defined? rule['lbs'] or !rule['lbs'].is_a?(Array))\n raise MuError, \"One of 'hosts', 'sgs', or 'lbs' in rules provided to createEc2SG must be an array.\"\n end\n ec2_rule[:ip_ranges] = []\n ec2_rule[:user_id_group_pairs] = []\n\n if !rule['hosts'].nil?\n rule['hosts'].each { |cidr|\n next if cidr.nil? # XXX where is that coming from?\n cidr = cidr + \"/32\" if cidr.match(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/)\n ec2_rule[:ip_ranges] << {cidr_ip: cidr}\n }\n end\n\n if !rule['lbs'].nil?\n# XXX This is a dopey place for this, dependencies() should be doing our legwork\n rule['lbs'].each { |lb_name|\n if @dependencies.has_key?(\"loadbalancer\") and @dependencies[\"loadbalancer\"].has_key?(lb_name)\n# MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], \"DependsOn\", @dependencies[\"loadbalancer\"][lb_name].cloudobj.cfm_name)\n end\n }\n end\n\n if !rule['sgs'].nil?\n rule['sgs'].each { |sg_name|\n# XXX This is a dopey place for this, dependencies() should be doing our legwork\n if @dependencies.has_key?(\"firewall_rule\") and @dependencies[\"firewall_rule\"].has_key?(sg_name)\n# MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], \"DependsOn\", @dependencies[\"firewall_rule\"][sg_name].cloudobj.cfm_name)\n end\n }\n end\n\n if !ec2_rule[:user_id_group_pairs].nil? and\n ec2_rule[:user_id_group_pairs].size > 0 and\n !ec2_rule[:ip_ranges].nil? and\n ec2_rule[:ip_ranges].size > 0\n MU.log \"Cannot specify ip_ranges and user_id_group_pairs\", MU::ERR\n raise MuError, \"Cannot specify ip_ranges and user_id_group_pairs\"\n end\n\n ec2_rule.delete(:ip_ranges) if ec2_rule[:ip_ranges].size == 0\n ec2_rule.delete(:user_id_group_pairs) if ec2_rule[:user_id_group_pairs].size == 0\n\n if !ec2_rule[:user_id_group_pairs].nil? and\n ec2_rule[:user_id_group_pairs].size > 0\n ec2_rule.delete(:ip_ranges)\n elsif !ec2_rule[:ip_ranges].nil? and\n ec2_rule[:ip_ranges].size > 0\n ec2_rule.delete(:user_id_group_pairs)\n end\n ec2_rules << ec2_rule\n }\n end\n return ec2_rules\n end", "def rules=(new_rules)\n Fog::Logger.deprecation('#rules= is deprecated. Use the Fog::OpenStack::Compute::SecurityGroupRules collection to create new rules.')\n attributes[:security_group_rules] = new_rules\n end", "def addRule(hosts,\n proto: \"tcp\",\n port: nil,\n egress: false,\n port_range: \"0-65535\"\n )\n rule = Hash.new\n rule[\"proto\"] = proto\n if hosts.is_a?(String)\n rule[\"hosts\"] = [hosts]\n else\n rule[\"hosts\"] = hosts\n end\n if port != nil\n port = port.to_s if !port.is_a?(String)\n rule[\"port\"] = port\n else\n rule[\"port_range\"] = port_range\n end\n ec2_rule = convertToEc2([rule])\n\n begin\n if egress\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_egress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n else\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_ingress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n end\n rescue Aws::EC2::Errors::InvalidPermissionDuplicate => e\n MU.log \"Attempt to add duplicate rule to #{@cloud_id}\", MU::DEBUG, details: ec2_rule\n end\n end", "def create\n @security = OpenStack::Nova::Compute::SecurityGroup.new();\n @security.name = params[:name]\n @security.description = params[:description]\n @security.save\n \n # TODO\n params[:rules].each do |k, v|\n @rule = OpenStack::Nova::Compute::Rule.new\n @rule.ip_protocol = v[:ip_protocol]\n @rule.from_port = v[:from_port]\n @rule.to_port = v[:to_port]\n @rule.cidr = v[:cidr]\n @rule.parent_group = @security\n @security.rule = @rule\n @rule.save\n @security.rule = @rule\n end\n\n respond_to do |format|\n format.json { render json: { status: 0 } }\n end\n\n # respond_to do |format|\n # if @security.save\n # format.html { redirect_to @security, notice: 'Security was successfully created.' }\n # format.json { render json: @security, status: :created, location: @security }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @security.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def authorize_security_group_ingress( options = {} )\n options = { :group_name => nil,\n :ip_protocol => nil,\n :from_port => nil,\n :to_port => nil,\n :cidr_ip => nil,\n :source_security_group_name => nil,\n :source_security_group_owner_id => nil }.merge(options)\n\n # lets not validate the rest of the possible permutations of required params and instead let\n # EC2 sort it out on the server side. We'll only require :group_name as that is always needed.\n raise ArgumentError, \"No :group_name provided\" if options[:group_name].nil? || options[:group_name].empty?\n\n params = { \"GroupName\" => options[:group_name],\n \"IpProtocol\" => options[:ip_protocol],\n \"FromPort\" => options[:from_port].to_s,\n \"ToPort\" => options[:to_port].to_s,\n \"CidrIp\" => options[:cidr_ip],\n \"SourceSecurityGroupName\" => options[:source_security_group_name],\n \"SourceSecurityGroupOwnerId\" => options[:source_security_group_owner_id]\n }\n return response_generator(:action => \"AuthorizeSecurityGroupIngress\", :params => params)\n end", "def create\n ec2 = self.class.new_ec2(@resource.value(:user), @resource.value(:password))\n group = @resource.value(:name)\n begin\n ec2.describe_security_groups({:group_name => group})\n rescue Exception => e\n ec2.create_security_group({ \n :group_name => group,\n :group_description => @resource.value(:desc)\n })\n end\n # if instance in that security group exists, start it\n # otherwise just create a new instance \n ec2.run_instances(\n { :image_id => @resource.value(:image),\n # security groups\n :security_group => group,\n :instance_type => @resource.value(:type)\n })\n end", "def add_rules(rules)\n options = {request: []}\n rules.each do |rule|\n options[:request] << rule.attributes\n end\n response = nil\n if @parent.class == Profitbricks::LoadBalancer\n response = Profitbricks.request :add_firewall_rules_to_load_balancer, options.merge(load_balancer_id: @parent.id)\n self.reload\n else\n response = Profitbricks.request :add_firewall_rules_to_nic, options.merge(nic_id: self.nic_id)\n self.reload\n end\n \n end", "def create(name, desc=nil, addresses=[], ports=[], protocols=[], &each_group)\n desc ||= \"Security Group #{name}\"\n ret = @@ec2.create_security_group(:group_name => name, :group_description => desc)\n return false unless (ret && ret['return'] == 'true')\n authorize(name, addresses, ports, protocols)\n get(name, &each_group)\n end", "def create_group\n group_params = params.require(:group_params)\n\n group_id = @infra.ec2.create_security_group({ group_name: group_params[0], description: group_params[1], vpc_id: group_params[3] })\n @infra.ec2.create_tags(resources: [group_id[:group_id]], tags: [{ key: 'Name', value: group_params[2] }])\n\n render plain: I18n.t('security_groups.msg.change_success')\n end", "def create_group\n group_params = params.require(:group_params)\n\n group_id = @infra.ec2.create_security_group({group_name: group_params[0], description: group_params[1], vpc_id: group_params[3]})\n @infra.ec2.create_tags(resources: [group_id[:group_id]], tags: [{key: 'Name', value: group_params[2]}])\n\n render text: I18n.t('security_groups.msg.change_success')\n end", "def security_group\n node = 'AWS_SECURITY_GROUP'\n q = []\n\n # security_group node\n q.push(_upsert({ node: node, id: @name }))\n\n # vpc node and relationship\n if @data.vpc_id\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_VPC',\n child_name: @data.vpc_id,\n relationship: 'MEMBER_OF_VPC'\n }\n\n q.push(_upsert_and_link(opts))\n end\n\n # ingress rules\n @data.ip_permissions.each do |ingress|\n ingress.ip_ranges.each_with_index do |ip_range, i|\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_SECURITY_GROUP_INGRESS_RULE',\n child_name: \"#{@name}-#{ingress.ip_protocol}-#{ingress.to_port}-#{i}\",\n relationship: 'HAS_INGRESS_RULE',\n relationship_attributes: {\n cidr_ip: ip_range.cidr_ip,\n ip_protocol: ingress.ip_protocol,\n to_port: ingress.to_port,\n from_port: ingress.from_port,\n direction: 'ingress'\n }\n }\n\n q.push(_upsert_and_link(opts))\n end\n end\n\n # egress rules\n @data.ip_permissions_egress.each do |egress|\n egress.ip_ranges.each_with_index do |ip_range, i|\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_SECURITY_GROUP_EGRESS_RULE',\n child_name: \"#{@name}-#{egress.ip_protocol}-#{egress.to_port}-#{i}\",\n relationship: 'HAS_EGRESS_RULE',\n relationship_attributes: {\n cidr_ip: ip_range.cidr_ip,\n ip_protocol: egress.ip_protocol,\n to_port: egress.to_port,\n from_port: egress.from_port,\n direction: 'egress'\n }\n }\n\n q.push(_upsert_and_link(opts))\n end\n end\n\n q\n end", "def authorize_ec2_security_group(group_name, group_owner_id=owner_id)\n key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName'\n authorize_ingress({\n key => group_name,\n 'EC2SecurityGroupOwnerId' => group_owner_id\n })\n end", "def create_security_group(name, vpc_id)\n sg = ec2.create_security_group({\n group_name: name,\n description: \"Kontena Grid\",\n vpc_id: vpc_id\n })\n\n sg.authorize_ingress({ # SSH\n ip_protocol: 'tcp', from_port: 22, to_port: 22, cidr_ip: '0.0.0.0/0'\n })\n sg.authorize_ingress({ # HTTP\n ip_protocol: 'tcp', from_port: 80, to_port: 80, cidr_ip: '0.0.0.0/0'\n })\n sg.authorize_ingress({ # HTTPS\n ip_protocol: 'tcp', from_port: 443, to_port: 443, cidr_ip: '0.0.0.0/0'\n })\n sg.authorize_ingress({ # OpenVPN\n ip_protocol: 'udp', from_port: 1194, to_port: 1194, cidr_ip: '0.0.0.0/0'\n })\n sg.authorize_ingress({ # Overlay / Weave network\n ip_permissions: [\n {\n from_port: 6783, to_port: 6783, ip_protocol: 'tcp',\n user_id_group_pairs: [\n { group_id: sg.group_id, vpc_id: vpc_id }\n ]\n },\n {\n from_port: 6783, to_port: 6784, ip_protocol: 'udp',\n user_id_group_pairs: [\n { group_id: sg.group_id, vpc_id: vpc_id }\n ]\n }\n ]\n })\n\n sg\n end", "def security_group_created_with_egress?(\n ec2_resource,\n group_name,\n description,\n vpc_id,\n ip_protocol,\n from_port,\n to_port,\n cidr_ip_range\n)\n security_group = ec2_resource.create_security_group(\n group_name: group_name,\n description: description,\n vpc_id: vpc_id\n )\n puts \"Created security group '#{group_name}' with ID \" \\\n \"'#{security_group.id}' in VPC with ID '#{vpc_id}'.\"\n security_group.authorize_egress(\n ip_permissions: [\n {\n ip_protocol: ip_protocol,\n from_port: from_port,\n to_port: to_port,\n ip_ranges: [\n {\n cidr_ip: cidr_ip_range\n }\n ]\n }\n ]\n )\n puts \"Granted egress to security group '#{group_name}' for protocol \" \\\n \"'#{ip_protocol}' from port '#{from_port}' to port '#{to_port}' \" \\\n \"with CIDR IP range '#{cidr_ip_range}'.\"\n return true\nrescue StandardError => e\n puts \"Error creating security group or granting egress: #{e.message}\"\n return false\nend", "def security_group=(new_cidr_block)\n new_cidr_block = new_cidr_block + '/32' unless new_cidr_block.include? \"/\"\n @environment.vpc.security_groups.each do |sg|\n @security_group = sg if sg.group_name == 'SshSecurityGroup' + new_cidr_block\n end\n\n # only create security group if it does not exist\n if @security_group.nil?\n ec2 = Aws::EC2::Resource.new(region: 'us-west-2')\n\n @security_group = ec2.create_security_group(\n group_name: 'SshSecurityGroup' + new_cidr_block,\n description: 'Enable SSH access via port 22',\n vpc_id: @environment.vpc.id\n )\n\n @security_group.authorize_egress(\n ip_permissions: [\n ip_protocol: 'tcp',\n from_port: 22,\n to_port: 22,\n ip_ranges: [\n cidr_ip: new_cidr_block\n ]\n ]\n )\n end\n end", "def security_groups\n @resource.security_groups.map { |sg| SecurityGroup.new(id: sg.group_id, ec2_resource: @ec2_resource) }\n end", "def create_security_rule(rule_hash:)\n # construct the XML elements for the request\n element_xpath = \"/config/devices/entry/vsys/entry/rulebase/security/rules/entry[@name='#{rule_hash[:name]}']\"\n\n element_value = \"<action>\" + rule_hash[:action] + \"</action>\"\n element_value += \"<from>\" + rule_hash[:from_zones].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</from>\"\n element_value += \"<to>\" + rule_hash[:to_zones].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</to>\"\n element_value += \"<source>\" + rule_hash[:sources].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</source>\" if rule_hash[:sources]\n element_value += \"<destination>\" + rule_hash[:destinations].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</destination>\" if rule_hash[:destinations]\n element_value += \"<source-user>\" + rule_hash[:source_users].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</source-user>\" if rule_hash[:source_users]\n element_value += \"<service>\" + rule_hash[:services].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</service>\" if rule_hash[:services]\n element_value += \"<category>\" + rule_hash[:categories].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</category>\" if rule_hash[:categories]\n element_value += \"<application>\" + rule_hash[:applications].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</application>\" if rule_hash[:applications]\n element_value += \"<hip-profiles>\" + rule_hash[:hip_profiles].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</hip-profiles>\" if rule_hash[:hip_profiles]\n element_value += \"<log-start>\" + rule_hash[:log_session_start] + \"</log-start>\" if rule_hash[:log_session_start]\n element_value += \"<log-end>\" + rule_hash[:log_session_end] + \"</log-end>\" if rule_hash[:log_session_end]\n\n # configure options for the request\n options = {}\n options[:url] = self.endpoint\n options[:method] = :post\n options[:payload] = { type: \"config\",\n action: \"set\",\n key: self.auth_key,\n xpath: element_xpath,\n element: element_value }\n\n html_result = Helpers::Rest.make_request(options)\n\n raise \"Error during security rule create\" if html_result.nil?\n\n # parse the XML data\n data = Nokogiri::XML(html_result)\n\n # check that the operation was successful\n if data.xpath('//response/@status').to_s == \"success\"\n # commit the change to be operational\n # TODO: Should probably do partial commit once device IDs are built in\n options = {}\n options[:url] = self.endpoint\n options[:method] = :post\n options[:payload] = { type: \"commit\",\n key: self.auth_key,\n cmd: \"<commit></commit>\" }\n\n html_result = Helpers::Rest.make_request(options)\n\n raise \"Error during security rule commit\" if html_result.nil?\n\n # parse the XML data\n data = Nokogiri::XML(html_result)\n\n # check that the operation was successful and return the job ID\n if data.xpath('//response/@status').to_s == \"success\"\n return data.xpath('//response/result/job')[0].content.to_s\n else\n raise \"#{Crack::XML.parse(data.to_xml)}\"\n end\n else\n raise \"#{Crack::XML.parse(data.to_xml)}\"\n end\n end", "def create\n file = Tempfile.new(\"onesecgroup-#{resource[:name]}-create.xml\")\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TEMPLATE do\n xml.NAME resource[:name]\n xml.DESCRIPTION resource[:description]\n resource[:rules].each do |rule|\n xml.RULE do\n rule.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:rules]\n end\n end\n tempfile = builder.to_xml\n file.write(tempfile)\n file.close\n self.debug \"Creating secgroup using #{tempfile}\"\n onesecgroup('create', file.path)\n file.delete\n @property_hash[:ensure] = :present\n end", "def aws_security_group_enable_outbound_to_subnets(opts)\n opts[:security_group].authorize_egress('10.0.0.0/16')\n end", "def authorize_db_security_group_ingress(name, opts={})\n unless opts.key?('CIDRIP') || ((opts.key?('EC2SecurityGroupName') || opts.key?('EC2SecurityGroupId')) && opts.key?('EC2SecurityGroupOwnerId'))\n raise ArgumentError, 'Must specify CIDRIP, or one of EC2SecurityGroupName or EC2SecurityGroupId, and EC2SecurityGroupOwnerId'\n end\n\n request({\n 'Action' => 'AuthorizeDBSecurityGroupIngress',\n :parser => Fog::Parsers::AWS::RDS::AuthorizeDBSecurityGroupIngress.new,\n 'DBSecurityGroupName' => name\n }.merge(opts))\n end", "def edit\n @firewall = OpenStack::Nova::Compute::SecurityGroup.find(params[:id])\n @rules = @firewall.rules\n end", "def revoke_security_group_ingress( options = {} )\n options = { :group_name => nil,\n :ip_protocol => nil,\n :from_port => nil,\n :to_port => nil,\n :cidr_ip => nil,\n :source_security_group_name => nil,\n :source_security_group_owner_id => nil }.merge(options)\n\n # lets not validate the rest of the possible permutations of required params and instead let\n # EC2 sort it out on the server side. We'll only require :group_name as that is always needed.\n raise ArgumentError, \"No :group_name provided\" if options[:group_name].nil? || options[:group_name].empty?\n\n params = { \"GroupName\" => options[:group_name],\n \"IpProtocol\" => options[:ip_protocol],\n \"FromPort\" => options[:from_port].to_s,\n \"ToPort\" => options[:to_port].to_s,\n \"CidrIp\" => options[:cidr_ip],\n \"SourceSecurityGroupName\" => options[:source_security_group_name],\n \"SourceSecurityGroupOwnerId\" => options[:source_security_group_owner_id]\n }\n return response_generator(:action => \"RevokeSecurityGroupIngress\", :params => params)\n end", "def set_security_groups(lb_id, security_group_ids)\n params = {}\n\n params.merge!(Fog::AWS.serialize_keys('SecurityGroups', security_group_ids))\n request({\n 'Action' => 'SetSecurityGroups',\n 'LoadBalancerArn' => lb_id,\n :parser => Fog::Parsers::AWS::ELBV2::SetSecurityGroups.new\n }.merge!(params))\n end", "def authorize_db_security_group_ingress(name, opts={})\n unless opts.key?('CIDRIP') || (opts.key?('EC2SecurityGroupName') && opts.key?('EC2SecurityGroupOwnerId'))\n raise ArgumentError, 'Must specify CIDRIP, or both EC2SecurityGroupName and EC2SecurityGroupOwnerId'\n end\n\n request({\n 'Action' => 'AuthorizeDBSecurityGroupIngress',\n :parser => Fog::Parsers::AWS::RDS::AuthorizeDBSecurityGroupIngress.new,\n 'DBSecurityGroupName' => name\n }.merge(opts))\n\n end", "def edit_security_group(action, group_name, params)\n hash = {}\n case action\n when :authorize, :grant then action = \"AuthorizeSecurityGroupIngress\"\n when :revoke, :remove then action = \"RevokeSecurityGroupIngress\"\n else raise \"Unknown action #{action.inspect}!\"\n end\n hash['GroupName'] = group_name\n hash['SourceSecurityGroupName'] = params[:source_group] unless params[:source_group].right_blank?\n hash['SourceSecurityGroupOwnerId'] = params[:source_group_owner].to_s.gsub(/-/,'') unless params[:source_group_owner].right_blank?\n hash['IpProtocol'] = params[:protocol] unless params[:protocol].right_blank?\n unless params[:port].right_blank?\n hash['FromPort'] = params[:port]\n hash['ToPort'] = params[:port]\n end\n hash['FromPort'] = params[:from_port] unless params[:from_port].right_blank?\n hash['ToPort'] = params[:to_port] unless params[:to_port].right_blank?\n hash['CidrIp'] = params[:cidr_ip] unless params[:cidr_ip].right_blank?\n #\n link = generate_request(action, hash)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def sec_group_exists(groups)\n groups.each do |group|\n begin\n puts \"Verifying #{group} exists...\"\n group = Tapjoy::AutoscalingBootstrap::AWS::EC2.describe_security_groups(group)\n rescue Aws::EC2::Errors::InvalidGroupNotFound => err\n STDERR.puts \"Warning: #{err}\"\n puts \"Creating #{group} for #{Tapjoy::AutoscalingBootstrap.scaler_name}\"\n Tapjoy::AutoscalingBootstrap::AWS::EC2.create_security_group(group)\n end\n end\n end", "def sec_group_exists(groups)\n groups.each do |group|\n begin\n puts \"Verifying #{group} exists...\"\n group = Tapjoy::AutoscalingBootstrap::AWS::EC2.describe_security_groups(group)\n rescue Aws::EC2::Errors::InvalidGroupNotFound => err\n STDERR.puts \"Warning: #{err}\"\n puts \"Creating #{group} for #{Tapjoy::AutoscalingBootstrap.scaler_name}\"\n Tapjoy::AutoscalingBootstrap::AWS::EC2.create_security_group(group)\n end\n end\n end", "def edit_security_group(action, group_name, params)\n hash = {}\n case action\n when :authorize, :grant then action = \"AuthorizeSecurityGroupIngress\"\n when :revoke, :remove then action = \"RevokeSecurityGroupIngress\"\n else raise \"Unknown action #{action.inspect}!\"\n end\n hash['GroupName'] = group_name\n hash['SourceSecurityGroupName'] = params[:source_group] unless params[:source_group].blank?\n hash['SourceSecurityGroupOwnerId'] = params[:source_group_owner].to_s.gsub(/-/,'') unless params[:source_group_owner].blank?\n hash['IpProtocol'] = params[:protocol] unless params[:protocol].blank?\n unless params[:port].blank?\n hash['FromPort'] = params[:port]\n hash['ToPort'] = params[:port]\n end\n hash['FromPort'] = params[:from_port] unless params[:from_port].blank?\n hash['ToPort'] = params[:to_port] unless params[:to_port].blank?\n hash['CidrIp'] = params[:cidr_ip] unless params[:cidr_ip].blank?\n #\n link = generate_request(action, hash)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def authorize_security_group_IP_ingress(name, owner, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n @ec2.autorize_security_group_ingress_IP(name, protocol, from_port, to_port, cidr_ip) \n rescue Exception\n on_query_exception('authorize_security_group_IP_ingress')\n end", "def update_security_groups(elb_name, vpc_id, security_groups)\n @elb.apply_security_groups_to_load_balancer({\n load_balancer_name: elb_name,\n security_groups: security_groups.map do |sg_name|\n SecurityGroups::vpc_security_groups[vpc_id][sg_name].group_id\n end\n })\n end", "def create_secgroup(group)\n connect = aws_api_connect('EC2_Client')\n begin\n p group[:name]\n sec_id = connect.describe_security_groups({\n filters: [\n {\n name: \"group-name\",\n values: [group[:name]],\n },\n ],\n }).security_groups[0].group_id\n return sec_id\n rescue => e\n not_created = true\n end\n\n if not_created == true\n resp = aws_api_connect(\"EC2_Resource\")\n pants = resp.create_security_group({\n group_name: group[:name], # required\n description: group[:description], # required\n vpc_id: group[:vpc_id],\n })\n secgroup_id = pants.id\n puts \"Created secgroup id #{group[:name]} with id #{secgroup_id}.\"\n return secgroup_id\n end\n end", "def apply_security_groups_to_load_balancer(security_group_ids, lb_name)\n params = Fog::AWS.indexed_param('SecurityGroups.member', [*security_group_ids])\n request({\n 'Action' => 'ApplySecurityGroupsToLoadBalancer',\n 'LoadBalancerName' => lb_name,\n :parser => Fog::Parsers::AWS::ELB::ApplySecurityGroupsToLoadBalancer.new\n }.merge!(params))\n end", "def describe_security_groups\n request({\n 'Action' => 'DescribeSecurityGroups',\n :idempotent => true,\n :parser => Fog::Parsers::BT::Compute::DescribeSecurityGroups.new\n })\n end", "def ec2_security_groups\n data.ec2_security_groups\n end", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n edit_security_group( :authorize, name, :from_port => from_port, :to_port => to_port, :protocol => protocol, :cidr_ip => cidr_ip )\n end", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n edit_security_group( :authorize, name, :from_port => from_port, :to_port => to_port, :protocol => protocol, :cidr_ip => cidr_ip )\n end", "def add_rule_group(rule_group)\n options = { :body => {\n :Rules => rule_group }.to_json }\n post \"rules\", options\n end", "def objectize_security_groups(security_groups)\n security_groups.keys.map do |sec_id|\n secgrp_raw = security_groups[sec_id]\n rules_objects = secgrp_raw[:rules].map { |rule| build_rule_object(rule, secgrp_raw) }\n build_security_group_object(secgrp_raw, rules_objects)\n end\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def create_security_group(security_group_name)\n ports = {\n ssh_access: 22,\n nats_server: 4222,\n message_bus: 6868,\n blobstore: 25250,\n bosh_director: 25555,\n bosh_registry: 25777\n }\n # TODO: New stemcells to be released will use 25777, so this can be deleted\n ports[:openstack_registry] = 25889 if openstack?\n\n provider.create_security_group(security_group_name, \"microbosh\", ports)\n\n settings[\"bosh_cloud_properties\"][provider_name][\"default_security_groups\"] = [security_group_name]\n settings[\"bosh_security_group\"] = {}\n settings[\"bosh_security_group\"][\"name\"] = security_group_name\n settings[\"bosh_security_group\"][\"ports\"] = {}\n ports.each { |name, port| settings[\"bosh_security_group\"][\"ports\"][name.to_s] = port }\n save_settings!\n end", "def aws_create_security_group( name, opts = {} )\n opts = deep_merge_hashes( @aws_default_sg_options, opts )\n region = opts.delete( :region )\n ec2 = AWS::EC2.new.regions[ region ]\n unless ec2.security_groups.find { |sg| sg.name == name }\n ec2.security_groups.create( name, opts )\n end\n end", "def create_security_group(name, description)\n # EC2 doesn't like an empty description...\n description = \" \" if description.blank?\n link = generate_request(\"CreateSecurityGroup\", \n 'GroupName' => name.to_s, \n 'GroupDescription' => description.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def create_security_group(name, description)\n # EC2 doesn't like an empty description...\n description = \" \" if description.blank?\n link = generate_request(\"CreateSecurityGroup\", \n 'GroupName' => name.to_s,\n 'GroupDescription' => description.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def parse_rules(rules)\n rules.split(\"\\n\").map do |rule|\n rule_name,r1,r2,r3,r4 = rule.match(/^([\\w\\s]+): (\\d+)-(\\d+) or (\\d+)-(\\d+)$/i).captures\n [rule_name,[(r1.to_i..r2.to_i),(r3.to_i..r4.to_i)]]\n end.to_h\n end", "def security_group(sg_name, hsh={}, &block)\n sg_name = sg_name.to_s\n security_groups[sg_name] ||= Ironfan::Cloud::SecurityGroup.new(self, sg_name)\n security_groups[sg_name].configure(hsh, &block)\n security_groups[sg_name]\n end", "def create rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_post_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def modify_security_group(db_instance_identifier, vpc_security_groups)\n modify_db_instance(db_instance_identifier: db_instance_identifier, vpc_security_group_ids: vpc_security_groups)\n end", "def security_group_to_security_group(_options = {})\n return {} if ar_ems.nil?\n\n cloud_network = field(:cloud_network)\n return {} if cloud_network.nil?\n\n ar_security_group = ar_ems.security_groups.select { |security_group| security_group.cloud_network.ems_ref == cloud_network }\n index_dropdown(ar_security_group)\n rescue => e\n logger(__method__).ui_exception(e)\n end", "def aws_security_group_disable_outbound(opts)\n opts[:security_group].revoke_egress('0.0.0.0/0')\n end", "def edge_security rule:\n # Only link access rules related to `podsecuritypolicies` resource, scoped to specific psp \n if rule[:resource] == 'podsecuritypolicies' && !rule[:resource_name].nil?\n rule_label = make_label rule.values\n psp_label = make_label 'psp', rule[:resource_name] # prepare label for PSP based on resource_name\n\n add_relation rule_label, :SECURITY, psp_label\n end\n end", "def construct_rules rules\n parsed_rules = {:rules => []}\n rules.each do |rule|\n parsed_rules[:rules] << rule.attributes\n end\n parsed_rules.to_json\n end", "def add_rules(rules)\n rules.each do |rule|\n add_rule rule\n end\n end", "def create\n @aws_security_group_egress = AwsSecurityGroupEgress.new(aws_security_group_egress_params)\n\n respond_to do |format|\n if @aws_security_group_egress.save\n format.html { redirect_to @aws_security_group_egress, notice: 'Aws security group egress was successfully created.' }\n format.json { render :show, status: :created, location: @aws_security_group_egress }\n else\n format.html { render :new }\n format.json { render json: @aws_security_group_egress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_security_group(name, description=nil)\n # EC2 doesn't like an empty description...\n description = \"-\" if description.right_blank?\n link = generate_request(\"CreateSecurityGroup\",\n 'GroupName' => name.to_s,\n 'GroupDescription' => description.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def create_and_setup_SGs(client, vpc_id)\n # Create security group for private subnet ingress TCP port 80 (for httpd (nginx)).\n puts 'Creating security group for ingress TCP port 80 on private subnet...'\n response = client.create_security_group(group_name: 'sg_in_tcp_80_priv',\n description: 'Ingress TCP HTTP:80 priv subnet',\n vpc_id: vpc_id)\n sg_tcp_80_priv = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_80_priv}]\"\n\n # Create security group for public LBs ingress TCP port 80.\n puts 'Creating security group for ingress TCP port 80 for LBs...'\n response = client.create_security_group(group_name: 'sg_in_tcp_80_lb',\n description: 'Ingress TCP HTTP:80 LBs',\n vpc_id: vpc_id)\n sg_tcp_80_lb = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_80_lb}]\"\n\n\n # Create security group for private subnet ingress TCP port 22 (for sshd).\n puts 'Creating security group for ingress TCP port 22 for private subnet...'\n response = client.create_security_group(group_name: 'sg_in_tcp_22_priv',\n description: 'Ingress TCP SSH:22 priv subnet',\n vpc_id: vpc_id)\n sg_tcp_22_priv = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_22_priv}]\"\n\n # Create security group for ingress TCP port 22 (for sshd) for public nat instances.\n puts 'Creating security group for ingress TCP port 22 for public nat instances...'\n response = client.create_security_group(group_name: 'sg_in_tcp_22_pub',\n description: 'Ingress TCP SSH:22 NAT instances',\n vpc_id: vpc_id)\n sg_tcp_22_pub = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_22_pub}]\"\n\n # Create security group for ingress TCP port 80 (for nginx instance updates) through nat instances.\n puts 'Creating security group for ingress TCP port 80 for NAT instance...'\n response = client.create_security_group(group_name: 'sg_in_tcp_80_nat',\n description: 'Ingress TCP HTTP:80 to/through NAT instances',\n vpc_id: vpc_id)\n sg_tcp_80_nat = response.group_id\n puts \"Security group created; Security group id = [#{sg_tcp_80_nat}]\"\n\n # Add an ingress rule of *any* (0.0.0.0/0) to the TCP port 80 private subnet security group.\n puts 'Adding ingress rule of *any* to the TCP port 80 private subnet security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_80_priv,\n ip_protocol: 'tcp',\n from_port: 80, # This is the start of the port range\n to_port: 80, # This is the end of the port range\n cidr_ip: '0.0.0.0/0') # TODO: limit to aws LB address space\n puts 'Rule added.'\n\n # Add an ingress rule of *any* (0.0.0.0/0) to the TCP port 80 LB security group.\n puts 'Adding ingress rule of *any* to the TCP port 80 LB security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_80_lb,\n ip_protocol: 'tcp',\n from_port: 80, # This is the start of the port range\n to_port: 80, # This is the end of the port range\n cidr_ip: '0.0.0.0/0')\n puts 'Rule added.'\n\n # Add an ingress rule of (10.0.0.0/16) to the TCP port 80 for the nat instances.\n puts 'Adding ingress rule of (10.0.0.0/16) to the TCP port 80 for the private nat instance side...'\n client.authorize_security_group_ingress(group_id: sg_tcp_80_nat,\n ip_protocol: 'tcp',\n from_port: 80, # This is the start of the port range\n to_port: 80, # This is the end of the port range\n cidr_ip: '10.0.0.0/16')\n puts 'Rule added.'\n\n # Add an ingress rule of 10.0.100.0/24 to the TCP port 22 private subnet security group.\n puts 'Adding ingress rule of 10.0.100.0/24 to the TCP port 22 private subnet security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_22_priv,\n ip_protocol: 'tcp',\n from_port: 22, # This is the start of the port range\n to_port: 22, # This is the end of the port range\n cidr_ip: '10.0.100.0/24') # eg. for ssh access from nat instance\n puts 'Rule added.'\n\n # Add an ingress rule of 10.0.200.0/24 to the TCP port 22 private subnet security group.\n puts 'Adding ingress rule of 10.0.200.0/24 to the TCP port 22 private subnet security group...'\n client.authorize_security_group_ingress(group_id: sg_tcp_22_priv,\n ip_protocol: 'tcp',\n from_port: 22, # This is the start of the port range\n to_port: 22, # This is the end of the port range\n cidr_ip: '10.0.200.0/24') # eg. for ssh access from nat instance\n puts 'Rule added.'\n\n # Add an ingress rule of your choice here to the TCP port 22 public subnet security group.\n # puts 'Adding ingress rule of x.x.x.x/32 to the TCP port 22 public subnet security group...'\n # client.authorize_security_group_ingress(group_id: sg_tcp_22_pub,\n # ip_protocol: 'tcp',\n # from_port: 22, # This is the start of the port range\n # to_port: 22, # This is the end of the port range\n # cidr_ip: 'x.x.x.x/32') # Replace this with your src IP.\n # puts 'Rule added.'\n return sg_tcp_80_priv, sg_tcp_22_priv, sg_tcp_22_pub, sg_tcp_80_nat, sg_tcp_80_lb\nend", "def createSubnetGroup\n subnet_ids = []\n if @config[\"vpc\"] && !@config[\"vpc\"].empty?\n raise MuError.new \"Didn't find the VPC specified for #{@mu_name}\", details: @config[\"vpc\"].to_h unless @vpc\n\n vpc_id = @vpc.cloud_id\n\n # Getting subnet IDs\n if @config[\"vpc\"][\"subnets\"].empty?\n @vpc.subnets.each { |subnet|\n subnet_ids << subnet.cloud_id\n }\n MU.log \"No subnets specified for #{@config['identifier']}, adding all subnets in #{@vpc}\", MU::DEBUG\n else\n @config[\"vpc\"][\"subnets\"].each { |subnet|\n subnet_obj = @vpc.getSubnet(cloud_id: subnet[\"subnet_id\"].to_s, name: subnet[\"subnet_name\"].to_s)\n raise MuError.new \"Couldn't find a live subnet matching #{subnet} in #{@vpc}\", details: @vpc.subnets if subnet_obj.nil?\n subnet_ids << subnet_obj.cloud_id\n }\n end\n else\n # If we didn't specify a VPC try to figure out if the account has a default VPC\n vpc_id = nil\n subnets = []\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_vpcs.vpcs.each { |vpc|\n if vpc.is_default\n vpc_id = vpc.vpc_id\n subnets = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_subnets(\n filters: [\n {\n name: \"vpc-id\", \n values: [vpc_id]\n }\n ]\n ).subnets\n break\n end\n }\n\n if !subnets.empty?\n mu_subnets = []\n subnets.each { |subnet|\n subnet_ids << subnet.subnet_id\n mu_subnets << {\"subnet_id\" => subnet.subnet_id}\n }\n\n @config['vpc'] = {\n \"vpc_id\" => vpc_id,\n \"subnets\" => mu_subnets\n }\n\n MU.log \"Using default VPC for cache cluster #{@config['identifier']}\"\n end\n end\n\n if subnet_ids.empty?\n raise MuError, \"Can't create subnet group #{@config[\"subnet_group_name\"]} because I couldn't find a VPC or subnets\"\n else\n MU.log \"Creating subnet group #{@config[\"subnet_group_name\"]} for cache cluster #{@config['identifier']}\"\n\n MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_cache_subnet_group(\n cache_subnet_group_name: @config[\"subnet_group_name\"],\n cache_subnet_group_description: @config[\"subnet_group_name\"],\n subnet_ids: subnet_ids\n )\n\n allowBastionAccess\n\n if @dependencies.has_key?('firewall_rule')\n @config[\"security_group_ids\"] = []\n @dependencies['firewall_rule'].values.each { |sg|\n @config[\"security_group_ids\"] << sg.cloud_id\n }\n end\n end\n end", "def create_security_group(name, description=nil)\n # EC2 doesn't like an empty description...\n description = \"-\" if description.blank?\n link = generate_request(\"CreateSecurityGroup\",\n 'GroupName' => name.to_s,\n 'GroupDescription' => description.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def new\n @security = OpenStack::Nova::Compute::SecurityGroup.new\n @rule = OpenStack::Nova::Compute::Rule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @security }\n end\n end", "def check_ingress_rule(rule, ip_permissions)\n if (rule.has_key? :security_group)\n group_name = rule[:security_group]\n protocols = rule[:protocol] || ['tcp', 'udp', 'icmp']\n match = Array(protocols).all? do |protocol|\n from_port = rule[:port] || rule[:from_port] || (protocol == 'icmp' ? -1 : 1)\n to_port = rule[:port] || rule[:to_port] || (protocol == 'icmp' ? -1 : 65535)\n get_group_permission(ip_permissions, group_name, protocol, from_port, to_port)\n end\n msg = \"Could not find ingress rule for #{group_name}\"\n else\n protocol = rule[:protocol] || 'tcp'\n from_port = rule[:port] || rule[:from_port] || (protocol == 'icmp' ? -1 : 1)\n to_port = rule[:port] || rule[:to_port] || (protocol == 'icmp' ? -1 : 65535)\n match = ip_permissions.any? do |perm|\n protocol == perm[:ip_protocol] &&\n from_port == perm[:from_port] &&\n to_port == perm[:to_port] &&\n perm[:ip_ranges].any? { |ip| ip[:cidr_ip] == rule[:cidr] }\n end\n\n msg = \"Could not find ingress rule for #{protocol} from port #{from_port} to #{to_port} with CIDR #{rule[:cidr]}\"\n end\n [match, msg]\n end", "def modify_rule(rule_id, actions, conditions)\n params = {}\n\n params.merge!(Fog::AWS.serialize_keys('Actions', actions))\n params.merge!(Fog::AWS.serialize_keys('Conditions', conditions))\n\n request({\n 'Action' => 'ModifyRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::ModifyRule.new\n }.merge(params))\n end", "def createEc2Instance\n name = @config[\"name\"]\n node = @config['mu_name']\n\n instance_descriptor = {\n :image_id => @config[\"ami_id\"],\n :key_name => @deploy.ssh_key_name,\n :instance_type => @config[\"size\"],\n :disable_api_termination => true,\n :min_count => 1,\n :max_count => 1\n }\n\n arn = nil\n if @config['generate_iam_role']\n role = @deploy.findLitterMate(name: @config['name'], type: \"roles\")\n s3_objs = [\"#{@deploy.deploy_id}-secret\", \"#{role.mu_name}.pfx\", \"#{role.mu_name}.crt\", \"#{role.mu_name}.key\", \"#{role.mu_name}-winrm.crt\", \"#{role.mu_name}-winrm.key\"].map { |file| \n 'arn:'+(MU::Cloud::AWS.isGovCloud?(@config['region']) ? \"aws-us-gov\" : \"aws\")+':s3:::'+MU.adminBucketName+'/'+file\n }\n role.cloudobj.injectPolicyTargets(\"MuSecrets\", s3_objs)\n\n @config['iam_role'] = role.mu_name\n arn = role.cloudobj.createInstanceProfile\n# @cfm_role_name, @cfm_prof_name\n\n elsif @config['iam_role'].nil?\n raise MuError, \"#{@mu_name} has generate_iam_role set to false, but no iam_role assigned.\"\n end\n if !@config[\"iam_role\"].nil?\n if arn\n instance_descriptor[:iam_instance_profile] = {arn: arn}\n else\n instance_descriptor[:iam_instance_profile] = {name: @config[\"iam_role\"]}\n end\n end\n\n security_groups = []\n if @dependencies.has_key?(\"firewall_rule\")\n @dependencies['firewall_rule'].values.each { |sg|\n security_groups << sg.cloud_id\n }\n end\n\n if security_groups.size > 0\n instance_descriptor[:security_group_ids] = security_groups\n else\n raise MuError, \"Didn't get any security groups assigned to be in #{@mu_name}, that shouldn't happen\"\n end\n\n if !@config['private_ip'].nil?\n instance_descriptor[:private_ip_address] = @config['private_ip']\n end\n\n vpc_id = subnet = nil\n if !@vpc.nil? and @config.has_key?(\"vpc\")\n subnet_conf = @config['vpc']\n subnet_conf = @config['vpc']['subnets'].first if @config['vpc'].has_key?(\"subnets\") and !@config['vpc']['subnets'].empty?\n tag_key, tag_value = subnet_conf['tag'].split(/=/, 2) if !subnet_conf['tag'].nil?\n\n subnet = @vpc.getSubnet(\n cloud_id: subnet_conf['subnet_id'],\n name: subnet_conf['subnet_name'],\n tag_key: tag_key,\n tag_value: tag_value\n )\n if subnet.nil?\n raise MuError, \"Got null subnet id out of #{subnet_conf['vpc']}\"\n end\n MU.log \"Deploying #{node} into VPC #{@vpc.cloud_id} Subnet #{subnet.cloud_id}\"\n punchAdminNAT\n instance_descriptor[:subnet_id] = subnet.cloud_id\n end\n\n if !@userdata.nil? and !@userdata.empty?\n instance_descriptor[:user_data] = Base64.encode64(@userdata)\n end\n\n MU::Cloud::AWS::Server.waitForAMI(@config[\"ami_id\"], region: @config['region'], credentials: @config['credentials'])\n\n # Figure out which devices are embedded in the AMI already.\n image = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_images(image_ids: [@config[\"ami_id\"]]).images.first\n ext_disks = {}\n if !image.block_device_mappings.nil?\n image.block_device_mappings.each { |disk|\n if !disk.device_name.nil? and !disk.device_name.empty? and !disk.ebs.nil? and !disk.ebs.empty?\n ext_disks[disk.device_name] = MU.structToHash(disk.ebs)\n end\n }\n end\n\n configured_storage = Array.new\n cfm_volume_map = {}\n if @config[\"storage\"]\n @config[\"storage\"].each { |vol|\n # Drop the \"encrypted\" flag if a snapshot for this device exists\n # in the AMI, even if they both agree about the value of said\n # flag. Apparently that's a thing now.\n if ext_disks.has_key?(vol[\"device\"])\n if ext_disks[vol[\"device\"]].has_key?(:snapshot_id)\n vol.delete(\"encrypted\")\n end\n end\n mapping, cfm_mapping = MU::Cloud::AWS::Server.convertBlockDeviceMapping(vol)\n configured_storage << mapping\n }\n end\n\n instance_descriptor[:block_device_mappings] = configured_storage\n instance_descriptor[:block_device_mappings].concat(@ephemeral_mappings)\n instance_descriptor[:monitoring] = {enabled: @config['monitoring']}\n\n MU.log \"Creating EC2 instance #{node}\"\n MU.log \"Instance details for #{node}: #{instance_descriptor}\", MU::DEBUG\n#\t\t\t\tif instance_descriptor[:block_device_mappings].empty?\n#\t\t\t\t\tinstance_descriptor.delete(:block_device_mappings)\n#\t\t\t\tend\n\n retries = 0\n begin\n response = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).run_instances(instance_descriptor)\n rescue Aws::EC2::Errors::InvalidGroupNotFound, Aws::EC2::Errors::InvalidSubnetIDNotFound, Aws::EC2::Errors::InvalidParameterValue => e\n if retries < 10\n if retries > 7\n MU.log \"Seeing #{e.inspect} while trying to launch #{node}, retrying a few more times...\", MU::WARN, details: instance_descriptor\n end\n sleep 10\n retries = retries + 1\n retry\n else\n raise MuError, e.inspect\n end\n end\n\n instance = response.instances.first\n MU.log \"#{node} (#{instance.instance_id}) coming online\"\n\n return instance\n\n end", "def authorize_db_security_group( options = {} )\n raise ArgumentError, \"No :db_security_group_name provided\" if options.does_not_have?(:db_security_group_name)\n\n params = {}\n params['DBSecurityGroupName'] = options[:db_security_group_name]\n\n if options.has?(:cidrip)\n params['CIDRIP'] = options[:cidrip]\n elsif options.has?(:ec2_security_group_name) && options.has?(:ec2_security_group_owner_id)\n params['EC2SecurityGroupName'] = options[:ec2_security_group_name]\n params['EC2SecurityGroupOwnerId'] = options[:ec2_security_group_owner_id]\n else\n raise ArgumentError, \"No :cidrip or :ec2_security_group_name and :ec2_security_group_owner_id provided\"\n end\n\n return response_generator(:action => \"AuthorizeDBSecurityGroupIngress\", :params => params)\n end", "def add_compliance_to_config_rules(config_rules)\n mapped_compliance_results = fetch_all_compliance_info(config_rules)\n\n # Add compliance to config_rules\n config_rules.each do |rule|\n rule[:compliance] = mapped_compliance_results[rule[:config_rule_name]]&.dig(:compliance, :compliance_type)\n end\n\n config_rules\n end", "def add_group(group, rule)\n return false unless rule.is_a?(Rule)\n @groups ||= {}\n (@groups[group] ||= []) << rule\n end", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n link = generate_request(\"AuthorizeSecurityGroupIngress\", \n 'GroupName' => name.to_s, \n 'IpProtocol' => protocol.to_s, \n 'FromPort' => from_port.to_s, \n 'ToPort' => to_port.to_s, \n 'CidrIp' => cidr_ip.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def create_db_security_group(name, description = name)\n request({\n 'Action' => 'CreateDBSecurityGroup',\n 'DBSecurityGroupName' => name,\n 'DBSecurityGroupDescription' => description,\n :parser => Fog::Parsers::AWS::RDS::CreateDBSecurityGroup.new\n })\n end", "def distributed_engine_rules_2_json_simple(rules)\n\n end", "def add_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})\n requires :network_acl_id\n\n service.create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options)\n true\n end", "def authorize_security_group_IP_ingress(name, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n link = generate_request(\"AuthorizeSecurityGroupIngress\", \n 'GroupName' => name.to_s,\n 'IpProtocol' => protocol.to_s,\n 'FromPort' => from_port.to_s,\n 'ToPort' => to_port.to_s,\n 'CidrIp' => cidr_ip.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def instance_vpc(name, image_id, subnet, security_groups, depends_on: [], properties: {})\n fail \"VPC instance #{name} can not contain non VPC SecurityGroups\" if properties.include?(:SecurityGroups)\n if properties.include?(:NetworkInterfaces)\n fail \"VPC instance #{name} can not contain NetworkInterfaces and subnet or security_groups\"\n end\n properties[:ImageId] = image_id\n properties[:SubnetId] = subnet\n properties[:SecurityGroupIds] = security_groups\n if properties[:Tags] && !properties[:Tags].any? { |x| x[:Key] == 'Name' }\n properties[:Tags] << { Key: 'Name', Value: join('-', aws_stack_name, name) }\n end\n options = {\n Type: 'AWS::EC2::Instance',\n Properties: properties\n }\n\n options[:DependsOn] = depends_on unless depends_on.empty?\n resource name, options\n name\n end", "def set_aws_security_group_egress\n @aws_security_group_egress = AwsSecurityGroupEgress.find(params[:id])\n end", "def to_rules\n Array.new.tap do |rules|\n new_rule = Rule.new(rule.chain)\n new_rule.description = \"#{rule.description} (#{self.description})\"\n new_rule.rule = rule.rule.gsub(/\\{\\{(\\w+)\\}\\}/) do\n if value = self.options[$1.to_sym]\n value\n else\n \"{{#{$1}}}\"\n end\n end\n new_rule.action = rule.action\n new_rule.conditions = rule.conditions | self.conditions\n if self.version\n new_rule.versions = [self.version]\n end\n\n if has_host_group?\n host_group = @rule.chain.table.base.host_groups[self.options[:ip]]\n host_group.hosts.each do |key, host|\n host.ips.each do |v, ip|\n hg_rule = new_rule.dup\n hg_rule.description += \" (#{host.name} via #{host_group.name})\"\n hg_rule.rule.gsub!(host_group.name.to_s, ip)\n hg_rule.versions = [v]\n rules << hg_rule\n end\n end\n else\n rules << new_rule\n end\n end\n end", "def authorize_security_group_named_ingress(name, owner, group)\n edit_security_group( :authorize, name, :source_group_owner => owner, :source_group => group)\n end", "def authorize_security_group_named_ingress(name, owner, group)\n edit_security_group( :authorize, name, :source_group_owner => owner, :source_group => group)\n end", "def revoke_security_group_IP_ingress(name, owner, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n @ec2.revoke_security_group_ingress_IP(name, protocol, from_port, to_port, cidr_ip) \n rescue Exception\n on_query_exception('revoke_security_group_IP_ingress')\n end", "def transform_rules(rules)\n rules.map do |rule|\n case rule\n when Array\n transform_rules(rule)\n when String\n opts[:hostname_map][rule]\n end\n end\n end", "def revoke_ec2_security_group(group_name, group_owner_id=owner_id)\n key = group_name.match(/^sg-/) ? 'EC2SecurityGroupId' : 'EC2SecurityGroupName'\n revoke_ingress({\n key => group_name,\n 'EC2SecurityGroupOwnerId' => group_owner_id\n })\n end", "def add_rule request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::AddRuleSecurityPolicyRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/addRule\"\n body = request_pb.security_policy_rule_resource.to_json\n\n result_json = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::Operation.decode_json result_json[:body], { ignore_unknown_fields: true }\n end", "def create_security_group(name, description)\n action = 'CreateSecurityGroup'\n params = {\n 'Action' => action,\n 'GroupName' => name,\n 'GroupDescription' => description\n }\n\n response = send_query_request(params)\n response.is_a?(Net::HTTPSuccess)\n end", "def parse_rules(rules)\n key = nil\n rules.each do |s|\n s.split.each do |ru|\n if key.nil? and /^:([a-z_]+)=(\\S+)*/ =~ ru\n key = $1\n var = $2\n @attr[key] = var\n key = nil\n elsif /^:([a-z_]+)+/ =~ ru\n key = $1\n if @attr[key].nil?\n @attr[key] = []\n end\n elsif not key.nil?\n @attr[key].push ru unless key.nil?\n else\n if /([a-z0-9_.:-]+)([=!><\\~][=>]*)(.*)/ =~ ru\n names = $1\n op = $2\n ver = $3\n r = Gem::Version.new ver\n name, new_name = names.split(/:/, 2)\n @requirements[name] = {\n :method => :update,\n :op => op,\n :version => r,\n :name => new_name\n }\n elsif /([a-z0-9_-]+):$/ =~ ru\n name = $1\n @requirements[name] = {\n :method => :delete,\n }\n end\n end\n end\n end\n end", "def parse_rules(rules)\n rules.split(\"\\n\").each_with_object({}) do |rule, rule_hsh|\n mdata = /\\s{3}(\\w+)\\s/.match(rule)\n case mdata.nil? ? nil : mdata[1]\n when 'match'\n rule_hsh[:match] = [] unless rule_hsh.include?(:match)\n rule_hsh[:match] << rule.sub('match', '').strip\n when 'set'\n rule_hsh[:set] = [] unless rule_hsh.include?(:set)\n rule_hsh[:set] << rule.sub('set', '').strip\n when 'continue'\n rule_hsh[:continue] = nil unless rule_hsh.include?(:continue)\n rule_hsh[:continue] = rule.sub('continue', '').strip.to_i\n when 'description'\n rule_hsh[:description] = nil unless rule_hsh.include?(:description)\n rule_hsh[:description] = rule.sub('description', '').strip\n end\n end\n end", "def permission(access_rules)\n access_rules.each_pair do |verb, role|\n @resource_config[:roles].validate_role(role)\n @resource_config[:permission][verb] = role\n end\n end", "def create_rules(deploy_id, template, only_attached)\n template_xml = Nokogiri::XML(template)\n\n # OpenNebula host\n host_name = template_xml\n .xpath('//HISTORY_RECORDS/HISTORY[last()]/HOSTNAME')\n .text\n one_host = VCenterDriver::VIHelper\n .find_by_name(OpenNebula::HostPool, host_name)\n rc = one_host.info\n if OpenNebula.is_error?(rc)\n err_msg = rc.message\n raise err_msg\n end\n host_id = one_host['ID']\n\n # OpenNebula VM\n one_vm = VCenterDriver::VIHelper\n .one_item(OpenNebula::VirtualMachine, deploy_id)\n\n vm_data = {\n :id => template_xml.xpath('/VM/ID').text,\n :deploy_id => deploy_id\n }\n\n # vCenter VirtualMachine\n vi_client = VCenterDriver::VIClient.new_from_host(host_id)\n vm = VCenterDriver::VirtualMachine\n .new_one(vi_client, deploy_id, one_vm)\n\n # Search NSX Nics\n # First try to search only new attached NSX Nics\n nsx_nics = NSXDriver::LogicalSwitch.nsx_nics(template_xml,\n only_attached)\n # If there is no NSX Nics\n return if nsx_nics.empty?\n\n # Create rules for each NSX Nic\n nsx_nics.each do |nic|\n # Extract NIC data\n nic_data = extract_nic_data(nic, @nsx_client, vm)\n # Get all Security Groups belonging to each NIC.\n sec_groups = nic.xpath('SECURITY_GROUPS').text.split(',')\n sec_groups.each do |sec_group|\n sg_rules_array = []\n # Get all rules belonging to this Security Group.\n xp = \"//SECURITY_GROUP_RULE[SECURITY_GROUP_ID=#{sec_group}]\"\n sg_rules = template_xml.xpath(xp)\n sg_rules.each do |sg_rule|\n # Create rules spec\n rule_data = extract_rule_data(sg_rule)\n rule_spec = rule_spec(rule_data,\n vm_data,\n nic_data,\n @nsx_client)\n sg_rules_array.push(rule_spec)\n end\n # Create NSX rules\n sg_rules_array.each do |sg_spec|\n create_rule(sg_spec)\n end\n end\n end\n end", "def add_rule request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/#{request_pb.security_policy}/addRule\"\n body = request_pb.security_policy_rule_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def add_rules(rules)\n rules.each {|a_rule| @l.addToken(a_rule.tokID,a_rule.re)}\n end", "def remove_security_group_properties\n properties = []\n properties << 'SecurityGroupEgress.SourceSecurityGroupOwnerId'\n properties << 'SecurityGroupIngress.SourceSecurityGroupOwnerId'\n add_patch Patches::RemoveProperty.new 'AWS::EC2::SecurityGroup', properties\n end", "def create_security_group_iso(iso)\n @logger.info(\"Creating SecurityGroup #{iso.name}\")\n sg = SugarCRM::SecurityGroup.new(:name => iso.name) unless find_sugarcrm_object('security_group','name', iso.name)\n sg.save! if sg\n end", "def set *rules\n\n raise ArgumentError, 'expected one or more rules' if rules.empty?\n\n if rules == [[]]\n self.clear\n else\n rules = rule_hashes(rules)\n client.put_bucket_cors(:bucket_name => bucket.name, :rules => rules)\n end\n\n nil\n\n end", "def describe_security_groups( options = {} )\n options = { :group_name => [] }.merge(options)\n params = pathlist(\"GroupName\", options[:group_name] )\n return response_generator(:action => \"DescribeSecurityGroups\", :params => params)\n end", "def create_group_acls(acls)\n acls_ids = Array.new\n rc = true\n\n acls.each{|rule|\n acl = OpenNebula::Acl.new(OpenNebula::Acl.build_xml,@client)\n rule_ast = rule + \" *\"\n parsed_acl = *OpenNebula::Acl.parse_rule(rule_ast)\n return parsed_acl[0], \"\" if OpenNebula.is_error?(parsed_acl[0])\n rc = acl.allocate(*OpenNebula::Acl.parse_rule(rule_ast))\n return rc, \"\" if OpenNebula.is_error?(rc)\n\n acls_ids << acl.id\n }\n\n return rc, acls_ids\n end", "def create_policy_role_EC2\n\n AWS.config(\n :access_key_id => ENV[\"S3_ACCESS_KEY\"], \n :secret_access_key => ENV[\"S3_SECRET_KEY\"])\n\n # naming policy \n role_name = 'ec2-start-stop'\n policy_name = 'ec2-start-stop'\n profile_name = 'ec2-start-stop' \n instance_profile_name = 'inst-ec2-start-stop' \n\n # building a custom policy \n policy = AWS::IAM::Policy.new\n policy.allow(\n :actions => [\"ec2:StartInstances\",\"ec2:StopInstances\"],\n :resources => '*')\n\n # EC2 can generate session credentials\n assume_role_policy_document = '{\"Version\":\"2008-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"ec2.amazonaws.com\"]},\"Action\":[\"sts:AssumeRole\"]}]}'\n \n # creating a role\n $iam.client.create_role(\n :role_name => role_name,\n :assume_role_policy_document => assume_role_policy_document)\n\n # adding policy to role\n $iam.client.put_role_policy(\n :role_name => role_name,\n :policy_name => policy_name,\n :policy_document => policy.to_json)\n\n # creating a profile for the role\n response = $iam.client.create_instance_profile(\n :instance_profile_name => instance_profile_name)\n \n # ARN\n profile_arn = response[:instance_profile][:arn]\n \n $iam.client.add_role_to_instance_profile(\n :instance_profile_name => instance_profile_name,\n :role_name => role_name)\n\n # you can use the profile name or ARN as the :iam_instance_profile option\n $ec2 = AWS::EC2.new\n $ec2.instances.create(:image_id => \"ami-inst-id-1\", :iam_instance_profile => profile_name)\n\n redirect_to iams_path, notice: 'Added Policy and Role for EC2'\n \n end", "def aws_security_group_enable_outbound_port_80(opts)\n opts[:security_group].authorize_egress('0.0.0.0/0', protocol: :tcp, ports: 80)\n end", "def aws_security_group_enable_inbound(opts)\n opts[:security_group].authorize_ingress(:tcp, 20..8080)\n end", "def create_group_acls(acls)\n acls_ids = Array.new\n\n acls.each{|rule|\n\n acl = OpenNebula::Acl.new(OpenNebula::Acl.build_xml,@client)\n\n rule_ast = \"#{rule} *\" #Add all zone id's\n\n parsed_acl = OpenNebula::Acl.parse_rule(rule_ast)\n\n return parsed_acl, [] if OpenNebula.is_error?(parsed_acl)\n\n rc = acl.allocate(*parsed_acl)\n\n return rc, \"\" if OpenNebula.is_error?(rc)\n\n acls_ids << acl.id\n }\n\n return true, acls_ids\n end", "def parse(id)\n regex = /.+\\/resourceGroups\\/([^\\/]+)\\/providers\\/Microsoft.Network\\/networkSecurityGroups\\/([^\\/]+)\\/securityRules\\/([^\\/]+).*/\n captures = regex.match(id).captures\n {group: captures[0], nsg: captures[1], name: captures[2]}\nend", "def run_rules(url, rules)\n str = url.to_s\n return str if rules.nil?\n rules.each do |rule|\n case rule\n when 'noproto'\n str = str.gsub(%r{^https?://}, '')\n when 'nossl', 'http'\n str = str.gsub(%r{^https://}, 'http://')\n when 'ssl', 'https'\n str = str.gsub(%r{^http://}, 'https://')\n when 'base32'\n str = Base32.encode(str).to_s\n when 'base64'\n str = Base64.encode64(str).delete(\"\\n\")\n when 'md4'\n str = OpenSSL::Digest::MD4.hexdigest(str)\n when 'md5'\n md5 = Digest::MD5.new\n md5.update str\n str = md5.hexdigest\n when 'sha1'\n str = Digest::SHA1.hexdigest(str)\n when 'reverse'\n str = str.reverse\n when 'upcase'\n str = str.upcase\n when 'downcase'\n str = str.downcase\n when 'rot13'\n str = str.tr('A-Za-z', 'N-ZA-Mn-za-m')\n when 'urlencode'\n str = CGI.escape(str).gsub(/\\+/, '%20')\n when 'urldecode'\n str = CGI.unescape(str)\n when 'append-hash'\n str = \"#{str}##{rand(36**6).to_s(36)}\"\n when 'append-method-get'\n separator = str.include?('?') ? '&' : '?'\n str = \"#{str}#{separator}method=get&_method=get\"\n else\n logger.warn(\"Unknown rule: #{rule}\")\n end\n end\n str\n end", "def initialize(name, provider = :aws, rules = [])\n @name = name.to_sym\n @provider = Bogo::Utility.snake(provider).to_sym\n @rules = rules.dup.uniq.freeze\n validate_rules!\n end", "def create\n @security_group = SecurityGroup.new(security_group_params)\n\n respond_to do |format|\n if @security_group.save\n format.html { redirect_to @security_group, notice: 'Security group was successfully created.' }\n format.json { render :show, status: :created, location: @security_group }\n else\n format.html { render :new }\n format.json { render json: @security_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_security_group_queue(userid, security_group)\n task_opts = {\n :action => \"adding Security Group to Instance for user #{userid}\",\n :userid => userid\n }\n\n queue_opts = {\n :class_name => self.class.name,\n :method_name => 'add_security_group',\n :instance_id => id,\n :role => 'ems_operations',\n :queue_name => queue_name_for_ems_operations,\n :zone => my_zone,\n :args => [security_group]\n }\n\n MiqTask.generic_action_with_callback(task_opts, queue_opts)\n end", "def create_security_group_for_inception_vm\n \n return if settings[\"inception\"][\"security_group\"] \n\n ports = {\n ssh_access: 22,\n ping: { protocol: \"icmp\", ports: (-1..-1) } \n }\n security_group_name = \"#{settings.bosh_name}-inception-vm\"\n\n provider.create_security_group(security_group_name, \"inception-vm\", ports)\n\n settings[\"inception\"] ||= {}\n settings[\"inception\"][\"security_group\"] = security_group_name\n save_settings!\n end" ]
[ "0.7184339", "0.61924857", "0.58716196", "0.5747694", "0.55351424", "0.5526258", "0.5476864", "0.5455429", "0.5451784", "0.5440346", "0.5416581", "0.5384735", "0.52951914", "0.51761967", "0.5116565", "0.51091504", "0.5106706", "0.5069618", "0.50331575", "0.5004386", "0.49917656", "0.49667794", "0.4943437", "0.49136505", "0.48880762", "0.48845258", "0.48845258", "0.48742673", "0.48695716", "0.48581246", "0.48313102", "0.47826037", "0.47755766", "0.47724283", "0.47492868", "0.47492868", "0.47347957", "0.4722805", "0.4702671", "0.47019413", "0.46608144", "0.46536815", "0.46514255", "0.46387324", "0.4625682", "0.46220574", "0.46136373", "0.4597897", "0.45874003", "0.45764446", "0.45757473", "0.45675743", "0.45649308", "0.45553786", "0.45541802", "0.45397812", "0.45345476", "0.45217976", "0.4521738", "0.4517367", "0.45110923", "0.45105782", "0.4494512", "0.4473405", "0.44670716", "0.44614404", "0.4457831", "0.44478893", "0.44431975", "0.4442842", "0.4439621", "0.44278705", "0.44019043", "0.44019043", "0.4395197", "0.4392527", "0.43740138", "0.43725643", "0.43672106", "0.43666834", "0.4358503", "0.4349139", "0.43389687", "0.43106896", "0.4292375", "0.4281586", "0.42698327", "0.42628962", "0.42403463", "0.4239203", "0.4238264", "0.42346516", "0.42309412", "0.42232", "0.4218149", "0.42179298", "0.4212913", "0.420304", "0.41969106", "0.41831318" ]
0.6506932
1
Convert our config languages description of firewall rules into Amazon's. This rule structure is as defined in MU::Config.
def convertToEc2(rules) ec2_rules = [] if rules != nil rules.each { |rule| ec2_rule = Hash.new rule['proto'] = "tcp" if rule['proto'].nil? or rule['proto'].empty? ec2_rule[:ip_protocol] = rule['proto'] p_start = nil p_end = nil if rule['port_range'] p_start, p_end = rule['port_range'].split(/\s*-\s*/) elsif rule['port'] p_start = rule['port'] p_end = rule['port'] elsif rule['proto'] != "icmp" raise MuError, "Can't create a TCP or UDP security group rule without specifying ports: #{rule}" end if rule['proto'] != "icmp" if p_start.nil? or p_end.nil? raise MuError, "Got nil ports out of rule #{rule}" end ec2_rule[:from_port] = p_start.to_i ec2_rule[:to_port] = p_end.to_i else ec2_rule[:from_port] = -1 ec2_rule[:to_port] = -1 end if (!defined? rule['hosts'] or !rule['hosts'].is_a?(Array)) and (!defined? rule['sgs'] or !rule['sgs'].is_a?(Array)) and (!defined? rule['lbs'] or !rule['lbs'].is_a?(Array)) raise MuError, "One of 'hosts', 'sgs', or 'lbs' in rules provided to createEc2SG must be an array." end ec2_rule[:ip_ranges] = [] ec2_rule[:user_id_group_pairs] = [] if !rule['hosts'].nil? rule['hosts'].each { |cidr| next if cidr.nil? # XXX where is that coming from? cidr = cidr + "/32" if cidr.match(/^\d+\.\d+\.\d+\.\d+$/) ec2_rule[:ip_ranges] << {cidr_ip: cidr} } end if !rule['lbs'].nil? # XXX This is a dopey place for this, dependencies() should be doing our legwork rule['lbs'].each { |lb_name| if @dependencies.has_key?("loadbalancer") and @dependencies["loadbalancer"].has_key?(lb_name) # MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "DependsOn", @dependencies["loadbalancer"][lb_name].cloudobj.cfm_name) end } end if !rule['sgs'].nil? rule['sgs'].each { |sg_name| # XXX This is a dopey place for this, dependencies() should be doing our legwork if @dependencies.has_key?("firewall_rule") and @dependencies["firewall_rule"].has_key?(sg_name) # MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "DependsOn", @dependencies["firewall_rule"][sg_name].cloudobj.cfm_name) end } end if !ec2_rule[:user_id_group_pairs].nil? and ec2_rule[:user_id_group_pairs].size > 0 and !ec2_rule[:ip_ranges].nil? and ec2_rule[:ip_ranges].size > 0 MU.log "Cannot specify ip_ranges and user_id_group_pairs", MU::ERR raise MuError, "Cannot specify ip_ranges and user_id_group_pairs" end ec2_rule.delete(:ip_ranges) if ec2_rule[:ip_ranges].size == 0 ec2_rule.delete(:user_id_group_pairs) if ec2_rule[:user_id_group_pairs].size == 0 if !ec2_rule[:user_id_group_pairs].nil? and ec2_rule[:user_id_group_pairs].size > 0 ec2_rule.delete(:ip_ranges) elsif !ec2_rule[:ip_ranges].nil? and ec2_rule[:ip_ranges].size > 0 ec2_rule.delete(:user_id_group_pairs) end ec2_rules << ec2_rule } end return ec2_rules end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatRules config\n\tresult = \"\"\n\t\n\t# rule set filename is not indicated from the name of the rule set, so a mapping is used\n\trulesetFiles = {\"Android\" => \"android\",\"Basic\" => \"basic\",\"Braces\" => \"braces\",\"Clone Implementation\" => \"clone\",\"Code Size\" => \"codesize\",\"Comments\" => \"comments\",\"Controversial\" => \"controversial\",\"Coupling\" => \"coupling\",\"Design\" => \"design\",\"Empty Code\" => \"empty\",\"Finalizer\" => \"finalizers\",\"Import Statements\" => \"imports\",\"J2EE\" => \"j2ee\",\"JavaBeans\" => \"javabeans\",\"JUnit\" => \"junit\",\"Jakarta Commons Logging\" => \"logging-jakarta-commons\",\"Java Logging\" => \"logging-java\",\"Migration\" => \"migrating\",\"Naming\" => \"naming\",\"Optimization\" => \"optimizations\",\"Strict Exceptions\" => \"strictexception\",\"String and StringBuffer\" => \"strings\",\"Security Code Guidelines\" => \"sunsecure\",\"Type Resolution\" => \"typeresolution\",\"Unnecessary\" => \"unnecessary\",\"Unused Code\" => \"unusedcode\"}\n\t\n\tfor r in config[\"pmd\"][\"rules\"] do\n\t\tresult += \"java-\" + rulesetFiles[r] + \",\"\n\tend\n\treturn result[0..-2]\nend", "def parse_firewall_rules\n script_code = 'netsh advfirewall firewall show rule name=all verbose'\n cmd = powershell_out(script_code) # Not logged because it makes too much noise\n\n retval = parse_firewall_paragraphs(cmd)\n\n raise 'Could not parse firewall rules' if retval.empty?\n return retval\n end", "def to_rules\n Array.new.tap do |rules|\n new_rule = Rule.new(rule.chain)\n new_rule.description = \"#{rule.description} (#{self.description})\"\n new_rule.rule = rule.rule.gsub(/\\{\\{(\\w+)\\}\\}/) do\n if value = self.options[$1.to_sym]\n value\n else\n \"{{#{$1}}}\"\n end\n end\n new_rule.action = rule.action\n new_rule.conditions = rule.conditions | self.conditions\n if self.version\n new_rule.versions = [self.version]\n end\n\n if has_host_group?\n host_group = @rule.chain.table.base.host_groups[self.options[:ip]]\n host_group.hosts.each do |key, host|\n host.ips.each do |v, ip|\n hg_rule = new_rule.dup\n hg_rule.description += \" (#{host.name} via #{host_group.name})\"\n hg_rule.rule.gsub!(host_group.name.to_s, ip)\n hg_rule.versions = [v]\n rules << hg_rule\n end\n end\n else\n rules << new_rule\n end\n end\n end", "def transform_rules(rules)\n rules.map do |rule|\n case rule\n when Array\n transform_rules(rule)\n when String\n opts[:hostname_map][rule]\n end\n end\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def to_s\n rules.map {|r| r.embed }.join(' | ')\n end", "def config_fwrules(filtertype, srcaddr, dstaddr, sport, dport, protocol, action, svc_negate, interface,\n int, sub, filter, term, dscp)\n\n\n # Initialize\n newaddobj = false\n\n # Currently an \"input filter\" (v4 or v6) is being translated to a FG interface policy\n # interface policies can only specifically allow traffic (aka no action can be specified)\n if filtertype == :ipv4_input_filter || filtertype == :ipv6_input_filter\n unless action == :accept\n p \"config_fwrules: action type must be accept for interface policy\" if $opts[:verbose]\n return ''\n end\n end\n\n # if action not specified then assume it is accept. *update* This should be verified.\n action = :accept if action == ''\n\n if filtertype == :ipv4_output_filter || filtertype == :ipv6_output_filter\n unless action == :accept || action == :discard\n p \"config_fwrules: action type must be accept or discard, was #{action} for outbound policy filter: #{filter},\\\\\n term: #{term}\" if $opts[:verbose]\n\n return ''\n end\n end\n\n # Initialize local vars, strings, hashes, sets, arrays\n fwconfig = String.new\n # fwconfig += \"### From Filter: #{filter}, Term: #{term}\\n\"\n fwconfig += \" edit 0\\n\"\n fwconfig += \" set comment \\\"From Filter: #{filter}, Term: #{term}\\\" \\n\"\n srcaddr_out = String.new\n dstaddr_out = String.new\n service_out = String.new\n dscp_out = String.new\n\n # Put the srcaddr and dstaddrs in a string format acceptable for applying\n # to a FG firewall policy as srcaddr or dstaddr setting. (aka no punctuation, spaces only)\n if srcaddr.count > 0\n srcaddr.each do |x|\n srcaddr_out += x.to_s + ' '\n end\n else\n srcaddr_out = 'all'\n end\n\n if dstaddr.count > 0\n dstaddr.each do |x|\n dstaddr_out += x.to_s + ' '\n end\n else\n if $opts[:map2sub]\n ### When map2sub enabled, any rules with dstaddr any will be changed from any to the subnet\n ### that the associated interfaces IP is in\n case filtertype\n when :ipv4_output_filter\n if $h_interfaces[int.to_sym][sub.to_sym][:'address_v4_primary'] == nil\n $h_interfaces[int.to_sym][sub.to_sym][:vrrp].each_key do |x|\n unless $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'] == nil\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n end\n else\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:address_v4_primary].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n when :ipv6_output_filter\n if $h_interfaces[int.to_sym][sub.to_sym][:'address_v6_primary'] == nil\n $h_interfaces[int.to_sym][sub.to_sym][:vrrp].each_key do |x|\n unless $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'] == nil\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n end\n else\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:address_v6_primary].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n else\n dstaddr_out = 'all'\n end\n else\n dstaddr_out = 'all'\n end\n end\n\n # For input filters we are creating an inbound interface policy\n if filtertype == :ipv4_input_filter || filtertype == :ipv6_input_filter\n fwconfig += \" set interface #{interface}\\n\"\n fwconfig += \" set srcaddr #{srcaddr_out}\\n\"\n fwconfig += \" set dstaddr #{dstaddr_out}\\n\"\n elsif filtertype == :ipv4_output_filter || filtertype == :ipv6_output_filter\n fwconfig += \" set srcintf any\\n\"\n fwconfig += \" set dstintf #{interface}\\n\"\n fwconfig += \" set srcaddr #{srcaddr_out}\\n\"\n fwconfig += \" set dstaddr #{dstaddr_out}\\n\"\n fwconfig += \" set action #{action}\\n\"\n fwconfig += \" set schedule always\\n\"\n else\n p \"config_fwrules: filtertype not supported, skipping #{filtertype}\"\n end\n\n ## Create the source and/or destination services fg config\n if protocol.include?(:tcp)\n dport.each do |x|\n service_out += \"#{x}-tcp \"\n end\n sport.each do |x|\n service_out += \"#{x}-tcp_source \"\n end\n end\n if protocol.include?(:udp)\n dport.each do |x|\n service_out += \"#{x}-udp \"\n end\n sport.each do |x|\n service_out += \"#{x}-udp_source \"\n end\n end\n\n # If no protocol is specified in the term, then we will add tcp and udp.\n if !(protocol.include?(:tcp) || protocol.include?(:udp) || protocol.include?(:icmp))\n dport.each do |x|\n service_out += \"#{x}-tcp \"\n end\n sport.each do |x|\n service_out += \"#{x}-tcp_source \"\n end\n dport.each do |x|\n service_out += \"#{x}-udp \"\n end\n sport.each do |x|\n service_out += \"#{x}-udp_source \"\n end\n elsif (protocol.include?(:tcp) || protocol.include?(:udp) || protocol.include?(:icmp)) &&\\\n (dport.count == 0 && sport.count == 0)\n protocol.each do |x|\n service_out += \"#{x.to_s.upcase} \"\n end\n elsif protocol.include?(:icmp) && !(protocol.include?(:tcp) || protocol.include?(:udp))\n dport.each do |x|\n service_out += \"ICMP-#{x} \"\n end\n end\n\n service_out = 'ALL' if service_out == ''\n fwconfig += \" set service #{service_out} \\n\"\n\n if svc_negate == 'true'\n fwconfig += \" set service-negate enable \\n\"\n end\n\n # if dscp acls in configured create the dscp fg value\n if dscp.count > 0\n dscp.each do |x|\n\n if $h_dscp_map[x.to_s]\n dscpval = $h_dscp_map[x.to_s]\n dscp_out += dscpval + ' '\n else\n p \"config_fw_fules: No DSCP mapping found for dscp: #{x.to_s}\"\n next\n end\n\n fwconfig += \" set dscp-match enable \\n\"\n fwconfig += \" set dscp-value #{dscp_out} \\n\"\n fwconfig += \" set diffserv-forward enable \\n\"\n fwconfig += \" set diffserv-reverse enable \\n\"\n end\n end\n\n fwconfig += \" next\\n\"\n\n return fwconfig, dstaddr_out if newaddobj == true\n return fwconfig, nil\nend", "def formatted_description\n RuleDescription::Formatter.new(description).format\n end", "def parse_firewall_rule(rule_name)\n raise \"Firewall rule '#{rule_name}' does not exist.\" unless firewall_rule_exists?(rule_name)\n\n script_code = \"netsh advfirewall firewall show rule name=\\'#{rule_name}\\' verbose\"\n cmd = log_powershell_out('parse', script_code)\n rule = {}\n parse_key_value_lines(rule, cmd.stdout)\n return rule\n end", "def parse_rules(rules)\n rules.split(\"\\n\").each_with_object({}) do |rule, rule_hsh|\n mdata = /\\s{3}(\\w+)\\s/.match(rule)\n case mdata.nil? ? nil : mdata[1]\n when 'match'\n rule_hsh[:match] = [] unless rule_hsh.include?(:match)\n rule_hsh[:match] << rule.sub('match', '').strip\n when 'set'\n rule_hsh[:set] = [] unless rule_hsh.include?(:set)\n rule_hsh[:set] << rule.sub('set', '').strip\n when 'continue'\n rule_hsh[:continue] = nil unless rule_hsh.include?(:continue)\n rule_hsh[:continue] = rule.sub('continue', '').strip.to_i\n when 'description'\n rule_hsh[:description] = nil unless rule_hsh.include?(:description)\n rule_hsh[:description] = rule.sub('description', '').strip\n end\n end\n end", "def to_s\n rules.map {|r| r.embed }.join(' ')\n end", "def to_s\n rules.map {|r| r.embed }.join(' ')\n end", "def rules_config\n @squeezed_rules_config\n end", "def to_citrus # :nodoc:\n rules.map {|r| r.to_embedded_s }.join(' | ')\n end", "def to_citrus # :nodoc:\n rules.map {|r| r.to_embedded_s }.join(' | ')\n end", "def to_citrus # :nodoc:\n rules.map {|r| r.to_embedded_s }.join(' ')\n end", "def normalize_formatting_rules(rules); end", "def to_readable(config)\n # yes, for real, AWS returns the STRING \"-1\" if all protocols are allowed\n protocol = if config.protocol == \"-1\" then \"All\" else config.protocol end\n allowed = (config.security_groups + config.subnets).join(\", \")\n allowed = \"all addresses\" if allowed == \"0.0.0.0/0\"\n\n temp = \"Allowed: #{allowed}, Protocol: #{protocol}, \"\n if protocol.downcase == \"icmp\"\n temp << \"Type: #{config.from}, Code: #{config.to}\"\n elsif config.from != config.to\n temp << \"Ports: #{config.from}-#{config.to}\"\n elsif config.from.nil?\n temp << \"Ports: all\"\n else\n temp << \"Port: #{config.from}\"\n end\n temp\n end", "def to_s\n\t\tmap { |k,v|\n\t\t\tv.to_s + \" ::= \" + v.rules.map { |r| r.map{|e| e.inspect}.join(\" \") }.join(\" | \")\n\t\t}.join(\"\\n\")\n\tend", "def spellout_rules = rbnf(:spellout_rules)", "def construct_rules rules\n parsed_rules = {:rules => []}\n rules.each do |rule|\n parsed_rules[:rules] << rule.attributes\n end\n parsed_rules.to_json\n end", "def to_s\n label.to_s + ':' + rule.embed\n end", "def to_s\n label_name.to_s + ':' + rule.embed\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def expand_rule_definition definition\r\n\t\t@rules.reverse_each do |r|\r\n definition = definition.gsub \"[:#{r.type.to_s}]\", \"(#{r.definition})\"\r\n\t\tend\r\n\t\tdefinition\r\n\tend", "def rules\n cluster.configurationEx.rule\n end", "def rules\n cluster.configurationEx.rule\n end", "def to_s\n rule\n end", "def apply_rules( state )\n\t\trules_hash = self.rules_as_hash\n\t\treturn state.each_char.with_object( String.new(encoding: 'utf-8') ) do |char, new_state|\n\t\t\tnew_state << rules_hash[ char ]\n\t\tend\n\tend", "def distributed_engine_rules_2_json_simple(rules)\n\n end", "def correct_yaml_in_rule_scheme\n error = false\n begin\n yaml = YAML.load(self.rule_scheme.to_s)\n rescue\n error = true\n end\n error = true if !yaml.blank? && yaml.is_a?(String)\n if error\n errors.add(:rule_scheme, \"You should specify correct YAML format\")\n end\n end", "def pluralization_rules\n if defined?(@pluralization_regex) && @pluralization_regex\n return [@pluralization_regex, @pluralization_hash]\n end\n @pluralization_regex = Regexp.new(\"(\" + @plural_rules.map {|s,p| s}.join(\"|\") + \")$\", \"i\")\n @pluralization_hash = Hash[*@plural_rules.flatten]\n [@pluralization_regex, @pluralization_hash]\n end", "def to_s\n rule.inspect\n end", "def parse_rules(rules)\n rules.split(\"\\n\").map do |rule|\n rule_name,r1,r2,r3,r4 = rule.match(/^([\\w\\s]+): (\\d+)-(\\d+) or (\\d+)-(\\d+)$/i).captures\n [rule_name,[(r1.to_i..r2.to_i),(r3.to_i..r4.to_i)]]\n end.to_h\n end", "def rules\n I18n.t(\"rubrics.item.rule.#{basename.underscore}\")\n end", "def to_ruby\n \"EBNF::Rule.new(#{sym.inspect}, #{id.inspect}, #{expr.inspect}#{', kind: ' + kind.inspect unless kind == :rule})\"\n end", "def puts_rule(product, rule, prefix=\"\")\n if product == \"ec2\"\n if rule[:from_port] == rule[:to_port]\n port = rule[:from_port]\n else\n port = \"#{rule[:from_port]}-#{rule[:to_port]}\"\n end\n\n if rule[:ip]\n puts \"#{prefix}IP range #{rule[:ip]} (#{@ip_to_name[rule[:ip]] || \"unknown\"}) on #{port} over #{rule[:protocol]}\"\n else\n puts \"#{prefix}Group #{rule[:group]} on #{port} over #{rule[:protocol]}\"\n end\n elsif product == \"rds\"\n if rule[:ip]\n puts \"#{prefix}IP range #{rule[:ip]} (#{@ip_to_name[rule[:ip]] || \"unknown\"})\"\n else\n puts \"#{prefix}Group #{rule[:group]}\"\n end\n end\nend", "def adapt_rule(rule_ast)\n adapted_rule = {}\n\n # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data\n save_original_data(adapted_rule, rule_ast)\n clear_child_elements(adapted_rule, [[:rule, :tags],\n [:rule, :children]])\n\n adapted_rule['type'] = 'Rule'\n adapted_rule['keyword'] = rule_ast.rule.keyword\n adapted_rule['name'] = rule_ast.rule.name\n adapted_rule['description'] = rule_ast.rule.description\n adapted_rule['line'] = rule_ast.rule.location.line\n adapted_rule['column'] = rule_ast.rule.location.column\n\n adapted_rule['elements'] = adapt_child_elements(rule_ast.rule)\n adapted_rule['tags'] = adapt_tags(rule_ast.rule)\n\n adapted_rule\n end", "def parse_rules(rules)\n key = nil\n rules.each do |s|\n s.split.each do |ru|\n if key.nil? and /^:([a-z_]+)=(\\S+)*/ =~ ru\n key = $1\n var = $2\n @attr[key] = var\n key = nil\n elsif /^:([a-z_]+)+/ =~ ru\n key = $1\n if @attr[key].nil?\n @attr[key] = []\n end\n elsif not key.nil?\n @attr[key].push ru unless key.nil?\n else\n if /([a-z0-9_.:-]+)([=!><\\~][=>]*)(.*)/ =~ ru\n names = $1\n op = $2\n ver = $3\n r = Gem::Version.new ver\n name, new_name = names.split(/:/, 2)\n @requirements[name] = {\n :method => :update,\n :op => op,\n :version => r,\n :name => new_name\n }\n elsif /([a-z0-9_-]+):$/ =~ ru\n name = $1\n @requirements[name] = {\n :method => :delete,\n }\n end\n end\n end\n end\n end", "def to_s\n rule_name.to_s\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def create_security_rule(rule_hash:)\n # construct the XML elements for the request\n element_xpath = \"/config/devices/entry/vsys/entry/rulebase/security/rules/entry[@name='#{rule_hash[:name]}']\"\n\n element_value = \"<action>\" + rule_hash[:action] + \"</action>\"\n element_value += \"<from>\" + rule_hash[:from_zones].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</from>\"\n element_value += \"<to>\" + rule_hash[:to_zones].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</to>\"\n element_value += \"<source>\" + rule_hash[:sources].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</source>\" if rule_hash[:sources]\n element_value += \"<destination>\" + rule_hash[:destinations].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</destination>\" if rule_hash[:destinations]\n element_value += \"<source-user>\" + rule_hash[:source_users].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</source-user>\" if rule_hash[:source_users]\n element_value += \"<service>\" + rule_hash[:services].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</service>\" if rule_hash[:services]\n element_value += \"<category>\" + rule_hash[:categories].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</category>\" if rule_hash[:categories]\n element_value += \"<application>\" + rule_hash[:applications].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</application>\" if rule_hash[:applications]\n element_value += \"<hip-profiles>\" + rule_hash[:hip_profiles].split(',').map{ |e| \"<member>#{e}</member>\" }.join + \"</hip-profiles>\" if rule_hash[:hip_profiles]\n element_value += \"<log-start>\" + rule_hash[:log_session_start] + \"</log-start>\" if rule_hash[:log_session_start]\n element_value += \"<log-end>\" + rule_hash[:log_session_end] + \"</log-end>\" if rule_hash[:log_session_end]\n\n # configure options for the request\n options = {}\n options[:url] = self.endpoint\n options[:method] = :post\n options[:payload] = { type: \"config\",\n action: \"set\",\n key: self.auth_key,\n xpath: element_xpath,\n element: element_value }\n\n html_result = Helpers::Rest.make_request(options)\n\n raise \"Error during security rule create\" if html_result.nil?\n\n # parse the XML data\n data = Nokogiri::XML(html_result)\n\n # check that the operation was successful\n if data.xpath('//response/@status').to_s == \"success\"\n # commit the change to be operational\n # TODO: Should probably do partial commit once device IDs are built in\n options = {}\n options[:url] = self.endpoint\n options[:method] = :post\n options[:payload] = { type: \"commit\",\n key: self.auth_key,\n cmd: \"<commit></commit>\" }\n\n html_result = Helpers::Rest.make_request(options)\n\n raise \"Error during security rule commit\" if html_result.nil?\n\n # parse the XML data\n data = Nokogiri::XML(html_result)\n\n # check that the operation was successful and return the job ID\n if data.xpath('//response/@status').to_s == \"success\"\n return data.xpath('//response/result/job')[0].content.to_s\n else\n raise \"#{Crack::XML.parse(data.to_xml)}\"\n end\n else\n raise \"#{Crack::XML.parse(data.to_xml)}\"\n end\n end", "def parse_http_rule rule_yaml\n rule = Google::Api::HttpRule.new\n rule.selector = rule_yaml[HTTP_RULES_SELECTOR_KEY] if rule_yaml.key? HTTP_RULES_SELECTOR_KEY\n verb_path = HTTP_RULES_VERBS_ALLOWED.find { |verb| rule_yaml[verb] }\n rule.send \"#{verb_path}=\", rule_yaml[verb_path] if verb_path\n rule.body = rule_yaml[HTTP_RULES_BODY_KEY] if rule_yaml.key? HTTP_RULES_BODY_KEY\n\n if rule_yaml.key? HTTP_RULES_ADDITIONAL_BINDINGS_KEY\n rule.additional_bindings = rule_yaml[HTTP_RULES_ADDITIONAL_BINDINGS_KEY].map do |binding_yaml|\n parse_http_rule binding_yaml\n end\n end\n\n rule\n end", "def config_firewall\n\t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p tcp -m tcp --dport 389 -j ACCEPT`\n \t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p udp -m udp --dport 389 -j ACCEPT`\n\t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p tcp -m tcp --dport 636 -j ACCEPT`\n \t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p udp -m udp --dport 636 -j ACCEPT`\n\t\t`service iptables save`\n\t\t`service iptables restart`\n\t\t\n\tend", "def to_cfg(rule)\n rules = [rule]\n nonterminals = { rule.token => true }\n\n rules.inject(CFG.new(@nonterm)) do |cfg, rule|\n cfg[rule.token] = rule.inject(List.new) do |list, node|\n symbol = node.value\n\n if not symbol.rule.nil? and not nonterminals[symbol.token]\n rules << symbol.rule\n nonterminals[symbol.token] = true\n end\n\n list << symbol.token\n end\n cfg\n end\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def firewall_rules\n return unless exists?\n additional_resource_properties(\n {\n property_name: \"firewall_rules\",\n property_endpoint: \"#{id}/firewallRules\",\n api_version: @opts[:firewall_rules_api_version],\n },\n )\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def process_firewall(fw)\n\n # Make sure the record is of firewall sub-type family\n if fw.at(2) == :family\n # Make sure the record is and ipv4 firewall filter\n if fw.at(3) == :inet && fw.at(4) == :filter\n # Ensure that a \"term\" has been specified then create the first key \"filter\"\n if fw.at(6) == :term\n $h_filters[fw.at(5)] = {} unless $h_filters.has_key?(fw.at(5))\n\n # Add the terms to the filter hashes and create the term hash structure\n unless $h_filters[fw.at(5)].has_key?(fw.at(7))\n $h_filters[fw.at(5)][fw.at(7)] = {\\\n :source => Hash.new,\\\n :action => nil,\\\n :'forwarding-class' => nil,\\\n :'loss-priority' => nil,\\\n :policer => nil}\n\n # count the number of total terms processed\n $ipv4_term_count += 1\n end\n\n # Populate term details (sources (and source type), action, forwarding-classs, loss-priority)\n case fw.at(8)\n ### Fill in term sources (extracted from fw.at(9) when definition type is \"from\")\n when :from\n $h_filters[fw.at(5)][fw.at(7)][:source][fw.at(10)] = fw.at(9)\n $ipv4_term_source_address += 1 if fw.at(9) == :'source-address'\n $ipv4_term_source_port += 1 if fw.at(9) == :'source-port'\n $ipv4_term_destination_address += 1 if fw.at(9) == :'destination-address'\n $ipv4_term_destination_port += 1 if fw.at(9) == :'destination-port'\n $ipv4_term_dscp += 1 if fw.at(9) == :dscp\n $ipv4_term_forwarding_class +=1 if fw.at(9) == :'forwarding-class'\n\n # action/forwarding-class/loss-priority\n when :then\n case fw.at(9)\n when :accept\n $h_filters[fw.at(5)][fw.at(7)][:action] = fw.at(9)\n when :discard\n $h_filters[fw.at(5)][fw.at(7)][:action] = fw.at(9)\n when :reject\n $h_filters[fw.at(5)][fw.at(7)][:action] = fw.at(9)\n when :'forwarding-class'\n $h_filters[fw.at(5)][fw.at(7)][:'forwarding-class'] = fw.at(10)\n when :'loss-priority'\n $h_filters[fw.at(5)][fw.at(7)][:'loss-priority'] = fw.at(10)\n when :'policer'\n $h_filters[fw.at(5)][fw.at(7)][:policer] = fw.at(10)\n else\n if $opts[:verbose]\n p \"ipv4 filter: action-type not supported, skipping: #{fw.at(9)} --> #{fw.at(10)}\"\\\n unless fw.at(9) == :count\n end\n end\n # other filter object reference\n when :filter\n $h_filters[fw.at(5)][fw.at(7)][:source][fw.at(9)] = :filter\n end\n end\n\n # IPv6 FW filter processing\n elsif fw.at(3) == :inet6 && fw.at(4) == :filter\n\n # Ensure that a \"term\" has been specified then create the first key \"filter\"\n if fw.at(6) == :term\n $h_filters6[fw.at(5)] = {} unless $h_filters6.has_key?(fw.at(5))\n\n # Add the terms to the filter hashes and create the term detail hash structure\n unless $h_filters6[fw.at(5)].has_key?(fw.at(7))\n $h_filters6[fw.at(5)][fw.at(7)] = {:source => Hash.new, :action => nil, :'forwarding-class' => nil,\\\n :'loss-priority' => nil, :policer => nil}\n\n $ipv6_term_count += 1\n end\n\n # Populate term details, sources and source type as hash entries to $h_entries\n case fw.at(8)\n\n # source detail\n when :from\n $h_filters6[fw.at(5)][fw.at(7)][:source][fw.at(10)] = fw.at(9)\n $ipv6_term_source_address += 1 if fw.at(9) == :'source-address'\n $ipv6_term_source_port += 1 if fw.at(9) == :'source-port'\n $ipv6_term_destination_address += 1 if fw.at(9) == :'destination-address'\n $ipv6_term_destination_port += 1 if fw.at(9) == :'destination-port'\n $ipv6_term_dscp += 1 if fw.at(9) == :dscp\n $ipv6_term_forwarding_class += 1 if fw.at(9) == :'forwarding-class'\n\n # add action/forwarding-class/loss-priority/etc options to $h_filter entries if they exist\n when :then\n case fw.at(9)\n when :accept\n $h_filters6[fw.at(5)][fw.at(7)][:action] = fw.at(9)\n when :discard\n $h_filters6[fw.at(5)][fw.at(7)][:action] = fw.at(9)\n when :reject\n $h_filters6[fw.at(5)][fw.at(7)][:action] = fw.at(9)\n when :'forwarding-class'\n $h_filters6[fw.at(5)][fw.at(7)][:'forwarding-class'] = fw.at(10)\n when :'loss-priority'\n $h_filters6[fw.at(5)][fw.at(7)][:'loss-priority'] = fw.at(10)\n when :'policer'\n $h_filters6[fw.at(5)][fw.at(7)][:policer] = fw.at(10)\n else\n if $opts[:verbose]\n p \"ipv6 filter: action-type not supported, skipping: #{fw.at(9)} --> #{fw.at(10)}\"\\\n unless fw.at(9) == :count\n end\n end\n # other filter object reference\n when :filter\n $h_filters6[fw.at(5)][fw.at(7)][:source][fw.at(9)] = :filter\n end\n end\n\n # If this is a VPLS firewall filter, for now we are noting it in output but taking no action\n # as vpls isn't easily translatable to FortiGate\n elsif fw.at(3) == :vpls && fw.at(4) == :filter\n p 'process_firewall: no action taken on vpls filters' if $opts[:verbose]\n else\n return\n end\n\n # If this is not a firewall filter and is instead a policer definition\n elsif fw.at(2) == \"policer\"\n p 'firewall: no action taken on policiers' if $opts[:debug]\n else\n p \"firewall: unsupported firewall option, #{fw.at(2)}\" if $opts[:verbose]\n end\n\nend", "def check_rule(rule)\n\n\t if rule.include? 'twitter_lang'\n\t\t rule = handle_lang_operators rule\n\t end\n\n\t if rule.include? 'has:lang'\n\t\t rule = handle_has_lang rule\n\t end\n\n\t if rule.include? '_contains:'\n\t\t rule = handle_contains_operators rule\n\t end\n\n\n\t if rule.include? 'country_code:'\n\t\t rule = handle_country_code_operators rule\n\t end\n\n\t rule\n\n end", "def rule_stanza(desc, manipulators)\n return {\n 'description' => desc,\n 'manipulators' => manipulators\n }\nend", "def add_rules\n\n raise 'Not a single yml location is defined for rules' if yml.empty?\n\n yml.each do |location|\n\n RuleParser.yml location, self\n\n end\n\n end", "def create_firewall_rule(rule_hash, firewall_name)\n script_code = +'netsh advfirewall firewall add rule'\n rule_hash.each do |key, val|\n filter_or_append_rule_field(script_code, key, val)\n end\n @@creation_script_cache[firewall_name] = [] if @@creation_script_cache[firewall_name].nil?\n @@creation_script_cache[firewall_name].push(script_code)\n cmd = log_powershell_out('creation', script_code)\n validate_creation_output(cmd.stdout)\n end", "def data_to_ruleset \n\n\t\ttemp_array = []\n\t\trule_name = self.fctr_code.blank? ? (\"rule_\" + self.id.to_s) : self.fctr_code + \": \"\n\n\t\tif not self.where_country.blank?\n\t\t\ttemp_array << (\"c_where_country = \" + self.where_country.subfctr_name)\n\t\tend\n\n\t\tif not self.where_zone.blank?\n\t\t\ttemp_array << (\"c_where_zone = \" + self.where_zone.subfctr_name)\n\t\tend\n\n\t\tif not self.where_network.blank?\n\t\t\ttemp_array << (\"c_where_network = \" + self.where_network.subfctr_name)\n\t\tend\n\n\t\tif not self.where_custom.blank?\n\t\t\ttemp_array << (\"c_where_custom = \" + self.where_custom.subfctr_name)\n\t\tend\n\n\t\tif temp_array.size > 0\n\t\t\treturn rule_name + temp_array.join(\", \")\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend", "def to_s\n \"v=#{@version} #{@rules.join(' ')}\"\n end", "def add_to_rules(msg)\n # TODO use configatron config parameter for conf dir\n line = \"ACCEPT net:#{msg[2]} fw #{msg[1]}\"\n line << \" \" << msg[3] if msg[3]\n line << \"\\n\"\n lines = []\n\n File.open(rules_file) do |f|\n lines = f.readlines\n end\n\n i = lines.size - 1\n\n while i >= 0 && lines[i] !~ /\\s*#LAST LINE -- ADD YOUR ENTRIES/\n i -= 1\n end\n\n if i >= 0\n a = [line, lines[i]]\n lines[i,i] = a\n\n # TODO ask agent to backup original file\n\n File.open(rules_file, \"w\") do |f|\n f.write lines.join\n end\n\n message = \"#{rules_file} updated, run shorewall restart to reload the rules.\"\n else\n message = \"Can not find last mark line\"\n end\n\n send_response(message)\n end", "def triggered_rules_to_encrypted\n\n # TODO: add encryption\n\n # instantiate array\n array = []\n\n @triggered_rules.each do |rule|\n\n # create a new hash\n hash = {:name => rule.name, :facts => []}\n\n # get the facts added by the rule\n facts = rule.facts\n\n # iterate all the facts\n facts.each do |fact|\n\n hash[:facts] << {:name => fact.name, :value => fact.value}\n\n end\n\n # add the hash to the array\n array << hash\n\n end\n\n # return the encrypted array\n string = array.to_json\n\n # encrypt the data\n encrypted = string\n\n end", "def run_rules(url, rules)\n str = url.to_s\n return str if rules.nil?\n rules.each do |rule|\n case rule\n when 'noproto'\n str = str.gsub(%r{^https?://}, '')\n when 'nossl', 'http'\n str = str.gsub(%r{^https://}, 'http://')\n when 'ssl', 'https'\n str = str.gsub(%r{^http://}, 'https://')\n when 'base32'\n str = Base32.encode(str).to_s\n when 'base64'\n str = Base64.encode64(str).delete(\"\\n\")\n when 'md4'\n str = OpenSSL::Digest::MD4.hexdigest(str)\n when 'md5'\n md5 = Digest::MD5.new\n md5.update str\n str = md5.hexdigest\n when 'sha1'\n str = Digest::SHA1.hexdigest(str)\n when 'reverse'\n str = str.reverse\n when 'upcase'\n str = str.upcase\n when 'downcase'\n str = str.downcase\n when 'rot13'\n str = str.tr('A-Za-z', 'N-ZA-Mn-za-m')\n when 'urlencode'\n str = CGI.escape(str).gsub(/\\+/, '%20')\n when 'urldecode'\n str = CGI.unescape(str)\n when 'append-hash'\n str = \"#{str}##{rand(36**6).to_s(36)}\"\n when 'append-method-get'\n separator = str.include?('?') ? '&' : '?'\n str = \"#{str}#{separator}method=get&_method=get\"\n else\n logger.warn(\"Unknown rule: #{rule}\")\n end\n end\n str\n end", "def to_s\n \"#{rule} #{type_class} #{name} = #{tag} #{default ? \"[default=#{default.inspect}]\" : ''}\"\n end", "def rules\n rule_applier.rules\n end", "def parse_grammar \n\t\tnormalize\n\n\t\t@grammar_string.each do |line|\n\t\t\tlhs, placeholder, rhs = line.partition \"->\"\n\t\t\t# get rid of extra white space\n\t\t\tlhs.strip!\n\t\t\trhs.strip!\n\n\t\t\t# catch line with goal symbol\n\t\t\t@goal = lhs if rhs.include? \"$\"\n\n\t\t\trhs.split(\"|\").each do |rule|\n\t\t\t\t@production_rules[lhs] ||= []\n\t\t\t\t@production_rules[lhs] << rule.split(\" \")\n\t\t\tend\n\t\tend\n\tend", "def setRules(rules, add_to_self: false, ingress: true, egress: false)\n return if rules.nil? or rules.size == 0\n\n if add_to_self\n rules.each { |rule|\n if rule['sgs'].nil?\n new_rule = rule.clone\n new_rule.delete('hosts')\n rule['sgs'] = Array.new if rule['sgs'].nil?\n rule['sgs'] << { \"Ref\" => @cfm_name }\n end\n }\n end\n\n ec2_rules = convertToEc2(rules)\n\n # Creating an empty security group is ok, so don't freak out if we get\n # a null rule list.\n if !ec2_rules.nil?\n ec2_rules.each { |rule|\n next if rule.nil? or rule[:ip_ranges].nil? # XXX whaaat\n rule[:ip_ranges].each { |cidr|\n MU::Cloud::CloudFormation.setCloudFormationProp(\n @cfm_template[@cfm_name],\n \"SecurityGroupIngress\",\n {\n \"IpProtocol\" => rule[:ip_protocol],\n \"FromPort\" => rule[:from_port],\n \"ToPort\" => rule[:to_port],\n \"CidrIp\" => cidr[:cidr_ip]\n }\n )\n }\n }\n end\n\n end", "def parse_rules_properties(rules)\n rules.map do |rule|\n properties = rule[:body].split(';').map(&:strip)\n properties = properties.map do |property|\n a = property.split(':').map(&:strip)\n throw \"Syntax error in property '#{property}', rule: '#{rule}'\" if a.length != 2\n {\n name: a[0],\n value: a[1]\n }\n end\n {\n selector: rule[:selector],\n properties: properties\n }\n end\n end", "def load_parameter_rules(rules); end", "def create_policy(filtertype)\n\n # Initialize vars, sets, string, hashes, etc\n filter = String.new\n fwconfig = String.new\n result = String.new\n service_negate = String.new\n newaddresses = Set.new\n\n case filtertype\n when :ipv4_input_filter\n fwconfig += \"#### Firewall Interface Policy ####\\n\"\n fwconfig += \"config firewall interface-policy\\n\"\n h_filters = $h_filters\n when :ipv6_input_filter\n fwconfig += \"#### Firewall IPv6 Interface Policy ####\\n\"\n fwconfig += \"config firewall interface-policy6\\n\"\n h_filters = $h_filters6\n when :ipv4_output_filter\n fwconfig += \"#### Firewall Policy ####\\n\"\n fwconfig += \"config firewall policy\\n\"\n h_filters = $h_filters\n when :ipv6_output_filter\n fwconfig += \"#### Firewall IPv6 Policy ####\\n\"\n fwconfig += \"config firewall policy6\\n\"\n h_filters = $h_filters6\n else\n p \"create_fg_intf_policy_rules: filtertype not supported - #{filtertype}\" if $opts[:verbose]\n return\n end\n\n # For each interface/sub-interface, process each unique filter matching the passed filtertype option\n # We are iterating through each used filter and checking the terms for compatibility. If compatible\n # then we will go ahead and process/convert to FG config.\n $h_interfaces.each_key do |int|\n $h_interfaces[int].each_key do |sub|\n if ($opts[:interfacemapout] && $h_ints_map_out.has_key?(\"#{int}-#{sub}\")) || !$opts[:interfacemapout]\n filter = $h_interfaces[int][sub][filtertype]\n\n ruletype = '' # for supportability checks\n filterref = '' # for referenced filters (aka linked filters)\n\n ### if interfacemapout option specified then we will change the dst interace to zone name supplied by file\n if $opts[:interfacemapout]\n interface = $h_ints_map_out[\"#{int}-#{sub}\"]\n else\n interface = \"#{int}-#{sub}\"\n end\n\n unless filter == 'nil' || filter == nil\n if h_filters.has_key?(filter)\n h_filters[filter].each_key do |term|\n\n # check to see if this policy is derived from dscp, forwarding-class, etc. if so, we will skip\n ruletype, filterref = check_rule_support_type(filter, term, h_filters)\n\n # Call action_rule_support_type which will call the right methods to build the fg config\n # based on the juniper filter/term detail, including handling nested filters/terms\n # will return the completed FG config for that filter/term. Also, if int2sub option is enabled\n # may return a list of subnets that need to be additionally created as address objects.\n newconfig, newaddobj = action_rule_support_type(ruletype,\\\n filterref,\\\n h_filters,\\\n filtertype,\\\n filter,\\\n term,\\\n interface,\\\n int,\\\n sub)\n\n fwconfig += newconfig\n\n # Add any new address objects that need to be configured to a set (due to any dst int map)\n newaddresses << newaddobj if newaddobj\n end\n\n else\n p \"create_fg_policy_rules: filter \\\"#{filter} referenced by interface does not exist for #{int}-#{sub}\"\\\n if $opts[:debug] || $opts[:verbose]\n end\n\n end\n else\n p \"Skipping interface #{int}-#{sub} due to, is not included in --interfacemapout file\"\\\n if $opts[:debug] || $opts[:verbose]\n end\n end\n end\n fwconfig += \"end \\n\"\n\n # If new address objects need to be created due that here, and insert them in the config ahead of creating\n # rules that will need to use these objects.\n if newaddresses.count > 0\n newconfig = \"### Additional FW Addresses from derived subnets ###\"\n newconfig += \"config firewall address\\n\"\n\n newaddresses.each do |x|\n newconfig += <<-EOS\n edit #{x}\n set type subnet\n set subnet #{x}\n set comment \"Derived subnet from interface IP due to rule with dst of any\"\n next\n EOS\n end\n\n newconfig += \"end\\n\"\n\n fwconfig = newconfig + fwconfig\n end\n\n return fwconfig\n end", "def init_rule(rule)\n # categories get square brackets and ? becomes <, also split rule\n r = rule.gsub(/\\p{Lu}/,'[\\\\0]').gsub('?', '<').split('/')\n unless r[0].gsub!('#', '*').nil?\n # change # to * (in TRG) or % (in CHG) when not with _\n r[1].gsub!(/(?<!_)#(?!_)/, '%')\n end\n r[1].gsub!(/(?<!@)\\-/, '#') # - becomes # for word-insertions\n r # return ruleset as initialised array\n end", "def setup_rules\n define_match_any_of\n\n shortcode_configuration = @configuration\n klass.rule(:block_tag) { match_any_of shortcode_configuration.block_tags }\n klass.rule(:self_closing_tag) { match_any_of shortcode_configuration.self_closing_tags }\n\n klass.rule(:quotes) { str(shortcode_configuration.attribute_quote_type) }\n\n klass.rule(:space) { str(\" \").repeat(1) }\n klass.rule(:space?) { space.maybe }\n klass.rule(:newline) { (str(\"\\r\\n\") | str(\"\\n\")) >> space? }\n klass.rule(:newline?) { newline.maybe }\n klass.rule(:whitespace) { (space | newline).repeat(1) }\n\n klass.rule(:key) { match('[a-zA-Z0-9\\-_]').repeat(1) }\n\n klass.rule(:value_with_quotes) { quotes >> (quotes.absent? >> any).repeat.as(:value) >> quotes }\n klass.rule(:value_without_quotes) { quotes.absent? >> ((str(\"]\") | whitespace).absent? >> any).repeat.as(:value) }\n klass.rule(:value) { shortcode_configuration.use_attribute_quotes ? value_with_quotes : (value_without_quotes | value_with_quotes) }\n\n klass.rule(:option) { key.as(:key) >> str(\"=\") >> value }\n klass.rule(:options) { (str(\" \") >> option).repeat(1) }\n klass.rule(:options?) { options.repeat(0, 1) }\n\n klass.rule(:open) { str(\"[\") >> block_tag.as(:open) >> options?.as(:options) >> str(\"]\") >> newline? }\n klass.rule(:close) { str(\"[/\") >> block_tag.as(:close) >> str(\"]\") >> newline? }\n klass.rule(:open_close) { str(\"[\") >> self_closing_tag.as(:open_close) >> options?.as(:options) >> str(\"]\") >> newline? }\n\n klass.rule(:text) { ((close | block | open_close).absent? >> any).repeat(1).as(:text) }\n klass.rule(:block) { (open >> (block | text | open_close).repeat.as(:inner) >> close) }\n\n klass.rule(:body) { (block | text | open_close).repeat.as(:body) }\n klass.root(:body)\n end", "def action_rule_support_type(ruletype, filterref, h_filters, filtertype, filter, term, interface, int, sub)\n\n fwconfig = String.new\n\n if ruletype == :normal\n\n # Call get_rule_detail to provide most relevant config detail related to this filter/term\n # The following are returned as sets from the get_rule_detail method\n srcaddr, dstaddr, sport, dport, protocol, action, service_negate, result, dscp = get_rule_detail(h_filters, filtertype, filter, term)\n\n # Using provided rule detail config_fwrules method will return the FG configuration for \"normal\" rules\n # this includes determining interfaces vs policy based rules\n newconfig, newaddobj = config_fwrules(filtertype,\\\n srcaddr,\\\n dstaddr,\\\n sport,\\\n dport,\\\n protocol,\\\n action,\\\n service_negate,\\\n interface,\\\n int,\\\n sub,\\\n filter,\\\n term,\n dscp)\n\n fwconfig += newconfig\n\n# if newaddobj\n#\n# fwconfig = <<-EOS\n# config firewall address\n# edit #{newaddobj}\n# set type subnet\n# set subnet #{newaddobj}\n# set comment \"derived from dst interface IP due to dst any in filter-term: #{filter}-#{term}\"\n# end\n# #{fwconfig}\n# EOS\n#\n# p \"new address object\"\n# end\n\n ### If the ruletype is a filter, this is referencing a nested filter so we will supply this filter back up to\n ### check_rule_support_type method which will in turn call this method if it contains supported filters/rules\n elsif ruletype == :filter\n\n # Check to make sure that the nested filter referenced does in fact exist\n if h_filters.has_key?(filterref)\n h_filters[filterref].each_key do |termref|\n\n # Call check_rule_support_type method to determine the rule type and therefore parameters for actions to be\n # taken next. returns the rule type, and... if it is a nested rule, returns the reference to the nested\n # filter name so that that filter can be processed in place of the rule currently being processed.\n refruletype, reffilterref = check_rule_support_type(filterref, termref, h_filters)\n\n # Now that we know the rule type. Call action_rule_support_type method passing the ruletype information\n # and the appropriate actions will be taken to configure this rule type. by finally calling config_fwrules\n newconfig, newaddobj = action_rule_support_type(refruletype,\\\n reffilterref,\\\n h_filters,\\\n filtertype,\\\n filter,\\\n term,\\\n interface,\\\n int,\\\n sub)\n\n fwconfig += newconfig\n end\n\n\n # If the nested filter referenced does not exist then output error to stdout and return empty config\n else\n p \"action_rule_support_type: nested filter reference #{filterref} does not exist, referenced by filter:\\\\\n #{filter}, term: #{term} \"\n\n fwconfig += ''\n end\n\n # If not ruletype or :normal or :filter then we do not currently support it. Will print error and return\n # empty fg configuration\n else\n p \"action_rule_support_type: unsupported source type: #{continue}, skipping: filter: #{filter}, term: #{term}\"\\\n if $opts[:verbose] || $opts[:debug]\n\n fwconfig += ''\n end\n\n return fwconfig += '', newaddobj\nend", "def format_rule(rule)\n return unless rule.attributes['name']\n\n puts ''\n puts '----'\n puts ''\n puts \"== #{rule.attributes['name']} ==\"\n puts ''\n\n is_deprecated = rule.attributes['deprecated'] == 'true'\n if is_deprecated\n puts \"'''Deprecated'''\"\n puts ''\n \n ref = rule.attributes['ref'].sub(/rulesets\\/java\\//, '') \n name = ref[/[^\\/]+$/]\n ruleset = ref[/^[^\\.]+/]\n puts \"This rule has been renamed or moved. Use instead: [[PmdRules#{ruleset.capitalize}##{name.downcase}|#{name}]]\"\n \n return\n end\n \n puts \"<blockquote>#{norm_text(rule.get_text('description'))}</blockquote>\"\n puts ''\n\n isxpath = rule.attributes['class'] == 'net.sourceforge.pmd.lang.rule.XPathRule'\n if isxpath\n puts 'This rule is defined by the following XPath expression:'\n puts '<pre>'\n puts rule.elements['properties/property/value'].texts.join.strip\n puts '</pre>'\n else\n classname = rule.attributes['class']\n href = \"https://github.com/codecop/pmd-rules/tree/master/src/main/java/#{classname.gsub(/\\./,'/')}.java\"\n puts \"This rule is defined by the following Java class: [#{href} #{classname}]\"\n end\n\n rule.elements.each('example') do |example|\n puts ''\n puts '=== Example: ==='\n puts '<pre>'\n puts example.texts.join.strip\n puts '</pre>'\n end\n\n properties = rule.elements['count(properties/property)']\n properties -= 1 if isxpath\n if properties > 0\n puts ''\n puts 'This rule has the following properties:'\n puts ''\n \n puts '{| class=\"wikitable\"'\n puts '! Name'\n puts '! Default value' \n puts '! Description' \n \n rule.elements.each('properties/property') do |prop|\n next if prop.attributes['name']=='xpath'\n puts '|-' \n puts \"| #{prop.attributes['name']}\"\n puts \"| '#{prop.attributes['value']}'\"\n puts \"| #{prop.attributes['description']}\"\n end\n puts '|}' \n end\nend", "def to_bnf\n return [self] unless rule?\n new_rules = []\n\n # Look for rules containing recursive definition and rewrite to multiple rules. If `expr` contains elements which are in array form, where the first element of that array is a symbol, create a new rule for it.\n if expr.any? {|e| e.is_a?(Array) && (BNF_OPS + TERM_OPS).include?(e.first)}\n # * Transform (a [n] rule (op1 (op2))) into two rules:\n # (a.1 [n.1] rule (op1 a.2))\n # (a.2 [n.2] rule (op2))\n # duplicate ourselves for rewriting\n this = dup\n new_rules << this\n\n expr.each_with_index do |e, index|\n next unless e.is_a?(Array) && e.first.is_a?(Symbol)\n new_rule = build(e)\n this.expr[index] = new_rule.sym\n new_rules << new_rule\n end\n\n # Return new rules after recursively applying #to_bnf\n new_rules = new_rules.map {|r| r.to_bnf}.flatten\n elsif expr.first == :opt\n this = dup\n # * Transform (rule a (opt b)) into (rule a (alt _empty b))\n this.expr = [:alt, :_empty, expr.last]\n this.cleanup = :opt\n new_rules = this.to_bnf\n elsif expr.first == :star\n # * Transform (rule a (star b)) into (rule a (alt _empty (seq b a)))\n this = dup\n this.cleanup = :star\n new_rule = this.build([:seq, expr.last, this.sym], cleanup: :merge)\n this.expr = [:alt, :_empty, new_rule.sym]\n new_rules = [this] + new_rule.to_bnf\n elsif expr.first == :plus\n # * Transform (rule a (plus b)) into (rule a (seq b (star b)\n this = dup\n this.cleanup = :plus\n this.expr = [:seq, expr.last, [:star, expr.last]]\n new_rules = this.to_bnf\n elsif [:alt, :seq].include?(expr.first)\n # Otherwise, no further transformation necessary\n new_rules << self\n elsif [:diff, :hex, :range].include?(expr.first)\n # This rules are fine, they just need to be terminals\n raise \"Encountered #{expr.first.inspect}, which is a #{self.kind}, not :terminal\" unless self.terminal?\n new_rules << self\n else\n # Some case we didn't think of\n raise \"Error trying to transform #{expr.inspect} to BNF\"\n end\n \n return new_rules\n end", "def to_s\n 'rule: ' + @symbol.to_s\n end", "def dumpRule(als)\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"RULE: #{als}\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n rule = @rules[als]\r\n if (nil != rule)\r\n puts \"#{rule.name}\\t(#{rule.alias})\"\r\n puts \"#{rule.xml}\"\r\n\r\n else\r\n puts \"Cannot find matching rule.\"\r\n end\r\n\r\n puts \"\"\r\n end", "def parse_config(config); end", "def triggered_rules_from_encrypted(encrypted)\n\n # TODO: add decryption\n\n # create a new rules array\n rules = Array.new\n\n # decrypt the data\n string = encrypted\n\n # get the array back\n array = JSON.parse string\n\n # iterate the array\n array.each do |hash|\n\n # get the rule back\n rule = retrieve_rule hash['name']\n\n # create a new facts array\n facts = []\n\n # retrieve each of the facts\n hash['facts'].each do |fact|\n\n # create a new fact for each\n facts << create_fact(fact['name'], fact['value'])\n\n end\n\n # replace the facts on the rule\n rule.facts = facts\n\n # add to the array\n rules << rule\n\n end\n\n # return the rules array\n rules\n\n end", "def initialize(rule)\n @rule = rule\n @protocol = @rule[:protocol].downcase.to_sym\n @protocol = :esp if @protocol == :ipsec\n\n @rule_type = @rule[:rule_type].downcase.to_sym\n @icmp_type = @rule[:icmp_type]\n @icmpv6_type = @rule[:icmpv6_type]\n\n @range = @rule[:range]\n @ip = @rule[:ip]\n @ip6 = @rule[:ip6]\n @ip6_global = @rule[:ip6_global]\n @ip6_ula = @rule[:ip6_ula]\n @size = @rule[:size]\n @type = set_type\n end", "def to_ttl\n @ebnf.debug(\"to_ttl\") {inspect} if @ebnf\n statements = [%{:#{sym} rdfs:label \"#{sym}\";}]\n if orig\n comment = orig.to_s.strip.\n gsub(/\"\"\"/, '\\\"\\\"\\\"').\n gsub(\"\\\\\", \"\\\\\\\\\").\n sub(/^\\\"/, '\\\"').\n sub(/\\\"$/m, '\\\"')\n statements << %{ rdfs:comment #{comment.inspect};}\n end\n statements << %{ dc:identifier \"#{id}\";} if id\n \n statements += ttl_expr(expr, terminal? ? \"re\" : \"g\", 1, false)\n \"\\n\" + statements.join(\"\\n\")\n end", "def to_citrus # :nodoc:\n '~' + rule.to_embedded_s\n end", "def to_json\n json = { :name => @name.to_sym, :rules => {} }\n @rules.inject(json[:rules]) do |result, (k, v)|\n result.update(k => v.to_json)\n end\n json\n end", "def _consume_rule seq\n # rule = rulename defined-as elements c-nl\n\n rulename = seq.shift\n raise \"BUG: bad rulename #{rulename.inspect}\" if rulename.nil? || rulename.type != :name\n\n raise \"truncated rule for #{rulename.value}\" if seq.empty?\n\n defined_as = nil\n case (op = seq.shift).type\n when :EQ, :EQ_ALT\n defined_as = op\n else\n raise \"unexpected #{op.type.inspect}, expected :EQ or :EQ_ALT\"\n end\n\n definition = _alternation(seq)\n raise \"unexpected #{seq.first.type.inspect} after rule\" unless seq.empty? || seq.first.type == :endline\n [rulename, defined_as, definition]\n end", "def get_all_config_rules\n config_rules = []\n\n # Fetch all rules with pagination\n response = @client.describe_config_rules\n config_rules += response.config_rules\n while response.next_token\n response = @client.describe_config_rules(next_token: response.next_token)\n config_rules += response.config_rules\n end\n config_rules = config_rules.map(&:to_h)\n\n # Add necessary data to rules using helpers\n add_compliance_to_config_rules(config_rules)\n add_results_to_config_rules(config_rules)\n end", "def add_rules(rules)\n options = {request: []}\n rules.each do |rule|\n options[:request] << rule.attributes\n end\n response = nil\n if @parent.class == Profitbricks::LoadBalancer\n response = Profitbricks.request :add_firewall_rules_to_load_balancer, options.merge(load_balancer_id: @parent.id)\n self.reload\n else\n response = Profitbricks.request :add_firewall_rules_to_nic, options.merge(nic_id: self.nic_id)\n self.reload\n end\n \n end", "def rules_by_name; end", "def rule_name_to_etl_job(rule)\n rule.gsub(/^convergdb\\-(\\d|[abcdef]){16}\\-/, '').gsub(/\\-trigger$/, '')\n end", "def reformat_languages(languages)\n new_hash = {}\n java_style_array = Array.new\n\n languages.each do |style, language_data| # :oo , :ruby\n language_data.each do |language_name, language_name_value| # :ruby , {type =>}\n if language_name == :javascript\n java_style_array << style\n end\n language_name_value.each do |attribute, value|\n if language_name == :javascript\n new_hash[language_name] = {type: value, style: java_style_array}\n else\n new_hash[language_name] = {type: value, style: [style]}\n end\n\n end\n end\n end\n puts new_hash\n return new_hash\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 inbound_rules\n @inbound_rules ||= normalized_security_rules.one_direction_rules(\"inbound\")\n end", "def to_citrus # :nodoc:\n rule_name.to_s\n end", "def translate_role_to_ar(val)\n role_name = val.match(/(\\()(\\w+)(\\))/)&.to_a&.at(2)\n return val unless role_name\n\n role_ar_map = Traject::TranslationMap.new('role_ar_from_en')\n translated_role = role_ar_map[role_name]\n return val unless translated_role\n\n val.gsub(role_name, translated_role)\n end", "def link_category\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n array = nil\n kind = nil\n mixin = nil\n # - - - - @init action - - - -\n array = Array.new\n\n begin\n # at line 84:36: SEMICOLON ( WS )? CATEGORY EQUALS QUOTE kind= uri ( WS mixin= uri )* QUOTE\n match( SEMICOLON, TOKENS_FOLLOWING_SEMICOLON_IN_link_category_702 )\n # at line 84:46: ( WS )?\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0 == WS )\n alt_23 = 1\n end\n case alt_23\n when 1\n # at line 84:46: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_link_category_704 )\n\n end\n match( CATEGORY, TOKENS_FOLLOWING_CATEGORY_IN_link_category_707 )\n match( EQUALS, TOKENS_FOLLOWING_EQUALS_IN_link_category_709 )\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_link_category_711 )\n @state.following.push( TOKENS_FOLLOWING_uri_IN_link_category_715 )\n kind = uri\n @state.following.pop\n # --> action\n array << ( kind && @input.to_s( kind.start, kind.stop ) ) \n # <-- action\n # at line 84:105: ( WS mixin= uri )*\n while true # decision 24\n alt_24 = 2\n look_24_0 = @input.peek( 1 )\n\n if ( look_24_0 == WS )\n alt_24 = 1\n\n end\n case alt_24\n when 1\n # at line 84:106: WS mixin= uri\n match( WS, TOKENS_FOLLOWING_WS_IN_link_category_720 )\n @state.following.push( TOKENS_FOLLOWING_uri_IN_link_category_724 )\n mixin = uri\n @state.following.pop\n # --> action\n array << ( mixin && @input.to_s( mixin.start, mixin.stop ) ) \n # <-- action\n\n else\n break # out of loop for decision 24\n end\n end # loop for decision 24\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_link_category_730 )\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__, 16 )\n\n end\n \n return array\n end", "def addRule(hosts,\n proto: \"tcp\",\n port: nil,\n egress: false,\n port_range: \"0-65535\"\n )\n rule = Hash.new\n rule[\"proto\"] = proto\n if hosts.is_a?(String)\n rule[\"hosts\"] = [hosts]\n else\n rule[\"hosts\"] = hosts\n end\n if port != nil\n port = port.to_s if !port.is_a?(String)\n rule[\"port\"] = port\n else\n rule[\"port_range\"] = port_range\n end\n ec2_rule = convertToEc2([rule])\n\n begin\n if egress\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_egress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n else\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_ingress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n end\n rescue Aws::EC2::Errors::InvalidPermissionDuplicate => e\n MU.log \"Attempt to add duplicate rule to #{@cloud_id}\", MU::DEBUG, details: ec2_rule\n end\n end", "def add_rules(rules)\n rules.each {|a_rule| @l.addToken(a_rule.tokID,a_rule.re)}\n end", "def normalize_formatting_rules(rules)\n if rules.size == 0\n rules = {}\n elsif rules.size == 1\n rules = rules.pop\n rules = { rules => true } if rules.is_a?(Symbol)\n end\n if not rules.include?(:decimal_mark) and rules.include?(:separator)\n rules[:decimal_mark] = rules[:separator]\n end\n if not rules.include?(:thousands_separator) and rules.include?(:delimiter)\n rules[:thousands_separator] = rules[:delimiter]\n end\n rules\n end", "def to_list\n rules.map do |rule|\n object = { actions: rule.actions, subject: rule.subjects.map{ |s| s.is_a?(Symbol) ? s : s.name } }\n object[:conditions] = rule.conditions unless rule.conditions.blank?\n object[:inverted] = true unless rule.base_behavior\n object\n end\n end", "def getJSON\n rulesPayload = Hash.new\n rulesPayload[:rules] = @rules\n rulesPayload.to_json\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end" ]
[ "0.61242247", "0.57955056", "0.579042", "0.57717", "0.55693173", "0.5555996", "0.55405885", "0.5540385", "0.55349433", "0.5494803", "0.54843014", "0.54843014", "0.5432833", "0.539634", "0.5370612", "0.53447706", "0.53441375", "0.5321945", "0.5312328", "0.5306548", "0.52898777", "0.51738423", "0.5172343", "0.5164795", "0.5142999", "0.51423436", "0.51423436", "0.5064843", "0.5049888", "0.5028022", "0.49882185", "0.4974194", "0.49621376", "0.4952849", "0.49401504", "0.49382004", "0.49341205", "0.49197155", "0.4911486", "0.49056107", "0.49051479", "0.49019283", "0.48928592", "0.48653123", "0.4857261", "0.48455262", "0.48423547", "0.4839636", "0.48248163", "0.48237246", "0.48207188", "0.48129365", "0.48003387", "0.47862607", "0.47684768", "0.47350684", "0.47347265", "0.47338453", "0.47277552", "0.47133785", "0.47095844", "0.47076705", "0.4702101", "0.46942797", "0.4686147", "0.46856287", "0.46833462", "0.46808994", "0.46719006", "0.46679783", "0.46631628", "0.46557966", "0.46139628", "0.46051285", "0.46011457", "0.46011242", "0.45744672", "0.4568839", "0.4554018", "0.4550004", "0.45457342", "0.45407826", "0.4534552", "0.45293885", "0.45282844", "0.4523868", "0.45216864", "0.45167875", "0.45128408", "0.4506229", "0.45056048", "0.45019096", "0.4501643", "0.44973248", "0.44769558", "0.44769558", "0.44769558", "0.44769558", "0.44769558", "0.44769558" ]
0.5943718
1
=begin :type prefix: String :type suffix: String :rtype: Integer =end
def f(prefix, suffix) @hash[prefix].nil? || @hash[prefix][suffix].nil? ? -1 : @hash[prefix][suffix] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_part_with_prefix(prefix, suffix)\n num = @parts.select { |n, _| n.start_with?(prefix) && n.end_with?(suffix) }\n .map { |n, _| n[prefix.length..-1][0..-(suffix.size + 1)].to_i }\n .max\n num = (num || 0) + 1\n \"#{prefix}#{num}#{suffix}\"\n end", "def f(prefix, suffix)\r\n \r\n end", "def prefix_count\n count = prefix_arg || 1\n update_prefix_arg(self)\n count\n end", "def suffix; end", "def suffix; end", "def suffix; end", "def suffix; end", "def suffix; end", "def prefix_limit\n limit = ideal_prefix_limit\n \n # extend the limit if the text after the substring is too short\n unless @options[:prefix] || full_text_after_substring_uses_ideal_suffix_limit?\n limit += ideal_suffix_limit - full_text_after_substring.unpack( \"U*\" ).size\n end\n \n limit\n end", "def prefix_count(default = 1)\n if skip_prefix_count_once\n self.skip_prefix_count_once = false\n update_prefix_arg\n return default\n end\n\n count = prefix_arg || default\n update_prefix_arg\n count\n end", "def substrings (n, m, prefix, max)\n if n . length == 0 then\n return prefix > -1 &&\n prefix < max &&\n prefix % m == 0 ? 1 : 0\n end\n\n fc = n[0] . to_i\n tail = n[1 .. -1]\n if prefix == -1 then\n n_prefix = fc\n else\n n_prefix = 10 * prefix + fc\n end\n\n return substrings(tail, m, n_prefix, max) +\n substrings(tail, m, prefix, max)\nend", "def prefixes; end", "def prefixes; end", "def find_prefix(prefix)\n node = find_word prefix.downcase\n if node.nil?\n [false, false, 0]\n else\n count = node.word_count\n count -= 1 if node.is_word\n [true, node.is_word, count]\n end\n end", "def common_prefix_length str1, str2\n l = 0\n s1 = str1.size\n s2 = str2.size\n for i in (0...min(min(s1,s2),4)) do\n if str1[i].eql?(str2[i])\n l += 1\n else\n break\n end\n end\n l\n end", "def suffix\n @suffix || parse_and_return(:@suffix)\n end", "def prefix\n (\"aa\"..\"zz\").to_a.sample(2).to_s\n end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def suffix_limit\n limit = ideal_suffix_limit\n \n # extend the limit if the text before the substring is too short\n unless @options[:suffix] || full_text_before_substring_uses_ideal_prefix_limit?\n limit += ideal_prefix_limit - full_text_before_substring.unpack( \"U*\" ).size\n end\n \n limit\n end", "def next_suffix\n if max_suffix_value.respond_to?(:next)\n max_suffix_value.next\n else\n # If it's not a number then something is wrong\n 1\n end\n end", "def suffix(num)\n namespace + '_suffix_' + num.to_s\n end", "def find_common_prefix_length(a, b)\n length = 0\n while (a[length] == b[length])\n length += 1\n end\n\n length\n end", "def get_prefixed_words(prefix)\n # FILL ME IN\n unless valid_word?(prefix)\n return \"Invalid input (string should only consist of letters).\"\n end\n output = findWords(prefix)\n if output.length() == 0\n return \"No prefixed words found!\"\n end\n output\n end", "def prefix_suffix\n ext = extname\n [basename(ext), ext]\n end", "def prefix\n number[3..5]\n end", "def get_next_guids(prefix, last_guid)\n length = last_guid.length - prefix.length\n last_guid = last_guid[prefix.length..-1].to_i\n\n res1 = (last_guid + 1).to_s.rjust(length, '0').prepend(prefix);\n res2 = (last_guid + 2).to_s.rjust(length, '0').prepend(prefix);\n\n return res1, res2\nend", "def suffix\n fetch_sample(SUFFIXES)\n end", "def prefix=(_arg0); end", "def prefixes(max_length:)\n names = %w()\n (names.select { |name| name.length <= max_length }.map { |name| str(name) }.reduce(:|) || str('1')).as(:prefix)\n end", "def shared_prefix(a, b)\n shared_prefix_length = [a.length, b.length].min\n while shared_prefix_length >= 0\n a_prefix = a[0..shared_prefix_length]\n b_prefix = b[0..shared_prefix_length]\n return a_prefix if a_prefix == b_prefix\n\n shared_prefix_length -= 1\n end\n\n return nil\n end", "def suffix(s, index=s.size-1)\ns[index, s.size-index]\nend", "def count_code(str)\n count_coe = 0\n (str.size - 3).times do |i|\n slice = str[i..(i+1)] + str[(i+3)]\n if slice == \"coe\"\n count_coe += 1\n end\n end\n return count_coe\nend", "def count_substrings(str)\n \nend", "def longest_prefix(strings)\n min = strings.min \n max = strings.max\n string_pre = min.size.times do |i| \n break i if min[i] != max[i]\n end\n min[0...string_pre]\nend", "def prefix(num)\n namespace + '_prefix_' + num.to_s\n end", "def prefix\n raise NotImplementedError\n end", "def build_prefix\n @prefix = @str[@i_last_real_word...@i]\n end", "def ends_with?(suffix)\r\n suffix = suffix.to_s\r\n self[-suffix.length, suffix.length] == suffix \r\n end", "def prefix\n fetch_sample(PREFIXES)\n end", "def suffix(s, index=s.size-1)\n s[index,s.size-index]\nend", "def get_idx(basename)\n idx = basename[/^\\d+_/].gsub(\"_\", \"\")\n idx\nend", "def descends_from? path, base\n if base == path\n 0\n elsif base == SLASH\n (path.start_with? SLASH) && 1\n else\n (path.start_with? base + SLASH) && (base.length + 1)\n end\n end", "def ends_with?(suffix)\n suffix = suffix.to_s\n self[-suffix.length, suffix.length] == suffix \n end", "def search_prefixes(str, pos= 0, len= -1)\n end", "def suffix\n nil\n end", "def _prefix_arg0(args, prefix)\n if args.size > 0 && !args[0].nil? && !args[0].include?(prefix)\n args[0] = prefix + args[0]\n end\n args\nend", "def sum(prefix)\n @hash[prefix] ? @hash[prefix].values.sum : 0\n end", "def prefix(value)\n merge(leprefix: value.to_s)\n end", "def longest_prefix(str, pos= 0, len= -1, match_prefix= false)\n end", "def set_prefix\n @prefix = @str[@i_last_real_word...@i]\n end", "def delete_prefixed(prefix)\n raise NotImplementedError\n end", "def prefix=(prefix) @prefix = prefix end", "def search(bases, prefixes, suffixes, remaining_bases) \n# p \"searching: bases #{bases.inspect}, prefixes #{prefixes.inspect}, suffixes #{suffixes.inspect}, remaining #{remaining_bases.inspect}\"\n# sleep 0.1\n\n if remaining_bases.empty? && (suffixes.last == prefixes.first)\n p \"solution: #{bases.inspect}, #{prefixes.inspect}, #{suffixes.inspect}\"\n return prefixes.zip(suffixes).inject(0) {|memo, obj| memo + 100*obj.first + obj.last }\n # {|a,b| 100*a+b}.inject {|a,b| a+b}\n end\n\n remaining_bases.each do |base|\n bases.push(base)\n\n new_remaining_bases = remaining_bases - [base]\n h = choice_hash_for_base(base)\n\n h.each_pair do |prefix, suffix|\n # 1.) if suffixes not empty, check this prefix with last suffix\n if !suffixes.empty? && (suffixes.last != prefix)\n next\n end\n\n prefixes.push(prefix)\n suffixes.push(suffix)\n\n found = search(bases, prefixes, suffixes, new_remaining_bases)\n return found if found\n\n prefixes.pop\n suffixes.pop\n end\n\n bases.pop\n end\n\n return nil\nend", "def ends_with?(suffix)\n suffix = suffix.to_s\n self[-suffix.length, suffix.length] == suffix\n end", "def longest_prefix(strings)\n word_array = strings[0].split(\"\")\n length = strings.length\n\n prefix = \"\"\n\n word_array.each_with_index do |letter,letter_index|\n count_words_with_letter = 0\n\n (length - 1).times do |i|\n if (strings[i+1].split(\"\"))[letter_index] == letter \n count_words_with_letter += 1\n else\n return prefix\n end\n end\n\n if count_words_with_letter = length-1\n prefix += letter\n end\n end\n\n return prefix\nend", "def prefix\n @data['prefix']\n end", "def add_initial(prefix)\n # A pangram is : \"prefix\" + counts of each letter + \"and\" before 'z'\n known_string = prefix.downcase + ('a'..'z').to_a.join(\"\") + \"and\"\n add_function(:initial, known_string, '+', @add_word)\n\n # known_count[letter] is the count of each letter we know must exist\n known_count = known_string.to_counts\n\n name_bytes = Array.new(26).fill(0)\n (1..99).each { |n| n.to_en.accum_counts(name_bytes) }\n in_names = name_bytes.collect {|n| n > 0}\n # Now we have an array of booleans representing whether a character\n # is constant (only appearing in the prefix or enumerated list)\n # or is a variable quantity (because it also appears in number names\n\n # From the count of what we initially knew to be present, return\n # our initial target. This is our best initial guess for a result\n # which will converge quickly. Basically, anything which is\n # not found in a name, is now known to occur a constant number of\n # times in the result. If it is in a name, I just punt and\n # prepare to see it 1 time like Simon does.\n @target_template = in_names.zip(known_count).collect do |in_name, known|\n if in_name\n 1\n else\n known\n end\n end\n\n # Starting with the count of known contents add the letter counts\n # for the numbers we expect to see. The counts in the target template\n # indicate that we expect to see N occurences of that (char) in the\n # result. Thus if 7 a's are reflected in the target we must have\n # an associated set of bytes {seven's} in the result. The following\n # code initializes the result template with the static byte counts\n # that we know must occur in the result. Using the target template as\n # a guide, we then call the appropriate adder_function to increment\n # the counts for the spelled out numbers which MUST be present in\n # the result if our guess remains congruent. e.g. if the target contained\n # [7, 2, 1, 2]... we MUST increment the result_template by\n # \"sevens\" \"twos\" \"one\" \"twos\"\n @result_template = known_count.dup\n @target_template.each do |n|\n @add_word[n].call(@result_template)\n end\n\n end", "def prefix\n match(/Prefix\\s+:\\s+([^\\s])/)\n end", "def count ( nucleotide, strand )\n\tstrand.upcase.count( nucleotide )\nend", "def find_prefix(word)\n prefix = ''\n i = 0\n while starts_with(prefix)\n prefix += word[i]\n i += 1\n end\n prefix.slice(0, prefix.length - 1)\n end", "def prefix=(value)\n value += '/' if value != '' and value[-1] != '/'\n @prefix = value\n end", "def getCount(s)\n s.count('aeiou')\nend", "def str_str2(haystack, needle)\n return 0 if needle.empty?\n current_idx = haystack.index(needle[0])\n until current_idx .nil?\n if haystack[current_idx, needle.length] == needle\n return current_idx\n else\n previous_idx = current_idx\n current_idx = haystack[current_idx + 1..-1].index(needle[0])\n if current_idx\n current_idx = current_idx + previous_idx + 1\n end\n end\n end\n -1\nend", "def end_with?(suffix)\n suffix = suffix.to_s\n self[-suffix.length, suffix.length] == suffix\n end", "def getCount(str)\n str.count(\"AEIOUaeiou\")\nend", "def coinc?( word, base )\r\n\t# output: nil - no coincedence, 0 - from beginning, >0 - prefix exists\r\n\treturn word.index(base)\r\nend", "def prefix_suffix_option=(prefix_suffix_option)\n validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n unless validator.valid?(prefix_suffix_option)\n fail ArgumentError, \"invalid value for 'prefix_suffix_option', must be one of #{validator.allowable_values}.\"\n end\n @prefix_suffix_option = prefix_suffix_option\n end", "def count_indel_bases(delimiter)\n array = self.read_bases.split(delimiter)\n number = 0\n array.shift\n array.each do |element|\n # deletions in reference could contain ambiguous codes,\n number += /^(\\d+)[#{@indelbases}]/.match(element)[1].to_i\n end\n number\n end", "def prefix\n 'oai_dc' \n end", "def prefix\n regexify(bothify(fetch('aircraft.prefix')))\n end", "def prefix(argument_1, argument_2)\n print argument_1\n print argument_2\nend", "def getCount(inputStr)\n inputStr.count 'aeiouAEIOU'\nend", "def str_str(haystack, needle)\n return 0 if needle.empty?\n pattern_length = needle.length\n i = 0\n while i <= (haystack.length - pattern_length) do\n return i if needle == haystack.slice(i, pattern_length)\n i += 1\n end\n return -1\nend", "def _prefixes; end", "def prefix=(value)\n @prefix = value\n end", "def length_of_name(first_name, second_name)\n return first_name.length + second_name.length\nend", "def getCount(inputStr)\n inputStr.count('aeiou')\nend", "def getCount(inputStr)\n inputStr.count('aeiou')\nend", "def +(suffix)\n suffix = suffix.to_s\n\n call + (suffix.start_with?(' ') ? '' : ' ') + suffix\n end", "def compute(left_strand,right_strand)\n return 0 if left_strand == right_strand\n\n left_chars = left_strand.chars\n right_chars = right_strand.chars\n\n distance = 0\n\n left_chars.each_with_index do |left_char,idx|\n right_char = right_chars[idx]\n break if right_char.nil? # ignore extra length on first strand when longer\n\n distance += 1 unless left_char == right_char\n end\n\n distance\n end", "def prefix\n ''\n end", "def prefix_suffix_text=(prefix_suffix_text)\n\n if !prefix_suffix_text.nil? && prefix_suffix_text.to_s.length > 5\n fail ArgumentError, \"invalid value for 'prefix_suffix_text', the character length must be smaller than or equal to 5.\"\n end\n\n @prefix_suffix_text = prefix_suffix_text\n end", "def starts_with?(f, prefix)\n\treturn false if prefix.size > f.size\n\tf1 = f[0 .. prefix.size-1]\n\treturn f1 == prefix\nend", "def name_prefix\n 'num'\n end", "def words_with_prefix(prefix, words)\n raise NotImplementedError # TODO\nend", "def to_s()\n\t\t\treturn \"/#{@prefix_len}\"\n\t\tend", "def getCount(inputStr)\n return inputStr.count(\"aeiou\")\nend", "def max_suffix_value\n related_names_in_use.map { |match| match.captures.first.to_i }.max\n end", "def f(prefix, suffix)\n hint = @answers.shift\n regex = Regexp.new(\"^#{prefix}\")\n regex1 = Regexp.new(\"#{suffix}$\")\n valid = ->(word){ (regex===word) && (regex1 === word)}\n puts \"#{prefix}, #{suffix}, #{regex.inspect} #{regex1.inspect}\" if @d\n puts \"Answer string: #{@w[hint]} #{valid[@w[hint]]}\" if @d\n ans = @w.each_with_index.select{|x,i| \n valid[x]}\n puts ans.inspect if @d\n return -1 if ans.empty?\n puts ans.sort{|a,b| a[0] <=> b[0]}.last.last if @d\n puts \"=====\" if @d\n ans.sort{|a,b| a[0] <=> b[0]}.last.last \n end", "def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end", "def trim_suffix(s, suffix)\n s.end_with? suffix and s[0..-(suffix.length + 1)] or s\n end" ]
[ "0.7463263", "0.6559145", "0.64508134", "0.60494727", "0.60494727", "0.60494727", "0.60494727", "0.60494727", "0.59450126", "0.5874299", "0.58166337", "0.5691618", "0.5691618", "0.56827635", "0.5674452", "0.5581028", "0.5558828", "0.5558499", "0.5558499", "0.5558499", "0.5558499", "0.5558499", "0.5558499", "0.5558499", "0.5558499", "0.5558499", "0.5558499", "0.553647", "0.5503993", "0.5491589", "0.54466605", "0.5433947", "0.5433347", "0.5385861", "0.5369471", "0.5332047", "0.53271306", "0.529223", "0.5286575", "0.52602404", "0.525751", "0.5247589", "0.52450365", "0.5226541", "0.52201396", "0.5215465", "0.52113414", "0.51964086", "0.51864827", "0.51853955", "0.51809835", "0.5172738", "0.5167639", "0.5163419", "0.51586884", "0.5150319", "0.51083845", "0.50954765", "0.50936085", "0.50935686", "0.5092483", "0.5080422", "0.50801075", "0.5069949", "0.50629234", "0.5058001", "0.5056383", "0.5054633", "0.5054453", "0.50518763", "0.5049609", "0.5048641", "0.5042962", "0.5034031", "0.50293493", "0.50255543", "0.5022303", "0.5020637", "0.5006482", "0.50053", "0.50038093", "0.50027597", "0.5001766", "0.49994585", "0.4998922", "0.49953833", "0.49953833", "0.49909437", "0.49868035", "0.4986129", "0.4975399", "0.49742723", "0.4970807", "0.49704692", "0.49561656", "0.49476007", "0.49415922", "0.4937942", "0.49295133", "0.49279445" ]
0.6696163
1
context block to dry up code describe 'post page' do context 'when user is an admin' do before(:each) do
def login(email, password) visit '/users/sign_in' fill_in 'Email', :with => email fill_in 'Password', :with => password click_button 'Log in' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_02_comment_on_post_as_guest\n end", "def login_admin\n let(:current_user) { create(:user, admin: true) }\n\n before(:each) { sign_in current_user }\n end", "def feature_login_admin\n before(:each) do\n admin = create(:attached_admin)\n\n visit admin_root_path\n fill_in('user_email', with: admin.email)\n fill_in('user_password', with: admin.password)\n click_button 'Login'\n end\n end", "def test_should_verify_admin_updating_an_item_does_not_change_typus_user_id_if_not_defined\n\n assert @typus_user.is_root?\n\n post_ = posts(:owned_by_editor)\n post :update, { :id => post_.id, :post => { :title => 'Updated by admin' } }\n post_updated = Post.find(post_.id)\n assert_equal post_.typus_user_id, post_updated.typus_user_id\n\n end", "def test_ID_25862_new_post_in_group_you_manage()\n login $user_1_email, $master_password\n read_all_updates\n logout_common\n login $user_1_email, $master_password\n inline_posting_to_any_blog(\"atest\")\n logout_common\n login $user_1_email, $master_password\n verify_updates\n end", "def check_if_should_be_admin\n end", "def admin_content(&block)\n yield if logged_in? && User.find(session[:user]).is_admin?\n end", "def test_should_verify_root_can_edit_any_record\n\n assert @typus_user.is_root?\n\n Post.find(:all).each do |post|\n get :edit, { :id => post.id }\n assert_response :success\n assert_template 'edit'\n end\n\n end", "def is_admin\n test_access :admin\n end", "def test_admin_user_edit\n\n post(:login,\n { :user_login => \"cathy_m\", :user_password => \"test\"},\n {})\n assert_equal('Login successful', flash['notice'])\n \n post(:edit, { :id => @cathy_m.id }, cathy_admin_session)\n assert_template(\"user/edit\", \"Template should be 'user/edit'\")\n\n end", "def user_is_admin\n unless current_user.admin?\n flash[:notice] = \"You may only view existing scenarios.\"\n redirect_to root_path\n end\n end", "def login_admin\n before(:each) do\n @request.env[\"devise.mapping\"] = Devise.mappings[:admin]\n sign_in FactoryGirl.create(:admin)\n end\n end", "def setup\n @admin = users(:admin)\n @user = users(:user)\n end", "def setup\n @admin = FactoryBot.create(:admin)\n end", "def test_page_security\n # A public page\n get '/home'\n assert_response :success\n # An administrator page\n get '/admin'\n assert_redirected_to_login\n\n form_login('admin', 'admin')\n \n get '/admin'\n assert_response :success\n end", "def assume_admin_logged_in(admin = nil)\n admin = admin || create(:user, :admin)\n assume_logged_in(admin)\nend", "def redirect_to_admin\n redirect_to admin_tests_path if current_user.is_a?(Admin)\n end", "def test_admin_can_edit_a_user\n \n #first create an admin\n ann_admin = setup_dummy_user('anneadmin')\n ann_admin.add_role('admin')\n ann_admin.save!\n \n # log ann_admin in\n get '/login' # need to do this to set up the form container.\n post '/login', { :username => 'anneadmin', :password => GOOD_PASSWORD }\n\n # ensure a request to edit and unknown ID is bounced.\n get \"/user/edit/153\"\n assert last_response.ok?\n assert last_response.body.include?(\"The user id supplied was not recognised\")\n\n # ensure a command to update an unknown ID is bounced.\n post \"/user/edit/153\"\n assert last_response.ok?\n assert last_response.body.include?(\"The user id supplied was not recognised\")\n\n # set up 2 dummy users\n george = setup_dummy_user(\"george\")\n mildred = setup_dummy_user(\"mildred\")\n \n # ensure we can bring up the edit screen for a user\n get \"/user/edit/#{george.id}\"\n assert last_response.ok?\n assert last_response.body.include?(george.username)\n assert last_response.body.include?(george.email)\n \n # check the mechanics of posting an update but change nothing just yet.\n pref = george.get_preference('HTML_EMAIL').value\n\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"no changes\")\n \n # try changing george's html email preference only\n not_pref = pref == 'true' ? 'false' : 'true'\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => not_pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\")\n assert not_pref == george.get_preference('HTML_EMAIL').value\n \n # try changing george's email to mildred's\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => mildred.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"A user with email '#{mildred.email}' already exists\")\n\n # try changing george's email to something nice\n post \"/user/edit/#{george.id}\", { :email => \"testytestgeorgegeorge@davesag.com\", :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\")\n george.reload\n assert george.email == 'testytestgeorgegeorge@davesag.com'\n \n # try changing george's password and locale.\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"newpassword\", :_locale => 'fr',\n :html_email => pref, :roles => [''] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\") # changing george's locale should not change the user's \n george.reload\n assert george.locale == 'fr'\n\n # make up a new role to give George that is not a superuser role.\n special_role_one = Role.create(:name => 'special-role-one')\n special_role_two = Role.create(:name => 'special-role-two')\n\n # try making george a 'special-role-one' and a 'user'.\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => ['special-role-one','user'] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\") \n george.reload\n assert george.has_role?('special-role-one')\n assert george.has_role?('user')\n assert !george.has_role?('special-role-two')\n assert george.locale == 'fr'\n \n # try making george just a 'user'.\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => ['user'] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\") \n george.reload\n assert !george.has_role?('special-role-one')\n assert george.has_role?('user')\n assert !george.has_role?('special-role-two')\n assert george.locale == 'fr'\n \n # now try making george an 'admin'\n get \"/user/edit/#{george.id}\" # to open the form\n post \"/user/edit/#{george.id}\", { :email => george.email, :password => \"\", :_locale => george.locale,\n :html_email => pref, :roles => ['admin'] }\n assert last_response.ok?\n assert last_response.body.include?(\"User Details Saved\") \n george.reload\n assert !george.has_role?('special-role-one')\n assert !george.has_role?('user')\n assert !george.has_role?('special-role-two')\n assert george.has_role?('admin')\n assert george.locale == 'fr'\n\n get '/logout'\n \n # try logging george in with his new password\n post '/login', { :username => george.username, :password => \"newpassword\" }\n assert last_response.body.include?('Vous avez ouvert une session comme') # we changed him to French.\n assert last_response.body.include?(george.username) \n assert last_response.body.include?('Utilisateurs de liste') # we made him an Admin\n \n # okay now let's test make mildred an admin and test that george can't edit mildred or root\n mildred.add_role('admin')\n mildred.save!\n \n pref = mildred.get_preference('HTML_EMAIL').value\n \n # try changing mildred's email to something nice will bounce.\n\n get \"/user/edit/#{mildred.id}\" # to open the form\n post \"/user/edit/#{mildred.id}\", { :email => \"testytestmildredpierce@davesag.com\", :password => \"\", :_locale => mildred.locale,\n :html_email => pref, :roles => [''] }\n assert last_response.ok? \n assert last_response.body.include?(\"Vous n'avez pas le droit d'éditer cet utilisateur\")\n \n get '/logout'\n assert last_response.ok?\n\n # next we test that root (a superuser) can edit mildred (an admin)\n post '/login', { :username => 'root', :password => GOOD_PASSWORD }\n assert last_response.ok?\n \n# require 'ruby-debug'\n# debugger\n\n # the edit will be to make mildred a superuser. Currently this is also something an admin can do to anyone but other admins.\n # TODO: This of course means a corrupt admin could create a fake user for another email address they own, with superuser access. \n # To close this loophole only superusers ought to be able to assign someone a superuser role.\n # admins may not assign anyone a superuser role.\n get \"/user/edit/#{mildred.id}\" # to open the form\n post \"/user/edit/#{mildred.id}\", { :email => \"testytestmildredpierce@davesag.com\", :password => \"\", :_locale => mildred.locale,\n :html_email => pref, :roles => ['admin', 'superuser'] }\n assert last_response.ok?\n assert last_response.body.include?('User Details Saved')\n \n # require 'ruby-debug'\n # debugger\n\n mildred.reload\n assert mildred.has_role?('admin')\n assert mildred.has_role?('superuser')\n assert mildred.email == 'testytestmildredpierce@davesag.com'\n \n # finally we test that root can edit another superuser. So now that is a mildred a superuser root should edit her.\n # in this case change her email and remove her from the superuser role, but leave her as an admin.\n get \"/user/edit/#{mildred.id}\" # to open the form\n post \"/user/edit/#{mildred.id}\", { :email => \"taketwofortestymildred@davesag.com\", :password => \"\", :_locale => mildred.locale,\n :html_email => pref, :roles => ['admin'] }\n assert last_response.ok?\n assert last_response.body.include?('User Details Saved')\n mildred.reload\n assert mildred.has_role?('admin')\n assert !mildred.has_role?('superuser')\n assert mildred.email == 'taketwofortestymildred@davesag.com'\n \n get '/logout'\n assert last_response.ok?\n \n # now finally test that mildred, as an admin, can't edit root, a superuser.\n root = User.find_by_username('root')\n post '/login', {:username => 'mildred', :password => GOOD_PASSWORD }\n assert last_response.ok?\n\n get \"/user/edit/#{root.id}\" # to open the form\n post \"/user/edit/#{root.id}\", { :email => \"changeisasgoodasaholiday@davesag.com\", :password => \"\", :_locale => root.locale,\n :html_email => pref, :roles => ['admin','superuser'] }\n assert last_response.ok?\n\n assert last_response.body.include?('You do not have permission to edit that user')\n \n get '/logout'\n assert last_response.ok?\n\n \n \n # clean up database at the end of the test\n special_role_two.destroy\n special_role_one.destroy\n mildred.destroy\n george.destroy\n ann_admin.destroy\n end", "def as_admin\n user_id = session[:user_id]\n u = FactoryGirl.create(:user, admin: true)\n session[:user_id] = u.id\n yield\n session[:user_id] = user_id\n end", "def ensure_admin_user!\n redirect_to(enemy_templates_path, :alert => \"You may not perform this action on enemies!\") and return unless current_user.admin?\n end", "def test_should_verify_typus_user_id_of_item_when_creating_record\n\n setup_for_no_root\n\n post :create, { :post => { :title => \"Chunky Bacon\", :body => \"Lorem ipsum ...\" } }\n post_ = Post.find_by_title(\"Chunky Bacon\")\n\n assert_equal @request.session[:typus_user_id], post_.typus_user_id\n\n end", "def ensure_admin_user!\n redirect_to(item_templates_path, :alert => \"You may not perform this action on items!\") and return unless current_user.admin?\n end", "def before_each_suite(rack_request)\n # would login_as Factory(:admin)\n end", "def set_admin_post\n @admin_post_details = PostDetail.where(post_id: params[:post_detail][:post_id])\n @admin_post_detail = PostDetail.find(params[:id])\n @admin_post = Post.find(params[:post_detail][:post_id])\n end", "def before\n end", "def setup\n create(:admin)\n log_user(\"sazor_test_admin\", \"foo\")\n gitlab_destroy_all({ token: User.current.gitlab_token })\n end", "def authorize_user\n # stores action past, gathered by params, and stores action into action variable\n action = params['action']\n\n # passes current post and all of its keys and values, via params, inside variable post\n post = Post.find(params[:id])\n\n # if the post.user id is the same as the current user id, then pass all actions as true and\n # exit out. Machine here thinks (if not the same user id), \"I am a different id.\n # and am exiting loop and headed to the next bit of information\"\n return true if post.user == current_user\n\n # The user was not the current user (see above), so what user are you?\n # If the destroy action is generated, the post.user id will need to match a\n # moderator user id of 2 or an admin id of 1, else redirect back to post with directed error\n if action == 'destroy' && (post.user == !current_user || !current_user.admin?)\n flash[:alert] = 'You must be an admin to do that'\n redirect_to [post.topic, post]\n # same idea as destroy (above), except for the 'update' action\n elsif action == 'update' && !(current_user.moderator? || current_user.admin?)\n flash[:alert] = 'You must be an admin or a moderator to do that'\n redirect_to [post.topic, post]\n end\n end", "def test_ID_25866_comment_on_post_you_wrote()\n login_as_user1\n post_to_any_group(\"Sports\",\"Basketball\")\n logout_common\n login_as_user2\n leave_a_comment_on_any_group(\"Sports\",\"Basketball\")\n logout_common\n login_as_user1\n verify_updates()\n end", "def test_admin_can_show_user\n # first log in\n get '/login' # need to do this to set up the form container.\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n user_id = User.find_by_username(NOBODY_USERNAME).id\n\n get \"/user/#{user_id}\"\n assert last_response.ok?\n assert last_response.body.include?(NOBODY_USERNAME)\n\n # ensure a request for unknown ID is bounced.\n get \"/user/153\"\n assert last_response.ok?\n assert last_response.body.include?(\"The user id supplied was not recognised\")\n\n end", "def setup_admin\n create_admin_user\n create_admin_organization\n update_admin_user_perms\nend", "def admin_only()\n # if you are a logged in user\n # session[:current_user_id] = 123\n if(session[:current_user_id])\n # if you are an admin\n if(User.find(session[:current_user_id]).admin == 'yes')\n yield\n else\n # otherwise\n # send login failure and redirect to dashboard\n flash[:warning] = \"Admin Login Required\"\n redirect_to action: \"index\", controller: \"dashboard\"\n end\n else\n # otherwise\n # send login failure and redirect to login\n flash[:warning] = \"Not Logged In\"\n redirect_to \"/login\"\n end\n end", "def ensure_author_is_admin\n unless current_author_is_admin?\n redirect_to :root\n end \n end", "def correct_or_admin_user\n respond_to do |format|\n if current_user != @post.user && current_user.admin == false\n format.html { redirect_to posts_url, alert: 'Não permitido!' }\n end\n end\n end", "def setup\n @useradmin3 = useradmins(:useradmin3)\n @user3 = users(:three)\n end", "def check_post_user\n # Fetch post by id\n @post = Post.find(params[:id])\n\n # Redirect to home page if wrong user or not admin\n unless @post.blog.user == logged_in_user || logged_in_user.admin?\n redirect_to root_url\n end\n end", "def require_same_user\n if admin_user != @post.user\n flash[:danger] = ['You can not edit these articles fool']\n redirect_to admin_posts_path\n end\n end", "def setup\n @user = users(:user1)\n @other_user = users(:user2)\n @admin = users(:admin1)\n @other_admin = users(:admin2)\n\n @admin_role = roles(:admin)\n @user_role = roles(:user)\n end", "def test_list\n\n # Try editing from a non-Admin account.\n # VERIFY: The user is redirected.\n get :list, {}, rich_designer_session\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The platform list data is retrieved\n post(:list, { :page => 1 }, cathy_admin_session)\n assert_equal(3, assigns(:design_directories).size)\n\n end", "def test_index\n assert Pundit.policy!(@admin_user, Role).index?\n refute Pundit.policy!(@not_admin_user, Role).index?\n end", "def setup\n Factory(:admin)\n end", "def setup\n @request.env[\"devise.mapping\"] = Devise.mappings[:admin]\n sign_in FactoryGirl.create(:admin)\n end", "def test_second_try\n admin = users(:olm_admin_1)\n post :login, :user_login => \"afds\", :user_password => \"lala\"\n assert_equal I18n.t(:login_failed), flash[:login_notice]\n\n post :login, :user_login => admin.user_name, :user_password => \"lala\"\n assert_redirected_to :action => \"index\"\n assert_equal admin.id, session[:uid]\n end", "def test_list\n\n # Try editing from a non-Admin account.\n # VERIFY: The user is redirected.\n get(:list, {}, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The platform list data is retrieved\n post(:list, { :page => 1 }, cathy_admin_session)\n assert_equal(5, assigns(:platforms).size)\n\n end", "def admin?\n #warning: ADMIN must have id 0, rake db:seed to get admin and sample user\n logged_in? && current_user.admin\n end", "def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end", "def verify_is_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def authorize_user\n post = Post.find(params[:id])\n\n unless current_user == post.user || current_user.admin?\n flash[:alert] = \"You must be an admin to do that.\"\n redirect_to [post.topic, post]\n end\n end", "def test_should_get_index_as_admin\n login_as_admin\n get :index\n assert_response :success\n assert_not_nil assigns(:users)\n \n assigns(:users).each do |user|\n assert_tag :a, :content => \"Edit\", :attributes => {:href => edit_user_path(user)}\n assert_tag :a, :content => \"Destroy\", :attributes => {:href => user_path(user)}\n end\n \n assert_tag :a, :content => \"New member\", :attributes => {:href => new_user_path}\n end", "def admin_should_be_logged_in\n page.should have_content('Log Out')\n end", "def admin_in!\n access_denied! unless current_user.admin?\n end", "def test_logged_in_admin_can_list_users\n # first log in\n get '/login' # need to do this to set up the form container.\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n get '/users'\n assert last_response.ok?\n assert last_response.body.include?('There are 2 users')\n end", "def canManagePost(user)\n\t \t\t\t\n\t \t\t\tif user.nil? \n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif user.has_role?(:admin)\n\t \t\t\t\treturn true\n\t \t\t\telse\n\t \t\t\t\treturn false\n\t \t\t\tend\n\t \t\tend", "def test_03_comment_on_post_as_member\n end", "def check_admin\n # using the function above by grabbing the id\n @current_user = find_current_user\n # cross checking to see if user is also an admin\n unless @current_user.present? and @current_user.is_admin?\n #they're find so no additional code needed\n #if they're not admin\n redirect_to root_path\n end\n end", "def test_non_admin_user_cant_list_users\n # first log in\n get '/login' # need to do this to set up the form container.\n post '/login', { :username => NOBODY_USERNAME, :password => GOOD_PASSWORD }\n\n get '/users'\n assert last_response.redirect?\n end", "def setup_admins_users\n begin\n click_on('Logout')\n rescue\n print\n end\n\n Warden.test_reset!\n\n @a1 = admins(:elle_woods)\n @a2 = admins(:vivian_kensington)\n @a3 = admins(:emmett_richmond)\n\n @u1 = users(:connery)\n @u2 = users(:moore)\n @u3 = users(:brosnan)\nend", "def verify_admin\n render_401 unless current_user.is_admin?\n end", "def admin(&block)\n block.call if logged_in?\n end", "def test_shold_not_show_to_non_admin\n sign_in Factory.create(:user)\n get :show\n assert_response :redirect\n end", "def setup_session\n allow_any_instance_of(PostsController).to receive(:current_user).and_return @user\n end", "def checkAdmin\n if !admin_signed_in?\n # if current user is not an admin then can't access the page like add teacher,department,college and new subject\n redirect_to root_path, notice: \"Only Admin Can Access This Page\"\n end\n end", "def do_login(name='admin', is_admin=true)\n u = user_create(name, is_admin)\n visit \"/dev/set_current_user?login=#{u.email_address}\"\n # raise \"do_login: Error login of #{name} with admin = #{is_admin}\" if page.status_code != 200\nend", "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "def admin_user\n redirect_to(admin_page_url) if current_user.admin?\n end", "def admin_area &block\n capture(&block) if current_user && current_user.admin?\n end", "def admin_user\n redirect_to(admin_page_url) if current_user.admin?\n end", "def checkAdmin\n current_user.present? && current_user.isAdmin\n end", "def for_admin\n current_user.admin? ? yield : nil unless current_user.nil?\n end", "def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end", "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "def eventunscrape?\n @user.is_admin?\n end", "def setup\n @admin = users(:admin)\n @user = users(:user)\n @user2 = users(:user2)\n @user3 = users(:user3)\n @user4 = users(:user4)\n @instance_teaming = instances(:instance_teaming)\n @instance_in_progress = instances(:instance_in_progress)\n @instance_complete = instances(:instance_complete)\n end", "def admin?\n begin\n person_signed_in? && current_person && current_person.admin?\n rescue\n # TBD: figure out why view specs don't see 'person_signed_in?'; once we understand, decide how to handle (rescue may be good enough)\n false\n end\n end", "def is_admin\n \tif current_user != nil\n\t \t \tif !current_user.admin\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t \tend\n\t\t else\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t\t end\n \t\t\n\n end", "def is_admin?\n admin?\n end", "def setup\r\n\t\t@controller = Admin::UserController.new\r\n\t\t@request = ActionController::TestRequest.new\r\n\t\t@response = ActionController::TestResponse.new\r\n\t\t# Retrieve fixtures via their name\r\n\t\t# @first = users(:first)\r\n\t\t@first = User.find_first\r\n\tend", "def before_assert\n end", "def may_edit_pages(user)\n true\n end", "def create_other_members_posts\n\t\tposts = []\n\t\tother_user = create_other_member_user\n\t\tposts << FactoryGirl.create(:post, :user_id => other_user.id, :title => \"Post 1\", :body => \"In Post 1 we talk about...\", :public => true) \n\t posts << FactoryGirl.create(:post, :user_id => other_user.id, :title => \"Post 2\", :body => \"In Post 2 we talk about...\", :public => false) \n\t posts << FactoryGirl.create(:post, :user_id => other_user.id, :title => \"Post 3\", :body => \"In Post 3 we talk about...\", :public => true)\n\tend", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def accessible?(context)\n # context[:current_user].is_super_admin?\n true\n end", "def admin_user\n \tif current_user.nil?\n \tredirect_to(login_path)\n else\n \tredirect_to(login_path) unless current_user.admin?\n end\n end", "def admin_user\n \tif current_user.nil?\n \tredirect_to(login_path)\n else\n \tredirect_to(login_path) unless current_user.admin?\n end\n end", "def is_admin?\n admin\n end", "def is_admin?\n admin\n end", "def test_create_on_post\n post :create,\n :post_id => posts(:by_quentin).id,\n :content => 'This is a test note from aaron...'\n assert_response :redirect\n end", "def set_admin_user\n\t@admin_user = current_admin_user\n\tend", "def verify_admin\n admin_is_logged_in? || not_found\n end", "def ensure_admin_user!\n redirect_to(news_path, :alert => \"You may not perform this action on News!\") and return unless user_signed_in? && current_user.admin?\n end", "def is_admin\n admin?\n end", "def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end", "def before\n end", "def admin_area(&block)\n if admin?\n yield\n end\n end", "def is_admin?\n current_user ? current_user.login == 'admin' : false\n end", "def admin?\n user.admin?\n end", "def authenticate_admin!\n if self.class.name =~ /Admin/ && current_user.is_mod?\n redirect_to admin_flagged_replies_path\n false\n elsif self.class.name =~ /Admin/ && !current_user.is_admin?\n flash[:alert] = t('flash.application.should_be_admin')\n (redirect_to :back rescue redirect_to root_path)\n false\n else\n true\n end\n end", "def test_ID_25890_published_posts_01\n login $user_1_email, $master_password\n go_to_edit_profile_page\n $profiles_your_posts.click\n postCount = count_post_current\n if (postCount < 5)\n i=1\n while i < 5\n $browser.goto($patch_note)\n \t$post_pick_group.when_present().click\n \t$browser.link(:text, Regexp.new(groupName)).click\n \t$post_compose_note.when_present().set(\"Note field populated by automated test.\")\n \t$post_now_button.when_present().click\n i = i+1\n end\n end \n end", "def admin_user\n (current_user.present? && current_user.admin?)\n end", "def user_is_admin\n redirect_to root_path unless current_user && current_user.is_admin?\n end", "def context(description, &block)\n context = Speciny::MatcherGroup.new(description, &block)\n # Add all the `before` blocks to be executed if any where defined\n # higher up.\n #\n # For example consider the following spec:\n #\n # describe \"Before block\" do\n # before do\n # @somestring = \"somestring\"\n # end\n #\n # it \"should have access to instance variable \n # in describe before block\" do\n #\n # @somestring.should == \"somestring\"\n #\n # end\n #\n # scenario \"Nested scenarios should have access to\n # anything set in parent before block\" do\n #\n # it \"have access to parent variable\" do\n # @somestring.should == \"somestring\"\n # end\n #\n # end\n # end\n #\n @before.each do |order, values|\n values.each { |before_block| context.before(order, &before_block) }\n end\n # Now call the `run!` method for the scenario\n context.run!\n end", "def setup(&block)\n before(:each, &block)\n end" ]
[ "0.6524277", "0.62141687", "0.6136024", "0.60426456", "0.59583485", "0.5937462", "0.59214634", "0.5907417", "0.58659613", "0.58245283", "0.58046734", "0.57997787", "0.5797049", "0.5794898", "0.57789236", "0.57289034", "0.57219946", "0.57177067", "0.5706512", "0.5696779", "0.56958926", "0.56692934", "0.5666799", "0.56650037", "0.56504315", "0.56369084", "0.5633729", "0.56207174", "0.5617846", "0.56037927", "0.5600983", "0.5599061", "0.5597472", "0.55823845", "0.5568808", "0.55541444", "0.5538043", "0.5535927", "0.5532792", "0.55326545", "0.55159074", "0.55040336", "0.54992115", "0.5497881", "0.54833716", "0.54768366", "0.54729337", "0.5471641", "0.5469885", "0.5463058", "0.54607093", "0.54585254", "0.5457293", "0.5450585", "0.5447155", "0.5429112", "0.542368", "0.5421371", "0.54207706", "0.54159313", "0.5414618", "0.54012537", "0.53985", "0.5397788", "0.5397494", "0.5390631", "0.5389802", "0.5383901", "0.5375547", "0.53753346", "0.5371349", "0.5370505", "0.5367957", "0.5364531", "0.53637904", "0.53518903", "0.53448194", "0.5324537", "0.53233117", "0.5319893", "0.5307278", "0.5302955", "0.5302955", "0.5301666", "0.5301666", "0.53012407", "0.5298829", "0.52985084", "0.52969635", "0.5295879", "0.52930546", "0.52868676", "0.5286766", "0.52839524", "0.52818346", "0.52812463", "0.5275653", "0.5271934", "0.5271795", "0.5269265", "0.5268719" ]
0.0
-1
return the chef config files dir or fail hard
def chef_config_path if Chef::Config['config_file'] ::File.dirname(Chef::Config['config_file']) else raise("No chef config file defined. Are you running \ chef-solo? If so you will need to define a path for the ohai_plugin as the \ path cannot be determined") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_directory\n \"C:\\\\chef\"\n end", "def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end", "def cfg_dir\n File.join(@full_path, CONFIG_DIR)\n end", "def chef_config_path\n Berkshelf.root.join(\"spec/config/knife.rb\").to_s\n end", "def get_config_directory()\n\t\t\tconfig_directory= File.join(@base_directory, \"config\")\n\t\t\treturn config_directory\n\t\tend", "def config_path\n if result = chef_api_config_path\n Pathname(result).expand_path\n else\n Pathname(\"\")\n end\n end", "def config_dir\n dir = options[:config] ? File.dirname(options[:config]) : './config'\n File.expand_path(dir)\n end", "def getConfigPath\n if @conf[:config_name].index('/')\n return @conf[:config_name] if File.file?(@conf[:config_name])\n else \n @conf[:config_dirs].each {|i|\n r = Pathname.new(i) + @conf[:config_name]\n return r if File.file?(r)\n }\n end\n\n CliUtils.warnx \"no config file '#{@conf[:config_name]}' found\" if @conf[:verbose] >= 2\n return nil\n end", "def config_dir\r\n unless @config_dir # first time? calculate config_dir value to \"cache\"\r\n \r\n if opts.config_path\r\n @config_dir = opts.config_path\r\n else\r\n @config_dir = cache_dir\r\n end\r\n \r\n # make sure path exists\r\n FileUtils.makedirs( @config_dir ) unless File.directory? @config_dir\r\n end\r\n \r\n @config_dir\r\n end", "def config_dir\n \"#{gem_dir}/config\"\n end", "def config_dir\n \"#{gem_dir}/config\"\n end", "def find_config_file\n\n root_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))\n app_config = File.join(root_directory, CONFIG_FILE_NAME)\n global_config = File.join('/etc', CONFIG_FILE_NAME)\n\n [app_config, global_config].each do |config_file|\n return config_file if File.exists?(config_file)\n end\n\n nil\n\n end", "def dir\n ENV['XDG_CONFIG_HOME'] || File.join(home, '.config')\n end", "def confdir\n cli_confdir = cli[:confdir]\n global = global_config_dir\n if !cli_confdir.nil?\n return cli_confdir\n elsif File.directory?(global)\n return global\n else\n return user_config_dir\n end\n end", "def global_config_path\n linux_cfg = '/etc/openshift/' + conf_name\n File.exists?(linux_cfg) ? linux_cfg : File.join(File.expand_path(File.dirname(__FILE__) + \"/../../conf\"), conf_name)\n end", "def chef_api_config_path\n ENV[\"CHEF_API_CONFIG\"] || if ENV.key?(\"HOME\")\n \"~/.chef-api\"\n else\n nil\n end\n end", "def conf_folder\n conf['conf_folder'] || '.'\n end", "def get_config_file_for(name)\n if File.exists?(\"#{user_dir}/config/#{name}\")\n \"#{user_dir}/config/#{name}\"\n else\n \"#{root_dir}/config/#{name}\"\n end\n end", "def configdir\n\t\tetc/\"cpu-sentinel\"\n\tend", "def core_cfg_path\n File.expand_path(ENV[\"DBS_CFGDIR\"].presence || \"~/.db_sucker\")\n end", "def get_uplift_config_folder\n path = File.expand_path(@@config_file_path)\n FileUtils.mkdir_p path\n\n return path\n end", "def chef_repo_path\n File.join(ENV['HOME'], '.kitchen', \"pantry_#{config[:port]}\")\n end", "def path\n @path ||= File.dirname @config_file\n end", "def config_path\n @config_path ||= local_config_path\n end", "def config_path\n test? ? \"config-test.yml\" : \"config.yml\"\n end", "def find_config_file\n if ENV[\"SMITH_CONFIG\"]\n to_pathname(ENV[\"SMITH_CONFIG\"]).tap do |path|\n raise ConfigNotFoundError, \"Cannot find a config file name: #{path}\" unless path.exist?\n end\n else\n user = [\"./.#{CONFIG_FILENAME}\", \"#{ENV['HOME']}/.#{CONFIG_FILENAME}\"].map { |p| to_pathname(p) }\n system = [\"/etc/#{CONFIG_FILENAME}\", \"/etc/smith/#{CONFIG_FILENAME}\"].map { |p| to_pathname(p) }\n default = [default_config_file]\n\n (user + system + default).detect { |path| path.exist? }\n end\n end", "def config_dir\n runtime_config.generated_files_dir\n end", "def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end", "def _spec_conf_dir(file)\n specdir = Dir.new('./spec/conf/')\n File.join(specdir.path, file)\nend", "def _spec_conf_dir(file)\n specdir = Dir.new('./spec/conf/')\n File.join(specdir.path, file)\nend", "def find_local_config\n dir = Dir.pwd\n\n local_config_files = []\n\n while dir != '/' && (dir =~ %r{[A-Z]:/}).nil?\n local_config_files.push(File.join(dir, '.doingrc')) if File.exist? File.join(dir, '.doingrc')\n\n dir = File.dirname(dir)\n end\n\n local_config_files.delete(config_file)\n\n local_config_files\n end", "def chef_repo\n File.join(docker_context, 'chef')\n end", "def conf_root(root = nil)\n Pathname(File.expand_path(root || Environment::CONFROOT || ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n rescue\n Pathname(File.expand_path(ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n end", "def config_file\n \"#{confdir}/config.yml\"\n end", "def config_filepath(name)\n File.expand_path(\"../fixtures/configs/#{name}.yaml\", __dir__)\nend", "def config_directory\n return @dir if @dir\n\n path = @options[:directory] || default_config_dir\n @dir = File.expand_path(path)\n end", "def get_config_file\n\t\tconfig_paths =\n\t\t\t[\n\t\t\t\t\"C:\\\\ProgramData\\\\Dyn\\\\Updater\\\\\", #Vista\n\t\t\t\t\"C:\\\\Documents and Settings\\\\All Users\\\\Application Data\\\\Dyn\\\\Updater\\\\\" #XP and else\n\t\t\t]\n\n\t\t# Give me the first match\n\t\tconfig_file = nil\n\t\tconfig_paths.each do |p|\n\t\t\ttmp_path = p + \"config.dyndns\"\n\t\t\tbegin\n\t\t\t\tf = session.fs.file.stat(tmp_path)\n\t\t\t\tconfig_file = tmp_path\n\t\t\t\tbreak #We've found a valid one, break!\n\t\t\trescue\n\t\t\tend\n\t\tend\n\n\t\treturn config_file\n\tend", "def test_config_work\n result = [File.join(Dir.pwd,'.config'), File.join(Dir.pwd,'config')]\n assert_equal(result, XDG.config.work)\n end", "def config_path(config_type)\n config_type = config_type.to_s\n if (config_path = config_options.fetch(\"#{config_type}_config_path\".to_sym, nil))\n raise ConfigurationError, \"file does not exist #{config_path}\" unless ::File.file? config_path\n return ::File.expand_path(config_path)\n end\n\n # if solr, attempt to use path where fedora.yml is first\n if config_type == \"solr\" && (config_path = check_fedora_path_for_solr)\n return config_path\n end\n\n if defined?(Rails.root)\n config_path = \"#{Rails.root}/config/#{config_type}.yml\"\n return config_path if ::File.file? config_path\n end\n\n return \"#{Dir.getwd}/config/#{config_type}.yml\" if ::File.file? \"#{Dir.getwd}/config/#{config_type}.yml\"\n\n # Last choice, check for the default config file\n config_path = ::File.join(ActiveFedora.root, \"config\", \"#{config_type}.yml\")\n raise ConfigurationError, \"Couldn't load #{config_type} config file!\" unless ::File.file?(config_path)\n\n ActiveFedora::Base.logger.warn \"Using the default #{config_type}.yml that comes with active-fedora. If you want to override this, pass the path to #{config_type}.yml to ActiveFedora - ie. ActiveFedora.init(:#{config_type}_config_path => '/path/to/#{config_type}.yml') - or set Rails.root and put #{config_type}.yml into \\#{Rails.root}/config.\"\n config_path\n end", "def app_config_path\n Pathname.new('.').join('config')\n end", "def get_uplift_config_file \n config_dir_path = get_uplift_config_folder\n file_name = \".vagrant-network.yaml\"\n\n return File.join(config_dir_path, file_name) \n end", "def config_path\n File.join(solr_home, 'conf')\n end", "def config_path\n @config_path ||= 'config/spinach.yml'\n end", "def configuration_file_path; end", "def default_global_config_file\n File.join(File.expand_path(ENV[\"HOME\"]), \".kitchen\", \"config.yml\")\n end", "def relative_config_file\n File.join(@settings[:config_dir], @settings[:config_file])\n end", "def template_dir\n File.dirname(__FILE__) + '/../cfg'\n end", "def ensure_config\n return if @config_found\n found = CONFIG_FILES.all? {|f| File.exists? \"#{@options[:config_path]}/#{f}\" }\n found ? @config_dir = true : config_not_found\n end", "def config_path(svc_name)\n # strip st2 prefix\n noprefix_name = svc_name.sub(/^st2/, '')\n config_name = ['logging', noprefix_name, 'conf'].compact.join('.')\n File.join([spec[:conf_dir], config_name])\n end", "def config_file\n File.join AppRoot, ConfigFile\n end", "def global_config_dir\n '/etc/vgh'\n end", "def base_config_path\n BASE_CONFIG_PATH\n end", "def yml_directory\n @data_magic_yml_directory ||= 'config'\n end", "def omnibus_root\n \"/opt/chef\"\n end", "def default_authoritative_config_directory\n case node['platform_family']\n when 'debian'\n '/etc/powerdns'\n when 'rhel'\n '/etc/pdns'\n end\nend", "def setup_config_defaults\n Chef::Config[:knife][:dockerfiles_path] ||= File.join(Chef::Config[:chef_repo_path], \"dockerfiles\")\n config[:dockerfiles_path] = Chef::Config[:knife][:dockerfiles_path]\n end", "def config_file\n File.join(install_directory,'installer','rails_installer.yml')\n end", "def conf_file(name)\n user_conf = File.join(PoolParty.user_dir, \"config\", name)\n if File.file?(user_conf)\n File.join(PoolParty.user_dir, \"config\", name)\n else\n File.join(PoolParty.root_dir, \"config\", name)\n end \n end", "def find_root\n pwd = Dir.pwd\n if pwd.end_with? \"rootfs\"\n \"\" # analysing a supportconfig\n elsif pwd =~ %r{/nts_} && File.directory?(\"rootfs\")\n \"rootfs/\" # analysing a supportconfig\n elsif File.exist? \"/var/log/crowbar/install.log\"\n \"/\" # on an actual admin server\n else\n abort \"Couldn't find log files; aborting.\"\n end\nend", "def install_dir(val = NULL)\n if null?(val)\n @install_dir || raise(MissingProjectConfiguration.new('install_dir', '/opt/chef'))\n else\n @install_dir = File.expand_path(val, Config.project_root)\n end\n end", "def get_config_path()\n return ENV['DOCS_CONFIG_PATH'] || CONFIG_PATH_DEFAULT\n end", "def config_dir\n Wonkavision::Sample::CONFIG_DIR\n end", "def fixture_path\n File.join(__dir__, '../chef/fixtures')\n end", "def config_file\n File.join(root, 'config.yml')\n end", "def outside_configured_directory?(dir); end", "def file_cache_path\n Chef::Config[:file_cache_path]\n end", "def shell_installed(home)\n @logger.info(\"Searching for config in home #{home}\")\n @config_paths.each do |path|\n config_file = File.join(home, path)\n if File.exists?(config_file)\n @logger.info(\"Found config file #{config_file}\")\n return config_file\n end\n end\n return nil\n end", "def chef_config\n ci = @json.split('/').last.gsub('.json', '')\n \"#{prefix_root}/home/oneops/#{@circuit}/components/cookbooks/\" \\\n \"chef-#{ci}.rb\"\n end", "def install_directory\n \"C:\\\\opscode\\\\chef\"\n end", "def default_path\n Pathname.pwd.join(*base_config_path, self.class.config_folder)\n end", "def config_root\n @config_root ||= root / 'config'\n end", "def config_files\n @config_files\n end", "def cfg_dir\n warn \"cfg_dir is deprecated; please use right_agent_cfg_dir\"\n right_agent_cfg_dir\n end", "def cfg_dir\n warn \"cfg_dir is deprecated; please use right_agent_cfg_dir\"\n right_agent_cfg_dir\n end", "def cfg_dir\n warn \"cfg_dir is deprecated; please use right_agent_cfg_dir\"\n right_agent_cfg_dir\n end", "def config_filename\n return @config_filename if @config_filename\n\n @config_filename = File.join(config_directory, \"config\")\n end", "def configuration_file_for(target_dir); end", "def config_file\n CONFIG_FILE\n end", "def _FILESDIR; Config._FILES; end", "def config_dev_path\n File.join test_app_path, 'config', 'deploy', 'dev.rb'\n end", "def check_directory_and_config_file(dir = '', config = '')\n if !Dir.exist?(dir) || !File.exist?(config)\n raise \"Can't find the _config.yml or the _site directory! Please create these files it!\"\n end\n end", "def config_file\n File.join(@path, %w[ application config application.php ])\n end", "def config_path\n etc+\"php/\"\n end", "def config_file\n env_config['config_file'] || raise('environment problem:environment information not loaded')\n end", "def root_dir\n ManageIQ::Providers::Lenovo::Engine.root.join(\"content/ansible_runner\")\n end", "def app_dir\n @app_dir ||= Chef::Resource::Directory.new(deploy_dir, run_context)\n end", "def configru_path\n @configru_path ||= if ::File.directory?(new_resource.path)\n ::File.join(new_resource.path, 'config.ru')\n else\n new_resource.path\n end\n end", "def config_file\n FilePath.new(@directory, 'tc-config.xml')\n end", "def empty_config_file_path\n ::File.expand_path '../../../support/empty_resolv.conf', __FILE__\n end", "def sapi_directory(sapi)\n \"#{node['php']['conf_dir']}/#{sapi}/conf.d\"\n end", "def config\n path = \"./\"\n path = \"config/\" if File.exists?(\"config/\")\n if config_exists?(path) && !Opt[:force]\n puts \"Config file already exists\"\n exit\n else\n FileUtils.copy(File.dirname(__FILE__) + \"/#{CONFIG_FILE}\", path)\n puts \"Copied config file to #{path}\"\n end\n end", "def config_not_found\n puts \"`crowd` can't find the CloudCrowd configuration directory. Please use `crowd -c path/to/config`, or run `crowd` from inside of the configuration directory itself.\"\n exit(1)\n end", "def generate_base_directory_environments(tmpdir)\n puppet_conf = \"#{tmpdir}/puppet2.conf\"\n dir_envs = \"#{tmpdir}/environments\"\n\n step 'Configure a the direnv directory environment'\n apply_manifest_on master, %Q{\n File {\n ensure => directory,\n owner => #{master.puppet['user']},\n group => #{master.puppet['group']},\n mode => \"0750\",\n }\n file {\n [\n '#{dir_envs}',\n '#{dir_envs}/direnv',\n ]:\n }\n\n file {\n '#{puppet_conf}':\n ensure => file,\n content => \"\n [main]\n environmentpath=#{dir_envs}\n \"\n }\n }\n\n return puppet_conf\n end", "def config_files\n files = Dir[File.join(path, \"_config.yml\")]\n return files\n end", "def john_config_file\n ::File.join(::Msf::Config.data_directory, \"jtr\", \"john.conf\")\n end", "def find_config(path)\n if File.exists?(File.join(path, CONFIG_YAML))\n load_config(path)\n else\n find_config(File.dirname(path))\n end\n end", "def dot_kitchen_yml\n File.join(Dir.pwd, \".kitchen.yml\")\n end", "def active_configuration_path\n configuration_paths.find do |path|\n File.file? path\n end || theme_configuration_path\n end", "def config_file_path\n rails_root + \"/config/redis.conf\"\n end", "def chef_secure_path\n return @secure_resources unless @secure_resources.nil?\n\n @secure_resources = Chef::Resource::Directory.new(::File.join(new_resource.chef_secure_path), run_context)\n @secure_resources.recursive(true)\n\n return @secure_resources\n end" ]
[ "0.78017294", "0.7541503", "0.7502662", "0.7380222", "0.7167201", "0.71493816", "0.7068944", "0.70639604", "0.7021905", "0.7008876", "0.7008876", "0.7001938", "0.69809324", "0.6899863", "0.6894657", "0.6793473", "0.6776487", "0.67223704", "0.67008024", "0.66179454", "0.6605912", "0.6604186", "0.6600817", "0.65536714", "0.65452015", "0.65273833", "0.65187395", "0.64794517", "0.647092", "0.647092", "0.64521986", "0.644032", "0.64292055", "0.64121395", "0.64057213", "0.6405475", "0.6397384", "0.63877726", "0.63857734", "0.63698965", "0.6353652", "0.633535", "0.63286895", "0.63243973", "0.6307842", "0.6291109", "0.6289679", "0.628752", "0.62847024", "0.6277903", "0.6271727", "0.62472415", "0.6240464", "0.62294984", "0.62221783", "0.6207656", "0.620506", "0.6204762", "0.6193481", "0.6176926", "0.6168098", "0.6137967", "0.6126425", "0.6125686", "0.6120779", "0.6119474", "0.6100183", "0.60959", "0.6088318", "0.6082373", "0.608095", "0.6080172", "0.6065581", "0.6065581", "0.6065581", "0.60287666", "0.60273755", "0.60259306", "0.6025619", "0.6007624", "0.60050863", "0.59979844", "0.599036", "0.5986423", "0.5982659", "0.5979496", "0.59664124", "0.59551376", "0.594753", "0.59453386", "0.59414256", "0.59364164", "0.59033257", "0.5902627", "0.5899587", "0.5880567", "0.5878033", "0.5876799", "0.5871616", "0.5853824" ]
0.77907807
1
is the desired plugin dir in the ohai config plugin dir array?
def in_plugin_path?(path) # get the directory where we plan to stick the plugin (not the actual file path) desired_dir = ::File.directory?(path) ? path : ::File.dirname(path) case node['platform'] when 'windows' ::Ohai::Config.ohai['plugin_path'].map(&:downcase).include?(desired_dir.downcase) else ::Ohai::Config.ohai['plugin_path'].include?(desired_dir) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maybe_plugin_dir(path:)\n path and plugin_dir path: path or self\n end", "def plugin_directory; end", "def plugins_directory\n @@plugins_directory ||= './plugins'\n end", "def plugins_path; end", "def current_plugin?\n if Origen.application_loaded?\n Origen.app.plugins.current == self\n else\n puts <<-END\ncurrent_plugin? cannot be used at this point in your code since the app is not loaded yet.\n\nIf you are calling this from config/application.rb then you can only use current_plugin? within a block:\n\n# Not OK\nif current_plugin?\n config.output_directory = \"#{Origen.root}/output/dir1\"\nelse\n config.output_directory = \"#{Origen.root}/output/dir2\"\nend\n\n# OK\nconfig.output_directory do\n if current_plugin?\n \"#{Origen.root}/output/dir1\"\n else\n \"#{Origen.root}/output/dir2\"\n end\nend\n\nEND\n exit 1\n end\n end", "def plugin_dir(path:)\n add option: \"-plugin-dir=#{path}\"\n end", "def outside_configured_directory?(dir); end", "def plugin? name\n self.class.plugins.include? name\n end", "def installed?\n File.exist?(\"/etc/munin/plugins/#{name}\")\n end", "def plugins_path\n data[:plugins_path]\n end", "def plugin_deployment?\n DeploymentOption.plugins.include?(deployment_option)\n end", "def plugin_allowed?(plugin_name); end", "def has_plugin?(name)\n true\n end", "def get_plugin_dir(dbc)\n begin\n q = dbc.query('SELECT @@plugin_dir;')\n q.each { |x| @pdir=x[0]; }\n if @pdir.nil?\n q = dbc.query(\"SHOW VARIABLES LIKE 'basedir';\")\n q.each { |x| @pdir=x[1]; }\n plugpath = @pdir.split(\"\\\\\").join(\"\\\\\\\\\")\n plugpath += \"\\\\\\\\lib\\\\\\\\plugin\\\\\\\\\"\n else\n plugpath = @pdir.split(\"\\\\\").join(\"\\\\\\\\\")\n plugpath += \"\\\\\\\\\"\n end\n return plugpath\n rescue Mysql::Error => e\n puts \"Problem determining the plugins directory\".light_red + \"!\".white\n puts \"\\t=> \".white + \"#{e}\".light_red\n puts \"Sorry, can't continue without this piece\".light_red + \"....\\n\\n\".white\n exit 666;\n end\nend", "def ohai_plugin_path\n \"/etc/chef/ohai_plugins\"\n end", "def plugin_root\n \"vendor/plugins/#{plugin_name}\"\n end", "def local_plugin_repo(plugin)\n File.join(\"#{PROJECT_ROOT}\", \"sensu-plugins-#{plugin}\")\nend", "def plugin_directory\n File.join(Overcommit::Utils.repo_root, @hash['plugin_directory'] || '.git-hooks')\n end", "def config_repo_installed?\n cmd_test %{-d \"#{config_path}\"}\nend", "def get_plugin_file(pname)\n plugindir = Dir.new(\"#{$pwd}/plugins\")\n pname += '.rb' unless pname.end_with? '.rb'\n plugindir.each do |filename|\n return \"#{plugindir.path}/#{filename}\" if pname.casecmp(filename).zero?\n end\n end", "def exists?(name)\n\t\t@plugins.has_key?(name)\n\tend", "def get_plugin_dir\n begin\n q = @db_connection.query('SELECT @@plugin_dir;')\n q.each { |x| @pdir=x[0]; }\n if @pdir.nil?\n q = @db_connection.query(\"SHOW VARIABLES LIKE 'basedir';\")\n q.each { |x| @pdir=x[1]; }\n plugpath = @pdir.split(\"\\\\\").join(\"\\\\\\\\\")\n plugpath += \"\\\\\\\\lib\\\\\\\\plugin\\\\\\\\\"\n else\n plugpath = @pdir.split(\"\\\\\").join(\"\\\\\\\\\")\n plugpath += \"\\\\\\\\\"\n end\n return plugpath\n rescue Mysql::Error => e\n print_error(\"Problem determining the plugins directory!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n return nil\n end\n end", "def plugin_path\n ::LittlePlugger.default_plugin_path(self)\n end", "def plugins_path\n if site.config[\"plugins_dir\"].eql? Jekyll::Configuration::DEFAULTS[\"plugins_dir\"]\n [site.in_source_dir(site.config[\"plugins_dir\"])]\n else\n Array(site.config[\"plugins_dir\"]).map { |d| File.expand_path(d) }\n end\n end", "def plugin_path_warning\n Chef::Log.warn(\"The Ohai plugin_path does not include #{desired_plugin_path}. \\\nOhai will reload on each chef-client run in order to add this directory to the \\\npath unless you modify your client.rb configuration to add this directory to \\\nplugin_path. The plugin_path can be set via the chef-client::config recipe. \\\nSee 'Ohai Settings' at https://docs.chef.io/config_rb_client.html#ohai-settings \\\nfor more details.\")\n end", "def gem_path?(file); end", "def plugin_enabled?(plugin_name)\n !!@config['plugins'][plugin_name]\n end", "def plugin_conf_files\n plugin_conf_glob = File.join(File.join(app_root),'plugins/**/*.yaml')\n Dir.glob(plugin_conf_glob)\n end", "def plugin_config_file\n File.join(@dir, Config::FILE_NAME)\n end", "def plugin?(ref)\n\t\t\t\t\t\n\t\t\t\tend", "def status\n #does the plugin exist?\n if File.directory?(File.join(@plugin_path, '.git'))\n #okay...exists.. compare hashes\n if type == 1\n @remote_hash != @plugin_head ? 1 : 2\n else\n 3\n end\n else \n 0\n end\n end", "def vagrant_plugin_installed(name)\n run_cmd(\"vagrant plugin list\").should match(\"#{name}\")\n end", "def plugin_installed?(name)\n raise \"Not Implemented\"\n end", "def is_plugin(name)\n if Vagrant.has_plugin?(name)\n puts \"using #{name}\"\n else\n puts \"please run vagrant plugin install #{name}\"\n exit(1)\n end\nend", "def plugin_enabled_with_engine_additions?(path)\r\n Engines.load_all_plugins? || plugin_enabled_without_engine_additions?(path)\r\n end", "def application?\n gem_dir\n end", "def application?\n gem_dir\n end", "def plugins_path(add_dir = nil)\n paths = Array(File.join(File.dirname(__FILE__), 'plugins'))\n paths << File.join(add_dir) if add_dir\n paths.map { |d| File.expand_path(d) }\n end", "def resource_exists?\n path_exists? install_dir\nend", "def require_plugin_files; end", "def test_plugin_dirs_should_appear_in_reverse_plugin_loading_order\r\n app_paths = %w(app/controllers/ app app/models app/helpers lib)\r\n app_paths.map { |p| File.join(RAILS_ROOT, p)}\r\n plugin_paths = Engines.plugins.reverse.collect { |plugin| plugin.load_paths.reverse }.flatten \r\n \r\n expected_paths = expand_paths(app_paths + plugin_paths) \r\n # only look at those paths that are also present in expected_paths so\r\n # the only difference would be in the order of the paths\r\n actual_paths = @load_path & expected_paths \r\n \r\n assert_equal expected_paths, actual_paths\r\n end", "def plugins\n non_suite_dirs = %w{data data_bags environments nodes roles}\n Util.list_directory(File.join(config[:test_base_path], config[:suite_name])).reject do |d|\n !File.directory?(d) || non_suite_dirs.include?(File.basename(d))\n end.map { |d| \"busser-#{File.basename(d)}\" }.sort.uniq\n end", "def can_proceed?(plugins, plugin_name)\n plugins = plugins.select do |plugin|\n plugin['name'] == plugin_name\n end\n\n return false if plugins.length != 1\n plugin = plugins[0]\n\n if !TeracyDev::Plugin.installed?(plugin_name)\n @logger.debug(\"#{plugin_name} is not installed\")\n return false\n end\n\n if plugin['enabled'] != true\n @logger.debug(\"#{plugin_name} is installed but not enabled so its settings is ignored\")\n return false\n end\n return true\n end", "def plugins_root\n RUBYCOCOA_ROOT + 'vendor/plugins'\n end", "def installed?\n (dir = installed_prefix).directory? && dir.children.length > 0\n end", "def config_directory_exists?\n File.exist?(config_directory) && File.directory?(config_directory)\n end", "def plugin_loaded(name)\n\n\t\tif @plugins.length == 0\n\t\t\treturn false\n\t\tend\n\n\t\t@plugins.each do |a|\n\t\t\tif a.name == name\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\n\t\treturn false\n\tend", "def installed?\n File.exists?(@path)\n end", "def active_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + @resource[:name] )\n end", "def plugins_respond_to?(cmd_name)\n\t\t\treturn respond_to?(\"command_#{cmd_name}\".to_sym)\n\t\tend", "def is_plugin?\n return true if (Sessions.type(session[:session_id]) == \"Administrator\" and Sessions.is_plugin?(session[:session_id]) == true)\nend", "def directory?() end", "def current_folder_has_souffle_config?\n File.exists? \"#{Dir.pwd}/souffle.json\"\n end", "def default_plugin_paths_with_test_helper\n paths = default_plugin_paths_without_test_helper\n paths << \"#{HELPER_RAILS_ROOT}/vendor/plugins\"\n end", "def plugin_files_by_dir\n Array(Ohai.config[:plugin_path]).inject([]) do |plugin_files, plugin_path|\n plugin_files + PluginFile.find_all_in(plugin_path)\n end\n end", "def derivative_plugins_for(plugin)\n plugins.find_all do |pd|\n pd.dependencies.any? {|dep| dep.required_name == plugin.name}\n end\n end", "def loadPlugins(onlythese=nil)\n Dir.foreach($COMMON_PLUGINS_WORKDIR) { |entry| \n next if(onlythese && !onlythese.index(entry))\n d = $COMMON_PLUGINS_WORKDIR + \"/\" + entry\n if FileTest.directory?(d)\n if(FileTest.exists?( d + \"/plugin.rb\"))\n puts \"Loading common plugin %s...\" % entry\n load(d + \"/plugin.rb\")\n end\n end\n }\n Dir.foreach($PLUGINS_WORKDIR) { |entry| \n next if(onlythese && !onlythese.index(entry))\n d = $PLUGINS_WORKDIR + \"/\" + entry\n if FileTest.directory?(d)\n if(FileTest.exists?( d + \"/plugin.rb\"))\n puts \"Loading plugin %s...\" % entry\n load(d + \"/plugin.rb\")\n end\n end\n }\nend", "def zup_dir_enabled?\n if File.exist?('.zup/enabled')\n return true\n else\n return false\n end\n end", "def bundle_exists?\n File.exists? self.bundle_dir\n end", "def plugin_module\n ::LittlePlugger.default_plugin_module(plugin_path)\n end", "def installed?\n ::File.exist?(PATH)\n end", "def loaded?(name)\n plugins.any? { |plugin| plugin.name == name }\n end", "def in_module_root?(path = Dir.pwd)\n PDK::Util::MODULE_FOLDERS.any? { |dir| PDK::Util::Filesystem.directory?(File.join(path, dir)) } ||\n PDK::Util::Filesystem.file?(File.join(path, 'metadata.json'))\n end", "def dir?\n type == :dir\n end", "def config_exists?(path)\n File.exist?(path)\n end", "def plugin_path(*args); end", "def detect_configuration_file\n KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f)}.detect{|f| File.exists?(f)}\n end", "def valid_plugin_input?(input)\n %w{\n KITCHEN_INSTANCE_NAME\n KITCHEN_SUITE_NAME\n KITCHEN_PLATFORM_NAME\n }.include? input\n end", "def dir_exists?(name)\n # Does it exist?\n end", "def managed?(component)\n File.directory?(File.join(freezer_dir, component)) || in_submodule?(component)\n end", "def dir_check\n return sdk_dir_arr.find { |dir| File.directory? dir }\n end", "def PluginManager plugs\n plugs.each do |plugin|\n begin\n unless File.directory?( \"#{PADRINO_ROOT}/templates/#{plugin}\" )\n if File.directory?(\"#{PADRINO_ROOT}/plugins/#{plugin}/templates/#{plugin}\")\n puts \"Linking #{PADRINO_ROOT}/plugins/#{plugin}/templates/#{plugin} => #{PADRINO_ROOT}/templates/#{plugin}\"\n File.symlink \"#{PADRINO_ROOT}/plugins/#{plugin}/templates/#{plugin}\", \"#{PADRINO_ROOT}/templates/#{plugin}\"\n end\n\n if File.directory?(\"#{PADRINO_ROOT}/plugins/#{plugin}/mailers/#{plugin}\")\n puts \"Linking #{plugin} mailers\"\n File.symlink(\n \"#{PADRINO_ROOT}/plugins/#{plugin}/templates/mailers/#{plugin}\", \"#{PADRINO_ROOT}/templates/mailers/#{plugin}\")\n end\n end\n rescue Errno::EEXIST\n # do nothing\n end\n Padrino.set_load_paths(\n \"#{PADRINO_ROOT}/plugins/#{plugin}\", \"#{PADRINO_ROOT}/plugins/#{plugin}/models\")\n\n require \"#{PADRINO_ROOT}/plugins/#{plugin}/app\"\n Dir.glob(\"#{PADRINO_ROOT}/plugins/#{plugin}/models/*.rb\").each{|r|\n require r.sub(/\\.rb$/, '') }\n end\n\n\n\n Cfg['apps'].each do |app, mountpoint|\n begin\n Object.const_get(app) # testing app existance\n\n puts \"Mounting App: #{app}...\"\n Padrino.mount(\"#{app}\").to(\"#{mountpoint.downcase}\").host(/^(?!(admin|www\\.admin)).*$/)\n rescue NameError\n # do nothing\n logger.error \"not mounting #{app}\"\n end\n end unless Cfg['apps'].nil?\nend", "def plugin_gem_location(plugin)\n \"sequel/plugins/#{plugin}\"\n end", "def setup_plugin\n if options[:list] || plugin_file.nil?\n list_plugins\n else # executing the plugin instructions\n self.destination_root = options[:root]\n if in_app_root?\n self.behavior = :revoke if options[:destroy]\n execute_runner(:plugin, plugin_file)\n else\n say \"You are not at the root of a Padrino application! (config/boot.rb not found)\"\n end\n end\n end", "def rails?\n File.directory? dest + '/vendor'\n end", "def load_plugin_with_engine_additions(directory)\r\n name = plugin_name(directory)\r\n return false if loaded_plugins.include?(name)\r\n \r\n logger.debug \"loading plugin from #{directory} with engine additions\"\r\n \r\n # add the Plugin object\r\n plugin = Plugin.new(plugin_name(directory), directory)\r\n Rails.plugins << plugin\r\n \r\n # do the other stuff that load_plugin used to do. This includes\r\n # allowing the plugin's init.rb to set configuration options on\r\n # it's instance, which can then be used in it's initialization\r\n load_plugin_without_engine_additions(directory)\r\n\r\n # perform additional loading tasks like mirroring public assets\r\n # and adding app directories to the appropriate load paths\r\n plugin.load\r\n \r\n true\r\n end", "def directory?\n @directory\n end", "def plugin_manager\n server.plugin_manager\n end", "def plugin_test_root\n \"#{plugin_root}/test\"\n end", "def outside_configured_directory?(dir)\n collections_dir = site.config[\"collections_dir\"]\n !collections_dir.empty? && !dir.start_with?(\"/#{collections_dir}\")\n end", "def eponymous_directory?\n if !path.end_with?(\"/#{@app.config[:index_file]}\") && destination_path.end_with?(\"/#{@app.config[:index_file]}\")\n return true\n end\n\n @app.files.by_type(:source).watchers.any? do |source|\n (source.directory + Pathname(eponymous_directory_path)).directory?\n end\n end", "def plugin_installed?(name)\n return if Vagrant.has_plugin?(name)\n puts \"Vagrant plugin '#{name}' is NOT installed.\"\n puts 'Please run:'\n puts \"\\tvagrant plugin install #{name}\"\n exit(1)\nend", "def dir?\n !!@dir ||= false\n end", "def exists?\n conf.has_key? 'api'\n end", "def load_plugins; end", "def directory_index?\n path.include?(@app.config[:index_file]) || path =~ /\\/$/ || eponymous_directory?\n end", "def current?\n # If this is called before the plugins are loaded (i.e. by a plugin's application file), then\n # it is definitely not the top-level app\n if Origen.application_loaded?\n Origen.app == self\n else\n Origen.root == root\n end\n end", "def directory?\n kind == NODE_DIR\n end", "def is_engine?(dir)\n File.exist?(File.join(dir, \"init_engine.rb\")) || # if the directory contains init_engine.rb\n (File.basename(dir) =~ /_engine$/) || # or it engines in '_engines'\n (File.basename(dir) =~ /_bundle$/) # or even ends in '_bundle' \n end", "def find_plugin_path( mod_name )\n\t\tcandidates = self.plugin_path_candidates( mod_name )\n\t\tPluggability.log.debug \"Candidates for %p are: %p\" % [ mod_name, candidates ]\n\n\t\tcandidate_paths = candidates.\n\t\t\tflat_map {|path| Gem.find_latest_files( path ) }.\n\t\t\treject {|path| self.is_excluded_path?( path ) || ! File.file?(path) }\n\t\tPluggability.log.debug \"Valid candidates in the current gemset: %p\" % [ candidate_paths ]\n\n\t\treturn candidate_paths.first\n\tend", "def installed?(plugin_name, version = nil)\n fetch(plugin_name).version == version or version.nil?\n rescue Plugin::NotFound\n false\n end", "def applicable?(dir = Dir.pwd)\n false\n end", "def in_path?\n config.paths.any? do |path_spec|\n path_spec === file\n end\n end", "def plugin_disabled?(plugin)\n site.disabled_plugins.find do |p|\n p.gsub(/_/, '').downcase == plugin.class.name.gsub(/_/, '').downcase\n end\n end", "def plugin_manager; end", "def plugin_config(plugin_name)\n\t\t\tplugin_ns = player_config['plugins'] ||= {}\n\t\t\treturn plugin_ns[plugin_name.to_s] ||= {}\n\t\tend", "def internal?\n base_config_path = File.expand_path(File.join(ConfigLoader::RUBOCOP_HOME,\n 'config'))\n File.expand_path(loaded_path).start_with?(base_config_path)\n end", "def load(path)\n path = path.sub(%r{/main$}, '')\n files = [File.join(@dir, path, 'main.rb'), File.join(@dir, \"#{path}.rb\")].select {|file| File.file?(file) }\n if files.size == 2\n Olelo.logger.error \"Duplicate plugin #{files.join(', ')}\"\n return false\n end\n return false if files.empty?\n\n if @loaded.include?(path)\n true\n elsif @failed.include?(path) || !enabled?(path)\n false\n else\n begin\n new(path, files.first)\n true\n rescue Exception => ex\n @failed << path\n if LoadError === ex\n Olelo.logger.warn \"Plugin #{path} could not be loaded due to: #{ex.message} (Missing gem?)\"\n else\n Olelo.logger.error \"Plugin #{path} could not be loaded due to: #{ex.message}\"\n Olelo.logger.debug ex\n end\n @loaded.delete(path)\n false\n\t end\n end\n end", "def dir? ; directory? ? self : nil ; end", "def pluginconf(plugin)\n @pluginconfig[plugin]\n end" ]
[ "0.75336653", "0.7378803", "0.7114235", "0.70886266", "0.70205355", "0.69956034", "0.6961204", "0.6949756", "0.68870604", "0.68290204", "0.6709665", "0.6660084", "0.6555435", "0.6493822", "0.6465093", "0.64543086", "0.64234895", "0.634609", "0.63372", "0.6327181", "0.6302366", "0.6300162", "0.6274971", "0.6249786", "0.6205993", "0.6183034", "0.618071", "0.61612195", "0.6148553", "0.6147811", "0.61409795", "0.6140458", "0.6101304", "0.6095477", "0.6078396", "0.6053676", "0.6053676", "0.6030541", "0.6012765", "0.5992818", "0.5991787", "0.59875196", "0.5974765", "0.59716845", "0.5963491", "0.59576124", "0.5946199", "0.59421206", "0.5937562", "0.5921057", "0.59197605", "0.5919442", "0.5909273", "0.5907932", "0.5903259", "0.5902226", "0.58906335", "0.5888164", "0.5887039", "0.5880758", "0.58599156", "0.5858761", "0.5839121", "0.5832641", "0.5817763", "0.58004767", "0.5792481", "0.5769246", "0.57655156", "0.574757", "0.57391185", "0.5738222", "0.5734881", "0.57327425", "0.5730657", "0.57255083", "0.57227033", "0.5717541", "0.5713132", "0.57117015", "0.57112306", "0.5709082", "0.5708953", "0.5705393", "0.5695637", "0.5694458", "0.5692588", "0.56925166", "0.5690802", "0.5686734", "0.5686453", "0.5681682", "0.5680903", "0.5665301", "0.56554514", "0.5654084", "0.56530946", "0.5646671", "0.5642757", "0.56332195" ]
0.820934
0
we need to warn the user that unless the path for this plugin is in Ohai's plugin path already we're going to have to reload Ohai on every Chef run. Ideally in future versions of Ohai /etc/chef/ohai/plugins is in the path.
def plugin_path_warning Chef::Log.warn("The Ohai plugin_path does not include #{desired_plugin_path}. \ Ohai will reload on each chef-client run in order to add this directory to the \ path unless you modify your client.rb configuration to add this directory to \ plugin_path. The plugin_path can be set via the chef-client::config recipe. \ See 'Ohai Settings' at https://docs.chef.io/config_rb_client.html#ohai-settings \ for more details.") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ohai_plugin_path\n \"/etc/chef/ohai_plugins\"\n end", "def setup_ohai\n Ohai::Config[:plugin_path] << ohai_plugin_path\n @ohai = Ohai::System.new\n @ohai.all_plugins\n end", "def compile_ohai_plugins\n return super unless $CHEFSPEC_MODE\n return if $CHEFSPEC_PRELOAD\n\n super\n end", "def compile_ohai_plugins\n ohai_plugin_count = count_files_by_segment(:ohai)\n events.ohai_plugin_load_start(ohai_plugin_count)\n FileUtils.rm_rf(Chef::Config[:ohai_segment_plugin_path])\n\n cookbook_order.each do |cookbook|\n load_ohai_plugins_from_cookbook(cookbook)\n end\n\n # Doing a full ohai system check is costly, so only do so if we've loaded additional plugins\n if ohai_plugin_count > 0\n # FIXME(log): figure out what the ohai logger looks like here\n ohai = Ohai::System.new.run_additional_plugins(Chef::Config[:ohai_segment_plugin_path])\n node.consume_ohai_data(ohai)\n end\n\n events.ohai_plugin_load_complete\n end", "def run_ohai\n @ohai.require_plugin(\"os\")\n end", "def in_plugin_path?(path)\n # get the directory where we plan to stick the plugin (not the actual file path)\n desired_dir = ::File.directory?(path) ? path : ::File.dirname(path)\n\n case node['platform']\n when 'windows'\n ::Ohai::Config.ohai['plugin_path'].map(&:downcase).include?(desired_dir.downcase)\n else\n ::Ohai::Config.ohai['plugin_path'].include?(desired_dir)\n end\n end", "def load_plugin_class(plugin_path, plugin_dir_path = nil)\n # Read the contents of the plugin to understand if it's a V6 or V7 plugin.\n contents = \"\"\n begin\n Ohai::Log.debug(\"Loading plugin at #{plugin_path}\")\n contents << IO.read(plugin_path)\n rescue IOError, Errno::ENOENT\n Ohai::Log.warn(\"Unable to open or read plugin at #{plugin_path}\")\n return nil\n end\n\n # We assume that a plugin is a V7 plugin if it contains Ohai.plugin in its contents.\n if contents.include?(\"Ohai.plugin\")\n load_v7_plugin_class(contents, plugin_path)\n else\n Ohai::Log.warn(\"[DEPRECATION] Plugin at #{plugin_path} is a version 6 plugin. \\\nVersion 6 plugins will not be supported in future releases of Ohai. \\\nPlease upgrade your plugin to version 7 plugin syntax. \\\nFor more information visit here: docs.chef.io/ohai_custom.html\")\n\n load_v6_plugin_class(contents, plugin_path, plugin_dir_path)\n end\n end", "def load_gem_plugins; end", "def load_plugins\n Gem.find_latest_files(\"pantry/init.rb\").each do |path|\n begin\n gem_path = path.gsub(\"#{Gem.dir}/gems/\", '')\n Pantry.logger.debug(\"Installing plugin from #{gem_path}\")\n require path\n rescue Exception => ex\n Pantry.logger.warn(\"Unable to load plugin at #{gem_path}, #{ex.message}\")\n end\n end\n end", "def disable_plugin_shim!\n include_recipe 'openvpn'\n resources(openvpn_conf: 'server').plugins.delete(plugin_str)\n end", "def load_plugins; end", "def plugin_script\n @plugin_script ||= File.join(RAILS_ROOT, 'script', 'plugin')\n end", "def plugins_path; end", "def load_plugins\n # Add our private gem path to the gem path and reset the paths\n # that Rubygems knows about.\n ENV[\"GEM_PATH\"] = \"#{@gems_path}#{::File::PATH_SEPARATOR}#{ENV[\"GEM_PATH\"]}\"\n ::Gem.clear_paths\n\n # Load the plugins\n rc_path = File.expand_path(ENV[\"VAGRANT_RC\"] || DEFAULT_RC)\n if File.file?(rc_path) && @@loaded_rc.add?(rc_path)\n @logger.debug(\"Loading RC file: #{rc_path}\")\n load rc_path\n else\n @logger.debug(\"RC file not found. Not loading: #{rc_path}\")\n end\n end", "def load_plugins\n plugins(@config.subsystems).each do |plugin|\n @ohai.require_plugin(plugin, true)\n end\n end", "def fixLoadPath(oldpath,libpath,target)\n debug \"#{$install_name_tool} -change #{oldpath} #{$executableId}#{libpath} #{target}\"\n `#{$install_name_tool} -change #{oldpath} #{$executableId}#{libpath} #{target}`\nend", "def add_load_path(path)\n full_path = \"#{ENV['HOME']}/.gem/#{path}\"\n\n if File.exists?(full_path)\n $: << full_path\n else\n raise(\"load path missing: #{full_path} (maybe you forgot to bundle?)\")\n end\nend", "def enable_plugin_shim!\n disable_plugin_shim!\n resources(openvpn_conf: 'server').plugins << plugin_str\n end", "def install_plugins\n download_plugins\n generate_goodies_includes\nend", "def require_plugin_files; end", "def path_check!\n # When installed outside of omnibus, trust the user to configure their PATH\n return true unless omnibus_install?\n\n paths = env[path_key].split(File::PATH_SEPARATOR)\n paths.map! { |p| drive_upcase(Chef::Util::PathHelper.cleanpath(p)) }\n embed_index = paths.index(drive_upcase(Chef::Util::PathHelper.cleanpath(omnibus_embedded_bin_dir)))\n bin_index = paths.index(drive_upcase(Chef::Util::PathHelper.cleanpath(omnibus_bin_dir)))\n if embed_index\n if bin_index\n if embed_index < bin_index\n err(\"WARN: #{omnibus_embedded_bin_dir} is before #{omnibus_bin_dir} in your #{path_key}, please reverse that order.\")\n err(\"WARN: consider using `#{ChefCLI::Dist::EXEC} shell-init <shell>` command to setup your environment correctly.\")\n end\n else\n err(\"WARN: only #{omnibus_embedded_bin_dir} is present in your path, you must add #{omnibus_bin_dir} before that directory.\")\n err(\"WARN: consider using `#{ChefCLI::Dist::EXEC} shell-init <shell>` command to setup your environment correctly.\")\n end\n end\n end", "def reload!\n require 'pathname'\n Pathname.new(File.expand_path(__FILE__)).parent.find do |path|\n if path.extname == '.rb' and path.mtime > reload_time\n puts path.to_s\n load path.to_s\n end\n end\n clear_plugin_cache\n @reload_time = Time.now\n end", "def site_subcommands\n user_specific_files = []\n\n if chef_config_dir\n user_specific_files.concat Dir.glob(File.expand_path(\"plugins/knife/*.rb\", chef_config_dir))\n end\n\n # finally search ~/.chef/plugins/knife/*.rb\n user_specific_files.concat Dir.glob(File.join(env['HOME'], '.chef', 'plugins', 'knife', '*.rb')) if env['HOME']\n\n user_specific_files\n end", "def site_subcommands\n user_specific_files = []\n\n if chef_config_dir\n user_specific_files.concat Dir.glob(File.expand_path(\"plugins/knife/*.rb\", Chef::Util::PathHelper.escape_glob(chef_config_dir)))\n end\n\n # finally search ~/.chef/plugins/knife/*.rb\n user_specific_files.concat Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(env['HOME'], '.chef', 'plugins', 'knife'), '*.rb')) if env['HOME']\n\n user_specific_files\n end", "def chef_config_path\n if Chef::Config['config_file']\n ::File.dirname(Chef::Config['config_file'])\n else\n raise(\"No chef config file defined. Are you running \\\nchef-solo? If so you will need to define a path for the ohai_plugin as the \\\npath cannot be determined\")\n end\n end", "def add_plugin_load_paths\r\n plugins.each do |plugin|\r\n plugin.load_paths.each do |path|\r\n $LOAD_PATH.insert(application_lib_index + 1, path)\r\n\r\n ActiveSupport::Dependencies.load_paths << path\r\n\r\n unless configuration.reload_plugins?\r\n ActiveSupport::Dependencies.load_once_paths << path\r\n end\r\n end\r\n end\r\n\r\n $LOAD_PATH.uniq!\r\n end", "def __load_local_plugins\n ARGV.each do |arg|\n if !arg.start_with?(\"-\") && arg == 'bindler'\n bindler_debug 'bindler command detected, setting VAGRANT_NO_PLUGINS to 1'\n ENV[\"VAGRANT_NO_PLUGINS\"] = \"1\"\n break\n end\n end\n\n if ENV['VAGRANT_NO_PLUGINS']\n bindler_debug 'VAGRANT_NO_PLUGINS is set to true, skipping local plugins manifest parsing'\n return\n end\n\n # Prepend our local gem path and reset the paths that Rubygems knows about.\n bindler_debug 'Tweaking GEM_HOME'\n ENV[\"GEM_PATH\"] = \"#{local_data_path.join('gems')}#{::File::PATH_SEPARATOR}#{ENV[\"GEM_PATH\"]}\"\n ::Gem.clear_paths\n\n bindler_debug \"#{bindler_plugins_file} data: #{bindler_plugins.inspect}\"\n bindler_plugins.each do |plugin|\n if plugin.is_a?(String)\n __load_plugin plugin\n else\n __load_plugin *plugin.first\n end\n end\n\n if @__failed_to_load\n plugins = @__failed_to_load.map do |plugin, version|\n \" -> #{plugin} (#{version || \">= 0\"})\"\n end\n raise VagrantPlugins::Bindler::PluginNotFoundError, plugins: plugins.join(\"\\n\")\n end\n end", "def create_ohai\n ohai = Ohai::System.new\n ohai.require_plugin('os')\n ohai.require_plugin('hostname')\n return ohai\n end", "def plugin_directory; end", "def load_plugins\n @loaded ||= {}\n found = {}\n\n Gem.find_files(File.join(plugin_path, '*.rb')).sort!.reverse_each do |path|\n name = File.basename(path, '.rb').to_sym\n found[name] = path unless found.key? name\n end\n\n :keep_on_truckin while found.map { |name, path|\n next unless plugin_names.empty? or plugin_names.include? name\n next if disregard_plugins.include? name\n next if @loaded[name]\n begin\n @loaded[name] = load path\n rescue ScriptError, StandardError => err\n warn \"Error loading #{path.inspect}: #{err.message}. skipping...\"\n end\n }.any?\n end", "def reload_plugins?\n !!@reload_plugins\n end", "def add_plugins_from_lookup_folders\n @plugin_lookup_folders.each do |folder|\n if File.directory?(folder)\n #TODO: add gem root to load path ? and require short folder ?\n #$LOAD_PATH.push(folder) if i[:add_path]\n Dir.entries(folder).select{|file|file.end_with?(RUBY_FILE_EXT)}.each do |source|\n add_plugin_info(File.join(folder,source))\n end\n end\n end\n end", "def load_plugin(name); end", "def update_fs(plugin_name_or_path, plugin_version = nil)\n if plugin_name_or_path.nil?\n @logger.warn('Unable to update the filesystem: no name or path specified')\n return\n end\n\n p = if plugin_version.nil?\n plugin_name_or_path\n else\n @plugins_dir.join('*').join(plugin_name_or_path).join(plugin_version == :all ? '*' : plugin_version)\n end\n\n modified = []\n Dir.glob(p).each do |plugin_dir_path|\n plugin_dir = Pathname.new(plugin_dir_path)\n tmp_dir = plugin_dir.join('tmp')\n FileUtils.mkdir_p(tmp_dir)\n\n yield(tmp_dir) if block_given?\n\n modified << plugin_dir\n end\n\n if modified.empty?\n if plugin_version.nil?\n @logger.warn(\"No plugin found with name #{plugin_name_or_path}. Installed plugins: #{Dir.glob(@plugins_dir.join('*').join('*'))}\")\n else\n @logger.warn(\"No plugin found with name #{plugin_name_or_path} and version #{plugin_version}. Installed plugins: #{Dir.glob(@plugins_dir.join('*').join('*').join('*'))}\")\n end\n end\n\n modified\n end", "def loadPlugins(onlythese=nil)\n Dir.foreach($COMMON_PLUGINS_WORKDIR) { |entry| \n next if(onlythese && !onlythese.index(entry))\n d = $COMMON_PLUGINS_WORKDIR + \"/\" + entry\n if FileTest.directory?(d)\n if(FileTest.exists?( d + \"/plugin.rb\"))\n puts \"Loading common plugin %s...\" % entry\n load(d + \"/plugin.rb\")\n end\n end\n }\n Dir.foreach($PLUGINS_WORKDIR) { |entry| \n next if(onlythese && !onlythese.index(entry))\n d = $PLUGINS_WORKDIR + \"/\" + entry\n if FileTest.directory?(d)\n if(FileTest.exists?( d + \"/plugin.rb\"))\n puts \"Loading plugin %s...\" % entry\n load(d + \"/plugin.rb\")\n end\n end\n }\nend", "def plugin_dir(path:)\n add option: \"-plugin-dir=#{path}\"\n end", "def __load_global_plugins\n # If we're in a Bundler environment, don't load plugins. This only\n # happens in plugin development environments.\n if defined?(Bundler)\n require 'bundler/shared_helpers'\n if Bundler::SharedHelpers.in_bundle?\n @logger.warn(\"In a bundler environment, not loading environment plugins!\")\n return\n end\n end\n\n # Load the plugins\n plugins_json_file = @home_path.join(\"global-plugins.json\")\n bindler_debug(\"Loading plugins from: #{plugins_json_file}\")\n if plugins_json_file.file?\n data = YAML.parse(plugins_json_file.read).to_ruby\n data[\"installed\"].each do |plugin|\n bindler_info(\"Loading plugin from global-plugin.json: #{plugin}\")\n begin\n Vagrant.require_plugin(plugin)\n rescue Vagrant::Errors::PluginLoadError => e\n @ui.error(e.message + \"\\n\")\n rescue Vagrant::Errors::PluginLoadFailed => e\n @ui.error(e.message + \"\\n\")\n end\n end\n end\n end", "def plugin_check(plugin_name)\n unless Vagrant.has_plugin?(plugin_name)\n raise \"#{plugin_name} is not installed, please run: vagrant plugin \" \\\n \"install #{plugin_name}\"\n end\nend", "def plugin_conf\n inspec_config.fetch_plugin_config(\"inspec-chef\")\n end", "def name\n self.class.name.split(\"Ohai::NamedPlugin::\")[1].to_sym\n end", "def load_plugins\n return unless plugin_prefix\n files_to_require = if Gem.respond_to? :find_latest_files\n Gem.find_latest_files(\"#{plugin_prefix}_plugin\")\n else\n Gem.find_files(\"#{plugin_prefix}_plugin\")\n end\n files_to_require.each { |path| require_plugin_path(path) }\n end", "def upgrade_app_explain; \"Check for updates to Hobix.\"; end", "def reload_ohai(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:ohai, :reload, resource_name)\n end", "def ensure_plugin(name)\n unless Vagrant.has_plugin?(name)\n system(\"vagrant plugin install #{name}\")\n end\nend", "def add_plugin_load_paths\n configuration.add_plugin_paths(extension_loader.paths(:plugin))\n super\n ActiveSupport::Dependencies.autoload_once_paths -= extension_loader.paths(:load)\n end", "def maybe_plugin_dir(path:)\n path and plugin_dir path: path or self\n end", "def installed?\n File.exist?(\"/etc/munin/plugins/#{name}\")\n end", "def gem_warning(server)\n if(!server.command_available?)\n puts \"WARNING: The #{server.server} gem does not appear to be installed\"\n end\n end", "def load_plugin(plugin_path, plugin_dir_path = nil)\n plugin_class = load_plugin_class(plugin_path, plugin_dir_path)\n return nil unless plugin_class.kind_of?(Class)\n case\n when plugin_class < Ohai::DSL::Plugin::VersionVI\n load_v6_plugin(plugin_class, plugin_path, plugin_dir_path)\n when plugin_class < Ohai::DSL::Plugin::VersionVII\n load_v7_plugin(plugin_class)\n else\n raise Exceptions::IllegalPluginDefinition, \"cannot create plugin of type #{plugin_class}\"\n end\n end", "def load_cloudflare_cookbook_gems\n return if defined? @@cloudflare_cookbook_gems_loaded\n chef_gem 'cloudflare' do\n action :install\n version '2.0.1'\n end\n require 'resolv'\n require 'cloudflare'\n @@cloudflare_cookbook_gems_loaded = true\nend", "def plugin_path\n ::LittlePlugger.default_plugin_path(self)\n end", "def check_command_plugins(msg)\n @command_plugins.each do |name, block, options|\n begin\n if name =~ /^!/\n if msg =~ /^#{name}\\b/\n msg = msg.gsub(/!\\S+\\s*/, \"\")\n block.call(msg)\n end\n else\n block.call(msg)\n end\n rescue Exception => e\n reply \"Error: #{e.class}\"\n e.dump(@current_server.logger)\n end\n end\n end", "def ensure_plugins(plugins)\n logger = Vagrant::UI::Colored.new\n result = false\n plugins.each do |p|\n pm = Vagrant::Plugin::Manager.new(\n Vagrant::Plugin::Manager.user_plugins_file\n )\n plugin_hash = pm.installed_plugins\n next if plugin_hash.has_key?(p)\n result = true\n logger.warn(\"Installing plugin #{p}\")\n system(\"vagrant plugin install #{p}\")\n end\n if result\n logger.warn('Reloading vagrant now that plugins are installed')\n system(\"vagrant halt; vagrant up;\")\n exit\n end\nend", "def etc; (HOMEBREW_PREFIX+'etc').extend(InstallRenamed) end", "def forcereload\n run \"#{try_sudo} /sbin/service puppet force-reload\"\n end", "def update_plugin!\n reset_xml\n include_frameworks @config[:frameworks] || {}\n include_headers @config[:headers] || {}\n\n resource_options = @config[:resources] || {}\n resource_options[:localization] = @config[:localization] if @config[:localization]\n include_resources resource_options\n\n include_product @config[:product] || {}\n write_plugin_xml! @config[:plugin_xml]\n write_build_target_file!\n end", "def iyyov_install\n iyyov_install_rundir\n\n if iyyov_install_gem\n iyyov_install_init!\n true\n else\n false\n end\n\n end", "def cli_install(executable_path)\n puts \"Creating symlinks at the Smuxi plugin hook locations…\"\n puts\n\n install(executable_path) do |hook_executable_file|\n puts \"Creating `#{hook_executable_file}`\"\n end\n\n puts\n puts \"Plugin `#{name}` installed.\"\n\n exit\n end", "def add_plugin_path(path)\n $LOAD_PATH << path\n end", "def check_plugins\n required_plugins = %w(vagrant-vbguest vagrant-triggers vagrant-reload)\n missing_plugins = required_plugins.reject { |plugin| Vagrant.has_plugin? plugin }.join(\" \")\n unless missing_plugins.empty?\n puts \"The following required plugins are not installed on the HOST machine:\\n#{missing_plugins.tr(' ', ', ')}\"\n puts \"\\nRun following command to install missing plugins:\\nvagrant plugin install #{missing_plugins}\"\n # Halt the provisioning process\n abort\n end\nend", "def local_plugin_repo(plugin)\n File.join(\"#{PROJECT_ROOT}\", \"sensu-plugins-#{plugin}\")\nend", "def load_plugin_failed(name, exception); end", "def after_load_with_appable_plugins\n# $LOAD_PATH.delete_at($LOAD_PATH.index(lib_path)) if lib_path? && @dependencies_injected\n end", "def ensure_all_registered_plugins_are_loaded!\n begin\n super\n rescue LoadError => load_error\n raise LoadError, load_error.to_s unless load_error.to_s =~ /friendly_id|aasm|will_paginate/\n end\n end", "def patch_bashrc\n bashrc = File.readlines(BASHRC_PATH)\n require_line = 'source ~/.goodies-sources'\n if bashrc.any? { |l| l =~ /#{require_line}/ }\n puts 'goodies-sources already in your bash config'\n else\n puts 'Install goodies-sources in your bash config'\n open(BASHRC_PATH, 'a') { |f| f.puts require_line }\n end\nend", "def loadplugins\n @plugins.each do |p|\n Angelia::Util.debug(\"loading plugin angelia/plugin/#{p.downcase}.rb and registering Angelia::Plugin::#{p}\")\n\n Kernel.load(\"angelia/plugin/#{p.downcase}.rb\")\n eval(\"Angelia::Plugin::#{p}.register\")\n end\n end", "def plugin_manager; end", "def from_old_gem?(path)\n path =~ CHEF_FILE_IN_GEM && path !~ CURRENT_CHEF_GEM\n end", "def all_plugins; end", "def load_plugin_map; end", "def PluginManager plugs\n plugs.each do |plugin|\n begin\n unless File.directory?( \"#{PADRINO_ROOT}/templates/#{plugin}\" )\n if File.directory?(\"#{PADRINO_ROOT}/plugins/#{plugin}/templates/#{plugin}\")\n puts \"Linking #{PADRINO_ROOT}/plugins/#{plugin}/templates/#{plugin} => #{PADRINO_ROOT}/templates/#{plugin}\"\n File.symlink \"#{PADRINO_ROOT}/plugins/#{plugin}/templates/#{plugin}\", \"#{PADRINO_ROOT}/templates/#{plugin}\"\n end\n\n if File.directory?(\"#{PADRINO_ROOT}/plugins/#{plugin}/mailers/#{plugin}\")\n puts \"Linking #{plugin} mailers\"\n File.symlink(\n \"#{PADRINO_ROOT}/plugins/#{plugin}/templates/mailers/#{plugin}\", \"#{PADRINO_ROOT}/templates/mailers/#{plugin}\")\n end\n end\n rescue Errno::EEXIST\n # do nothing\n end\n Padrino.set_load_paths(\n \"#{PADRINO_ROOT}/plugins/#{plugin}\", \"#{PADRINO_ROOT}/plugins/#{plugin}/models\")\n\n require \"#{PADRINO_ROOT}/plugins/#{plugin}/app\"\n Dir.glob(\"#{PADRINO_ROOT}/plugins/#{plugin}/models/*.rb\").each{|r|\n require r.sub(/\\.rb$/, '') }\n end\n\n\n\n Cfg['apps'].each do |app, mountpoint|\n begin\n Object.const_get(app) # testing app existance\n\n puts \"Mounting App: #{app}...\"\n Padrino.mount(\"#{app}\").to(\"#{mountpoint.downcase}\").host(/^(?!(admin|www\\.admin)).*$/)\n rescue NameError\n # do nothing\n logger.error \"not mounting #{app}\"\n end\n end unless Cfg['apps'].nil?\nend", "def after_install(path, options = T.unsafe(nil)); end", "def plugin_setup!; end", "def plugin_installed?(name)\n raise \"Not Implemented\"\n end", "def load_autoload_plugins; end", "def install_hack(installer)\n server_installer_name = File.basename(installer)\n return \";\" if server_installer_name.nil?\n<<SCRIPT\ncp /home/vagrant/.gitconfig /root/.gitconfig\nif [ -d \"/opt/opscode/embedded\" ]\nthen\n echo \"Bypassing server install, it appears done.\"\nelse\n echo \"PATH=/opt/opscode/embedded/bin:$PATH\" > /root/.bashrc\n sudo dpkg -i \"/installers/#{server_installer_name}\"\nfi\nSCRIPT\nend", "def plugin_module\n ::LittlePlugger.default_plugin_module(plugin_path)\n end", "def register_plugin\n @plugins ||= []\n plugin = Homeland::Plugin.new\n yield plugin\n @plugins << plugin\n @sorted_plugins = nil\n plugin.version ||= \"0.0.0\"\n plugin.source_path = File.dirname(caller(1..1).first)\n plugin\n end", "def reload!\n # Change 'my_gem' here too:\n files = $LOADED_FEATURES.select { |feat| feat =~ /\\/nails\\// }\n files.each { |file| \n puts file\n load file }\n end", "def plugins_path\n data[:plugins_path]\n end", "def ensure_plugins(plugins)\n logger = Vagrant::UI::Colored.new\n result = false\n plugins.each do |p|\n pm = Vagrant::Plugin::Manager.new(\n Vagrant::Plugin::Manager.user_plugins_file\n )\n plugin_hash = pm.installed_plugins\n next if plugin_hash.has_key?(p)\n result = true\n logger.warn(\"Installing plugin #{p}\")\n pm.install_plugin(p)\n end\n if result\n logger.warn('Re-run vagrant up now that plugins are installed')\n exit\n end\nend", "def ensure_plugins(plugins)\n logger = Vagrant::UI::Colored.new\n result = false\n plugins.each do |p|\n pm = Vagrant::Plugin::Manager.new(\n Vagrant::Plugin::Manager.user_plugins_file\n )\n plugin_hash = pm.installed_plugins\n next if plugin_hash.has_key?(p)\n result = true\n logger.warn(\"Installing plugin #{p}\")\n pm.install_plugin(p)\n end\n if result\n logger.warn('Re-run vagrant up now that plugins are installed')\n exit\n end\nend", "def ensure_plugins(plugins)\n logger = Vagrant::UI::Colored.new\n result = false\n plugins.each do |p|\n pm = Vagrant::Plugin::Manager.new(\n Vagrant::Plugin::Manager.user_plugins_file\n )\n plugin_hash = pm.installed_plugins\n next if plugin_hash.has_key?(p)\n result = true\n logger.warn(\"Installing plugin #{p}\")\n pm.install_plugin(p)\n end\n if result\n logger.warn('Re-run vagrant up now that plugins are installed')\n exit\n end\nend", "def ensure_plugins(plugins)\n logger = Vagrant::UI::Colored.new\n result = false\n plugins.each do |p|\n pm = Vagrant::Plugin::Manager.new(\n Vagrant::Plugin::Manager.user_plugins_file\n )\n plugin_hash = pm.installed_plugins\n next if plugin_hash.has_key?(p)\n result = true\n logger.warn(\"Installing plugin #{p}\")\n pm.install_plugin(p)\n end\n if result\n logger.warn('Re-run vagrant up now that plugins are installed')\n exit\n end\nend", "def ensure_plugins(plugins)\n logger = Vagrant::UI::Colored.new\n result = false\n plugins.each do |p|\n pm = Vagrant::Plugin::Manager.new(\n Vagrant::Plugin::Manager.user_plugins_file\n )\n plugin_hash = pm.installed_plugins\n next if plugin_hash.has_key?(p)\n result = true\n logger.warn(\"Installing plugin #{p}\")\n pm.install_plugin(p)\n end\n if result\n logger.warn('Re-run vagrant up now that plugins are installed')\n exit\n end\nend", "def safe_run\n run\n rescue Ohai::Exceptions::Error => e\n @failed = true\n raise e\n rescue => e\n @failed = true\n logger.trace(\"Plugin #{name} threw #{e.inspect}\")\n e.backtrace.each { |line| logger.trace( line ) }\n end", "def plugins; end", "def plugins; end", "def plugins; end", "def plugins; end", "def megacli_path\n if Facter::Util::Resolution.which('megacli').nil?\n Facter::Util::Resolution.which('MegaCli')\n else\n Facter::Util::Resolution.which('megacli')\n end\nend", "def fix_H2K_INI()\n # Rewrite INI file with updated location !\n fH2K_ini_file_OUT = File.new(\"#{$gMasterPath}\\\\H2K\\\\HOT2000.ini\", \"w\")\n $ini_out=\"[HOT2000]\nLANGUAGE=E\nECONOMIC_FILE=#{$gMasterPath}\\\\H2K\\\\StdLibs\\\\econLib.eda\nWEATHER_FILE=#{$gMasterPath}\\\\H2K\\\\Dat\\\\Wth110.dir\nFUELCOST_FILE=#{$gMasterPath}\\\\H2K\\\\StdLibs\\\\fuelLib.flc\nCODELIB_FILE=#{$gMasterPath}\\\\H2K\\\\StdLibs\\\\codeLib.cod\nHSEBLD_FILE=#{$gMasterPath}\\\\H2K\\\\Dat\\\\XPstd.slb\nUPDATES_URI=http://198.103.48.154/hot2000/LatestVersions.xml\nCHECK_FOR_UPDATES=N\nUNITS=M\n\"\n fH2K_ini_file_OUT.write($ini_out)\n fH2K_ini_file_OUT.close\n\nend", "def load_plugins!\n # Scan plugins\n plugin_glob = File.join(File.dirname(__FILE__), 'plugins', '*.rb')\n Dir.glob(plugin_glob).each do |plugin|\n logger.debug(\"Loading file: #{plugin}\")\n require plugin\n end\n end", "def check_utils\n\tif not File.exists?(\"/usr/bin/avahi-browse\")\n\t\tprint_error(\"Avahi Utils are not installed: run `apt-get install avahi-utils` to install them.\")\n\t\texit\n\tend\nend", "def require_plugin(name, version='>= 0')\n unless Vagrant.has_plugin?(name, version)\n # This displays the error twice. I'm not sure how to fix that. I don't want to\n # use raise because that throws up a huge stack-trace which is overwhelming.\n abort \"'#{name} is not installed!\"\n end\nend", "def getfromOhai\n\t\tthissys=Ohai::System.new\n\t\tthissys.all_plugins\n\t\treturn thissys.to_json\n\tend", "def install_hotfix_no_daemons(opts)\n opts = check_params(opts,[:hotfix_files,:reboot_system])\n super(opts)\n end", "def load_from_local_plugin_info\n if File.exist?(@plugin_path)\n pwd = Dir.pwd\n begin\n FileUtils.cd(@plugin_path)\n log = eval(GIT_LOG_CMD)\n #parse output\n match = /^commit\\s+(.+)\\nAuthor:\\s+(.+)\\nDate:\\s+(.+)\\n+\\s+(.+)/.match(log)\n raise \"Error in parsing log:\\n#{log}\" unless match && match.length > 0\n @plugin_head = match[1]\n @plugin_author = match[2]\n @plugin_date = match[3]\n @plugin_commit_log = match[4]\n ensure\n FileUtils.cd(pwd) \n end \n end\n end", "def set_load_path!\n load_paths = configuration.load_paths || [] # TODO: from script/console the configuration isn't ran.\n load_paths.reverse_each { |dir| $LOAD_PATH.unshift(dir) if File.directory?(dir) } unless Rucola::RCApp.test? # FIXME: why??\n $LOAD_PATH.uniq!\n end", "def force_reload\n\t\t\tcall(:on_unload)\n\t\t\t@plugins.clear\n\t\t\treload\n\t\tend" ]
[ "0.7636913", "0.66288525", "0.6389356", "0.63807756", "0.6358395", "0.6192538", "0.58402437", "0.58359164", "0.56772554", "0.56727105", "0.56377244", "0.55836606", "0.5564606", "0.55620384", "0.5516394", "0.5486679", "0.5484506", "0.5479545", "0.5479366", "0.54792345", "0.54661363", "0.5462785", "0.5437586", "0.54369986", "0.5393832", "0.5383409", "0.5379373", "0.5361561", "0.53410035", "0.532467", "0.52850974", "0.5271161", "0.52651614", "0.524108", "0.52353144", "0.5227731", "0.5203896", "0.52017105", "0.51965463", "0.5193903", "0.51807886", "0.51433414", "0.5136501", "0.5135458", "0.5126135", "0.51215744", "0.51167464", "0.51134616", "0.51076543", "0.5105358", "0.51021576", "0.5097101", "0.50921714", "0.507363", "0.50586325", "0.50361586", "0.5033432", "0.50217205", "0.5013331", "0.49960956", "0.49845573", "0.4983203", "0.4982937", "0.49764308", "0.49734354", "0.49692896", "0.49678287", "0.49669462", "0.49579337", "0.49540862", "0.49503872", "0.4946496", "0.494509", "0.4943843", "0.4940226", "0.49368304", "0.4934217", "0.49284464", "0.49275884", "0.49200767", "0.49167722", "0.49167722", "0.49167722", "0.49167722", "0.49167722", "0.49161413", "0.491592", "0.491592", "0.491592", "0.491592", "0.49098706", "0.49052218", "0.49046183", "0.49025348", "0.49014184", "0.48947707", "0.48791447", "0.48734224", "0.4864582", "0.48632658" ]
0.8726781
0
this resource forces itself to run at compile_time
def after_created return unless compile_time Array(action).each do |action| run_action(action) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n super\n return self\n end", "def exec\n super\n end", "def compile!\n raise NotImplementedError\n end", "def regenerator; end", "def run; new.run; end", "def run\n super\n end", "def run\n super\n end", "def compile\n end", "def onCompile\n end", "def generate\n super\n end", "def compile\n prep\n client.setup_run_context\n end", "def inherited\n super\n @run = false\n end", "def run(_); end", "def run(_); end", "def stand_alone?; end", "def stand_alone?; end", "def compilelet\n\n end", "def initialize\n\n # call super to make @base_engine available\n super\n \n @engine = Proc.new do |options|\n\n # check if require should be relative or not\n req = (options[['relative']].is__null | options[['relative']].isTRUE) >> 0\n \n # load the content of the file in options.code\n options.code = GalaazUtil.inline_file(options.label >> 0, req)\n\n @base_engine.call(options)\n end\n \n # Add the include engine function for processing the rb block\n add(include: @engine)\n \n end", "def definition\n super\n end", "def definition\n super\n end", "def compile\n @instance ||= new\n end", "def compile\n raise NotImplementedError\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def internal; end", "def always_run=(_arg0); end", "def self\n @define_self = true", "def runnables; end", "def resource(name, &block)\n # It creates a new class based on the resource name scoped tot he Scrumy module\n klass = Scrumy::Models.const_set(name.to_s.classify, Class.new(Scrumy::Models::Model))\n # Then executes the block on the class. The class provides several class\n # methods for making instances behave correctly.\n klass.class_exec &block\nend", "def after_created\n if compile_time\n self.run_action(:apply)\n self.action :nothing\n end\nend", "def build; end", "def generate_comprehensive\n\n end", "def define\n end", "def define\n end", "def run() end", "def private; end", "def qualified_intermediary\n super || create_qualified_intermediary\n end", "def compile\n self.class.compile(id)\n end", "def call\n # implement in subclasses\n end", "def external; end", "def build\r\n raise \"Not implemented\"\r\n end", "def run()\n\t\tif Core::DEBUG\n\t\t\traise \"View #{self.class.name} can't be build because run method is not redefined.\"\t\t\n\t\tend\n\tend", "def run!\n instance_eval(&self.class.setup) if self.class.setup\n instance_eval(&self.class.validate) if self.class.validate\n instance_eval(&self.class.build) if self.class.build\n instance_eval(&self.class.clean) if self.class.clean\n end", "def use(*)\n super\n end", "def freeze\n super\n # Nothing to do here\n extend Freezer\n self\n end", "def freeze() end", "def freeze() end", "def build_script\n raise NotImplementedError\n end", "def initialize ( _caller )\n super\n end", "def initialize ( _caller )\n super\n end", "def compiledo\n\n end", "def define; end", "def main_run\n raise NotImplementedError\n end", "def initialize_generate\n super\n add_accessors\n declare_guardfile\n declare_chefignore_patterns\n end", "def initialize\n super(true)\n end", "def make; end", "def generate\n raise \"must implement\"\n end", "def work\n raise \"implement this in a class that includes this module\"\n end", "def run\n raise \"Not implemented yet.\"\n end", "def source(override); end", "def define &blk\n self.instance_eval(&blk)\n end", "def final; end", "def refutal()\n end", "def custom; end", "def custom; end", "def run; raise NotImplementedError; end", "def run; raise NotImplementedError; end", "def standalone; end", "def run\n super\n require_enrichment\n end", "def generate\n throw \"override me before innocent kittens are hurt!\"\n end", "def internal?; end", "def partially_instanciated?; !fully_instanciated? 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 instantiate!; end", "def construct\n end", "def instance_eval\n end", "def implementation; end", "def implementation; end", "def realize_self\n raise NotImplementedError\n end", "def freeze; end", "def call() end", "def compile force:nil, production:nil\n @production = production || false\n method_name = 'compile_%s' % @source.to_s.split('.').last.downcase\n\n if respond_to?(method_name, true)\n (!force && cached) || ( process_erb; send(method_name))\n else\n @source.read\n end\n end", "def at_init\n\n\t\tend", "def pre_generation_hook(task)\n end", "def run\n end", "def run\n super\n create_easy_type_source\n create_simple_provider_source\n create_name_attribute_source\n end", "def freeze\n context and inclusions and super\n end" ]
[ "0.61323965", "0.60312074", "0.6000105", "0.59993094", "0.5967604", "0.59609103", "0.59609103", "0.5853844", "0.585312", "0.5841339", "0.5832365", "0.58277166", "0.5800191", "0.5800191", "0.5799184", "0.5799184", "0.57721496", "0.57673275", "0.57605636", "0.57605636", "0.5734219", "0.5681627", "0.56546056", "0.56546056", "0.56546056", "0.56546056", "0.56546056", "0.56546056", "0.56546056", "0.56546056", "0.56546056", "0.56463325", "0.564131", "0.56393695", "0.5630923", "0.5629656", "0.56196153", "0.55995923", "0.558716", "0.5578809", "0.5578809", "0.5568716", "0.55617297", "0.5542933", "0.55410427", "0.5540521", "0.5538797", "0.55321807", "0.5529659", "0.55261654", "0.5525932", "0.55125123", "0.55116105", "0.55116105", "0.5502917", "0.549978", "0.549978", "0.549099", "0.54903364", "0.5487598", "0.548313", "0.5475523", "0.54719996", "0.54683965", "0.5460846", "0.54556096", "0.54520553", "0.5448708", "0.5445568", "0.5433464", "0.54278195", "0.54278195", "0.54271287", "0.54271287", "0.5416385", "0.5415473", "0.5412377", "0.5403733", "0.5402157", "0.53828335", "0.53828335", "0.53828335", "0.53828335", "0.53828335", "0.53828335", "0.53828335", "0.53828335", "0.53820264", "0.5372661", "0.53639007", "0.5363877", "0.5363877", "0.5358102", "0.5357067", "0.5355257", "0.5350138", "0.5343565", "0.53410155", "0.5339938", "0.5333741", "0.5326882" ]
0.0
-1
we need a method that replicates Array.sort method builtin to Ruby we will need recursion as we go thru each word pair in the unsorted Array we will need recursion again as we compare each new word that is being sorted to the words already stored in the sorted Array
def sort some_array # This "wraps" rec_sort so you don't have to pass rec_sort an empty array each iteration rec_sort some_array, [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort array\n\tcount = -2\n\t\t# count number of words in first list\n\t\tarray.each do |word|\n\t\tcount = count + 1\n\t\tend\n\trecursive_sort(array, [ ], [ ], count)\nend", "def sort array\n\tcount = -2\n\t\t# count number of words in first list\n\t\tarray.each do |word|\n\t\tcount = count + 1\n\tend\n\trecursive_sort(array, [ ], [ ], count)\nend", "def sort_method(unsorted_array, sorted_array)\n if unsorted_array.length <= 0 #checking if there is any words left to sort\n return sorted_array #if no words then output is the complete sorted array\n end\n \nsmallest = unsorted_array.pop #select a word from the end of the unsorted array\nstill_unsorted = [] #create a new array to put the unsorted words in\n\nunsorted_array.each do |test_word|\n if test_word < smallest #word is tested if it should come before the selected word\n still_unsorted.push smallest #if it does come before the selected word, then move the selected word into unsorted array\n smallest = test_word #then set \n else\n still_unsorted.push test_word #if no words found then the \n end\nend\n\nsorted_array.push smallest #pushes the \n \nsort_method still_unsorted, sorted_array #recursive method\n\nend", "def rec_sort(unsorted, sorted)\n if unsorted.length <= 0\n return sorted\n end\n\n=begin\nif the arr passed through the rec_sort method has a length of 0 or negative,\nreturn the empty array\n=end\n\n smallest = unsorted.pop\n still_unsorted = []\n\n#smallest variable pops the last object of the unsorted array\n#storing an empty array to the variable still_unsorted\n\n unsorted.each do |tested_object|\n if tested_object.downcase < smallest.downcase\n# this will ignore if the word is capitalized or not when sorting\n still_unsorted.push(smallest)\n smallest = tested_object\n else\n still_unsorted.push(tested_object)\n end\n end\n\n=begin\nwe are passing each element of the array to the each method. If the first element\nof the array comes before the last element of the array, we push that last element\ninto the still_unsorted array. Else we push the first element into the\nstill_unsorted array. The last element has been popped out of the array.\nthis is to find the smallest element which will be stored into the smallest\nvariable\n=end\n\n sorted.push(smallest)\n\n#once we find the smallest word, we push it in to the sorted array\n\n rec_sort(still_unsorted, sorted)\n\n=begin\nthen we recursively repeat the process with the still_unsorted array and push\nthe smallest word into the sorted array, until we pushed them all in the sorted\narray\n=end\nend", "def sort words\n # Arrays for sorting\n sorted_array = []\n unsorted_array = []\n\n # Attempting a method which helps sort only unsorted_array, instead of words and unsorted_array\n # if unsorted_array.empty? == true && sorted_array.empty? == true\n # unsorted_array.replace([words])\n # end\n\n # Array for holding the current lowest word\n low_word = []\n # Array for holding the current word\n current_word = []\n\n words.each { |word| current_word.replace([word])\n\n if low_word.empty? == true\n low_word.push(word)\n # Display the low_word being passed in when low_word.empty? = true\n # puts 'low_word == empty: ' + low_word.to_s\n end\n \n if current_word.to_s > low_word.to_s && unsorted_array.include?(word) == false\n unsorted_array.push(word)\n # Display the word if it's greater than the low_word\n # puts current_word.to_s + ' > ' + low_word.to_s\n\n elsif current_word.to_s < low_word.to_s && unsorted_array.include?(low_word) == false\n # puts 'The low_word being replaced: ' + low_word.to_s + ' - is being replaced with - ' + current_word.to_s\n # Why does this push cause the word to display as an array? Example: [\"treason\"] vs treason. A: Pushing low_word.to_s brought in a string of an\n # array: \"[\\\"treason\\\"]\" - not great. Using the .at method I am able to select and push just the string at low_word.at(0) without the array.\n unsorted_array.push(low_word.at(0))\n low_word.replace([word])\n\n end\n \n }\n\n sorted_array.push(low_word.at(0))\n \n unsorted_array.delete_if { |word| word == low_word.at(0) }\n \n # Looping through the unsorted_array until it's empty\n while unsorted_array.empty? == false\n\n # Array for holding the current lowest word\n low_word = []\n # Array for holding the current word\n current_word = []\n \n unsorted_array.each { |word| current_word.replace([word])\n\n if low_word.empty? == true\n low_word.push(word)\n # Display the low_word being passed in when low_word.empty? = true\n # puts 'low_word == empty: ' + low_word.to_s\n end\n \n if current_word.to_s > low_word.to_s && unsorted_array.include?(word) == false\n unsorted_array.push(word)\n # Display the word if it's greater than the low_word\n # puts current_word.to_s + ' > ' + low_word.to_s\n\n elsif current_word.to_s < low_word.to_s && unsorted_array.include?(low_word) == false\n # puts 'The low_word being replaced: ' + low_word.to_s + ' - is being replaced with - ' + current_word.to_s\n # Why does this push cause the word to display as an array? Example: [\"treason\"] vs treason. A: Pushing low_word.to_s brought in a string of an\n # array: \"[\\\"treason\\\"]\" - not great. Using the .at method I am able to select and push just the string at low_word.at(0) without the array.\n unsorted_array.push(low_word.at(0))\n low_word.replace([word])\n\n end\n \n }\n\n sorted_array.push(low_word.at(0))\n \n unsorted_array.delete_if { |word| word == low_word.at(0) }\n\n end\n\n puts ' '\n puts ':: sorted_array ::'\n puts sorted_array.to_s\n puts ' '\n puts ':: unsorted_array ::'\n puts unsorted_array.to_s\n puts ' '\n\nend", "def the_sort array, sorted_array, unsorted_array\n\n # Array for holding the current lowest word\n low_word = []\n # Array for holding the current word\n current_word = []\n\n array.each { |word| current_word.replace([word])\n\n if low_word.empty? == true\n low_word.push(word)\n # Display the low_word being passed in when low_word.empty? = true\n # puts 'low_word == empty: ' + low_word.to_s\n end\n \n if current_word.to_s > low_word.to_s && unsorted_array.include?(word) == false\n unsorted_array.push(word)\n # Display the word if it's greater than the low_word\n # puts current_word.to_s + ' > ' + low_word.to_s\n\n elsif current_word.to_s < low_word.to_s && unsorted_array.include?(low_word) == false\n # puts 'The low_word being replaced: ' + low_word.to_s + ' - is being replaced with - ' + current_word.to_s\n # Why does this push cause the word to display as an array? Example: [\"treason\"] vs treason. A: Pushing low_word.to_s brought in a string of an\n # array: \"[\\\"treason\\\"]\" - not great. Using the .at method I am able to select and push just the string at low_word.at(0) without the array.\n unsorted_array.push(low_word.at(0))\n low_word.replace([word])\n\n end\n \n }\n\n sorted_array.push(low_word.at(0))\n\n unsorted_array.delete_if { |word| word == low_word.at(0) }\n\nend", "def sorting(array)\n\t#start with an empty array where newly sorted elements from the input will go\n\tsorted_array = []\n\n\t#while there is at least one element in the passed in array execute the loop\n\twhile array.length > 0\n\t\t#start with these initial values\n\t\tcount = 1\n\t\tminIndex = 0\n\t\t#this ensures that count will never exceed the number of elements in the inputted array\n\t\twhile count < array.length\n\t\t\t#compare using index values of the array elements starting with array[0] and array[1]\n\t\t\t#compares words in their lowercase form, otherwise capitalized letters would come before lowercase ones, despite alphabetical order\n\t\t\t#the downcase method just temporarily changes the value of the element during comparison, then they retain their capitalized form in the output\n\t\t\tif array[minIndex].downcase > array[count].downcase\n\t\t\t\t#if the preceding element of the inputted array is a word that comes after the following element\n\t\t\t\t#set minIndex (the smallest index value of the array) equal to the count value\n\t\t\t\tminIndex = count\n\t\t\tend\n\t\t\t#add 1 to count so that the while loop will eventually finish\n\t\t\tcount += 1\n\t\tend\n\t\t#now, the array element with minIndex is the smallest value so it is safe to push it to our sorted_array\n\t\tsorted_array.push(array[minIndex])\n\t\t#then delete the smallest element from the inputted array so that the next iteration will be the next smallest element\n\t\tarray.delete_at(minIndex)\n\tend\n\tputs sorted_array\nend", "def non_recursive_sort unsorted_array\n\nsorted_array = []\n\nsmallest = unsorted_array[0]\n\n while unsorted_array != []\n \n unsorted_array.each {|word|\n if smallest >= word\n smallest = word\n end\n }\n sorted_array.push smallest\n unsorted_array.delete_at(unsorted_array.find_index(smallest))\n smallest = unsorted_array[0]\n end\n puts sorted_array.join(\", \")\nend", "def rec_sort unsorted, sorted\n if unsorted.length <= 0\n return sorted\n end\n#\n#start smallest using 'pop' word and move to sorted list\nsmallest = unsorted.pop\nstill_unsorted = []\n#if tested word from unsorted is less then put\n#smallest into still_unsorted and move tested to smallest\nunsorted.each do |tested_object|\n if tested_object < smallest\n still_unsorted.push smallest\n smallest = tested_object\n#otherwise put tested_object into still_unsorted\n else\n still_unsorted.push tested_object\n end\n#push smallest into sorted\n sorted.push smallest\n #calls method recursively again\n rec_sort still_unsorted, sorted\nend\nend", "def sort_by_length(my_sentence)\n array_of_words = my_sentence.split\n sorted_array = []\n array_of_words.each_with_index do |word, index_on_normal_array|\n if index_on_normal_array == 0\n sorted_array.push(array_of_words[0])\n else\n sorted_array_clone = sorted_array.clone\n sorted_array_clone.each_with_index do |word_in_sorted_array,index_in_sorted_array| \n if word.length < word_in_sorted_array.length\n sorted_array.insert(index_in_sorted_array,word)\n elsif word.length == word_in_sorted_array.length && word.length < word_in_sorted_array.length\n sorted_array.insert(sorted_array_clone.length,word) \n elsif word.length >= word_in_sorted_array.length && index_in_sorted_array == (sorted_array_clone.length - 1)\n sorted_array.insert(sorted_array_clone.length,word) \n end\n\n end\n\n end\n\n end\n return sorted_array\nend", "def recursive_sort unsorted_array, sorted_array\n\tu = unsorted_array\n\ts = sorted_array\n\n lowest = u.last\n\n\n\n # test 2 elements, keep the lowest\n u.each do |elem| \n if elem.downcase < lowest.downcase\n\n\n lowest = elem\n \n end\n\n end\n s << lowest\n u.delete_at(u.index(lowest)) \n \n if u.empty? == false\n recursive_sort(u, s)\n else\n s\n end\nend", "def dictionary_sort arr\n return arr if arr.length <= 1\n\n middle = arr.pop\n less = arr.select{|x| x.downcase < middle.downcase} \n more = arr.select{|x| x.downcase >= middle.downcase}\n\n dictionary_sort(less) + [middle] + dictionary_sort(more)\nend", "def array_sort_by_last_letter_of_word(array)\n new_array = Array.new\n array.each {|element|\n new_array << element.reverse\n } \n new_array.sort!\n new_array2 = Array.new\n new_array.each {|element|\n new_array2 << element.reverse\n } \n new_array2\nend", "def sort(word)\n\t# Downcase and converting string into array\n\tword = word.downcase().split(\"\")\n\tlen = word.length\n\n\t# Initializing loop variables\n\ti = 0\n\tj = 0\n\ttemp = 0\n\n\t# Sort the array\n\twhile i < len - 1\n\t\tj = i + 1\n\t\twhile j < len\n\t\t\tif word[i] > word[j]\n\t\t\t\t#swap characters in ascending order\n\t\t\t\ttemp = word[i]\n\t\t\t\tword[i] = word[j]\n\t\t\t\tword[j] = temp\n\t\t\tend\n\t\t\tj += 1\n\t\tend\n\t\ti += 1\n\tend\n\treturn word\nend", "def sort( words )\n sorted = []\n words.each { |word| sorted = insert( word, sorted ) }\n return sorted\nend", "def sort_method unsorted, sorted\n# end the programme when the unsorted array is empty\n if unsorted.length == 0\n return sorted\n end\n\nsmallest = unsorted.pop\nstill_unsorted = []\n\nunsorted.each do |testedword|\n if testedword > smallest\n still_unsorted.push testedword # testedword is bigger than the reference word so will need to be sorted\n else\n still_unsorted.push smallest # 'smallest' goes in the unsorted array as turns out was not the smallest\n smallest = testedword # sets the tested word as smallest found so far in the array\n end\nend\n\nsorted.push smallest\n\nsort_method still_unsorted, sorted\n\nend", "def bubble_sort(array)\n sorting = true\n\n while sorting\n sorting = false\n\n (array.length - 1).times do |idx|\n word1 = array[idx]\n word2 = array[idx + 1]\n if word1.length > word2.length\n array[idx], array[idx + 1] = array[idx + 1], array[idx]\n sorting = true\n end\n end\n end\n\n array.last\nend", "def sort some_array\n\tsome_array = some_array.downcase.split\n\trecursive_sort some_array, []\nend", "def sort(arr)\n word_count = {}\n arr.each do |word|\n if word_count[word.length]\n word_count[word.length] << word\n else\n word_count[word.length] = [word]\n end\n end\n word_count.sort.map{|set|set.last.sort}.flatten\nend", "def bubble_sort_by(array)\n while (array != array.sort_by { |word| word.length}) do\n for x in (0..array.length-2) do\n if (yield(array[x],array[x+1]) > 0)\n array[x], array[x+1] = array[x+1], array[x]\n end\n end\n end\n array\nend", "def sort_by_length(my_sentence)\n words_array = my_sentence.split(\" \")\n\n length = words_array.length\n\n #insertion sort\n i = 1\n while i < length\n to_insert = words_array[i]\n j = i\n while j > 0 && words_array[j - 1].length > to_insert.length\n words_array[j] = words_array[j - 1]\n j -= 1\n end\n words_array[j] = to_insert\n i += 1\n end\n return words_array\n\n # #selection sort\n # i = 0\n # while i < length - 1\n # min_index = i\n # j = i + 1\n # while j < length #finding the min\n # if words_array[j].length < words_array[min_index].length\n # min_index = j\n # end\n # j += 1\n # end\n # if min_index != i\n # temp = words_array[min_index]\n # words_array[min_index] = words_array[i]\n # words_array[i] = temp\n # end\n # i += 1\n # end\n # return words_array\n\n # #bubble sort\n # i = 0\n # while i < length - 1\n # j = 0\n # while j < length - i - 1\n # if words_array[j].length > words_array[j + 1].length\n # temp = words_array[j]\n # words_array[j] = words_array[j + 1]\n # words_array[j + 1] = temp\n # end\n # j += 1\n # end\n # i += 1\n # end\n # return words_array\nend", "def sort_by_length(my_sentence)\n array_of_words = [] #create array to hold words, initialized to empty\n\n if my_sentence == \"\" #check if sentece is empty, return initialized empty array\n return array_of_words\n end\n\n array_of_words = my_sentence.split #split words by space\n\n #array_of_words = [\"dogs\", \"are\", \"bestest\"]\n first_word = array_of_words[0] #saving value at index 0 to first_word. ex: \"dogs\" is first word\n (1..array_of_words.length-1).each do |i| #start at first word (index starts at 1, not 0), check every word\n current_word = array_of_words[i] #new var called current_word is equal to first word at value i in array_of_words\n #current_word = \"are\"\n #ex. if length of current word \"are\" less than first word \"dogs\"\n if current_word.length < first_word.length\n #assign \"are\" to current word\n array_of_words[i-1] = current_word\n #assign dogs to first word (which has not shifted to second place)\n array_of_words[i] = first_word\n end\n #otherwise if current word is greater than first word, then set first word to current word\n first_word = current_word\n end\n return array_of_words\nend", "def sortwords(words\n return words.sort\nend", "def sort_words\n audit\n @_sort_words ||= words.sort { |a, b| b.last <=> a.last }\n end", "def sort_by_length(my_sentence)\n words = my_sentence.split(/\\W+/)\n\n words.size.times do |first_index| \n min_index = first_index\n\n (words.size-first_index).times do |subarray_index|\n if words[first_index+subarray_index].length < words[min_index].length \n min_index = first_index + subarray_index\n end\n end\n \n unless min_index == first_index #don't swap the same index with itself\n holder = words[first_index]\n words[first_index] = words[min_index]\n words[min_index] = holder\n end\n end\n\n return words\nend", "def sort_by_length(my_sentence)\n array = my_sentence.split(\" \")\n array_size = array.length\n \n temp = nil\n swaps_made = nil\n \n j = 0\n stop_here = array_size - 1\n \n while 0 < stop_here\n # puts \"\\nOUTER LOOP stop @ index #{stop_here}\"\n j = 0\n swaps_made = false\n \n while j < stop_here\n # puts \" INNER LOOP #{j} stop @ index #{stop_here}\"\n curr_word = array[j]\n next_word = array[j+1]\n \n if curr_word.length > next_word.length\n temp = curr_word\n array[j] = next_word\n array[j+1] = temp\n swaps_made = true\n end\n \n j += 1\n end\n \n if swaps_made == false\n # puts \"HUZZAH! WE CAN STOP NOW!\"\n return array\n end\n \n stop_here -= 1\n end\n \n return array\nend", "def array_sort_by_last_letter_of_word(array)\n array.map(&:reverse).sort.map(&:reverse)\nend", "def dictionary_sort array # This \"wraps\" recursive_sort.\n recursive_sort array, []\nend", "def sort_by_length(my_sentence)\n if my_sentence.nil? || my_sentence == \"\"\n return []\n end\n word_array = my_sentence.split(\" \")\n sorted = []\n sorted << word_array[0]\n \n \n word_array.each do |word|\n index = 0\n while index < word_array.length\n if word.length < sorted[index].length\n sorted.insert(index, word)\n break\n elsif word.length == sorted[index].length\n sorted.insert(index+1,word)\n break\n elsif index == sorted.length-1\n sorted.insert(index+1,word)\n break\n end\n index += 1\n end\n end\n return sorted.uniq\nend", "def sort_by_length(my_sentence)\n array = my_sentence.split\n length = array.length\n i = 0\n\n while i < length-1 \n j = 0\n while j < length-i-1 \n if array[j].length > array[j+1].length # compares the length of each word\n temp = array[j]\n array[j] = array[j+1]\n array[j+1] = temp\n end\n j += 1\n end\n i += 1\n end\n\n return array \nend", "def sort_by_length(sentence)\n #Step_1: break the sentence into an array of words\n array = sentence.split(/\\W+/)\n #Step_2: use insertion sort to sort the array\n i = 1\n while i < array.length\n to_insert = array[i]\n j = i\n while j > 0 && array[j-1].length > to_insert.length\n array[j] = array[j-1]\n j -= 1\n end\n array[j] = to_insert\n i += 1\n end\n\n return array\nend", "def recursive_dict_sort(unsorted, sorted) #Recursive method used in order to keep going through array and sorting when required\n if unsorted.length <= 0\n return sorted\n end\n smallest = unsorted.pop\n still_unsorted = []\n \n unsorted.each do |x|\n if x.downcase < smallest.downcase\n still_unsorted.push smallest\n smallest = x\n else\n still_unsorted.push x\n end #If statement determining which variable to put into which array\n end\n sorted.push smallest\n recursive_dict_sort(still_unsorted, sorted) #Run method again to determine if any remaining elements of the array need sorting.\nend", "def sort_by_length(my_sentence)\n return [] if my_sentence == \"\"\n\n array = my_sentence.split\n # swapped is not necessary for code to work, but reduces number of loops if inner loop runs without swapping anything (no swaps means everything is sorted)\n swapped = true\n i = 0\n while i < array.length-1 && swapped\n j = 0\n # Assume you won't have to make a swap\n swapped = false\n while j < array.length-i-1\n # word being checked is at the index of j (starts at 0 & increments by 1 each iteration)\n current_word = array[j]\n # if current word is longer then the word after it,\n if current_word.length > array[j+1].length\n # word at current index is swapped with the word at the next index\n array[j] = array[j+1]\n array[j+1] = current_word\n # since we just made a swap, set swapped to true\n swapped = true\n end\n # increment j so the next word will be checked on the next iteration\n j += 1\n end\n i += 1\n end\n\n return array\nend", "def alphabetic_number_sort2 num_arr\n num_arr.sort {|a, b| WORDS_ARR[a] <=> WORDS_ARR[b]}\nend", "def sorter(array)\n loop do\n switched = false\n for i in 0...array.length - 1\n if array[i].downcase > array[i + 1].downcase\n array[i], array[i + 1] = array[i + 1], array[i]\n switched = true\n end\n end\n break if !switched\n end\n array\nend", "def sort_by_length(sentence)\n word_arr = sentence.split(\" \")\n\n i = 0\n while i < word_arr.length\n j = 0\n while j < word_arr.length - i - 1\n if word_arr[j].length > word_arr[j+1].length\n temp = word_arr[j]\n word_arr[j] = word_arr[j+1]\n word_arr[j+1] = temp \n end\n\n j += 1\n end\n i += 1\n end\n\n return word_arr\nend", "def rec_sort unsorted, sorted \n\tif unsorted.length <= 0\n\n# sorted is an array\n\treturn sorted \n\tend\n\n# So if we got here, then it means we still have work to do.\n# take last one out of unsorted, call it smallest\nsmallest = unsorted.pop\n#create en empty 'still unsorted' array \nstill_unsorted = []\n\n#testing if each object in unsorted is smaller than 'smallest' \n\tunsorted.each do |tested_object| \n\t#if tested object is smaller than smallest then push them in still unsorted\n\t\tif tested_object.downcase < smallest.downcase\n\t\t\tstill_unsorted.push smallest\n\t\t\tsmallest = tested_object\n\t\telse\n\t\t\tstill_unsorted.push tested_object\n\t\tend \n\tend\n# Now \"smallest\" really does point to the\n# smallest element that \"unsorted\" contained,\n# and all the rest of it is in \"still_unsorted\". \nsorted.push smallest\n\nrec_sort still_unsorted, sorted\nend", "def my_array_sorting_method(source)\n sourceDup = source.dup\n # p sourceDup.sort_by{|word| word.to_s}\n\n return sourceDup.sort_by{|word| word.to_s}\nend", "def word_sort(sentence)\n\t\n\t# require 'pry'\n\tword_split = sentence.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '') # Removes punctuation marks.\n\tword_array= word_split.split(\" \") # Creates an array of words with the split sentence.\n\tword_array=word_array.sort {|a,b| a.casecmp(b)} #Sort alphabeticaly and case insensitively elements of the array.\n\t# binding.pry\n\tputs \"#{word_array}\"\nend", "def sortMe(arr)\n arr.sort_by { |word| word.to_s[word.to_s.length-1] }\nend", "def sorted(sentence)\n\tsentence.gsub!(/[^a-z0-9\\s]/i, '') #strip out punctuation\n\tsentence_array=sentence.split #split the uppercase sentence into an array using .split\n\tsentence_array.sort{|word1, word2| word1.upcase <=> word2.upcase} #sort the new uppercase array\n\nend", "def double_sort(arr)\n sorted_strings = []\n arr.each do |string|\n sorted_strings << string.sort\n end\n #O(n * m * log m, where m is the length of the longest string)\n sorted_strings.sort\n # there are n * log n comparisons in this sort, but each string\n # comparisons takes m time to perform.\n # Therefore, calling .sort on an array of strings takes n * m log n\nend", "def dictionary_sort(string) \n\n capitalized = string.split(' ').each_with_object([]) { |w, a| a << w if w == w.capitalize }\n\n # downcase and sort orignal list\n \n \n first_sort = string.downcase.split(' ').sort \n\n # after sorting need to compare each element to each element of capitalized\n # if the capitalized version of an element from the sorted list matches and element from \n # capitalized, need to replace it with the element from capitalized \n \n # I'm sure there are other ways to do this, but I used Array#product \n # to create pairs of all the elements from capitalized and first_sort \n # I then went through and found which pairs had a first element that when capitalized, matched the second element \n # Then I found the downcased word within first_sort using Array#index \n # and replaced it with the capitalized version of itself \n\n # http://stackoverflow.com/questions/6692840/iterating-over-two-arrays-at-once\n # http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-product\n # http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-index\n\n\n first_sort.product(capitalized).each { |x| first_sort[first_sort.index(x[0])] = x[1] if x[0].capitalize == x[1] }\n \n\n first_sort.inspect \n \nend", "def sort_the_inner_content(words)\r\n words.split.each { |x| x[1..-2] = x[1..-2].chars.sort.reverse.join }.join(' ')\r\nend", "def alphabetize(arr)\n arr.sort_by do |word|\n word.chars.map { |letter| ESPERANTO_ALPHABET.index(letter) }\n end\nend", "def sorting(arr)\n#display orig array\n p arr \n p \"**************************************************\"\n # do something to the array\n # compare each value of an array to the value on its left\n # if the value is less than the value on its left, switch places\n # do this by placing the lesser value in a holder and then moving the greater\n # value to the lesser value's former position in the array, then rewrite the\n # greater value's former position, with the holder value.\n # do this until the value is greater than the value on its left for \n # the entire array \n#Here is our brute force attempt at making our own .sort! method\n#we used the .sort! method from the Array class.\narr.length.times do\n |x|\n holder = \"\"\n if arr[x] > arr[x-1]\n holder = arr[x-1]\n arr[x-1] = arr[x]\n arr[x] = holder\n end \n end\nputs \"this is the one we made #{arr} \"\n # if arr[1] > arr[0]\n p arr.sort!\n p \"above is the sorting method\"\n#rerturn the changed array\nend", "def dictionary_sort arr\n recursive_sort arr, []\nend", "def sort_by_length(my_sentence)\n array = my_sentence.split(\" \")\n length = array.length\n \n i = 0\n # Outer loop\n while i < length-1\n j = 0\n # Inner loop\n while j < length-1\n # Swap\n if array[j].length > array[j+1].length\n temp = array[j]\n array[j] = array[j+1]\n array[j+1] = temp\n end\n j += 1\n end\n i += 1\n end\n return array\nend", "def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)\n\tend\n\tpos = 0\n\twhile pos < an_array.length \n\t\tif an_array[pos] > an_array[pos + 1]\n\t\t\tmove_to_end(an_array[pos], an_array)\n\t\telse\n\t\t\tpos += 1\n\t\tend\n\tend\n\tan_array\nend", "def sort_sentence(sentence)\r\n words = break_words(sentence)\r\n sort_words(words)\r\nend", "def wordsorting (sentence)\n\t# removing punctuation and splitting sentence\n\twordlist = sentence.gsub(/\\W/, ' ').split(\" \")\n\t#sorting alpahbetically + upcase\n\tputs wordlist.sort_by { |word| word.upcase }\nend", "def sort_by_length(my_sentence)\n array = my_sentence.split\n words_by_length = {}\n i = 0\n while i < array.length #O(m)\n if words_by_length[array[i].length] == nil\n words_by_length[array[i].length] = []\n end\n words_by_length[array[i].length] << array[i]\n i += 1\n end\n\n j = 0\n new_array = [] #space = O(n)\n while j < my_sentence.length #O(n)\n if words_by_length[j] != nil\n new_array << words_by_length[j]\n end\n j += 1\n end\n\n final_array = [] #space = O(n)\n k = 0\n while k < new_array.length #O(m) \n l = 0\n while l < new_array[k].length #O(p)\n final_array << new_array[k][l]\n l += 1\n end\n k += 1\n end\n\n return final_array\n \nend", "def bubble_sort_by_explanation array\n puts \"The beginning order of the array: #{array}\"\n puts \"\"\n unsorted = true\n while unsorted do\n i = 0\n unsorted = false\n while i < (array.length - 1)\n puts \"Yield to calculate the difference of #{array[i]}.length - #{array[i + 1]}.length\"\n difference = (yield array[i], array[i + 1]).to_i\n puts \"The difference is #{difference}.\"\n puts \"If is < 0 the order second word is longer and nothing changes\"\n if (difference >= 0)\n puts \"BUT IF THE DIFFERENCE >= 0 the order second word is shorter & needs to be switched!\"\n puts \"This next line switches the words #{array[i]} and #{array[i + 1]}\"\n array[i], array[i + 1] = array[i + 1], array[i]\n unsorted = true\n end\n i += 1\n puts \"#{array} is the current array in while loop\"\n puts \"\"\n end\n end\n puts \"The ending order of the array: #{array}\"\nend", "def match(array)\n ary = []\n array.each do |w| \n if w.split(\"\").sort == @word.sort\n ary << w\n end \n end\n ary\n end", "def strand_sort(array)\n temp = array.dup\n result = []\n until temp.empty?\n value = temp.first\n sublist, temp = temp.partition { |val| value = val if value <= val }\n result += sublist.shift(sublist.length) if result.empty?\n result = binary_sort(result, sublist)\n end\n result\nend", "def sort_by_length(my_sentence)\n return [] if my_sentence == \"\"\n\n words = my_sentence.split\n i = 1\n \n # implement selection sort \n while i < words.length \n adjacent_word = words[i]\n j = i \n\n while j > 0 && words[j-1].length > adjacent_word.length\n words[j] = words[j-1]\n j -= 1\n end\n\n words[j] = adjacent_word\n i += 1\n end\n\n return words\nend", "def full_merge_sort(array)\n merge_sort(array, 0, array.length - 1)\n retrieve_strings array\n array\nend", "def rec_dict_sort unsorted, sorted\r\n\tif unsorted.length <= 0\r\n\t\treturn sorted\r\n\tend\r\n\t# if here then there is still work to do\r\n\r\n\tsmallest = unsorted.pop\r\n\tstill_unsorted = []\r\n\r\n\tunsorted.each do |tested_object|\r\n\t\tif tested_object.downcase < smallest.downcase\r\n\t\t\t# when tested_object < smallest\r\n\t\t\tstill_unsorted.push smallest\r\n\t\t\tsmallest = tested_object\r\n\t\telse\r\n\t\t\tstill_unsorted.push tested_object\r\n\t\tend\r\n\tend\r\n\t# now 'smallest' really does point to the smallest\r\n\t# element that 'unsorted' contained, and all the\r\n\t# rest of it is in 'still_unsorted'\r\n\tsorted.push smallest\r\n\r\n\trec_dict_sort still_unsorted, sorted\r\nend", "def alphabetize(arr)\n arr.sort_by do |word| \n word.split(\"\").collect do |letter| \n split_alphabet = alphabet.split(\"\")\n if split_alphabet.include?(letter)\n split_alphabet.index(letter)\n else\n split_alphabet.count\n end\n end\n end\n end", "def word_sort(array, letter)\n array.select do |value|\n value.include?(letter)\n end\nend", "def find_anagrams(target_word, array_of_words)\n array_of_anagrams = []\n\n array_of_words.each do |member|\n if member.split(//).sort == target_word.split(//).sort\n array_of_anagrams.push(member)\n else\n next\n end\n end\n array_of_anagrams\nend", "def sort_array_2(arr)\n arr.sort{|a,b| a.downcase <=> b.downcase}\nend", "def grand_sorting_machine(array)\n\n\n\nend", "def unscramble_with_sort(scrambled_words, dictionary)\n # by maintaining their array index i can restore to unsorted version\n sorted_dictionary = dictionary.map{|i| i.chars.sort.join}\n sorted_scrambled_words = scrambled_words.map{|i| i.chars.sort.join}\n\n sorted_scrambled_words.each_with_index do |word,i|\n puts \"#{scrambled_words[i]} ==> #{dictionary[sorted_dictionary.index(word)]}\"\n end\nend", "def sort\n @sort ||= Vidibus::Words.sort_by_occurrence(list)\n end", "def sort_by_length(my_sentence)\n \n array = my_sentence.split(/\\s/)\n\n # using selection sort here\n i = 0\n while i < array.length - 1\n min_index = i\n j = i + 1\n while j < array.length\n if array[j].length < array[min_index].length\n min_index = j\n end\n j += 1\n end\n if min_index != i\n temp = array[min_index]\n array[min_index] = array[i]\n array[i] = temp\n end\n i += 1\n end\n \n return array\n\nend", "def array_sort_by_last_letter_of_word(array)\n\tn =['sky', 'puma', 'maker']\n\tn.sort_by { | thing | thing.chars.last}\nend", "def sort1(array)\n\nend", "def alphabetic_number_sort(arr)\n words = %w[zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen]\n arr.sort_by do |number|\n words[number]\n end\nend", "def sort_by_length(my_sentence)\n # using bubble sort\n sentence_in_array = my_sentence.split(\" \")\n i = 0\n while i < sentence_in_array.length-1\n j = 0\n while j < sentence_in_array.length-i-1\n if sentence_in_array[j].length > sentence_in_array[j+1].length\n temp = sentence_in_array[j]\n sentence_in_array[j] = sentence_in_array[j+1]\n sentence_in_array[j+1] = temp\n end\n j += 1\n end\n i += 1\n end\n return sentence_in_array\nend", "def array_sort_by_last_letter_of_word(array)\n array.sort_by{|word|word[-1]}\nend", "def smooth_sort(array)\n orders = [0]\n trees = 0\n\n (0...array.length).each do |i|\n if trees > 1 && orders[trees - 2] == orders[trees - 1] + 1\n trees -= 1\n orders[trees - 1] += 1\n elsif trees > 0 && orders[trees - 1] == 1\n orders[trees += 1] = 0\n else\n orders[trees += 1] = 1\n end\n find_and_sift(array, i, trees - 1, orders)\n end\n (array.length - 1).downto(1) do |i|\n if orders[trees - 1] <= 1\n trees -= 1\n else\n right_index = i - 1\n left_index = right_index - LEONARDO_NUMS[orders[trees - 1] - 2]\n trees += 1\n orders[trees - 2] -= 1\n orders[trees - 1] = orders[trees - 2] - 1\n find_and_sift(array, left_index, trees - 2, orders)\n find_and_sift(array, right_index, trees - 1, orders)\n end\n end\n array\nend", "def sort_sentence(sentence)\n words = break_words(sentence)\n sort_words(words)\nend", "def string_sort(str_arr)\n (str_arr.first.length - 1).downto(0) do |d|\n str_arr = merge_sort(str_arr, d)\n end\n str_arr\nend", "def sort_by_length(my_sentence)\n i = 0\n sentence_array = my_sentence.split(\" \")\n\n while i < (sentence_array.length)-1\n j = 0\n while j < (sentence_array.length)-i-1\n if (sentence_array[j].length) > (sentence_array[j+1].length)\n temp = sentence_array[j]\n sentence_array[j] = sentence_array[j+1]\n sentence_array[j+1] = temp\n end\n j += 1\n end\n i += 1\n end\n return sentence_array\nend", "def my_array_sorting_method(source)\n return source.push(thing_to_locate).sort_by{|word| word.downcase}\nend", "def combine_anagrams(words)\r\n big_array = Array.new\r\n hash = Hash.new(0)\r\n words.each do |w| \r\n array = Array.new\r\n array = w.downcase.split(//)\r\n if hash.has_key?(array.sort) \r\n hash[array.sort]=hash[array.sort].push(w)\r\n else\r\n hash[array.sort]=Array.[](w)\r\n end\r\n end\r\n hash.each { |key,value| big_array.push(value) }\r\n big_array\r\nend", "def sort array # This \"wraps\" recursive_sort.\n recursive_sort array, []\nend", "def dictionary_sort arr\r\n\trec_dict_sort arr, []\r\nend", "def dub_sort(arr)\nend", "def sort_sentence(sentence)\n words = break_words(sentence)\n sort_words(words) # took out 'return'\nend", "def funWithAnagrams(word_arr)\n # Write your code here\n visited = {}\n\n word_arr.each_with_index do |word,idx|\n if visited[word.split(\"\").sort.join(\"\")]\n word_arr[idx] = \"\"\n else\n visited[word.split(\"\").sort.join(\"\")] = 1\n end\n end\n\n word_arr.delete(\"\")\n word_arr.sort\nend", "def sort_by_length(my_sentence)\n split_sentence = my_sentence.split(\" \")\n\n split_sentence.each_with_index do |word, index|\n previous_word = split_sentence[index - 1]\n if index == 0 \n elsif word.length < previous_word.length\n split_sentence[index - 1], split_sentence[index] = word, previous_word\n end\n end\nend", "def sort(to_sort)\n # if the array is of length 0 or 1, consider it is already sorted\n if to_sort.length <= 1\n then return to_sort\n end\n\n # otherwise split the remaining elements in two\n # I had to look this line on the web (sourcerefactormycode.com)\n second_array = to_sort.slice!((to_sort.length / 2.0).round..to_sort.length)\n\n # recursive method call on both arrays\n first_sorted_array = sort(to_sort)\n second_sorted_array = sort(second_array)\n\n # merge the two sorted arrays together\n return merge(first_sorted_array, second_sorted_array)\nend", "def sortarray (sort_me)\n counter = sort_me.length\n a = 0\n b = 1\n while a < (counter-1)\n b = a+1\n while b < (counter)\n if sort_me[a] > sort_me[b]\n temp = sort_me[a]\n sort_me[a] = sort_me[b]\n sort_me[b] = temp\n end\n b += 1\n end\n a += 1\n end\n return sort_me\nend", "def get_all_letters_in_array_of_words(array)\n #go through each word\n new_array = []\n array.each {|word|\n new_array << word.split(//)\n }\n new_array.flatten.sort\n #separate each letter and add to new array of letters - .split(//)\n #take all letters and sort for alphabet\nend", "def sort(array_of_nodes, order); end", "def match(possible_anagrams)\nresult = []\nsplitted_word = @word.downcase.split(\"\").sort\n\npossible_anagrams.each do |element|\nif splitted_word == element.downcase.split(\"\").sort\n result << element\nend \nend\nresult\nend", "def merge_sort(array)\r\n\tif array.length > 1\r\n\t\tleft_array = []\r\n\t\t\t(array.length/2).times { left_array << array.shift }\r\n\t\tright_array = array\r\n\t\tleft_sorted = merge_sort(left_array)\r\n\t\tright_sorted = merge_sort(right_array)\r\n\t\tresult = []\r\n\t\twhile left_sorted.length>0 && right_sorted.length>0\r\n\t\t\tif left_sorted[0] <= right_sorted[0]\r\n\t\t\t\tresult << left_sorted.shift\r\n\t\t\telse\r\n\t\t\t\tresult << right_sorted.shift\r\n\t\t\tend\r\n\t\tend\r\n\t\tif left_sorted.length>0\r\n\t\t\tleft_sorted.each { |e| result << e }\r\n\t\telsif right_sorted.length>0\r\n\t\t\tright_sorted.each { |e| result << e }\r\n\t\tend\r\n\t\treturn result\r\n\telse\r\n\t\treturn array\r\n\tend\r\nend", "def sorted_triples(array)\n\tnew_array = []\n\tarray.each_slice(3) {|grouped_words| new_array << grouped_words.sort}\n\tnew_array\nend", "def anagram(word)\n anagrams_array = %w(enlists google inlets banana)\n search = word.split('')\n search.sort!\n anagrams_array.each do |wordanna|\n new_word = wordanna.split('')\n new_word.sort!\n if search == new_word\n puts wordanna\n end\n end\nend", "def orderly(array)\n p array.sort\nend", "def word_unscrambler(str, words)\n str = str.split('').sort.join('')\n possible = []\n words.map do |word|\n sort_word = word.split('').sort.join('')\n possible << word if word_c == str\n end\n return possible\nend", "def alphabetize1(arr, rev=false)\n if rev!=false\n arr.sort! do |a, b|\n b <=> a # REVERSE ALPHABETICAL ORDER\n end\n else\n arr.sort! do |a, b|\n a <=> b\n end\n end\nend", "def using_sort(array)\narray.sort\nend", "def using_sort(array)\narray.sort\nend", "def array_sort(arr)\nx = arr.length\nif x == 1\nelsif x == 2\n if arr[0] > arr[1]\n arr[0], arr[1] = arr[1], arr[0]\n end\nelse\n loop do\n modified = FALSE\n (x-2).times do |x|\n if (arr[x] < arr[x + 1]) && (arr[x] < arr[x + 2])\n if arr[x + 2] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x], arr [x + 2], arr[x + 1]\n modified = TRUE\n end\n elsif (arr[x + 1] < arr[x]) && (arr[x + 1] < arr[x + 2])\n if arr[x] < arr[x + 2]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n elsif arr[x + 2] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr [x + 2], arr[x]\n modified = TRUE\n elsif arr[x + 2] == arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 1], arr[x], arr[x + 2]\n modified = TRUE\n end\n elsif (arr[x + 2] < arr[x]) && (arr[x + 2] < arr[x + 1])\n if arr[x] < arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n elsif arr[x + 1] < arr[x]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x + 1], arr[x]\n modified = TRUE\n elsif arr[x] == arr[x + 1]\n arr[x], arr[x + 1], arr[x + 2] = arr[x + 2], arr[x], arr[x + 1]\n modified = TRUE\n end\n end\n end\n break if modified == FALSE\n end\nend\n arr\nend", "def sort_by_length(my_sentence)\n my_array = my_sentence.split(\" \")\n i = 1\n \n while i < my_array.length\n to_insert = my_array[i]\n j = i\n \n while j > 0 && my_array[j-1].length > to_insert.length\n my_array[j] = my_array[j-1]\n j -= 1\n end\n my_array[j] = to_insert\n i += 1\n end\n return my_array\nend", "def sort_by_length(my_sentence)\n if my_sentence == \"\" \n return []\n end\n\n array = my_sentence.split\n\n i = 1\n while i < array.length \n j=i \n while j > 0 && array[j-1].length > array[j].length \n array[j-1],array[j] = array[j], array[j-1]\n end\n i=i+1\n end\n return array \nend", "def sort_sentence(sentence)\n words = break_words(sentence)\n return sort_words(words)\nend", "def order(words)\n # sorted = words.split(\" \")\n # sorted.sort_by { |word| word.scan[/\\d/]first.to_i}.join(\" \")\n words.split.sort_by { |word| word[/\\d/] }.join(\" \")\nend" ]
[ "0.82708365", "0.8268202", "0.81447226", "0.7787669", "0.7706872", "0.76213", "0.754766", "0.7499072", "0.74946284", "0.7299443", "0.72955865", "0.72787476", "0.7270108", "0.72666633", "0.72200227", "0.7216597", "0.7205846", "0.71453196", "0.71306723", "0.7121634", "0.70658976", "0.70492727", "0.70477086", "0.7031399", "0.70128155", "0.69721", "0.689098", "0.6854276", "0.68506104", "0.6817795", "0.68166274", "0.6815821", "0.67701054", "0.6768377", "0.6766171", "0.6764873", "0.6763398", "0.6715136", "0.66801053", "0.66506386", "0.65923864", "0.6582167", "0.65820676", "0.65751195", "0.6565581", "0.65490365", "0.65475845", "0.6521791", "0.6516035", "0.6509358", "0.6497803", "0.64824605", "0.6477357", "0.6474532", "0.6457776", "0.6445286", "0.6444174", "0.6430453", "0.64251155", "0.6418634", "0.63826835", "0.63734573", "0.6371971", "0.63701266", "0.6358", "0.6356027", "0.63424426", "0.6335008", "0.63317734", "0.63307387", "0.6311735", "0.6304933", "0.6299668", "0.6285103", "0.6278953", "0.62782085", "0.6273995", "0.62701446", "0.6267252", "0.62610793", "0.6255534", "0.6253586", "0.6229887", "0.6218356", "0.6213556", "0.6207052", "0.6196318", "0.6190944", "0.6190504", "0.61840534", "0.61762226", "0.61745095", "0.617062", "0.61659867", "0.6160631", "0.6160631", "0.615878", "0.61487293", "0.6131803", "0.6123976", "0.61230785" ]
0.0
-1
Add a frame to the message (positioning it at the end of message). Any ZMQ::Message automatically gets copied out to a ruby string (user still responsible for original ZMQ::Message), strings are added directly.
def add(frame) msg_frame = convert_frame(frame) return nil if msg_frame.nil? @msg_frames << msg_frame self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(frame)\n msg_frame = convert_frame(frame)\n return nil if msg_frame.nil?\n @msg_frames.unshift(msg_frame)\n self\n end", "def push(frame)\n msg_frame = convert_frame(frame)\n return nil if msg_frame.nil?\n @msg_frames.unshift(msg_frame)\n self\n end", "def append(obj)\n raise 'Trying to append to an unitialized ZMessage!' if @zmsg.nil?\n\n if obj.is_a? String\n LibCZMQ.zmsg_addstr(@zmsg, obj)\n elsif obj.is_a? ZFrame\n LibCZMQ.zmsg_append(@zmsg, obj.__extract__)\n else\n raise ArgumentError, 'Unknown object type!'\n end\n end", "def send_text_frame message\n log_system_debug \"sending text frame: payload_length=#{message.bytesize}\" if $oversip_debug\n\n frame = \"\".encode ::Encoding::BINARY\n\n # byte1 = OPCODE_TO_INT[:text] | 0b10000000 => 129\n #\n # - FIN bit set.\n # - RSV1-3 bits not set.\n # - opcode = 1\n frame << 129\n\n length = message.bytesize\n if length <= 125\n frame << length # since rsv4 is 0\n elsif length < 65536 # write 2 byte length\n frame << 126\n frame << [length].pack('n')\n else # write 8 byte length\n frame << 127\n frame << [length >> 32, length & 0xFFFFFFFF].pack(\"NN\")\n end\n\n if message.encoding == ::Encoding::BINARY\n frame << message\n else\n frame << message.force_encoding(::Encoding::BINARY)\n end\n\n @connection.send_data frame\n true\n end", "def duplicate\n dup_frames = @msg_frames.map {|frame| frame.dup}\n ZMQ::StringMultipartMessage.new(dup_frames)\n end", "def push(obj)\n raise 'Trying to push in front of an unitialized ZMessage!' if @zmsg.nil?\n\n if obj.is_a? String\n LibCZMQ.zmsg_pushstr(@zmsg, obj)\n elsif obj.is_a? Array\n LibCZMQ.zmsg_pushmem(@zmsg, obj)\n elsif obj.is_a? ZFrame\n LibCZMQ.zmsg_push(@zmsg, obj.__extract__)\n else\n raise ArgumentError, 'Unknown object type!'\n end\n end", "def send_to(receiver, message)\n message = Message.coerce(message)\n message.prepend '' # separator frame\n message.prepend receiver # receiver envelope\n self << message\n end", "def msg_add(c)\n\t@msg_buf << c\n end", "def push frame\n raise TypeError unless frame.kind_of? Frame\n @avi.process_movi do |indices, movi|\n this_size = movi.size\n movi.pos = this_size\n movi.print frame.id\n movi.print [frame.data.size].pack('V')\n movi.print frame.data\n movi.print \"\\0\" if frame.data.size % 2 == 1\n indices << {\n :id => frame.id,\n :flag => frame.flag,\n :offset => this_size,\n :size => frame.data.size,\n }\n [indices, movi]\n end\n self\n end", "def net_message(message)\n @messages << message\n # Remove last element from messages history\n if messages.length > @history_length\n messages.shift\n messages.pop\n end\n end", "def send msg\n rencoded = REncode.dump([msg]).pack('C*')\n #rencoded = [193, 196, 1, 139, 100, 97, 101, 109, 111, 110, 46, 105, 110, 102, 111, 192, 102].pack('C*')\n compressed = Zlib::Deflate.deflate(rencoded)\n raw = compressed.bytes\n\n # all commented out stuff is for version 4, which we do not yet support\n # Store length as a signed integer (using 4 bytes), network byte order\n # header = [raw.length].pack('N').bytes\n\n #every message begins with an ASCII 'D'\n # header.insert(0, 'D'.ord)\n\n # header_str = header.pack('C*')\n message_str = raw.pack('C*')\n\n # puts \"Writing header:\"\n # p header_str.bytes\n # puts\n # puts \"Writing message:\"\n # p rencoded.bytes\n # puts\n\n\n # @con.write(header_str)\n @con.write(message_str)\n @con.flush\n\n nil\n end", "def insert buffer, text\n @frames[buffer].fillBuffer buffer, text\n end", "def pad(message)\n ml = message.size * 8\n\n message += 0x80.chr\n message += \"\\0\" * ((448 / 8 - message.size) & ((512 - 1) / 8))\n message += [ml].pack('Q>')\nend", "def add_frame(frame)\n end", "def add_to_message_queue(msg_type, socket_send_message)\n #message = [msg_type] # Cria o array de mensagens\n # Verifica todos os objetos em comum e partilha entre os jogadores\n # [:uuid, :x, :y, :direction].each do |instance|\n # # Pega cada instancia do objeto e adiciona na mensagem \n # end\n @messages.push << \"#{msg_type}|#{socket_send_message}\"\n p \" Messages Push --> #{msg_type}|#{socket_send_message}\"\n end", "def pad(message)\n ml = message.size * 8\n\n message += 0x80.chr\n message += \"\\0\" * ((448 / 8 - message.size) & ((512 - 1) / 8))\n message += [ml].pack('Q<')\nend", "def duplicate\n dup_frames = @msg_frames.map {|frame| frame.duplicate}\n ZMQ::RawMultipartMessage.new(dup_frames)\n end", "def write(message)\n @messages.unshift(message)\n end", "def append_message(mailbox, message, flags, date=nil)\n #raise ReadOnlyMailbox.new(mailbox) if @read_only\n @lock.synchronize do\n\n begin\n if(message =~ /^(From - ... ... .+?[0-9]{4}\\n)/ && date.nil?)\n timestr = $1\n message.gsub(/^#{timestr}/, '')\n timestr.chomp\n begin\n date = Time.parse(timestr)\n rescue\n date = Time.now\n end\n end\n imap.append(mailbox, message, flags, date)\n Logger.info(\"New message added to #{mailbox}\")\n rescue Object => boom\n Logger.warn(\"Failed to transer message to #{mailbox}: #{boom}\")\n end\n end\n end", "def add_to_message_queue(msg_type, socket_send_message)\n #message = [\"#{msg_type}|#{socket_send_message}|\\n\"] # Cria o array de mensagens\n # Verifica todos os objetos em comum e partilha entre os jogadores\n # [:uuid, :x, :y, :direction].each do |instance|\n # # Pega cada instancia do objeto e adiciona na mensagem \n # end\n @messages.push << \"#{msg_type}|#{socket_send_message}\"\n p \"CLIENT: Added to queue: #{@messages}\"\n end", "def add_frame(hash, name, string)\n $stderr.puts \"ID3V2.add_frame(name='#{name}',string=[#{string[0..255].inspect}...])\" if $DEBUG\n frame = ID3V24::Frame.create_frame_from_string(name, string)\n if hash.keys.include?(name)\n unless hash[name].is_a?(Array)\n hash[name] = [hash[name]]\n end\n hash[name] << frame\n else\n hash[name] = frame\n end\n end", "def write level, message\n now = Time.now\n usec = sprintf \"%06d\", now.usec\n timestamp = now.strftime \"%Y%m%d-%H:%M:%S.#{usec} %Z\"\n @message_queue << [ZMQ::Message.new(level.to_s), ZMQ::Message.new(timestamp), ZMQ::Message.new(message.to_s)]\n write_queue_to_socket\n end", "def <<(message)\n @mailbox << message\n end", "def process_message(message, connection)\n if(message.is_a?(FrameType::Message))\n distribution.register_message(message, connection.identifier)\n message.origin = current_actor\n end\n message\n end", "def enqueue_message(bytes, timestamp)\n if bytes.first.eql?(0xF0) || !@sysex_buffer.empty?\n @sysex_buffer += bytes\n if bytes.last.eql?(0xF7)\n bytes = @sysex_buffer.dup\n @sysex_buffer.clear\n end\n end\n # SINM ADDED\n @sysex_buffer.empty? ? get_message_formatted(bytes, timestamp) : nil\n # SINM COMMENTED OUT\n # @buffer << get_message_formatted(bytes, timestamp) if @sysex_buffer.empty?\n # @buffer\n end", "def push(a_msg)\n encoded_message = YAML::dump(a_msg)\n @queue.push(a_msg)\n end", "def format_msg_with_context(msg)\n if @context_hash.keys.length > 0\n msg_context = '['\n @context_hash.each do |k, v|\n msg_context += \"#{k}=#{v} \"\n end\n msg_context += '] '\n msg = msg.prepend(msg_context)\n end\n msg\n end", "def inject(frame)\n @sock.send(frame, 0)\n end", "def send_message(name,body,head={})\n message = DripDrop::Message.new(name,:body => body, :head => head).encoded\n if ZMQGEM == :rbzmq\n @socket.send name, ZMQ::SNDMORE\n @socket.send message\n else\n @socket.send_string name, ZMQ::SNDMORE\n @socket.send_string message\n end\n end", "def send_frame sequence_number\n if @sent[sequence_number] == 0\n @sent[sequence_number] = 1\n @buffer_len += 1\n\n if @buffer_len > @max_buffer_len\n @max_buffer_len = @buffer_len\n end\n end\n\n puts \"Sending frame #{sequence_number}\"\n @stats[:frames_sent] += 1\n\n if drop?\n @stats[:frames_dropped] += 1\n puts \"Dropped Frame\"\n return\n end\n\n # send from buffer\n @socket.puts \"#{sequence_number} #{checksum sequence_number} #{@number}\"\n\n to_send = String.new(@buffer[sequence_number])\n if rand(100) < @options[:error_rate] * 100\n @stats[:corrupted] += 1\n puts to_send.length\n puts to_send.getbyte(0)\n to_send.setbyte(0, to_send.getbyte(0) ^ 255)\n end\n\n # timeout for acknowledgement\n reset_timeout\n @socket.write to_send\n end", "def <<( object )\n\t\t\tself.frame << object\n\t\t\treturn self\n\t\tend", "def send_string label, message\n @publisher.send_string label, ZMQ::SNDMORE\n @publisher.send_string message\n end", "def message_buffer; end", "def inject(frame)\n\t\t@sock.send(frame, 0)\n\tend", "def put_message(payload, reply_queue_name = \"\")\n @queue_handle = open_queue(@queue_manager.connection_handle, @queue_name, Constants::MQOO_OUTPUT) if @queue_handle.nil?\n\n message_id = put_message_on_queue(@queue_manager.connection_handle, @queue_handle, payload, reply_queue_name)\n\n close_queue(@queue_manager.connection_handle, @queue_handle, Constants::MQCO_NONE)\n @queue_handle = nil\n\n message_id\n end", "def inject(frame)\n\t\t@sock.send(frame, 0)\n\tend", "def write_frame_nonblock frame\n ser = serializer.frame_to_bytes frame\n push_write_buffer ser, frame\n end", "def <<(message)\n if @thread.alive?\n @actorQueue << message\n @main.shift\n else \n raise DeadActor, \"Actor is dead!\"\n end\n end", "def addFrameNewBuffer fileLocation, fileName, fileContent, rights, serverSide, line, overWrite = false\n buffer = Buffer.new(fileLocation, fileName, fileContent,\n rights, serverSide, self)\n cursor = Cursor.new(self, buffer.fileContent, line)\n frame = Frame.new(cursor, overWrite)\n @frames[buffer] = frame\n buffer.id\n end", "def append(mailbox, message, flags=nil, date_time=nil)\n args = [to_utf7(mailbox)]\n args << flags if flags\n args << date_time if date_time\n args << Net::IMAP::Literal.new(message)\n tagged_response(\"APPEND\", *args)\n end", "def enqueue_message(message)\n socket.enqueue_packet(message)\n end", "def encode_message(type, body)\n if type.is_a? Integer\n type_num = type\n elsif type.is_a? String\n type_num = type.ord\n else\n fail ArgumentError, 'type must be a String or Integer'\n end\n\n [UNFRAGMENTED_HEADER, type_num ].pack('NC') + body\n end", "def build_message(type, body, flags=NLM_F_REQUEST, seq=next_seq, pid=@pid)\n body = body.to_str\n header = [\n body.bytesize + NLMSGHDR_SIZE,\n type, flags, seq, pid\n ].pack(NLMSGHDR_PACK)\n # assume the header is already aligned\n header + body\n end", "def add_message_send message\n @drb_messages_sent += 1\n\n msg = message.message\n argc = message.argument_count\n\n source = message.source\n destination = message.destination\n\n @last_peer_send[source][destination] = message.timestamp\n @last_sent_message[source][destination] = msg, argc, message.allocations\n end", "def queue message\n @buffer_semaphore.synchronize do\n @buffer += message\n end\n end", "def wrap(msg,len)\n finalmsg = [msg].pack(\"v\")\n finalLen = [len].pack(\"V\")\n return finalmsg+finalLen\nend", "def message_frame=(value)\n return unless GameData::Windows::MESSAGE_FRAME.include?(value)\n @message_frame = value\n $game_system&.windowskin_name = @message_frame\n end", "def raw(message)\n self.network << message\n end", "def make_message message\n prefix = \"#{@file_name}:\".dup\n\n tk = peek_tk\n prefix << \"#{tk[:line_no]}:#{tk[:char_no]}:\" if tk\n\n \"#{prefix} #{message}\"\n end", "def send_message(message)\n @socket.write(message)\n @socket.write(\"\\004\")\n end", "def send_string(string, flags = 0)\n string = string.to_s\n size = string.respond_to?(:bytesize) ? string.bytesize : string.size\n @msgbuf = LibC.malloc size\n @msgbuf.write_string string, size\n \n rc = LibZMQ.zmq_msg_init_data @msgptr, @msgbuf, size, LibC::Free, nil\n ZMQ.error_check true if rc==-1\n \n rc = LibZMQ.zmq_sendmsg @pointer, @msgptr, flags\n ZMQ.error_check true if rc==-1\n \n rc = LibZMQ.zmq_msg_close @msgptr\n ZMQ.error_check true if rc==-1\n end", "def send_message msg\n timeline << Spinoza::Event[actor: dst, time: time_now + latency,\n action: :recv, msg: msg]\n end", "def forward\n message = self.message.class.new(:subject => subject, :body => body)\n message.sender = receiver\n message\n end", "def encode_message(message)\n # create context buffer with encode headers\n ctx_buffer = encode_headers(message)\n headers_len = ctx_buffer.bytesize\n # encode payload\n if message.payload.length > MAX_PAYLOAD_LENGTH\n raise Aws::EventStream::Errors::EventPayloadLengthExceedError.new\n end\n ctx_buffer << message.payload.read\n total_len = ctx_buffer.bytesize + OVERHEAD_LENGTH\n\n # create message buffer with prelude section\n buffer = prelude(total_len, headers_len)\n\n # append message context (headers, payload)\n buffer << ctx_buffer.read\n # append message checksum\n buffer << pack_uint32(Zlib.crc32(buffer.read))\n\n # write buffered message to io\n buffer.rewind\n buffer\n end", "def send(message)\n length = sprintf(\"%-8d\", message.length)\n @socket.write(\"#{length}#{message}\")\n end", "def write_message(obj)\n semaphore.synchronize do\n new_message = write_trailing_message(obj)\n if new_message\n obj = obj.dup\n obj.message = new_message.chomp\n inject_headers!(obj)\n writer_for(obj).trailing = obj.trailing\n output << obj.message + \"\\n\"\n output.flush\n end\n end\n end", "def add_message(name, message)\n\t\tend", "def message_hex=(message_hex)\n self.message = [message_hex].pack('H*')\n end", "def << bytes\n @body << bytes\n end", "def send_message m\n @mutex.synchronize do\n @sinks.each { |sink| sink << m }\n @buf << m\n @buf = @buf[[(@buf.length - @keep_lines), 0].max .. -1]\n m\n end\n end", "def queue(message); end", "def append_buffer(buffer, hash)\n if hash['message'] != nil\n buffer['message'] << \" #{hash['message'].gsub(\"\\n\", ' ')}\"\n end\n end", "def pass_message(message, socket)\n begin\n formatted_message = {\n \"message\" => JSON.parse(message),\n \"socket_id\" => @sockets[socket]\n }.to_json\n rescue\n log_message(\"#{$!}\")\n end\n\n @redis.rpush(INBOX, formatted_message)\n end", "def encode\r\n self.offset *= -1 if self.negate\r\n actual_offset = self.offset\r\n\r\n # We invert the offset used if we are trying to decode the message\r\n actual_offset *= -1 if self.mode == :decode\r\n\r\n msg = self.message.chars.map do |ch|\r\n case ch\r\n when \"A\"..\"Z\"\r\n idx = ALPHABET_UPPER.index(ch)\r\n ALPHABET_UPPER[(idx + actual_offset) % 26]\r\n when \"a\"..\"z\"\r\n idx = ALPHABET_LOWER.index(ch)\r\n ALPHABET_LOWER[(idx + actual_offset) % 26]\r\n when \"0\"..\"9\"\r\n idx = NUMBERS.index(ch)\r\n NUMBERS[(idx + actual_offset) % 10]\r\n else\r\n ch\r\n end\r\n end.join\r\n\r\n self.print <<~HEREDOC\r\n Message #{ self.mode == :decode ? \"decoded\" : \"encoded\" } with offset #{ self.offset }:\r\n\r\n #{ msg }\r\n HEREDOC\r\n end", "def push_write_buffer data, frame\n @write_mutex.synchronize {\n update_last_write_activity if @write_buffer.empty?\n @write_buffer << [data, frame] unless @closing\n }\n end", "def send_message(message)\n socket.enqueue_packet(message)\n end", "def push(b)\n \n timeNow = Time.now\n \n if (@time - timeNow) > @tio\n @state = :idle \n end\n \n @time = timeNow\n \n case @state\n when :idle\n \n if b == Frame::FRAME_CHAR\n @state = :fsize_b1\n @rx = \"\"\n @info = \"\"\n end\n \n when :fsize_b1\n \n checksum_init\n checksum_next(b)\n @rx << b\n \n if (b & 0xf0) != 0xa0\n \n if b != FRAME::FRAME_CHAR\n\n log_error \"first byte of frame is invalid\"\n @state = :start_frame;\n \n end\n \n else\n \n @frame_size = ( (b & 0x7) << 8 )\n @segment = ( ((b & 0x8) == 0x8) ? true : false )\n @state = :fsize_b2\n \n end\n \n when :fsize_b2\n\n checksum_next(b)\n @rx << b\n\n @frame_size |= b \n\n if @frame_size < 6\n log_error \"frame will be too short\"\n @state = :start_frame\n else\n @state = :dest_b1\n end\n \n when :dest_b1\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @dest = OneByte.new(b >> 1)\n @state = :src_b1\n else\n @state = :dest_b2\n end\n \n when :dest_b2\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @dest = TwoByte.new(@rx[-2].to_i >> 1, b >> 1)\n @state = :src_b1\n else\n @state = :dest_b3\n end\n \n when :dest_b3\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n log_error \"invalid address length\"\n @state = :idle\n else\n @state = :dest_b4\n end\n \n when :dest_b4\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n @dest = FourByte.new((@rx[-4].to_i << 8) | @rx[-3].to_i, (@rx[-2].to_i << 8) | b)\n @state = :src_b1\n else\n log_error \"invalid address length\"\n @state = :idle\n end\n \n when :src_b1\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @src = OneByte.new(b >> 1)\n @state = :control\n else\n @state = :src_b2\n end\n \n when :src_b2\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @src = TwoByte.new(@rx[-2].to_i >> 1, b >> 1)\n @state = :control\n else\n @state = :src_b3\n end\n \n when :src_b3\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n log_error \"invalid address length\"\n @state = :idle\n else\n @state = :src_b4\n end\n \n when :src_b4\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n @src = FourByte.new((@rx[-4].to_i << 8) | @rx[-3].to_i, (@rx[-2].to_i << 8) | b)\n @state = :control\n else\n log_error \"invalid address length\"\n @state = :idle\n end\n \n when :control\n \n checksum_next(b)\n @rx << b\n @control = b\n @state = :hcs_b1\n \n when :hcs_b1\n \n checksum_next(b)\n @rx << b \n @state = :hcs_b2\n \n when :hcs_b2\n \n checksum_next(b)\n @rx << b \n \n if @fcs != 0xf0b8\n \n log_error \"invalid HCS\"\n @state = :start_frame\n \n elsif @frame_size == @rx.size\n \n @state = :end_frame\n \n else\n \n @state = :info\n \n end\n \n when :info\n \n checksum_next(b)\n @rx << b \n @info << b \n \n if @rx.size == (@frame_size - 2)\n \n @state = :fcs_b1\n \n end\n \n when :fcs_b1\n \n checksum_next(b)\n @rx << b \n @state = :fcs_b2\n \n when :fcs_b2\n \n checksum_next(b)\n @rx << b \n @state = :end_frame\n \n when :end_frame\n \n if b == Frame::FRAME_CHAR\n \n if @fcs == 0xf0b8\n \n begin\n \n f = Frame.from_decoder(self)\n \n # todo enforce rules for which frames are allowed certain fields\n \n yield(f) if block_given?\n \n rescue => e\n log_error \"#{e.exception}: #{e.message}\"\n log_error e.backtrace.join(\"\\n\")\n end\n \n else\n \n log_error \"invalid fcs\"\n \n end\n \n else\n \n log_error \"expecting end of frame\"\n \n end\n \n @state = :idle\n \n end\n \n self\n \n end", "def msg\n\treturn @msg_buf.dup()\n end", "def send_message(message)\n @logger.trace { \"<<< #{message}\" }\n s = message.dump\n #@logger.trace { \"<<< #{s.inspect} [#{s.size}] (#{s.encoding})\" }\n send_data(message.dump)\n self\n end", "def addFrame fileLocation, fileName, fileContent, rights, serverSide, line, overWrite = false\n buf = nil\n @frames.each do |buffer, frame|\n if buffer.fileLocation == fileLocation\n buf = buffer\n break\n end\n end\n if buf.nil?\n addFrameNewBuffer fileLocation, fileName, fileContent, rights, serverSide, line\n else\n addFrameExistingBuffer buf, line, overWrite\n end\n end", "def to_frame(frame)\r\n # checks if specified string parameter\r\n if frame.is_a?(String)\r\n if frame == \"last\"\r\n frame = @totalFrames - 1\r\n else\r\n frame = 0\r\n end\r\n end\r\n # sets frame\r\n frame = @totalFrames - 1 if frame >= @totalFrames\r\n frame = 0 if frame < 0\r\n @currentIndex = frame\r\n end", "def add message\n @events[message.sequence] = message\n end", "def forward\n message = self.class.new(:subject => subject, :body => body)\n message.sender = sender\n message\n end", "def enqueue_message(message); end", "def push(message)\n @queue.push(message)\n end", "def generate(frame)\n bytes = Buffer.new\n length = 0\n\n frame[:flags] ||= []\n frame[:stream] ||= 0\n\n case frame[:type]\n when :data\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n\n when :headers\n if frame[:priority]\n frame[:flags] += [:priority] if !frame[:flags].include? :priority\n end\n\n if frame[:flags].include? :priority\n bytes << [frame[:priority] & RBIT].pack(UINT32)\n length += 4\n end\n\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n\n when :priority\n bytes << [frame[:priority] & RBIT].pack(UINT32)\n length += 4\n\n when :rst_stream\n bytes << pack_error(frame[:error])\n length += 4\n\n when :settings\n if frame[:stream] != 0\n raise CompressionError.new(\"Invalid stream ID (#{frame[:stream]})\")\n end\n\n frame[:payload].each do |(k,v)|\n if !k.is_a? Integer\n k = DEFINED_SETTINGS[k]\n\n if k.nil?\n raise CompressionError.new(\"Unknown settings ID for #{k}\")\n end\n end\n\n bytes << [k & RBYTE].pack(UINT32)\n bytes << [v].pack(UINT32)\n length += 8\n end\n\n when :push_promise\n bytes << [frame[:promise_stream] & RBIT].pack(UINT32)\n bytes << frame[:payload]\n length += 4 + frame[:payload].bytesize\n\n when :ping\n if frame[:payload].bytesize != 8\n raise CompressionError.new(\"Invalid payload size \\\n (#{frame[:payload].size} != 8 bytes)\")\n end\n bytes << frame[:payload]\n length += 8\n\n when :goaway\n bytes << [frame[:last_stream] & RBIT].pack(UINT32)\n bytes << pack_error(frame[:error])\n length += 8\n\n if frame[:payload]\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n end\n\n when :window_update\n bytes << [frame[:increment] & RBIT].pack(UINT32)\n length += 4\n\n when :continuation\n bytes << frame[:payload]\n length += frame[:payload].bytesize\n end\n\n frame[:length] = length\n bytes.prepend(commonHeader(frame))\n end", "def push( message )\n context.push(message)\n self\n end", "def print(message)\n\t\ttime = Time.now\n\n\t\t@duration += (time - @lastMessageTime)\n\n\t\t@lastMessageTime = time\n\n\t\t@message = message\n\n\tend", "def message(text)\n @text_queue.push text\n end", "def <<(message)\n submit_message message\n self\n end", "def |(message)\n if @thread.alive?\n @actorQueue << message\n else \n raise DeadActor, \"Actor is dead!\"\n end\n end", "def puts(msg)\n @buffer << \"#{msg}\\n\"\n end", "def add_msg(msg, type = nil)\n ##### local message event\n puts msg\n $stdout.flush\n end", "def unshift_write_buffer data, frame\n @write_mutex.synchronize { @write_buffer.unshift [data, frame] }\n end", "def update_message(data); end", "def update_message(data); end", "def format_msg_with_context(msg)\n msg\n end", "def put(msg)\n socket.write(msg + \"\\n\") if socket\n end", "def encode_body(buffer)\n buffer << action.to_msgpack\n end", "def create_message(data); end", "def create_message(data); end", "def parse_body(length)\n @frame.body = @buffer[0...length]\n @buffer = @buffer[length+1..-1]\n @frames << @frame\n @frame = Frame.new\n end", "def write_message(message)\n\t\tupdate_screen_size\n\t\txpos = (@cols - message.length)/2\n\t\t@screen.attroff Curses::A_REVERSE\n\t\twrite_str(@rows-1,0,\" \"*@cols)\n\t\t@screen.attron Curses::A_REVERSE\n\t\twrite_str(@rows-1,xpos,message)\n\t\t@screen.attroff Curses::A_REVERSE\n\tend", "def encode_frame(stream_id=0, buffer=ByteBuffer.new, enable_compression)\n super(stream_id, buffer, false)\n end", "def stream(message)\n @messages = @messages.to_s + message\n end", "def push msg\n end", "def toString()\n @header[LENGTH - 1] = checksum()\n return @header + @message\n end", "def attach(frame)\n detach if attached?\n self.size = Rect.new(\n top: frame.top + frame.height - 1,\n left: frame.left,\n width: frame.width,\n height: 1\n )\n @frame = frame\n @frame.mini_buffer = self\n set_current_buffer(buffer)\n end", "def write_trailing_message(obj)\n if writer_for(obj).pending?\n continuation, new_message = obj.message.split(\"\\n\", 2)\n trailing = writer_for(obj).trailing!\n output << \"%s%s\\n\" % [trailing, continuation]\n new_message\n else\n obj.message\n end\n end" ]
[ "0.70751184", "0.70751184", "0.64102805", "0.6161355", "0.60879815", "0.59986806", "0.59584296", "0.58947015", "0.58887535", "0.5644586", "0.558231", "0.55789757", "0.5523461", "0.5521585", "0.5515992", "0.55045575", "0.5493586", "0.5429489", "0.5426171", "0.5420571", "0.54117", "0.5401949", "0.53590167", "0.5340518", "0.5325926", "0.52663577", "0.5257643", "0.5246857", "0.5242159", "0.52291757", "0.52253634", "0.5215931", "0.52066535", "0.5206252", "0.5205127", "0.5203159", "0.51921135", "0.5176235", "0.51630616", "0.5156151", "0.515049", "0.5139335", "0.513551", "0.5135004", "0.5103725", "0.5082875", "0.5069338", "0.5050075", "0.50346196", "0.5025197", "0.5019026", "0.5009435", "0.50074863", "0.5000695", "0.4999544", "0.49820858", "0.4978343", "0.49674425", "0.49643832", "0.49509257", "0.4948284", "0.4941842", "0.49325457", "0.4918729", "0.4914634", "0.49118376", "0.49079236", "0.49025002", "0.48897985", "0.48882306", "0.487762", "0.4870194", "0.48670125", "0.4865943", "0.48657858", "0.48596612", "0.4856695", "0.48553896", "0.48445168", "0.48444402", "0.48400366", "0.4838019", "0.48317054", "0.48253587", "0.4812367", "0.4812367", "0.48121735", "0.4812137", "0.48101893", "0.48046732", "0.48046732", "0.48036042", "0.47994155", "0.4797216", "0.47941998", "0.47906616", "0.47834158", "0.4783182", "0.47830856" ]
0.7219567
1
Add a frame to the front of the message. Frame can be either a string or a ZMQ::Message. The method copies out any string given in a ZMQ::Message (and the user is still in charge of properly closing such a message).
def push(frame) msg_frame = convert_frame(frame) return nil if msg_frame.nil? @msg_frames.unshift(msg_frame) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(frame)\n msg_frame = convert_frame(frame)\n return nil if msg_frame.nil?\n @msg_frames << msg_frame\n self\n end", "def add(frame)\n msg_frame = convert_frame(frame)\n return nil if msg_frame.nil?\n @msg_frames << msg_frame\n self\n end", "def push(obj)\n raise 'Trying to push in front of an unitialized ZMessage!' if @zmsg.nil?\n\n if obj.is_a? String\n LibCZMQ.zmsg_pushstr(@zmsg, obj)\n elsif obj.is_a? Array\n LibCZMQ.zmsg_pushmem(@zmsg, obj)\n elsif obj.is_a? ZFrame\n LibCZMQ.zmsg_push(@zmsg, obj.__extract__)\n else\n raise ArgumentError, 'Unknown object type!'\n end\n end", "def duplicate\n dup_frames = @msg_frames.map {|frame| frame.dup}\n ZMQ::StringMultipartMessage.new(dup_frames)\n end", "def push frame\n raise TypeError unless frame.kind_of? Frame\n @avi.process_movi do |indices, movi|\n this_size = movi.size\n movi.pos = this_size\n movi.print frame.id\n movi.print [frame.data.size].pack('V')\n movi.print frame.data\n movi.print \"\\0\" if frame.data.size % 2 == 1\n indices << {\n :id => frame.id,\n :flag => frame.flag,\n :offset => this_size,\n :size => frame.data.size,\n }\n [indices, movi]\n end\n self\n end", "def append(obj)\n raise 'Trying to append to an unitialized ZMessage!' if @zmsg.nil?\n\n if obj.is_a? String\n LibCZMQ.zmsg_addstr(@zmsg, obj)\n elsif obj.is_a? ZFrame\n LibCZMQ.zmsg_append(@zmsg, obj.__extract__)\n else\n raise ArgumentError, 'Unknown object type!'\n end\n end", "def insert buffer, text\n @frames[buffer].fillBuffer buffer, text\n end", "def add_frame(frame)\n end", "def enqueue_message(bytes, timestamp)\n if bytes.first.eql?(0xF0) || !@sysex_buffer.empty?\n @sysex_buffer += bytes\n if bytes.last.eql?(0xF7)\n bytes = @sysex_buffer.dup\n @sysex_buffer.clear\n end\n end\n # SINM ADDED\n @sysex_buffer.empty? ? get_message_formatted(bytes, timestamp) : nil\n # SINM COMMENTED OUT\n # @buffer << get_message_formatted(bytes, timestamp) if @sysex_buffer.empty?\n # @buffer\n end", "def net_message(message)\n @messages << message\n # Remove last element from messages history\n if messages.length > @history_length\n messages.shift\n messages.pop\n end\n end", "def duplicate\n dup_frames = @msg_frames.map {|frame| frame.duplicate}\n ZMQ::RawMultipartMessage.new(dup_frames)\n end", "def forward\n message = self.message.class.new(:subject => subject, :body => body)\n message.sender = receiver\n message\n end", "def send_to(receiver, message)\n message = Message.coerce(message)\n message.prepend '' # separator frame\n message.prepend receiver # receiver envelope\n self << message\n end", "def forward\n message = self.class.new(:subject => subject, :body => body)\n message.sender = sender\n message\n end", "def write(message)\n @messages.unshift(message)\n end", "def inject(frame)\n\t\t@sock.send(frame, 0)\n\tend", "def inject(frame)\n\t\t@sock.send(frame, 0)\n\tend", "def inject(frame)\n @sock.send(frame, 0)\n end", "def pushback(string)\n raise RMail::Parser::Error,\n 'You have already pushed a string back.' if @pushback\n @pushback = string\n end", "def process_message(message, connection)\n if(message.is_a?(FrameType::Message))\n distribution.register_message(message, connection.identifier)\n message.origin = current_actor\n end\n message\n end", "def unwrap\n frame = pop\n if @msg_frames.first.size == 0\n pop\n end\n frame\n end", "def enqueue_message(message)\n socket.enqueue_packet(message)\n end", "def addFrameNewBuffer fileLocation, fileName, fileContent, rights, serverSide, line, overWrite = false\n buffer = Buffer.new(fileLocation, fileName, fileContent,\n rights, serverSide, self)\n cursor = Cursor.new(self, buffer.fileContent, line)\n frame = Frame.new(cursor, overWrite)\n @frames[buffer] = frame\n buffer.id\n end", "def unshift_write_buffer data, frame\n @write_mutex.synchronize { @write_buffer.unshift [data, frame] }\n end", "def add_frame(hash, name, string)\n $stderr.puts \"ID3V2.add_frame(name='#{name}',string=[#{string[0..255].inspect}...])\" if $DEBUG\n frame = ID3V24::Frame.create_frame_from_string(name, string)\n if hash.keys.include?(name)\n unless hash[name].is_a?(Array)\n hash[name] = [hash[name]]\n end\n hash[name] << frame\n else\n hash[name] = frame\n end\n end", "def to_frame(frame)\r\n # checks if specified string parameter\r\n if frame.is_a?(String)\r\n if frame == \"last\"\r\n frame = @totalFrames - 1\r\n else\r\n frame = 0\r\n end\r\n end\r\n # sets frame\r\n frame = @totalFrames - 1 if frame >= @totalFrames\r\n frame = 0 if frame < 0\r\n @currentIndex = frame\r\n end", "def send_text_frame message\n log_system_debug \"sending text frame: payload_length=#{message.bytesize}\" if $oversip_debug\n\n frame = \"\".encode ::Encoding::BINARY\n\n # byte1 = OPCODE_TO_INT[:text] | 0b10000000 => 129\n #\n # - FIN bit set.\n # - RSV1-3 bits not set.\n # - opcode = 1\n frame << 129\n\n length = message.bytesize\n if length <= 125\n frame << length # since rsv4 is 0\n elsif length < 65536 # write 2 byte length\n frame << 126\n frame << [length].pack('n')\n else # write 8 byte length\n frame << 127\n frame << [length >> 32, length & 0xFFFFFFFF].pack(\"NN\")\n end\n\n if message.encoding == ::Encoding::BINARY\n frame << message\n else\n frame << message.force_encoding(::Encoding::BINARY)\n end\n\n @connection.send_data frame\n true\n end", "def <<( object )\n\t\t\tself.frame << object\n\t\t\treturn self\n\t\tend", "def unwrap\n frame = pop\n if @msg_frames.first.empty?\n empty = pop\n empty.close\n end\n frame\n end", "def message_frame=(value)\n return unless GameData::Windows::MESSAGE_FRAME.include?(value)\n @message_frame = value\n $game_system&.windowskin_name = @message_frame\n end", "def msg_add(c)\n\t@msg_buf << c\n end", "def write_frame_nonblock frame\n ser = serializer.frame_to_bytes frame\n push_write_buffer ser, frame\n end", "def attach(frame)\n detach if attached?\n self.size = Rect.new(\n top: frame.top + frame.height - 1,\n left: frame.left,\n width: frame.width,\n height: 1\n )\n @frame = frame\n @frame.mini_buffer = self\n set_current_buffer(buffer)\n end", "def send_message(name,body,head={})\n message = DripDrop::Message.new(name,:body => body, :head => head).encoded\n if ZMQGEM == :rbzmq\n @socket.send name, ZMQ::SNDMORE\n @socket.send message\n else\n @socket.send_string name, ZMQ::SNDMORE\n @socket.send_string message\n end\n end", "def <<(message)\n if @thread.alive?\n @actorQueue << message\n @main.shift\n else \n raise DeadActor, \"Actor is dead!\"\n end\n end", "def pushback(data)\n @pushback_buffer << data\n end", "def enqueue_message(message); end", "def make_message message\n prefix = \"#{@file_name}:\".dup\n\n tk = peek_tk\n prefix << \"#{tk[:line_no]}:#{tk[:char_no]}:\" if tk\n\n \"#{prefix} #{message}\"\n end", "def frame_chain!\n @frame_chain\n end", "def addFrame fileLocation, fileName, fileContent, rights, serverSide, line, overWrite = false\n buf = nil\n @frames.each do |buffer, frame|\n if buffer.fileLocation == fileLocation\n buf = buffer\n break\n end\n end\n if buf.nil?\n addFrameNewBuffer fileLocation, fileName, fileContent, rights, serverSide, line\n else\n addFrameExistingBuffer buf, line, overWrite\n end\n end", "def addFrameExistingBuffer buffer, line, overWrite\n cursor = Cursor.new(self, buffer.fileContent, line)\n frame = Frame.new(cursor, overWrite)\n buffer.addWorkingUser self\n @frames[buffer] = frame\n buffer.id\n end", "def ack_frame *args\n create_ack_or_nack 'ACK', args\n end", "def queue(message); end", "def adjust_frame(frame_num, absolute_pos)\n frame, frame_num = get_frame(frame_num, absolute_pos)\n if frame \n @frame = frame\n @frame.index = frame_num\n prefix = \"--> ##{frame_num} \" \n unless @settings[:traceprint]\n msg(\"#{prefix}%s\" %\n @frame.describe(:basename => settings[:basename],\n :maxwidth => settings[:maxwidth] - prefix.size,\n :callstyle => settings[:callstyle]))\n end\n @line_no = @frame.line\n @frame\n else\n nil\n end\n end", "def initialize_copy(orig)\n super\n unless @zmsg.nil?\n @zmsg = LibCZMQ.zmsg_dup(@zmsg)\n end\n end", "def send_string label, message\n @publisher.send_string label, ZMQ::SNDMORE\n @publisher.send_string message\n end", "def |(message)\n if @thread.alive?\n @actorQueue << message\n else \n raise DeadActor, \"Actor is dead!\"\n end\n end", "def append_message(mailbox, message, flags, date=nil)\n #raise ReadOnlyMailbox.new(mailbox) if @read_only\n @lock.synchronize do\n\n begin\n if(message =~ /^(From - ... ... .+?[0-9]{4}\\n)/ && date.nil?)\n timestr = $1\n message.gsub(/^#{timestr}/, '')\n timestr.chomp\n begin\n date = Time.parse(timestr)\n rescue\n date = Time.now\n end\n end\n imap.append(mailbox, message, flags, date)\n Logger.info(\"New message added to #{mailbox}\")\n rescue Object => boom\n Logger.warn(\"Failed to transer message to #{mailbox}: #{boom}\")\n end\n end\n end", "def prepend!(buffer)\n @str = buffer.to_s + @str\n self\n end", "def prepend!(buffer)\n @str = buffer.to_s + @str\n self\n end", "def push(value)\n case value[0]\n when :CONTENT, :STRING_LITERAL\n value[1].gsub!(/\\n\\s*/, ' ') if strip_line_breaks?\n\n if !@stack.empty? && value[0] == @stack[-1][0]\n @stack[-1][1] << value[1]\n else\n @stack.push(value)\n end\n when :ERROR\n @stack.push(value) if @include_errors\n leave_object\n when :META_CONTENT\n @stack.push(value) if @include_meta_content\n else\n @stack.push(value)\n end\n\n self\n end", "def shift non_block=false\n @messages.shift(non_block)\n end", "def prepend_queue(address,cmd)\n\t \tqueue = eval \"@cmd_queue_#{address}\"\n\t \tqueue.unshift(cmd)\n\t end", "def prepare_parsed_frame frame\n force_body_encoding frame\n end", "def enqueue_received_message(message,queue=received_message_queue)\n enqueue(message,queue)\n end", "def put_message(payload, reply_queue_name = \"\")\n @queue_handle = open_queue(@queue_manager.connection_handle, @queue_name, Constants::MQOO_OUTPUT) if @queue_handle.nil?\n\n message_id = put_message_on_queue(@queue_manager.connection_handle, @queue_handle, payload, reply_queue_name)\n\n close_queue(@queue_manager.connection_handle, @queue_handle, Constants::MQCO_NONE)\n @queue_handle = nil\n\n message_id\n end", "def <<(message)\n @mailbox << message\n end", "def push(a_msg)\n encoded_message = YAML::dump(a_msg)\n @queue.push(a_msg)\n end", "def tell(message)\n message message, nil\n end", "def tell(message)\n message message, nil\n end", "def forward(payload)\n @forwarded << payload\n end", "def push(b)\n \n timeNow = Time.now\n \n if (@time - timeNow) > @tio\n @state = :idle \n end\n \n @time = timeNow\n \n case @state\n when :idle\n \n if b == Frame::FRAME_CHAR\n @state = :fsize_b1\n @rx = \"\"\n @info = \"\"\n end\n \n when :fsize_b1\n \n checksum_init\n checksum_next(b)\n @rx << b\n \n if (b & 0xf0) != 0xa0\n \n if b != FRAME::FRAME_CHAR\n\n log_error \"first byte of frame is invalid\"\n @state = :start_frame;\n \n end\n \n else\n \n @frame_size = ( (b & 0x7) << 8 )\n @segment = ( ((b & 0x8) == 0x8) ? true : false )\n @state = :fsize_b2\n \n end\n \n when :fsize_b2\n\n checksum_next(b)\n @rx << b\n\n @frame_size |= b \n\n if @frame_size < 6\n log_error \"frame will be too short\"\n @state = :start_frame\n else\n @state = :dest_b1\n end\n \n when :dest_b1\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @dest = OneByte.new(b >> 1)\n @state = :src_b1\n else\n @state = :dest_b2\n end\n \n when :dest_b2\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @dest = TwoByte.new(@rx[-2].to_i >> 1, b >> 1)\n @state = :src_b1\n else\n @state = :dest_b3\n end\n \n when :dest_b3\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n log_error \"invalid address length\"\n @state = :idle\n else\n @state = :dest_b4\n end\n \n when :dest_b4\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n @dest = FourByte.new((@rx[-4].to_i << 8) | @rx[-3].to_i, (@rx[-2].to_i << 8) | b)\n @state = :src_b1\n else\n log_error \"invalid address length\"\n @state = :idle\n end\n \n when :src_b1\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @src = OneByte.new(b >> 1)\n @state = :control\n else\n @state = :src_b2\n end\n \n when :src_b2\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1\n @src = TwoByte.new(@rx[-2].to_i >> 1, b >> 1)\n @state = :control\n else\n @state = :src_b3\n end\n \n when :src_b3\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n log_error \"invalid address length\"\n @state = :idle\n else\n @state = :src_b4\n end\n \n when :src_b4\n \n checksum_next(b)\n @rx << b\n \n if (b & 1) == 1 \n @src = FourByte.new((@rx[-4].to_i << 8) | @rx[-3].to_i, (@rx[-2].to_i << 8) | b)\n @state = :control\n else\n log_error \"invalid address length\"\n @state = :idle\n end\n \n when :control\n \n checksum_next(b)\n @rx << b\n @control = b\n @state = :hcs_b1\n \n when :hcs_b1\n \n checksum_next(b)\n @rx << b \n @state = :hcs_b2\n \n when :hcs_b2\n \n checksum_next(b)\n @rx << b \n \n if @fcs != 0xf0b8\n \n log_error \"invalid HCS\"\n @state = :start_frame\n \n elsif @frame_size == @rx.size\n \n @state = :end_frame\n \n else\n \n @state = :info\n \n end\n \n when :info\n \n checksum_next(b)\n @rx << b \n @info << b \n \n if @rx.size == (@frame_size - 2)\n \n @state = :fcs_b1\n \n end\n \n when :fcs_b1\n \n checksum_next(b)\n @rx << b \n @state = :fcs_b2\n \n when :fcs_b2\n \n checksum_next(b)\n @rx << b \n @state = :end_frame\n \n when :end_frame\n \n if b == Frame::FRAME_CHAR\n \n if @fcs == 0xf0b8\n \n begin\n \n f = Frame.from_decoder(self)\n \n # todo enforce rules for which frames are allowed certain fields\n \n yield(f) if block_given?\n \n rescue => e\n log_error \"#{e.exception}: #{e.message}\"\n log_error e.backtrace.join(\"\\n\")\n end\n \n else\n \n log_error \"invalid fcs\"\n \n end\n \n else\n \n log_error \"expecting end of frame\"\n \n end\n \n @state = :idle\n \n end\n \n self\n \n end", "def consume_remaining_buffer(stack, buf)\n return if buf.length == 0\n stack << buf.dup\n buf.replace('')\n end", "def mark_message(message)\n self.message = message\n end", "def nack_frame *args\n create_ack_or_nack 'NACK', args\n end", "def enqueue_message(obj)\n output_queue << obj\n end", "def pass_message(message, socket)\n begin\n formatted_message = {\n \"message\" => JSON.parse(message),\n \"socket_id\" => @sockets[socket]\n }.to_json\n rescue\n log_message(\"#{$!}\")\n end\n\n @redis.rpush(INBOX, formatted_message)\n end", "def forward_message(message, forward_hash)\n get edit_message_path(message)\n assert_response :success\n assert_template \"edit\"\n patch message_path, message: forward_hash\n original_message = assigns(:message) # message being forwarded\n new_message = original_message.copies.first # message created by forward\n assert new_message.valid?\n assert_response :redirect\n assert_redirected_to mailbox_in_messages_path\n follow_redirect!\n assert_response :success\n assert_template \"mailbox_in\"\n return new_message\n end", "def push(item)\n @stack.unshift(item)\n self.top = @stack[0]\n end", "def frame=(pos); end", "def push(new)\n @stack.unshift(new)\n self\n end", "def receive_frame(frame)\n ioframe = StringIO.new frame\n begin\n command = RTunnel::Command.decode ioframe\n rescue Exception => e\n receive_bad_frame frame, e\n return\n end\n if @in_command_hasher\n signature = ioframe.read\n if signature != @in_command_hasher.hash(frame[0...(-signature.length)])\n receive_bad_frame frame, :bad_signature\n return\n end\n end\n receive_command command\n end", "def send(frame)\n send_connection_preface\n super(frame)\n end", "def forward(offset = 1)\n self[offset]\n @buffer.slice!(0, offset)\n end", "def prepend(name, content = nil, &block)\n content = capture(&block) if block_given?\n add_instruction_to_area name, :unshift, content\n end", "def message(text)\n @text_queue.push text\n end", "def header(message)\n puts \"\\n\"\n puts '+---'\n puts \"| #{message}\"\n puts '+---'\nend", "def add_bottom (card)\n @cards.unshift(card);\n end", "def to_destination(destination)\n @monitor.synchronize {\n # Frames are adjusted (-1) so that the message is tagged as\n # coming from this routine.\n destination.accept(Message.new(\"==== Beginning of buffer contents.\",\n \"\", \"announce\", -1))\n messages.each do | msg |\n destination.accept(msg)\n end\n destination.accept(Message.new(\"==== End of buffer contents.\",\n \"\", \"announce\", -1))\n }\n end", "def initialize( sender_id, conn_id, body='' )\n\t\t\t@frame = Mongrel2::WebSocket::Frame.new( body )\n\t\t\tsuper( sender_id, conn_id, @frame.payload )\n\t\tend", "def <<(message)\n submit_message message\n self\n end", "def comment(comment)\r\n # Do nothing unless we're currently working on a <packet> element or one of its children\r\n return unless @element_stack.length > 0\r\n\r\n @element_stack.last.add(Comment.new(comment))\r\n end", "def enqueue_packet(payload); end", "def push(message)\n @queue.push(message)\n end", "def message_buffer; end", "def prepend(hash_stack)\n @stack.unshift *hash_stack.stack\n self\n end", "def convert_stack_frame frame\n TraceProtos::StackTrace::StackFrame.new \\\n function_name: make_truncatable_string(frame.label),\n file_name: make_truncatable_string(frame.path),\n line_number: frame.lineno\n end", "def << message; write UNKNOWN, message, caller[0] end", "def user_message_begin(msg)\n user_message(msg, 0, \">>>\")\n end", "def forward_messages(from, to)\n msg = from.recv()\n\n while from.getsockopt(ZMQ::RCVMORE)\n to.send(msg, ZMQ::SNDMORE)\n msg = from.recv()\n end\n\n to.send(msg)\nend", "def add(content)\n @back = content\n\n store\n\n true\n end", "def append(mailbox, message, flags=nil, date_time=nil)\n args = [to_utf7(mailbox)]\n args << flags if flags\n args << date_time if date_time\n args << Net::IMAP::Literal.new(message)\n tagged_response(\"APPEND\", *args)\n end", "def push(position = nil)\n @stack.push current.dup\n seek(position)\n\n self\n end", "def frame(text, char)\n\n longest_word_length = (text.map { |w| w.length }.max)\n frame_width = longest_word_length + 4\n\n frame_top_bottom = char*(frame_width)\n frame_arr = []\n\n #top of frame\n frame_arr.push(\"#{frame_top_bottom}\\n\")\n\n #middle of frame (content and the sides of the frame)\n text.each do |word|\n diff = longest_word_length - word.length\n spaces = ' '*diff\n frame_arr.push(\"#{char} #{word} #{spaces}#{char}\\n\")\n end\n\n #bottom of frame\n frame_arr.push(\"#{frame_top_bottom}\")\n frame_arr.join\nend", "def add_to_front(node)\n node.set_next(@head)\n @head = node\n end", "def add_message(text,name=nil)\n debug \"add message\"\n puts \"WWWTHUNHEOUTSN\"\n puts @glade['scrolledwindow1'].hadjustment.value\n puts @glade['scrolledwindow1'].hadjustment.upper\n puts @glade['scrolledwindow1'].hadjustment.lower\n @talk.buffer.insert @talk.buffer.end_iter,\"#{name || @contact.name}: \", @nickname_tag\n @talk.buffer.insert @talk.buffer.end_iter, \"#{text}\\n\"\n end", "def queue message\n @buffer_semaphore.synchronize do\n @buffer += message\n end\n end", "def push( message )\n context.push(message)\n self\n end", "def add_msg(msg, type = nil)\n ##### local message event\n puts msg\n $stdout.flush\n end" ]
[ "0.6618648", "0.6618648", "0.59120953", "0.5898879", "0.58269763", "0.57802206", "0.5601004", "0.54635406", "0.5391144", "0.53286916", "0.5303479", "0.5247716", "0.5223775", "0.5216274", "0.51866853", "0.512249", "0.51193976", "0.5116066", "0.5103631", "0.50944704", "0.5065478", "0.4968711", "0.49669632", "0.49434412", "0.49342602", "0.49007013", "0.4900678", "0.48992583", "0.4891586", "0.48862365", "0.48728985", "0.48689342", "0.48630065", "0.48598516", "0.48368365", "0.48323396", "0.4831048", "0.4826189", "0.48203185", "0.481158", "0.48021942", "0.4788311", "0.4761419", "0.4740842", "0.4733849", "0.47087818", "0.4702801", "0.4678592", "0.4673452", "0.4673452", "0.46720555", "0.467013", "0.46527743", "0.46286017", "0.4627175", "0.45996085", "0.45976582", "0.4592567", "0.45697552", "0.45697552", "0.45697373", "0.45602924", "0.4557486", "0.45505422", "0.45481634", "0.4528501", "0.45137906", "0.45015827", "0.44925788", "0.44891116", "0.44869947", "0.44860363", "0.44846225", "0.44797707", "0.4475178", "0.44546893", "0.44522187", "0.44398344", "0.44352508", "0.4431017", "0.44192865", "0.441477", "0.44059247", "0.44016567", "0.4382976", "0.43786442", "0.4375916", "0.43744183", "0.4373186", "0.4370099", "0.43603617", "0.4346499", "0.4344952", "0.43425462", "0.43372336", "0.4329251", "0.43286583", "0.43271", "0.43269038" ]
0.72565156
1
Remove the address from the front of a message. Takes care of also removing any empty frame.
def unwrap frame = pop if @msg_frames.first.size == 0 pop end frame end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_pre_address(address)\n address = address.sub(/^\\s*mail\\:\\s*/i, '')\n address.gsub(/.*\\,\\s+(\\d+\\b\\s+\\w)/i, '\\1')\n end", "def remove_message(name)\n\t\tend", "def remove_prefix(msg)\n msg.sub(PREFIX_REGEX, \"|\")\n end", "def remove_original_address(opts)\n opts = check_params(opts,[:addresses])\n super(opts)\n end", "def unreceive message, headers={}\n end", "def clean_message\n self.message = Loofah.fragment(self.message).scrub!(:strip).text\n end", "def remove message\n @events.delete message.sequence\n end", "def remove_envelope(message)\n generator.strip(message)\n end", "def backtrace_remove=(_arg0); end", "def remove_all_original_addresses\n super\n end", "def sip_sanitize_address(addr)\n\t\tif ( addr =~ /:/ )\n\t\t\treturn addr.scan(/.*:(.*)/)[0][0]\n\t\tend\n\t\treturn addr\n\tend", "def normalize_message(message)\n remove_line_number(normalize_caller(normalize_callstack_path(message)))\n end", "def remove_from_friends_list(email)\n send_contact_command email, 'RML', '1'\n end", "def remove_appended_messages(text)\n return nil if text.nil? || text.empty?\n string = text.to_s # ensure we have a string\n\n # ------------ Original Message ------------\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+[-=]+.*Original Message.*/mi, ''\n\n # ------------ Forwarded Message ------------\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+[-=]+.*Forwarded Message.*/mi, ''\n\n # From: Seth Vargo <svargo@andrew.cmu.edu>\n # Send: Tues, Oct 9, 2012\n # To: Robbin Stormer <a@example.com>\n # Subject: Cookies and Cream\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+From:.*Sent:.*(To:.*)?.*(Cc:.*)?.*(Subject:.*)?.*/im, ''\n\n # On Oct 9, 2012, at 6:48 PM, Robbin Stormer wrote:\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+On.+at.+wrote:.*/mi, ''\n\n # Begin forwarded message:\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+Begin\\ forwarded\\ message:.*/mi, ''\n string.strip!\n string\n end", "def remove_front\n @head = @head.next\n end", "def remove_front\n @head = @head.next if @head\n end", "def remove_front\n @head = @head.next if @head\n end", "def supprimerMessage(indice)\r\n\t\t@lstMessages.delete(indice) if @lstMessages.has_key?(indice)\r\n\tend", "def remove_front\n if (@head)\n @head = @head.next\n end\n end", "def net_message(message)\n @messages << message\n # Remove last element from messages history\n if messages.length > @history_length\n messages.shift\n messages.pop\n end\n end", "def remove_email_forward(source)\n validate_list([[\"Source\", source, :email] ])\n\n options = { \"Source\" => source }\n\n connection = Connection.new\n connection.post(\"Domain/EmailForward/Remove\", options)\n end", "def trim_capture_message(item_with_capture_message)\n item_with_capture_message[0,2]\n end", "def remove_front\n placeholder = @head\n @head = placeholder.next\n return placeholder\n end", "def clean_message(message); end", "def remove_prefix(other)\n tail = dup\n Pointer.new(other).to_a.each do |segment|\n return nil unless tail.shift == segment\n end\n tail\n end", "def undo buffer\n @frames[buffer].undo buffer\n end", "def pop_af\n end", "def backtrace_remove; end", "def delete_address(address)\n address.delete!\n end", "def remove_front\n self.head = self.head.next\n end", "def remove_front\n temp = @head\n @head.next = nil # This is for memory managment purposes\n @head = temp\n end", "def remove_front\n if @head == nil\n return nil\n end\n front = @head\n @head = front.next\n front\n end", "def remove_frame(frame)\n end", "def unbind\n # totally broken.\n @buffer.chomp!\n while(@buffer.length > 0) do\n # 3 bytes for header\n # 32 bytes for token\n # 2 bytes for json length\n \n # taking the last is acceptable because we know it's never\n # longer than 256 bytes from the apple documentation.\n json_length = @buffer.slice(35,37).unpack('CC').last\n chunk = @buffer.slice!(0,json_length + 3 + 32 + 2)\n if notification = APND::Notification.valid?(chunk)\n APND.logger \"#{@address.last}:#{@address.first} added new Notification to queue\"\n queue.push(notification)\n else\n APND.logger \"#{@address.last}:#{@address.first} submitted invalid Notification\"\n end\n @buffer.strip!\n end\n APND.logger \"#{@address.last}:#{@address.first} closed connection\"\n end", "def delete_front()\n \n end", "def dead_letter_address=(address)\n with_queue_control do |control|\n control.set_dead_letter_address(address)\n end\n\n dead_letter_address\n end", "def remove\n @stack.pop\n end", "def remove\n @stack.pop\n end", "def remove_edge(from, to)\n\t\t\t@size -= 1 if disconnect(from, to)\n\t\t\tself\n\t\tend", "def remove_message_reaction(data); end", "def pop\n delete_at(0)\n end", "def pop(a)\n @client.sendmsg(\"POP #{a}\\n\")\n decode(read_response)\n end", "def clean(backtrace)\n filtered = filter_backtrace(backtrace)\n\n backtrace.reverse.map do |trace_line|\n in_app = frame_in_app?(trace_line)\n [trace_line, in_app]\n end\n end", "def pop\n return nil if empty?\n @anchor.prev_node.delete\n end", "def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\t@head.next = nil || element.next\n\t\t\telement\n\t\tend", "def remove_front\n self.head = self.head.next\n if self.head == nil\n self.tail = nil\n end\n end", "def pop\r\n ret = peek\r\n @buffer = nil\r\n ret\r\n end", "def remove\n if @pop_stack.is_empty?\n transfer(@push_stack, @pop_stack)\n end\n\n @pop_stack.pop\n end", "def clear()\n @fields = []\n @mbox_from = nil\n self\n end", "def clean_buffer; self.input_buffer = self.input_buffer[self.input_buffer.length-4,self.input_buffer.length-1]; end", "def unreceive(message=nil)\n for msg, receivers in SendReceive.registry\n next if message and message.to_s != msg\n receivers.delete_if { |_, max_object| max_object == $max_object } # $max_object is the current max object\n end\n end", "def delete_translation_address\n super\n end", "def reset_message\n @recipient_variables = {}\n @message.delete('recipient-variables')\n @message.delete(:to)\n @message.delete(:cc)\n @message.delete(:bcc)\n @counters[:recipients][:to] = 0\n @counters[:recipients][:cc] = 0\n @counters[:recipients][:bcc] = 0\n end", "def message_from_queue\n if msg = @connection.pop\n message = msg.body.delete(\"\\n\")\n msg.finish\n message\n end\n end", "def remove_proto( url )\n url\n #begin\n # url = URI.parse( url )\n # scheme = url.scheme + '://'\n # escape( url.to_s.gsub( scheme, '' ) )\n #rescue\n # return url\n #end\n end", "def unfollow(actor)\n contact = contact_to!(actor)\n contact.update_column(:blocked, true)\n contact\n end", "def delete_at(p0) end", "def del_msg_name( msgName )\n @msgNames.delete msgName if defined? @msgNames\n end", "def delete_before\r\n return nil if @cursor == 0\r\n result = @buffer.delete_at(@cursor - 1)\r\n @buffer.compact! #needed?\r\n @cursor = @cursor - 1 if result != nil\r\n result\r\n end", "def remover_item\n # Remove um item do final do buffer\n BUFFER.pop\n end", "def pop_front\n return nil if @size.zero?\n\n temp = @head.data\n @head = if @size == 1\n @tail = nil\n else\n @head.next\n end\n @size -= 1\n temp\n end", "def wipe_leading_adjective\n @leading_adjective = nil\n end", "def unreceive(message, options = {})\n @connection.unreceive(message, options)\n end", "def clear!\n visit(@address)\n reset_session!\n end", "def strip_note!(data_array)\n data_array.pop\n end", "def remove_leading(node_or_range, size)\n range = to_range(node_or_range)\n to_remove = Parser::Source::Range.new(range.source_buffer,\n range.begin_pos,\n range.begin_pos + size)\n @source_rewriter.remove(to_remove)\n end", "def pop\n\t\t@stack.pop.cleaup\n\tend", "def fix(address)\n @address = address\n end", "def fix(address)\n @address = address\n end", "def forward(offset = 1)\n self[offset]\n @buffer.slice!(0, offset)\n end", "def delete\n # Note that $curbuf does not point to the buffer that is being deleted;\n # we need to use Vim's <abuf> for the correct buffer number.\n current = ::VIM::evaluate('expand(\"<abuf>\")').to_i\n stack.delete_if { |number| number == current }\n end", "def remove_friend\n end", "def pop\n new_tail = at(size - 2)\n old_tail = tail\n puts \"#{old_tail.data} is now gone!\"\n set_tail(new_tail)\n old_tail = nil\n old_tail\nend", "def remove_front\n removed_node = self.head\n self.head = self.head.next\n return removed_node\n end", "def strip_message_from_whitespace(msg)\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "def strip_message_from_whitespace(msg)\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "def remove!(jumped_pos)\n board[jumped_pos] = nil\n end", "def remove_front\n self.tail == self.head ? self.head = nil : self.head = self.head.next\n end", "def shift non_block=false\n @messages.shift(non_block)\n end", "def _put_back_on_queue(message)\n future = nil\n _redis.multi do\n _redis.rpush(@queue, message)\n future = _redis.lrem(@in_progress_queue, 1, message)\n end\n removed = future.value\n if removed !=1\n RailsPipeline.logger.error \"ERROR: Didn't remove message from in_progress queue?!!!\"\n end\n end", "def truncate(msg, extra = 0)\n max = MAX_MESSAGE_LENGTH - @prefix.length - 3 - extra\n msg = msg[0..max] if msg.length > max\n msg\n end", "def pop\n return unless @head\n popped = @head\n \n if @head.to\n new_head = @head.to\n new_head.from = nil\n @head = new_head\n size += 1\n else\n empty!\n end\n\n popped.obj\n end", "def pop() end", "def remove_front\n if @head == @tail\n @head = nil\n @tail = nil\n else\n @head = @head.next\n end\n end", "def strip_message_from_whitespace msg\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "def remove_this_file_from_backtrace(backtrace)\n regexp = %r\"#{Regexp.quote(__FILE__)}\"o\n line_number = 0\n until regexp =~ backtrace[line_number] || line_number == 0\n line_number += 1\n end\n backtrace.slice!(line_number..-1)\n end", "def popline\n (pop || '')[1..-1]\n end", "def remove_recipient(name)\n name_li(name).link(:text=>\"x\").click\n end", "def dead_letter_address\n with_queue_control do |control|\n control.dead_letter_address\n end\n end", "def shorten_mail_adr(adr)\n pattern = /\\S*(@|\\sved\\s)\\S*/\n adr =~ pattern\n (adr = adr.sub(/#{$&}/, \"<a href=\\\"mailto:#{$&}\\\">email</a>\")) unless $& == nil\n return adr\n end", "def undo_bypass(frame)\n # !! always return a boolean\n if !!frame.match(/1{5}0/)\n frame.gsub(/1{5}0/, \"11111\")\n end\n end", "def popToSegment(segment, value, location)\n str = \"//pop to segment\"+\"\\n\"+\n getSegmentPosition(segment, value, location) + storeToFreeRegister(\"R13\") + getTopOfStack + \"D=M\"+\"\\n\" +\n freeRegisterToSegment(\"R13\") + removeFromStack + deleteFreeRegister(\"R13\")\n return str\nend", "def pop; end", "def pop; end", "def pop; end", "def pop; end", "def pop; end", "def slice_message_tail(message_vector)\n vector.new(message_vector.vector[-HASH_LENGTH / 8..-1])\n end", "def remove_url_anchor(url)\n url.split('#').first # url.split('#').shift\nend", "def fillBack(msg)\n ttl = msg.getConfig(\"ttl\")\n sn = msg.getConfig(\"seq\")\n if ttl == 0\n return\n else\n message = msg.getMessage()\n message_array = message.split(\"\\t\")\n host = message_array[0]\n if (host != $hostname and ($networks[host] == nil or $networks[host][\"sn\"] != sn))\n host_dist_tbl = Hash.new()\n for i in 1..(message_array.length - 1)\n neighbor_dist_pair = message_array[i].split(\",\")\n host_dist_tbl[neighbor_dist_pair[0]] = neighbor_dist_pair[1].to_i\n end\n $networks[host] = {\"sn\" => sn, \"neighbors\" => host_dist_tbl}\n msg.setConfig(\"ttl\", ttl - 1)\n $clients.each do |dst, client|\n sendMessage(client, msg)\n end\n if checkNode()\n runDijkstra()\n end\n end\n end\nend" ]
[ "0.62554634", "0.5772375", "0.5660778", "0.55819464", "0.552734", "0.55093575", "0.54551965", "0.5402385", "0.53923184", "0.5281751", "0.5267525", "0.52554804", "0.52297485", "0.5227724", "0.521531", "0.52020454", "0.52020454", "0.5200364", "0.5199173", "0.5191443", "0.5189182", "0.5169982", "0.51535416", "0.51187164", "0.5104481", "0.5075713", "0.5064562", "0.5050468", "0.50435466", "0.50038826", "0.50000036", "0.49858344", "0.49765804", "0.49628955", "0.49528632", "0.49516633", "0.49362296", "0.49362296", "0.49221113", "0.49078897", "0.49060994", "0.48998278", "0.48692733", "0.48581707", "0.4856782", "0.4854854", "0.48533803", "0.48531985", "0.48466998", "0.48466936", "0.48418978", "0.4825675", "0.48254752", "0.48254657", "0.4823521", "0.4815022", "0.48121428", "0.48041084", "0.4801365", "0.47927856", "0.4781886", "0.47782996", "0.47724867", "0.47538453", "0.47510165", "0.4744106", "0.47415", "0.47363022", "0.47363022", "0.472256", "0.471106", "0.47071818", "0.4705052", "0.4704758", "0.47019735", "0.47019735", "0.46906495", "0.4689048", "0.46865004", "0.46862617", "0.46809176", "0.46791205", "0.46789443", "0.46752265", "0.46693462", "0.46651125", "0.4663454", "0.46555758", "0.46509475", "0.46449414", "0.46448871", "0.46406502", "0.46388695", "0.46388695", "0.46388695", "0.46388695", "0.46388695", "0.4634583", "0.46309996", "0.46295398" ]
0.5131577
23
Create a duplicate of the message.
def duplicate dup_frames = @msg_frames.map {|frame| frame.dup} ZMQ::StringMultipartMessage.new(dup_frames) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_duplicate_message(message, clone)\n if message.request?\n if message.from_user_info == @from && message.to_user_info == @to\n if clone.outgoing? && message.incoming?\n clone.duplicate = true\n else\n message.duplicate = true\n end\n else\n if clone.outgoing? && message.incoming?\n message.duplicate = true\n else\n clone.duplicate = true\n end\n end\n else\n if message.from_user_info == @from && message.to_user_info == @to\n if clone.outgoing? && message.incoming?\n message.duplicate = true\n else\n clone.duplicate = true\n end\n else\n if clone.outgoing? && message.incoming?\n clone.duplicate = true\n else\n message.duplicate = true\n end\n end\n end\n end", "def duplicate_message_template(id, data)\n # FIXME: Error in duplicating\n @client.raw('post', \"/content/message-templates/#{id}/duplicate\", nil, data_transform(data))\n end", "def duplicate\n dup_frames = @msg_frames.map {|frame| frame.duplicate}\n ZMQ::RawMultipartMessage.new(dup_frames)\n end", "def create_dup\n self.generate_key\n new = Mensaje.new(self.attributes.merge(:owner_id =>self.recibe_id))\n self.owner_id ||= self.envia_id\n self.save\n new.owner_id = self.recibe_id\n new.save if (new.valid? && !Mensaje.exists?(:clave => self.clave, :owner_id => new.owner_id))\n end", "def dup\n self.class.new(color, board, pos)\n end", "def duplicate\n enhance_settings\n\n p = self.dup\n p.category = 'COPY OF ' + category\n p.created_at = p.updated_at = nil\n p.url = url\n p.attachment = attachment\n\n # allow site to do some customization\n p.send( :duplicate_extra, self ) if p.respond_to?( :duplicate_extra )\n p.save!\n \n p\n end", "def dup\n clone\n end", "def new_message(from, to, subject, message)\r\n rec = to.clone\r\n subs = to.concat([from])\r\n conv = Conversation.create(subs)\r\n time = Time.new\r\n message = Message.create(from, rec, subject, time, message, nil)\r\n\r\n subs.each{ |s| self.message_boxes[s.to_s].add_conversation(conv)}\r\n conv.add_message(message)\r\n\r\n self.conversations.store(conv.conversation_id.to_s, conv)\r\n conv\r\n end", "def duplicate(duplicate, original)\n @duplicate = duplicate\n @original = original\n @account = @duplicate.account\n @user = @account.user\n\n mail :to => @user.email\n end", "def new_message_from(prototype_message)\n copy = prototype_message.clone\n copy.node = self\n copy\n end", "def duplicate\n @new_course = duplicator.duplicate(@current_course)\n if @new_course.save\n Course::Mailer.course_duplicated_email(@current_course, @new_course,\n @current_user).deliver_now\n end\n @new_course\n end", "def newMessage\n @message = Message.new\n end", "def duplicate\n dup = Order.new\n dup.parent = self\n self.children << dup\n\n [:email,\n :ship_address,\n :bill_address,\n :shipping_method,\n :special_instructions,\n :split_shipment_type,\n :dc_code,\n :order_type].each do |attr|\n value = self.send(attr)\n dup.send(\"#{attr.to_s}=\", value)\n end\n\n # assign line_items\n self.line_items.each { |li| dup.add_variant li.variant, li.quantity }\n\n # set name\n dup.order_name = \"Duplicate of #{self.number}: #{self.order_name}\"\n dup.save!\n dup\n end", "def duplicate!\n ff = amoeba_dup\n ff.save\n ff\n end", "def duplicate\n @account = Account.find(params[:id]).dup\n @account.name += ' - NEW'\n @account.username = ''\n @account.password = ''\n end", "def dup\n h = super\n h.fields = @fields.dup\n h.mbox_from = @mbox_from\n h\n end", "def dup\n end", "def dup\n end", "def newMessage\n message = Message.last\n\n MagicMailer.newMessage(message)\n end", "def dup\n a = self.class.new\n a.args = args.map { |arg| arg.dup }\n a.proc = self.proc.dup\n a.id = Utils.random_str\n a\n end", "def duplicate\n my_href = URI.parse(self.href)\n ServerTemplate.new(:href => connection.post(my_href.path + \"/duplicate\"))\n end", "def dup\n self\n end", "def dup\n self\n end", "def dup\n self\n end", "def dup\n copy(false)\n end", "def duplicate()\n bug( \"you must override duplicate()\" )\n end", "def try_dup\n self.dup\n end", "def dup\n obj = super\n obj.duplicated_from = self\n obj.resource = self.resource_file\n uhook_duplicated_object(obj)\n\n obj\n end", "def duplicate_part(part)\n duplicate = part.dup\n duplicate.add_content_id(part.content_id) unless part.content_id.nil?\n duplicate\n end", "def dup\n self.class.new(to_hash)\n end", "def dup\n raise NotImplementedError.new(\"Method 'dup' not implemented by '#{self.class.name}'\")\n end", "def duplicate\n n = \"#{self.name} copy\"\n while !(r = Role.find_by(name: n)).nil?\n n = SecureRandom.hex.first(6)\n end\n c = n.parameterize.underscore\n r = Role.create(name: n, code: c, description: \"-- Copy of #{self.description}\")\n\n Permission.all.each do |perm|\n bool = PermissionRole.find_by(role: self, permission: perm)&.permitted || false\n PermissionRole.create(role: r, permission: perm, permitted: bool)\n end\n r\n end", "def dup\n self.class.new.tap { |obj| reverse_dup_copy obj }\n end", "def duplicate\n super do |cloned_resource|\n cloned_resource.title = \"Copy #{@resource.title}\"\n end\n end", "def duplicate?(data)\n msg_digest = Digest::MD5.hexdigest(data.to_s)\n return true if @messages_cache.include?(msg_digest)\n\n @messages_cache << msg_digest\n return false\n end", "def dup\n # noinspection RubyMismatchedReturnType\n self.class.new(object.presence)\n end", "def push_dup; end", "def keep message\n @messages << message\n end", "def dup\n new_board = Board.new\n @rows.each_with_index do |row, row_idx|\n row.each_with_index do |pos, col_idx|\n new_pos, new_piece_type, color = [row_idx, col_idx], pos.class, pos.color\n new_board[new_pos] = new_piece_type.new(color, new_board, new_pos) unless pos.is_a?(NullPiece)\n new_board[new_pos] = new_piece_type.instance if pos.is_a?(NullPiece)\n end\n end \n new_board\n end", "def dup() end", "def duplicate\n rejected_attributes = %w[id type created_at updated_at respondents_count]\n questionnaire = self.class.name.constantize.new(self.attributes.reject{|key,value| rejected_attributes.include?(key)})\n questionnaire.save\n contents.each do |content|\n copy = content.copy\n questionnaire.contents << copy\n \n \n # copy.clone_assets(content)\n \n end\n questionnaire\n end", "def dup; end", "def dup; end", "def dup; end", "def dup; end", "def duplicate_message?(dedupe_key, klass, queue_timeout)\n dupe_detector.found_duplicate?(:id=>dedupe_key, :queue=>klass.to_s, :visibility_timeout=>queue_timeout)\n end", "def dup\n copy = Queue.new\n copy.size = @size\n copy.elements = @elements\n copy\n end", "def duplicate\n \t\n \tjob = Job.find(params[:job_id].to_i)\n \n \tnewJob = Job.new\n \tnewJob.title = job.title\n \tnewJob.description = job.description\n \tnewJob.other_requirements = job.other_requirements\n\t newJob.admin_user_id = job.admin_user_id\n\t newJob.id_requester = job.id_requester\n\t newJob.id_status = job.id_status\n\t newJob.id_parent = job.id\n\t newJob.save\n \t\n \tredirect_to request.referer\n end", "def new_message\n end", "def dup(*) end", "def new_message(message)\n @message = message\n mail(\n :from => message.email,\n :to => 'brentalansmith@gmail.com',\n :subject => 'New Message From ' + message.email\n )\n end", "def new_message(message)\n @message = message\n mail\n end", "def duplicate!(**args)\n self.dont_create_legend_item = true\n duplicate = super(args)\n return duplicate if duplicate.new_record? || duplicate.errors.present?\n\n duplicate\n end", "def clone\n dup\n end", "def dup\n clone = super\n clone.name = \"Clone of #{self.name}\"\n clone.institution_default = false\n # The instance requires an ID for MetadataProfileElement validations.\n clone.save!\n self.elements.each { |e| clone.elements << e.dup }\n clone\n end", "def new\n \t@message = Message.new\n end", "def duplicate_content_template(id)\n @client.raw('post', \"/content/templates/#{id}/duplicate/\")\n end", "def duplicate\n # get the base name\n base = name.match(/^(.+?)( v(\\d+))?$/)[1]\n version = (self.class.max_version(base) || 1) + 1\n # create the new form and set the basic attribs\n cloned = self.class.new(:mission_id => mission_id, :name => \"#{base} v#{version}\", :published => false, :form_type_id => form_type_id)\n # clone all the questionings\n cloned.questionings = Questioning.duplicate(questionings)\n # done!\n cloned.save\n end", "def duplicate(&block)\n @on_duplicate = block\n end", "def dup\n duped_board = Board.new(false)\n\n figures.each do |piece|\n duped_board[piece.position] = piece.class.new(duped_board, piece.color, piece.position.dup)\n end\n\n duped_board\n end", "def duplicate(qty_ordered, qty_received = nil, qty_issued = nil)\n new_item = OrderedLineItem.create!(self.attributes.merge({\n :quantity_ordered => qty_ordered, \n :quantity_received => qty_received, \n :issued_quantity => qty_issued,\n :date_received => nil\n }))\n new_item.line_item_no = self.line_item_no\n new_item.save!\n end", "def dup\n\t\t\traise EmptyStackError, \"Empty stack\" if STACK.empty?\n\t\t\tpush STACK.last\n\t\tend", "def dup\n copy = super\n copy.clear_puzzle\n @puzzle.each_with_index do |entry, index|\n copy[index] = entry\n end\n copy\n end", "def dup\n return super unless post_id\n clone = super\n clone.post_id = nil\n clone\n end", "def duplicate(survey_form, position)\n\t\tclone = self.dup\n\t\tclone.survey_form = survey_form\n\t\tclone.position = position\n\t\tclone.save!\n\tend", "def dup\n GameBoard.build(row_size,column_size) {|r,c| self[r,c]}\n end", "def dup\n new_board = ChessBoard.new\n new_board.rows = self.rows.map(&:dup)\n new_board\n end", "def dup! ; self ; end", "def duplicated_question\n duplicator = Duplicator.new({}, current_course: current_course)\n duplicator.duplicate(@question.specific).acting_as\n end", "def new\n @message = Message.new\n end", "def new\n @message = Message.new\n end", "def new\n @message = Message.new\n end", "def new\n @message = Message.new\n end", "def new\n @message = Message.new\n end", "def new\n @message = Message.new\n end", "def new\n @message = Message.new\n end", "def new\n @message = Message.new\n end", "def duplicate\n p = self.dup\n p.name = 'COPY OF ' + name\n p.deleted_at = nil\n p.created_at = p.updated_at = nil\n p.taxons = taxons\n\n p.product_properties = product_properties.map { |q| r = q.dup; r.created_at = r.updated_at = nil; r }\n\n image_dup = lambda { |i| j = i.dup; j.attachment = i.attachment.clone; j }\n\n variant = master.dup\n variant.sku = 'COPY OF ' + master.sku\n variant.deleted_at = nil\n variant.images = master.images.map { |i| image_dup.call i }\n p.master = variant\n\n # don't dup the actual variants, just the characterising types\n p.option_types = option_types if has_variants?\n\n # allow site to do some customization\n p.send(:duplicate_extra, self) if p.respond_to?(:duplicate_extra)\n p.save!\n p\n end", "def dup\n Data.new( sheet, @data.map(&:dup) )\n end", "def duplicate_resource(resource)\n resource.dup\n end", "def <<(message)\n submit_message message\n self\n end", "def dup\n atom = Atom.new(id, element, x, y, z)\n atom.label = label\n atom.partial_charge = partial_charge\n atom.ignored1 = ignored1\n atom.ignored2 = ignored2\n return atom\n end", "def duplicate_form(id)\n @client.raw('post', \"/content/forms/#{id}/duplicate\")\n end", "def string_dup\n <<-CODE\n t1 = stack_pop();\n stack_push(string_dup(state, t1));\n CODE\n end", "def dup\n Card.new @value, @suit\n end", "def create_message(data); end", "def create_message(data); end", "def copy\n dup\n end", "def dup( )\n\t\t\tMarshal.load(Marshal.dump(self))\n\t\tend", "def dup #$\n a = pop\n push a\n push a\n end", "def duplicate?\n @duplicate == true\n end", "def create\n create_message(params)\n end", "def deep_dup\n dup\n end", "def deep_dup; end", "def duplicate(from)\n @bits.each_index {|i| @bits[i] = from.getWord(i)}\n end", "def deep_dup\n # noinspection RubyMismatchedReturnType\n dup\n end", "def dup\n self.class.new(@value, **(@object || {}))\n end", "def duplicate\n \n job = Job.find(params[:job_id].to_i)\n \n newJob = Job.new\n newJob.title = job.title\n newJob.description = job.description\n newJob.other_requirements = job.other_requirements\n newJob.admin_users_id = job.admin_users_id\n newJob.id_requester = job.id_requester\n newJob.id_status = job.id_status\n newJob.id_parent = job.id\n newJob.save\n \n redirect_to request.referer\n end", "def duplicate\n @newsletter = @structure.newsletters.includes(:blocs).find params[:id]\n duplicated_newsletter = @newsletter.duplicate!\n\n redirect_to pro_structure_newsletters_path(@structure), notice: 'Newsletter dupliquée avec succés.'\n end", "def duplicate\n super do |cloned_resource|\n cloned_resource.title = \"Copy #{@resource.title[0...Integral.title_length_maximum - 5]}\"\n cloned_resource.view_count = 0\n cloned_resource.build_active_block_list(content: @resource.active_block_list.content, listable: cloned_resource)\n cloned_resource.tag_list = @resource.tag_list_on(@resource.tag_context)\n cloned_resource.slug = @resource.slug\n cloned_resource.status = :draft\n cloned_resource.published_at = nil\n end\n end" ]
[ "0.7034578", "0.6996422", "0.6937953", "0.67715174", "0.6319098", "0.6307666", "0.6281456", "0.6262816", "0.62531364", "0.6162757", "0.61578", "0.61570317", "0.61515903", "0.61447096", "0.6094837", "0.60811496", "0.6079748", "0.6079748", "0.6045895", "0.6016814", "0.59561193", "0.5935838", "0.5935838", "0.5935838", "0.59309596", "0.59231627", "0.59160155", "0.59152734", "0.590822", "0.5907142", "0.5872475", "0.5871362", "0.58648294", "0.582033", "0.58174986", "0.5814808", "0.57754", "0.5756841", "0.5723009", "0.5719091", "0.5717142", "0.5697058", "0.5697058", "0.5697058", "0.5697058", "0.5695467", "0.5693749", "0.56688535", "0.56444", "0.563955", "0.56354743", "0.5635102", "0.5633479", "0.5582482", "0.5580698", "0.55805427", "0.5570255", "0.556298", "0.55612564", "0.55610913", "0.5554164", "0.55530626", "0.5549051", "0.5548114", "0.5547003", "0.5536273", "0.55227655", "0.5520245", "0.5514792", "0.55059123", "0.55059123", "0.55059123", "0.55059123", "0.55059123", "0.55059123", "0.55059123", "0.55059123", "0.5498778", "0.5498245", "0.5496386", "0.54918605", "0.5484592", "0.5482687", "0.5481648", "0.54796183", "0.54740757", "0.54740757", "0.5467408", "0.546426", "0.5444527", "0.5443251", "0.5440865", "0.5435774", "0.54350007", "0.5428034", "0.5415336", "0.54126716", "0.5404001", "0.5402651", "0.53997236" ]
0.71045434
0
GET /positions/1 GET /positions/1.json
def show @position = Position.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @position } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position }\n end\n end", "def index\n @positions = @mold.positions\n @photos = @mold.photos.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end", "def index\n @user_positions = UserPosition.paginate(:page => params[:page]).per_page(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_positions }\n end\n end", "def index\n @positions = Position.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def index\n @support = find_support\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @positions }\n end\n end", "def index\n @positions = Position.all\n end", "def positions(id)\n get(\"/accounts/#{id}/positions\")['positions']\n end", "def index\n @positions = Position.all(:order=>'name')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def show\n @user_position = UserPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_position }\n end\n end", "def show\n @position_history = PositionHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position_history }\n end\n end", "def show\r\n if Item.exists?(params[:id])\r\n @item = Item.find(params[:id])\r\n else\r\n redirect_to :home_page\r\n return\r\n end\r\n lats = []\r\n longs = []\r\n @item.item_histories.each do |it|\r\n lats << it.latitude\r\n longs << it.longitude\r\n end\r\n @positions = {:longs => longs, :lats => lats, :histories => @item.item_histories.paginate(:page => params[:page], :per_page => 10)}\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @item }\r\n end\r\n end", "def index\n @positions = current_user.positions.all\n end", "def show\n @position_mapper = PositionMapper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @position_mapper }\n end\n end", "def index\n @company = Company.find(params[:company_id])\n @positions = @company.positions\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def show\n @text_position = TextPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_position }\n end\n end", "def index\n @position_mappers = PositionMapper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @position_mappers }\n end\n end", "def index\n @positions = Position.all.order :id\n @geojson = Hash.new\n\n @points = Position.geopoints\n @geojson = {\n type: 'FeatureCollection',\n features: @points\n }\n\n respond_to do |format|\n format.html\n format.json { render json: @geojson } # respond with the created JSON object\n end\n end", "def new\n @user_position = UserPosition.new\n @positions = Position.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_position }\n end\n end", "def index\n @positions = @portfolio.positions\n end", "def show\n @position = Position.find(params[:id])\n end", "def show\n @unko_position = UnkoPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unko_position }\n end\n end", "def show\n @crew_position = CrewPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crew_position }\n end\n end", "def show\n @position = Position.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n end\n end", "def show\n @possess = Possess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @possess }\n end\n end", "def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end", "def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end", "def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position }\n end\n end", "def show\n @position = Position.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position }\n \n end\n end", "def index\n @managers_positions = Managers::Position.all\n end", "def active_positions\n authenticated_post(\"auth/positions\").body\n end", "def show\n \t@internship_position = InternshipPosition.find(params[:id])\n\n \trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @internship_position }\n \tend\n end", "def index\n respond_to do |format|\n format.html { render action: 'index' } # index.html.erb\n format.json # index.json.erb\n format.xml { render xml: positions }\n end\n end", "def get_positions\n all_players = consume_player_data\n keep_position_info(all_players)\n end", "def show\n redirect_to positions_path\n end", "def index\n @position_scene1s = PositionScene1.all\n end", "def index\n if @device\n @positions = @device.positions\n else\n @positions = Position.all\n end\n end", "def show\n @employee_position_history = EmployeePositionHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee_position_history }\n end\n end", "def index\n # @candidates = Candidate.all\n @candidates = Position.find(params[:position_id]).candidates\n end", "def get_position_request\n @position_request = PositionRequest.find(params[:id])\n end", "def index\n @hrms_positions = Hrms::Position.all\n end", "def show\n @finanzposition = Finanzposition.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finanzposition }\n end\n end", "def destroy\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def positions\n Easybill::Api::Positions\n end", "def destroy\n @position = Position.find(params[:id])\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url }\n format.json { head :no_content }\n end\n end", "def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end", "def show\r\n @positions.each do |p|\r\n\t puts p.inspect\r\n\tend\r\n end", "def index\n @position_scene3s = PositionScene3.all\n end", "def position\n fetch('football.positions')\n end", "def index\n @image_position_templates = ImagePositionTemplate.ordered\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @image_position_templates }\n end\n end", "def show\n @image_position_template = ImagePositionTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_position_template }\n end\n end", "def index\n @template_positions = TemplatePosition.all\n end", "def index\n @order_positions = OrderPosition.all\n end", "def new\n @position_mapper = PositionMapper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position_mapper }\n end\n end", "def index\n @proposal_positions = ProposalPosition.all\n end", "def index\n @positioncoefficients = Positioncoefficient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positioncoefficients }\n end\n end", "def index\n @arrival_ranges = ArrivalRange.find(:all, :order => \"position ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arrival_ranges }\n end\n end", "def new\n @position_history = PositionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position_history }\n end\n end", "def index\n @positives = Positive.all\n @positives_json= Positive.all.map(&:lonlat).as_json\n\n\n\n\n\n end", "def show\n @character_geo_position = Character::GeoPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character_geo_position }\n end\n end", "def show\n position = Position.find_by_id(params[:id])\n \n if !position.nil?\n respond_with position, include: [:restaurants], status: :ok\n else\n respond_with message: \"Resource not found\", status: :not_found\n end\n end", "def update\n respond_to do |format|\n if @position.update(position_params)\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @position }\n else\n format.html { render :edit }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @position.update(position_params)\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @position }\n else\n format.html { render :edit }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @position.update(position_params)\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { render :show, status: :ok, location: @position }\n else\n format.html { render :edit }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @position.destroy\n respond_to do |format|\n format.html { redirect_to positions_url, notice: 'Position was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @entried_positions = EntriedPosition.all\n end", "def show\n @track = current_user.tracks.includes(:positions).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @track }\n format.gpx { render text: @track.as_gpx}\n end\n end", "def index\n @fundamental_daily_position_stats = Fundamental::DailyPositionStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_daily_position_stats }\n end\n end", "def find\n render json: format_places(closest(params[:latitude], params[:longitude]).take(3))\n end", "def create\n @position = Position.new(params[:position])\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render json: @position, status: :created, location: @position }\n else\n format.html { render action: \"new\" }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @position = Position.new(params[:position])\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render json: @position, status: :created, location: @position }\n else\n format.html { render action: \"new\" }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @staff_tracking_position = StaffTrackingPosition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @staff_tracking_position }\n end\n end", "def stops_by_position\n get '/gtfs/stops/geosearch/'\n end", "def search_coord_route\n sql_results = Route.select(\"ST_AsGeoJSON(path) as path\")\n .where(\"cod_route = ?\", \"#{params[:id]}\").to_sql\n\n resp = ActiveRecord::Base.connection.execute(sql_results).map do |value|\n ActiveSupport::JSON.decode(value[\"path\"])[\"coordinates\"]\n end\n render json: resp\n end", "def show\n @fundamental_daily_position_stat = Fundamental::DailyPositionStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamental_daily_position_stat }\n end\n end", "def index\n @coordinates = @track.coordinates.for_user current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordinates }\n end\n end", "def get_position\n @step = Step.find(params[:stepID])\n if @step\n position = @step.position\n end\n respond_to do |format|\n format.js{\n render :js => position\n }\n end\n end", "def index\n @location_points = LocationPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @location_points }\n end\n end", "def positions\n position_id = params[:id]\n @position = Position.find_by(id: position_id)\n @applicants = @position.applicants\n \n # Arrange applicant skills for easier use in view\n @skills = {}\n for applicant in @applicants do\n @skills[applicant[:id]] = []\n for skill in applicant.skills do\n @skills[applicant[:id]].push(skill.name)\n end\n end\n end", "def create\n @position = Position.new(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @position = Position.new(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @position = Position.new(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to @position, notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_position_list\n\n end", "def index\n \t@categories = Category.find(:all)\n if params[:query]\n\t @positions = current_user && current_user.admin? ? Position.find(:all, :conditions => [\"category_id = :query\", {:query => params[:query]}]) : Position.active\n\t\telse\n\t\t @positions = current_user && current_user.admin? ? Position.find(:all, :order => 'created_at DESC') : Position.active\n\t\tend\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def show\n respond_with PreferredPosition.find(params[:id])\n end", "def show\n @position_member = PositionMember.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @position_member }\n end\n end", "def index\n if params[:x1]\n @places = Place.by_bounds( params[:x1], params[:y1], params[:x2], params[:y2], params )\n end\n #@places = Place.without_nodes\n respond_with(@places)\n end", "def show\n @order = Order.includes(:order_positions, :pizzeria => :pizzas).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def index\n locations = @project.locations.all\n render json: { locations: locations }\n end", "def update\n @position = Position.find(params[:id])\n respond_to do |format|\n if @position.update_attributes(params[:position])\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n positions = JSON.parse(params['positions'])\n\n # Fill in body to initialize the game and return a 200 response\n\n render plain: \"OK\"\n end", "def update\n\n respond_to do |format|\n if @position.update_attributes(params[:position])\n format.html { redirect_to @position, notice: 'Position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @move, status: 200\n end", "def get(position)\n @listener.get_to_positions(position.to_positions)\n end" ]
[ "0.7592656", "0.7122526", "0.68040425", "0.67908335", "0.67804617", "0.67543066", "0.67370677", "0.67292786", "0.6698444", "0.66883117", "0.661597", "0.6583506", "0.6575291", "0.65597713", "0.6540365", "0.64919364", "0.6491296", "0.64289105", "0.63477904", "0.63469964", "0.63469386", "0.63409144", "0.62640643", "0.6258613", "0.62433773", "0.62348336", "0.62348336", "0.62348336", "0.62102365", "0.6187579", "0.6185866", "0.6185265", "0.6173184", "0.61531657", "0.60747313", "0.601024", "0.600511", "0.5985141", "0.5950174", "0.5942174", "0.59290576", "0.5918619", "0.59144205", "0.59081024", "0.5894704", "0.58921903", "0.5853911", "0.58505195", "0.5822552", "0.58071804", "0.5772634", "0.5766153", "0.57654566", "0.57547766", "0.5730224", "0.57269025", "0.5723112", "0.56968397", "0.5694745", "0.56939197", "0.5690414", "0.5689499", "0.568024", "0.568024", "0.568024", "0.568012", "0.568012", "0.568012", "0.5679297", "0.56786317", "0.5668835", "0.5666814", "0.56595343", "0.56560034", "0.5650262", "0.56491756", "0.5648478", "0.5646696", "0.5644943", "0.5634852", "0.5608918", "0.5608174", "0.56068397", "0.56068397", "0.560654", "0.56007993", "0.5594012", "0.55737513", "0.55734175", "0.55724645", "0.5567319", "0.5555743", "0.55513984", "0.55394113", "0.5534115", "0.5532095", "0.5531865" ]
0.7194168
4
Decrypts a block of data (encrypted_data) given an encryption key and an initialization vector (iv). Keys, iv's, and the data returned are all binary strings. Cipher_type should be "AES256CBC", "AES256ECB", or any of the cipher types supported by OpenSSL. Pass nil for the iv if the encryption type doesn't use iv's (like ECB). :return: => String :arg: encrypted_data => String :arg: key => String :arg: iv => String :arg: cipher_type => String
def decrypt(encrypted_data, key, iv, cipher_type) aes = OpenSSL::Cipher::Cipher.new(cipher_type) aes.decrypt aes.key = key aes.iv = iv if iv != nil aes.update(encrypted_data) + aes.final end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt_data(encrypted_data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.decrypt\n aes.key = key\n aes.padding = 0\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final\n end", "def decrypt encrypted_data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final \n end", "def decrypt(data, key = nil, iv = nil)\n key ||= @request[:secret]\n iv ||= @request[:iv]\n\n @cipher.decrypt\n @cipher.key = key\n @cipher.iv = iv\n\n @cipher.update(data)\n end", "def decrypt_data(data, private_key, iv)\n aes = OpenSSL::Cipher::AES.new(256, :CBC)\n aes.decrypt\n aes.iv = iv\n aes.key = private_key\n aes.update(data) + aes.final\n end", "def decrypt(data, passphrase)\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.decrypt\n\n cipher.key = Digest::SHA256.digest(passphrase)\n cipher.iv = obtain_iv(passphrase)\n\n decrypted = cipher.update(data)\n decrypted << cipher.final\n\n rsize = decrypted[0]\n return decrypted[rsize + 1..-1]\n rescue\n return nil\n end", "def decrypt(data, password = nil)\n data = Base64.strict_decode64(data) if @base64\n\n salt = data[0, @salt_len]\n iv = data[@salt_len, @iv_len]\n ciphertext = data[@salt_len + @iv_len..-@mac_len - 1]\n mac = data[data.length - @mac_len, @mac_len]\n\n aes_key, mac_key = keys(salt, password)\n verify(iv + ciphertext, mac, mac_key)\n\n aes = cipher(aes_key, iv, false)\n plaintext = aes.update(ciphertext) + aes.final\n plaintext\n rescue TypeError, ArgumentError, NoMethodError => e\n error_handler e\n rescue OpenSSL::OpenSSLError => e\n error_handler e\n end", "def decrypt\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t_rt = Encryptor.decrypt(Base64.decode64(@data))\r\n\t\t\t\r\n\t\treturn _rt\r\n\t\t\t\r\n\t end", "def decrypt!(encrypted_data, options = {})\n secret = options[:secret]\n cipher = Gibberish::AES.new(secret)\n cipher.decrypt(encrypted_data).strip\n end", "def decrypt data, key, salt, iter, iv, key_length = 32\n decipher = OpenSSL::Cipher.new \"AES-256-CBC\"\n decipher.decrypt\n decipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, iter, key_length)\n decipher.iv = iv\n decipher.update(data) + decipher.final\n end", "def decrypt(data)\n\tarray = splitdencrypt(data)\n\tdecryptedBlock = ''\n\tfor i in 0...array.length\n\t val = array[i]\n\t decryptedBlock << @blowfish.decrypt_block([val].pack('H*'))\n\tend\n\treturn decryptedBlock\n end", "def decrypt(data)\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.decrypt\n cipher.key = @passphrase\n cipher.iv = @iv\n decrypted = cipher.update(data)\n decrypted << cipher.final\n json = JSON.parse(decrypted)\n self.identifier = json['identifier']\n @expiry = Time.parse(json['expiry'])\n rescue OpenSSL::Cipher::CipherError => e\n raise Kennedy::BadTicketException, \"Given data was not decryptable\"\n end", "def decrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).decrypt(data)\n end", "def aes_decrypt(key, crypt_string)\n cipher = OpenSSL::Cipher::Cipher.new(ssl_cipher)\n\n cipher.decrypt\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n decrypted_data = cipher.update(crypt_string) + cipher.final\n end", "def decrypt(data)\n data = remove_noise(data)\n # The first 32 bytes of the data is the original IV\n iv = data[0..31]\n cipher = FirebugMcrypt.new(:rijndael_256, :cbc, @key, iv, :zeros)\n cipher.decrypt(data[32..-1])\n end", "def decrypt(data)\n crypto_key.decrypt64(data)\n end", "def decrypt(encrypted_data_hex, key_hex, iv_hex)\n encrypted_data_bytes = hex_to_bytes(encrypted_data_hex)\n key = hex_to_bytes(key_hex)\n iv = hex_to_bytes(iv_hex)\n decrypt_bytes(encrypted_data_bytes, key, iv)\n end", "def decrypt\n unless @encrypted_data.blank?\n plaintext_data\n end\n end", "def aes_decrypt(key, crypt_string)\n cipher = OpenSSL::Cipher.new(ssl_cipher)\n\n cipher.decrypt\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n cipher.update(crypt_string) + cipher.final\n end", "def decrypt(encrypted_text)\n len = encrypted_text.length\n if (len == 0) || (len % BlockLengthInBytes > 0) then\n puts \"(encrypted_text.length == 0) || (encrypted_text.length % BlockLengthInBytes > 0)\"\n return nil\n end\n blocks = encrypted_text.scan(/.{8}/m)\n decrypted_blocks = []\n blocks.each do |block|\n decryptedBlock = self.class.decryptBlock(block, @keys)\n decrypted_blocks << decryptedBlock\n end\n output = decrypted_blocks.join\n return output\n end", "def decode_aes256 data\n length = data.length\n length16 = length % 16\n length64 = length % 64\n\n if length == 0\n ''\n elsif length16 == 0\n decode_aes256_ecb_plain data\n elsif length64 == 0 || length64 == 24 || length64 == 44\n decode_aes256_ecb_base64 data\n elsif length16 == 1\n decode_aes256_cbc_plain data\n elsif length64 == 6 || length64 == 26 || length64 == 50\n decode_aes256_cbc_base64 data\n else\n raise RuntimeError, \"'#{data.inspect}' doesn't seem to be AES-256 encrypted\"\n end\n end", "def decrypt_string(ciphertext, auth_tag, key, iv, auth_data = '')\n cipher = OpenSSL::Cipher.new(CIPHER_TYPE)\n cipher.decrypt\n cipher.key = key\n cipher.iv = iv[0, IV_LENGTH]\n\n cipher.auth_tag = auth_tag\n cipher.auth_data = auth_data\n\n cipher.update(ciphertext) + cipher.final\n end", "def decrypt(text64, iv)\n if @cipher\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-#{@cipher}-cbc\")\n cipher.decrypt\n cipher.key = @secret[0..cipher_block_size]\n if iv != \"\"\n cipher.iv = Base64.decode64(iv)\n end\n decrypted_text = cipher.update(Base64.decode64(text64))\n decrypted_text << cipher.final\n return decrypted_text\n else\n return text64\n end\n end", "def decrypt(data, key, options = {})\n raise KeyError.new(\"Please provide a secret key to decrypt data with.\") unless key\n options = settings[:crypt].merge(options)\n decoded_data = decode(data, options)\n decrypted_data = crypt(:decrypt, decoded_data, key, options)\n return data unless decrypted_data\n begin\n JSON.parse(decrypted_data)\n rescue JSON::ParserError\n decrypted_data\n end\n end", "def decipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.decrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end", "def decrypt(encrypted_text, password = nil, salt = nil)\n password = password.nil? ? Hoodie.crypto.password : password\n salt = salt.nil? ? Hoodie.crypto.salt : salt\n\n iv_ciphertext = Base64.decode64(encrypted_text)\n cipher = new_cipher(:decrypt, password, salt)\n cipher.iv, ciphertext = separate_iv_ciphertext(cipher, iv_ciphertext)\n plain_text = cipher.update(ciphertext)\n plain_text << cipher.final\n plain_text\n end", "def decrypt_data(encrypted, &decrypted)\n injected = @engine.inject encrypted\n\n unless injected\n exit -1\n end\n\n read_data = []\n\n begin\n while(read_chunk = @engine.read)\n read_data << read_chunk\n end\n rescue Exception => e\n unless @engine.state == 'SSLOK '\n raise e\n end\n end\n\n if block_given? then\n read_data.each do |data|\n decrypted.call data\n end\n else\n read_data.join\n end\n end", "def decrypt_ciphertext(ciphertext)\n aes = OpenSSL::Cipher.new(@cipher).decrypt\n aes.key = @encryption_key\n iv = ciphertext[0, aes.iv_len]\n aes.iv = iv\n crypted_text = ciphertext[aes.iv_len..-1]\n return nil if crypted_text.nil? || iv.nil?\n aes.update(crypted_text) << aes.final\n rescue\n nil\n end", "def _decode_aes256 cipher, iv, data\n aes = OpenSSL::Cipher::Cipher.new \"aes-256-#{cipher}\"\n aes.decrypt\n aes.key = @encryption_key\n aes.iv = iv\n aes.update(data) + aes.final\n end", "def decipher(key, user_iv, text)\n ssl_decipher = OpenSSL::Cipher.new('AES-256-CBC')\n ssl_decipher.decrypt\n ssl_decipher.key = key\n ssl_decipher.iv = user_iv\n ssl_decipher.update(text) + ssl_decipher.final\n end", "def decode_aes256_cbc_plain data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, data[1, 16], data[17..-1]\n end\n end", "def decrypt(encrypted)\n return nil unless encrypted =~ /Validation: (.*?)\\n(.*)\\n\\*\\*\\*/m\n begin\n decipher = OpenSSL::Cipher.new(\"AES-128-CBC\")\n decipher.decrypt\n # puts \"**** $1=#{$1}, $2=#{$2}\"\n decipher.key = EMAIL_KEY\n decipher.iv = Base64.decode64($1)\n encrypted_data = Base64.decode64($2)\n # puts \"**** decipher.iv=#{Base64.encode64 iv}\"\n # puts \"**** encrypted=#{Base64.encode64 encrypted}\"\n return decipher.update(encrypted_data) + decipher.final \n rescue\n return nil\n end \n end", "def decrypt(base64_encrypted_data,key,base64_init_vector,ciper='aes-128-cbc')\n SymmetricEncryption.cipher = SymmetricEncryption::Cipher.new(:key => key,:iv => Base64.urlsafe_decode64(base64_init_vector), :cipher => ciper )\n SymmetricEncryption.decrypt(Base64.urlsafe_decode64(base64_encrypted_data))\n end", "def decryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_ret = \"\"\r\n\t\t(0...@data.size()/2).each{|index| _ret += [@data[index*2, 2]].pack(\"H2\")}\t\t\r\n\t\t_rt = Encryptor.decrypt(_ret)\r\n\t\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end", "def decrypt_aes_cbc(key, iv, padding: false)\n key_str = str(key)\n iv_str = str(iv)\n data = self.pad(16).value\n\n _decrypt_aes_cbc(data, key_str, iv_str)\n end", "def decrypt(data)\n begin\n data = Base64.urlsafe_decode64(data)\n rescue ArgumentError\n raise Error, \"Unable to decode encrypted column: invalid base64\"\n end\n\n unless data.getbyte(1) == 0 && data.getbyte(3) == 0\n raise Error, \"Unable to decode encrypted column: invalid format\"\n end\n\n flags = data.getbyte(0)\n\n key, auth_data = @key_map[data.getbyte(2)]\n unless key\n raise Error, \"Unable to decode encrypted column: invalid key id\"\n end\n\n case flags\n when NOT_SEARCHABLE\n if data.bytesize < 65\n raise Error, \"Decoded encrypted column smaller than minimum size\"\n end\n\n data.slice!(0, 4)\n when SEARCHABLE, LOWERCASE_SEARCHABLE\n if data.bytesize < 97\n raise Error, \"Decoded encrypted column smaller than minimum size\"\n end\n\n data.slice!(0, 36)\n else\n raise Error, \"Unable to decode encrypted column: invalid flags\"\n end\n\n key_part = data.slice!(0, 32)\n cipher_iv = data.slice!(0, 12)\n auth_tag = data.slice!(0, 16)\n\n cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n cipher.decrypt\n cipher.iv = cipher_iv\n cipher.key = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, key_part)\n cipher.auth_data = auth_data\n cipher.auth_tag = auth_tag\n begin\n decrypted_data = cipher.update(data) << cipher.final\n rescue OpenSSL::Cipher::CipherError => e\n raise Error, \"Unable to decrypt encrypted column: #{e.class} (probably due to encryption key or auth data mismatch or corrupt data)\"\n end\n\n # Remove padding\n decrypted_data.slice!(0, decrypted_data.getbyte(0) + 1)\n\n decrypted_data\n end", "def decrypt(data)\n pipe_to_stdin command('--decrypt'), data\n end", "def decrypt!(data, options = {})\n unless options.has_key?(:secret)\n options[:secret] = PreciousCargo::Secret.decrypt!(options)\n end\n\n PreciousCargo::Data.decrypt!(data, options)\n end", "def decrypt(ciphertext, passwd, options = {})\n iv_and_ciphertext = Base64.decode64(ciphertext)\n cipher = new_cipher(:decrypt, passwd, options)\n cipher.iv, ciphertext = iv_and_ciphertext(cipher, iv_and_ciphertext)\n plaintext = cipher.update(ciphertext)\n plaintext << cipher.final\n plaintext\n end", "def decrypt(ciphertext, options = {})\n # TODO\n end", "def decrypt!(cipher, options={})\n opt = { salt: '', parse: true }.merge!(options)\n\n set_crypto cipher, opt[:intmode]\n iv = compute_iv_for_decrypting(force_binary(opt[:salt]), self[:content])\n\n if authenticated?\n if @icv_length.zero?\n @icv_length = opt[:icv_length].to_i if opt[:icv_length]\n raise PacketGen::ParseError, 'unknown ICV size' if @icv_length.zero?\n end\n icv = self[:content].slice!(-@icv_length, @icv_length)\n end\n\n authenticate_if_needed iv, icv\n private_decrypt opt\n end", "def decrypt(bin64, iv64)\n aes = OpenSSL::Cipher::Cipher.new($alg)\n aes.decrypt\n aes.key = $key\n aes.iv = Base64.urlsafe_decode64(iv64)\n aes.update(Base64.urlsafe_decode64(bin64)) + aes.final\nend", "def crypt(decrypt_or_encrypt, data, key, iv)\n c = OpenSSL::Cipher.new(CIPHER)\n c.send(decrypt_or_encrypt.to_sym)\n c.key = key\n c.iv = iv\n c.update(data) << c.final\n end", "def decrypt(encrypted_string)\n CRYPTO.decrypt_string(encrypted_string.decode64)\nend", "def decrypt(encrypted_str)\n return encrypted_str unless encrypted_str.is_a?(String) && @derived_key\n return encrypted_str unless encrypted_str.start_with?(ENCRYPTED_PREFIX)\n\n decrypt_str = encrypted_str[ENCRYPTED_PREFIX.length..-1]\n params = decode_aes(decrypt_str)\n\n cipher = OpenSSL::Cipher.new(CIPHER).decrypt\n\n cipher.key = @derived_key\n cipher.iv = params.nonce\n cipher.auth_tag = params.auth_tag\n cipher.auth_data = \"\"\n\n decoded_str = cipher.update(params.data) + cipher.final\n\n # force to utf-8 encoding. We already ensured this when we encoded in the first place\n decoded_str.force_encoding(Encoding::UTF_8)\n end", "def decrypt(str)\n str = str.unpack('m0').first\n aes = OpenSSL::Cipher::Cipher.new('aes-128-cbc').decrypt\n aes.key = @secret\n iv = str[0, aes.iv_len]\n aes.iv = iv\n crypted_text = str[aes.iv_len..-1]\n return nil if crypted_text.nil? || iv.nil?\n aes.update(crypted_text) << aes.final\n rescue\n nil\n end", "def decrypt(ciphertext)\n ciphertext = ciphertext.unpack('m').first\n tag = ciphertext[0, hmac_length]\n ciphertext = ciphertext[hmac_length..-1]\n\n # make sure we actually had enough data for the tag too.\n if tag && ciphertext && verify_message(tag, ciphertext)\n decrypt_ciphertext(ciphertext)\n else\n nil\n end\n end", "def decrypt(data)\n return nil if data.to_s.empty?\n\n password =\n if /^(1\\.[0-9.]+|2\\.0)(\\.[0-9]+)?/ =~ GPGME::Engine.info.first.version || @pinmode\n { password: @gpg_pass }\n else\n { password: @gpg_pass,\n pinentry_mode: GPGME::PINENTRY_MODE_LOOPBACK }\n end\n\n crypto = GPGME::Crypto.new(armor: true)\n crypto\n .decrypt(data, password)\n .read.force_encoding('utf-8')\n rescue => e\n raise \"#{I18n.t('error.gpg_file.decrypt')}\\n#{e}\"\n end", "def decrypt(data)\n @cert_chain[0].public_key.public_decrypt(Base64::decode64(data))\n end", "def _decrypt_packet_internal(keys, data)\n @l.debug(\"Encryptor: Decrypting a #{data.length}-byte packet\")\n # Don't decrypt if we don't have a key set\n# if(@keys[:shared_secret].nil?)\n# return data\n# end\n\n # Parse out the important fields\n header, signature, nonce, encrypted_body = data.unpack(\"a5a6a2a*\")\n\n # Check if it was truncated\n if(nonce.nil? || nonce.length < 2)\n raise(Error, \"Invalid encrypted packet!\")\n end\n\n # Check the signature\n correct_signature = SHA3::Digest::SHA256.digest(keys[:their_mac_key] + header + nonce + encrypted_body)\n if(correct_signature[0,6] != signature)\n raise(Error, \"Invalid signature on incoming packet!\")\n end\n\n # Check the nonce *after* checking the signature (otherwise, we might update the nonce to a bad value and Bad Stuff happens)\n nonce_int = nonce.unpack(\"n\").pop()\n if(nonce_int < keys[:their_nonce])\n raise(Error, \"Client tried to use an invalid nonce: #{nonce_int} < #{keys[:their_nonce]}\")\n end\n keys[:their_nonce] = nonce_int\n\n # Decrypt the body\n body = Salsa20.new(keys[:their_write_key], nonce.rjust(8, \"\\0\")).decrypt(encrypted_body)\n\n return header + body\n end", "def decrypt( string, pass, salt)\n key, iv = derive_key_iv( pass, salt)\n \n decipher = OpenSSL::Cipher::AES.new(256, :CBC)\n decipher.decrypt\n decipher.key = key\n decipher.iv = iv\n\n decipher.update( string) + decipher.final\n end", "def decrypt_string(encrypted_string) \n enc = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')\n enc.decrypt(RAM_SALT)\n text = enc.update(Base64.decode64(encrypted_string))\n decrypted_string = (text << enc.final)\n rescue\n nil\n end", "def decrypt_byte(iv, block, known)\n c = BLOCK_SIZE.times.map { rand(0..255) }\n p = known.length + 1\n\n # During encryption we:\n # 1. XOR (block, iv)\n # 2. Encrypt the value above ending with an \"encrypted value\"\n #\n # During decryption we do:\n # 1. decrypted_value = aes_cbc_decrypt(encrypted_value, KEY)\n # 2. XOR(decrypted_value, iv)\n # 3. We now have our plaintext\n #\n # So let's deconstruct what \"c[byte_pos] = x ^ p ^ iv[byte_pos]\" means.\n #\n # 1. We know \"x\" is part of our \"zeroing IV\", meaning:\n # * XOR(decrypted_value[pos], x) == 0\n # 2. p is the amount of zeroing bytes we already know\n # 3. iv[byte_pos] is our IV\n #\n # By doing c[byte_pos] = x ^ p ^ iv[byte_pos]\n #\n # We know that doing XOR(XOR(decrypted_block, iv), iv) will return decrypted_block\n # Following with XOR(decrypted_block[pos], x) will return 0 since x is equal the block\n # byte.\n # Followed by XOR(0, p) will return p, setting the byte to the padding value we want\n\n known.each_with_index do |x, i|\n byte_pos = BLOCK_SIZE - i - 1\n c[byte_pos] = x ^ p ^ iv[byte_pos]\n end\n\n i = 0\n\n loop do\n c[BLOCK_SIZE - p] = i\n break if check_credentials(c, block)\n raise \"Couldn't guess byte\" if i > 256\n i += 1\n end\n\n # So here we know c[BLOCK_SIZE - p] = i generated a value that\n # when XORed creates a valid padding for that specific byte.\n # Now we need to find the value for the \"zeroing IV\".\n #\n # We know that \"iv[BLOCK_SIZE - p] ^ i\" generates a number for a valid padding\n # when XORing it with our decrypted_value\n # and \"p\" represents that number for the current iteration. So XORing\n # \"iv[BLOCK_SIZE - p] ^ i\" with \"p\" will generate a number that when XORed\n # with the decrypted block will zero it.\n\n iv[BLOCK_SIZE - p] ^ i ^ p\nend", "def encrypt_data(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end", "def decrypt(data, padding: nil)\n dec = Botan::PK::Decrypt.new(key: self, padding: padding)\n dec.decrypt(data)\n end", "def _decrypt_packet_internal(keys, data)\n # Don't decrypt if we don't have a key set\n if(!ready?(keys))\n @@window.puts(\"Not decrypting data (incoming data seemed to be cleartext): #{data.unpack(\"H*\")}\")\n return data\n end\n\n # Parse out the important fields\n header, signature, nonce, encrypted_body = data.unpack(\"a5a6a2a*\")\n\n # Put together the data to sign\n signed_data = header + nonce + encrypted_body\n\n # Check the signature\n correct_signature = SHA3::Digest::SHA256.digest(keys[:their_mac_key] + signed_data)\n if(correct_signature[0,6] != signature)\n @@window.puts(\"Couldn't verify packet signature!\")\n raise(Encryptor::Error, \"Invalid signature!\")\n end\n\n # Check the nonce *after* checking the signature (otherwise, we might update the nonce to a bad value and Bad Stuff happens)\n nonce_int = nonce.unpack(\"n\").pop()\n if(nonce_int < keys[:their_nonce])\n @@window.puts(\"Client tried to use an invalid nonce: #{nonce_int} < #{keys[:their_nonce]}\")\n raise(Encryptor::Error, \"Invalid nonce!\")\n end\n keys[:their_nonce] = nonce_int\n\n # Decrypt the body\n body = Salsa20.new(keys[:their_write_key], nonce.rjust(8, \"\\0\")).decrypt(encrypted_body)\n\n #@@window.puts(\"Decryption successful\")\n return header+body\n end", "def decode(data, passphrase)\n decrypt(unpack64(data), passphrase)\n rescue\n return nil\n end", "def decryptAES128ECBblock(inputblock, keybytes)\n\tinput, key = bytearraytostring(inputblock), bytearraytostring(keybytes)\n\tdecipher = OpenSSL::Cipher::AES.new(128, 'ECB')\n\tdecipher.decrypt\n\tdecipher.key = key\n\tdecipher.padding = 0\n\treturn stringtobytearray(decipher.update(input) + decipher.final)\nend", "def decrypt(data)\n raise NoPrivateKeyError, \"Private key file: #{@private_key_file}\" unless private?\n \n decrypted_data = Base64.decode64(data)\n private_rsa.private_decrypt(decrypted_data)\n end", "def decrypt(x)\n @aes_key.decrypt(x)\n end", "def decrypt(ciphertext)\n @cipher.decrypt(@secret_key, ciphertext)\n end", "def decode_aes256_cbc_base64 data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, decode_base64(data[1, 24]), decode_base64(data[26..-1])\n end\n end", "def lookup(encrypted_string)\n crypted_iv, crypted_value = encrypted_string.split('|')\n fail ArgumentError, 'invalid value for decryption' unless crypted_iv && crypted_value\n iv = Base64.decode64(crypted_iv)\n value = Base64.decode64(crypted_value)\n @cipher.iv = iv\n @cipher.update(value) + @cipher.final\n end", "def decrypt_token(data)\n cipher = OpenSSL::Cipher::AES.new(128, :CBC)\n cipher.decrypt\n cipher.key = @client_secret.byteslice(0..15)\n cipher.iv = @client_id.byteslice(0..15)\n json = cipher.update(data) + cipher.final\n JSON.parse(json)\n end", "def encrypt data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final \n end", "def base_decrypt(ciphertext)\n RbNaCl::SimpleBox\n .from_secret_key(key)\n .decrypt(ciphertext)\n .force_encoding(Encoding::UTF_8)\n end", "def decrypt(alg, password, cipher)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256')\n when \"Blowfish\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'blowfish')\n when \"Plaintext\" then return cipher\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256')\n end\n decrypted_text = key.decrypt64(cipher)\n rescue => e\n p e.message\n end\n return decrypted_text\n \n end", "def decrypt_with_password(password, salt, iterations, key, iv, tag, data, debug_text=nil)\n\n\n # Create the key with our password\n @logger.debug(\"Apple Decrypter: #{debug_text} Attempting decryption with password #{password}\")\n\n # Create variables to track our generated and unwrapped keys between blocks\n decrypt_result = false\n plainext = false\n\n # Generate the key-encrypting key from the user's password\n generated_key = generate_key_encrypting_key(password, salt, iterations)\n\n # Unwrap the key\n unwrapped_key = aes_key_unwrap(key, generated_key) if generated_key\n\n # Decrypt the content only if we have a key\n plaintext = aes_gcm_decrypt(unwrapped_key, iv, tag, data, debug_text) if unwrapped_key\n\n if plaintext\n decrypt_result = { plaintext: plaintext, password: password }\n @logger.debug(\"Apple Decrypter: #{debug_text} generated a decrypt using password #{password}\")\n end\n\n return decrypt_result\n end", "def decrypt_message ciphertext\n key_pair.decrypt ciphertext\n end", "def decrypt(msg, private_key)\n # 1\n rsa_encrypted_aes_key = msg[0..255] # 256 bits\n rsa_encrypted_aes_iv = msg[256..511] # next 256 bits\n aes_encrypted_message = msg[512..msg.length]\n\n # 2\n rsa_decryptor = OpenSSL::PKey::RSA.new private_key\n aes_key = rsa_decryptor.private_decrypt rsa_encrypted_aes_key\n aes_iv = rsa_decryptor.private_decrypt rsa_encrypted_aes_iv\n\n # 3\n decipher = OpenSSL::Cipher::AES256.new(AES_MODE)\n decipher.decrypt\n decipher.key = aes_key\n decipher.iv = aes_iv\n\n decipher.update(aes_encrypted_message) + decipher.final\n end", "def decrypt\n data = Tools.get_data4\n potential_payloads = []\n \n data.each do |encrypted|\n potential_payloads << xor_cypher(encrypted)\n end\n \n potential_payloads.flatten(1)\n .sort { |a,b| a[1] <=> b[1] }\n .last(5)\n end", "def decrypt(cipher_bytes, private_key)\n cipher_bytes = Validation.check_filled_array_argument!(cipher_bytes)\n private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key)\n\n begin\n cipher = Core::VirgilCipher.new\n decrypted_bytes = cipher.decrypt_with_key(\n cipher_bytes,\n private_key.id,\n private_key.raw_key\n )\n wrap_bytes(decrypted_bytes)\n rescue StandardError => error\n raise VirgilCryptoException, error.message\n end\n end", "def decrypt(enc)\n\n des = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')\n des.decrypt\n des.key = \"7304912f3d62b5efcd837373bf6b7ff4f1f438b6b67008ef\".unhex\n des.iv = \"0a0a0a0a0a0a0a0a\".unhex\n des.padding = 0\n\n # libCARSReposMgr.so 3DES padding handling is wrong...\n # we try to mimick the behavior here.\n enc += \"00\" * ( 8 - ( (enc.length / 2) & 7 ) )\n\n decrypted_passwd = des.update(enc.unhex) + des.final\n decrypted_passwd.gsub(/\\x00.*/, '')\n\n end", "def aes_encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, \"randomString\", 1024, aes.key_len)\n aes.iv = iv if iv != nil\n aes.update(data.to_s) + aes.final \n end", "def encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end", "def decrypt_aes_ecb(key, padding: false)\n key_str = str(key)\n data = self.pad(16).value\n\n _decrypt_aes_ecb(data, key_str)\n end", "def private_decrypt(ciphertext)\n @private_key.private_decrypt(ciphertext)\n end", "def base_decrypt(ciphertext)\n simple_box = RbNaCl::SimpleBox.from_secret_key(key)\n simple_box.decrypt(ciphertext).force_encoding('UTF-8')\n # For an unknown reason, the decrypted result is default\n # to be of 'ASCII-8BIT', so we have to transform it into\n # UTF-8 by ourself!!\n end", "def decrypt(ciphertext_blob)\n begin\n\n d_resp = client.decrypt({\n ciphertext_blob: ciphertext_blob\n }).to_h\n\n plaintext = d_resp[:plaintext]\n\n return success_with_data(\n plaintext: plaintext\n )\n\n rescue => e\n return exception_with_data(\n e,\n 'a_k_1',\n GlobalConstant::ErrorAction.default,\n {\n purpose: @purpose,\n role: @role,\n ciphertext_blob: ciphertext_blob\n }\n )\n end\n end", "def decrypt(ciphertext_blob)\n begin\n plaintext = client.decrypt_and_verify(ciphertext_blob)\n\n success_with_data(\n plaintext: plaintext\n )\n rescue Exception => e\n error_with_data('lc_2',\n \"LocalCipher could not decrypt cipher with message => #{e.message}\",\n 'Something Went Wrong.',\n GlobalConstant::ErrorAction.default,\n {})\n end\n end", "def decrypt_with_private(crypted, base64=true)\n raise \"Crypted data should include a key\" unless crypted.include?(:key)\n raise \"Crypted data should include data\" unless crypted.include?(:data)\n\n if base64\n key = rsa_decrypt_with_private(base64_decode(crypted[:key]))\n aes_decrypt(key, base64_decode(crypted[:data]))\n else\n key = rsa_decrypt_with_private(crypted[:key])\n aes_decrypt(key, crypted[:data])\n end\n end", "def decrypt_with_private(crypted, base64=true)\n raise \"Crypted data should include a key\" unless crypted.include?(:key)\n raise \"Crypted data should include data\" unless crypted.include?(:data)\n\n if base64\n key = rsa_decrypt_with_private(base64_decode(crypted[:key]))\n aes_decrypt(key, base64_decode(crypted[:data]))\n else\n key = rsa_decrypt_with_private(crypted[:key])\n aes_decrypt(key, crypted[:data])\n end\n end", "def decrypt(ciphertext, key)\n plaintext = []\n i = 0\n ciphertext.each_byte do |c|\n p = c ^ key[i % 3][0]\n i += 1\n plaintext << p.chr\n end\n return plaintext.join\nend", "def decrypt(data)\n\t\tbegin\n\t\t\tkey = OpenSSL::PKey::RSA.new File.read '../keys/victim.pem'\n\t\t\treturn key.private_decrypt(data)\n\t\trescue\n\t\t\treturn false\n\t\tend\n\tend", "def unlock(str)\n str = str.unpack('m0').first\n aes = cipher.decrypt\n aes.key = @key.size > 32 ? @key[0..31] : @key\n iv = str[0, aes.iv_len]\n aes.iv = iv\n crypted_text = str[aes.iv_len..-1]\n return nil if crypted_text.nil? || iv.nil?\n aes.update(crypted_text) << aes.final\n rescue\n nil\n end", "def maybe_decrypt(context)\n # TODO determine if we should be decrypting data coming from pre-4.2\n # servers, potentially using legacy wire protocols. If so we need\n # to implement decryption for those wire protocols as our current\n # encryption/decryption code is OP_MSG-specific.\n self\n end", "def perform_decryption(\n encryption_data,\n password,\n content_entry,\n roo_content_xml_path\n )\n # Extract various expected attributes from the manifest that\n # describe the encryption\n\n algorithm_node = encryption_data.xpath('manifest:algorithm').first\n key_derivation_node =\n encryption_data.xpath('manifest:key-derivation').first\n start_key_generation_node =\n encryption_data.xpath('manifest:start-key-generation').first\n\n # If we have all the expected elements, then we can perform\n # the decryption.\n\n if !algorithm_node.nil? && !key_derivation_node.nil? &&\n !start_key_generation_node.nil?\n\n # The algorithm is a URI describing the algorithm used\n algorithm = algorithm_node['manifest:algorithm-name']\n\n # The initialization vector is base-64 encoded\n iv = Base64.decode64(\n algorithm_node['manifest:initialisation-vector']\n )\n key_derivation_name = key_derivation_node['manifest:key-derivation-name']\n iteration_count = key_derivation_node['manifest:iteration-count'].to_i\n salt = Base64.decode64(key_derivation_node['manifest:salt'])\n\n # The key is hashed with an algorithm represented by this URI\n key_generation_name =\n start_key_generation_node[\n 'manifest:start-key-generation-name'\n ]\n\n hashed_password = password\n\n if key_generation_name == 'http://www.w3.org/2000/09/xmldsig#sha256'\n\n hashed_password = Digest::SHA256.digest(password)\n else\n fail ArgumentError, \"Unknown key generation algorithm #{key_generation_name}\"\n end\n\n cipher = find_cipher(\n algorithm,\n key_derivation_name,\n hashed_password,\n salt,\n iteration_count,\n iv\n )\n\n begin\n decrypted = decrypt(content_entry, cipher)\n\n # Finally, inflate the decrypted stream and overwrite\n # content.xml\n IO.binwrite(\n roo_content_xml_path,\n Zlib::Inflate.new(-Zlib::MAX_WBITS).inflate(decrypted)\n )\n rescue StandardError => error\n raise ArgumentError, \"Invalid password or other data error: #{error}\"\n end\n else\n fail ArgumentError, 'manifest.xml missing encryption-data elements'\n end\n end", "def decrypt(cipher_text, key, opts={})\n ::AES::AES.new(key, opts).decrypt(cipher_text)\n end", "def decrypt(key, encrypted_message)\n key.private_key? or raise \"Must have private key to decrypt\"\n @cipher.reset\n\n ephemeral_public_key_length = key.group.generator.to_octet_string(:compressed).bytesize\n ciphertext_length = encrypted_message.bytesize - ephemeral_public_key_length - @mac_length\n ciphertext_length > 0 or raise OpenSSL::PKey::ECError, \"Encrypted message too short\"\n\n ephemeral_public_key_octet = encrypted_message.byteslice(0, ephemeral_public_key_length)\n ciphertext = encrypted_message.byteslice(ephemeral_public_key_length, ciphertext_length)\n mac = encrypted_message.byteslice(-@mac_length, @mac_length)\n\n ephemeral_public_key = OpenSSL::PKey::EC::Point.new(key.group, OpenSSL::BN.new(ephemeral_public_key_octet, 2))\n\n shared_secret = key.dh_compute_key(ephemeral_public_key)\n\n key_pair = kdf(shared_secret, @cipher.key_len + @mac_length, ephemeral_public_key_octet)\n cipher_key = key_pair.byteslice(0, @cipher.key_len)\n hmac_key = key_pair.byteslice(-@mac_length, @mac_length)\n\n computed_mac = OpenSSL::HMAC.digest(@mac_digest, hmac_key, ciphertext + @mac_shared_info).byteslice(0, @mac_length)\n computed_mac == mac or raise OpenSSL::PKey::ECError, \"Invalid Message Authenticaton Code\"\n\n @cipher.decrypt\n @cipher.iv = IV\n @cipher.key = cipher_key\n\n @cipher.update(ciphertext) + @cipher.final\n end", "def decrypt_and_encrypt(data)\n ## ** Decrypt\n keys = @keys\n begin\n #@@window.puts(\"Attempting to decrypt with primary key\")\n data = _decrypt_packet_internal(keys, data)\n #@@window.puts(\"Successfully decrypted with primary key\")\n\n # If it was successfully decrypted, make sure the @old_keys will no longer work\n @old_keys = nil\n rescue Encryptor::Error => e\n # Attempt to fall back to old keys\n if(@old_keys.nil?)\n @@window.puts(\"No secondary key to fallback to\")\n raise(e)\n end\n\n @@window.puts(\"Attempting to decrypt with secondary key\")\n keys = @old_keys\n data = _decrypt_packet_internal(@old_keys, data)\n @@window.puts(\"Successfully decrypted with secondary key\")\n end\n\n # Send the decrypted data up and get the encrypted data back\n data = yield(data, ready?(keys))\n\n # If there was an error of some sort, return nothing\n if(data.nil? || data == '')\n return ''\n end\n\n # If encryption is turned off, return unencrypted data\n if(!ready?(keys))\n @@window.puts(\"Returning an unencrypted response\")\n return data\n end\n\n ## ** Encrypt\n #@@window.puts(\"Encrypting the response\")\n\n # Split the packet into a header and a body\n header, body = data.unpack(\"a5a*\")\n\n # Encode the nonce properly\n nonce = [keys[:my_nonce]].pack(\"n\")\n\n # Encrypt the body\n encrypted_body = Salsa20.new(keys[:my_write_key], nonce.rjust(8, \"\\0\")).encrypt(body)\n\n # Sign it\n signature = SHA3::Digest::SHA256.digest(keys[:my_mac_key] + header + nonce + encrypted_body)\n\n # Arrange things appropriately\n return [header, signature[0,6], nonce, encrypted_body].pack(\"a5a6a2a*\")\n end", "def decrypt(string)\n require_key\n\n @private_key.private_decrypt(Base64.decode64(string))\n end", "def decrypt(msg)\n msg = Bytes.new(msg) unless msg.is_a?(Bytes)\n\n @cipher.decrypt\n @cipher.padding = 0\n @cipher.key = @key.ascii\n\n ptext = []\n (0..msg.length/BLOCK_SZ - 1).each do |block_i|\n block = msg.slice(block_i*BLOCK_SZ, BLOCK_SZ)\n\n dec = Bytes.new(@cipher.update(block.ascii) + @cipher.final)\n dec ^= @state\n ptext << dec\n\n @state = block\n end\n\n ptext = ptext.reduce(:concat)\n\n # Strip off padding.\n Bytes.new(ptext.reject { |b| b == ptext[-1] })\n end", "def decrypt(value)\n escape_and_execute_sql(\n [\"SELECT AES_DECRYPT(?, ?)\", Base64.decode64(value), key]).first\n end", "def decrypt(value,key,context)\n plaintext = @vault.logical.write(\"transit/decrypt/#{key}\", ciphertext: value, context: Base64.encode64(context).gsub('\\n',''))\n return Base64.decode64(plaintext.data[:plaintext]).gsub('\\n','')\n end", "def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end", "def decrypt(text)\n @private_key.private_decrypt(Base64.decode64(text)) if text\n end", "def crypt( decrypt_or_encrypt, data, pwhash, iv )\n c = OpenSSL::Cipher.new CIPHER\n c.send decrypt_or_encrypt.to_sym\n c.key = pwhash\n c.iv = iv\n c.update( data ) << c.final\n end", "def decrypt(message)\n xcrypt(:decrypt, message)\n rescue OpenSSL::Cipher::CipherError\n raise CipherError, 'invalid password'\n end", "def public_decrypt(data)\n @key.public_decrypt(Base64.decode64(data))\n end", "def decrypt(value)\n return unless value\n fail ArgumentError, 'Value is not encrypted' unless value.match(REGEXP)\n @key.private_decrypt(Base64.strict_decode64(Regexp.last_match(:value)))\n end", "def decrypt(attribute, encrypted_value)\n begin\n encrypted_attributes[attribute.to_sym][:operation] = :decrypting\n encrypted_attributes[attribute.to_sym][:value_present] = self.class.not_empty?(encrypted_value)\n self.class.decrypt(attribute, encrypted_value, evaluated_attr_encrypted_options_for(attribute))\n rescue ArgumentError #must specify a key\n return self.value_when_no_key\n end\n end" ]
[ "0.8432963", "0.8187987", "0.75452805", "0.74710566", "0.7119538", "0.70949453", "0.70847267", "0.7000138", "0.6980801", "0.6946616", "0.693633", "0.688547", "0.6851703", "0.6817218", "0.68083364", "0.6757908", "0.66244787", "0.6618416", "0.659759", "0.65801257", "0.6572465", "0.6556474", "0.6523105", "0.65184045", "0.64948654", "0.6434438", "0.6433153", "0.6405708", "0.63537854", "0.63510585", "0.6318548", "0.63035136", "0.6276977", "0.6260513", "0.6254354", "0.62465113", "0.6239915", "0.62236965", "0.6191065", "0.611623", "0.6084532", "0.6020388", "0.6020217", "0.5979836", "0.59766984", "0.59403926", "0.5926771", "0.5891113", "0.588195", "0.5876156", "0.58377904", "0.5833842", "0.5832811", "0.581779", "0.581758", "0.5799976", "0.5799008", "0.57808757", "0.5778392", "0.5775372", "0.57742655", "0.57485336", "0.5744115", "0.5736385", "0.5732845", "0.57091653", "0.5686926", "0.5675503", "0.5669699", "0.56664467", "0.5656359", "0.5619966", "0.5619178", "0.5610866", "0.5602612", "0.55937976", "0.5590388", "0.5577163", "0.55732316", "0.55719584", "0.55719584", "0.55676365", "0.5538731", "0.55285144", "0.5522215", "0.55188495", "0.5516565", "0.55075663", "0.54966456", "0.5482328", "0.54527813", "0.5434743", "0.5427833", "0.5398629", "0.5398629", "0.5379501", "0.5369253", "0.5367156", "0.53526354", "0.5338242" ]
0.8439621
0
Encrypts a block of data given an encryption key and an initialization vector (iv). Keys, iv's, and the data returned are all binary strings. Cipher_type should be "AES256CBC", "AES256ECB", or any of the cipher types supported by OpenSSL. Pass nil for the iv if the encryption type doesn't use iv's (like ECB). :return: => String :arg: data => String :arg: key => String :arg: iv => String :arg: cipher_type => String
def encrypt(data, key, iv, cipher_type) aes = OpenSSL::Cipher::Cipher.new(cipher_type) aes.encrypt aes.key = key aes.iv = iv if iv != nil aes.update(data) + aes.final end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt_data(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end", "def encrypt data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final \n end", "def aes_encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, \"randomString\", 1024, aes.key_len)\n aes.iv = iv if iv != nil\n aes.update(data.to_s) + aes.final \n end", "def encrypt(data, key = nil, iv = nil)\n key ||= @request[:secret]\n iv ||= @request[:iv]\n\n @cipher.encrypt\n @cipher.key = key\n @cipher.iv = iv\n\n @cipher.update(data)\n end", "def encrypt(data)\n cipher = OpenSSL::Cipher.new 'AES-256-CBC'\n cipher.encrypt\n cipher.key, cipher.iv = @password, @iv\n data.nil? ? '' : (cipher.update(data) + cipher.final).unpack('H*')[0]\n end", "def encrypt(data)\n cipher = OpenSSL::Cipher.new(\"AES-256-CBC\")\n cipher.encrypt\n cipher.iv = @enc_iv\n cipher.key = @enc_key\n encrypted = cipher.update(data) + cipher.final\n enc = Base64.strict_encode64(encrypted)\nend", "def encrypt(data, password = nil)\n salt = random_bytes(@salt_len)\n iv = random_bytes(@salt_len)\n aes_key, mac_key = keys(salt, password)\n\n aes = cipher(aes_key, iv, true)\n ciphertext = aes.update(data) + aes.final\n mac = sign(iv + ciphertext, mac_key)\n\n encrypted = salt + iv + ciphertext + mac\n encrypted = Base64.strict_encode64(encrypted) if @base64\n encrypted\n rescue TypeError, ArgumentError => e\n error_handler e\n end", "def urlsafe_base64_symmetric_encrypt(data, key, iv)\n raise 'Initialization Vector must have 16 hexadecimal characters.' unless iv.length == 16\n raise 'Key must have 16 hexadecimal characters.' unless key.length == 16\n\n bin_iv = [iv].pack('H*')\n raise 'Initialization Vector is not valid, must contain only hexadecimal characters.' if bin_iv.empty?\n\n # Appends first 8 Bytes to Key\n key += key.byteslice(0,8)\n\n # Create Cipher\n cipher = OpenSSL::Cipher.new(CIPHER_ALGORITHM)\n # Initialize cipher mode\n cipher.encrypt\n # Set initialization vector\n cipher.iv = bin_iv\n # Set key\n cipher.key = key\n\n # Encrypt data\n encrypted_data = cipher.update(data) + cipher.final\n # Encode data\n custom_base64_urlsafe_encode(encrypted_data)\n end", "def encrypt(text, iv)\n if @cipher\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-#{@cipher}-cbc\")\n cipher.encrypt\n cipher.key = @secret[0..@cipher_block_size]\n if iv != \"\"\n cipher.iv = iv\n end\n cipher_text = cipher.update(text)\n cipher_text << cipher.final\n return Base64.encode64(cipher_text) #output in base64\n else\n return text\n end\n end", "def encrypt(\n data, key, salt, iter, iv = SecureRandom.random_bytes(16), key_length = 32\n )\n cipher = OpenSSL::Cipher.new \"AES-256-CBC\"\n cipher.encrypt\n cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, iter, key_length)\n cipher.iv = iv\n {\n data: cipher.update(data) + cipher.final,\n iv: iv\n }\n end", "def aes_ecb_encrypt(data, key, params: {})\n key_arr = key.unpack(\"C*\")\n\n data = pad_data(data, 16)\n encrypted_data = data.unpack(\"C*\").each_slice(16).map do |slice|\n state = array_to_matrix(slice)\n encrypted_state = aes_encrypt_block(state, key_arr)\n matrix_to_array(encrypted_state).pack(\"C*\")\n end\n\n # return base64 encoded data\n [encrypted_data.join].pack(\"m\")\n end", "def decrypt encrypted_data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final \n end", "def encrypt_string(plaintext, key, iv, auth_data = '')\n cipher = OpenSSL::Cipher.new(CIPHER_TYPE)\n cipher.encrypt\n cipher.key = key\n cipher.iv = iv[0, IV_LENGTH]\n cipher.auth_data = auth_data\n\n encrypted = cipher.update(plaintext) + cipher.final\n [encrypted, cipher.auth_tag]\n end", "def decrypt_data(encrypted_data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.decrypt\n aes.key = key\n aes.padding = 0\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final\n end", "def encrypt(data)\n\tarray = splitencrypt(data)\n\tencryptedBlock = ''\n\tfor i in 0...array.length\n\t encryptedBlock << @blowfish.encrypt_block(array[i])\n\tend\n\treturn encryptedBlock\n end", "def encrypt(data, passphrase)\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.encrypt\n\n cipher.key = Digest::SHA256.digest(passphrase)\n cipher.iv = obtain_iv(passphrase)\n\n rsize = rand(32)\n data = '' << rsize << random_data(rsize) << data\n\n encrypted = cipher.update(data)\n encrypted << cipher.final\n\n return encrypted\n end", "def encrypt(data, key_hex)\n key = hex_to_bytes(key_hex)\n (encrypted_data_bytes, iv_bytes) = encrypt_bytes(data, key)\n encrypted_data_hex = bytes_to_hex(encrypted_data_bytes)\n iv_hex = bytes_to_hex(iv_bytes)\n [encrypted_data_hex, iv_hex]\n end", "def decrypt(encrypted_data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final\n end", "def encrypt( data )\n rsa = OpenSSL::PKey::RSA.new( File.read( @public_pem ) )\n\n # encrypt with 256 bit AES with CBC\n aes = OpenSSL::Cipher::Cipher.new( 'aes-256-cbc' )\n aes.encrypt\n\n # use random key and IV\n aes.key = key = aes.random_key\n aes.iv = iv = aes.random_iv\n\n # this will hold all primitives and ciphertext\n primitives = {}\n\n primitives['ciphertext'] = aes.update( data )\n primitives['ciphertext'] << aes.final\n\n primitives['key'] = rsa.public_encrypt( key )\n primitives['iv'] = rsa.public_encrypt( iv )\n\n # serialize everything and base64 encode it\n Base64.encode64( primitives.to_yaml )\n end", "def crypt(decrypt_or_encrypt, data, key, iv)\n c = OpenSSL::Cipher.new(CIPHER)\n c.send(decrypt_or_encrypt.to_sym)\n c.key = key\n c.iv = iv\n c.update(data) << c.final\n end", "def encrypt!(cipher, iv, options={}) # rubocop:disable Naming/MethodParameterName\n opt = { salt: '' }.merge!(options)\n\n set_crypto cipher, opt[:intmode]\n compute_iv_for_encrypting iv, opt[:salt]\n\n authenticate_if_needed iv\n encrypted_msg = encrypt_body(iv, opt)\n encrypted_msg << generate_auth_tag(opt) if authenticated?\n self[:content].read(iv + encrypted_msg)\n\n # Remove plain payloads\n self[:body] = PacketGen::Types::String.new\n\n remove_enciphered_packets\n self.calc_length\n self\n end", "def encrypt(data)\n crypto_key.encrypt64(data)\n end", "def encrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).encrypt(data)\n end", "def encrypt_aes_cbc(key, iv)\n key_str = str(key)\n iv_str = str(iv)\n msg = self.pad(16).value\n\n _encrypt_aes_cbc(msg, key_str, iv_str)\n end", "def aes_encrypt(plain_string)\n cipher = OpenSSL::Cipher::Cipher.new(ssl_cipher)\n cipher.encrypt\n\n key = cipher.random_key\n\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n encrypted_data = cipher.update(plain_string) + cipher.final\n\n {:key => key, :data => encrypted_data}\n end", "def aes_encrypt(plain_string)\n cipher = OpenSSL::Cipher.new(ssl_cipher)\n cipher.encrypt\n\n key = cipher.random_key\n\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n encrypted_data = cipher.update(plain_string) + cipher.final\n\n {:key => key, :data => encrypted_data}\n end", "def encrypt(data, key, options = {})\n raise KeyError.new(\"Please provide a secret key to encrypt data with.\") unless key\n options = settings[:crypt].merge(options)\n unless data.is_a?(String)\n data = JSON.generate(data)\n end\n encrypted_data = crypt(:encrypt, data, key, options)\n encode(encrypted_data, options)\n end", "def encrypt(str)\n return str unless str.is_a?(String)\n return \"\" if str == \"\"\n\n cipher = OpenSSL::Cipher.new(CIPHER).encrypt\n\n # Technically, this is a \"bad\" way to do things since we could theoretically\n # get a repeat nonce, compromising the algorithm. That said, it should be safe\n # from repeats as long as we don't use this key for more than 2^32 encryptions\n # so... rotate your keys/salt ever 4 billion encryption calls\n nonce = cipher.random_iv\n cipher.key = @derived_key\n cipher.auth_data = \"\"\n\n # Make sure the string is encoded as UTF-8. JSON/YAML only support string types\n # anyways, so if you passed in binary data, it was gonna fail anyways. This ensures\n # that we can easily decode the string later. If you have UTF-16 or something, deal with it.\n utf8_str = str.encode(Encoding::UTF_8)\n encrypted_data = cipher.update(utf8_str) + cipher.final\n auth_tag = cipher.auth_tag\n\n params = CipherParams.new(nonce, auth_tag, encrypted_data)\n\n encode_aes(params).prepend(ENCRYPTED_PREFIX)\n end", "def encrypt \r\n\t \r\n\t \tif validateParams\r\n\t \t \t\t \t\t \t \t\r\n\t \t\tif @IV.empty?\r\n\t\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\t\telse\r\n\t\t\t\t_iv= @IV\r\n\t\t\tend\t\t\r\n\t\t\t\r\n\t\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t\t_cyper_text = Encryptor.encrypt(@data)\t\t\t\r\n\t\t\t_rt = Base64.strict_encode64(_cyper_text)\r\n\t\t\t\t\t\t\r\n\t\t\treturn _rt\t\r\n\t\telse\r\n\t\t\traise \"Provide valid details to get transaction token\" \t\t\r\n\t \tend\r\n\t \t\r\n\t end", "def encryptCBC(plaintext, key, iv, padding: false)\r\n\t\t## split the text into chunks of block size\r\n\t\tblock_size = 16\r\n\t\tblocks = plaintext.chars.each_slice(block_size).to_a.map{|v| v.join.to_s}\r\n\r\n\r\n\t\tciphertext = String.new\r\n\t\tvector = iv\r\n\t\tblocks.each do |block|\r\n\t\t\txor = block^vector\r\n\t\t\tvector = encryptECB(xor, key, padding: false)\r\n\t\t\tciphertext += vector\r\n\t\tend\r\n\r\n\t\tciphertext\r\n\tend", "def crypt( decrypt_or_encrypt, data, pwhash, iv )\n c = OpenSSL::Cipher.new CIPHER\n c.send decrypt_or_encrypt.to_sym\n c.key = pwhash\n c.iv = iv\n c.update( data ) << c.final\n end", "def encryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_cyper_text = Encryptor.encrypt(@data)\t\r\n\t\t_rt = _cyper_text.unpack(\"H*\")[0]\r\n\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end", "def encrypt(str)\n return str unless str.is_a?(String) && @derived_key\n return \"\" if str == \"\"\n\n cipher = OpenSSL::Cipher.new(CIPHER).encrypt\n\n # Technically, this is a \"bad\" way to do things since we could theoretically\n # get a repeat nonce, compromising the algorithm. That said, it should be safe\n # from repeats as long as we don't use this key for more than 2^32 encryptions\n # so... rotate your keys/salt ever 4 billion encryption calls\n nonce = cipher.random_iv\n cipher.key = @derived_key\n cipher.auth_data = \"\"\n\n # Make sure the string is encoded as UTF-8. JSON/YAML only support string types\n # anyways, so if you passed in binary data, it was gonna fail anyways. This ensures\n # that we can easily decode the string later. If you have UTF-16 or something, deal with it.\n utf8_str = str.encode(Encoding::UTF_8)\n encrypted_data = cipher.update(utf8_str) + cipher.final\n auth_tag = cipher.auth_tag\n\n params = CipherParams.new(nonce, auth_tag, encrypted_data)\n\n encode_aes(params).prepend(ENCRYPTED_PREFIX)\n end", "def encryption_oracle(input)\n #Hardcoded, secret string\n append = 'Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg'\n append << 'aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBq'\n append << 'dXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUg'\n append << 'YnkK'\n append = append.unpack('m')\n\n str = input + append.join\n\n cipher = OpenSSL::Cipher.new('AES-128-ECB') \n cipher.encrypt \n cipher.key = 'O' * Blocksize;\n \n enc = cipher.update(str) + cipher.final\n #Hex encoded return\n return enc.unpack('H*').join\nend", "def encrypt(str)\n aes = OpenSSL::Cipher::Cipher.new($alg)\n iv = aes.random_iv\n iv64 = Base64.urlsafe_encode64(iv)\n\n aes.encrypt\n aes.key = $key\n aes.iv = iv\n\n cipher = aes.update(str) + aes.final\n\n { :cipher => Base64.urlsafe_encode64(cipher),\n :iv => iv64 }\nend", "def encrypt(data)\n # Create a random 32 byte string to act as the initialization vector.\n iv = SecureRandom.random_bytes(32)\n # Pyro pads the data with zeros\n cipher = FirebugMcrypt.new(:rijndael_256, :cbc, @key, iv, :zeros)\n add_noise(iv + cipher.encrypt(data))\n end", "def decrypt_data(data, private_key, iv)\n aes = OpenSSL::Cipher::AES.new(256, :CBC)\n aes.decrypt\n aes.iv = iv\n aes.key = private_key\n aes.update(data) + aes.final\n end", "def encrypt(plaintext, passwd, options = {})\n cipher = new_cipher(:encrypt, passwd, options)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plaintext)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_and_ciphertext(iv, ciphertext))\n end", "def encrypt_data(plaintext, &encrypted)\n written = @engine.write plaintext\n\n if written < plaintext.length\n exit -1\n end\n\n read_data = []\n\n while(read_chunk = @engine.extract)\n read_data << read_chunk\n end\n\n if block_given?\n read_data.each do |data|\n encrypted.call data\n end\n else\n read_data.join\n end\n end", "def decrypt(data, key = nil, iv = nil)\n key ||= @request[:secret]\n iv ||= @request[:iv]\n\n @cipher.decrypt\n @cipher.key = key\n @cipher.iv = iv\n\n @cipher.update(data)\n end", "def encrypt(iv, message)\n Util.validate_bytestring(\"IV\", iv, length: Block::SIZE)\n return \"\".b if message.empty?\n\n @cipher.iv = iv\n @cipher.update(message) + @cipher.final\n end", "def cipher(key, iv, encrypt = true)\n mode = @modes[@mode] % (@key_len * 8)\n cipher = OpenSSL::Cipher.new(mode)\n encrypt ? cipher.encrypt : cipher.decrypt\n cipher.key = key\n cipher.iv = iv\n cipher\n end", "def encrypt(data, expires_at: nil, expires_in: nil, purpose: nil)\n return nil unless data\n\n service.encrypt_and_sign(\n data,\n expires_at: expires_at,\n expires_in: expires_in,\n purpose: purpose\n )\n end", "def encrypt(plain_text, password = nil, salt = nil)\n password = password.nil? ? Hoodie.crypto.password : password\n salt = salt.nil? ? Hoodie.crypto.salt : salt\n\n cipher = new_cipher(:encrypt, password, salt)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plain_text)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_ciphertext(iv, ciphertext))\n end", "def encrypt(data)\n pipe_to_stdin command('--encrypt'), data\n end", "def cipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.encrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end", "def encrypt(data)\n self.class.encrypt(data + salt.to_s)\n end", "def aes_cbc_encrypt(buffer, key, iv)\n blocks = buffer.each_slice(key.size)\n previous_ciphertext_block = iv\n\n blocks.flat_map do |block|\n previous_ciphertext_block = aes_ecb_encrypt(\n xor_bytes(previous_ciphertext_block, block),\n key\n )\n\n previous_ciphertext_block\n end\nend", "def encrypt(object)\n result = ''\n if cipher.respond_to?(:iv=) and @iv == nil\n iv = OpenSSL::Random.random_bytes(cipher.iv_len)\n cipher.iv = iv\n result << Ripple::Contrib::VERSION << iv\n end\n\n if cipher.respond_to?(:public_encrypt)\n result << cipher.public_encrypt(object)\n else\n cipher_setup :encrypt\n result << cipher.update(object) << cipher.final\n cipher.reset\n end\n return serialize_base64(result)\n end", "def blowfish_encrypt(pass, data)\r\n\r\n\t\t# Forces 8-bit encoding\r\n\t\tpass = pass.unpack(\"C*\").pack(\"C*\")\r\n\t\tdata = data.unpack(\"C*\").pack(\"C*\")\r\n\t\t\r\n\t\t# Use 448-bit keys with 8-byte IV\r\n\t\tkey_len = 56\r\n\t\tiv_len = 8\r\n\t\t\r\n\t\t# Expand the key with MD5 (key-generated-key mode)\r\n\t\thash = OpenSSL::Digest::MD5.digest(pass)\r\n\t\twhile (hash.length < key_len)\r\n\t\t\thash << OpenSSL::Digest::MD5.digest(hash)\r\n\t\tend\r\n\t\r\n\t\tkey = hash[0, key_len]\r\n\t\tiv = Rex::Text.rand_text(iv_len)\r\n\r\n\t\tc = OpenSSL::Cipher::Cipher.new('bf-cbc')\r\n\t\tc.encrypt\r\n\t\tc.key_len = key_len\r\n\t\tc.key = key\r\n\t\tc.iv = iv\r\n\t\t\r\n\t\t\"RandomIV\" + iv + c.update(data) + c.final\r\n\tend", "def encrypt(data)\n return nil if !@key\n Base64::encode64(@key.private_encrypt(data)).delete(\"\\n\").strip\n end", "def encrypt(data)\n _encrypt(data, \"#{NOT_SEARCHABLE.chr}\\0#{@key_id.chr}\\0\")\n end", "def encryption_oracle(data)\n # prepend and append some random chars to the data\n # (why are we doing this?)\n pre = rand(6)+5\n post = rand(6)+5\n plain_text = data\n plain_text.prepend( (1..pre).map {rand(256).chr}.join )\n plain_text.concat( (1..post).map {rand(256).chr}.join )\n plain_text = CBCEncryptor.pad(plain_text, KEYSIZE)\n\n key = (1..16).map {rand(256).chr}.join\n\n if rand(2) > 0\n puts \"[Oracle using ECB]\"\n ecb = ECBEncryptor.new(key)\n ecb.encrypt(plain_text)\n else\n puts \"[Oracle using CBC]\"\n iv = (1..16).map {rand(256).chr}.join\n cbc = CBCEncryptor.new(key)\n cbc.encrypt(plain_text, iv)\n end\nend", "def encrypt(object)\n old_version = '0.0.1'\n result = ''\n if cipher.respond_to?(:iv=) and @iv == nil\n iv = OpenSSL::Random.random_bytes(cipher.iv_len)\n cipher.iv = iv\n result << old_version << iv\n end\n\n if cipher.respond_to?(:public_encrypt)\n result << cipher.public_encrypt(object)\n else\n cipher_setup :encrypt\n result << cipher.update(object) << cipher.final\n cipher.reset\n end\n return result\n end", "def pack(iv, encrypted)\n [iv, encrypted].map { |x| Base64.urlsafe_encode64(x).gsub('=','') }.join('~')\n end", "def encrypt(content, type)\n cipher = reset_cipher\n plaintext = content + type + \"\\x00\" * @length_of_padding\n cipher.auth_data = additional_data(plaintext.length)\n encrypted_data = cipher.update(plaintext) + cipher.final\n @sequence_number.succ\n\n encrypted_data + cipher.auth_tag\n end", "def decrypt data, key, salt, iter, iv, key_length = 32\n decipher = OpenSSL::Cipher.new \"AES-256-CBC\"\n decipher.decrypt\n decipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, iter, key_length)\n decipher.iv = iv\n decipher.update(data) + decipher.final\n end", "def encrypt(alg, password, string)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'aes256')\n when \"Blowfish\" then key =EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'blowfish')\n when 'Plaintext' then return string\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256') \n end\n encrypted_text = key.encrypt64(string)\n rescue => e\n p e.message\n end\n return encrypted_text\n \n end", "def encrypt(plain_text)\n len = plain_text.length\n if (len == 0) || (len % BlockLengthInBytes > 0) then\n puts \"(plain_text.length == 0) || (plain_text.length % BlockLengthInBytes > 0)\"\n return nil\n end\n blocks = plain_text.scan(/.{8}/m)\n encrypted_blocks = []\n blocks.each do |block|\n encryptedBlock = self.class.encryptBlock(block, @keys)\n encrypted_blocks << encryptedBlock\n end\n output = encrypted_blocks.join\n return output\n end", "def encrypt(msg, key)\n Rails.logger.debug \"AesEncryptDecrypt::encrypt::BEGIN\"\n begin\n cipher = OpenSSL::Cipher.new(ALGORITHM)\n cipher.encrypt()\n cipher.padding = 1\n cipher.key = key\n crypt = cipher.update(msg) + cipher.final\n return (Base64.encode64(crypt))\n rescue Exception => exc\n Rails.logger.error (\"Error when encrypting message #{msg} is #{exc.message}\")\n raise exc\n end\n end", "def seal(plaintext, associated_data = [])\n raise TypeError, \"expected String, got #{plaintext.class}\" unless plaintext.is_a?(String)\n\n v = _s2v(associated_data, plaintext)\n ciphertext = @ctr.encrypt(_zero_iv_bits(v), plaintext)\n v + ciphertext\n end", "def encrypt(data)\n Digest::SHA1.hexdigest(data + @salt)\n end", "def encrypt_ecb_nofinal(msg, key)\n cipher = OpenSSL::Cipher.new('AES-128-ECB')\n cipher.encrypt\n cipher.key = key\n return cipher.update(msg)\nend", "def crypt( decrypt_or_encrypt, data, pwhash )\n unless @iv\n raise RuntimeError, \n \"Initialization Vector (iv) must be set before doing #{decrypt_or_encrypt}\"\n end\n\n begin\n cipher = OpenSSL::Cipher.new(CIPHER)\n cipher.send decrypt_or_encrypt.to_sym\n cipher.key = pwhash\n cipher.iv = @iv\n cipher.update( data ) << cipher.final\n\n rescue OpenSSL::Cipher::CipherError => ce\n $stderr.puts ce\n $stderr.puts ce.inspect\n raise BadPassword.new\n\n rescue Exception => e\n puts \"ERROR: Unable to #{decrypt_or_encrypt}: #{e.class}: #{e}\"\n raise e\n end\n end", "def encrypt_message(message)\n aes = OpenSSL::Cipher.new(@cipher).encrypt\n aes.key = @encryption_key\n iv = aes.random_iv\n aes.iv = iv\n iv + (aes.update(message) << aes.final)\n end", "def encrypt(msg)\n msg = Bytes.new(msg) unless msg.is_a?(Bytes)\n\n # Capture the IV for this message.\n iv = @state\n\n # Setup OpenSSL cipher mode.\n @cipher.encrypt\n @cipher.padding = 0\n @cipher.key = @key.ascii\n\n # Encrypt message block by block.\n ctext = []\n (0..msg.length/BLOCK_SZ).each do |block_i|\n block = msg.slice(block_i*BLOCK_SZ, BLOCK_SZ)\n block = Crypto.pkcs7_padding(block) unless block.length == BLOCK_SZ\n\n block ^= @state\n enc = Bytes.new(@cipher.update(block.ascii) + @cipher.final)\n ctext << enc\n\n @state = enc\n end\n\n [iv, ctext.reduce(:concat)]\n end", "def encrypt_aes_ecb(key)\n key_str = str(key)\n msg = self.pad(16).value\n\n _encrypt_aes_ecb(msg, key_str)\n end", "def encrypt(string, password = DEFAULT_ENCRYPT_PASS)\n return '' if string == ''\n hex_encode(aes256_encrypt(string, Digest::SHA256.hexdigest(password)))\nend", "def _encrypt(data, prefix)\n padding = @padding\n random_data = SecureRandom.random_bytes(32)\n cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n cipher.encrypt\n cipher.key = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, @key, random_data)\n cipher_iv = cipher.random_iv\n cipher.auth_data = @auth_data\n\n cipher_text = String.new\n data_size = data.bytesize\n\n padding_size = if padding\n (padding * rand(1)) + padding - (data.bytesize % padding)\n else\n 0\n end\n\n cipher_text << cipher.update(padding_size.chr)\n cipher_text << cipher.update(SecureRandom.random_bytes(padding_size)) if padding_size > 0\n cipher_text << cipher.update(data) if data_size > 0\n cipher_text << cipher.final\n\n Base64.urlsafe_encode64(\"#{prefix}#{random_data}#{cipher_iv}#{cipher.auth_tag}#{cipher_text}\")\n end", "def encrypt(string)\n e_salt = salt\n e_key = key(e_salt)\n e_iv, ciphertext = p_encrypt_string(string, e_key, profile.algorithm)\n p_pack_string(e_iv, e_salt, ciphertext)\n end", "def perform(input, method)\n aes = OpenSSL::Cipher.new('AES-128-CBC')\n aes.public_send(method)\n aes.iv = @iv\n aes.key = @key\n aes.padding = 16 #PKCS7 padding\n aes.update(input) + aes.final\n end", "def public_encrypt(data)\n Base64.encode64(@key.public_encrypt(data))\n end", "def encrypt(string)\n CRYPTO.encrypt_string(string).to_64\nend", "def encrypt(data)\n\t\t# The limit of the encryption scheme is 235 bytes, so if the string is longer than that we need to limit it\n\t\tif data.length > 234\n\t\t\tdata = data[0..234] + \"\\n\"\n\t\tend\n\n\t\tkey = OpenSSL::PKey::RSA.new File.read '../keys/attacker.pub'\n\t\treturn key.public_key.public_encrypt(data)\n\tend", "def initialize(key,iv)\n \t\t\t\t@key = key\n \t\t\t\t@iv = iv\n \t\t\t\t@aes = OpenSSL::Cipher::Cipher.new('aes-256-cbc')\n \t\t\t\t@aes.key = key\n \t\t\t\t@aes.iv = iv\n \t\t\t\t@aes.encrypt\n \t\t\t\t@block = @aes.update(iv) << @aes.final\n \t\t\t\t@index = 0\n \t\t\tend", "def encrypt_string(clear_text)\n enc = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')\n enc.encrypt(RAM_SALT)\n data = enc.update(clear_text)\n Base64.encode64(data << enc.final)\n end", "def cage(payload)\n Base64.encode64(encrypt(payload)).strip! + \"-\" + @request[:iv]\n end", "def encrypt(x)\n @aes_key.encrypt(x)\n end", "def encrypted_data\n formatted_data = formatted_event_data\n encryptor_obj = LocalCipher.new(GlobalConstant::SecretEncryptor.webhook_event_secret_key)\n r = encryptor_obj.encrypt(formatted_data)\n fail \"r: #{r}, params: #{@params}\" unless r.success?\n\n r.data[:ciphertext_blob]\n end", "def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end", "def encrypt(string)\r\n aes = cipher\r\n encrypted = aes.update(string) + aes.final\r\n Base64.encode64(encrypted)\r\n end", "def encrypt(plaintext, options = {})\n # TODO\n end", "def encrypt64(str)\n enc = ''\n while str.length > self.encrypt_block_size\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n str = str[self.encrypt_block_size+1..-1] if str.length > self.encrypt_block_size\n end\n if str.length != 0 then\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n end\n Base64.encode64(enc)\n end", "def do_aes(key_binary_p, iv_binary_p, input_binary_p, output_binary_p,\n response_length_p, status_p, decrypt: false)\n key = Binary.from_pointer(key_binary_p).to_s\n iv = Binary.from_pointer(iv_binary_p).to_s\n input = Binary.from_pointer(input_binary_p).to_s\n\n write_binary_string_and_set_status(output_binary_p, status_p) do\n output = Hooks.aes(key, iv, input, decrypt: decrypt)\n response_length_p.write_int(output.bytesize)\n\n output\n end\n end", "def build_cipher(args={})\n cipher = OpenSSL::Cipher.new('AES-256-CBC')\n args[:decrypt] ? cipher.decrypt : cipher.encrypt\n iv = args[:iv]\n until(iv.length > 65)\n iv = iv * 2\n end\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(\n args[:key], CRYPT_SALT, CRYPT_ITER, CRYPT_KEY_LENGTH\n )\n cipher.iv = iv\n cipher.key = key\n cipher\n end", "def encrypt; end", "def cipher(cipher_mode, data)\n expect! cipher_mode => [ :decrypt, :encrypt ]\n\n case cipher_mode\n when :decrypt\n expect! data => /^envy:/\n cipher_op(:decrypt, data: Base64.decode64(data[5..-1]))\n when :encrypt\n \"envy:\" + Base64.strict_encode64(cipher_op(:encrypt, data: data))\n end\n end", "def encrypted_string\n blocks = initial_string.chars.each_slice(16).map(&:join)\n\n nonce = SecureRandom.random_bytes(8)\n counter = [0] * 8\n counter_bytes = counter.pack('C*')\n encryption = nonce + counter_bytes\n\n blocks.each do |block|\n cipher_block = block ^ encrypt_block(nonce + counter_bytes)\n encryption << cipher_block\n counter[-1] += 1\n counter_bytes = counter.pack('C*')\n end\n\n encryption\n end", "def protecting_encrypted_data(&block)\n with_encryption_context encryptor: ActiveRecord::Encryption::EncryptingOnlyEncryptor.new, frozen_encryption: true, &block\n end", "def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end", "def encrypt(*args, &block)\n crypt :encrypt, *args, &block\n end", "def combine_iv_and_ciphertext(iv, message)\n message.force_encoding('BINARY') if message.respond_to?(:force_encoding)\n iv.force_encoding('BINARY') if iv.respond_to?(:force_encoding)\n iv + message\n end", "def encrypt(plaintext)\n begin\n\n e_resp = client.encrypt({\n plaintext: plaintext,\n key_id: key_id\n }).to_h\n\n ciphertext_blob = e_resp[:ciphertext_blob]\n\n return success_with_data(\n ciphertext_blob: ciphertext_blob\n )\n\n rescue => e\n return exception_with_data(\n e,\n 'a_k_2',\n GlobalConstant::ErrorAction.default,\n {\n purpose: @purpose,\n role: @role,\n plaintext: plaintext\n }\n )\n end\n end", "def build(salt = nil, iv = nil)\n cipher = OpenSSL::Cipher.new(arguments[:cipher] || DEFAULT_CIPHER)\n iv ? cipher.decrypt : cipher.encrypt\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(\n arguments[:key],\n salt,\n arguments.fetch(:iterations, CRYPT_ITER),\n arguments.fetch(:key_length, CRYPT_KEY_LENGTH)\n )\n cipher.iv = iv if iv\n cipher.key = key\n cipher\n end", "def _decode_aes256 cipher, iv, data\n aes = OpenSSL::Cipher::Cipher.new \"aes-256-#{cipher}\"\n aes.decrypt\n aes.key = @encryption_key\n aes.iv = iv\n aes.update(data) + aes.final\n end", "def combine_iv_ciphertext(iv, message)\n message.force_encoding('BINARY') if message.respond_to?(:force_encoding)\n iv.force_encoding('BINARY') if iv.respond_to?(:force_encoding)\n iv + message\n end", "def base_encrypt(plaintext)\n simple_box = RbNaCl::SimpleBox.from_secret_key(key)\n simple_box.encrypt(plaintext)\n end", "def encode(data)\n @encryptor.encrypt_and_sign(data)\n end", "def encrypt(key, state)\n raise unless key.size == 16\n raise unless state.size == 16\n\n key = expand_key(key)\n\n round_key = key[0, 16]\n state = AES.add_round_key(state, round_key)\n\n (1..9).each do |i|\n round_key = key[16*i, 16]\n state = AES.sub_bytes(state)\n state = AES.shift_rows(state)\n state = AES.mix_columns(state)\n state = AES.add_round_key(state, round_key)\n end\n\n round_key = key[16*10, 16]\n state = AES.sub_bytes(state)\n state = AES.shift_rows(state)\n state = AES.add_round_key(state, round_key)\n end", "def cipher\n aes = OpenSSL::Cipher::Cipher.new(\"aes-#{@key_size}-cbc\")\n\n case @mode\n when :encrypt\n aes.encrypt\n when :decrypt\n aes.decrypt\n else\n raise(InvalidMode,\"invalid mode #{@mode}\")\n end\n\n aes.key = @key\n aes.iv = @iv\n\n yield aes if block_given?\n return aes\n end" ]
[ "0.8367523", "0.8310651", "0.8018604", "0.7561377", "0.7245172", "0.7221345", "0.69133705", "0.68800205", "0.6872039", "0.68715656", "0.68711346", "0.6845555", "0.6768463", "0.6674719", "0.6661547", "0.65922177", "0.6588938", "0.6569504", "0.6516006", "0.6479473", "0.6410227", "0.63720083", "0.6330837", "0.62918633", "0.6277848", "0.6269448", "0.6253737", "0.62249553", "0.6189616", "0.6185935", "0.61710876", "0.6161872", "0.6124407", "0.6114801", "0.6104566", "0.60632193", "0.6051684", "0.60120606", "0.59898543", "0.5938705", "0.5938031", "0.59303004", "0.5925767", "0.5924069", "0.591541", "0.5893184", "0.58765936", "0.5874723", "0.585966", "0.5844867", "0.58409053", "0.5835793", "0.57904834", "0.57588124", "0.57494116", "0.5742645", "0.56636107", "0.5608633", "0.55875534", "0.555851", "0.55574197", "0.55558497", "0.5554655", "0.55469507", "0.55438733", "0.55024576", "0.5491451", "0.549069", "0.5488515", "0.54877836", "0.54793704", "0.547763", "0.5457386", "0.5454906", "0.5440091", "0.543901", "0.5426384", "0.5411532", "0.5383883", "0.5371231", "0.5365929", "0.53621066", "0.5360408", "0.5346892", "0.53370327", "0.53178656", "0.5315974", "0.5309929", "0.5307038", "0.5305796", "0.52982956", "0.5294311", "0.52899885", "0.52822816", "0.5274884", "0.526863", "0.5265001", "0.522579", "0.5205143", "0.5204798" ]
0.83820516
0
insert a new note into a database
def save if @id # run an UPDATE query if it is in the database DB[:conn].execute("UPDATE notes SET text='#{@text}', is_complete='#{@is_complete}' WHERE id=#{@id}") else # INSERT if it's not in the database yet. DB[:conn].execute("INSERT INTO notes(text) VALUES('#{@text}')") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_note(db, category, name, note)\n db.execute(\"INSERT INTO notes (category, name, note) VALUES (?, ?, ?)\", [category, name, note])\nend", "def note(uid, note)\n single(\"INSERT INTO notes (assumption_uid, content) VALUES ($1, $2)\", [uid, note])\nend", "def new_note(content)\n note = Note.new({:type_id => self.id,\n :owner => 'bill',\n :content => content})\n note.save\n end", "def insert_into_article(title, content, price, user_id, adress, phone_number, date_created, tag_id) \n return get_db().execute(\"INSERT INTO article (title, content, price, user_id, adress, phone_number, date_created, tag_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)\", title, content, price, user_id, adress, phone_number, date_created, tag_id)\n end", "def add_note(note)\n self.notes = notes.present? ? \"\\n\\n#{note}\" : note\n save\n end", "def new_note(db)\n puts \"\\nWhat category would you like this note to be saved under?? examples html, css, ruby.....ect.\"\n category = gets.chomp\n\n puts \"\\nWhat would you like to name this note?? examples how to make a new line, how to round to the nearest whole number, ...ect \"\n name = gets.chomp\n\n puts \"\\nAdd your note below\"\n note = gets.chomp\n\n create_note(db, category, name, note)\nend", "def add_task(db, task, date_needed, notes)\n db.execute(\"INSERT INTO list (task, date_needed, notes) VALUES (?, ?, ?)\", [task, date_needed, notes])\nend", "def insert \n DATABASE.execute(\"INSERT INTO contents (slide_order, title, body) \n VALUES (#{@slide_order}, '#{@title}', '#{@body}')\")\n @id = DATABASE.last_insert_row_id\n end", "def create_new_note\n note_type = params[:note_type][:note_type_id]\n new_note = keytech_note_handler.create(note_type, params[:element_key])\n new_note.subject = params[:subject]\n new_note.text = params[:body]\n response = keytech_note_handler.save(new_note)\n if response[:success] == true\n flash[:info] = 'Notiz wurde angelegt'\n else\n flash[:error] = \"Notiz konnte nicht angelegt werden: #{response[:error]}\"\n end\n redirect_to \"/element/#{params[:element_key]}/notes\"\n end", "def insert\n DATABASE.execute(\"INSERT INTO boards (title,description) VALUES ('#{@title}', '#{@description}')\")\n @id = DATABASE.last_insert_row_id\n end", "def new_patient(db, name, dob, insurance)\n\t\n\tdb.execute(\"INSERT INTO patient_info (name, dob, insurance) VALUES (?, ?, ?)\", [name, dob, insurance])\n\nend", "def post(authToken, noteStore, note)\n\tcreatedNote = noteStore.createNote(authToken, note)\n\tputs \"Successfully created a new note with GUID: #{createdNote.guid}\"\nend", "def create\n @note = Note.new(note_params)\n @note.save\n end", "def add_subject(database, name)\r\n\tdatabase.execute(\"INSERT INTO subjects (name) VALUES (?)\", [name])\r\nend", "def newpost(params,userid)\r\n db = connect_non_hash()\r\n db.execute(\"SELECT userid FROM users\")\r\n db.execute(\"INSERT INTO posts(title, text, userid) VALUES (?, ?, ?)\", params[\"title\"], params[\"text\"], userid)\r\n end", "def create_notes\n end", "def add_notes\n \tNote.create!(content: params[:body], user_id: params[:user_id], email_conversation_id: params[:email_conversation_id])\n \tredirect_to chat_history_path(lead_id: params[:lead_id])\n end", "def insert\n # Preparing for the query...\n cols = self.class.columns\n col_names = cols.map(&:to_s).join(\", \")\n question_marks = ([\"?\"] * cols.count).join(\", \")\n \n # The actual query\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{ self.class.table_name } (#{ col_names })\n VALUES\n (#{ question_marks })\n SQL\n \n # Add an id number for the record\n self.id = DBConnection.last_insert_row_id\n end", "def insert(todo)\n todo = Rutodo::Database::Todo.new(\n title: todo.title,\n description: todo.description,\n done: todo.status == :finished\n )\n\n todo.save\n\n todo.as_entity\n end", "def save\n\n\t\tconn = Post.open_connection\n\t\t# If there is no id then make a new entry\n\t\tif(!self.id)\n\t\t\t# Insert a new record in to the database\n\t\t\tsql = \"INSERT INTO post (title, body) VALUES ('#{self.title}', '#{self.body}') \"\n\t\telse\n\t\t\t# Update an existing one\n\t\t\tsql = \"UPDATE post SET title='#{self.title}', body='#{self.body}' WHERE id=#{self.id}\"\n\t\tend\n\n\t\tconn.exec(sql)\n\n\tend", "def add_entry(db, book_name, year_pubished, genre, author, rating, read)\n\tdb.execute(\"INSERT INTO books (book_name, year_pubished, genre, author, rating, read) VALUES (?, ?, ?, ?, ?, ?)\", [book_name, year_pubished, genre, author, rating, read])\nend", "def add_symptom(db, symptom, date, time_of_day, severity)\n $db.execute(\"INSERT INTO symptoms (symptom, date, time_of_day, severity) VALUES (?, ?, ?, ?)\", [symptom, date, time_of_day, severity])\nend", "def add_interest(db, interest)\n db.execute(\"INSERT INTO interests (interest) VALUES (?)\", [interest])\nend", "def insert\n DATABASE.execute(\"INSERT INTO terms (term, definition, phonetic) VALUES \n ('#{@term}', '#{@definition}', '#{@phonetic}')\")\n @id = DATABASE.last_insert_row_id\n end", "def create\n note_attr = note_params\n tag_names = note_params[:tag].split(\" \")\n note_attr[:tag] = tag_names\n\n ActiveRecord::Base.transaction do\n Tag.add_count(tag_names, [])\n @note = Note.new(note_attr)\n raise \"ノートの作成ができませんでした。\" unless @note.save!\n end\n\n respond_to do |format|\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n end\n rescue => e\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end", "def create_note(note, topics, attachments)\n click_create_new_note\n enter_new_note_subject note\n enter_note_body note\n add_attachments_to_new_note(note, attachments)\n add_topics(note, topics)\n click_save_new_note\n set_new_note_id note\n end", "def add_item(db, new_item, new_date)\n db.execute(\"INSERT INTO todolist (item, date, done) VALUES (?, ?, ?)\", [new_item, new_date, \"false\"])\nend", "def insert_article(id, body, s)\n if id == nil\n stmt = @sql.prepare \"insert into articles (original_article, article) values(?,?)\"\n stmt.execute(body, s)\n else\n stmt = @sql.prepare \"insert into articles (article_list_id, original_article, article) values(?,?,?)\"\n stmt.execute(id, body, s)\n end\n end", "def insert_record(name, type, ttl, content)\n records_table.insert(\n :domain_id => domain.id,\n :name => name,\n :type => type, \n :ttl => ttl, \n :content => content,\n :change_date => Time.now.to_i\n )\n end", "def new_student (db, name)\n db.execute(\"INSERT INTO student (name) VALUES (?)\", [name])\nend", "def insert(name)\n CONN.execute(\"INSERT INTO artits(name) VALUES(?)\", name)\nend", "def create_note(contents, title = nil, description = nil)\n Dropio::Resource.client.create_note(self, contents, title, description)\n end", "def db_adder(database, year, variety, region, notes)\n database.execute(\"INSERT INTO wine_cellar (year,variety,region,notes) VALUES (?,?,?,?)\", [year,variety,region,notes])\nend", "def insert()\n\n end", "def insert(**opts)\n add(**opts)\n save!\n end", "def add_book(db, title, author, rating)\n db.execute(\"INSERT INTO books (title, author, rating) VALUES (?, ?, ?)\", [title, author, rating])\nend", "def insert(sql, name = nil, pk = nil, id_value = nil) end", "def add_song(db, artist, song, rating, explicit_lyrics, user_id, platform_id)\n db.execute(\"INSERT INTO music (artist, song, rating, explicit_lyrics, user_id, platform_id) VALUES (?, ?, ?, ?, ?, ?)\", [artist, song, rating, explicit_lyrics, user_id, platform_id])\nend", "def insert_link(url, comment)\n open_db { |db|\n db.execute(\"insert into links (url, comment, time) values ('#{url}', '#{comment}', datetime('now', 'localtime'));\") \n }\nend", "def add_student(database, name)\r\n\tdatabase.execute(\"INSERT INTO students (name) VALUES (?)\", [name])\r\nend", "def create(params = {})\n note = build(params)\n note.save\n note\n end", "def save_post(params)\n sql= 'INSERT INTO posts (title, description, url, created_at)\n VALUES($1,$2,$3,NOW())'\n db_connection do |conn|\n conn.exec_params(sql,[params[:title],params[:description],params[:url]])\n end\nend", "def insert\n array = [[@name, @tagline, @github, @twitter, @blog_url, @image_url, @biography]]\n ins = DB[:conn].prepare(\"INSERT INTO students (name, tagline, github, twitter, blog_url, image_url, biography) VALUES (?, ?, ?, ?, ?, ?, ?);\")\n array.each { |s| ins.execute(s)}\n self.id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students;\")[0][0]\n #ask steven re. index figures\n #inserting data into an instance\n end", "def add_note(note)\n @notes.push(note)\n end", "def create_new_todo(list_id, todo_name)\n sql = \"INSERT INTO todos (name, list_id) VALUES ($1, $2)\"\n query(sql, todo_name, list_id)\n end", "def insert\n\n DBConnection.execute2(<<-SQL, attribute_values)\n INSERT INTO\n #{class_obj.table_name} #{sql_columns}\n VALUES\n #{sql_question_marks}\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end", "def insert task\n now = Time.now.to_i\n tasks = @db[:tasks]\n tasks.insert :title => task.title,\n :status => task.getStatus,\n :created => now,\n :wake => now,\n :changed => 0,\n :path => task.getPath,\n :data => Marshal::dump(task)\n end", "def createNote(noteText)\n refreshToken\n path = \"/api/note?auth=#{@token}\\&email=#{@email}&modify=#{ERB::Util.url_encode(Time.now.strftime(\"%Y-%m-%d %H:%M:%S\"))}\"\n data = noteText\n payload = Base64.encode64(data)\n response, data = agent.post(path,payload)\n unless response.code.to_i == 200\n raise \"Failed to create new note\"\n end\n response.body\n end", "def add_note(note)\n response = self.class.put(url(self.id), :query => {:notes => note}, :body => \"\") # nginx reject requests without body\n\n if response.code == 200\n return true\n else\n raise response.response\n end\n end", "def create_new_update(database, user_id, update_text)\r\n database.execute(\"INSERT INTO updates (user_id, update_text, update_datetime) VALUES (?, ?, date('now'))\", [user_id, update_text])\r\nend", "def make_note (notes_hash, framework=self.framework)\n\t\t\tprint_deb \"Attempting to create note with #{notes_hash.inspect}\"\n\t\t\t# check the required hash elements for a good note\n\t\t\t\n\t\t\t# <-- start weird bug work around\n\t\t\trequired_elements = [:data]\n\t\t\t#required_elements = [:data,:type]\n\t\t\tnotes_hash[:type] = \"db_fun\"\n\t\t\t# --> end weird bug work around\n\t\t\t\n\t\t\trequired_elements.each do |elem|\n\t\t\t\traise ArgumentError.new \"Missing required element (#{elem}) \" +\n\t\t\t\t\"for the note\" unless notes_hash[elem]\n\t\t\tend\n\t\t\tprint_deb \"Sending note to db with #{notes_hash.inspect}\"\n\t\t\tframework.db.report_note(notes_hash)\n\t\t\t\t\n\t\t\t#\n\t\t\t# Report a Note to the database. Notes can be tied to a Workspace, Host, or Service.\n\t\t\t#\n\t\t\t# opts MUST contain\n\t\t\t# +:data+:: whatever it is you're making a note of\n\t\t\t# +:type+:: The type of note, e.g. smb_peer_os\n\t\t\t#\n\t\t\t# opts can contain\n\t\t\t# +:workspace+:: the workspace to associate with this Note\n\t\t\t# +:host+:: an IP address or a Host object to associate with this Note\n\t\t\t# +:service+:: a Service object to associate with this Note\n\t\t\t# +:port+:: along with :host and proto, a service to associate with this Note\n\t\t\t# +:proto+:: along with :host and port, a service to associate with this Note\n\t\t\t# +:update+:: what to do in case a similar Note exists, see below\n\t\t\t#\n\t\t\t# The +:update+ option can have the following values:\n\t\t\t# +:unique+:: allow only a single Note per +:host+/+:type+ pair\n\t\t\t# +:unique_data+:: like +:uniqe+, but also compare +:data+\n\t\t\t# +:insert+:: always insert a new Note even if one with identical values exists\n\t\t\t#\n\t\t\t# If the provided +:host+ is an IP address and does not exist in the\n\t\t\t# database, it will be created. If +:workspace+, +:host+ and +:service+\n\t\t\t# are all omitted, the new Note will be associated with the current\n\t\t\t# workspace.\n\t\t\t#\n\t\tend", "def add_note(note)\n notes << note\n end", "def insert_start (db, event)\n\tdb.execute(\"INSERT INTO start (event) VALUES (?)\", [event])\nend", "def insert\n DATABASE.execute(\"INSERT INTO students (name, age, github) VALUES (?, ?, ?)\", @name, @age, @github)\n @id = DATABASE.last_insert_row_id\n end", "def insert_entry(params)\n Entry.create(params)\n end", "def insert\n col_names = self.class.columns.join(\", \")\n question_marks = ([\"?\"] * self.class.columns.length).join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{self.class.table_name} (#{col_names})\n VALUES\n (#{question_marks})\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end", "def create_artist(db,artist_name,language)\n\tdb.execute(\"INSERT INTO artists (artist_name,language) VALUES ('#{artist_name}', '#{language}');\")\nend", "def add_todo(db, act_id)\n\tdb.execute(\"INSERT INTO todo (activity_id, done) VALUES (?,'false')\", [act_id])\n\nend", "def save(params, userid)\n db = connect\n db.execute('INSERT INTO users_discussions(UserId, DiscId) VALUES(?, ?)', userid, params[\"id\"])\n end", "def add_media(db, mediatype, title, rentLease, mediaconsumed)\r\n\tdb.execute('INSERT INTO media (mediatype, title, rentLease, mediaconsumed) VALUES (?, ?, ?, ?)', [mediatype, title, rentLease, mediaconsumed])\r\nend", "def insert(table,doc)\n connection.insert(path(table),doc)\n end", "def create_review(db, banker_name, potential_id, house_info_id)\n\tdb.execute(\"INSERT INTO review (banker_name, potential_id, house_info_id) VALUES (?, ?, ?)\", [banker_name, potential_id, house_info_id])\nend", "def add_new_school(db, name)\n db.execute(\"INSERT INTO school (name) VALUES (?)\", [name])\nend", "def create\n @note = current_user.notes.new(params[:note])\n @note.note = view_context.markdown(@note.note).gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n @note.save\n $statsd.increment 'animal.note.created'\n respond_with(@note)\n end", "def create_task (db, task, due_date, completed)\r\n db.execute(\"INSERT INTO tasks (task, due_date, completed) VALUES (?, ?, ?)\", [task, due_date, completed])\r\nend", "def add_note(note)\n notes << note\n end", "def note_contents=(notes)\n notes.each do |note|\n if note != \"\"\n self.notes << Note.find_or_create_by(content: note)\n end\n end\n\n end", "def create\n @task_note = Note.new(params[:note])\n\n respond_to do |format|\n if @task_note.save\n format.html { redirect_to notes_path, notice: 'Task note was successfully created.' }\n format.json { render json: @task_note, status: :created, location: @task_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n importance = 11\n @note = Note.new(body: note_params['body'], last_seen: Date.today, user_id: current_user.id, importance: importance)\n @note.add_tag(note_params['tag'].chomp.downcase, current_user.id)\n @note.add_second(note_params['second'].chomp.downcase, @note.tag.id, current_user.id)\n respond_to do |format|\n if @note.save\n format.html { redirect_to notes_path, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { redirect_to notes_path, notice: @note.errors }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @note = Note.new(params[:note])\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_kitten(db, name, age)\r\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\r\nend", "def add_exercise(db)\n puts \"What is the name of the exercise you want to add?\"\n exercise = gets.chomp\n if is_existing_exercise(db, exercise)\n puts \"#{exercise} is already in the database.\"\n else\n db.execute(\"INSERT INTO exercises (name) VALUES (?)\", [name])\n puts \"#{exercise} was added to the database.\"\n end\nend", "def contact_note_add(id:, listid:, note:, **args)\n post(\n '/admin/api.php',\n query: {\n api_action: 'contact_note_add'\n },\n body: args.merge(\n id: id,\n listid: listid,\n note: note,\n )\n )\n end", "def create\n @note = build_note\n\n if note.save\n successful_creation\n else\n @errors = note.errors\n render_errors\n end\n end", "def insert\n \n attributes = []\n instance_variables.each do |i|\n attributes << i.to_s.delete(\"@\") if (i != :@id && i != :@table)\n end\n \n values = []\n attributes.each do |a|\n value = self.send(a)\n \n if value.is_a?(Integer)\n values << \"#{value}\"\n else values << \"'#{value}'\"\n end\n end\n \n DATABASE.execute(\"INSERT INTO slides (#{attributes.join(\", \")}) \n VALUES (#{values.join(\", \")})\")\n @id = DATABASE.last_insert_row_id\n return self\n end", "def add_movie(db, title, rating, comments)\r\n\t\tdb.execute(\"INSERT INTO movies(title, rating, comments) VALUES(?, ?, ?)\", [title, rating, comments])\t\r\n\tend", "def add_make(db, make)\n db.execute(\"INSERT INTO makes (make) VALUES (?)\", [make])\nend", "def insert()\n\n # Kräver att det finns ett \"set_table(\"Table\")\" i klassen\n @insertable_vars_full = self.instance_variables # Ta med namnen user.username osv\n @insertable_vars_full.shift(1) # Kinda frisky\n @insertable_vars = []\n @insertable_values = []\n @insertable_vars_full.each do |var|\n @insertable_vars << var[1..-1]\n @insertable_values << self.instance_variable_get(var)\n end\n\n\n @insertable_vars_str = @insertable_vars.join(\", \")\n\n @question_marks = \"\"\n @insertable_vars.each do |key|\n @question_marks.concat(\"?,\")\n end\n @question_marks = @question_marks[0..-2]\n\n DB.execute(\"INSERT INTO #{@table} (#{@insertable_vars_str})\n VALUES (#{@question_marks})\", @insertable_values)\n\n end", "def create_deal_note(deal_id, note)\n post(\"deals/#{deal_id}/notes\", note: { note: note })\n end", "def insert\n DATABASE.execute(\"INSERT INTO dogs (name, breed, age, serial_num, colour, description, temperament_id, owner_id) VALUES \n ('#{@name}', '#{@breed}', #{@age}, #{@serial_num}, '#{@colour}', '#{@description}', #{@temperament_id}, #{@owner_id})\")\n @id = DATABASE.last_insert_row_id\n end", "def create\n attributes = self.class.attributes.map { |attribute| attribute.to_s }\n attributes.shift\n question_marks = []\n attributes.each { |attribute| question_marks << \"?\"}\n\n DBConnection.execute(<<-SQL, *attribute_values(attributes))\n INSERT INTO\n #{self.class.table_name} (#{attributes.join(\", \")})\n VALUES\n (#{question_marks.join(\", \")})\n SQL\n #self.send('id', DBConnection.instance.last_insert_row_id)\n end", "def save\n conn = Sandwich.open_connection\n\n if self.id\n #Update\n sql = \"UPDATE sandwich SET title='#{self.title}', description='#{self.description}' WHERE id=#{self.id}\"\n else\n #Add\n sql= \"INSERT INTO sandwich (title, description) VALUES ('#{self.title}','#{self.description}')\"\n end\n\n\n conn.exec(sql)\n end", "def insert()\n\t\t@db.execute(\"insert into ausgaben (jahr, monat, name, betrag, gemeinsam, tags) values(:jahr, :monat, :name, :betrag, :gemeinsam, :tags)\", @options)\n\tend", "def create_recipe(db,name,description,length,difficulty)\n q = \"INSERT INTO recipes (name,description,length,difficulty) VALUES ('#{name}','#{description}',#{length},#{difficulty});\"\n return db.execute(q)\nend", "def create_entry()\n\tdb.execute( \"INSERT INTO test (name, codename) VALUES (?, ?)\", [name, code_name])\n\nend", "def note\n DBC.require( bu?, \"Vin non bu: La note n'est pas definie\" )\n\n @note\n end", "def create\r\n @note = Note.new(note_params)\r\n if @note.save\r\n redirect_to @note\r\n else\r\n render :new\r\n end\r\n end", "def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend", "def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend", "def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend", "def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend", "def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend", "def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend", "def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend", "def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend", "def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend", "def save_form_data_to_database\n db = get_db\n db.execute 'INSERT INTO Messages (username, phone, email, option, comment)\n VALUES (?, ?, ?, ?, ?)', [@username, @phone, @email, @option, @comment]\n db.close\nend", "def insert_film(title, date, channel, start_time, end_time, year, desc, duration)\n title = title.gsub(/[']/, \"\\\\'\")\n desc = desc.gsub(/[']/, \"\")\n @db.execute(\"INSERT OR IGNORE INTO Films \\\nVALUES ('#{title.escape_single_quotes}', '#{date}', '#{channel}', \\\n'#{start_time}', '#{end_time}', '#{year}', '#{desc.escape_single_quotes}', #{duration})\")\nend", "def create_reminder(date, reminder)\r\n norm_date = normalize_date(date)\r\n $DB.execute(\"INSERT INTO reminders (date, reminder) VALUES (?,?)\",\r\n [norm_date, reminder])\r\nend", "def add_input (db, user_input)\r\n db.execute(\"INSERT INTO strength (date, exercise, weight, reps, minutes, difficult) VALUES (?, ?, ?, ?, ?, ?)\", [user_input])\r\nend" ]
[ "0.8154324", "0.7843895", "0.706663", "0.70261586", "0.6955155", "0.68844074", "0.6884008", "0.68751156", "0.6796505", "0.6711709", "0.6674796", "0.66637397", "0.66467154", "0.66272354", "0.6570325", "0.6569332", "0.65283144", "0.65212995", "0.6506293", "0.6504767", "0.64941645", "0.64901364", "0.64651906", "0.64506924", "0.6448522", "0.64388245", "0.64352506", "0.64222383", "0.6419969", "0.6413251", "0.64094377", "0.6405355", "0.6396982", "0.63894975", "0.63876367", "0.6376122", "0.63527167", "0.6351862", "0.63387674", "0.6332702", "0.6326343", "0.63162106", "0.631314", "0.6306492", "0.63026154", "0.62979317", "0.62882686", "0.628651", "0.628361", "0.62642264", "0.62641084", "0.62631303", "0.6253398", "0.62523746", "0.62502277", "0.6245308", "0.6243814", "0.6232845", "0.62170386", "0.62115544", "0.6197739", "0.6177104", "0.6174704", "0.6170604", "0.6166422", "0.61579275", "0.61534613", "0.6137705", "0.6134168", "0.61322033", "0.6130712", "0.61295044", "0.61181045", "0.6117014", "0.61142397", "0.61067057", "0.6100782", "0.609217", "0.60888135", "0.6087776", "0.6084229", "0.6082664", "0.6076265", "0.6076008", "0.60592467", "0.60538363", "0.60457736", "0.6045054", "0.6045054", "0.6045054", "0.6045054", "0.6045054", "0.6045054", "0.6045054", "0.6045054", "0.6045054", "0.6043313", "0.6043043", "0.6041478", "0.60370594" ]
0.7322147
2
Runs a program locally.
def run(program,*args) system(program,*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_local(cmd)\n system(cmd)\n end", "def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n `#{cmd}`\n end", "def run(cmd)\n #logger.trace \"executing locally: #{cmd.inspect}\" if logger\n run_locally cmd\n # puts `#{cmd}`\nend", "def local\n system(*@args)\n end", "def run\n script_name = shift_argument\n unless script_name\n error(\"Usage: mortar local:run SCRIPT\\nMust specify SCRIPT.\")\n end\n validate_arguments!\n\n # cd into the project root\n project_root = options[:project_root] ||= Dir.getwd\n unless File.directory?(project_root)\n error(\"No such directory #{project_root}\")\n end\n Dir.chdir(project_root)\n script = validate_script!(script_name)\n params = config_parameters.concat(pig_parameters)\n\n ctrl = Mortar::Local::Controller.new\n ctrl.run(script, pig_version, params)\n end", "def program() @program end", "def execute_program\n @pc = @program_start\n \n end", "def run( file_name )\n application = select_app( file_name )\n system( \"#{application} #{file_name}\" )\n end", "def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end", "def run file_name\n application = select_app file_name\n system \"#{application} #{file_name}\"\n end", "def run file_name\n\t\tapplication = select_app file_name\n\t\tsystem \"#{application} #{file_name}\"\n\tend", "def run file_name \n\t\tapplication = select_app file_name \n\t\tsystem \"#{application} #{file_name}\" \n\tend", "def exec_local(opt)\n @command = [ @program, *opt ]\n #STDERR.print \"DEBUG: \", @command.join(\" \"), \"\\n\"\n @output = nil\n @log = nil\n Open3.popen3(*@command) do |din, dout, derr|\n din.close\n derr.sync = true\n t = Thread.start do\n @log = derr.read\n end\n ff = Bio::FlatFile.new(Bio::FastaFormat, dout)\n @output = ff.to_a\n t.join\n end\n @log\n end", "def run file_name \n application = select_app file_name \n system \"#{application} #{file_name}\" \n end", "def exec_local(filename1, filename2 = nil)\n @command = [ @program, filename1, (filename2 or @database), *@option ]\n @output = nil\n @log = nil\n @report = nil\n Open3.popen3(*@command) do |din, dout, derr|\n din.close\n derr.sync = true\n t = Thread.start { @log = derr.read }\n begin\n @output = dout.read\n @report = Bio::Sim4::Report.new(@output)\n ensure\n t.join\n end\n end\n @report\n end", "def program; end", "def exec_local(opt)\n @command = [ @program, *opt ]\n #STDERR.print \"DEBUG: \", @command.join(\" \"), \"\\n\"\n @log = nil\n\n Open3.popen3(*@command) do |din, dout, derr|\n din.close\n t = Thread.start do\n @errorlog = derr.read\n end\n @log = dout.read\n t.join\n end\n# @command_string = @command.join(\" \")\n# IO.popen(@command, \"r\") do |io|\n#\tio.sync = true\n#\t@log = io.read\n# end\n @log\n end", "def run(file_name)\n application = select_app(file_name)\n system \"#{application} #{file_name}\"\n end", "def run\n puts \"Hello world\"\n end", "def run_local(cmd)\n require 'English'\n\n system cmd\n return unless $CHILD_STATUS.exitstatus != 0\n puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s\n exit\nend", "def run_main\n end", "def run_local_story(filename, options={})\n run File.join(File.dirname(__FILE__), filename), options\nend", "def run\n\t\t require File.dirname(__FILE__) + \"/base\"\n\n\t\t require \"./experiments/experiment\"\n\t\t $: << \"./\"\n Experiment::Config::init @options.env\n\t\t @options.cv = Experiment::Config.get :cross_validations, 5 if @options.cv.nil?\n\t\t if @options.distributed\n\t\t require \"drb/drb\"\n\t\t require File.dirname(__FILE__) + \"/work_server\"\n\t\t puts \"Running in distributed mode. Run other machines with:\\nexperiment worker --address #{local_ip}\\n\"\n\t\t Notify::init @arguments.length * @options.cv, STDOUT, Experiment::Config::get(:growl_notifications, true)\n\t\t ws = WorkServer.new @arguments, @options, local_ip\n\t\t Notify::done\n\t\t return true\n \t else\n \t Notify::init @arguments.length * @options.cv, @options.quiet ? false : STDERR, Experiment::Config::get(:growl_notifications, !@options.quiet)\n\t\t\t @arguments.each do |exp|\n \t\t\t require \"./experiments/#{exp}/#{exp}\"\n \t\t\t cla = eval(as_class_name(exp))\n \t\t\t\texperiment = cla.new :normal, exp, @options\n \t\t\t\texperiment.run! @options.cv\n \t\t\tend\n\t\t\t Notify::done\n\t\t end\n\t\tend", "def run(path)\n if File.exist? path\n puts(path) ; system(\"ruby \" + path) \n end\nend", "def run\r\n return puts(\"usage example: glimmer run tictactoe\") unless @name\r\n # Search for the filename (and add the .rb extension if not provided), and run it\r\n if File.exist?(\"#{@name}#{'.rb' unless @name =~ /.rb$/}\")\r\n command = \"#{JRUBY_COMMAND} \\\"#{@name.gsub(/\\\\/, '/')}#{'.rb' unless @name =~ /.rb$/}\\\"\"\r\n else\r\n # Search for all installed samples and try to run of those\r\n command = \"#{JRUBY_COMMAND} \\\"#{SAMPLES_PATH}/#{fetch_app(@name)}.rb\\\"\"\r\n end\r\n puts \"Starting the application with following command:\"\r\n puts command\r\n system command\r\n end", "def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Benchmark.realtime do\n output_on_stdout = `#{cmd}`\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd} returned status code #{$?}\"\n end\n logger.trace \"command finished in #{(elapsed * 1000).round}ms\" if logger\n output_on_stdout\n end", "def run\n if not @test then\n @dirs.each do |dir|\n if @local\n `cd #{dir}; ./local-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task run: #{dir}\"\n else\n `cd #{dir}; ./pbs-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task queued: #{dir}\"\n end\n end\n end\n end", "def start\n Dir.chdir @working_directory do\n Aruba.platform.with_environment(environment) do\n @exit_status = system(command, *arguments) ? 0 : 1\n end\n end\n end", "def run\n testable = Parser.new(@argv).parse\n Executor.new(testable).execute\n end", "def run(*args)\n cli.run(*args)\n end", "def run_program_with runner\n @@runner_symbol = runner\n end", "def run_locally(cmd)\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Benchmark.realtime do\n output_on_stdout = `#{cmd}`\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd} returned status code #{$?}\"\n end\n logger.trace \"command finished in #{(elapsed * 1000).round}ms\" if logger\n output_on_stdout\n end", "def run(cmd)\n puts(cmd)\n system(cmd)\nend", "def runAlgosLocally(algosToRun)\n\tfor algoToRun in algosToRun\n\t\trunalgo(algoToRun[0], algoToRun[1])\n\t\t#system \"ruby #{$script_dir_for_cluster}/runalgo.rb #{algoToRun[0]} #{algoToRun[1]}\"\n\tend\nend", "def load_program(program, offset = 0)\n @program = program\n compile_program(@program)\n end", "def execute_local\n\t\tcurAp = @apListBox.value;\n\t\tcmd = getVal(\"exec-local in #{curAp.mac}\"); \n\t\treturn if cmd.nil? or cmd == \"\";\n\n\t\ta = curAp.execute_local(cmd).split( \"\\n\" );\n\t\t@entryListBox.empty\n\t\ta.each { |line|\n\t\t\t@entryListBox.add( \"#{line}\", {});\n\t\t}\n\tend", "def run_local(cmd)\n require 'English'\n\n system cmd\n return unless $CHILD_STATUS.exitstatus != 0\n\n puts 'exit code: ' + $CHILD_STATUS.exitstatus.to_s\n abort('Shell command failed, assuming you want to abort'.foreground(:red))\nend", "def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end", "def run_sketch\n ensure_exists(filename)\n spin_up('run.rb', filename, argc)\n end", "def run_host(ip)\n\n\t\tself.target_port = datastore['RPORT']\t\n\n\t\tbegin\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET'\n\t\t\t}, 10)\n\n\t\t\tif (res and res.headers['Server'])\n\t\t\t\textra = http_fingerprint(res)\n\t\t\t\tprint_status(\"#{ip} is running #{res.headers['Server']}#{extra}\")\n\n\t\t\t\trep_id = wmap_base_report_id(\n\t\t\t\t\t\twmap_target_host,\n\t\t\t\t\t\twmap_target_port,\n\t\t\t\t\t\twmap_target_ssl\n\t\t\t\t)\n\t\t\t\twmap_report(rep_id,'WEB_SERVER','TYPE',\"#{res.headers['Server']}#{extra}\",nil)\n\t\t\tend\n\t\t\t\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\n\tend", "def run\n @pid = fork do \n initialize_sandbox\n exec(@app)\n end\n\n _, @exit_status = Process.wait2(@pid)\n @pid\n end", "def Run222(programPath)\n file = File.open(programPath, \"w+\")\n\t\tfile.puts(\"Yes I am up!\")\n\t\tfile.close()\n end", "def main \n hash_literal = ARGV[0]\n options = eval(hash_literal)\n\n set_server_uri(options[:uri])\n start_server(options)\n end", "def manual_debug_code(program)\n print(\"[Starting a Debug Session with @#{caller.first}]\\n\")\n write_temp_file(strip_line_num(program))\n remote_info = setup_unix_doman_socket_remote_debuggee\n\n while !File.exist?(remote_info.sock_path)\n sleep 0.1\n end\n\n DEBUGGER__::Client.new([socket_path]).connect\n ensure\n kill_remote_debuggee remote_info\n end", "def init_with_program(prog); end", "def run(sketch, args)\n ensure_exists(sketch)\n spin_up('run.rb', sketch, args)\n end", "def run_locally(cmd)\n if dry_run\n return logger.debug \"executing locally: #{cmd.inspect}\"\n end\n logger.trace \"executing locally: #{cmd.inspect}\" if logger\n output_on_stdout = nil\n elapsed = Benchmark.realtime do\n output_on_stdout = `#{cmd}`\n end\n if $?.to_i > 0 # $? is command exit code (posix style)\n raise Capistrano::LocalArgumentError, \"Command #{cmd} returned status code #{$?}\"\n end\n logger.trace \"command finished in #{(elapsed * 1000).round}ms\" if logger\n output_on_stdout\n end", "def main\n @workspace.main\n end", "def run\n Byebug.mode = :standalone\n\n option_parser.order!($ARGV)\n return if non_script_option? || error_in_script?\n\n $PROGRAM_NAME = program\n\n Byebug.run_init_script if init_script\n\n loop do\n debug_program\n\n break if quit\n\n ControlProcessor.new(nil, interface).process_commands\n end\n end", "def exec_file(file)\n exec \"#{file}\"\n end", "def exe(cmd)\n puts \"executing: #{cmd}\"\n out = `#{cmd}`\n puts out\n out\n end", "def default_start_program\n _init_command('start')\n end", "def run(file, cmd, *args)\n env = Environment.load(source: file)\n exec env, cmd, *args\n end", "def run\n write_parameter_file\n Tandem.run_commandline_application\n end", "def run_program(cmd, input = \"\")\n stdout, = Open3.capture2e(shell_out_env, *cmd, stdin_data: input)\n\n stdout\n end", "def run\n env_args = @system_env ? [@system_env] : []\n options_args = @system_options ? [@system_options] : []\n system_args = [*env_args, *Rscons.command_executer, *@command, *options_args]\n\n @thread = Thread.new do\n system(*system_args)\n end\n end", "def run_script(path, script, *cli_params)\n on primary :backend do |host|\n within path do\n unless test \" [ -e #{script} ] \"\n error I18n.t('resource.not_exists_on_host', resource: script, host: host.hostname, scope: :dkdeploy)\n next\n end\n\n with fetch(:typo3_environment_cli) do\n execute :php, script, *cli_params\n end\n end\n end\n end", "def runner_command input_path, output_path\n # run as either local or hadoop\n case run_mode\n when 'local'\n $stderr.puts \" Reading STDIN / Writing STDOUT\"\n command = local_command input_path, output_path\n when 'hadoop', 'mapred'\n $stderr.puts \" Launching hadoop as\"\n command = hadoop_command input_path, output_path\n else\n raise \"Need to use --run=local or --run=hadoop; or to use the :default_run_mode in config.yaml just say --run \"\n end\n end", "def run(app)\n raise '@run already set' if @run\n\n @run = app\n end", "def main\n solar_system = create_solar_system\n cli(solar_system)\nend", "def run_local_task(task, params, options)\n # Make sure we're in a compiler to use the sensitive type\n with_a_compiler do |_comp|\n params = Bolt::Task::Run.wrap_sensitive(task, params)\n Bolt::Task::Run.run_task(\n task,\n empty_inventory.get_targets('localhost'),\n params,\n options,\n serial_executor\n )\n end\n end", "def program\n @compile\n end", "def debug_program(dbgr, ruby_path, program_to_debug)\n\n # Make sure Ruby script syntax checks okay.\n # Otherwise we get a load message that looks like trepanning has \n # a problem. \n output = `#{ruby_path} -c #{program_to_debug.inspect} 2>&1`\n if $?.exitstatus != 0 and RUBY_PLATFORM !~ /mswin/\n puts output\n exit $?.exitstatus \n end\n # print \"\\032\\032starting\\n\" if Trepan.annotate and Trepan.annotate > 2\n\n dbgr.trace_filter << self.method(:debug_program)\n dbgr.trace_filter << Kernel.method(:load)\n\n old_dollar_0 = $0\n\n # Without the dance below to set $0, setting it to a signifcantly\n # longer value will truncate it in some OS's. See\n # http://www.ruby-forum.com/topic/187083\n $progname = program_to_debug\n alias $0 $progname\n dollar_0_tracker = lambda {|val| $program_name = val} \n trace_var(:$0, dollar_0_tracker)\n\n dbgr.debugger(:hide_stack=>true) do\n dbgr.core.processor.hidelevels[Thread.current] = \n RubyVM::ThreadFrame.current.stack_size + 1\n Kernel::load program_to_debug\n end\n\n # The dance we have to undo to restore $0 and undo the mess created\n # above.\n $0 = old_dollar_0\n untrace_var(:$0, dollar_0_tracker)\n end", "def run_by\n prog = launched_from(Process.pid)\n\n case prog\n when %r{/sshd$}, '/usr/bin/login'\n 'interactive'\n when 'sshd:', '/usr/bin/python', '/lib/svc/bin/svc.startd'\n 'bootstrapper'\n when /cron/\n 'cron'\n else\n prog\n end\nend", "def run_test_file(executable)\n @last_cmd = executable\n @last_out = \"\"\n @last_err = \"\"\n ret = Host.run_and_output(executable.to_s.shellescape)\n\n # print any stack traces found during a failure\n print_stack_dump(executable) unless ret\n\n ret\n end", "def process(program)\n Verneuil::Process.new(program, context)\n end", "def program\n @_program ||= begin\n ptr = MemoryPointer::new( Program )\n error = OpenCL.clGetKernelInfo(self, PROGRAM, Program.size, ptr, nil)\n error_check(error)\n Program::new(ptr.read_pointer)\n end\n end", "def start\n @pid = Process.fork do\n if (@options.rack) \n # NOTE: This does not support command-line setting of repo!\n opts = { :server => :webrick, :host => @host, :port => @port}\n PlanR::Application::LocalHttpd::WebApp.run!( repo, opts ) \n else\n # rack doesn't do the one thing we need it to: \n # pass WebApp instantiation arguments to Webrick.mount\n opts = { :BindAddress => @host, :Port => @port}\n @webrick = ::WEBrick::HTTPServer.new(opts)\n @webrick.mount \"/\", Servlet,\n [ PlanR::Application::LocalHttpd::WebApp, \n @options ]\n @webrick.start\n end\n end\n\n trap('INT') { Process.kill 'INT', @pid }\n trap('TERM') { Process.kill 'INT', @pid }\n\n self\n end", "def main\n if system(ARGV.join(\" \"))\n exit 0\n else\n main\n end\nend", "def run(env_vars, extra_vars, playbook_path)\n run_via_cli(env_vars, extra_vars, :playbook_path => playbook_path)\n end", "def exec; end", "def exec; end", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\" if @options.verbose\n output_options if @options.verbose # [Optional]\n process_arguments\n # add parameters\n args = {}\n # TODO: use correct syntax for set\n args[:verbose] = @options.verbose if @options.verbose\n args[:input] = @options.input if @options.input\n args[:output] = @options.output if @options.output\n args[:map_name] = @options.map_name if @options.map_name\n args[:not_installed] = @options.cwd if @options.cwd\n \n program = Guy.new args\n program.work\n puts \"Finished at #{DateTime.now}\" if @options.verbose\n else\n output_usage\n end \n end", "def run(code)\n eval(code, binding)\n end", "def run\n puts \"#{@name} is running.\"\n end", "def run(_remote_host = nil, _remote_port = nil)\n @sink.host = _remote_host if not _remote_host.nil?\n @sink.port = _remote_port if not _remote_port.nil?\n raise 'Remote host not set!' if @sink.host == 'localhost'\n\n run_main(true)\n end", "def run\n program :name, 'Budik'\n program :version, VERSION\n program :description, @strings.description\n\n commands\n\n default_command :run\n\n run!\n end", "def live\n ensure_exists(filename)\n spin_up('live.rb', filename, argc)\n end", "def live\n ensure_exists(filename)\n spin_up('live.rb', filename, argc)\n end", "def run(cmd)\n print \"-> #{cmd}...\"\n system cmd\n print \"ok\\n\"\nend", "def main\n # Check that there was an argument supplied to the application\n if ARGV.length > 0\n # Convert the argument to an integer to be used as a port number\n port = ARGV[0].to_i\n if port < 1024 || port > 49151\n puts \"illegal port #{ARGV[0].to_i}: Choose one in range 1024-49151\"\n exit\n end\n else\n # If no port was specified, create a random port number\n port = Random.new.rand(48128) + 1024\n end\n serve port\nend", "def run_system\n sys = system(command)\n #binding.pry # false when no vpn. # true when finished. hurray!\n end", "def start_local_tunnel(bs_local, local_id, access_key)\n $logger.info 'Starting BrowserStack local tunnel'\n command = \"#{bs_local} -d start --key #{access_key} --local-identifier #{local_id} \" \\\n '--force-local --only-automate --force'\n\n # Extract the pid from the output so it gets killed at the end of the run\n output = Runner.run_command(command)[0][0]\n begin\n @pid = JSON.parse(output)['pid']\n $logger.info \"BrowserStackLocal daemon running under pid #{@pid}\"\n rescue JSON::ParserError\n $logger.warn 'Unable to parse pid from output, BrowserStackLocal will be left to die its own death'\n end\n end", "def program_device(hex_file_path, run_flag)\n @errors = []\n return false unless @programmer_path\n\n # Generate the command string with E(rase) and P(rogram).\n # Also, the \"run\" option invokes utility's S(tart) command.\n command = \"#{@programmer_path} E P#{hex_file_path}\"\n command += \" S\" if run_flag\n run_and_examine command\n end", "def main\n @main ||= RubyPython.import \"__main__\"\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(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to\n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to\n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def local_rake_executable\n rake.local_executable\n end", "def run\n log.info(\"Running...\")\n result = run_internal()\n log.info(\"Success! #{result.message}\")\n return result\n end", "def start_command\n \"%VCAP_LOCAL_RUNTIME% #{detect_main_file} $@\"\n end", "def run_cmd\n @run_cmd ||= local_suite_files.empty? ? nil : \"#{sudo}#{jr_bin} test\"\n end", "def run\n code = 0\n opt = OptionParser.new\n define_options(opt)\n default_options(opt)\n define_exit_codes(opt)\n argv = opt.parse!\n\n if @help\n puts_msg(opt.help)\n\n else\n begin\n main(argv)\n rescue Exception => e\n arr = @@exit_code_map[e.class]\n code = arr ? arr[0] : 1\n puts_err e.to_s\n puts_err \"[ERROR]\"\n end\n end\n\n exit(code)\n end", "def test_run\n\t\tmocked_prog = MiniTest::Mock.new(\"mocked program\")\n\t\tmocked_prog.expect(:run, 1)\n\t\tassert mocked_prog\n\tend", "def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end", "def run\n client.run\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(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to \n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def launch(app_id, args)\n runcmd 'launch', \"#{app_id} #{args}\" \n end", "def run(args)\n if not defined? Trepan::PROG_SCRIPT\n errmsg \"Don't know name of debugged program\"\n return\n end\n prog_script = Trepan::PROG_SCRIPT\n if not defined? Trepan::PROG_UNRESOLVED_SCRIPT\n # FIXME? Should ask for confirmation? \n msg \"Debugger was not called from the outset...\"\n trepan8_script = prog_script\n else \n trepan8_script = Trepan::PROG_UNRESOLVED_SCRIPT\n end\n begin\n Dir.chdir(Trepan::INITIAL_DIR)\n rescue\n print \"Failed to change initial directory #{Trepan::INITIAL_DIR}\"\n end\n if not File.exist?(File.expand_path(prog_script))\n errmsg \"Ruby program #{prog_script} doesn't exist\\n\"\n return\n end\n if not File.executable?(prog_script) and trepan8_script == prog_script\n msg \"Ruby program #{prog_script} doesn't seem to be executable...\"\n msg \"We'll add a call to Ruby.\\n\"\n ruby = begin defined?(Gem) ? Gem.ruby : \"ruby\" rescue \"ruby\" end\n trepan8_script = \"#{ruby} -I#{$:.join(' -I')} #{prog_script}\"\n else\n trepan8_script += ' '\n end\n if args.size == 1\n if not defined? Trepan::OldCommand.settings[:argv]\n errmsg \"Arguments have not been set. Use 'set args' to set them.\"\n return\n else\n argv = Trepan::OldCommand.settings[:argv]\n end\n else\n argv = [prog_script] + args[1..-1]\n end\n args = argv.join(' ')\n \n # An execv would be preferable to the \"exec\" below.\n cmd = trepan8_script + args\n msg \"Re exec'ing:\\n\\t#{cmd}\"\n exec cmd\n rescue Errno::EOPNOTSUPP\n msg \"Restart command is not available at this time.\"\n end", "def assert_program_presence!(name)\n sh(['which', name], echo: false, output: false)\n rescue\n raise \"Failed to find required program: #{name}\"\n end", "def run(code)\n\t\t\t@interpreter.run(code)\n\t\tend" ]
[ "0.69531864", "0.68587", "0.6522916", "0.6191551", "0.6101409", "0.6028299", "0.6013207", "0.599349", "0.5983679", "0.5983679", "0.59690535", "0.5917468", "0.588048", "0.5861798", "0.5851168", "0.5830518", "0.5827285", "0.5826208", "0.57766294", "0.5772347", "0.5694776", "0.5648308", "0.56479156", "0.564521", "0.56285536", "0.56092566", "0.55786014", "0.5560574", "0.55590737", "0.55057025", "0.5483119", "0.54589844", "0.54581493", "0.5432319", "0.5418507", "0.538481", "0.5380479", "0.5370763", "0.5370763", "0.536823", "0.5366573", "0.5357081", "0.5346736", "0.53373164", "0.5330367", "0.5319685", "0.5313189", "0.5307101", "0.5305382", "0.5300389", "0.5293736", "0.5280618", "0.52781606", "0.52752775", "0.5262926", "0.52621454", "0.52511233", "0.52494943", "0.5248151", "0.5215071", "0.52149856", "0.52127737", "0.51954997", "0.5193497", "0.51884043", "0.51837003", "0.5179781", "0.51718926", "0.5163086", "0.5159097", "0.5157079", "0.5157079", "0.51547074", "0.5153684", "0.5140591", "0.5134413", "0.5128947", "0.5127041", "0.5127041", "0.51268166", "0.5117683", "0.51165503", "0.51096845", "0.5103197", "0.5095956", "0.5088858", "0.5088858", "0.50851727", "0.50835794", "0.5081592", "0.5080014", "0.5076418", "0.5075897", "0.5067352", "0.50640804", "0.5060987", "0.50566936", "0.50505126", "0.50488466", "0.5047638" ]
0.6893583
1
Prints out a message.
def echo(message) puts message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_message(msg)\n print \">> #{msg.to_s} \\n\"\n end", "def print(message)\n output.print(message)\n end", "def message(msg)\n STDOUT.puts msg\n end", "def msg(message)\n stdout.puts message\n end", "def print(msg = '')\n clear_line\n print_no_newline(msg)\n end", "def print_message_text()\n @renderer.puts(\"Msg: #{@message_to_post.text_for_display}\")\n end", "def print(msg)\n info(msg)\n end", "def display(msg)\n puts\n puts msg\n end", "def print(message); end", "def print(message); end", "def puts(message)\n @out.puts message\n end", "def display(msg)\n stdout.puts msg\n return \"#{msg}\\n\"\n end", "def puts(message)\n output.puts(message)\n end", "def say(msg)\n print msg + \"\\r\\n\"\n end", "def info(message)\n puts \"\\e[35m#{message}\\e[0m\"\n end", "def message(message, options = {})\n options[:prefix] ||= \"*** \"\n options[:color] ||= :white\n output message, options\n end", "def print(msg)\n out_stream.print(msg) if out_stream\n end", "def print(msg)\n Java::OrgFusesourceJansi::AnsiConsole::out.print msg\n end", "def tell(message)\n puts message\n end", "def puts(msg = '')\n print(\"#{msg}\\n\")\n end", "def send(message)\n puts prefix + message\n end", "def show_message(message)\n puts message\nend", "def show_message(message)\n puts message\nend", "def show_message(message)\n puts message\nend", "def output_message msg\n puts \"***** #{msg} *****\"\nend", "def display(message)\n __display(message)\n end", "def puts(msg)\n info(msg)\n end", "def message(message)\n Kernel.puts(message.to_s)\nend", "def puts(message); end", "def action(message)\n print(6, message)\n end", "def puts message\n print \">> \" + message +\"\\n\"\nend", "def pp(message)\n puts \"[#{NAME}] #{message}\"\nend", "def puts_msg(msg)\n STDOUT.puts(msg)\n end", "def message( *parts )\n\t\t$stdout.puts( *parts )\n\tend", "def message(string)\n puts\n puts \"--> #{ string }\"\nend", "def message(string)\n puts\n puts \"--> #{ string }\"\nend", "def message(string)\n puts\n puts \"--> #{ string }\"\nend", "def message(message)\n Kernel.puts(\"=> #{message}\")\nend", "def m_in(message)\n\t\tputs \"> #{Time.now} #{message}\"\n\tend", "def say(message)\n puts green(message) if self.verbose \n end", "def plain_output(message, color)\n if @options['without-color']\n puts message\n else\n puts Colorize.send(color, message)\n end\n end", "def info(message)\n print(5, message)\n end", "def print_stdout(msg)\n puts \" #{msg}\"\n end", "def say(message)\n output.puts message\n end", "def out(msg)\n io.print(msg) if io\n end", "def output(msg)\n puts \"*****#{msg}*****\"\nend", "def print_command(msg)\n puts \" #{color(\"$\", 32)} #{color(msg, 32)}\"\n end", "def ui_message(message)\n puts message\n end", "def puts(msg)\n @out.puts msg unless @silent\n end", "def puts(msg) # rubocop:disable Lint/UnusedMethodArgument\n info(msg)\n end", "def print_msg(message_id)\n puts @messages[message_id]\n end", "def print_status(msg)\n puts \"\" if verbose_mode?\n puts \"#{color('----->', 32)} #{msg}\"\n end", "def puts (msg)\n $stderr.puts msg\n end", "def print(msg) # rubocop:disable Lint/UnusedMethodArgument\n info(msg)\n end", "def print_raw(msg = '')\n\t\t$stdout.print(msg)\n\t\t$stdout.flush\n\n\t\tmsg\n\tend", "def print(msg)\n message = msg['message']\n @logger.debug(\"Printing msg #{message}\")\n print_raw(message)\n end", "def info(msg)\n puts msg\n end", "def show(msg)\n puts 'EXAMPLE<basic> ' + msg\nend", "def puts(msg)\n @buffer << \"#{msg}\\n\"\n end", "def shout(message)\n output.puts Paint[message, :bold, :red ]\n end", "def tell_user(message, stdout: $stdout)\n stdout.puts message\n end", "def display(msg)\n puts \"=\" * 15 + \" REQUEST \" + \"=\" * 15 \n puts msg\n puts \"=\" * 15 + \" EOF REQUEST \" + \"=\" * 15\n end", "def print_ok(msg)\n tag = '[ OK ]'\n print_formatted(tag,msg)\n end", "def bye_message\n message = \"Panacea's work is done, enjoy!\"\n say \"\\n\\n\\e[34m#{message}\\e[0m\"\n end", "def say text\n @output.say text\n end", "def print(color, message, nl = true)\n $stdout.print(\"\\e[34;1m[Level#{@level}] \\e[#{30 + color};22m#{message}\\e[0m\")\n $stdout.puts if nl\n end", "def say text\n @output.say text\n end", "def puts(message)\n session_command(:echo, message)\n end", "def info(message)\n puts(stdout, message)\n end", "def disp_msg(msg_in)\n puts \"=> #{msg_in}\"\nend", "def message(output)\n puts \"\"\n puts output\nend", "def display\n wrap_in_border do\n print_space(:before)\n puts formatted_message\n print_space(:after)\n end\n sleep @display_seconds if !@display_seconds.nil?\n clear if @clear_after_display\n @message\n end", "def message cmd, msg\n print_message cmd, 'INFO', msg\nend", "def output_message message, color\n case color\n when :black\n puts message.black\n when :red\n puts message.red\n when :green\n puts message.green\n when :yellow\n puts message.yellow\n when :blue\n puts message.blue\n when :magenta\n puts message.magenta\n when :cyan\n puts message.cyan\n else\n puts message\n end\n end", "def show_info(message)\n say \"Information\", message, :cyan\n end", "def ok(message=\"\")\n\t\t\t\tputs \"[ #{green('Ok')} ] #{message}\"\n\t\t\tend", "def show(msg)\n message(\"show\", :red, msg)\n end", "def plain message\n reopen unless @filename == nil\n\n @device.print message + \"\\n\"\n end", "def show(msg)\n puts msg\n false\n end", "def info_msg(msg=\"\")\n puts(msg)\n @file.puts(msg)\n end", "def print_status_message text=$status_message\n r = $status_message_row || Ncurses.LINES-1\n clear_error r, $datacolor\n # print it in centre\n printstring r, (Ncurses.COLS-text.length)/2, text, color = $promptcolor\n end", "def info(msg)\n if Dotgpg.interactive?\n $stdout.puts msg\n end\n end", "def farewell_message\n puts \"\"\n puts \"Cheers! \\u{1f37b}\" # beer emoji 🍻\n end", "def print(message)\n\t\ttime = Time.now\n\n\t\t@duration += (time - @lastMessageTime)\n\n\t\t@lastMessageTime = time\n\n\t\t@message = message\n\n\tend", "def print_raw(msg = '')\n if (Rex::Compat.is_windows and supports_color?)\n WindowsConsoleColorSupport.new(io).write(msg)\n else\n io.print(msg)\n end\n\n io.flush\n\n msg\n end", "def output\n\t\tif @@message_box.length < 5 \n\t\t\t(5 - @@message_box.length).times { @@message_box << \"\\n\" }\n\t\tend\n\t\tputs @@message_box[0] \n\t\tputs @@message_box[1]\n\t\tputs @@v_row.join \n\t\tputs @@message_box[2]\n\t\tputs @@message_box[3]\n\t\tputs @@message_box[4]\n\tend", "def header(message)\n puts \"\\n\"\n puts '+---'\n puts \"| #{message}\"\n puts '+---'\nend", "def msg(message)\n puts message unless nagios_mode?\n end", "def message text\n $stderr.puts text\n end", "def message text\n $stderr.puts text\n end", "def emit(message, print)\n message = message.strip_heredoc.strip\n\n if print\n puts\n puts message\n puts\n\n # getting a huge string back in IRB is annoying as fawk.\n return nil\n end\n\n # Alternatively, if you turn of printing you *can* get the string back. Helpful for scripting\n # or testing.\n self.uncolored message\n end", "def print(*args); msg channel, args.join(\" \"); end", "def output(message, type)\n puts \"\\e[31m[ ✘ ]\\e[0m #{message}\" if type == 'error'\n puts \"\\e[32m[ ✔︎ ]\\e[0m #{message}\" if type == 'success'\n puts \"\\e[33m[ ✻ ]\\e[0m #{message}\" if type == 'info'\nend", "def message(string)\n puts \"==> #{string}\"\nend", "def print_formatted(tag, msg)\n puts \"#{tag}: #{msg}\"\n end", "def print msg, color\n @text[2] = @text[1]\n @text[1] = @text[0]\n @text[0] = Message.new(msg, color, 18)\n end", "def print\n result = \"\"\n messages.each do |message|\n result += Thimbl::Utils.parse_time( message['time'] ).strftime( '%Y-%m-%d %H:%M:%S' )\n result += \" #{message['address']}\"\n result += \" > #{message['text']}\"\n result += \"\\n\"\n end\n \n return result\n end", "def print(msg)\r\n puts msg\r\n exit(0)\r\n end", "def msg(m)\n print m + \"... \"\n $stdout.flush\n if block_given?\n msg = yield\n if msg.nil?\n ok\n else\n puts msg\n end\n end\n end", "def message(string)\n puts\n puts \"[#{colorize(\"--\", \"blue\")}] #{ string }\"\nend" ]
[ "0.82025903", "0.8136033", "0.7783097", "0.7782362", "0.77149785", "0.7577262", "0.7570735", "0.75509006", "0.7514466", "0.7514466", "0.7495838", "0.7434366", "0.7385435", "0.73768455", "0.73505324", "0.73366743", "0.73358387", "0.7326738", "0.7325645", "0.726797", "0.7266087", "0.72529846", "0.72529846", "0.72529846", "0.72422606", "0.72405875", "0.7235789", "0.72153485", "0.7205594", "0.7186673", "0.7182386", "0.71178436", "0.7102977", "0.7083454", "0.7067638", "0.7067638", "0.7067638", "0.7053024", "0.7048767", "0.701581", "0.69999963", "0.6992784", "0.69386125", "0.69317555", "0.6918362", "0.6908775", "0.69034266", "0.6897437", "0.6864713", "0.6850372", "0.6849518", "0.6843381", "0.6829969", "0.68250823", "0.6798794", "0.6789254", "0.6778695", "0.677797", "0.6774248", "0.67723775", "0.6771699", "0.6750429", "0.67499375", "0.6748472", "0.6746055", "0.6735555", "0.6733003", "0.67214423", "0.6715005", "0.6709305", "0.66997534", "0.669198", "0.6691428", "0.66871256", "0.667587", "0.66613096", "0.6642462", "0.66325575", "0.66320163", "0.6620981", "0.6619404", "0.66187805", "0.66128236", "0.66091245", "0.65971035", "0.6595853", "0.6594432", "0.65919775", "0.6590984", "0.6590984", "0.65886503", "0.658737", "0.65834665", "0.6582791", "0.65742064", "0.6556756", "0.654699", "0.6541389", "0.65315694", "0.6512975" ]
0.7578541
5
Changes the current working directory.
def cd(path,&block) if block cwd = Dir.pwd Dir.chdir(path) block.call() Dir.chdir(cwd) else Dir.chdir(path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chdir; end", "def chdir(path)\n ensure_relative_path! :chdir, path\n @path += path\n end", "def cd(target = ENV['HOME'])\n Dir.chdir(target.strip)\n \"Directory changed to #{Dir.pwd}\"\n end", "def change_dir f\n unless File.directory? f\n perror \"#{f} is not a directory, or does not exist.\"\n return\n end\n\n # before leaving a dir we save it in the list, as well as the cursor\n # position, so we can restore that position when we return\n @visited_dirs.insert(0, Dir.pwd)\n save_dir_pos\n\n f = expand_path(f)\n Dir.chdir f\n @current_dir = Dir.pwd # 2019-04-24 - earlier was in post_cd but too late\n read_directory\n post_cd\n\n redraw_required\nend", "def excel_change_directory(new_wd)\n new_wd = File.expand_path(new_wd)\n raise ExcelError.new(\"Cannot change working directory - '#{new_wd}' does not exist\") unless File.exist?(new_wd)\n\n begin\n orig_wd_w = Converter.to_windows_path(Dir.pwd)\n new_wd_w = Converter.to_windows_path(new_wd)\n # In some machines, ChDir will not change the directory immediately.\n # So to make sure, first change the drive and then change the directory if the directory is absolute.\n excel_call('ChangeWorkingDrive', new_wd_w[0..1]) if new_wd_w[1] == ?:\n excel_call('ChangeWorkingDirectory', new_wd_w)\n current_dir = excel_call('ShowWorkingDirectory')\n @logger.trace('Changed Excel.exe working directory: ' + current_dir)\n # Execute the provided block.\n yield\n ensure\n # All done, reset working directory.\n excel_call('ChangeWorkingDrive', orig_wd_w[0..1]) if orig_wd_w[1] == ?:\n excel_call('ChangeWorkingDirectory', orig_wd_w)\n current_dir = excel_call('ShowWorkingDirectory')\n @logger.trace('Reset Excel.exe working directory: ' + current_dir)\n end\n end", "def chdir(dir=nil)\n @chdir = dir.to_s if dir\n @chdir\n end", "def chdir=(dir)\n @chdir = dir.to_s\n end", "def chdir(&block)\n Dir.chdir(self, &block)\n end", "def work_dir=(path)\n path << '/' unless path.end_with?('/')\n @work_dir = path\n end", "def cd(path)\n Dir.chdir(path)\n \"cd #{path}\"\n end", "def cd(dir = nil)\n d = dir\n case d\n when File, Dir\n d = d.path if File.directory?(d.path)\n end\n $env.chdir(d)\nend", "def chdir(dir)\n previous_dir = File.expand_path(\".\")\n\n Dir.chdir(dir)\n begin\n @p4.cwd = File.expand_path(\".\")\n rescue\n Dir.chdir(previous_dir)\n raise\n end\n\n if block_given?\n begin\n yield dir\n ensure\n Dir.chdir(previous_dir)\n @p4.cwd = previous_dir\n end\n end\n end", "def change_dir(iDir)\n lOldDir = Dir.getwd\n Dir.chdir(iDir)\n begin\n yield\n rescue Exception\n Dir.chdir(lOldDir)\n raise\n end\n Dir.chdir(lOldDir)\n end", "def chdir(dir)\n puts Dir.pwd\n\n Dir.chdir(dir) do\n puts Dir.pwd\n end\nend", "def chdir(&block)\n Dir.chdir(top_level, &block)\n end", "def cd(dir = nil)\n dir ||= homedir\n dir = expand_path(dir)\n @cwd = dir\n end", "def working_dir(&block)\n return Dir.chdir(@working_dir, &block) if block_given?\n @working_dir\n end", "def change_dir(dir)\n begin\n return true if Dir.chdir(dir)\n rescue Exception => error\n Loggers::Main.log.warn error.message\n exit 5\n end\n end", "def set_workdir(filename)\n @workdir = File.dirname(filename)\n end", "def chdir(path)\n ensure_relative_path! :chdir, path\n @ftp.chdir path\n end", "def changePath(path, &block)\n currPath = Dir.pwd\n begin\n Dir.chdir(path)\n result = block.call\n Dir.chdir(currPath)\n result\n rescue\n Dir.chdir(currPath)\n raise $!\n end\nend", "def working_directory=(directory)\n @link.WorkingDirectory = directory.tr('/', \"\\\\\")\n end", "def working_dir(*path)\n if _working_dir.nil?\n @_working_dir = ENV['PROJECT_WORKING_DIR']\n if _working_dir != nil\n @_working_dir = Pathname.new(expand_variables _working_dir)\n Dir.chdir _working_dir.to_s\n\n elsif run_mode == :daemon\n @_working_dir = state_dir\n Dir.chdir _working_dir.to_s\n\n else\n @_working_dir = Pathname.getwd\n end\n\n raise \"working_dir not a directory: #{_working_dir.safe_s}\" unless _working_dir.directory?\n end\n [_working_dir, *path].reduce(:+)\n end", "def chdir(&block)\n ::Dir.chdir(path, &block)\n end", "def write_curdir\n f = File.expand_path('~/.fff_d')\n s = Dir.pwd\n File.open(f, 'w') do |f2|\n f2.puts s\n end\n # puts \"Written #{s} to #{f}\"\nend", "def chdir(&block)\n warn \"Path::Name#chdir is obsoleted. Use Dir.chdir.\"\n Dir.chdir(path, &block)\n end", "def set_dir(new_dir)\n # checking for / at the end of the env variable\n new_dir = '' unless new_dir\n new_dir += '/' unless new_dir[-1, 1] == '/'\n @dir = new_dir\n end", "def cd( path = File.expand_path('~') )\n new_last_path = FileUtils.pwd\n if path == '-'\n if @last_path\n path = @last_path\n else\n warn 'Sorry, there is no previous directory.'\n return\n end\n end\n cd path\n @last_path = new_last_path\n ls\n end", "def chdir(&block)\n Dir.chdir(ROOT.join(name), &block)\n end", "def working_directory(v)\n @options[:working_directory] = v\n end", "def push_dir(dir = nil)\n @directory_stack.push(Dir.pwd)\n self.chdir(dir)\n end", "def within_dir dir, &blk\n cur_dir = Dir.getwd\n Dir.chdir(dir)\n yield\n Dir.chdir(cur_dir)\n end", "def chdir(dir, &block)\n Dir.chdir(File.expand_path(dir), &block)\n end", "def in_path(path, &blk)\n old = Dir.pwd\n Dir.chdir path\n say_status :cd, path\n yield\n Dir.chdir old\n end", "def restore_dir\n cd @dir\n end", "def cd( path = '~' )\n new_last_path = FileUtils.pwd\n if path == '-'\n unless path = Irbtools.instance_variable_get(:@last_cd_path)\n warn 'Sorry, there is no previous directory.'\n return\n end\n end\n super(File.expand_path(path))\n Irbtools.instance_variable_set(:@last_cd_path, new_last_path)\n ls\n end", "def [](fpath=nil)\n if fpath.nil? || fpath.index('/') == 0\n @rye_current_working_directory = fpath\n else\n # Append to non-absolute paths\n if @rye_current_working_directory\n newpath = File.join(@rye_current_working_directory, fpath)\n @rye_current_working_directory = newpath\n else\n @rye_current_working_directory = fpath\n end\n end\n debug \"CWD: #{@rye_current_working_directory}\"\n self\n end", "def in_directory(working_dir)\n old_dir = Dir.pwd\n begin\n Dir.chdir working_dir\n yield\n ensure\n Dir.chdir old_dir\n end\n end", "def chroot\n Dir.chdir '/'\n File.umask 0000\n end", "def sync_dir(dir=Dir.getwd)\n @r.cmd \"setwd('#{dir}')\"\n end", "def store_dir\n @dir = Dir.pwd\n end", "def current_working_directory; @rye_current_working_directory; end", "def inside_cookbook(&block)\n cookbook_path = File.join(Strainer.sandbox_path.to_s, @cookbook.cookbook_name)\n Strainer.ui.debug \"Changing working directory to '#{cookbook_path}'\"\n original_pwd = ENV['PWD']\n\n ENV['PWD'] = cookbook_path\n success = Dir.chdir(cookbook_path, &block)\n ENV['PWD'] = original_pwd\n\n Strainer.ui.debug \"Restoring working directory to '#{original_pwd}'\"\n success\n end", "def working_dir\n ENV['PWD'] || Dir.pwd\n end", "def chroot\n warn \"Path::Name#chroot is obsoleted. Use Dir.chroot.\"\n Dir.chroot(path)\n end", "def chdir # :yields: the Git::Path\n Dir.chdir(dir.path) do\n yield dir.path\n end\n end", "def set_git_path basedir\n @git_path = basedir\n end", "def update_working_dir(index, dir, name, format)\n unless @repo.bare\n path =\n if dir == ''\n page_file_name(name, format)\n else\n ::File.join(dir, page_file_name(name, format))\n end\n\n Dir.chdir(::File.join(@repo.path, '..')) do\n if file_path_scheduled_for_deletion?(index.tree, path)\n @repo.git.rm({'f' => true}, '--', path)\n else\n @repo.git.checkout({}, 'HEAD', '--', path)\n end\n end\n end\n end", "def current_dir; end", "def change_dir f, pos=nil\nend", "def exec_in_git_dir(&block)\n Dir.chdir(top_level, &block)\n end", "def restart_dir; end", "def set_current_path(path)\n @current_path = path\nend", "def chdir(dest, &block)\n if block\n Dir.chdir(dest, &block)\n else\n if !defined? @original_dir\n @original_dir = Dir.pwd\n @cleaners << -> { Dir.chdir(@original_dir); @original_dir=nil }\n end\n Dir.chdir(dest)\n end\n end", "def set_current_path; end", "def chdir_to_repo(repo_name)\n repo_path = \"#{settings['build_dir']}/#{repo_name}\"\n assert_path_exists(repo_path, \"This is the expected path to the repo: #{repo_name}\")\n stdout.verbose(\"Changing to dir: #{repo_path}\")\n FileUtils.chdir(repo_path)\n @repo_context = repo_name\n @submodule_context = ''\n end", "def folder_changed(choo_dir, choo_file)\n dir = choo_dir.filename\n choo_file.current_folder = dir\nend", "def change_directory_for_start\n \"cd tomcat\"\n end", "def cwd\n return cd(\"\").to_s\n end", "def cd(path = nil)\n Cd.cd(path)\n end", "def cd(dir = '~', pushd: true)\n dir = load_item path: expand_path(dir) unless dir.is_a? Item\n unless dir.zip?\n Dir.chdir dir\n @current_zip = nil\n else\n @current_zip = dir\n end\n @dir_history << current_dir if current_dir && pushd\n @current_dir, @current_page, @current_row = dir, 0, nil\n main.activate_pane 0\n ls\n @current_dir\n end", "def workdir\n result = base.join('cache')\n result.mkpath\n result\n end", "def symlink_current_dir\n @shell.symlink self.checkout_path, self.current_path\n end", "def current_directory\n File.expand_path @current_directory\n end", "def cwd\n @cwd ||= begin\n exec! 'pwd'\n rescue => e\n raise e\n '/'\n end\n end", "def exec_in_git_dir(&block)\n curr = Dir.getwd\n result = nil\n begin\n Dir.chdir top_level\n result = yield\n rescue\n raise\n ensure\n Dir.chdir curr\n end\n result\n end", "def do_into_dir(dir, t)\n Dir.chdir dir do\n t.call\n end\nend", "def ExecuteInPath(path)\n currentFolder = Dir.pwd\n Dir.chdir(path.AbsolutePath())\n yield if block_given?\n Dir.chdir(currentFolder)\n end", "def work_dir; end", "def cwd\n Dir.getwd\n end", "def cd(key, options = {})\n return 1 unless self.class.subkeys.include?(key)\n begin\n puts \"Changing working directory to: #{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"\n FileUtils.cd(Dir[\"#{MDT::DataStorage.instance.versioned_base_path}/#{MDT::DataStorage.instance.versioned_releases_dirname}/#{MDT::DataStorage.instance.versioned_version_id}\"].first)\n 0\n rescue\n 1\n end\n end", "def cwd\n @target.is_a?(String) && File.directory?(@target) ? @target : \"./\"\n end", "def cd(path,&block)\n @history << ['cd', path]\n\n if block\n block.call() if block\n\n @history << ['cd', '-']\n end\n end", "def update\n working_dir do\n git 'checkout', working_dir\n git 'clean', '-fd'\n git 'checkout', 'master'\n git 'pull'\n git 'fetch', 'origin'\n git 'checkout', branch\n git 'submodule', 'update', '--init'\n end\n end", "def cd(path)\n @history << ['cd', path]\n\n if block_given?\n yield\n @history << ['cd', '-']\n end\n end", "def working_directory\n @options[:working_directory]\n end", "def teardown\n Dir.chdir @previous_wd # restore the working directory to what it was previously\n end", "def path=(path=\"\")\n path = Dir.pwd if not path or path.empty?\n @path = File.expand_path(path)\n end", "def jump_to(path, &block)\n Dir.chdir(test_content_dirs(path), &block)\nend", "def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, OPT_TABLE['cd']\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block)\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end", "def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, OPT_TABLE['cd']\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block)\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end", "def setPath(path)\n @currentPath = path.clone\n @root = @currentPath.getRoot unless path.empty?\n end", "def dir\n @working_directory\n end", "def setup\n switch_dir\n end", "def set_path\n self.path = File.join(self.store_dir, self.filename)\n end", "def working_dir\n @_working_dir ||= File.expand_path(options['merb-root'] || Dir.pwd)\n end", "def working_dir\n @_working_dir ||= File.expand_path(options['merb-root'] || Dir.pwd)\n end", "def working_dir\n @_working_dir ||= File.expand_path(options['merb-root'] || Dir.pwd)\n end", "def update_working_dir(path, branch)\n # path is of form username/project_name\n ids = path.split('/')\n project_owner = User.find_by(username: ids.first.to_s.downcase)\n @project = Project.with_deleted.find_by user_id: project_owner.id,\n name: ids.last.to_s.downcase\n\n # update of username/project/satellite with rugged\n @sat_repo = @project.satelliterepo\n bare_remote = @project.satelliterepo.remotes['bare']\n bare_remote = @sat_repo.remotes.create 'bare', @project.barerepo.path unless bare_remote\n # fetch from the bare remote\n bare_remote.fetch\n remote_branch = @sat_repo.branches[\"refs/remotes/bare/#{branch}\"]\n local_branch = @sat_repo.branches[\"#{branch}\"]\n local_branch = @sat_repo\n .create_branch(\"#{branch}\", \"remotes/bare/#{branch}\") unless local_branch\n\n # checkout the branch, sync the refs and force checkout head to keep\n # working dir clean\n @sat_repo.checkout local_branch.name\n @sat_repo.references.update(@sat_repo.head.resolve, remote_branch.target_id)\n @sat_repo.checkout local_branch.name, strategy: :force\n end", "def update\n working_dir do\n git 'fetch', 'origin'\n git 'checkout', branch\n git 'reset', '--hard', \"origin/#{branch}\"\n git 'submodule', 'update', '--init'\n end\n end", "def setDir _obj, _args\n \"_obj setDir _args;\" \n end", "def reset_dir(pathname)\n\tputs \" Deleting and recreating #{pathname} folder\"\n\tFileUtils.rm_rf(pathname) unless not Dir.exist?(pathname)\n\tDir.mkdir(pathname)\nend", "def cd(dir, options = {}, &block) # :yield: dir\r\n fu_check_options options, :noop, :verbose\r\n fu_output_message \"cd #{dir}\" if options[:verbose]\r\n Dir.chdir(dir, &block) unless options[:noop]\r\n fu_output_message 'cd -' if options[:verbose] and block\r\n end", "def save_dir(filename)\n @save_save_dir = @dispatch.save_dir\n @dispatch.save_dir = File.dirname(filename)\n end", "def cwd\n File.expand_path(@options[:cwd] || \".\")\n end", "def cd(arg)\n config_options = configuration_with_overrides(options)\n config_options.run_initializers! context: :static\n\n directive = arg.split(\"/\")\n unless directive[1]\n Bridgetown.logger.warn(\"Oops!\", \"Your command needs to be in the <origin/dir> format\")\n return\n end\n\n manifest = config_options.source_manifests.find do |source_manifest|\n source_manifest.origin.to_s == directive[0]\n end\n\n if manifest.respond_to?(directive[1].downcase)\n dir = manifest.send(directive[1].downcase)\n Bridgetown.logger.info(\"Opening the #{dir.green} folder for\" \\\n \" #{manifest.origin.to_s.cyan}…\")\n Bridgetown.logger.info(\"Type #{\"exit\".yellow} when you're done to\" \\\n \" return to your site root.\")\n puts\n\n # rubocop: disable Style/RedundantCondition\n Dir.chdir dir do\n ENV[\"BRIDGETOWN_SITE\"] = config_options.root_dir\n if ENV[\"SHELL\"]\n system(ENV[\"SHELL\"])\n else\n system(\"/bin/sh\")\n end\n end\n # rubocop: enable Style/RedundantCondition\n\n puts\n Bridgetown.logger.info(\"Done!\", \"You're back in #{Dir.pwd.green}\")\n else\n Bridgetown.logger.warn(\"Oops!\", \"I wasn't able to find the\" \\\n \" #{directive[1]} folder for #{directive[0]}\")\n end\n end", "def getwd\n Dir.getwd\n end", "def run_cwd(dir = resource[:path])\n result = nil\n Dir.chdir(dir) do\n result = yield.chomp\n end\n result\n end", "def current path=nil\n current = `pwd`.strip + \"/\"\n if path\n current + path \n else\n current\n end\nend", "def loadDir(dirname)\n\t\told = Dir.getwd()\n\t\tDir.chdir(dirname)\n\t\tret = self._loadDir(dirname)\n\t\tDir.chdir(old)\n\t\treturn ret\n\tend" ]
[ "0.7231913", "0.7016624", "0.69395834", "0.6899795", "0.67380613", "0.67330027", "0.6712974", "0.6612908", "0.6517972", "0.6497891", "0.64919966", "0.6487929", "0.64867973", "0.6484557", "0.64830977", "0.6446424", "0.6394484", "0.63352346", "0.63135314", "0.6305189", "0.62720406", "0.62624353", "0.6234054", "0.62155175", "0.618794", "0.61873704", "0.61873347", "0.61736256", "0.61458945", "0.61303484", "0.6080545", "0.60402495", "0.6039882", "0.6037273", "0.6033377", "0.60317576", "0.60266954", "0.6015103", "0.59274423", "0.5923332", "0.5903567", "0.59022236", "0.5857157", "0.58341384", "0.58337724", "0.58280516", "0.57983357", "0.57849014", "0.57738495", "0.5771785", "0.57340616", "0.57101315", "0.5704462", "0.57017374", "0.5677484", "0.5674546", "0.5672353", "0.5671362", "0.5642852", "0.5631952", "0.5613313", "0.554381", "0.5542693", "0.5533647", "0.55306333", "0.5530303", "0.5526661", "0.5520488", "0.5520362", "0.55146366", "0.5478378", "0.54586893", "0.54461986", "0.5436597", "0.542296", "0.5421283", "0.5412056", "0.53954697", "0.5376059", "0.5359509", "0.5359509", "0.5355854", "0.5354341", "0.5332928", "0.5330581", "0.53293467", "0.53293467", "0.53293467", "0.5301289", "0.5299386", "0.5288129", "0.52684754", "0.5268426", "0.5257144", "0.52547985", "0.5248346", "0.5247265", "0.5238882", "0.52348864", "0.5209229" ]
0.58607316
42
Only allow a trusted parameter "white list" through.
def tv_episode_params params.require(:tv_episode).permit(:title, :tmdb_episode_id, :description, :air_date, :episode_number, :season_number, :tvshow_image_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Examples p no_dupes?([1, 1, 2, 1, 3, 2, 4]) => [3, 4] p no_dupes?(['x', 'x', 'y', 'z', 'z']) => ['y'] p no_dupes?([true, true, true]) => []
def no_consecutive_repeats?(arr) (0...arr.length - 1).each { |i| return false if arr[i] == arr[i + 1] } true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_array\nend", "def no_dupes?(arr)\n arr.reject do |ele|\n # debugger\n arr.count(ele) > 1\n end\nend", "def nondupes(array)\n array.map do |elem| \n array.count(elem) == 1\n \n end\n \nend", "def no_dupes?(arr)\n count_hash = Hash.new(0)\n non_dupes = []\n\n arr.each { |ele| count_hash[ele] += 1 }\n\n count_hash.each do |key, val|\n non_dupes << key if val == 1\n end\n\n non_dupes\nend", "def no_dupes?(arr)\n count = Hash.new(0)\n arr.each { |el| count[el] += 1 }\n count.keys.select { |el| count[el] == 1 }\nend", "def has_no_duplicates?(arr)\n !(arr.uniq.size < arr.size)\n end", "def hasDupes(a)\n return a.uniq.length == a.length\nend", "def no_dupes?(array)\n hash = Hash.new(0)\n array.each do |ele|\n hash[ele] += 1\n end\n new_array = []\n hash.each do |k, v|\n new_array << k if v == 1\n end\n return new_array\nend", "def no_dupes?(arr)\n count = Hash.new(0)\n\n arr.each { |ele| count[ele] += 1 }\n\n array = []\n count.each { |k, v| array << k if v == 1 }\n\n array\nend", "def no_dupes?(arr)\n counter = Hash.new(0)\n arr.each { |ele| counter[ele] +=1 }\n \n # new_array = []\n # counter.each do |k,v|\n # new_array << k if v == 1\n # end\n # new_array\n counter.keys.select { |el| counter[el] == 1 }\nend", "def no_dupes?(arr)\n dupes = Hash.new(0)\n\n arr.each do |ele|\n dupes[ele] += 1\n end\n\n new_arr = []\n dupes.each do |k, v|\n if v == 1\n new_arr << k\n end\n end\n\n new_arr\nend", "def no_dupes?(arr)\n solved = Hash.new(0)\n arr.each { |ele| solved[ele] += 1 }\n solved.keys.select { |ele| solved[ele] == 1 }\nend", "def no_dupes?(arr)\n hash = Hash.new(0)\n arr.each do |ele|\n hash[ele] += 1\n end\n #can use the select method\n # hash.keys.select {|ele| hash[ele] == 1}\n new = []\n hash.each do |k, v|\n new << k if v == 1\n end\n new\n #another way to do it is sort and if there are adjacent pairs\n # we know that it is not a unique pair\nend", "def no_dupes?(arr)\n counts = Hash.new(0)\n arr.each do |e|\n counts[e] += 1\n end\n counts.select {|k,v| v <= 1}.keys\nend", "def no_dupes?(arr)\n counter_hash = Hash.new(0)\n arr.each { |ele| counter_hash[ele] += 1 }\n counter_hash.select { |key, val| val == 1 }.keys\n #counter_hash.keys.select { |blah| counter_hash[blah] == 1 }\nend", "def no_dupes?(arr)\n new_hash = Hash.new(0)\n new_arr = []\n\n arr.each do |x|\n new_hash[x] += 1\n end\n\n new_hash.each do |k,v|\n if v == 1\n new_arr << k\n end\n end\n new_arr\nend", "def non_duplicated_values(values)\n results = []\n values.each do |value|\n results << value if values.count(value) == 1\n end\n results\nend", "def remove_duplicates(array)\n uniq_array = []\n array.each {|value| uniq_array << value unless uniq_array.include?(value) }\n return uniq_array\nend", "def non_duplicated_values(values)\n values.select{|item| values.count(item) == 1}.uniq\nend", "def all_duplicates(a)\n a.uniq.select{|v| a.select{|b| b == v}.count > 1}\n end", "def non_duplicated_values(values)\n return values.select {|x| values.count(x) == 1 } \nend", "def non_duplicated_values(values)\n values.find_all { |x| values.count(x) == 1 }\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 remove_duplicates\n return @remove_duplicates if @set_remove_duplicates\n @remove_duplicates ||= true\n end", "def non_duplicated_values(values)\n uniques = []\n for number in values.uniq.each do\n if values.count(number) == 1\n uniques.push(number)\n end\n end\n return uniques\nend", "def remove_duplicates(array)\n array.uniq!.length\nend", "def non_duplicated_values(values)\n values.select { |value| values.count(value) == 1 }\nend", "def non_duplicated_values(values)\n values.select { |value| values.count(value) == 1 }\nend", "def non_duplicated_values(values)\n duplicates = values.find_all { |item| values.count(item) > 1 }.uniq\n duplicates.each do |item|\n values.delete(item)\n end\n return values\nend", "def no_dupes?(arr)\n count = Hash.new(0)\n arr.each do |char|\n count[char] += 1\n end\n count.select { |k,v| v == 1 }.keys\nend", "def find_duplicate(arr)\n\tarr.select{|e| arr.count(e) > 1}.uniq\nend", "def non_duplicated_values(values)\n p values.select{ |i|\n values.count(i) == 1\n \t}\nend", "def unique_items(ary)\r\n ary.select {|x| ary.count(x) == 1}\r\nend", "def remove_duplicates(list)\n list & list # list | list would work too\nend", "def remove_duplicates(nums)\n nums.uniq!\n return nums.length\nend", "def my_unique(arr)\n res = []\n arr.each do |item|\n res << item unless res.include?(item)\n end\n \n res\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def my_uniq(array)\n result = []\n array.each { |ele| result << ele unless result.include?(ele) }\n result\nend", "def duplicate_elements?(arr)\n arr.uniq.length != arr.length\nend", "def remove_duplicates(array)\nend", "def non_duplicated_values(values)\n values.find_all do |e|\n if values.count(e) > 1\n values.delete(e)\n end\n end\n values\nend", "def just_once(original_array)\n unique = []\n i = 0\n while i < original_array.length\n unique.push(original_array[i]) unless unique.include?(original_array[i])\n i += 1\n end\n return unique\n end", "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 non_duplicated_values(values)\n values.each do |x|\n values.delete(x) if values.count(x) == 2\n end\nend", "def my_uniq(arr)\n uniques = []\n arr.each do |el|\n uniques << el unless uniques.include?(el)\n end\n uniques\nend", "def contains_duplicate(nums)\n tmp_arr = nums.uniq\n result = \n tmp_arr.map do |i|\n nums.select { |j| i == j }.size > 1\n end\n return result.any?\nend", "def uniq(array)\n finalArray = []\n array.each do |element|\n if !finalArray.include?(element)\n finalArray.push(element)\n end\n end\n return finalArray\nend", "def one_week_wonders(songs)\n uniq_songs = songs.uniq\n uniq_songs.select do |song|\n no_repeats?(song, songs)\n end\nend", "def duplications?\n size != uniq.size \n end", "def unique(integers)\narray = []\nintegers.map {|item| array << item unless array.include?(item)}\narray\nend", "def same_or_dif? card_arr\n card_arr.uniq.size != 2\nend", "def my_uniq(arr)\n \n output = []\n hash = Hash.new(false)\n \n arr.each do |x|\n output << x if !hash[x]\n hash[x] = true\n end\n output\n end", "def non_duplicated_values(values)\n values.keep_if { |v| values.count(v) == 1 }\nend", "def rem_dup(list)\n list.uniq!\n return list\nend", "def non_duplicated_values(values)\n # Write your code here\n values.uniq!\nend", "def using_uniq (array)\n return array.uniq!\nend", "def no_mutter(arr)\n arr.uniq\nend", "def non_duplicated_values(values)\n values.each do |num|\n values.delete(num) if values.count(num)>=2\n end\n return values\nend", "def test_removes_duplicates\n stream = FromArray.new([2, 2, 3, 4, 1, 1, 2, 5, 4, 3, 6])\n collected = stream.distinct.collect\n assert(collected == collected.uniq)\n assert(collected.length == collected.uniq.length)\n end", "def duplicates(arr)\n values = Set.new\n copies = Set.new\n\n arr.each do |value|\n if values.include?(value)\n copies << value\n else\n values << value\n end\n end\n\n return copies\nend", "def remove_duplicates(cart:[])\n cart.uniq\nend", "def find_unique_elements(arr)\n arr.reject { |e| arr.count(e) > 1 }\nend", "def no_mutate(arr)\n arr.uniq\nend", "def no_mutate(arr)\n arr.uniq\nend", "def no_mutate(arr)\n arr.uniq\nend", "def remove_duplicates(nums)\n puts nums.uniq.length\nend", "def unique(array)\n unique_array = []\n\n array.each do |original_element|\n found = false\n\n unique_array.each do |unique_element|\n if original_element == unique_element\n found = true\n break\n end\n end\n\n if !found\n unique_array << original_element\n end\n end\n\n unique_array\nend", "def dup_args_alt(arr)\n arr == arr.uniq ? false : true\nend", "def dupe_indices(arr)\n idxs = Hash.new { |h, k| h[k] = [] }\n \n arr.each_with_index do |ele, i|\n idxs[ele] << i\n end\n\n return idxs.select { |ele, arr| arr.length > 1 }\nend", "def uniqify(array)\n encountered = Hash.new { |hash, key| hash[key] = false }\n uniqified_array = []\n array.each do |element|\n uniqified_array.push(element) unless encountered[element]\n encountered[element] = true\n end\n uniqified_array\nend", "def removeDupe(linkedlist)\n return linkedlist.uniq!\nend", "def remove_duplicates(list)\n list.inject({}){ |ele, n| ele[n] = nil; ele }.keys\nend", "def one_week_wonders(songs)\n songs.uniq.select {|song|no_repeats?(song,songs)}\n\nend", "def dupes?(a, b)\n a.uniq.size != a.size || b.uniq.size != b.size || (a & b).any?\n end", "def duplicate(array)\n array.uniq!\nend", "def find_unique_elements(arr)\n# Count how many times each element appears in the array, if an element appears\n# more than once, delete that element and any elements that are equal to it.\n \n arr.each do |i|\n\tif arr.count(i) > 1\n\t\tarr.delete(i)\n\tend\n end\n return arr\nend", "def no_mutate(arr)\n arr.uniq!\nend", "def no_mutate(arr)\n arr.uniq!\nend", "def remove_duplicates(list)\n d = list.clone\n dups = find_duplicates(list).each_with_object([]) { |(k, v), a| a << k if v > 1 }\n dups.each { |i| d.delete(i) }\n d\nend", "def clean_up_dupes(dupes, output)\n unless dupes.empty?\n dupes.uniq.each do |sequence|\n output.delete sequence\n end\n end\n\n output\n end", "def remove_dups(arr)\n\treturn arr.uniq()\nend", "def all_uniq?(words)\n words.length == words.uniq.length\nend", "def custom_uniq(array)\n final = []\n array.each do |element|\n final << element if !final.include?(element)\n end \n final\nend", "def my_uniq\n unique = []\n each_index { |i| unique << self[i] unless unique.include?(self[i]) }\n unique\n end", "def identical_values?(arr)\n arr.uniq.length == 1\nend", "def get_non_duplicated(given_array)\n non_repeated_values=[\"\"]\n non_repeated_index=0\n outer_index=0\n given_array.each do |first_num|\n flag_for_a_duplicate=true\n inner_index=0\n given_array.each do |second_num|\n if (first_num == second_num) && (inner_index \\\n != outer_index)\n flag_for_a_duplicate=false \n end \n inner_index +=1\n end\n if flag_for_a_duplicate\n non_repeated_values[non_repeated_index]=first_num\n non_repeated_index +=1\n end\n outer_index +=1\n end\n non_repeated_values \nend", "def duplicates?(collection); end", "def unique(integers)\n # set variable arr to empty array where we will push duplicates\n arr = []\n\n # iterate through integers array and push integer to arr if integer not already included in arr\n integers.each { |i| arr << i if !arr.include?(i) }\n # return arr with duplicates removed\n arr\nend", "def single_number(nums)\n uniques = []\n nums.each do |num|\n uniques.include?(num) ? uniques.delete(num) : uniques << num\n end\n uniques\nend", "def one_week_wonders(songs)\n one_week_wonders = songs.select {|el| no_repeats?(el, songs)}\n one_week_wonders.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def contain_duplicates(arr)\n\n if arr == nil?\n return false\n end\n\n\n hash = Hash.new(0) # counter hash\n\n arr.each do |i|\n\n if hash[i]\n hash[i] = hash[i] + 1\n else\n hash[i] = 1\n end\n if hash[i] > 1\n return true\n end\n end\n\n return false\nend", "def uniq\n dup.uniq! or dup\n end", "def remove_duplicates(list)\n if list.length < 2\n return list\n else\n i = 0\n list.each do |num|\n if num == list[(i+1)]\n list.delete_at(i)\n end\n i += 1\n end\n return list\n end\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend" ]
[ "0.7766084", "0.7752476", "0.7736155", "0.7614962", "0.75363356", "0.7488069", "0.74668366", "0.746124", "0.7444679", "0.740563", "0.73547494", "0.73296684", "0.73166203", "0.72992706", "0.72074765", "0.71457577", "0.7128234", "0.70464814", "0.7034207", "0.69885266", "0.69842017", "0.6978579", "0.6955689", "0.6924004", "0.6880517", "0.6857631", "0.6849421", "0.6849421", "0.6847239", "0.6843716", "0.6820832", "0.67605525", "0.6736994", "0.67333764", "0.67256194", "0.67085713", "0.6690353", "0.6690353", "0.6690353", "0.66895455", "0.66869485", "0.66847605", "0.6681424", "0.6653155", "0.6635669", "0.6631765", "0.66268784", "0.6622879", "0.66046447", "0.65882146", "0.6576347", "0.65726924", "0.65681416", "0.655733", "0.65480834", "0.6540823", "0.6520801", "0.6491304", "0.6477236", "0.6471354", "0.6467224", "0.64575064", "0.64398384", "0.64392483", "0.6437214", "0.6437214", "0.6437214", "0.64357805", "0.64341354", "0.64335877", "0.6414683", "0.6410434", "0.6403782", "0.6403015", "0.64000565", "0.63947797", "0.63916093", "0.63879645", "0.6387158", "0.6387158", "0.637899", "0.6377061", "0.63746643", "0.6374008", "0.6370517", "0.63531274", "0.63433206", "0.63289386", "0.6322053", "0.6318051", "0.6308103", "0.6300982", "0.6298663", "0.6298663", "0.6298059", "0.6296656", "0.6286052", "0.628521", "0.628521", "0.628521", "0.628521" ]
0.0
-1
Examples p no_consecutive_repeats?(['cat', 'dog', 'mouse', 'dog']) => true p no_consecutive_repeats?(['cat', 'dog', 'dog', 'mouse']) => false p no_consecutive_repeats?([10, 42, 3, 7, 10, 3]) => true p no_consecutive_repeats?([10, 42, 3, 3, 10, 3]) => false p no_consecutive_repeats?(['x']) => true
def char_indices(str) indices = Hash.new([]) str.each_char.with_index { |char, i| indices[char] += [i] } indices end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_consecutive_repeats?(array)\n (0...array.length - 1).each {|index| return false if array[index] == array[index + 1] }\n true\nend", "def no_consecutive_repeats?(array)\n (0...array.length - 1).each do |i|\n return false if array[i] == array[i+1]\n end\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each { |i| return false if arr[i] == arr[i + 1] }\n true \nend", "def no_consecutive_repeats?(arr)\n (arr.length-1).times do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "def no_consecutive_repeats?(arr)\n (1...arr.length).each {|i| return false if arr[i] == arr[i-1]}\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |i|\n return false if arr[i] == arr[i + 1]\n end\n\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "def no_consecutive_repeats?(array)\n (0...array.length-1).each do |idx|\n return false if array[idx] == array[idx+1]\n end\n\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each { |i| return false if arr[i] == arr[i+1] }\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |i|\n return false if arr[i] == arr[i + 1]\n end\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |i|\n return false if arr[i] == arr[i+1]\n end\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each_with_index do |elm, i|\n return false if arr[i] == arr[i + 1]\n end \n\n true \nend", "def no_consecutive_repeats?(arr)\n no_repeats = true\n arr.each_with_index do |ele,idx|\n if idx <= arr.length - 2\n if arr[idx] == arr[idx+1]\n no_repeats = false\n end\n end\n end\n no_repeats\nend", "def no_consecutive_repeats?(arr)\n i = 0\n return true if arr.length == 1\n\n while i < arr.length - 1\n return false if arr[i] == arr[i + 1]\n i += 1\n end\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length - 1).each do |idx|\n next_idx = idx + 1\n return false if arr[idx] == arr[next_idx]\n end\n\n true\nend", "def no_consecutive_repeats?(arr)\n i = 0\n while i <= arr.length - 1\n return false if arr[i] == arr[i+1]\n i += 1\n end\n return true\nend", "def no_consecutive_repeats?(arr)\n new_arr = []\n arr.each do |ele|\n if new_arr[-1] == ele\n return false\n else\n new_arr << ele\n end\n end\n true\nend", "def no_consecutive_repeats?(array)\n array.each_with_index do |ele, idx|\n if idx != array[-1] && ele == array[idx + 1]\n return false\n end\n end\n true\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |idx|\n # if arr[idx] == arr[idx + 1]\n # return false\n # end\n return false if arr[idx] == arr[idx + 1]\n end\n\n true\nend", "def no_consecutive_repeats?(arr)\n\n (0...arr.length-1).all? { |idx| arr[idx] != arr[idx+1] }\n\nend", "def no_consecutive_repeats?(arr)\n no_consecutives = true\n arr.each_with_index do |elem, idx|\n no_consecutives = false if elem == arr[idx+1]\n end\n return no_consecutives\nend", "def no_consecutive_repeats?(arr)\n return true if arr.length == 1\n arr.inject do |acc, el| \n if acc == el\n return false\n else\n el \n end \n end\n true\nend", "def no_consecutive_repeats?(arr)\n arr.each_with_index do |ele, i|\n if arr[i] == arr[i + 1]\n return false\n end\n end\n\n true\nend", "def no_consecutive_repeats?(arr)\n arr.each_with_index do |ele, i|\n if ele == arr[i + 1]\n return false \n end\n end\n true \nend", "def no_consecutive_repeats?(arr)\n arr.each_with_index do |ele,idx|\n if arr[idx+1] == ele\n return false\n end\n end\n true\nend", "def repeats?\n false\n end", "def is_repeated? (value, times)\n !((value =~ /^(\\d)\\1{#{times-1}}$/).nil?)\n end", "def repeats?\n true \n end", "def no_repeats?(song_name, songs)\n songs.each_with_index do |ele, idx| \n if ele == song_name\n return false if ele == songs[idx + 1]\n end\n end\n true\nend", "def repeats_twice?(arr)\n\nend", "def no_repeat?(string)\n n = string.length\n for i in 0..n-1\n for j in 0..n-1\n if (i != j) && (string[i] == string[j]) then\n return false\n end\n end\n end\n return true\nend", "def has_no_sequences\n [1,2,3].each {|i|\n return true if count_dice_in_sequence(i, i+3) == 1\n }\n return false\n end", "def no_repeat?(year)\n numbers = year.to_s.split(//)\n numbers.uniq.length == numbers.length\nend", "def has_no_duplicates?(arr)\n !(arr.uniq.size < arr.size)\n end", "def duplicate_elements?(arr)\n arr.uniq.length != arr.length\nend", "def no_repeat?(number)\n digits = number.to_s.chars\n seen = []\n digits.each do |digit|\n return false if seen.include?(digit)\n seen << digit\n end\n true\nend", "def missing_sequence_of_two\n [1,2,3].each {|i|\n return true if count_dice_in_sequence(i, i+3) == 2\n }\n return false\n end", "def repeating?\n symbols[0] == symbols[1]\n end", "def no_repeats(year_start, year_end)\n no_repeats = []\n (year_start..year_end).each do |yr|\n no_repeats << yr if no_repeat?(yr)\n end\n\n no_repeats\nend", "def got_three?(arr)\n !!(arr.map(&:to_s).join =~ /(.)\\1\\1/)\nend", "def no_repeats(year_start, year_end)\n\tyear = year_start\n\tnon_repeat_years = []\n\twhile year <= year_end\n\t\tif no_repeat_year?(year)\n\t\t\tnon_repeat_years.push(year)\n\t\tend\n\t\tyear += 1\n\tend\n\tnon_repeat_years\nend", "def repeats?(year)\n x = []\n year.to_s.each_char do |a|\n return false if x.include?(a)\n x << a\n end\n return true\nend", "def can_capture(arr)\n arr.join().split('').uniq.count != arr.join().split('').count\nend", "def assert_no_repeats reclist, att\n values = get_values reclist, att\n uniques = values.values.uniq\n log_v \"Repeated values in #{reclist.first.class}'s #{att}\" if uniques.count != values.count\n end", "def no_repeat?(year)\n digits = year.to_s.split(\"\")\n counter = Array.new(10, 0) \n \n digits.each do |digit|\n counter[digit.to_i] += 1\n return false if counter[digit.to_i] > 1\n end\n \n true\nend", "def hasDupes(a)\n return a.uniq.length == a.length\nend", "def digits_repeat?(number)\n !(number.to_s.chars.eql? number.to_s.chars.uniq)\nend", "def no_repeat?(year)\n digits = year.to_s.chars # Break year into digits\n digits.each do |x| # If any digit repeats, return false\n return false if digits.count(x) > 1\n end\n true # Otherwise return true \nend", "def repeating_letters?(str)\n str.downcase.chars.uniq.length != str.length\nend", "def has_group_of_at_least_two_repeating_nums(num)\n num.digits.group_by { |i| i }.any? { |c, values| values.length > 1 }\n end", "def isRepeated? subString, str\n\n if str.length % subString.length != 0 then return false end\n\n n = subString.length\n max_repetitions = str.length / n\n (0...max_repetitions).each do |i|\n if str[n*i, n] != subString then return false end\n end\n return true\nend", "def no_dupes?(arr)\n arr.reject do |ele|\n # debugger\n arr.count(ele) > 1\n end\nend", "def no_repeat?(year)\n chars_seen = []\n\n years.to_s.each_char do |char|\n return false if chars_seen.include?(char)\n chars_seen << char\n end\n\n return true \nend", "def three_of_a_kind?\n repeat_counts.include? 3\n end", "def repeated_substring_pattern(s)\n return false if !s\n (s + s)[1...-1].include?(s)\nend", "def repeating_letters?(str)\n # your code goes here\n str.downcase.chars.uniq.length != str.downcase.chars.length\nend", "def is_non_repeating_animation?\n loop_count.in?(0..10)\n end", "def no_repeats(first_year, year_end)\n result = []\n (first_year..year_end).each do |year| if repeat?(year) == true\n result.push(year) end\n end\n\n return result\nend", "def repeating_letters?(str)\n # your code goes here\n str.downcase.chars.uniq.length != str.downcase.chars.length\n\n end", "def duplications?\n size != uniq.size \n end", "def no_repeats(year_start, year_end)\n return if year_start > year_end\n results = []\n \n (year_start .. year_end).each do |year|\n results << year if no_repeat?(year) \n end\n \n results\nend", "def repeated_substring(str)\n 0.upto(str.size / 2) do |end_idx|\n slice = str[0..end_idx]\n repeat_nums = str.size / slice.size\n return true if slice * repeat_nums == str\n end\n false\nend", "def no_repeats(start_year, end_year)\n (start_year..end_year).to_a.select { |year| no_repeat?(year) }\nend", "def repeat_with_gap?\n letters = split('')\n letters.each.with_index do |letter, i|\n next_with_gap = letters[i + 2]\n return true if letter == next_with_gap\n end\n\n false\n end", "def no_activity?(*counts)\n self.prev_counts ||= Array.new(counts.length)\n @repeats ||= 0\n status = adjust_deferred_jobs(0).zero? && (prev_counts == counts ? true : (self.prev_counts = counts and false))\n @repeats += 1 if status\n @repeats == 3\n end", "def no_repeats(year_start, year_end)\n result = []\n (year_start..year_end).each do |yr|\n result << yr if no_repeat?(yr)\n end\n result\nend", "def consecutive_duplicates(collection); end", "def got_three?(arr)\n count = 0 # This is a counter that looks for consecutive instances of an element\n i = 3 # This the number of consecutive instanes we're looking for (three in a row)\n previous = arr.first # Start the counter from the first array element\n arr.each do |n| \n if n == previous # If the current element is the same as the last element,\n count += 1 # then add to the counter\n return true if count == i # If the counter reaches 3, then return true\n else\n previous = n # Otherwise reset the counter to 1\n count = 1\n end\n end\n false\nend", "def first_non_repeating(input)\n # Your code goes here\nend", "def dup_args_ms(arr)\n arr.any? {|e| arr.count(e) > 1} ? true : false\nend", "def non_repeating(str)\n str.chars.find { |char| str.count(char) == 1 }\nend", "def not_repeat_year?(year) \n str = year.to_s\n str.each_char do |ele| \n if str.count(ele) > 1\n return false\n end\n end\n true\nend", "def has_dup?(s)\n s = s.split('')\n s.uniq.size != s.size\nend", "def contains_duplicate(nums)\n nums.length.times do |i|\n (0..i - 1).each do |j|\n return true if nums[j] == nums[i]\n end\n end\n\n false\nend", "def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_array\nend", "def no_activity?(*counts)\n self.prev_counts ||= Array.new(counts.length)\n @repeats ||= 0\n status = adjust_deferred_jobs(0).zero? && (prev_counts == counts ? true : (self.prev_counts = counts and false))\n @repeats += 1 if status\n @repeats == 3\n end", "def same_or_dif? card_arr\n card_arr.uniq.size != 2\nend", "def more_than_once(string)\n # Write your code here\n a = string.length\n array = []\n i = 0\n loop do \n array.push(string[i])\n i += 1\n break if i == a \n end\n p array\n array1 = array.uniq\n y = array1.length\n x = 0\n result = []\n loop do \n if array.count(array1[x]) > 2\n result.push(array1[x])\n end\n x += 1\n break if x == y \n end \nreturn result\nend", "def identify_duplicate_sequences sequences\n sequences.select { |e| sequences.count(e) > 1 }.uniq\n end", "def repeated?\n @rule == :repeated\n end", "def nondupes(array)\n array.map do |elem| \n array.count(elem) == 1\n \n end\n \nend", "def no_repeats(year_start, year_end)\n (year_start..year_end).to_a.select do |year|\n if year.to_s.split(\"\").uniq == year.to_s.split(\"\")\n year\n end\n end\nend", "def no_repeats(year_start, year_end)\nanswer = []\n\n for year in year_start..year_end do\n if no_repeat?(year)\n answer << year\n end\n end\n return answer\nend", "def unique_arr?(arr)\n not_unique = false\n i = 0\n while (i < arr.length && !not_unique)\n j = i + 1\n while (j < arr.length && !not_unique)\n not_unique = true if arr[i] == arr[j] && arr[i] != '' && arr[i] != 0\n j += 1\n end\n i += 1\n end \n return !not_unique\n end", "def got_three? (arr)\n\tcount = 0\n \tlast = arr.first\n \tarr.each do |d|\n \tif d==last\n \t\tcount += 1\n \t\treturn true if count==3\n \telse\n \t\tlast = d\n \t\tcount = 1\n \tend\n \tend\n \tfalse\nend", "def no_dupes?(arr)\n count = Hash.new(0)\n arr.each { |el| count[el] += 1 }\n count.keys.select { |el| count[el] == 1 }\nend", "def missing_one_at_either_end\n [2,3].each { |i|\n return true if @counts[i]>0 && @counts[i+1]>0 && @counts[i+2]>0\n }\n return false\n end", "def repeating_letters?(str)\n str = str.downcase\n i = 0\n while i < str.length - 1\n return true if str[i] == str[i + 1]\n i += 1\n end\n false\nend", "def no_repeats(year_start, year_end)\n\n\tyear = year_start\n\tresults = []\n\n\twhile year <= year_end\n\t\tresults << year if no_repeat?(year)\n\t\tyear += 1\n\tend\n\n\tresults\nend", "def is_unique?(string)\n for x in 1...string.length\n for y in (x+1)...string.length\n return false if string[x] == string[y]\n end\n end\n return true\nend", "def contains_duplicate(arr)\n chars_freq = Hash.new(0)\n arr.each { |char| chars_freq[char] += 1 }\n if chars_freq.values.max >= 2\n true\n else\n false\n end\nend", "def no_repeat?(year)\n str=year.to_s\n res=[]\n str.each_char do |ch|\n return false if res.include?(ch)\n res << ch\n end\n return true\nend", "def all_uniq?(words)\n words.length == words.uniq.length\nend", "def repeating_letters?(str)\n index = 0\nnew_str = str.split(\"\").sort.join.downcase\n\nwhile index < str.length\n if new_str[index] == new_str[index + 1]\n return true\n end\n index += 1\nend\nfalse\n\nend", "def repeating_pair?(text)\n text.match(/(\\w{2})\\w*\\1/) ? true : false\nend", "def no_dupes?(arr)\n count = Hash.new(0)\n arr.each do |char|\n count[char] += 1\n end\n count.select { |k,v| v == 1 }.keys\nend", "def digits_repeat?(number)\n number.to_s.chars.any? { |s| number.to_s.count(s) > 1 }\nend", "def is_unique2(str)\n (0...str.length).each do |i|\n (i + 1...str.length).each do |j|\n return false if str[i] == str[j]\n end\n end\n\n true\nend", "def crunch(string)\n array = string.chars\n no_repeats = []\n no_repeats.push(array[0])\n for i in 0..(array.size - 1)\n no_repeats.push(array[i+1]) if array[i] != array[i+1]\n end\n\n no_repeats.join\nend" ]
[ "0.76850927", "0.76576746", "0.76258814", "0.7618245", "0.75910467", "0.75884116", "0.75857764", "0.75857764", "0.7583619", "0.7580226", "0.7568152", "0.756634", "0.7528283", "0.7512146", "0.74973285", "0.74478567", "0.743711", "0.73797923", "0.73648095", "0.7362042", "0.73540634", "0.73249674", "0.7300995", "0.7297947", "0.72816837", "0.7193985", "0.71704316", "0.67425066", "0.6704337", "0.66453594", "0.66274244", "0.6621339", "0.65870905", "0.65256196", "0.6342021", "0.62696975", "0.6218817", "0.6200823", "0.6198223", "0.6168698", "0.61187756", "0.61173654", "0.60873723", "0.6083539", "0.60647917", "0.6063878", "0.60175115", "0.6010473", "0.6004376", "0.6002771", "0.5981915", "0.596754", "0.5966332", "0.5961505", "0.5940777", "0.59153664", "0.5903157", "0.59004223", "0.5892855", "0.5886374", "0.5866098", "0.5866059", "0.5860059", "0.58523357", "0.58450955", "0.5809338", "0.58072466", "0.5807052", "0.57937026", "0.57874817", "0.5782361", "0.57420206", "0.5733285", "0.5728623", "0.57187796", "0.57145596", "0.5709312", "0.5702259", "0.57001114", "0.56959236", "0.56887066", "0.56848496", "0.567948", "0.56698215", "0.5649569", "0.5647173", "0.5637981", "0.5617459", "0.5615614", "0.5607127", "0.5595532", "0.55877995", "0.5576943", "0.5574142", "0.5563983", "0.55577385", "0.5554826", "0.55504704", "0.5546808", "0.5543206", "0.55281126" ]
0.0
-1
Examples p longest_streak('a') => 'a' p longest_streak('accccbbb') => 'cccc' p longest_streak('aaaxyyyyyzz') => 'yyyyy p longest_streak('aaabbb') => 'bbb' p longest_streak('abc') => 'c'
def bi_prime?(num) primes = list_primes_until(num) primes.any? { |x| primes.any? { |y| x * y == num } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_streak(str)\n return str if str.length < 2\n \n max_streak = \"\"\n i = 0\n j = 1\n while i < str.length - 1\n j = i + 1\n cur_streak = \"\"\n while j < str.length && str[i] == str [j]\n j += 1\n end\n\n cur_streak = str[i...j]\n max_streak = cur_streak if cur_streak.length >= max_streak.length\n\n i = j\n end\n \n return str[-1] if max_streak.length == 1\n max_streak\nend", "def longest_streak(str)\n count = Hash.new(0)\n\n str.each_char do |char|\n count[char] += 1\n end\n\n count.map { |k, v| k * v }.inject { |a, b| a.size > b.length ? a: b }\nend", "def longest_streak str \n str.split('L').max.length\nend", "def longest_streak(str)\n char_streaks = Hash.new(0)\n str.chars.each { |char| char_streaks[char] += 1 }\n\n char_streaks.inject(\"\") do |max_streak, (char, streak)|\n if (char * streak).length >= max_streak.length\n char * streak\n else\n max_streak\n end\n end\nend", "def longest_streak(str)\n longest = \"\"\n test_str = \"\"\n\n (0...str.length).each do |i|\n char = str[i]\n next_char = str[i + 1]\n\n if char == next_char\n test_str += char\n longest = test_str if test_str.length >= longest.length\n else\n test_str += char\n longest = test_str if test_str.length >= longest.length\n test_str = \"\"\n end\n end\n\n longest\nend", "def longest_winning_streak str \n win_ocurred = false\n current_streak = 0\n streaks = []\n str.each_char do |c|\n if c == 'W' && win_ocurred\n current_streak += 1\n elsif c == 'W' && !win_ocurred\n win_ocurred = true\n elsif c == 'L'\n win_ocurred = false\n streaks << current_streak if current_streak >= 1\n current_streak = 0\n end \n end\n streaks << current_streak if current_streak >= 1\n streaks.max ? (streaks.max + 1) : nil\nend", "def longestStreak\n\t\t\t# Set an initial value for the streak\n\t\t\tstreak = 0\n\t\t\t# Set an empty array to hold the streak values\n\t\t\tstreakArray = []\n\t\t\t# Loop through the raw data\n\t\t\t@rawData.each do |day|\n\t\t\t\t# Check if a day is \"prefect\"\n\t\t\t\tif perfectDayChecker day\n\t\t\t\t\tstreak += 1 \t\t\t\t\t\t\t# Add one to the previous streak value\n\t\t\t\t# If the day is not prefect\n\t\t\t\telse\n\t\t\t\t\tstreakArray << streak if streak > 0\t\t# If the previous streak count was not zero\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# That means that there were consecutive perfect days\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Push the value of the streak in the array\n\t\t\t\t\tstreak = 0\t\t\t\t\t\t\t\t# Reset the streak\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Push in the last value of the streak since the loop ends before adding it.\n\t\t\tstreakArray << streak\n\t\t\tstreakArray.max \t\t\t\t\t\t\t\t# Return the max value in the array\n\t\tend", "def length(longest: false)\n # no streaks\n if streaks.empty?\n 0\n\n # calculate the longest one?\n elsif longest\n streaks.sort do |x, y|\n y.size <=> x.size\n end.first.size\n\n # default streak calculation\n else\n # pull the first streak\n streak = streaks.first\n \n # either the streak includes today,\n # or we don't care about today and it includes yesterday\n if streak.include?(Date.current) || except_today && streak.include?(Date.current - 1.day)\n streak.size\n else\n 0\n end\n end\n end", "def getMaxStreaks(toss)\n # Return an array of two integers containing the maximum streak of heads and tails respectively\n return [toss.count('Heads'),0] if toss.count('Tails').zero?\n return [0,toss.count('Tails')] if toss.count('Heads').zero?\n [(toss.join.split('Tails').max.length / 5) , (toss.join.split('Heads').max.length / 5) ]\nend", "def winning_streak(str)\n\nend", "def find_streak_sequential(flips, streak_length)\n flips.count.times do |ii|\n return ii if streak_found?(flips, ii, streak_length)\n end\n return nil\nend", "def longest(s)\n\tall_results = []\n\n\tlist_of_chars = s.chars\n\n\tlist_of_chars.each_with_index do |char, index|\n\n\t\tresult = ''\n\t\tnext_index = index + 1 \n\t\tcurrent_index = index\n\t\tresult << char\n\n\t\tif current_index == list_of_chars.length - 1\n\t\t\tall_results = all_results.max { |a,b| a.length <=> b.length }\n\t\telse\n\t\t loop do\n\t\t \tif list_of_chars[next_index] == nil\n\t\t \t\tall_results << result\n\t\t \t\tbreak\n\t\t\t\telsif list_of_chars[next_index] >= list_of_chars[current_index]\n\t\t\t\t\tresult << list_of_chars[next_index]\n\t\t\t\t\tcurrent_index += 1\n\t\t\t\t\tnext_index += 1\n\t\t\t\telse\n\t\t\t\t\tall_results << result\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tall_results\nend", "def lsworc s\n i = 0\n max_len = 0\n cc = {}\n s.chars.each_with_index do |c, j|\n if !!cc[c]\n # contract window\n while s[i] != c\n cc[s[i]] = false\n i += 1\n end\n i += 1\n end\n # expand window\n cc[c] = true\n # select longest\n max_len = [max_len, j + 1 - i].max\n end\n return max_len\nend", "def longest_palindrome(s)\n left = 0\n right = 0\n for i in 0...s.length do\n odd = length_from_center(s, i, i)\n even = length_from_center(s, i, i + 1)\n longest = [odd, even].max\n if longest > right - left\n left = i - (longest - 1) / 2\n right = i + longest / 2\n end\n end\n return s[left..right]\n end", "def longest_palindrome(s)\n max = \"\"\n 0.upto(s.size - 1).each { |i|\n odd = palindrome(s, i, i)\n even = palindrome(s, i, i + 1)\n \n return s if odd.size == s.size || even.size == s.size\n max = odd if odd.size > max.size\n max = even if even.size > max.size\n }\n\n max \nend", "def longest_palindrome(s)\n hash = {}\n output = 0\n odd = false\n \n s.each_char do |letter|\n hash[letter] = hash[letter] ? hash[letter] + 1 : 1\n end\n \n hash.each do |key, val|\n if val % 2 == 0\n output += val\n else\n output += val - 1 if val > 1\n odd = true\n end\n end\n output += 1 if odd\n output\nend", "def find_longest(arr)\n arr.max_by { |x| x.to_s.length }\nend", "def longest(string)\n sliced = string.chars.slice_when {|a,b| a > b}.to_a\n longest = sliced.max_by {|sub_arr| sub_arr.length}.join\nend", "def longest_palindrome(s)\n string_hash = Hash.new(0)\n \n s.each_char do |char|\n string_hash[char] += 1\n end\n \n beginning_count = 0\n middle_count = 0\n \n string_hash.keys.each do |key|\n if string_hash[key] % 2 == 1\n middle_count = 1\n end\n \n beginning_count += string_hash[key] / 2\n end\n \n beginning_count * 2 + middle_count\nend", "def longest_palindrome s\n return 0 if s.empty?\n (s.length).downto(1).each do | i |\n s.split(\"\").each_cons(i).map do |c|\n return c.count if c == c.reverse\n end\n end\nend", "def lps(s)\n return \"\" if s.empty?\n longest = [0,0]\n s.chars.each_with_index do |ch, idx|\n for i,j in [[idx, idx + 1], [idx, idx]]\n until s[i] != s[j]\n break if i < 0 || j >= s.length\n longest = [i,j] if longest[1] - longest[0] < j - i\n i -= 1\n j += 1\n end\n end\n end\n s[longest[0]..longest[1]]\nend", "def linear_longest_word(arr)\n max_length=0\n max_str=arr[0]\n arr.each do |str| \n curr_length=str.length\n if curr_length>max_length\n max_length=curr_length\n max_str=str\n end\n end\n max_str\nend", "def longest_prefix(strings)\n min = strings.min \n max = strings.max\n string_pre = min.size.times do |i| \n break i if min[i] != max[i]\n end\n min[0...string_pre]\nend", "def find_longest_palindrome(string)\n l = string.size\n l.downto(0) { |i|\n 0.upto(l) { |j|\n s = string.slice(j,i)\n return s if s == s.reverse && s.size > 1\n }\n }\nend", "def naive_longest_palindrome(s)\n longest = s[0]\n s.each_char.with_index do |ch_i, i|\n s.each_char.with_index do |ch_j, j|\n next if j < i\n possible_pal = s[i..j]\n if is_palindrome?(possible_pal)\n longest = possible_pal.length > longest.length ? possible_pal : longest\n end\n end\n end\n longest\nend", "def longest_string(strings)\r\n#+++solution+++\r\n strings.inject('') { | best, this | (best.length < this.length) ? this : best }\r\n#---solution---\r\nend", "def find_longest(arr)\n arr.map(&:to_s).sort_by(&:length).find { |num| num.length == arr.map(&:to_s).sort_by(&:length).last.length }.to_i\nend", "def longest_prefix(strings)\n if strings.length < 2\n raise ArgumentError\n else\n prefix = \"\"\n l = 0\n (strings.min.length).times do\n s = 0\n track = 0\n (strings.length - 1).times do\n if strings[s][l] == strings [(s+1)][l]\n track += 1\n else\n break\n end\n s += 1\n end\n if track == (strings.length - 1)\n prefix << strings.min[l]\n else\n break\n end\n l += 1\n end\n return prefix\n end\nend", "def longest_sequence_in(string)\n arr = string.split(' ').map{|num| num.to_i}\n if arr.length < 3\n return arr.length\n end\n chain_tracker = [2]\n increment = arr[1] - arr[0]\n chain = 2\n arr.each_with_index do |num, idx|\n if idx != 0 and idx != arr.length - 1\n if arr[idx + 1] - arr[idx] == increment \n chain += 1\n chain_tracker << chain\n else \n chain = 2\n increment = arr[idx + 1] - arr[idx]\n end\n end\n end\n chain_tracker.max\nend", "def longest\n @strings.max { |a,b| a.length <=> b.length}\n end", "def find_longest(arr)\n x = arr.map(&:to_s).sort_by { |x| x.length }.last.chars.length\n arr.map(&:to_s).find { |num| num.length == x }.to_i\nend", "def linear_longest_fish(fishes)\n biggest = fishes.first\n fishes.each do |fish|\n biggest = fish if fish.length > biggest.length\n end\n biggest\nend", "def longest_pallimdromic_substr(str)\n maxlen = 1\n start = 0\n n = str.length\n for i in 1...n\n\n # even Case\n low = i-1\n hi = i\n while(low >= 0 && hi < n && str[low] == str[hi])\n if(hi-low+1 > maxlen)\n maxlen = hi - low + 1\n start = low\n end\n low -= 1\n hi += 1 \n end\n \n\n # odd Case\n low = i-1\n hi = i + 1\n while(low >= 0 && hi < n && str[low] == str[hi])\n if(hi-low+1 > maxlen)\n maxlen = hi - low + 1\n start = low\n end\n low -= 1\n hi += 1\n end \n end\n\n puts \"maxlength is #{maxlen}\"\n puts \"string is #{str[start..maxlen]}\" \nend", "def longest_startstop\n startstop(0).first\n end", "def longest_palindrome(str)\n \nend", "def longest_palindrome(s)\n return s if s.length == 1\n previous = s[0]\n\n all_same = true\n z = 0\n counter = 0\n while z < s.length\n if s[z] == previous\n counter += 1\n else\n tmp_longest = previous * counter\n longest = tmp_longest if tmp_longest.length > longest.length\n previous = s[z]\n counter = 1\n break if counter > s.length / 2\n end\n z += 1\n end\n return previous * counter if all_same || counter > s.length / 2\n\n longest = ''\n i = 0\n while i < s.length\n starting_letter = s[i]\n matching_hash = {}\n matching_hash[i] = starting_letter\n\n j = i + 1\n while j < s.length\n if s[j] == starting_letter\n matching_hash[j] = s[j]\n end\n j += 1\n end\n\n i += 1\n\n indices = matching_hash.keys\n next if indices.length == 1\n next if (indices[-1] - indices[0]) < longest.length\n\n first_index = matching_hash.first[0]\n\n k = 0\n valid_sequence = true\n while k < (indices.length / 2 - 1)\n first_dist = indices[k + 1] - indices[k]\n second_dist = indices[indices.length - 1 - k] - indices[indices.length - 2 - k]\n if first_dist != second_dist\n valid_sequence = false\n break\n end\n k += 1\n end\n\n next if !valid_sequence\n\n matching_hash.delete_if {|key,v| (key != first_index) && (key - first_index < longest.length)}\n indices = matching_hash.keys\n\n n = 1\n last_index = indices[-1]\n running_str = ''\n while first_index + n < ((last_index - first_index) / 2)\n matching_hash.each do |key, v|\n if key == first_index\n running_str = matching_hash[key] << s[key + n]\n else\n checking_str = matching_hash[key] << s[key - n]\n matching_hash.delete(key) if checking_str != running_str\n end\n end\n n +=1\n end\n\n matching_hash.values.each do |value|\n longest = value if value.length > longest.length\n end\n end\n puts \"longest: #{longest}\"\n return longest\nend", "def longest_improvement(grades)\n runs = []\n prev = 0\n run = 1\n grades.each do |g|\n if g >= prev then\n run +=1\n else\n runs << run\n run = 1\n end\n prev = g\n end\n\n puts runs.max\nend", "def longest_palindrome(str)\n result = [0, \"\"]\n for i in (0..str.length - 1)\n p1 = expand(str, i, i) \n result = result[0] > p1.length ? result : [p1.length, p1]\n p2 = expand(str, i, i + 1) \n result = result[0] > p2.length ? result : [p2.length, p2]\n end\n result[1]\nend", "def longest_string(list_of_words)\n index = 0\n counter = 1\n if list_of_words == []\n return nil\n end\n until counter == list_of_words.length\n if list_of_words[index].length > list_of_words[counter].length\n counter += 1\n else\n index = counter\n counter += 1\n end\n end\n return list_of_words[index]\nend", "def longest_palindrome(str)\r\n pal = \"\"\r\n (0..str.size).each do |x|\r\n i = 1\r\n while (i < (str.size-x)) do\r\n\t if str[x,i].reverse == str[x,i]\r\n\t pal = str[x,i] if pal.size < str[x,i].size\r\n\t end\r\n\t i+= 1\r\n\tend\r\n end\r\n pal\r\nend", "def longest_palindrome(string)\n \nend", "def longest_palindrome(str)\n\nend", "def longest_palindrome(s)\n result = ''\n \n for i in (0..s.length-1) do\n for j in (i..s.length-1) do \n result = s[i..j] if s[i..j].length > result.length && s[i..j] == s[i..j].reverse\n end\n end\n \n result\nend", "def longest_string(list)\n list.values.inject('') { |value, memo|\n\t(value.to_s.length > memo.to_s.length) ? value : memo\n }\n end", "def longest_palindrome(s)\n return '' if s == ''\n arr = s.chars\n\n s.length.downto(1) do |char|\n palindrome = arr.each_cons(char).find { |tested| tested == tested.reverse }\n return palindrome.join if palindrome\n end\nend", "def longest_string(list_of_words)\n if list_of_words == []\n p nil\n else\n words_and_lengths = {}\n list_of_words.each do |word|\n words_and_lengths[word.length] = word\n end\n p words_and_lengths\n longest_length = list_of_words[0].length\n words_and_lengths.each do|length, word|\n if length > longest_length\n longest_length = length\n end\n end\n p words_and_lengths[longest_length]\n end\nend", "def longest_palindrome(str)\n return 0 if str.empty?\n\n arr = str.chars\n substrings = []\n length = 1\n loop do\n arr.each_cons(length) { |set| substrings << set }\n length += 1\n break if length > arr.length\n end\n substrings.select { |set| set == set.reverse }.max_by(&:length).length\n p substrings\nend", "def longest_palindrome(string)\n\nend", "def longest_palindrome(string)\n\nend", "def longest_palindrome(string)\n\nend", "def longest_string(list_of_words)\n long_string = list_of_words[0]\n counter = 0\n while counter < list_of_words.length\n if long_string.length < list_of_words[counter].length\n long_string = list_of_words[counter]\n end\n counter += 1\n end\n p long_string\n #return list_of_words.sort {|x,y| y.length <=> x.length}[0]\nend", "def longest (arr)\n arr.max_by {|str| str.length}\nend", "def longest str\n\tstr.max_by(&:length)\nend", "def longest_repetition chars\n return [\"\", 0] if chars.empty?\n \n chars.chars\n .chunk { |char| char }\n .map { |char, chars| [char, chars.size] }\n .max_by { |char, size| size }\n \nend", "def longest_palindrome(string)\nend", "def longest_digit_run(digit)\nend", "def longest_string(arr)\n arr.max_by { |word| word.length }\nend", "def longest_in_list list #:nodoc:\n longest = list.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end \n longest\n end", "def longest_in_list list #:nodoc:\n longest = list.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end \n longest\n end", "def longest_string(list_of_words)\n return list_of_words[0] if list_of_words.length <= 1\n\n longest = list_of_words.pop\n trash = []\n\n list_of_words.each do |test_item|\n if test_item.length < longest.length\n trash.push test_item\n else\n trash.push longest\n longest = test_item\n end\n end\n return longest\nend", "def longest_palindrome(string)\n if string.length <= 1\n return string\n end\n\n i = 0\n string.length.downto(1).each do |length|\n # .. is inclusive\n (0..i).each do |start_index|\n if palindrome?(string.slice(start_index, length))\n return string.slice(start_index, length)\n end\n end\n\n i += 1\n end\n\n string[0]\nend", "def longest_string(list_of_words)\n # Your code goes here!\n word_hash = Hash.new\n list_of_words.each do |word|\n word_hash[word] = word.length\n end\n word_length = Array.new\n word_hash.each_value do |value|\n word_length.push(value)\n end\n length_sorted = word_length.sort\n tall_one = length_sorted.last\n word_hash.key(tall_one)\nend", "def longest_pali(string)\n letters = string.gsub(/\\W+/,'').split('')\n combos = []\n idx = 2\n while idx <= letters.length\n combos << letters.combination(idx).to_a\n idx += 1\n end\n longest = nil\n combos.flatten(1).each do |x|\n if (palindrome?(x.join(''))) && (longest == nil || x.length > longest.length)\n longest = x\n end\n end\n \n return longest.join('')\nend", "def longest_entry(words)\n return words.max_by(&:length)\n end", "def longest_string(list_of_words)\n i=0\n long_string=list_of_words[0]\n list_of_words.each do\n if list_of_words[i].length>long_string.length\n long_string=list_of_words[i]\n end\n i+=1\n end\n return long_string\nend", "def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0\n \treturn nil\n end\n var = list_of_words[0]\n for i in 1 ... list_of_words.length\n \tif i == list_of_words.length\n \t\treturn var\n \telsif var.length < list_of_words[i].length\n \t\tvar = list_of_words[i]\n \tend\n \ti+=1\n end\n return var\nend", "def longest_string(list_of_words)\n list_of_words.max { |a,b| a.size <=> b.size }\n\nend", "def longest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\ti = list_of_words[0]\n\tj = 1\n\twhile j <= list_of_words.length - 1 do\n\t\tif i.length < list_of_words[j].length\n\t\t\ti = list_of_words[j]\n\t\tend\n\t\tj = j + 1\n\tend\n\treturn i\nend", "def longest_prefix(strings)\n strings.each do |string|\n if string.length == 0\n return \"\"\n end \n end \n prefix = strings[0]\n (1...strings.length).each do |n|\n (0...prefix.length).each do |i|\n if strings[n][i] != prefix[i]\n if i == 0\n prefix = \"\"\n break\n else \n prefix = prefix[0...i]\n break\n end \n end \n end \n end \n return prefix\nend", "def length_of_longest_substring(arr, k)\n\n start_index, max_length, max_ones = 0, 0, 0\n\n for end_index in 0..(arr.length - 1)\n if arr[end_index] == 1\n max_ones += 1\n end\n\n if (end_index - start_index + 1 - max_ones) > k\n if arr[start_index] == 1\n max_ones -= 1\n end\n start_index += 1\n end\n\n max_length = [max_length, end_index - start_index + 1].max\n end\n\n return max_length\nend", "def longest_length(validwords)\n validwords = validwords.sort_by(&:length).reverse\n validwords[0].length\nend", "def longest_prefix(strings)\n word_array = strings[0].split(\"\")\n length = strings.length\n\n prefix = \"\"\n\n word_array.each_with_index do |letter,letter_index|\n count_words_with_letter = 0\n\n (length - 1).times do |i|\n if (strings[i+1].split(\"\"))[letter_index] == letter \n count_words_with_letter += 1\n else\n return prefix\n end\n end\n\n if count_words_with_letter = length-1\n prefix += letter\n end\n end\n\n return prefix\nend", "def longest_palindrome(string)\n length = string.length\n while true\n (0..(string.length - length)).each do |i|\n word = string[i...(i + length)]\n return [i, (i + length - 1)] if is_palindrome?(word)\n end\n length -= 1\n end\nend", "def longest_string\nend", "def longest (string)\n length_string = getlength(string)\n string.each do |word|\n if word.length == length_string.max\n puts word\n end\n end\nend", "def longest_palindrome(string)\n longest = \"\"\n len = 2\n \n while len < string.length\n i = 0\n while i+len <= string.length\n if is_palindrome?(string[i...i+len])\n longest = [i, i+len-1]\n end\n i += 1\n end\n len += 1\n end\n\n longest\nend", "def longest_string array\n array.max_by(&:length)\nend", "def longest_palindrome(string)\n string.length.downto(3) do |length|\n string.chars.each_cons(length) do |substr_arr|\n return substr_arr.length if palindrome?(substr_arr.join)\n end\n end\n false\nend", "def longest_palindrome_subseq(s)\n length = s.size\n dp = []\n\n length.times do |i|\n dp[i]= Array.new(length).fill(0);\n dp[i][i] = 1\n end\n puts \"dp #{dp}\"\n (2..length).each do |len|\n puts \"len #{len}\"\n (0..(length - len)).each do |i|\n j = i + len - 1\n # puts \"j #{j} => i:#{i} + len:#{len} - 1\"\n\n if s[i] == s[j]\n dp[i][j] = 2 + (len == 2 ? 0 : dp[i+1][j-1])\n else\n dp[i][j] = [dp[i+1][j], dp[i][j-1]].max\n end\n puts \"dp #{dp}\"\n end\n end\n\n dp[0][length - 1]\nend", "def longest_string \nend", "def longest(words=[])\r\n result = ''\r\n words.inject do |memo, word|\r\n result = memo.length > word.length ? memo : word\r\n end\r\n result # don't use puts here, just return a value\r\nend", "def longest_string array\n\tarray.max_by(&:length)\nend", "def longest_consecutive(nums)\n return 0 if nums.empty?\n\n hash = {}\n nums.each { |num| hash[num] = -1 }\n nums.each do |num|\n next unless hash[num] == -1\n\n longest_consec = 1\n loop do\n val = hash[num + longest_consec]\n case val\n when -1\n hash[num + longest_consec] = -2\n longest_consec += 1\n when nil\n hash[num] = longest_consec\n break\n else\n longest_consec += hash[num + longest_consec]\n hash[num] = longest_consec\n break\n end\n end\n end\n\n hash.max_by { |_k, v| v }[1]\nend", "def longest_prefix(strings)\n\n # Assign relevant variables\n winning_ticket = \"\"\n i = 0 \n fastest_furthest = strings[0][i]\n\n # Account for non-nil values and return method result \n while fastest_furthest != nil\n strings.each do |string|\n unless string[i] == fastest_furthest\n return winning_ticket\n end \n end \n winning_ticket += fastest_furthest\n i += 1\n fastest_furthest = strings[0][i]\n end\n return winning_ticket\nend", "def longest_prefix(strings)\n prefix = ->s1, s2 { s1.each_char.zip(s2.each_char)\n .take_while { |c1, c2| c1 == c2 }\n .map(&:first).join }\n \n strings.reduce(&prefix)\nend", "def longest_prefix(strings)\n words = strings.length\n min_characters = (strings.min_by{|string|string.length}).length\n prefix = \"\"\n\n min_characters.times do |j|\n letter = strings[0][j]\n\n words.times do |i|\n return prefix if strings[i][j] != letter\n end\n\n prefix += letter\n end\n\n return prefix\nend", "def longest_string(list)\n\t\tlongest_so_far = list.first \t#look at the first element of the list. use that as the longest string.\n\t\tlist.each do | string |\t\t\t\t#move through the array. make the next element a placeholder.\n\t\t\tif string.length > longest_so_far.length #if this new placeholder value is longer than the longest_so_far length\n\t\t\t\tlongest_so_far = string \t#then the NEW longest string is that placeholder. REPEAT.\n\t\tend\n\tend\n\treturn longest_so_far\t\t\t\t\t\t\t\t\t\t\t\t\t#return the longest string so far.\nend", "def longest_string(list)\n longest_so_far = list.first\n list.each do |item|\n if longest_so_far.length < item.length\n longest_so_far = item\n end\n end\n longest_so_far\nend", "def longest_prefix(strings)\n # raise NotImplementedError, \"Not implemented yet\"\n longest_prefix = \"\"\n idx = 0\n letter = strings[0][idx]\n\n until letter == nil\n strings.each do |string|\n if string[idx] != letter\n return longest_prefix\n end\n end\n longest_prefix += letter\n idx += 1\n letter = strings[0][idx]\n end\n return longest_prefix\nend", "def longest_palindrome(string)\n string_arr = string.split(\"\")\n longest = 0\n substring = \"\"\n\n while string_arr.length > 0\n string_arr.each do |char|\n substring << char\n palindrome?(substring) && substring.length > longest ? longest = substring.length : next\n end\n\n string_arr.shift\n substring = \"\"\n end\n \n longest\nend", "def longest_in_list2 list #:nodoc:\n longest = list.inject(list[0]) do |memo,word|\n memo.length >= word.length ? memo : word\n end \n longest\n end", "def longest_palindrome(string)\n\ti = 0\n\tlongest = \"\"\n\twhile i < string.length\n\t\tcurrent_palindrome = \"\"\n\t\tj = 1\n\t\twhile j <= string.length\n\t\t\tif palindrome?(string.slice(i,j))\n\t\t\t\tcurrent_palindrome = string.slice(i,j)\n\t\t\tend\n\n\t\t\tif longest == \"\" || current_palindrome.length > longest.length\n\t\t\t\tlongest = current_palindrome\n\t\t\tend\t\n\t\t\tj += 1\n\t\tend\n\t\ti += 1\n\tend\n\tlongest\nend", "def length_of_longest_substring_2(s)\r\n return 0 if s == \"\"\r\n result = 0\r\n chars = s.chars\r\n hash = Hash.new\r\n left, right = 0, 0\r\n hash[chars[right]] = right\r\n hash[chars[left]] = left\r\n\r\n while right < chars.size\r\n result = [right - left + 1, result].max\r\n\r\n if hash.has_key?(chars[right + 1]) && left != right\r\n # Process the window\r\n hash.delete(chars[left])\r\n left += 1\r\n elsif !hash.has_key?(chars[right + 1])\r\n # Expand the window\r\n right += 1\r\n else\r\n # Move the window\r\n right += 1\r\n left += 1\r\n end\r\n\r\n # Update hash\r\n hash[chars[right]] = right\r\n hash[chars[left]] = left\r\n end\r\n\r\n result\r\nend", "def solution(n)\n binary_n = convert_to_binary(n)\n current, longest = 0, 0\n seen_start_one = false\n seen_end_one = false\n\n binary_n.each_char do |c|\n if c == \"0\"\n current += 1\n longest = [longest, current].max\n else\n current = 0\n end\n end\n\n longest\nend", "def find_streak_random(flips, streak_length)\n tries = 2 * flips.count + 10 # Since it's random we need to give up at some point. This is purely my gut feeling for what is 'enough' tries.\n # We could be more sophisticated here by randomizing a list of numbers that represent flip array indexes, but this is good enough.\n tries.times do\n flip_number = rand(flips.count - streak_length) # For a 100 flip array and 3 flip streak, this is 100 - 3 = 97 -> 0...96\n return flip_number if streak_found?(flips, flip_number, streak_length)\n end\n return nil # This represents a failure to find any streaks of the desired length in this array of flips\nend", "def longest_day_length\nend", "def longest_prefix(strings)\n loops = (strings.length) - 1\n comparison_word = strings[0]\n \n loops.times do |i|\n prefix = \"\"\n counter = 0\n \n strings[i + 1].each_char do |letter|\n if letter == comparison_word[counter]\n prefix<<(letter)\n end\n counter += 1\n end\n comparison_word = prefix\n end\n \n return comparison_word\nend", "def get_longest_string\n current_longest = {@data[0] => @data[0].length}\n longest_value = @data[0] # BUG should read @data[0].length\n @data.each do |word|\n if word.length > longest_value\n current_longest = {word => word.length}\n longest_value = word.length\n end\n end\n current_longest\n end", "def longest_word(sen)\n tmp_arr = sen.split(\" \")\n tmp_longest = 0\n tmp_arr.each do |i|\n tmp_longest = i.size if i.size > tmp_longest\n end\n\n tmp_arr.select { |i| i.size == tmp_longest }.first\nend", "def longest_string(list_of_words)\n # Your code goes here!\n longest = list_of_words[0]\n\n list_of_words.each { |word| \n if word.length > longest.length\n longest = word\n end\n }\n\n return longest\nend", "def longest_palindrome(string)\n\n palindromes = []\n\n (0...string.length).each do |i|\n (i+1...string.length).each do |j|\n sub = string[i..j]\n palindromes << sub if sub == sub.reverse\n end\n end\n\n palindromes.sort_by(&:length).last \n\nend" ]
[ "0.8441022", "0.82704574", "0.8244169", "0.81410116", "0.7903884", "0.7563653", "0.7093256", "0.68494946", "0.68438303", "0.6665296", "0.65755576", "0.63198435", "0.63146186", "0.6296605", "0.6270927", "0.6257507", "0.6256804", "0.62223566", "0.6215854", "0.62054133", "0.6185585", "0.6165027", "0.6109171", "0.60627174", "0.60316443", "0.6029227", "0.6024612", "0.6019013", "0.6005873", "0.6003784", "0.5970549", "0.5958488", "0.5953986", "0.5953689", "0.5953408", "0.5953398", "0.59492147", "0.5943629", "0.59351873", "0.59336597", "0.5933183", "0.5930009", "0.5922174", "0.5914873", "0.5912615", "0.59083617", "0.5902077", "0.5899697", "0.5899697", "0.5899697", "0.5877883", "0.58773804", "0.5860393", "0.5856623", "0.5855462", "0.5853411", "0.5848102", "0.5838659", "0.5838659", "0.58304894", "0.58295476", "0.5819204", "0.5818336", "0.58008254", "0.5798163", "0.5793268", "0.5785411", "0.57783175", "0.5772776", "0.57601845", "0.57589316", "0.5758602", "0.57579803", "0.57579225", "0.5755345", "0.57550526", "0.5732765", "0.57266194", "0.57254726", "0.57251835", "0.5723377", "0.5717843", "0.5714047", "0.57098794", "0.57095903", "0.5702805", "0.57026243", "0.56929123", "0.56926274", "0.56921726", "0.56865174", "0.5684874", "0.56825364", "0.56794465", "0.56776017", "0.567499", "0.56732434", "0.5673091", "0.56728333", "0.5672815", "0.56714845" ]
0.0
-1
Examples p bi_prime?(14) => true p bi_prime?(22) => true p bi_prime?(25) => true p bi_prime?(94) => true p bi_prime?(24) => false p bi_prime?(64) => false
def vigenere_cipher(message, keys) chars = message.split('') i = -1 enc_chars = chars.map do |char| i = (i + 1) % keys.length encrypt_char(char, keys[i]) end enc_chars.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bi_prime?(num)\n (2...num).each do |n|\n if num % n == 0\n return true if is_prime?(n) && is_prime?(num/n)\n end\n end\n false\nend", "def bi_prime?(num)\n (2...num).each do |i|\n return true if num % i == 0 && prime?(i) && prime?(num / i)\n end\n false\nend", "def bi_prime?(num)\n prime_factor_candidates = (2...num).to_a.select {|n| num % n == 0}\n prime_factors = prime_factor_candidates.select {|n| prime?(n)}\n prime_factors.each {|n| return true if prime_factors.include?(1.0*num/n)}\n false\nend", "def bi_prime?(num)\n (2...num).each do |i|\n if num % i == 0 && !((2...i).any? { |x| i % x == 0 })\n j = num / i\n return true if !((2...j).any? { |x| j % x == 0 })\n end\n end\n\n false\nend", "def bi_prime?(num)\n (2...num).any? { |n| num % n == 0 && is_prime?(n) && is_prime?(num/n) }\nend", "def bi_prime?(num)\n nums = []\n\n (1..num).each do |i|\n if num % i == 0 && is_prime?(i)\n nums << i\n end\n end\n if nums.length == 1\n return nums[0] * nums[0] == num\n end\n\n nums.inject { |acc, i| acc * i } == num\nend", "def bi_prime?(num)\n factors = []\n\n (2...num).each do |factor|\n factors << factor if num % factor == 0 \n end\n\n return false if factors.length > 2\n \n factors.each do |number|\n (2...number).each do |factor|\n return false if number % factor == 0\n end\n end\n\n true\nend", "def bi_prime?(num)\n factor_pair = []\n (1..num).each do |factor|\n if num % factor == 0\n factor_pair << [factor,num/factor]\n end\n end\n factor_pair.each do |pair|\n if is_prime?(pair[0]) && is_prime?(pair[1])\n return true\n end\n end\n false\nend", "def bi_prime?(num)\n factors = factors(num)\n\n factors.each do |subarray|\n if is_prime?(subarray[0]) && is_prime?(subarray[1])\n return true\n end\n end\n\n false\nend", "def bi_prime?(num)\n primers = prime_factors(num)\n primers.any? do |a|\n b = num / a * 1.0\n primers.include?(b)\n end\n\nend", "def bi_prime?(num)\n primes = []\n (1..num).each {|i| primes << i if prime?(i)}\n (0...primes.length).each do |idx1|\n (0...primes.length).each do |idx2|\n return true if idx2 >= idx1 && primes[idx1] * primes[idx2] == num\n end\n end\n false\nend", "def bi_prime?(num)\n arr = []\n (2...num).each do |i|\n if is_prime?(i) \n arr << i \n end\n end\n (0...arr.length).each do |first|\n (first...arr.length).each do |second|\n if arr[first] * arr[second] == num\n return true \n end\n end\n end\n false\nend", "def is_prime?(n)\n end", "def bi_prime?(num)\n factors = []\n (2...num).each {|n| factors << n if num % n == 0}\n (0...factors.length).each do |i1|\n (i1...factors.length).each do |i2|\n return true if factors[i1]*factors[i2] == num && (is_prime?(factors[i1]) && is_prime?(factors[i2]))\n end\n end\n false\nend", "def bi_prime?(num)\n primes = []\n\n divs = factors(num)\n divs.each do |s|\n if Prime.prime?(s)\n primes << s\n end\n end\n\n count = 1\n if primes.length == 1\n return primes[0] ** 2 == num\n else\n primes.each do |p|\n count *= p\n end\n return count == num\n end\nend", "def bi_prime?(num)\n (1..num).each do |j|\n (j..num).each do |i|\n if j.prime? && i.prime?\n return true if num == j * i\n end\n end\n end\n false\nend", "def bi_prime?(num)\n primes = list_primes_until(num)\n primes.any? { |x| primes.any? { |y| x * y == num } }\nend", "def bi_prime?(num)\n prime_nums = (0..num).select { |i| prime?(i) } \n\n prime_nums.any? do |prime_1|\n prime_nums.any? do |prime_2|\n prime_1 * prime_2 == num\n end\n end\nend", "def bi_prime?(num)\n primes = list_primes(num)\n primes.each_with_index do |elem1, idx1|\n primes[idx1...primes.length].each do |elem2|\n return true if elem1 * elem2 == num\n end\n end\n return false\nend", "def bi_prime?(num)\n prime_factors = []\n (2...num).each do |factor|\n if num % factor == 0\n prime_factors << factor if prime?(factor) # could use Prime class...do this for practice\n end\n end\n\n # do any of our prime factors have our num param as a product\n (0...prime_factors.length).each do |i|\n (i...prime_factors.length).each do |j|\n return true if (prime_factors[i] * prime_factors[j]) == num\n end\n end\n false\nend", "def is_prime?(x)\n return false if x == 1\n return true if x == 2 || x == 3\n return false if x % 2 == 0 || x % 3 == 0\n limit = (x ** (1/2.0)).to_i\n i = 1\n a = 6*i - 1\n b = 6*i + 1\n\n while a <= limit || b <= limit\n return false if x % a == 0 || x % b == 0\n i += 1\n a = 6*i - 1\n b = 6*i + 1\n end\n\n return true\nend", "def bi_prime?(num)\n (2...num).each do |i|\n if num % i == 0\n pair = [i, num / i]\n mapped = pair.map { |ele| prime?(ele) }\n if mapped.all? { |ele| ele == true }\n return true\n end\n end\n end\n false\nend", "def is_prime?(n) \n Math.sqrt(n).to_i.downto(2).each do |i| \n return false if n % i == 0\n end\nend", "def is_prime?(i)\r\n 2.upto(Math.sqrt(i).to_i) {|j|\r\n return false if i % j == 0\r\n }\r\n true\r\nend", "def is_prime?(n)\n (2...n).each { |factor| return false if n % factor == 0 } \n n > 1\nend", "def is_prime?\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\nend", "def is_prime?(f) \n !(2..(f**0.5)).any? {|div| f%div==0 }\nend", "def is_prime?(num)\nend", "def check_prime? num\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\nend", "def is_prime(num)\n (2..num**0.5).each { |i| return false if num % i == 0 }\n true\nend", "def is_prime?(number)\n (2...number).each do |divisor|\n return false if number % divisor == 0\n end\n\n true\n \nend", "def is_prime?(number)\n (2...number).each do |factor|\n if number % factor == 0\n return false\n end\n end\n return true\nend", "def is_prime?(num)\n Math.sqrt(num).floor.downto(2).each do |i|\n false if num % i == 0\n end\n true\nend", "def is_prime?\r\n\t#Your code here\r\nend", "def is_prime?(num)\n (2...num).each {|el| return false if num % el == 0}\n true\nend", "def is_prime?(integer)\n return false if integer == 1\n (2...integer).to_a.all? {|num| integer % num != 0}\nend", "def isprime?(num)\n\n return false if num<2\n\n (2...num).each do |factor|\n return false if num % factor == 0\n end\n\n return true\n\nend", "def is_prime?(number)\r\n (2...number).each do |n|\r\n return false if number % n == 0\r\n end\r\n true\r\nend", "def is_prime?(number)\n\nend", "def is_prime?(number)\n\nend", "def is_prime? (number)\n return false if number < 1\n 2.upto(Math.sqrt(number)) do |x|\n return false if number % x == 0\n end \n true\nend", "def is_prime?(num)\n return false if num < 2\n (2...num).each { |factor| return false if num % factor == 0}\n true\nend", "def prime?(num)\n Math.sqrt(num).to_i.downto(2).each { |i| return false if (num % i).zero? }\n true\nend", "def is_prime?(num)\r\n (2..(num ** 0.5).to_i).each {|factor| return false if num % factor == 0 && num != factor} # no need to check above square root\r\n true\r\nend", "def is_prime?(num)\n (2...num).each do |factor|\n if num % factor == 0\n return false\n end\n end\n true\nend", "def is_prime?(num)\n (2...num).each do |i|\n return false if num % i == 0\n end\n true\nend", "def is_prime?(num)\n return false if num == 1\n return true if num == 2 \n (2..Math.sqrt(num)+1).each do |x|\n return false if num%x == 0\n end\n true\nend", "def is_prime?(num)\n (2...num).each do |el|\n return false if num % el == 0\n end\n true\nend", "def is_prime?(num)\n\nend", "def is_prime?(num)\n 2.upto(num-1) do |i|\n return false if num%i==0\n end\n true\nend", "def check_prime? n \nn_max_two=Math.sqrt(n).floor \nnot_count=0 \nfor i in 2..n_max_two\n if n % i == 0 \nnot_count +=1 \n end \nend \nif not_count > 0 \n return false \n else \n return true \nend \nend", "def isprime(n)\n \n for x in (3..(n**0.5).abs+2)\n if n % x == 0\n return false\n end\n return true\n end\nend", "def is_prime?(num)\n return 2 if num == 2\n (2...num).each do |n|\n return false if num % n == 0\n end\n true\nend", "def is_prime?(num)\n (2..num-1).each do |x|\n return false if num % x == 0\n end\n true\nend", "def prime?(int)\n \nend", "def is_prime?(num)\n return false if num <= 1\n\n (2...num).each do |fact|\n return false if num % fact == 0\n end\n\n true\nend", "def is_prime?(i)\n return false if i <= 1\n return true if i == 2\n (2...i).each {|n|\n if i % n == 0\n return false\n end\n }\n true\nend", "def is_prime?(num)\n return false if num < 2\n (2...num).each do |i|\n return false if num%i == 0\n end\n return true\nend", "def is_prime?(num)\n (2..(num/2)).each { |divisor| return false if num % divisor == 0 }\n true\nend", "def prime?(num)\n return false if num == 1\n return true if num == 2 or num == 3 or num == 5 or num == 7\n return false if num % 2 == 0 or num % 3 == 0 or num % 5 == 0 or num % 7 == 0\n (11..Math.sqrt(num).ceil).each do |i| \n return false if num % i == 0\n end\n true \nend", "def is_prime?(number)\n idx = 2\n if number < 2\n return false\n end\n\n while idx <= number**0.5\n return false if number%idx == 0\n idx+=1\n end\n return true\nend", "def is_prime(num)\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n return true\nend", "def is_prime?(num)\n return false if num.even?\n for i in (2..((num/2.round) + 1))\n return false if num % i == 0\n end\n return true\nend", "def is_prime?(num)\n return false if num.even?\n for i in (2..((num/2.round) + 1))\n return false if num % i == 0\n end\n return true\nend", "def prime?(number)\n (2..(number-1)).each do |possible_factor|\n return false if number % possible_factor == 0\n end\n true\nend", "def is_prime?(n)\n count = 0\n if n.class==Float || n<1\n false\n else\n (2...n).to_a.each{|num| if n%num==0 then count+=1 end}\n return count==0 ? true : false\n end\nend", "def is_prime?(num)\n return false if num < 2\n\n (2...num).each do |i|\n return false if num % i == 0\n end\n true \nend", "def is_prime?(num)\n ('1' * num) !~ /^1?$|^(11+?)\\1+$/\n end", "def is_prime(nb)\n test = count = 0\n if (nb == 1)\n return -1\n end\n for i in 2..nb-1\n count++\n if (nb % i == 0)\n test = false\n end\n end\n if (!test)\n return 1\n else\n return 0\n end\nend", "def is_prime?(number)\n (2..(number - 1)).each do |divisor|\n return false if number % divisor == 0\n end\n\n true\nend", "def is_prime?(number)\n (2..(number - 1)).each do |divisor|\n return false if number % divisor == 0\n end\n\n true\nend", "def is_prime?(number)\n (2..(number - 1)).each do |divisor|\n return false if number % divisor == 0\n end\n\n true\nend", "def is_prime?(num)\n (2...num).each do |n|\n if num % n == 0\n return false\n end\n end\n true\nend", "def is_prime?(n)\n (2..n-1).to_a.all? {|num| n % num != 0}\nend", "def is_prime?(num)\n return false if num < 2\n \n (2...num).each do |i|\n return false if num % i == 0\n end\n true\nend", "def is_prime(x)\n return true if x.prime? == true\n else false\nend", "def is_prime?(num)\n (2...num).each do |i|\n if num % i == 0\n return false\n end\n end\n num > 2\nend", "def is_prime?(num)\n if !num.is_a?(Integer) || ( num.class == Float && !num.nan? && num == num.floor ) || num <= 1\n false\n else\n (2...num).each do |i|\n if num % i == 0\n return false\n end\n end\n true\n end\nend", "def is_prime?(number)\n return false if number < 2\n \n (2..number - 1).each do |n|\n return false if number % n == 0\n end\n\n true\nend", "def is_prime?(number)\n return true if number == 2\n 2.upto(number/2) do |x|\n return false if number%x == 0\n end\n return true\nend", "def isprime(n)\n if n == 1\n return false\n elsif n == 2\n return true\n else\n (2..Math.sqrt(n).ceil).each { |e| n % e == 0 ? (return false) : next }\n return true\n end\nend", "def is_prime?(a)\n max = a -1\n [*(2..max)].each do |val|\n if a % val == 0\n return false\n end\n end\n true\n end", "def is_prime?(number)\n for i in 2..(number-1)\n if (number % i) == 0\n return false\n break\n end\n end\n true\nend", "def is_prime?(num)\n\n return false if num<2\n\n (2...num).none? {|factor| num%factor == 0}\n\nend", "def is_prime?(n)\n 2.upto(Math.sqrt(n).to_i) { |num| return false if n % num == 0 }\n n == 1 ? false : true\nend", "def is_prime?(number)\n return false if number < 2\n (2...number).to_a.none?{ |integer| number % integer == 0 }\nend", "def is_prime?(num)\n return true if num == 1\n (2...num).all? {|i| (num % i) != 0}\nend", "def is_prime?(num)\n (2..num / 2).each do |n|\n return false if num % n == 0\n end\n true\nend", "def num_prime?(num)\n j = Math.sqrt(num).floor\n is_prime = true\n (2..j).each do |i|\n is_prime = false if num % i == 0\n end\n is_prime\nend", "def is_prime?(num)\n return false if num == 1 #added gaurd clause after watching walkthrough\n (2..(num - 1)).select do |x| #refactored to remove range variable\n return false if num % x == 0\n end\n return true #moved the this return to solve is_prime?(2) while watching video\nend", "def is_prime?(num)\n 2.upto(num / 2) do |n|\n return false if num % n == 0\n end\n true\nend", "def is_prime?(n)\n if n == 2\n return true\n end\n\n (2...n).each do |i|\n if n % i == 0\n return false\n end\n end\n true\nend", "def anti_prime?(number)\n divisor_count = divisors(number)\n (2..number).each do |num| \n return false if divisors(num) > divisor_count \n end \n true\nend", "def is_prime?(x)\n\ti = 2\n\twhile i < x\n\t\tif x % i == 0\n\t\t\treturn false\n\t\tend\n\t\ti += 1\n\tend\n\treturn true\nend", "def is_prime?(number)\n i = number - 1\n until i < 2\n if number % i == 0\n return false\n end\n i -= 1\n end\n return true\nend", "def is_prime k\n 2.upto(Math.sqrt(k).to_i) do |x|\n return false if k % x == 0 or (k - 1) <= 1\n end\n true\nend", "def is_prime?(number)\n remainders = (2...number).map { |d| number % d}\n !remainders.include?(0) && number > 1\nend", "def prime?(num)\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\n end", "def is_prime?(n)\n root = Math.sqrt(n)\n return false if n < 2\n return true if n < 4\n return false if n %2 == 0\n return true if n < 9\n return false if n % 3 == 0\n i = 5\n while i < root\n return false if n % i == 0\n return false if n % (i + 2) == 0\n i += 6\n end\n return true\nend", "def is_prime?(num)\nreturn false if num < 2\n\n(2...num).none? { |num2| num % num2 == 0}\nend", "def isPrime?(num)\n return false if num < 2\n\n (2...num).each { |factor| return false if num % factor == 0}\n\n true\nend" ]
[ "0.8281085", "0.82703304", "0.8257007", "0.82348573", "0.82134205", "0.8178718", "0.81769645", "0.81700945", "0.81395066", "0.8127853", "0.8118922", "0.8098536", "0.80793047", "0.8078909", "0.8074484", "0.8047045", "0.80304784", "0.8002915", "0.7993853", "0.79491615", "0.7948025", "0.79185116", "0.78442746", "0.77994746", "0.7767103", "0.7763314", "0.7751159", "0.7747804", "0.77344185", "0.7727721", "0.7720706", "0.7719141", "0.7713757", "0.76987934", "0.7697567", "0.76970184", "0.76896095", "0.76894593", "0.7684508", "0.7684508", "0.76771986", "0.76658607", "0.76471716", "0.76466256", "0.76421225", "0.76366776", "0.76333255", "0.76298213", "0.7628504", "0.76274604", "0.7621361", "0.7617625", "0.76165205", "0.7607747", "0.7606052", "0.758942", "0.7587247", "0.7580866", "0.7580002", "0.7566168", "0.75636595", "0.75634545", "0.75576067", "0.75576067", "0.75566053", "0.7556592", "0.7552782", "0.754718", "0.7547114", "0.7546163", "0.7546163", "0.7546163", "0.75437754", "0.7543629", "0.7543093", "0.7542017", "0.75320363", "0.75313383", "0.7528648", "0.7528494", "0.7523808", "0.7519457", "0.7518742", "0.75057083", "0.75050485", "0.7502295", "0.75015277", "0.7500956", "0.7498977", "0.74957174", "0.7495232", "0.74923", "0.7492154", "0.7491021", "0.74906576", "0.7490432", "0.7484502", "0.7483548", "0.7483545", "0.7480556", "0.7480413" ]
0.0
-1
Examples p vigenere_cipher("toerrishuman", [1]) => "upfssjtivnbo" p vigenere_cipher("toerrishuman", [1, 2]) => "uqftsktjvobp" p vigenere_cipher("toerrishuman", [1, 2, 3]) => "uqhstltjxncq" p vigenere_cipher("zebra", [3, 0]) => "ceerd" p vigenere_cipher("yawn", [5, 1]) => "dbbo"
def vowel_rotate(str) vowel_indices = (0...str.length).select { |i| 'aeiou'.include?(str[i]) } rotated_indices = vowel_indices.rotate(-1) rotated_chars = str.split('').map.with_index do |char, i| vowel_indices.include?(i) ? str[rotated_indices.shift] : char end rotated_chars.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vigenere_cipher(string, key_sequence, alphabet)\r\n\r\nend", "def vigenere_cipher(message, keys)\n alphabetic = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, i|\n num = keys[i % keys.length]\n index = alphabetic.index(char)\n encrypted += alphabetic[(index + num) % 26]\n end\n \n encrypted\nend", "def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n vigenere = \"\"\n\n message.each_char.with_index do |char, i|\n index = alphabet.index(char)\n key = keys[i % keys.length].to_i\n new_char = alphabet[(index + key) % 26] \n vigenere += new_char\n end\n\n vigenere\nend", "def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n vigenere_str = \"\"\n\n message.each_char.with_index do |char, idx|\n old_idx = alphabet.index(char)\n temp_key = keys.shift\n keys.push(temp_key)\n new_idx = (old_idx + temp_key) % 26\n vigenere_str += alphabet[new_idx]\n end\n vigenere_str\nend", "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n new_string = \"\"\n message.each_char.with_index do |char, i|\n old_i = alpha.index(char)\n new_i = (old_i + keys[i % keys.length]) % 26\n new_string += alpha[new_i]\n end\n new_string\nend", "def vigenere_cipher(string, key_sequence, alphabet)\n #\n # your code goes here\n #\nend", "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, idx|\n shift = keys[idx % keys.length]\n encrypted += alphabet[(alphabet.index(char) + shift) % 26]\n end\n\n encrypted\nend", "def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n array = []\n\n i = 0\n\n message.each_char do |char|\n idx = alphabet.index(char)\n array << alphabet[(idx + keys[i]) % 26]\n if i < keys.length - 1\n i += 1\n else\n i = 0\n end\n end\n array.join('')\n \nend", "def vigenere_cipher(string, key_sequence)\n result = \"\"\n alphabet = (\"a\"..\"z\").to_a\n string.each_char.with_index do |ch, idx|\n key_idx = idx % key_sequence.length\n char_idx = (alphabet.index(ch) + key_sequence[key_idx]) % alphabet.length\n result << alphabet[char_idx]\n end\n result\nend", "def vigenere_cipher(word, key_seq_arr)\n return word if key_seq_arr.empty?\n \n ciphered = \"\"\n word.chars.each_with_index do |char, i|\n # Can't modulo/divide by zero, so take first key manually\n if i == 0 || key_seq_arr.length == 1\n ciphered += cipher_char(char, key_seq_arr.first)\n else\n curr_key = i % key_seq_arr.length\n ciphered += cipher_char(char, key_seq_arr[curr_key])\n end\n end\n\n ciphered\nend", "def vigenere_cipher(message, keys)\n new_string = ''\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\n\n message.each_char.with_index do |char, idx|\n old_idx = alphabet.index(char)\n if keys.length == 1\n new_idx = keys[0]\n end\n new_idx = keys[idx % keys.length]\n new_pos = old_idx + new_idx\n new_string += alphabet[new_pos % 26]\n end\n\n new_string\nend", "def vigenere_cipher(string, key_sequence)\n\nend", "def vigenereCipher(string, key, alphabet)\n aryStr = string.split(\"\")\n nStr = Array.new\n i = 0\n while i < aryStr.length\n j = 0\n while j < key.length\n nStr << (alphabet[(alphabet.index(aryStr[i]) + key[j])])\n j += 1\n i += 1\n end\n end\n return nStr.join('')\nend", "def vigenere_cipher(string, key_sequence)\n alphabet = ('a'..'z').to_a\n keys = key_sequence.dup\n result = \"\"\n while result.length < string.length\n c = string[result.length] \n offset = (alphabet.index(c) + keys.first) % 26 \n result += alphabet[offset]\n keys.push(keys.shift)\n end\n result\nend", "def vigenere_cipher(message, keys)\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n if keys.length == 1\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + keys[0]) % 26\n new_str += alpha[new_idx]\n end\n else\n new_keys = keys\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + new_keys[0]) % 26\n new_str += alpha[new_idx]\n new_keys.rotate!(1)\n end\n end\n new_str\n \nend", "def vigenere_cipher(message, keys)\n key_idx = 0\n new_message = \"\"\n message.each_char do |char|\n new_message += cipher(char, keys[key_idx])\n key_idx = (key_idx + 1) % keys.length\n end\n\n new_message\nend", "def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n cycle = 0\n result = \"\"\n\n message.each_char do |char|\n result += alphabet[(alphabet.index(char) + keys[cycle % keys.length]) % alphabet.length]\n cycle += 1\n end\n\n return result\nend", "def vigenere_cipher(message, key)\n key_index = 0 \n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n message.each_char.with_index do|char,idx|\n new_str += alpha[(alpha.index(char) + key[key_index % key.length])%26]\n key_index += 1\n end\n new_str\nend", "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n cipher = message.chars.map.with_index do |c, i|\n # determine which key to use based on position in the message\n offset = keys[i % keys.length]\n new_idx = (alphabet.index(c) + offset) % 26\n alphabet[new_idx]\n end\n cipher.join(\"\")\nend", "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n\n message.each_char.with_index do |char|\n old_pos = alphabet.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_msg += alphabet[new_pos % alphabet.length]\n end\n\n new_msg\nend", "def vigenere_cipher(string, key_sequence)\n alphabet = (\"a\"..\"z\").to_a\n alphabet.concat(alphabet) # double it to deal with wrapping\n \n chars = string.split('')\n count = 0\n \n for i in 0...chars.length\n # lookup the index of chars[i] in alphabet, then add to it using key sequence\n # and modulo to keep track of which step in the sequence you're at\n chars[i] = alphabet[alphabet.index(chars[i]) + key_sequence[count % key_sequence.length]]\n count += 1\n end\n chars.join('')\nend", "def deVigenere(cipher, key)\n plain = \"\"\n\n n = cipher.length\n while key.length < n\n key += key\n end\n key = key[0...n]\n\n for i in 0...n\n c = cipher[i].upcase\n k = key[i].upcase\n if letter?(c)\n col = find_col(k)\n row = find_row(c, col)\n plain += $TABLE[row][0]\n if c != cipher[i]\n plain[-1] = plain[-1].downcase\n end\n else\n plain += c\n end\n end\n\n return plain\nend", "def vigenere_cipher(message, keys)\n chars = message.split('')\n i = -1\n enc_chars = chars.map do |char|\n i = (i + 1) % keys.length\n encrypt_char(char, keys[i])\n end\n enc_chars.join\nend", "def vigenere_cipher(str, k)\n alpha = (\"a\"..\"z\").to_a\n\n msg = (0...str.length).map do |i|\n old_pos = alpha.index(str[i])\n new_pos = (old_pos + k[i%k.length]) % alpha.length\n alpha[new_pos]\n end\n\n msg.join()\nend", "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n indices = message.split(\"\").map {|char| alphabet.index(char)}\n \n ciphered_message = \"\"\n indices.each_with_index do |n, i|\n shift_amount = keys[i % keys.length]\n new_index = (n + shift_amount) % alphabet.length\n ciphered_message += alphabet[new_index]\n end\n\n ciphered_message\nend", "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n count = 0\n message.each_char.with_index do |char, idx|\n pos = alpha.index(char)\n #rather than count we can do key alpha[(pos + key[idx % key.length] )% 26]\n message[idx] = alpha[(pos + keys[count]) % alpha.length]\n count += 1\n count = 0 if count == keys.length\n end\n message\nend", "def vigenere_cipher(msg, arr)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n msg.each_char.with_index do |char, i|\n pos= alphabet.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alphabet.length\n new_msg += alphabet[new_pos]\n end\n new_msg\nend", "def enVigenere(plain, key)\n cipher = \"\"\n\n n = plain.length\n while key.length < n\n key += key\n end\n key = key[0...n]\n\n for i in 0...n\n p = plain[i].upcase\n k = key[i].upcase\n if letter?(p)\n row = find_row(p, 0)\n col = find_col(k)\n cipher += $TABLE[row][col]\n if p != plain[i]\n cipher[-1] = cipher[-1].downcase\n end\n else\n cipher += p\n end\n end\n\n return cipher\nend", "def vigenere_cipher(str, arr)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n str.each_char.with_index do |char, i|\n pos = alpha.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alpha.length\n new_str += alpha[new_pos]\n end\n new_str\nend", "def vigenere_cipher(string, keys)\n alpha = ('a'..'z').to_a\n new_word = \"\"\n\n string.each_char.with_index do |char, idx|\n old_idx = alpha.index(char)\n new_idx = old_idx + keys[idx % keys.length]\n new_char = alpha[new_idx % alpha.length]\n new_word += new_char\n end\n\n new_word\nend", "def vigenere_cipher(string, key_sequence)\n result = \"\"\n string.each_char.with_index do |c, idx|\n key_idx = idx % key_sequence.length\n key = key_sequence[key_idx]\n result << shift(c, key)\n end\n result\nend", "def vigenere_cipher(str, arr)\n alpha = ('a'..'z').to_a\n new_msg = ''\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + arr[idx % arr.length]\n new_msg += alpha[new_pos % 26]\n end\n new_msg\nend", "def vigenere_cipher(str,keys)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_str += alpha[new_pos % alpha.length]\n end\n\n new_str\n\nend", "def vigenere_cipher(str, arr)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n results = \"\"\n str.each_char.with_index do |char, i|\n ind = (alphabet.index(char) + arr[0]) % 26\n results += alphabet[ind]\n arr.rotate!\n end\n results\nend", "def caesarCipherEncryptor(string, key)\n new_letters = []\n new_key = key % 26\n alphabet = (\"abcdefghijklmnopqrstuvwxyz\").chars\n\n string.each_char do |letter|\n new_letters.append(get_new_letter(letter, new_key, alphabet))\n end\n return new_letters.join\nend", "def vigenere_cipher(word,arr)\n\n new_arr = []\n alp = (\"a\"..\"z\").to_a\n word.split(\"\").each.with_index do |char,i|\n old_index = alp.index(char)\n new_index = (alp.index(char)+ arr[i % arr.length]) % 26\n new_arr << alp[new_index]\n end\n new_arr.join(\"\")\n\nend", "def dr_evils_cipher(coded_message)\n code = coded_message.downcase.split(/[@#$%&*]/)\n decoded_string = []\n cipher = (\"a\"..\"z\").to_a\n \n code.each do |word|\n decoded_word = \"\"\n word.split(//).each do |letter|\n if cipher.include?(letter)\n index = cipher.index(letter) - 4\n decoded_letter = cipher[index]\n decoded_word << decoded_letter\n else\n decoded_word << letter\n end\n end\n decoded_string << decoded_word\n end\n decoded_string.join(\" \")\nend", "def vigenere(key, txt)\n shift_array = key.get_shift\n count = 0\n\n txt_array = txt.split('')\n ciph=[]\n\n txt_array.each do |a|\n a = a.ord\n shift = shift_array[count % shift_array.size]\n case a\n when (64..90) \n new_char = ((a - 64 + shift) % 26) + 64 \n count += 1\n when (97..122)\n new_char = ((a- 97 + shift) % 26) + 97\n count += 1\n else \n new_char = a \n end\n ciph.push(new_char.chr)\n end\n\n ciph = ciph.join('')\n puts \"#{ciph}\"\nend", "def chiffre \n\n\t@character_to_digit = {'a',0,'b',1,'c',2,'d',3,'e',4,'f',5,'g',6,'h',7,'i',8,'j',9,'k',10,'l',11,'m',12,'n',13,'o',14,'p',15,'q',16,'r',17,'s',18,'t',19,'u',20,'v',21,'w',22,'x',23,'y',24,'z',25}\n\t@digit_to_character = {0,'a',1,'b',2,'c',3,'d',4,'e',5,'f',6,'g',7,'h',8,'i',9,'j',10,'k',11,'l',12,'m',13,'n',14,'o',15,'p',16,'q',17,'r',18,'s',19,'t',20,'u',21,'v',22,'w',23,'x',24,'y',25,'z'}\n\t\n\t@encrypted_text = \"\"\n\t@plaintext.each do |character| \n\t\tcharacter = character.downcase\n\t\t\n\t\tif @character_to_digit.has_key?(character) == false\n\t\t\tnew_character = character\n\t\telse\toriginal_number = @character_to_digit[character]\t\t\t\n\t\t\t@new_number = original_number.to_i + @key\n\n\t\t\tif @new_number > 25\n\t\t\t\t@new_number = @new_number.modulo(26) end\n\t\t\n\t\t\tnew_character = @digit_to_character[@new_number]\n\t\tend\n\t\t\n\t\t@encrypted_text += new_character.to_s \n\t\tend\nend", "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvxyz\"\n new_str = \"\"\n \n str.each_char do |char|\n old_idx = alphabet.index(char) # each items index on the alphabet\n\tnew_idx = old_idx + num\n\tnew_char = alphabet[new_idx % 26] # to ensure that results is always less than 26 e.g. 'z' + 4 will fail without this, will now return to 'a' + 4 = 'd'.\n\tnew_str += new_char\n\tend\n \n return new_str\n\nend", "def caesar_cipher(message, n)\n\nend", "def cipher; end", "def caesar_guesser(encrypted_string, alphabet)\r\n\r\nend", "def caesar_cipher(message, factor)\n message_a = message.split('')\n ciphered_message = message_a.map do |letter|\n cipher_letter(letter, factor)\n end\n ciphered_message.join('')\nend", "def caesar_cipher(string,num)\n alpha = (\"a\"..\"z\").to_a \n string_array = \"\"\n string.each_char do |char|\n if alpha.include?(char)\n old_index = alpha.index(char)\n new_index = old_index + num \n string_array += alpha[new_index % 26]\n else\n string_array += char \n end\n\n end\n return string_array\nend", "def caesar_guesser(encrypted_string, alphabet)\nend", "def caesar_cipher(string, key) \n\tarr_string = string.downcase.split(\"\") \n\talpha = (\"a\"..\"z\").to_a \n\tfor i in arr_string do \n\t\tif alpha.include?(i) \n\t\t\talpha_index = alpha.index(i) \n\t\t\tstring_index = arr_string.index(i) \n\t\t\tif alpha_index + key > 25 \n\t\t\t\tkey_change = alpha[alpha_index + key - 25 - 1] \n\t\t\t\tarr_string[string_index] = key_change \n\t\t\telse \n\t\t\t\tkey_change = alpha[alpha_index + key] \n\t\t\t\tarr_string[string_index] = key_change \n\t\t\tend \n\t\tend \n\tend \n\tarr_string.join\nend", "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n \n\tstr.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n\n end\n return new_str\n\nend", "def caesar_cipher(string, shift_factor)\n\n\n upc_alphabet_arr = ('A'..'Z').to_a\n downc_alphabet_arr = ('a'..'z').to_a\n\n\n string_chars_arr = string.chars\n\n new_chars_arr = []\n\n string_chars_arr.each do |char|\n if upc_alphabet_arr.include?(char)\n new_index = (upc_alphabet_arr.index(char) + shift_factor)%26\n new_char = upc_alphabet_arr[new_index]\n\n new_chars_arr << new_char\n\n elsif downc_alphabet_arr.include?(char)\n new_index = (downc_alphabet_arr.index(char) + shift_factor)%26\n new_char = downc_alphabet_arr[new_index]\n\n new_chars_arr << new_char\n\n else \n new_chars_arr << char\n end\n end\n\n new_string = new_chars_arr.join(\"\")\n puts new_string\nend", "def caesar_cipher_encryptor(string, key)\n\talphabet = %w(a b c d e f g h i j k l m n o p q r s t u v w x y z)\n\tnew_alphabet = []\n\twrap_key = key % 26\n for char in string.split(\"\")\n new_index = alphabet.index(char) + wrap_key\n new_alphabet << alphabet[new_index % 26]\n\tend\n\tnew_alphabet.join(\"\")\nend", "def caesar_cipher(word, length)\n alphabet = (\"a\"..\"z\").to_a\n\n word_as_arr = word.split(\"\")\n encrypted_arr = []\n word_as_arr.each do |char|\n encrypted_arr << alphabet[(alphabet.index(char) + length) % 26]\n end\n\n encrypted_arr.join(\"\")\n end", "def ceasar_cipher(input, shifter)\n\n alphabet = Array('a'..'z')\n lower_case = Hash[alphabet.zip(alphabet.rotate(shifter))]\n\n alphabet = Array('A'..'Z')\n upper_case = Hash[alphabet.zip(alphabet.rotate(shifter))]\n\n cipher = lower_case.merge(upper_case)\n\n input.chars.map{ |c| cipher.fetch(c , c)}.join\n \nend", "def caesar_cipher(str, num)\r\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n new_str = \"\"\r\n\r\n str.each_char do |char|\r\n old_idx = alphabet.index(char)\r\n new_idx = old_idx + num\r\n new_char = alphabet[new_idx % 26]\r\n new_str += new_char\r\n end\r\n\r\n return new_str\r\nend", "def caesar_cipher(text_to_cipher, key)\n # ensure key is a value between 0 and 25\n key = key % 26\n\n text_to_cipher.split(\"\").map do |character|\n if letter?(character)\n shift(character, key)\n else\n character\n end\n end.join(\"\")\n\nend", "def caesar_cipher(str, num)\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\n cipher = ''\n\n (0...str.length).each do |i|\n char = str[i]\n index = alphabet.index(char) + num\n cipher += alphabet[index % 26]\n end\n return cipher\nend", "def caesar_cipher(str, num)\n new_str = \"\"\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n str.each_char do |char|\n old_index = alphabet.index(char)\n new_index = old_index + num\n new_char = alphabet[new_index % 26] # MOST IMPORTANT STEP!!!!! THIS WILL ALSO TAKE CARE OF new_index > 26\n new_str += new_char\n end\n return new_str\nend", "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n\n str.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n end\n\n return new_str\nend", "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n \n str.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n end\n \n return new_str\nend", "def caesar_cipher(text, key)\n ciphered_text = []\n text.chars.each do |letter|\n ciphered_letter = letter\n if letter.match(/^[[:alpha:]]$/)\n key.times do\n if ciphered_letter == 'z'\n ciphered_letter = 'a'\n elsif ciphered_letter == 'Z'\n ciphered_letter = 'A'\n else\n ciphered_letter = ciphered_letter.next\n end\n end\n end\n ciphered_text << ciphered_letter\n end\n ciphered_text.join('')\nend", "def vowel_cipher(string)\n\tvowels = \"aeiou\"\n \tcipher = \"\"\n \n \tstring.each_char do |char|\n \tif vowels.include?(char)\n \tidx = vowels.index(char)\n \tchar = vowels[(idx + 1) % 5]\n end\n \tcipher += char\n end\n \n \treturn cipher\nend", "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n \n str.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n end\n\n return new_str\nend", "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n\n str.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n end\n\n return new_str\nend", "def caesar_cipher(string, shift)\nend", "def decipher(ciphertext, key)\n alphabet = (\"A\"..\"Z\").to_a\n remaining = alphabet - key\n grid = key.map{ |k| [k] }\n remaining.each_with_index { |l, i| grid[i % key.length] << l }\n substitution = grid.sort.flatten!\n ciphertext.inject(\"\") do |s, l|\n l == \" \" ? s += \" \" : s += alphabet[substitution.index(let)]\n end\nend", "def caesarCipher(s, k)\n s.chars.map do |e|\n e = e.ord\n case e\n when 97..122\n e + k > 122 ? (e + k - 122 + 97 - 1) : e + k\n when 65..90\n e + k > 90 ? (e + k - 90 + 65 - 1) : e + k \n else\n e \n end\n end.map{|e| e.chr}.join\nend", "def solve_cipher(input)\n\n\tputs \"\\n\\nCAESAR'S CYPHER -- ITERATION 1\\n\"\n\t \n\t#Char -> convert string to characters \n\t#map() -> convert all the items \n\t#ord -> Return the Integer ordinal of a one-character string\n\n\tinput_ascii = input.chars.map(&:ord)\n\toutput_ascii = []\n\t\n\tinput_ascii.each do |item|\n\n\t\tif (item >= 97 and item <= 122)\n\t\t\tlowercase = item - 97\n\t\t\toutput_ascii << 97 + (lowercase - 1) % 26\n\n\t\telsif (item >= 65 and item <= 90)\n\t\t\tuppercase = item - 65\n\t\t\toutput_ascii << 65 + (uppercase - 1) % 26\n\t \tend\n\tend\n\n\tcypher = output_ascii.map(&:chr)\n\tresult = cypher.join\n\n\treturn result\nend", "def cipher(word, key) \n #create a code for each letter of the alphabet (index == code)\n up_alpha = [\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"M\",\"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"Z\"]\n down_alpha = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n word_arr = []\n word_arr = word.split(//)\n\n #shift the value of each letter in the array \n word_arr.each do |letter|\n new_arr = []\n if up_alpha.include?(letter)\n new_index = up_alpha.index(letter) + key\n #If the new index exceed 25, rollover to index 0 (for uppercase letters)\n if new_index > 25\n new_index = new_index - 26\n new_arr.push(up_alpha[new_index])\n else \n new_arr.push(up_alpha[new_index])\n end\n\n elsif down_alpha.include?(letter)\n new_index = down_alpha.index(letter) + key\n #If the new index exceed 25, rollover to index 0 (for lowercase letters)\n if new_index > 25\n new_index = new_index - 26\n new_arr.push(down_alpha[new_index])\n else \n new_arr.push(down_alpha[new_index])\n end \n else\n new_arr.push(letter)\n end\n #combine the array into a string\n print new_arr.join()\n end\n puts ''\nend", "def solve_cipher(string, n)\n\n#Split each element of the string to get and array and return an array where each element is x (to operate with each element)\n string.split('').map do |x|\n#Create a new variable that will be the new index for each element.\n new_index = x.ord + n\n \n#Define the new index value with if conditional statements.\n\n#The value for whitespace is its value -26 as it is not included in the alphanumerical rules defined above\nif x == ' '\n new_index = ' '.ord - 26\nend\n\n\n#Declare the values of the index where it is above z's\nif new_index > 'z'.ord\n new_index = 'a'.ord + new_index - 'z'.ord - 1\nend\n\n#Declare the values of the index where it is beyond a's\nif new_index < 'a'.ord\n new_index = 'z'.ord - ('a'.ord - new_index) + 1\nend\n \n #Make the function return the list of numbers converted into letters \n new_index.chr\n\nend.join\n\nend", "def vowel_cipher(string)\r\n vowels = 'aeiou'\r\n newString = ''\r\n string.each_char do |char|\r\n if vowels.include?(char)\r\n newString += vowels[(vowels.index(char) + 1) % 5]\r\n else\r\n newString += char\r\n end\r\n end\r\nreturn newString\r\nend", "def caesar_cipher(num)\n alpha = (\"a\"..\"z\").to_a\n\n new_word = \"\"\n self.each_char do |char|\n old_ind = alpha.index(char)\n new_ind = (old_ind + num) % 26\n new_word += alpha[new_ind]\n end\n new_word\n end", "def caesar_cipher(str, num)\n \talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n \tcipher = \"\"\n\n\tstr.each_char do |char|\n \tletterPos = alphabet.index(char)\n \tnewPos = letterPos + num\n \tcipher += alphabet[newPos % 26] # mod so wraps arround\n end\n \n \treturn cipher\nend", "def envigenerate(plain, key)\n boundary = plain == plain.upcase ? \"Z\" : \"z\"\n cipher = plain.ord + (key.ord - 65)\n cipher -= 26 if cipher > boundary.ord\n cipher.chr\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n new_string = \"\"\n\n # string.each_char do |ch|\n # if vowels.include?(ch)\n # old_idx = vowels.index(ch)\n # new_idx = (old_idx + 1) % 5\n # new_vowel = vowels[new_idx]\n # new_string << new_vowel\n # else\n # new_string << ch\n # end\n # end\n\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = old_idx + 1\n vowels[new_idx % vowels.length]\n else\n char\n end\n end\n new_string = new_chars.join(\"\")\n\n return new_string\nend", "def caesar_cipher(str, shift)\n\nend", "def translate_to_cipher(sentence) #def method \n alphabet = ('a'..'z').to_a #create array of alphabet\n cipher = Hash[alphabet.zip(alphabet.rotate(4))]#creates a hash w/4letter rotation\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] # array of potential encoded space chars\n \n original_sentence = sentence.downcase #new var and set to downcase param\n encoded_sentence = [] #new array\n original_sentence.each_char do |element| #iterating through sentence.downcase by char\n if cipher.include?(element) #check to see if the element matches any of the hash keys\n encoded_sentence << cipher[element] # passes new array the hash value by calling the key\n elsif element == ' ' #checks for a space in sentence\n encoded_sentence << spaces.sample #sends in a random char from spaces array\n else\n encoded_sentence << element #if nothing else then just pass the encoded message the char\n end\n end\n \n return encoded_sentence.join #return encoded sentence array as one value\nend", "def caesar_cipher(message,key)\n\n key %= ALPHABET_LENGTH # reduces key if larger than ALPHABET_LENGTH\n\n cipher = message.codepoints.map do|ascii| # change string to ascii array\n if ASCII_UPPER.include?(ascii)\n # loops around ends (A to Z) and (Z to A) of alphabet if needed\n ascii -= ALPHABET_LENGTH if ascii + key > ASCII_UPPER.last \n ascii += ALPHABET_LENGTH if ascii + key < ASCII_UPPER.first\n ascii += key\n elsif ASCII_LOWER.include?(ascii)\n # loops around end (a to z) and (z to a) of alphabet if needed\n ascii -= ALPHABET_LENGTH if ascii + key > ASCII_LOWER.last\n ascii += ALPHABET_LENGTH if ascii + key < ASCII_LOWER.first\n ascii += key \n else\n ascii = ascii\n end\n end\n\n cipher.pack'U*' #converts ascii array to character string\n\nend", "def caesar_cipher(str, shift)\n new_str = []\n str = str.split('')\n str.each do |x| \n new_str << letter_cipher(x, shift) \n end\n new_str = new_str.join\n puts new_str\n return new_str\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n cipher = \"\"\n string.each_char do |char|\n if vowels.include?(char)\n idx = vowels.index(char)\n char = vowels[(idx + 1) % 5]\n end\n cipher += char\n end\n return cipher\nend", "def caesar_cipher(str, num)\r\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n cypher = alphabet.split(\"\").map.with_index do |char, i|\r\n if !(alphabet.split(\"\").index(char) + num >= alphabet.split(\"\").length)\r\n alphabet.split(\"\")[alphabet.split(\"\").index(char) + num]\r\n else\r\n alphabet.split(\"\")[alphabet.split(\"\").index(char) + num - alphabet.split(\"\").length]\r\n end\r\n end\r\n cryptography = ''\r\n str.each_char do |char|\r\n cryptography += cypher[alphabet.index(char)]\r\n end\r\n return cryptography\r\nend", "def caesar_cipher(userWord, userShift)\n userWordArray = userWord.split(\"\") #Makes an array of characters\n shift = userShift%26\n c = []\n userWordArray.each do |letter|\n if letter.ord == 32\n c.push(letter)\n elsif letter.ord < 122\n b = letter.ord + shift\n c.push(b.chr)\n else\n b = letter.ord \n diff= (b-122) + shift\n b = 96+diff\n c.push(b.chr)\n end\n end\n c = c.join\nend", "def vowel_cipher(string)\n\tvowels = \"aeiou\"\n \tstr = \"\"\n \tstring.each_char do |c|\n if vowels.include?(c)\n idx = vowels.index(c)\n idx += 1\n if idx > 4\n idx = (idx % 5)\n end\n str += vowels[idx]\n else\n str += c\n end\n end\n \treturn str\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n new_string = \"\"\n\n string.each_char do |char|\n if char == \"a\" || char == \"e\" || char == \"i\" || char == \"o\" || char == \"u\"\n new_char = vowels.index(char)\n new_string += vowels[(new_char + 1) % 5]\n else\n new_string += char\n end\n end\n\n return new_string\nend", "def caesar_cipher (text, number)\n\tcipher = ''\n\ttext.each_char do |char|\n\t\tif (char>='a' and char<='z') or (char>='A' and char<='Z')\n\t\t\tuplow = char<='Z' ? 'A'.ord : 'a'.ord\n\t\t\tchar = (((char.ord - uplow + number)%26)+uplow).chr\n\t\tend\n\t\tcipher += char\n\tend\n\tcipher\nend", "def caesar_cipher(message,key)\n\n key %= ALPHABET_LENGTH # reduces key if larger than ALPHABET_LENGTH\n\n cipher = message.codepoints.map do|ascii| # change string to ascii array\n if ASCII_UPPER.include?(ascii)\n # loops around ends (A to Z) and (Z to A) of alphabet if needed\n ascii -= ALPHABET_LENGTH if ascii + key > ASCII_UPPER.last \n ascii += ALPHABET_LENGTH if ascii + key < ASCII_UPPER.first\n ascii += key\n elsif ASCII_LOWER.include?(ascii)\n # loops around end (a to z) and (z to a) of alphabet if needed\n ascii -= ALPHABET_LENGTH if ascii + key > ASCII_LOWER.last\n ascii += ALPHABET_LENGTH if ascii + key < ASCII_LOWER.first\n ascii += key \n else\n ascii = ascii\n end\n end\n cipher.pack'U*' #converts ascii array to character string\nend", "def encrypt phrase, key\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\")\n cipherbet = get_cipherbet key\n result = \"\"\n phrase.each_char do |letter|\n encrypted_letter = encrypt_letter alphabet, cipherbet, letter\n result = result + encrypted_letter\n end\n return result\nend", "def caesar_cipher(str, num)\n \tnew_str = \"\"\n\n \tstr.each_char do |c|\n new_letter = c.ord + num\n if new_letter > 122\n shift = ((new_letter - 96) % 26) + 96\n new_str += shift.chr\n else\n new_str += new_letter.chr\n end\n end\n return new_str\nend", "def caesar_cipher(string, shift)\n begin\n shift = shift % 26\n new_string = \"\"\n letters = string.split('')\n letters.each do |i|\n if i >='a' && i <= 'z'\n encrypted = i.ord + shift\n if encrypted > 122 # ASCII for 'z'; wraps around to 'a'\n encrypted = encrypted - 26\n end\n elsif i >='A' && i <= 'Z'\n encrypted = i.ord + shift\n if encrypted > 90 # ASCII for 'Z'; wraps around to 'A'\n encrypted = encrypted - 26\n end\n else\n encrypted = i\n end\n new_string << encrypted.chr\n end\n return new_string\n rescue TypeError\n return \"Invalid shift factor. Please enter a number.\"\n end\nend", "def caesar_cipher(string, shift)\n lower = ('a'..'z')\n caesar_string = ''\n\n string.each_char do |char|\n shift.times { char = char.next } if lower.include?(char.downcase) # identify letters only\n caesar_string << char[-1]\n end\n caesar_string\nend", "def caesar_cipher(string, shift = DateTime.now.day) # I set shift to be the current day if I do not include a parameter for it\n string.tr Alphabet.join, Alphabet.map{ |array| array.rotate shift }.join # This looks at every single character in the string and uses .map to rotate the array to bascially let it shift how ever many times within the array to assign the new character to the string variable\nend", "def caesar_cipher(word, shift) \n\n #Checks if 'word' is a String \n unless word.is_a? String\n return \"Input was not text\"\n end\n\n #Initializes a temp word\n new_word = \"\"\n\n #Creates an array of ascii numbers for each letter in 'word'\n word_array = word.codepoints.to_a\n\n #Loops over each letter in 'word' and manipulates\n for i in 0..word_array.length-1\n\n #Keeps track of the letter casing\n lowercase = false\n if word_array[i] >= 97 && word_array[i] <= 122\n lowercase = true\n else\n lowercase = false\n end\n\n #Adds the shift to the letter (checks if the character is a letter and not a symbol or space)\n if word_array[i] >= 65 && word_array[i] <= 122\n word_array[i] += shift\n end\n\n # Checks character ascii values\n if word_array[i] > 122 && lowercase == true\n word_array[i] -= 26\n elsif word_array[i] > 90 && lowercase == false\n word_array[i] -= 26\n end\n new_word += word_array[i].chr\n end\n return new_word\nend", "def encode_decode_elegant message\n result = \"\"\n a_ascii = 'a'.ord\n message.each_char do |c|\n # formula from wikipedia\n # c.ord - a_ascii converts the chars from ascii to start from 0 instead of 97\n # avoids using index, and notice that we don't use @plain or @cipher at all!\n cipher_char_ascii = -(c.ord - a_ascii + 1) % 26\n cipher_char = (cipher_char_ascii + a_ascii).chr\n result << cipher_char\n end\n result\nend", "def translate_to_cipher(sentence) #Defining the method and the input\n alphabet = ('a'..'z').to_a #creating a variable, alphabet and making it an array\n cipher = Hash[alphabet.zip(alphabet.rotate(4))] # creating variable, cipher. #zip method takes the\n # alphabet variable and generates a sequence of arrays that correspond to the .length of the arguments. \n #The #rotate method will rotate the elements of the array to create a new array. I don't exactly now what \n # they do when put together like this.\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] #creating variable, spaces, that includes an array of symbols.\n \n original_sentence = sentence.downcase #making the input lowercase\n encoded_sentence = [] #creating a new array, encoded_sentence\n original_sentence.each_char do |element| #loops through the original sentence and takes each character and impliments element\n if cipher.include?(element)\n encoded_sentence << cipher[element] # if the cipher includes the element, the loop returns the encoded_sentence including the cipher.\n elsif element == ' '\n encoded_sentence << spaces.sample # if the element is a space, the encoded_sentence includes the space.\n else \n encoded_sentence << element #otherwise the encoded sentence just includes the element.\n end\n end\n \n return encoded_sentence.join\nend", "def caesar_cipher(string, shift_factor)\n output = \"\"\n string.scan (/./) do |i|\n if (\"a\"..\"z\").include? (i.downcase)\n shift_factor.times {i = i.next}\n end\n output << i[-1]\n end\n return output\nend", "def encode(plaintext, key)\n cipher = key.chars.uniq + (('a'..'z').to_a - key.chars)\n ciphertext_chars = plaintext.chars.map do |char|\n (65 + cipher.find_index(char)).chr\n end\n puts ciphertext_chars.join\nend", "def caesar_cipher(str, num)\n new_str = \"\"\n str.each_char { |c| new_str += shift_char(c, num) }\n new_str\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n new_arr = []\n string.each_char do |char|\n if vowels.include?(char)\n old_index = vowels.index(char)\n new_index = (old_index + 1)%5\n new_arr << vowels[new_index]\n else\n new_arr << char\n end\n \n end\n new_arr.join(\"\")\nend", "def caesar_cipher(string, shift_factor)\n alphabet = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\"]\n return string.split(//).map { |el|\n el.gsub(/\\w/, \"#{ind = alphabet.index(el).to_i + shift_factor\n until alphabet.index(el).to_i > 25 && ind < 52 || alphabet.index(el).to_i < 26 && ind < 26\n ind -= 26\n end\n alphabet[ind]}\")\n }.join\nend", "def caesar_cipher(x,y)\n\twords=x.split\n\tnew_words=[]\n\tnew_letters=[]\n\tnew_string=[]\n\twords.each do |word|\n\t\tletters=word.split(//)\n\t\t\n\t\tletters.each do |x|\n\t\t\t\n\t\t\tif x.ord+y<122 && x.ord+y>96\n\t\t\t\tx=x.ord+y\n\t\t\t\tx=x.chr\n\t\t\t\tnew_letters.push(x)\n\t\t\telsif x.ord+y>122\n\t\t\t\tx=x.ord-(26-y)\n\t\t\t\tx=x.chr\n\t\t\t\tnew_letters.push(x)\n\t\t\telsif x.ord+y<90 && x.ord+y>65\n\t\t\t\tx=x.ord+y\n\t\t\t\tx=x.chr\n\t\t\t\tnew_letters.push(x)\n\t\t\telsif x.ord+y>90 && x.ord+y<97\n\t\t\t\tx=x.ord-(26-y)\n\t\t\t\tx=x.chr\n\t\t\t\tnew_letters.push(x)\n\t\t\telse\n\t\t\t\tnew_letters.push(x)\n\t\t\tend\n\t\t\tnew_words=new_letters.join\n\t\t\t\n\t\tend\n\t\tnew_string.push(new_words)\n\t\t\n\t\tnew_letters=[]\n\tend\n\tnew_string.join\n\tp new_string.join(' ')\nend", "def vowel_cipher(string)\n vowels = 'aeiou'\n string.each_char.with_index do |char, i|\n if vowels.include?(char)\n vowel_index = vowels.index(char)\n string[i] = vowels[(vowel_index + 1) % vowels.length]\n end\n end\n string\nend", "def vowel_cipher(string)\n vowels = 'aeiou'\n cipher = ''\n\n string.chars do |char|\n if vowels.include?(char)\n index = vowels.index(char)\n new_vowel = vowels[(index + 1) % 5]\n cipher += new_vowel\n else\n cipher += char\n end\n end\n return cipher\nend", "def cipher(bytes, secret)\n ctext = Array.new(bytes)\n\n secret.each_index do |n|\n bytes.each_index do |i|\n ctext[i] = ctext[i] ^ secret[(n+secret[n]+i) % secret.length]\n end\n end\n\n return ctext\n end" ]
[ "0.79110205", "0.7902209", "0.78207576", "0.78193635", "0.77866805", "0.7767322", "0.7756652", "0.77224773", "0.7721039", "0.7709031", "0.76752245", "0.76732403", "0.7630802", "0.7607273", "0.76066494", "0.7589914", "0.75896025", "0.7548111", "0.7546698", "0.75004023", "0.74885434", "0.7460308", "0.744439", "0.74322844", "0.7406344", "0.7380605", "0.73591906", "0.7355904", "0.7327399", "0.729848", "0.72860694", "0.72547597", "0.7251267", "0.6973141", "0.69538856", "0.6926231", "0.6903251", "0.6856551", "0.685233", "0.68442464", "0.68412864", "0.68384796", "0.68331", "0.67829615", "0.6770051", "0.6756349", "0.6741492", "0.6712917", "0.67088896", "0.67011344", "0.6693676", "0.66573524", "0.6653651", "0.66320604", "0.6630071", "0.66243595", "0.66013896", "0.6590944", "0.6590035", "0.65899605", "0.65847796", "0.6581554", "0.6578901", "0.65640855", "0.6558071", "0.6557441", "0.65568316", "0.6553713", "0.6551227", "0.6535729", "0.65326977", "0.6530796", "0.65237254", "0.65080214", "0.6503501", "0.64989763", "0.6498005", "0.6495498", "0.648926", "0.648773", "0.6477652", "0.6465088", "0.6445895", "0.64378166", "0.6435501", "0.64255357", "0.6407696", "0.6378741", "0.63769644", "0.63664013", "0.6362979", "0.6358095", "0.6357881", "0.63563794", "0.6355653", "0.6354967", "0.6354623", "0.63507485", "0.63506407", "0.6346954", "0.6346442" ]
0.0
-1
If created user is first user, then make it an admin user
def first_user_hook if User.with_role(:admin).count == 0 self.grant :admin else # set editor as default role self.grant :editor if self.roles.empty? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_first_user_admin\n return unless User.count.zero?\n\n self.is_admin = true\n self.approved = true\n end", "def make_admin_if_first_user\n self.make_admin if self.first_user?\n end", "def record_first_admin\n return unless User.count.zero?\n\n self.admin = true\n end", "def upgrade_to_main_user\n self.is_main_user = true \n self.save \n \n admin_role = Role.find_by_name(USER_ROLE[:admin]) \n self.add_role_if_not_exists(admin_role ) \n end", "def make_admin\n @user = User.find(params[:user_id])\n @user.admin = !@user.admin\n @user.save\n redirect_to users_path\n end", "def create_default_admin\n admin_user = User.create!({\n email: 'admin@mindhub.org',\n first_name: 'Admin',\n last_name: 'the Administrator',\n password: 'creativefresno',\n password_confirmation: 'creativefresno',\n remember_me: false\n })\n\n admin_user.update_attribute :admin, true\nend", "def ensure_at_least_one_admin\n if User.count == 1\n u = User.first\n u.add_role :admin\n u.save!\n end\n end", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend", "def set_admin\n if User.count == 1\n self.statut = \"admin\"\n self.save\n end\n end", "def main_admin\n @@_cache_admin ||= (User.where(email: 'yaw@loverealm.org').take || User.create!(first_name: 'Loverealm', last_name: 'Administrator', email: 'yaw@loverealm.org', password: ENV['LR_SUPER_USERS_PASSWORD'], password_confirmation: ENV['LR_SUPER_USERS_PASSWORD'], roles: [:admin]))\n end", "def make_admin\n authorize! @user\n @user.roles = @user.roles + ['admin']\n @user.save\n redirect_to @user, notice: t('user.made_admin', name: @user.username)\n end", "def create_admin_user\n @user ||= FactoryGirl.build(:admin_user).save_without_session_maintenance\n end", "def assume_admin_logged_in(admin = nil)\n admin = admin || create(:user, :admin)\n assume_logged_in(admin)\nend", "def check_admin_user(password=\"spree\", email=\"spree@example.com\")\n admin = User.find_by_login(email) || User.create( :password => password,:password_confirmation => password,\n :email => email, :login => email )\n # create an admin role and and assign the admin user to that role\n admin.roles << Role.find_or_create_by_name(\"admin\")\n admin.save!\n end", "def make_admin\n\t\tself.usertype = \"admin\"\n\t\tself.save\n\tend", "def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end", "def admin_user\n @admin_user ||= User.first\n end", "def create_admin(first_name:, last_name:, email:)\n admin = create_user\n admin.update(\n first_name: first_name,\n last_name: last_name,\n email: email,\n admin: true\n )\nend", "def admin_user\n unless admin_user?\n redirect_to login_url\n end\n end", "def create?\n user.present? && user.admin?\n end", "def create_user\n @user = User.find(session[:user_id])\n redirect_to(root_url) unless current_user?(@user) || current_user.admin?\n end", "def admin_user\n redirect_to(root_path) unless current_user.try(:admin?) || current_user?(@user)\n end", "def new_admin_user\n user = User.take\n\n NotifierMailer.new_admin_user user.organizations.first.id, user.email\n end", "def admin_user\n redirect_to(current_user) unless current_user.admin?\n end", "def admin_user\n \tif current_user.nil?\n \tredirect_to(login_path)\n else\n \tredirect_to(login_path) unless current_user.admin?\n end\n end", "def admin_user\n \tif current_user.nil?\n \tredirect_to(login_path)\n else\n \tredirect_to(login_path) unless current_user.admin?\n end\n end", "def createUser(admin=false) \n usr = User.new \n usr.Admin = admin \n @Users.add usr \n end", "def pre_create(user)\n user.admin = params[:user][:admin]\n user.speaker = params[:user][:speaker]\n user.staff = params[:user][:staff]\n # when creating users, we assign them a temporary password and send it to them\n user.temporary_password = Devise.friendly_token[0,8]\n user.is_admin_created = true\n user\n end", "def create_admin\n unless User.find_by_email('admin@example.com')\n User.create! email: 'admin@example.com', password: 'password'\n end\nend", "def user\n super || create_user\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrator\n end", "def create\n @user = params[:user] ? User.new(params[:user]) : User.new_guest\n if @user.save\n flash[:notice] = \"Your account was created successfully.\"\n current.user.move_to(@user) if current.user && current.user.guest?\n session[:user_id] = @user.id\n redirect_to root_path\n else\n render \"new\"\n flash[:notice] = \"There was a problem creating your account.\"\n end\n after_create :set_admin \n end", "def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\n end", "def set_admin_user\n\t@admin_user = current_admin_user\n\tend", "def authorize_as_admin\n create_admin_user\n login_into_alchemy\n end", "def make_user_admin\n @requested_user = User.find(params[:id])\n if @requested_user.present?\n if @requested_user.is_admin?\n @requested_user.update_columns(:is_admin => false)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully degraded from admin.\"}\n else\n @requested_user.update_columns(:is_admin => true)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully upgraded as admin.\"}\n end\n else\n redirect_to admin_index_path, :flash => {:notice => \"Requested user not found.\"}\n end\n end", "def admin_user\n if (!current_user || current_user.username != 'admin')\n redirect_to(root_url)\n end\n end", "def admin_user\n redirect_to(root_path) unless is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin? || current_user.super_admin?\n end", "def correct_or_admin_user\n @user = User.find(params[:id]) \n unless current_user?(@user) || admin_user?\n redirect_to(login_url)\n end\n end", "def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end", "def setup_admin\n create_admin_user\n create_admin_organization\n update_admin_user_perms\nend", "def create\n if admin_signed_in?\n params[:user] = params[:user]&.merge(type: 'Admin')\n super\n else\n redirect_to root_path\n end\n end", "def user_create(name='admin', is_admin=true)\n key = \"#{name}:#{is_admin}\"\n UserCache.instance[key] ||= User.find_or_create_by_name(name) do |u|\n u.email_address = \"#{u.name}@concord.org\"\n u.password = u.password_confirmation = \"#{u.name}pAsS\"\n u.state = 'active'\n u.administrator = is_admin\n end\nend", "def created_or_admin(obj)\n if session[:person].id.to_i == obj.creator_id.to_i || session[:person].is_admin\n true\n else\n false\n end\n end", "def should_register_first_admin?\n unless User.any?\n redirect_to controller: 'users/registrations', action: 'new_admin'\n end\n end", "def admin_user\n\t redirect_to user_path(current_user) unless current_user.admin?\n\tend", "def create\n @user = User.new(user_params)\n\n if @user.save\n log_in @user\n @user.update_attributes(admin: true) if params[:user][:admin] == '1'\n flash[:success] = \"Sign up success!\"\n redirect_to @user\n else\n render 'new'\n end\n\n end", "def give_admin(admin, user_id)\n return get_db_as_hash().execute(\"UPDATE user SET admin = 1 WHERE user_id = ? \", user_id).first\n end", "def set_as_admin\n self.role = USER_ROLES[:admin]\n end", "def make_admin\n puts \"Creating Admin\"\n user = User.create!(:name => \"Admin\",\n :email => \"admin@home.no\",\n :password => \"adminpw\",\n :password_confirmation => \"adminpw\")\n user.toggle!(:admin)\n user.toggle!(:staff)\nend", "def admin?\n self == User.first\n end", "def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end", "def admin_user\n redirect_to(root_url) unless !current_user?(@user) && current_user.admin?\n end", "def admin_user\n redirect_to(root_path) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_path) unless current_user.admin?\n end", "def admin_user\n\t\tredirect_to(root_path) unless current_user.admin?\n\tend", "def admin_user\n unless current_user && current_user.admin?\n store_location\n flash[:danger] = \"Please log in as admin.\"\n redirect_to users_url\n end\n end", "def admin_user\n redirect_to(root_url) unless current_user && current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin? # se current_user.admin for falso redireciona para pagina principal\n end", "def create?\n !@current_user.admin?\n end", "def set_admin_user\n @admin_user = User.find(params[:id])\n end", "def set_admin_user\n @admin_user = User.find(params[:id])\n end", "def set_admin_user\n @admin_user = User.find(params[:id])\n end", "def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def set_admin_user\n User.current = User.anonymous_api_admin\n end", "def set_admin_user\n @user = User.find(params[:id])\n end", "def set_admin_user\n @user = User.find(params[:id])\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end", "def admin_user\n redirect_to(login_path) unless current_user.is_admin?\n end", "def create_as_admin\n create\n end", "def add_initial_user\n initial_user = Member.where(:email => \"administrator@administrator.com\").first\n \n unless initial_user\n # Create an initial position.\n position = Position.new\n position.name = \"Administrator\"\n position.pos_type = \"Administrator\"\n position.save\n \n # Create an initial division.\n division = Division.new\n division.name = \"Administrator\"\n division.save\n \n # Find initial position and division created.\n # Id´s will be used to crete initial user.\n position = Position.where(:name => \"Administrator\").first\n division = Division.where(:name => \"Administrator\").first\n \n # Create an initial user with position and divison created above.\n member = Member.new\n member.name = \"Administrator\"\n member.email = \"administrator@administrator.com\"\n member.password = \"administrator\"\n member.major = \"NONE\"\n member.grad_year = 9999\n member.member_since = 9999\n member.hometown = \"NONE\"\n member.position_id = position.id\n member.division_id = division.id\n member.save\n end\n end", "def admin_user\n # Redirect the user to their profile page unless the user is an admin\n redirect_to me_path unless current_user.admin?\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def create_admin_user\r\n create_root_user unless root = User.root\r\n admin = Factory(:user, :password => ADMIN_PASSWORD, :password_confirmation => ADMIN_PASSWORD)\r\n admin.grant_admin(root, CRYPTED_ADMIN_PASSWORD)\r\n return admin \r\n end", "def get_fake_user\n dev_user = User.find_by_uid('dev')\n if dev_user == nil\n dev_user = User.create({ name: 'Development User', email: 'dev@localhost', uid: 'dev' })\n end\n admin_role = Role.find_by_name(\"Administrator\")\n if not dev_user.role == admin_role\n dev_user.role = admin_role\n dev_user.save\n end\n return dev_user\n end", "def admin_user\n unless logged_in? && current_user.admin?\n redirect_to root_url\n end\n end", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin?\n\tend", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin?\n\tend", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin?\n\tend", "def create\n @admin = User.new\n if @admin.save\n redirect_to @admin, notice: \"Saved new admin entry\"\n else\n render :new\n end\nend", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end" ]
[ "0.83339506", "0.80765986", "0.78233045", "0.77503175", "0.7548114", "0.75064355", "0.7444957", "0.7295863", "0.7219491", "0.718042", "0.71701646", "0.71561134", "0.7139989", "0.71387243", "0.71384287", "0.7115287", "0.7110341", "0.7086334", "0.708213", "0.7056174", "0.70547235", "0.70240223", "0.6978958", "0.6978133", "0.69633454", "0.69633454", "0.6951046", "0.69489956", "0.69468826", "0.6938113", "0.6936561", "0.6924159", "0.6911576", "0.69078064", "0.6895123", "0.6891217", "0.6886733", "0.6872501", "0.6870367", "0.68626195", "0.6831773", "0.6825497", "0.68146706", "0.6806276", "0.6804207", "0.6799369", "0.6789614", "0.6776684", "0.67730945", "0.67715555", "0.6766799", "0.6764654", "0.67598814", "0.67399234", "0.6725642", "0.6725642", "0.67144436", "0.6712591", "0.6708227", "0.67075056", "0.6706772", "0.6705151", "0.6705151", "0.6705151", "0.6700396", "0.6700396", "0.6693694", "0.6693694", "0.66878504", "0.6676353", "0.6676353", "0.6674982", "0.6674982", "0.6674982", "0.6674982", "0.6672188", "0.66665334", "0.6663957", "0.66631144", "0.6660455", "0.66489786", "0.66489786", "0.66414136", "0.6641325", "0.663788", "0.66347635", "0.66347635", "0.66347635", "0.66326255", "0.6630054", "0.6630054", "0.6630054", "0.6630054", "0.6630054", "0.6630054", "0.6630054", "0.6630054", "0.6630054", "0.6630054", "0.6630054" ]
0.6897297
34
GET /efforts GET /efforts.json
def index @efforts = Effort.all respond_to do |format| format.html # index.html.erb format.json { render json: @efforts } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effort }\n end\n end", "def show\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effort }\n end\n end", "def live_effort_data\n\n # Params should include at least splitId and bibNumber. Params may also include timeIn and timeOut.\n # This endpoint returns as many of the following as it can determine:\n # { effortId (integer), name (string), reportedText (string), dropped (bool), finished (bool),\n # timeFromLastReported (\"hh:mm\"), timeInAid (\"mm minutes\"), timeInExists (bool), timeOutExists (bool),\n # timeInStatus ('good', 'questionable', 'bad'), timeOutStatus ('good', 'questionable', 'bad') }\n\n authorize @event\n if @event.available_live\n @live_data_entry_reporter = LiveDataEntryReporter.new(event: @event, params: params)\n render partial: 'live/events/live_effort_data.json.ruby'\n else\n render partial: 'live/events/live_entry_unavailable.json.ruby'\n end\n end", "def live_effort_data\n\n # Params should include at least splitId and bibNumber. Params may also include timeIn and timeOut.\n # This endpoint returns as many of the following as it can determine:\n # { effortId (integer), name (string), reportedText (string), dropped (bool), finished (bool),\n # timeFromLastReported (\"hh:mm\"), timeInAid (\"mm minutes\"), timeInExists (bool), timeOutExists (bool),\n # timeInStatus ('good', 'questionable', 'bad'), timeOutStatus ('good', 'questionable', 'bad') }\n\n if @event.available_live\n reporter = LiveDataEntryReporter.new(event: @event, params: params)\n render json: reporter.full_report\n else\n render json: live_entry_unavailable(@event), status: :forbidden\n end\n end", "def show\n @task = Task.find(params[:id])\n @task_efforts = Effort.where(:task_id => @task.id)\n @spend_effort_url = new_effort_path(:format => :js, :task_id => @task.id, :user_id => current_user.id)\n show!\n end", "def index\n @effort_ratings = EffortRating.all.page(params[:page]).per(50)\n end", "def new\n @effort = Effort.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @effort }\n end\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def update\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n if @effort.update_attributes(params[:effort])\n format.html { redirect_to @effort, notice: 'Effort was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def overview_json\n safe_params = params.permit(:force_querying_on_demand)\n force_querying_on_demand = safe_params.has_key?(:force_querying_on_demand)\n query = SchoolOverviewQueries.new(force_querying_on_demand: force_querying_on_demand)\n overview_json = query.json_for_overview(current_educator, @school)\n\n render json: overview_json\n end", "def index\n @modifications = Modification.all\n\n render json: @modifications\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def index\n @projects = Project.find(:all, :conditions => \"status = 'Active'\")\n @phases = ProjectPhase.find(:all, :conditions => {:projects => {:status => \"Active\"}}, :joins => [:project])\n @deliverables = Deliverable.find(:all, :conditions => {:project_phases => {:projects => {:status => \"Active\"}}}, :joins => [:project_phase => :project])\n\n if is_developer\n @efforts = Effort.find(:all, :conditions => ['user_id = ?', current_user.id])\n else\n @efforts = Effort.find(:all)\n end\n @efforts.sort! { |a,b| b.effort_date <=> a.effort_date }\n @effort = Effort.new\n\n respond_to do |format|\n format.html\n end\n end", "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "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 index\n @employments = Employment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employments }\n end\n end", "def segment_efforts(id_or_options, options = {}, &block)\n id, options = parse_args(id_or_options, options)\n paginate \"segments/#{id}/all_efforts\", options, Strava::Models::SegmentEffort, &block\n end", "def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end", "def index\n limit, offset = Calculator.limit_and_offset(params)\n @specifications = Specification.all.limit(limit).offset(offset).order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @specifications, each_serializer: Web::V1::SpecificationSerializer\n end", "def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end", "def new\n @effort = Effort.new(user_id: spree_current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @effort }\n end\n end", "def destroy\n @effort = Effort.find(params[:id])\n @effort.destroy\n\n respond_to do |format|\n format.html { redirect_to efforts_url }\n format.json { head :ok }\n end\n end", "def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end", "def index\n @conflict_illnesses = ConflictIllness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conflict_illnesses }\n end\n end", "def index\n @person_equipments = PersonEquipment.all\n respond_to do |format|\n format.html\n format.json { render json: @person_equipments }\n end\n end", "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end", "def destroy\n @effort = Effort.find(params[:id])\n @effort.destroy\n\n respond_to do |format|\n format.html { redirect_to efforts_url }\n format.json { head :no_content }\n end\n end", "def index\n @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\n end\n end", "def create\n @effort = Effort.new(params[:effort])\n\n respond_to do |format|\n if @effort.save\n format.html { redirect_to @effort, notice: 'Effort was successfully created.' }\n format.json { render json: @effort, status: :created, location: @effort }\n else\n format.html { render action: \"new\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def index\n @expertises = Expertise.all\n\n render json: @expertises\n end", "def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end", "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "def show\n @enhancement = Enhancement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enhancement }\n end\n end", "def set_effort_rating\n @effort_rating = EffortRating.find(params[:id])\n end", "def show\n @team = Team.find(params[:team_id])\n @sprint = @team.sprints.find(params[:id])\n @summary_sprint = @sprint\n @first_sprint = @team.sprints.find(:first)\n @last_sprint = @team.sprints.find(:last)\n @linear_regression = get_linear_regression_actual_velocity(@team.sprints, @last_sprint)\n @averages_set = last_n_sprints_inclusive(@team.sprints, @summary_sprint, 6)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprint }\n end\n end", "def index\n @user = User.find(params[:user_id])\n unless can? :index, @user\n authorize! :index, WorkingExperience, :message => 'Not authorized as an administrator.'\n end\n @working_experiences = @user.working_experiences\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @working_experiences }\n end\n end", "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def show\n @editability = Editability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end", "def show\n @team = Team.find(params[:team_id])\n @workout = @team.workouts.find(params[:workout_id])\n @practice = @workout.practices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def show\n @effort_log = EffortLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @effort_log }\n end\n end", "def show\n @effort_log = EffortLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @effort_log }\n end\n end", "def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def show\n @improvement = Improvement.find(params[:id])\n respond_to do |format|\n format.html {@improvement}\n format.json { render json: @improvement, include: [:user,:status,:responsible]}\n end\nend", "def index\n @advances = user_capabilities(Advance).current_advances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advances }\n end\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index_by_project\n @effort_log = EffortLog.new\n @projects = Project.all\n if(params[:id])\n @project = Project.find(params[:id])\n end\n respond_to do |format|\n format.html\n format.xml { render :xml => @project.effort_logs }\n end\n end", "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "def index\n if params[:admin]==\"1\"\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end", "def index\n respond_to do |format|\n format.html do\n @recent_objects = Descriptor.recent_from_project_id(sessions_current_project_id)\n .order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @descriptors = ::Queries::Descriptor::Filter.new(params).all\n .page(params[:page])\n .per(params[:per])\n .order('descriptors.name')\n }\n end\n end", "def index\n @endorsements = Endorsement.all\n\n render json: @endorsements\n end", "def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end", "def get_editions(params = {})\n get_json(get_editions_url(params))\n end", "def index\n proposed_changes = StashEngine::ProposedChange.includes(identifier: :resources)\n .joins(identifier: :resources).where(approved: false, rejected: false)\n params[:sort] = 'score' if params[:sort].blank?\n params[:direction] = 'desc' if params[:direction].blank?\n @proposed_changes = proposed_changes.order(helpers.sortable_table_order).page(@page).per(@page_size)\n return unless @proposed_changes.present?\n\n @resources = StashEngine::Resource.latest_per_dataset.where(identifier_id: @proposed_changes&.map(&:identifier_id))\n end", "def show\n @audit = Audit.find(params[:id])\n respond_with @audit.as_json(:include => [:location, :fine_tunes, :auditors, :auditees, :paragraphs => {only: [:id, :name]}])\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 @designations = Designation.order(\"id desc\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @designations }\n end\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def index\n @empskeds = Empsked.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empskeds }\n end\n end", "def index\n @employes = Employe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employes }\n end\n end", "def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end", "def index\n @effort_categories = EffortCategory.all\n end", "def effort(*effort)\n if effort.empty?\n @effort ||= \"default\"\n else\n raise \"Invalid effort '#{effort.join(', ')}\" unless effort.size == 1\n @effort = effort[0]\n self\n end\n end", "def index\n @responsibilities = Responsibility.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responsibilities }\n end\n end", "def show\n @believer = Believer.find(params[:id])\n @believer = Believer.sorting_table(params, :name).all\n @believers = Believer.sorting_table(params, :name).all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @believer }\n end\n end", "def index\n @approvals = Approval.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @approvals }\n end\n end", "def index\n @education_levels = EducationLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @education_levels }\n end\n end", "def index\n @educations = Education.all\n render json: @educations\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def index\n @test_runs = TestRun.accessible_by(current_ability).order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @test_runs }\n end\n end", "def set_stage_effort \t \n\t\t @race = Race.find(params[:race_id])\n\t\t @stage = @race.stages.find(params[:stage_id]) unless @race.nil?\n\t\t @cyclist = @race.cyclists.find(params[:cyclist_id]) unless @race.nil?\n\t\t\t@cyclists = @race.cyclists\n\t\t\t@cyclists = sort_cyclists_stage(@cyclists, @stage)\n\n\t\t if params[:id].present?\n\t\t \t@stage_effort = @cyclist.stage_efforts.find(params[:id]) unless @cyclist.nil?\n\t\t end\n\t end", "def index\n @hunters_improvements = HuntersImprovement.all\n end", "def index\n @requisitions = Requisition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requisitions }\n end\n end", "def show\n @experience_history = ExperienceHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experience_history }\n end\n end", "def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @modifications }\n end\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 @practices = Practice.order(\"practice_name\").paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @practices }\n end\n end", "def index\n @reward_and_levels = RewardAndLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_and_levels }\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 @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end", "def index\n @announces = Announce.not_finished.order(\"stime DESC\")\n\t\t@pannounces = Announce.finished.last_24_hours.limit(20).order(\"etime DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @announces }\n end\n end", "def index\n @experiences = Experience.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiences }\n end\n end", "def availabilities_booking_for_list\n @expert = Expert.find(params[:id])\n respond_to do |format|\n format.json { render json: @expert.availabilities_booking_for(params[:date]), status: 200 }\n end\n end", "def index\n @asset_info_adjustments = AssetInfoAdjustment.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asset_info_adjustments }\n format.xml { render xml: @asset_info_adjustments }\n end\n end", "def show\n @affectation = Affectation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @affectation }\n end\n end", "def get_higher_level_review_contestable_issues(user:, benefit_type:)\n with_monitoring_and_error_handling do\n path = \"higher_level_reviews/contestable_issues/#{benefit_type}\"\n headers = get_contestable_issues_headers(user)\n response = perform :get, path, nil, headers\n raise_schema_error_unless_200_status response.status\n validate_against_schema(\n json: response.body,\n schema: HLR_GET_CONTESTABLE_ISSUES_RESPONSE_SCHEMA,\n append_to_error_class: ' (HLR)'\n )\n response\n end\n end", "def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end", "def show\r\n @design_dissertation = DesignDissertation.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @design_dissertation }\r\n end\r\n end", "def show\n @imp = ImplementerRequest.where(user_id: @employee.id)\n @lessons = @employee.lessons.order(\"created_at, name DESC\")\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end" ]
[ "0.7128618", "0.7128059", "0.6579969", "0.6416515", "0.6225248", "0.6212075", "0.60979205", "0.59309536", "0.5849424", "0.57973653", "0.57282275", "0.5720143", "0.5697248", "0.5672627", "0.56671894", "0.5658207", "0.56552464", "0.56409734", "0.56394607", "0.5636336", "0.5632357", "0.56038254", "0.5582578", "0.55822414", "0.55817467", "0.5578379", "0.5565939", "0.5565939", "0.55583495", "0.55406487", "0.5539994", "0.55385727", "0.55350745", "0.55350745", "0.55334693", "0.5519167", "0.55071604", "0.55032605", "0.5495982", "0.54914397", "0.5489418", "0.5488516", "0.54879606", "0.5477227", "0.5472355", "0.5472355", "0.5464531", "0.54583406", "0.5445787", "0.5443672", "0.54425144", "0.5438174", "0.5437907", "0.54320335", "0.54320335", "0.5431483", "0.54249424", "0.5424186", "0.54215914", "0.5413246", "0.54026884", "0.53982604", "0.53947103", "0.5390397", "0.5389003", "0.53855455", "0.5380729", "0.536869", "0.53619367", "0.536164", "0.53599536", "0.53580403", "0.53574175", "0.5355742", "0.53520465", "0.53467417", "0.5346424", "0.5336016", "0.5335994", "0.53321046", "0.53253627", "0.5323246", "0.531892", "0.5315407", "0.5315081", "0.53114766", "0.53104484", "0.5308844", "0.53062695", "0.5295854", "0.5294621", "0.529308", "0.52917224", "0.52909714", "0.5289635", "0.52894914", "0.528465", "0.5276145", "0.5276145", "0.5274784" ]
0.7651738
0
GET /efforts/1 GET /efforts/1.json
def show @effort = Effort.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @effort } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effort }\n end\n end", "def index\n @efforts = Effort.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @efforts }\n end\n end", "def new\n @effort = Effort.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @effort }\n end\n end", "def show\n @task = Task.find(params[:id])\n @task_efforts = Effort.where(:task_id => @task.id)\n @spend_effort_url = new_effort_path(:format => :js, :task_id => @task.id, :user_id => current_user.id)\n show!\n end", "def live_effort_data\n\n # Params should include at least splitId and bibNumber. Params may also include timeIn and timeOut.\n # This endpoint returns as many of the following as it can determine:\n # { effortId (integer), name (string), reportedText (string), dropped (bool), finished (bool),\n # timeFromLastReported (\"hh:mm\"), timeInAid (\"mm minutes\"), timeInExists (bool), timeOutExists (bool),\n # timeInStatus ('good', 'questionable', 'bad'), timeOutStatus ('good', 'questionable', 'bad') }\n\n authorize @event\n if @event.available_live\n @live_data_entry_reporter = LiveDataEntryReporter.new(event: @event, params: params)\n render partial: 'live/events/live_effort_data.json.ruby'\n else\n render partial: 'live/events/live_entry_unavailable.json.ruby'\n end\n end", "def update\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n if @effort.update_attributes(params[:effort])\n format.html { redirect_to @effort, notice: 'Effort was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def live_effort_data\n\n # Params should include at least splitId and bibNumber. Params may also include timeIn and timeOut.\n # This endpoint returns as many of the following as it can determine:\n # { effortId (integer), name (string), reportedText (string), dropped (bool), finished (bool),\n # timeFromLastReported (\"hh:mm\"), timeInAid (\"mm minutes\"), timeInExists (bool), timeOutExists (bool),\n # timeInStatus ('good', 'questionable', 'bad'), timeOutStatus ('good', 'questionable', 'bad') }\n\n if @event.available_live\n reporter = LiveDataEntryReporter.new(event: @event, params: params)\n render json: reporter.full_report\n else\n render json: live_entry_unavailable(@event), status: :forbidden\n end\n end", "def destroy\n @effort = Effort.find(params[:id])\n @effort.destroy\n\n respond_to do |format|\n format.html { redirect_to efforts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @effort = Effort.find(params[:id])\n @effort.destroy\n\n respond_to do |format|\n format.html { redirect_to efforts_url }\n format.json { head :no_content }\n end\n end", "def create\n @effort = Effort.new(params[:effort])\n\n respond_to do |format|\n if @effort.save\n format.html { redirect_to @effort, notice: 'Effort was successfully created.' }\n format.json { render json: @effort, status: :created, location: @effort }\n else\n format.html { render action: \"new\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @effort_log = EffortLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @effort_log }\n end\n end", "def show\n @effort_log = EffortLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @effort_log }\n end\n end", "def show\n @enhancement = Enhancement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enhancement }\n end\n end", "def new\n @effort = Effort.new(user_id: spree_current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @effort }\n end\n end", "def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end", "def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end", "def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend", "def show\n @affectation = Affectation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @affectation }\n end\n end", "def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end", "def index_by_project\n @effort_log = EffortLog.new\n @projects = Project.all\n if(params[:id])\n @project = Project.find(params[:id])\n end\n respond_to do |format|\n format.html\n format.xml { render :xml => @project.effort_logs }\n end\n end", "def set_effort_rating\n @effort_rating = EffortRating.find(params[:id])\n end", "def show\n @editability = Editability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end", "def index\n @effort_ratings = EffortRating.all.page(params[:page]).per(50)\n end", "def show\n @experiment_software = ExperimentSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @experiment_software }\n end\n end", "def show\n @improvement = Improvement.find(params[:id])\n respond_to do |format|\n format.html {@improvement}\n format.json { render json: @improvement, include: [:user,:status,:responsible]}\n end\nend", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def effort(*effort)\n if effort.empty?\n @effort ||= \"default\"\n else\n raise \"Invalid effort '#{effort.join(', ')}\" unless effort.size == 1\n @effort = effort[0]\n self\n end\n end", "def index\n @modifications = Modification.all\n\n render json: @modifications\n end", "def show\n @audit = Audit.find(params[:id])\n respond_with @audit.as_json(:include => [:location, :fine_tunes, :auditors, :auditees, :paragraphs => {only: [:id, :name]}])\n end", "def edit\n @effort_log = EffortLog.find(params[:id])\n end", "def show\n @prof_inspection = ProfInspection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prof_inspection }\n end\n end", "def show\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @especy }\n end\n end", "def overview_json\n safe_params = params.permit(:force_querying_on_demand)\n force_querying_on_demand = safe_params.has_key?(:force_querying_on_demand)\n query = SchoolOverviewQueries.new(force_querying_on_demand: force_querying_on_demand)\n overview_json = query.json_for_overview(current_educator, @school)\n\n render json: overview_json\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def show\n @judgement = Judgement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @judgement }\n end\n end", "def show\n @engineering_project = EngineeringProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @engineering_project }\n end\n end", "def show\n @experience_history = ExperienceHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experience_history }\n end\n end", "def show\r\n @design_dissertation = DesignDissertation.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @design_dissertation }\r\n end\r\n end", "def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end", "def show\n @effect_experience_effect = Effect::ExperienceEffect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effect_experience_effect }\n end\n end", "def show\n @excuse = Excuse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @excuse }\n end\n end", "def show\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def show\n render json: @specification, serializer: Web::V1::SpecificationSerializer\n end", "def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end", "def show\n @laboratory = Laboratory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laboratory }\n end\n end", "def show\n @important_issue = ImportantIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @important_issue }\n end\n end", "def show\n @responsibility = Responsibility.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @responsibility }\n end\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def show\n @lab_equipment = LabEquipment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_equipment }\n end\n end", "def index\n @person_equipments = PersonEquipment.all\n respond_to do |format|\n format.html\n format.json { render json: @person_equipments }\n end\n end", "def show\n @team = Team.find(params[:team_id])\n @workout = @team.workouts.find(params[:workout_id])\n @practice = @workout.practices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end", "def getExperimentDetails\n @experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first\n if @experiment\n response = { 'title' => @experiment.title, 'description' => @experiment.text }.to_json\n respond_to do |format|\n format.html { render text: 'Experiment details: <br/>' + response }\n format.json { \n render json: response \n }\n end\n else\n response = nil.to_json\n respond_to do |format|\n format.html { render text: 'Experiment details: <br/>' + response }\n format.json { \n render json: response \n }\n end\n end\n end", "def index\n @projects = Project.find(:all, :conditions => \"status = 'Active'\")\n @phases = ProjectPhase.find(:all, :conditions => {:projects => {:status => \"Active\"}}, :joins => [:project])\n @deliverables = Deliverable.find(:all, :conditions => {:project_phases => {:projects => {:status => \"Active\"}}}, :joins => [:project_phase => :project])\n\n if is_developer\n @efforts = Effort.find(:all, :conditions => ['user_id = ?', current_user.id])\n else\n @efforts = Effort.find(:all)\n end\n @efforts.sort! { |a,b| b.effort_date <=> a.effort_date }\n @effort = Effort.new\n\n respond_to do |format|\n format.html\n end\n end", "def index\n @conflict_illnesses = ConflictIllness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conflict_illnesses }\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 show\n @complexity = Complexity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complexity }\n end\n end", "def show\n @effort_log_line_item = EffortLogLineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @effort_log_line_item }\n end\n end", "def show\n @idea = Idea.find(params[:id])\n respond_with(@idea) do |format|\n format.json { render json: @idea }\n end\n end", "def show\n @tooling_specification = ToolingSpecification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tooling_specification }\n end\n end", "def show\n @specification = Specification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specification }\n end\n end", "def show\n @employment = Employment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employment }\n end\n end", "def show\n @research = Research.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research }\n end\n end", "def show\n @team = Team.find(params[:team_id])\n @sprint = @team.sprints.find(params[:id])\n @summary_sprint = @sprint\n @first_sprint = @team.sprints.find(:first)\n @last_sprint = @team.sprints.find(:last)\n @linear_regression = get_linear_regression_actual_velocity(@team.sprints, @last_sprint)\n @averages_set = last_n_sprints_inclusive(@team.sprints, @summary_sprint, 6)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprint }\n end\n end", "def index\n @employments = Employment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employments }\n end\n end", "def show\n @idea_status = IdeaStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea_status }\n end\n end", "def set_stage_effort \t \n\t\t @race = Race.find(params[:race_id])\n\t\t @stage = @race.stages.find(params[:stage_id]) unless @race.nil?\n\t\t @cyclist = @race.cyclists.find(params[:cyclist_id]) unless @race.nil?\n\t\t\t@cyclists = @race.cyclists\n\t\t\t@cyclists = sort_cyclists_stage(@cyclists, @stage)\n\n\t\t if params[:id].present?\n\t\t \t@stage_effort = @cyclist.stage_efforts.find(params[:id]) unless @cyclist.nil?\n\t\t end\n\t end", "def show\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def show\n @lab = Lab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab }\n end\n end", "def show\n @medium_research_allotment = MediumResearchAllotment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_research_allotment }\n end\n end", "def index\n @expertises = Expertise.all\n\n render json: @expertises\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @experiencedetail = Experiencedetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiencedetail }\n end\n end", "def show\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expenditure }\n end\n end", "def segment_efforts(id_or_options, options = {}, &block)\n id, options = parse_args(id_or_options, options)\n paginate \"segments/#{id}/all_efforts\", options, Strava::Models::SegmentEffort, &block\n end", "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @exercise }\n end\n end", "def show\n @exercise = Exercise.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end", "def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end", "def show\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end", "def show\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exprience }\n end\n end", "def show\n @achievment = Achievment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @achievment }\n end\n end", "def create\n @effort = Effort.new(params[:effort])\n @effort.started_at = Time.now if params[:commit] == \"Iniciar atividade\"\n\n respond_to do |format|\n if @effort.save\n format.html { redirect_to admin_efforts_path, notice: 'Alocação criada com sucesso.' }\n format.json { render json: @effort, status: :created, location: @effort }\n else\n format.html { render action: \"new\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end", "def show\n @estimate = Estimate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estimate }\n end\n end", "def show\n @conflict_illness = ConflictIllness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conflict_illness }\n end\n end", "def index\n limit, offset = Calculator.limit_and_offset(params)\n @specifications = Specification.all.limit(limit).offset(offset).order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @specifications, each_serializer: Web::V1::SpecificationSerializer\n end", "def show\n @exhibition = Exhibition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exhibition }\n end\n end", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end", "def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end", "def index\n @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\n end\n end", "def show\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compromise }\n end\n end", "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end", "def show\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idea }\n end\n end" ]
[ "0.7495704", "0.74258894", "0.6464546", "0.6396182", "0.638218", "0.6340826", "0.62139845", "0.60046506", "0.5952846", "0.59344625", "0.5875357", "0.5875357", "0.58585757", "0.58548373", "0.5851356", "0.5851356", "0.5831068", "0.5828114", "0.5814851", "0.57949436", "0.57860535", "0.5766793", "0.57461476", "0.5739167", "0.57304054", "0.572171", "0.572171", "0.57052267", "0.56628793", "0.56620437", "0.56567967", "0.56342256", "0.5623736", "0.5611652", "0.56013805", "0.56013805", "0.5588073", "0.5583703", "0.5579813", "0.55764794", "0.5559208", "0.5550591", "0.55492115", "0.5542906", "0.55393517", "0.55384016", "0.5538203", "0.5534416", "0.5524427", "0.5523077", "0.5519881", "0.55149084", "0.5514739", "0.55126685", "0.55126685", "0.55087537", "0.55087465", "0.5506434", "0.55017906", "0.54987246", "0.5493587", "0.5490136", "0.54886764", "0.54876727", "0.54868484", "0.5486804", "0.5484802", "0.54827994", "0.5477623", "0.54714984", "0.5465347", "0.54578584", "0.54563373", "0.5454972", "0.5448425", "0.5448425", "0.54462886", "0.5442618", "0.5438547", "0.5437089", "0.5434064", "0.54307204", "0.5430417", "0.5428118", "0.542778", "0.5427336", "0.5426893", "0.5425863", "0.5423578", "0.5413375", "0.5409847", "0.5409555", "0.54088897", "0.54085815", "0.54063356", "0.5403223", "0.53989226", "0.53985935", "0.5395791", "0.5390458" ]
0.75051475
0
GET /efforts/new GET /efforts/new.json
def new @effort = Effort.new respond_to do |format| format.html # new.html.erb format.json { render json: @effort } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @effort = Effort.new(user_id: spree_current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @effort }\n end\n end", "def create\n @effort = Effort.new(params[:effort])\n\n respond_to do |format|\n if @effort.save\n format.html { redirect_to @effort, notice: 'Effort was successfully created.' }\n format.json { render json: @effort, status: :created, location: @effort }\n else\n format.html { render action: \"new\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @enhancement = Enhancement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enhancement }\n end\n end", "def create\n @effort = Effort.new(params[:effort])\n @effort.started_at = Time.now if params[:commit] == \"Iniciar atividade\"\n\n respond_to do |format|\n if @effort.save\n format.html { redirect_to admin_efforts_path, notice: 'Alocação criada com sucesso.' }\n format.json { render json: @effort, status: :created, location: @effort }\n else\n format.html { render action: \"new\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @editability = Editability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @editability }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @affectation = Affectation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @affectation }\n end\n end", "def new\n @idea = Idea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end", "def new\n @idea = Idea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end", "def new\n @idea = Idea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end", "def new\n @idea = Idea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @experiment = Experiment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @prof_inspection = ProfInspection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prof_inspection }\n end\n end", "def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @important_issue = ImportantIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @important_issue }\n end\n end", "def new\n @practice = Practice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @practice }\n end\n end", "def new\n @experience = Experience.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experience }\n end\n end", "def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end", "def new\n @complexity = Complexity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @complexity }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @experiment }\n end\n end", "def new\n @planned_time = PlannedTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planned_time }\n end\n end", "def new\n @absence = Absence.new\n @title = \"New Absence\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @absence }\n end\n end", "def new\n @normal_issue = NormalIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @normal_issue }\n end\n end", "def new\n @assigned = Assigned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assigned }\n end\n end", "def new\n @effort_log = EffortLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @effort_log }\n end\n end", "def new\n @exercise_plan = ExercisePlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def new\n @commitment = Commitment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commitment }\n end\n end", "def new\n @assigned_project = AssignedProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assigned_project }\n end\n end", "def new\n @solution = Solution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @exercice = Exercice.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercice }\n end\n end", "def new\n @objective = Objective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objective }\n end\n end", "def new\n @planned_event = PlannedEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planned_event }\n end\n end", "def new\n @competency = Competency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competency }\n end\n end", "def new\n @especy = Especie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @especy }\n end\n end", "def new\n @experience_history = ExperienceHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experience_history }\n end\n end", "def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contribution }\n end\n end", "def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end", "def new\n @assist = Assist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assist }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @assignment }\n end\n end", "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lease }\n end\n end", "def new\n @assignment = Assignment.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n @fundamentals_history = FundamentalsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamentals_history }\n end\n end", "def new\n @lab_name = LabName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_name }\n end\n end", "def new\n @needed_good = NeededGood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @needed_good }\n end\n end", "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @assignment }\n end\n end", "def new\n @evaluable_competency = EvaluableCompetency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluable_competency }\n end\n end", "def new\n @endurance = Endurance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @endurance }\n end\n end", "def new\n @risk_level = RiskLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @risk_level }\n end\n end", "def new\n @title = \"New Resources Periods\"\n @resource_period = ResourcePeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @resource_period }\n end\n end", "def new\n @lab_equipment = LabEquipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_equipment }\n end\n end", "def new\n @competent = Competent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competent }\n end\n end", "def new\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end", "def new\n @intention = Intention.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intention }\n end\n end", "def new\n @ultimate_team = UltimateTeam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ultimate_team }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @exp = Exp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exp }\n end\n end", "def new\n @desc = Desc.new\n @phase_collection = Desc.phase_hashes\n @star_collection = Desc.star_hashes\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @desc }\n end\n end", "def new\n @specie = Specie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @specie }\n end\n end", "def new\n if params[:last]\n @material_transfer_issue = MaterialTransferIssue.all.last.dup\n else\n @material_transfer_issue = MaterialTransferIssue.new\n end\n # after_controller_new\n respond_to do |format|\n format.html\n # new.html.erb\n format.json do\n render(json: @material_transfer_issue)\n end\n end\n end", "def new\n @persons_release = PersonsRelease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persons_release }\n end\n end", "def new\n @responsibility = Responsibility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @responsibility }\n end\n end", "def new\n @approval = Approval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @approval }\n end\n end", "def new\n @judgement = Judgement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @judgement }\n end\n end", "def new\n \n @timesheet = Timesheet.new\n \n 1.times do\n project_effort = @timesheet.project_efforts.build\n 1.times { project_effort.tasks.build }\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timesheet }\n end\n end", "def new\n @ranking = Ranking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ranking }\n end\n end", "def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end", "def new\n @lab_teach_resource = LabTeachResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end", "def new\n authorize! :new, WorkingExperience, :message => 'Not authorized as an administrator.'\n @user = User.find(params[:user_id])\n @working_experience = @user.working_experiences.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @working_experience }\n format.js\n end\n end", "def new\n @prototype = Prototype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prototype }\n end\n end", "def new\n @researcher = Researcher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @researcher }\n end\n end", "def new\n @assignment_standard_assignment = Assignment::StandardAssignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment_standard_assignment }\n end\n end", "def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @major }\n end\n end", "def new\n @decision = Decision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @decision }\n end\n end", "def show\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effort }\n end\n end", "def new\n @petition = Petition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @petition }\n end\n end", "def new\n @experiment_software = ExperimentSoftware.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @experiment_software }\n end\n end", "def new\n @dept = Dept.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @dept }\n end\n end", "def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end", "def new\n @explaination = Explaination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @explaination }\n end\n end", "def new\n @assignment_special_assignment = Assignment::SpecialAssignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment_special_assignment }\n end\n end", "def new\r\n @design_dissertation = DesignDissertation.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @design_dissertation }\r\n end\r\n end", "def new\n @excuse = Excuse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @excuse }\n end\n end", "def new\n @planets_exoplanet = Planets::Exoplanet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @planets_exoplanet }\n end\n end", "def new\n @tooling_specification = ToolingSpecification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tooling_specification }\n end\n end", "def new\n @situation = Situation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @situation }\n end\n end", "def new\n @judgement = Judgement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @judgement }\n end\n end", "def new\n @situation = Situation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @situation }\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @stable = Stable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stable }\n end\n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @engineering_project = EngineeringProject.new\n @engineering_project = @engineering_project.incrament(@engineering_project)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @engineering_project }\n end\n end" ]
[ "0.730456", "0.70629305", "0.69774073", "0.68256575", "0.6792218", "0.6576796", "0.6576796", "0.65649194", "0.65649194", "0.65513456", "0.6547807", "0.6547807", "0.6547807", "0.6547807", "0.65412456", "0.6538537", "0.65374184", "0.6531159", "0.6520965", "0.6515067", "0.6511472", "0.65017605", "0.6500495", "0.6499754", "0.6491049", "0.6474981", "0.6469527", "0.6455554", "0.64534885", "0.6444784", "0.6434932", "0.64345104", "0.6418389", "0.6417113", "0.64163893", "0.6414109", "0.6412847", "0.64079875", "0.64017713", "0.6399581", "0.6396853", "0.6390033", "0.638655", "0.63841116", "0.63830996", "0.6378675", "0.6377696", "0.63769287", "0.63714826", "0.63714826", "0.63651574", "0.63642985", "0.636173", "0.6358547", "0.6354609", "0.63545084", "0.6350911", "0.63508", "0.6348736", "0.63455266", "0.6342265", "0.6342265", "0.6342265", "0.63405615", "0.63390183", "0.6337347", "0.6337328", "0.63368046", "0.63342047", "0.6327163", "0.63254696", "0.6325412", "0.6323313", "0.6323123", "0.63140744", "0.63128275", "0.6304187", "0.63008946", "0.62995356", "0.6299205", "0.6297684", "0.62921846", "0.6282896", "0.62828237", "0.6281493", "0.6279341", "0.6279107", "0.62789226", "0.62741464", "0.6272046", "0.62697566", "0.62680197", "0.62640387", "0.6262213", "0.6261518", "0.6258563", "0.6256677", "0.6255489", "0.62532187", "0.6252369" ]
0.80478424
0
POST /efforts POST /efforts.json
def create @effort = Effort.new(params[:effort]) respond_to do |format| if @effort.save format.html { redirect_to @effort, notice: 'Effort was successfully created.' } format.json { render json: @effort, status: :created, location: @effort } else format.html { render action: "new" } format.json { render json: @effort.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @efforts = Effort.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @efforts }\n end\n end", "def create\n @effort = Effort.new(params[:effort])\n @effort.started_at = Time.now if params[:commit] == \"Iniciar atividade\"\n\n respond_to do |format|\n if @effort.save\n format.html { redirect_to admin_efforts_path, notice: 'Alocação criada com sucesso.' }\n format.json { render json: @effort, status: :created, location: @effort }\n else\n format.html { render action: \"new\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @effort = Effort.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @effort }\n end\n end", "def create\n Effort.create(\"value\" => params[\"value\"],\n \"date\" => params[\"date\"],\n \"goal_id\" => params[\"goal_id\"],\n \"strategy_id\" => params[\"strategy_id\"])\n redirect_to \"/efforts\"\n end", "def create\n @effort_rating = @opportunity.effort_ratings.new(effort_rating_params)\n\n respond_to do |format|\n if @effort_rating.save\n @opportunity.effort_rating = @opportunity.effort_ratings.average(:rating)\n @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Effort rating was successfully created.' }\n format.json { render :show, status: :created, location: @effort_rating }\n else\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n if @effort.update_attributes(params[:effort])\n format.html { redirect_to @effort, notice: 'Effort was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def live_effort_data\n\n # Params should include at least splitId and bibNumber. Params may also include timeIn and timeOut.\n # This endpoint returns as many of the following as it can determine:\n # { effortId (integer), name (string), reportedText (string), dropped (bool), finished (bool),\n # timeFromLastReported (\"hh:mm\"), timeInAid (\"mm minutes\"), timeInExists (bool), timeOutExists (bool),\n # timeInStatus ('good', 'questionable', 'bad'), timeOutStatus ('good', 'questionable', 'bad') }\n\n authorize @event\n if @event.available_live\n @live_data_entry_reporter = LiveDataEntryReporter.new(event: @event, params: params)\n render partial: 'live/events/live_effort_data.json.ruby'\n else\n render partial: 'live/events/live_entry_unavailable.json.ruby'\n end\n end", "def live_effort_data\n\n # Params should include at least splitId and bibNumber. Params may also include timeIn and timeOut.\n # This endpoint returns as many of the following as it can determine:\n # { effortId (integer), name (string), reportedText (string), dropped (bool), finished (bool),\n # timeFromLastReported (\"hh:mm\"), timeInAid (\"mm minutes\"), timeInExists (bool), timeOutExists (bool),\n # timeInStatus ('good', 'questionable', 'bad'), timeOutStatus ('good', 'questionable', 'bad') }\n\n if @event.available_live\n reporter = LiveDataEntryReporter.new(event: @event, params: params)\n render json: reporter.full_report\n else\n render json: live_entry_unavailable(@event), status: :forbidden\n end\n end", "def effort_rating_params\n params.require(:effort_rating).permit(:rating, :opportunity_id)\n end", "def create_assignment(name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @payload={'assignment': { \n 'name': name,\n 'points_possible': '0',\n 'grading_type': 'pass_fail',\n 'published': 'true',\n 'submission_types': [ \"none\" ]\n }\n }\n\n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to create assignment has Response.code #{@postResponse.code} and postResponse is #{@postRepsone}\")\nend", "def create\n @effort_category = EffortCategory.new(effort_category_params)\n\n respond_to do |format|\n if @effort_category.save\n format.html { redirect_to @effort_category, notice: 'Effort category was successfully created.' }\n format.json { render :show, status: :created, location: @effort_category }\n else\n format.html { render :new }\n format.json { render json: @effort_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @editability = Editability.new(params[:test])\n\n respond_to do |format|\n if @editability.save\n format.html { redirect_to @editability, notice: 'Test was successfully created.' }\n format.json { render json: @editability, status: :created, location: @test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @editability.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n effort = Effort.find_by(\"id\" => params[\"id\"])\n effort.update(\"value\" => params[\"value\"],\n \"date\" => params[\"date\"],\n \"goal_id\" => params[\"goal_id\"],\n \"strategy_id\" => params[\"strategy_id\"])\n redirect_to \"/efforts\"\n end", "def show\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effort }\n end\n end", "def create\n @experience = Experience.new(experience_params)\n byebug\n respond_to do |format|\n if @experience.save\n create_occurences\n format.html { redirect_to @experience, notice: 'Experience was successfully created.' }\n format.json { render :show, status: :created, location: @experience }\n else\n format.html { render :new }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enhancement = Enhancement.new(params[:enhancement])\n\n respond_to do |format|\n if @enhancement.save\n format.html { redirect_to @enhancement, notice: 'Enhancement was successfully created.' }\n format.json { render json: @enhancement, status: :created, location: @enhancement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enhancement.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @effort = Effort.find(params[:id])\n @effort.destroy\n\n respond_to do |format|\n format.html { redirect_to efforts_url }\n format.json { head :ok }\n end\n end", "def eligibility(params = {})\n scope 'default'\n post('eligibility/', params)\n end", "def show\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effort }\n end\n end", "def new\n @effort = Effort.new(user_id: spree_current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @effort }\n end\n end", "def set_stage_effort \t \n\t\t @race = Race.find(params[:race_id])\n\t\t @stage = @race.stages.find(params[:stage_id]) unless @race.nil?\n\t\t @cyclist = @race.cyclists.find(params[:cyclist_id]) unless @race.nil?\n\t\t\t@cyclists = @race.cyclists\n\t\t\t@cyclists = sort_cyclists_stage(@cyclists, @stage)\n\n\t\t if params[:id].present?\n\t\t \t@stage_effort = @cyclist.stage_efforts.find(params[:id]) unless @cyclist.nil?\n\t\t end\n\t end", "def new\n \n @timesheet = Timesheet.new\n \n 1.times do\n project_effort = @timesheet.project_efforts.build\n 1.times { project_effort.tasks.build }\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timesheet }\n end\n end", "def set_effort_rating\n @effort_rating = EffortRating.find(params[:id])\n end", "def create\n @specification = Specification.new(specification_params)\n\n if @specification.save\n audit(@specification, current_user)\n render json: @specification, status: :created, serializer: Web::V1::SpecificationSerializer\n else\n render json: @specification.errors, status: :unprocessable_entity\n end\n end", "def post(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def update\n respond_to do |format|\n if @effort_rating.update(effort_rating_params)\n format.html { redirect_to @effort_rating, notice: 'Effort rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_rating }\n else\n format.html { render :edit }\n format.json { render json: @effort_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @effort = Effort.find(params[:id])\n @effort.destroy\n\n respond_to do |format|\n format.html { redirect_to efforts_url }\n format.json { head :no_content }\n end\n end", "def stage_effort_params\n\t \tparams.require(:stage_effort).permit(:strava_activity_url)\n\t 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 effort_category_params\n params.require(:effort_category).permit(:value, :description)\n end", "def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend", "def create\n @expertise = Expertise.new(expertise_params)\n\n if @expertise.save\n render json: @expertise, status: :created, location: @expertise\n else\n render json: @expertise.errors, status: :unprocessable_entity\n end\n end", "def improvement_params\n params.require(:improvement).permit(:title, :category, :content, :user_id, :status_id, :responsible_id)\n end", "def create\n @improvement = Improvement.new (improvement_params)\n @improvement.user_id = current_user.id\n @status = Status.all\n @responsible = User.all\n\n respond_to do |format|\n if @improvement.save\n format.html { redirect_to @improvement, notice: 'Tarefa foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @improvement }\n else\n format.html { render :new }\n format.json { render json: @improvement.errors, status: :unprocessable_entity }\n end\n end\n end", "def grade!\n uri = URI.parse problem.endpoint.url\n response = Net::HTTP.post_form uri, task: problem.task_name, code: code\n verdict = Verdict.from_endpoint_response response, self\n verdict.save!\n end", "def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end", "def create\n resort = Resort.new(resort_params)\n\n if resort.save\n render json: ResortSerializer.new(resort).serialized_json\n else \n render json: { error: resort.errors.messages }, status: 422\n end\n end", "def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end", "def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def create\n @performance_test = PerformanceTest.new(params[:performance_test])\n\n respond_to do |format|\n if @performance_test.save\n format.html { redirect_to @performance_test, :notice => 'Performance test was successfully created.' }\n format.json { render :json => @performance_test, :status => :created, :location => @performance_test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @performance_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @chef_id = Profile.find_by(name: experience_params[:chef], user_type: \"Chef\").user.id\n @recipe_id = Recipe.find_by(name: experience_params[:recipe]).id\n @experience = Experience.new(chef_id: @chef_id, recipe_id: @recipe_id, foody_id: current_foody.id, cost: Pricing.calculate(@recipe_id, @chef_id), status: \"upcoming\", starts_at: experience_params[:starts_at] )\n\n\n respond_to do |format|\n if @experience.save\n format.html { redirect_to @experience, notice: 'Experience was successfully created.' }\n format.json { render :show, status: :created, location: @experience }\n else\n format.html { render :new }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @task = Task.find(params[:id])\n @task_efforts = Effort.where(:task_id => @task.id)\n @spend_effort_url = new_effort_path(:format => :js, :task_id => @task.id, :user_id => current_user.id)\n show!\n end", "def create\n count = person_equipment_params[:count].to_i\n params = person_equipment_params.merge(count: 1)\n @person_equipments = []\n count.times do |i|\n @person_equipments << PersonEquipment.new(params)\n end\n @person_equipments.each(&:save)\n respond_to do |format|\n if @person_equipments.last.save\n format.html { redirect_to @person_equipments.last, status: 303 }\n format.json { redirect_to @person_equipments.last, status: 303 }\n else\n format.html { render :new }\n format.json { render json: @person_equipments.last.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @escort = Escort.new(escort_params)\n\n respond_to do |format|\n if @escort.save\n format.html { redirect_to @escort, notice: 'Escort was successfully created.' }\n format.json { render :show, status: :created, location: @escort }\n else\n format.html { render :new }\n format.json { render json: @escort.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def escort_params\n params.require(:escort).permit(:name, :age, :description, :rate_per_hour_in_cents)\n end", "def demographics\n @t = Task.find(params[:id])\n #need to make sure to indicate a certain worker has seen the experiment before\n if SawExperiment.find_by_task_id_and_mturk_worker_id(@t.id, params[:workerId]).nil?\n SawExperiment.create(:task_id => @t.id, :mturk_worker_id => params[:workerId])\n end\n if request.post? \n Demographic.create(params[:demographic].merge(:mturk_worker_id => params[:workerId]))\n redirect_to :action => :index, :id => @t.id, :assignmentId => params[:assignmentId], :workerId => params[:workerId]\n end\n end", "def test_create_and_show\r\n assert_difference \"Helpful.count\" do\r\n post :create, :helpful_type => \"reviews\", :helpful_id => @review.to_param, :helpful => \"1\"\r\n assert_response :success\r\n end\r\n end", "def create\n if current_user.is_not_staff?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @safety_inspection = SafetyInspection.new(params[:safety_inspection])\n @safety_inspection.bike = Bike.find(params[:safety_inspection][:bike_id])\n @safety_inspection.inspector = current_user\n\n respond_to do |format|\n if @safety_inspection.save\n\t\t\n\t\t#Update EAB status\n\t\teabproj = @safety_inspection.bike.eab_project\n\t\tif !eabproj.nil?\n\t\t\tif @safety_inspection.passed?\n\t\t\t\teabproj.status = 300\n\t\t\telse\n\t\t\t\teabproj.status = 325\n\t\t\tend\n\t\t\teabproj.save\n\t\tend\n\t\t\n format.html { redirect_to @safety_inspection, notice: 'Safety inspection was successfully created.' }\n format.json { render json: @safety_inspection, status: :created, location: @safety_inspection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safety_inspection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inspection = Inspection.new(params[:inspection])\n\n respond_to do |format|\n if @inspection.save\n format.html { redirect_to inspections_path, notice: t(\"activerecord.models.inspection\") + t(\"message.created\") }\n format.json { render json: @inspection, status: :created, location: @inspection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inspection.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 post_request(url_params, data_params)\n # URL to POST to\n url = format_url(url_params)\n \n # Data to include\n data = format_arguments(data_params)\n \n response = self.class.post(url, :body => data)\n if response.code != 200\n raise AssignmentManager::ResponseError, \"Post request was met with error #{response.code}\"\n end\n return response\n end", "def POST; end", "def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense, status: :created, location: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def create\n @hunters_improvement = HuntersImprovement.new(hunters_improvement_params)\n @hunters_improvement.hunter = @hunter\n update_improvable_option\n authorize @hunters_improvement\n\n respond_to do |format|\n if @hunters_improvement.save\n format.html do\n redirect_to hunter_hunters_improvement_url(hunter_id: @hunter.id, id: @hunters_improvement.id),\n notice: 'Hunters improvement was successfully created.'\n end\n format.json do\n render :show,\n status: :created,\n location: hunter_hunters_improvement_url(hunter_id: @hunter.id, id: @hunters_improvement.id)\n end\n else\n format.html { render :new }\n format.json { render json: @hunters_improvement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @despatch = Despatch.new(despatch_params)\n\n respond_to do |format|\n if @despatch.save\n format.html { redirect_to @despatch, notice: 'Despatch was successfully created.' }\n format.json { render :show, status: :created, location: @despatch }\n else\n format.html { render :new }\n format.json { render json: @despatch.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @adopter = Adopter.new(adopter_params)\n\n if @adopter.save\n render json: @adopter, status: :created, location: @adopter\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end", "def post; end", "def create\n @exerciseoverview = Exerciseoverview.new(exerciseoverview_params)\n\n respond_to do |format|\n if @exerciseoverview.save\n format.html { redirect_to @exerciseoverview, notice: 'Exerciseoverview was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exerciseoverview }\n else\n format.html { render action: 'new' }\n format.json { render json: @exerciseoverview.errors, status: :unprocessable_entity }\n end\n end\n end", "def inspection_params\n params.require(:inspection).permit(:code, :houhou, :houhou_eng, :basho, :basho_eng, :cost)\n end", "def index\n @dept_name = params[:dept_name]\n @dept = params[:dept]\n @degrees = Degree.all\n #response = RestClient.get 'http://jsonplaceholder.typicode.com/posts'\n #response = RestClient.get 'https://api.myjson.com/bins/1rlz1'\n #response = RestClient.get 'https://api.myjson.com/bins/3l4rz'\n response = RestClient.get @dept_name\n @parsed = JSON.parse(response)\n a=Array.new\n post=Array.new\n url=Array.new\n @b=Array.new\n count=0\n max_requirements=0\n no_of_terms=@parsed['terms'].size\n for k in 0..no_of_terms-1\n \tcount =@parsed['terms'][k]['requirements'].size \n \tif max_requirements < count\n \tmax_requirements= count\n \tend\n end \n\n for i in 0..no_of_terms-1\n for j in 0..@parsed['terms'][i]['requirements'].size-1\n\t\t if @parsed['terms'][i]['requirements'][j]['courses'].size >=1 \n\t\t\tfor k in 0..@parsed['terms'][i]['requirements'][j]['courses'].size-1\n\t a<< [@parsed['terms'][i]['requirements'][j]['courses'][k]['number'],@parsed['terms'][i]['requirements'][j]['courses'][k]['title'],@parsed['terms'][i]['requirements'][j]['courses'][k]['prerequisites'],@parsed['terms'][i]['requirements'][j]['courses'][k]['postrequisites'],@parsed['terms'][i]['requirements'][j]['courses'][k]['url']]\n\t\t\t \n end\n\t\t else\n\t a<< [['Req'],@parsed['terms'][i]['requirements'][j]['name'],['']]\n\t\t end\n \t \n\tend\t\n \t@b.insert(i,a)\n a=Array.new\n\n end\n end", "def create\n idea_hash = params[:idea]\n idea_hash[:idea_actions] = idea_hash[:idea_actions].blank? ? [] : idea_hash[:idea_actions].map { | action_attrs | IdeaAction.new(action_attrs.merge(member: current_member)) }\n idea_hash[:talks] = idea_hash[:talks].blank? ? [] : idea_hash[:talks].map { | talk_attrs | Talk.find(talk_attrs[:id]) }\n\n @idea = Idea.new(idea_hash)\n @idea.member = member\n\n respond_to do |format|\n if @idea.save\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def effort(*effort)\n if effort.empty?\n @effort ||= \"default\"\n else\n raise \"Invalid effort '#{effort.join(', ')}\" unless effort.size == 1\n @effort = effort[0]\n self\n end\n end", "def api_v1_exercise_params\n params.require(:api_v1_exercise).permit(:title, :description, :deadline, :visible_date, :do_plagiarism_check, :exercise_test, :exercise_hidden_test, :exercise_stub)\n end", "def update\n @effort = Effort.find(params[:id])\n @effort.completed_at = Time.now if params[:commit] == \"Concluir atividade\"\n\n respond_to do |format|\n if @effort.update_attributes(params[:effort])\n format.html { redirect_to admin_efforts_path, notice: 'Alocação atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @performed_exercise = PerformedExercise.new(performed_exercise_params)\n\n respond_to do |format|\n if @performed_exercise.save\n format.html { redirect_to @performed_exercise, notice: 'Performed exercise was successfully created.' }\n format.json { render :show, status: :created, location: @performed_exercise }\n else\n format.html { render :new }\n format.json { render json: @performed_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @exam.update(exam_params)\n render json: @exam, include: [:point_po, :point_or, :point_n, :point_a], methods: :maxillary_depth_angle\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end", "def create\n @expert = Expert.new(expert_params)\n\n respond_to do |format|\n if @expert.save\n format.html { redirect_to @expert, notice: 'Expert was successfully created.' }\n format.json { render :show, status: :created, location: @expert }\n else\n format.html { render :new }\n format.json { render json: @expert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def create\n @standort = Standort.new(standort_params)\n\n respond_to do |format|\n if @standort.save\n format.html { redirect_to @standort, notice: 'Standort was successfully created.' }\n format.json { render :show, status: :created, location: @standort }\n else\n format.html { render :new }\n format.json { render json: @standort.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "def create\n if :opr == 'edit'\n update\n else\n @employee = Employee.create({:name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end\n\n\n end", "def create\n @investment = Investment.new(investment_params)\n\n if @investment.save\n render json: @investment, status: :created\n else\n render json: @investment.errors, status: :unprocessable_entity\n end\n end", "def submit_designs\n @pathway = @project.ae_team_pathways.find_by(id: params[:pathway_id])\n @project.update_designments(@pathway, params[:role], params[:design_ids])\n @designments = @project.ae_designments.where(ae_team_pathway: @pathway, role: params[:role])\n render :designments\n end", "def rate_post(rating)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.put(rate_post_endpoint, { 'router.params' => { rating: rating }, format: :json })\n end", "def create\n @judgement = Judgement.new(params[:judgement])\n\n respond_to do |format|\n if @judgement.save\n format.html { redirect_to @judgement, notice: 'Judgement was successfully created.' }\n format.json { render json: @judgement, status: :created, location: @judgement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @judgement = Judgement.new(params[:judgement])\n\n respond_to do |format|\n if @judgement.save\n format.html { redirect_to @judgement, notice: 'Judgement was successfully created.' }\n format.json { render json: @judgement, status: :created, location: @judgement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @judgement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @expense_report\n\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.update(expense_report_params)\n format.html { redirect_to @expense_report, notice: 'Expense report was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_report }\n else\n format.html { render :edit }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resource = Estimate.new(params[:estimate])\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to estimates_url, notice: 'estimate was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :name => name,\n :description => description,\n :organization => organization,\n :variables => variables\n })\n dprint resp\n\n #[XXX] Theoretical what this is at this point - need to see \n # actual response\n JSON.parse(resp)[\"results\"]\n end", "def create\n @defense = Defense.new(defense_params)\n\n respond_to do |format|\n if @defense.save\n format.html { redirect_to @defense, notice: 'Defense was successfully created.' }\n format.json { render :show, status: :created, location: @defense }\n else\n format.html { render :new }\n format.json { render json: @defense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @effort = @question.efforts.new(effort_params)\n @effort.question = @question\n @effort.quest = @quest\n\n # if @question.answer.content.downcase == @effort.content.downcase --> Doesn't work !!!\n # @effort.status = \"correct\"\n # else\n # @effort.status = \"wrong\"\n # end\n if @effort.save!\n\n @all_questions = @quest.challenge.questions.to_a\n @answered_questions = @quest.efforts.map(&:question)\n @remaining_questions = @all_questions - @answered_questions\n\n unless @remaining_questions.empty?\n next_question_id = @remaining_questions.first.id\n puts @question.id\n @question = Question.find(next_question_id)\n puts @question.id\n redirect_to student_quest_question_path(@quest, @question)\n else\n # Takes them back to profile if finished\n # TODO - change this to results page or flash message?\n redirect_to student_profile_path\n end\n else\n session[:return_to] ||= request.referer\n end\n end", "def create\n @person_expense_record = PersonExpenseRecord.new(person_expense_record_params)\n\n if @person_expense_record.save\n render json: @person_expense_record, status: :created, location: @person_expense_record\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\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 create\n points = params[:solution][:points_earned]\n unless current_user.posse.current_solution?\n solution = current_user.posse.solutions.create(solution_params)\n current_user.posse.add_points(points.to_i)\n end\n render json: solution\n end", "def post_params\n params.require(:post).permit(:section1, :section2, :section3, :goal, :learning, :positive1, :positive2, :improvement1, :improvement2)\n end", "def create\n @especy = Especie.new(params[:especy])\n\n respond_to do |format|\n if @especy.save\n format.html { redirect_to @especy, notice: 'Especie was successfully created.' }\n format.json { render json: @especy, status: :created, location: @especy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @enhancement = Enhancement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enhancement }\n end\n end", "def edit_rates\n return unless has_permission :can_do_billing\n @page_title = 'Edit Aircraft and Instructor Hourly Rates'\n @instructors = Group.users_in_group('instructor')\n @aircrafts = Aircraft.find(:all,:conditions=>['deleted = false'],:order=>\"identifier\")\n @offices = Office.find :all\n @instructors.sort!{|a,b| a.first_names<=>b.first_names}\n @aircrafts.sort!{|a,b| a.type.type_name<=>b.type.type_name}\n case request.method\n when :post\n @error_saving = false\n params[:aircraft].each{|k,v|\n begin\n aircraft = Aircraft.find(k)\n aircraft.hourly_rate = v\n aircraft.save\n rescue\n @error_saving = true \n end\n }\n params[:instructors].each{|k,v|\n begin\n instructor = User.find(k)\n instructor.hourly_rate = v\n instructor.save\n rescue \n @error_saving = true \n end\n }\n if @error_saving\n flash[:warning] = 'Error saving some of the values'\n else\n flash[:notice] = 'Updated'\n end \n redirect_to :back\n end\nend", "def create\n\n \t\t\t@penalty = Penalty.new penalty_params\n\n \t\t\tif @penalty.save\n\n \t\t\t\trender json: @penalty,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @penalty.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend", "def experience_params\n params.require(:experience).permit(:chef, :recipe, :starts_at)\n end", "def create\n @objective = @goal.objectives.create(objective_params)\n render json: @objective\n end", "def create\n @employee = Employee.find(1)\n @performance_evaluation = @employee.performance_evaluations.build(performance_evaluation_params)\n #@performance_evaluation = PerformanceEvaluation.new(performance_evaluation_params)\n\n respond_to do |format|\n if @performance_evaluation.save\n format.html { redirect_to @performance_evaluation, notice: 'Performance evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @performance_evaluation }\n else\n format.html { render :new }\n format.json { render json: @performance_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @effort_category.update(effort_category_params)\n format.html { redirect_to @effort_category, notice: 'Effort category was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_category }\n else\n format.html { render :edit }\n format.json { render json: @effort_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(summary, description, assignee, product=\"TestProduct\", component=\"\")\n @log.debug \"Attempting to file a new bug\"\n url = \"#{@url}/enter_bug.cgi?product=#{product}&assigned_to=#{assignee}&component=#{component}\"\n @log.debug url\n page = @agent.get(url)\n form_name = 'Create'\n form = page.form_with(:name => form_name)\n if form\n form['short_desc']=summary\n form['comment']=description\n form['assignee']=assignee\n form['component']=component if not component.empty?\n page = @agent.submit form if not @dummy\n @log.info page.search(\".//td[@id='title']\")[0].content.strip\n # Read the bug number from the page\n return page.search(\".//a[@title='NEW - #{summary}']\")[0].content.match(/Bug ([0-9]+)/)[1] \n else\n @log.error \"Unable to find form with name #{form_name}\"\n end\n end", "def create\n @petty_cash_expense = PettyCashExpense.new(petty_cash_expense_params)\n\n respond_to do |format|\n if @petty_cash_expense.save\n format.json { render :show, status: :created, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def idea_params\n params.require(:idea).permit(:category_id, :hacker_id, :status, :progress, :title, :description, :specialties)\n end", "def assigment\n @assignment = Assignment.new(params[:assignment])\n @asset = Asset.new(params[:asset])\n\n if @assignment.save\n\n @delivery_from_assignment = Delivery.find(@assignment.delivery)\n\n @delivery_from_assignment.evaluation_criteria.each do |generate_rubres|\n @response_to_the_evaluation = ResponseToTheEvaluation.new\n @response_to_the_evaluation.name = generate_rubres.name\n @response_to_the_evaluation.comment_for_rubre = generate_rubres.description\n @response_to_the_evaluation.assignment_id = @assignment.id\n @response_to_the_evaluation.save\n end\n end\n end", "def create\n #not sure why this was here...? @trips = Trip.all\n\n @expense_report = ExpenseReport.new(expense_report_params)\n authorize @expense_report\n @expense_report.submitter = current_account.accountable\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.save\n format.html { redirect_to home_index_path, notice: 'Expense report was successfully created.' }\n format.json { render :show, status: :created, location: @expense_report }\n else\n format.html { render :new }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @technical_goods_assortment = TechnicalGoodsAssortment.new(technical_goods_assortment_params)\n\n respond_to do |format|\n if @technical_goods_assortment.save\n format.html { redirect_to @technical_goods_assortment, notice: 'Technical goods assortment was successfully created.' }\n format.json { render :show, status: :created, location: @technical_goods_assortment }\n else\n format.html { render :new }\n format.json { render json: @technical_goods_assortment.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6383167", "0.6292616", "0.60142577", "0.6010825", "0.57508177", "0.5703241", "0.5688933", "0.55571604", "0.5556797", "0.5534042", "0.5513427", "0.54798985", "0.547407", "0.5438401", "0.5421402", "0.5394739", "0.5378964", "0.5377503", "0.53509384", "0.53286004", "0.532108", "0.53133374", "0.52989054", "0.5267347", "0.5236626", "0.52054733", "0.52031153", "0.5185443", "0.51419854", "0.5139489", "0.51387", "0.51224697", "0.5107022", "0.5101652", "0.51014465", "0.5093765", "0.5066939", "0.5066642", "0.5053316", "0.50365514", "0.50308377", "0.50297856", "0.5023276", "0.50131273", "0.5009744", "0.50075746", "0.5004362", "0.49996662", "0.49781325", "0.49762806", "0.49729145", "0.497135", "0.4962167", "0.49533698", "0.49488387", "0.4948335", "0.4942382", "0.4930516", "0.49230185", "0.49214625", "0.4920531", "0.49196947", "0.4916819", "0.49155417", "0.49123555", "0.4912011", "0.4902927", "0.49005306", "0.49001503", "0.4891453", "0.48906502", "0.48905936", "0.48902", "0.48856524", "0.48833576", "0.4881868", "0.4881868", "0.4879472", "0.48745984", "0.48741275", "0.48667973", "0.48663145", "0.4861378", "0.48564255", "0.48530033", "0.48511103", "0.48458713", "0.48445067", "0.4844153", "0.48405284", "0.4837941", "0.48338285", "0.4831709", "0.48309222", "0.4829517", "0.48239625", "0.48211327", "0.4820697", "0.48169005", "0.48168024" ]
0.6762209
0
PUT /efforts/1 PUT /efforts/1.json
def update @effort = Effort.find(params[:id]) respond_to do |format| if @effort.update_attributes(params[:effort]) format.html { redirect_to @effort, notice: 'Effort was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @effort.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @effort = Effort.find(params[:id])\n @effort.completed_at = Time.now if params[:commit] == \"Concluir atividade\"\n\n respond_to do |format|\n if @effort.update_attributes(params[:effort])\n format.html { redirect_to admin_efforts_path, notice: 'Alocação atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n effort = Effort.find_by(\"id\" => params[\"id\"])\n effort.update(\"value\" => params[\"value\"],\n \"date\" => params[\"date\"],\n \"goal_id\" => params[\"goal_id\"],\n \"strategy_id\" => params[\"strategy_id\"])\n redirect_to \"/efforts\"\n end", "def update\n respond_to do |format|\n if @effort_rating.update(effort_rating_params)\n format.html { redirect_to @effort_rating, notice: 'Effort rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_rating }\n else\n format.html { render :edit }\n format.json { render json: @effort_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, Employee\n if responsibility_changes?\n new_employee = Employee.new_from_old(employee_params['responsibility'], @employee)\n @employee.destroy\n new_employee.save\n @employee = new_employee\n end\n\n respond_to do |format|\n if @employee.update(employee_attrs)\n format.html { redirect_to (@employee.try(:employee) || @employee), notice: t('action.update.succeed', entity: Employee.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @effort_category.update(effort_category_params)\n format.html { redirect_to @effort_category, notice: 'Effort category was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_category }\n else\n format.html { render :edit }\n format.json { render json: @effort_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @editability = Editability.find(params[:id])\n\n respond_to do |format|\n if @editability.update_attributes(params[:editability])\n format.html { redirect_to @editability, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @editability.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exerciseoverview.update(exerciseoverview_params)\n format.html { redirect_to @exerciseoverview, notice: 'Exerciseoverview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exerciseoverview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @specification.update(specification_params)\n audit(@specification, current_user)\n render json: @specification, status: :ok, serializer: Web::V1::SpecificationSerializer\n else\n render json: @specification.errors, status: :unprocessable_entity\n end\n end", "def set_effort_rating\n @effort_rating = EffortRating.find(params[:id])\n end", "def update\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n if @especy.update_attributes(params[:especy])\n format.html { redirect_to @especy, notice: 'Especie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n debugger\n if @best_practice.update(best_practice_params)\n format.html { redirect_to @best_practice, notice: 'Best practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @best_practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @effort_log = EffortLog.find(params[:id])\n\n respond_to do |format|\n if @effort_log.update_attributes(params[:effort_log])\n format.html { redirect_to(:controller => \"effort_logs\", :action => \"index_by_project\",\n :id => @effort_log.project_phase_deliverable.project_phase.project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @effort_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @enhancement = Enhancement.find(params[:id])\n\n respond_to do |format|\n if @enhancement.update_attributes(params[:enhancement])\n format.html { redirect_to @enhancement, notice: 'Enhancement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enhancement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @effort = Effort.new(params[:effort])\n\n respond_to do |format|\n if @effort.save\n format.html { redirect_to @effort, notice: 'Effort was successfully created.' }\n format.json { render json: @effort, status: :created, location: @effort }\n else\n format.html { render action: \"new\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_stage_effort \t \n\t\t @race = Race.find(params[:race_id])\n\t\t @stage = @race.stages.find(params[:stage_id]) unless @race.nil?\n\t\t @cyclist = @race.cyclists.find(params[:cyclist_id]) unless @race.nil?\n\t\t\t@cyclists = @race.cyclists\n\t\t\t@cyclists = sort_cyclists_stage(@cyclists, @stage)\n\n\t\t if params[:id].present?\n\t\t \t@stage_effort = @cyclist.stage_efforts.find(params[:id]) unless @cyclist.nil?\n\t\t end\n\t end", "def update\n @inspection = Inspection.find(params[:id])\n\n respond_to do |format|\n if @inspection.update_attributes(params[:inspection])\n format.html { redirect_to inspections_path, notice: t(\"activerecord.models.inspection\") + t(\"message.updated\") }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inspection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update\n @idea = Idea.find(params[:id])\n respond_with(@idea) do |format|\n if @idea.update_attributes(params[:idea])\n format.json { render json: @idea, status: :created, location: @idea }\n else\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @effort = Effort.find(params[:id])\n @effort.destroy\n\n respond_to do |format|\n format.html { redirect_to efforts_url }\n format.json { head :ok }\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 respond_to do |format|\n if @actual.update(actual_params)\n format.html { redirect_to @actual, notice: 'Actual was successfully updated.' }\n format.json { render :show, status: :ok, location: @actual }\n else\n format.html { render :edit }\n format.json { render json: @actual.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @performance_test = PerformanceTest.find(params[:id])\n\n respond_to do |format|\n if @performance_test.update_attributes(params[:performance_test])\n format.html { redirect_to @performance_test, :notice => 'Performance test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @performance_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @idea = Idea.find(params[:id])\n raise_error_on_intrusion\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea.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 @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", "def update\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\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 @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @overview.update(overview_params)\n format.html { redirect_to @overview, notice: 'Overview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @overview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @objective.strategy, :update_objective?\n respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective}\n format.json { render :show, status: :ok, location: @objective }\n else\n format.html { render :edit }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person_expense_record = PersonExpenseRecord.find(params[:id])\n\n if @person_expense_record.update(person_expense_record_params)\n head :no_content\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\n end\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n if @stable.update_attributes(params[:stable])\n format.html { redirect_to @stable, notice: 'Stable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n if @exercise_plan.update_attributes(params[:exercise_plan])\n format.html { redirect_to @exercise_plan, notice: 'Exercise plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_plan.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(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @scratcher = Scratcher.find(params[:id])\n\n if @scratcher.update(permitted_params)\n head :no_content\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end", "def update\n @team = Team.find(params[:team_id])\n @workout = @team.workouts.find(params[:workout_id])\n @practice = @workout.practices.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to team_workout_practices_path(@team, @workout), notice: 'Practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @responsibility = Responsibility.find(params[:id])\n\n respond_to do |format|\n if @responsibility.update_attributes(params[:responsibility])\n format.html { redirect_to @responsibility, notice: 'Responsibility was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @responsibility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.update_responsible(:status, 'Waiting for Staff Response')\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @performed_exercise.update(performed_exercise_params)\n format.html { redirect_to @performed_exercise, notice: 'Performed exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @performed_exercise }\n else\n format.html { render :edit }\n format.json { render json: @performed_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @effort = Effort.new(params[:effort])\n @effort.started_at = Time.now if params[:commit] == \"Iniciar atividade\"\n\n respond_to do |format|\n if @effort.save\n format.html { redirect_to admin_efforts_path, notice: 'Alocação criada com sucesso.' }\n format.json { render json: @effort, status: :created, location: @effort }\n else\n format.html { render action: \"new\" }\n format.json { render json: @effort.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end", "def update\n @specification = Specification.find(params[:id])\n\n respond_to do |format|\n if @specification.update_attributes(params[:specification])\n format.html { redirect_to @specification, notice: 'Specification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employee = current_owner.employees.find(params[:id])\n puts \"#{params}\"\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def destroy\n @effort = Effort.find(params[:id])\n @effort.destroy\n\n respond_to do |format|\n format.html { redirect_to efforts_url }\n format.json { head :no_content }\n end\n end", "def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @idea = Idea.find(params[:id])\n\n respond_to do |format|\n if @idea.update_attributes(params[:idea])\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @experiment.update(experiment_params)\n format.html { redirect_to sti_experiment_path(@project.id, @phase.id, @experiment.type, @experiment), notice: 'Experiment was successfully updated.' }\n format.json { render :show, status: :ok, location: @experiment }\n else\n format.html { render :edit }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employ = Employ.find(params[:id])\n\n respond_to do |format|\n if @employ.update_attributes(params[:employ])\n format.html { redirect_to @employ, notice: 'Employ was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employ.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @effort = Effort.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @effort }\n end\n end", "def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @practice.assign_attributes(practice_params)\n\n if @practice.name == nil or @practice.name == \"\"\n @practice.name = @practice.default_name\n end\n\n respond_to do |format|\n if @practice.save\n format.html { redirect_to executive_practices_path }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\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 update\n authorize! :manage, @vspec\n\n respond_to do |format|\n if @vspec.update(vspec_params)\n format.html { redirect_to [@vspec.metric, @vspec], notice: 'Vspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vspec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employment = Employment.find(params[:id])\n\n respond_to do |format|\n if @employment.update_attributes(params[:employment])\n format.html { redirect_to @employment, notice: 'Employment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercice = Exercice.find(params[:id])\n\n respond_to do |format|\n if @exercice.update_attributes(params[:exercice])\n format.html { redirect_to @exercice, notice: 'Exercice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @expense_report\n\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.update(expense_report_params)\n format.html { redirect_to @expense_report, notice: 'Expense report was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_report }\n else\n format.html { render :edit }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Employee\n respond_to do |format|\n if @developer.update(developer_params)\n format.html { redirect_to developer_url(@developer), notice: 'Developer was successfully updated.' }\n format.json { render :show, status: :ok, location: @developer }\n else\n format.html { render :edit }\n format.json { render json: @developer.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\n authorize @employment\n respond_to do |format|\n\n if @employment.update(employment_params)\n format.html { redirect_to openings_path, notice: 'Employment was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment }\n else\n format.html { redirect_to openings_path }\n format.json { render json: @employment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @individual_company_investment.update(individual_company_investment_params)\n format.html { redirect_to @individual_company_investment, notice: 'Individual company investment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @individual_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @research = Research.find(params[:id])\n\n respond_to do |format|\n if @research.update_attributes(params[:research])\n format.html { redirect_to @research, notice: 'Research was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @research.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expertise = Expertise.find(params[:id])\n\n if @expertise.update(expertise_params)\n head :no_content\n else\n render json: @expertise.errors, status: :unprocessable_entity\n end\n end", "def update\n @experience = Experience.find(params[:id])\n respond_to do |format|\n if @experience.update_attributes(params[:experience])\n format.html { redirect_to @experience, notice: 'Experience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experience.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @objective = Objective.find(params[:id])\n\n respond_to do |format|\n if @objective.update_attributes(params[:objective])\n format.html { redirect_to @objective, notice: 'Objective was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n updated = params[:availabilities].keys.map(&:to_i)\n #existing = @person.availabilities.map(&:timeslot_id)\n #new = updated - existing\n #deleted = existing - updated\n #@person.availabilities.delete(deleted.map{|d| @person.availabilities.find_by_timeslot_id(d)})\n @person.availabilities=(updated.map{|t| @person.availabilities.find_or_create_by_timeslot_id(t)})\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # updating hard info\n hard_info = HardInfo.where(use_case_no: @use_case.use_case_no, client_name: @use_case.client_name, product_name: @use_case.product_name)\n hard_info.first.update(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n #--\n respond_to do |format|\n if @use_case.update(use_case_params)\n format.html { redirect_to @use_case }\n format.json { render :show, status: :ok, location: @use_case }\n else\n format.html { render :edit }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n logger.info { \"PARAMS: #{params.inspect}\" }\n project_id, id = params[:id].split('-')\n ticket = Lighthouse::Ticket.find(id, :params => {:project_id => project_id})\n \n # insanely hacky. can't nest json, so don't want to do a willy-nilly merge.\n # move mergeable params to the [:ticket] hash to follow usual rails conventions\n # before merging\n params[:ticket] = {}\n %w(assigned_user_id state milestone_id).each do |field|\n params[:ticket].merge!( field => params.delete(field) ) if params[field]\n end\n logger.info { \"TICKET ATTRS TO UPDATE: #{params[:ticket].inspect}\"}\n \n ticket.attributes.merge!( params[:ticket] )\n ticket.save\n\n respond_to do |format|\n # if @ticket.update_attributes(params[:ticket])\n # flash[:notice] = 'Ticket was successfully updated.'\n # format.html { redirect_to(@ticket) }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity }\n # end\n end\n end", "def update\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: I18n.t('exercises.updated') }\n format.json { render :show, status: :ok, location: @exercise }\n else\n format.html { render :edit }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @defense_charm.update(defense_charm_params)\n format.html { redirect_to @defense_charm, notice: 'Defense charm was successfully updated.' }\n format.json { render :show, status: :ok, location: @defense_charm }\n else\n format.html { render :edit }\n format.json { render json: @defense_charm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def update\n @advancement = Advancement.find(params[:id])\n\n respond_to do |format|\n if @advancement.update_attributes(params[:advancement])\n format.html { redirect_to @advancement, notice: 'Advancement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @advancement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @conceptual_entity = ConceptualEntity.find(params[:id])\n\n respond_to do |format|\n if @conceptual_entity.update_attributes(params[:conceptual_entity])\n format.html { redirect_to @conceptual_entity, notice: 'Conceptual entity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conceptual_entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employer_liability_item.update(employer_liability_item_params)\n format.html { redirect_to @employer_liability_item, notice: 'Employer liability item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employer_liability_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n if @employe.update_attributes(params[:employe])\n format.html { redirect_to @employe, notice: 'Employe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employe.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 @low_no_cost_improvement = LowNoCostImprovement.find(params[:id])\n\n respond_to do |format|\n if @low_no_cost_improvement.update_attributes(params[:low_no_cost_improvement])\n format.html { redirect_to(@low_no_cost_improvement, :notice => 'Low no cost improvement was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @low_no_cost_improvement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @practice.update(practice_params)\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @practice.update(practice_params)\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { render :show, status: :ok, location: @practice }\n else\n format.html { render :edit }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @labtech_audit.update(labtech_audit_params)\n format.html { redirect_to @labtech_audit, notice: 'Labtech audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @labtech_audit }\n else\n format.html { render :edit }\n format.json { render json: @labtech_audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @specification_type = SpecificationType.find(params[:id])\n\n if @specification_type.update(specification_type_params)\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\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" ]
[ "0.65331805", "0.64933944", "0.6129887", "0.6000726", "0.5985331", "0.5969388", "0.5923918", "0.5922773", "0.59196436", "0.5885111", "0.5882329", "0.5845489", "0.5836597", "0.58312607", "0.5830117", "0.5828616", "0.57698005", "0.5761425", "0.5739286", "0.5726388", "0.57254183", "0.5715999", "0.57133216", "0.5711064", "0.57103443", "0.57103443", "0.5708432", "0.57034147", "0.5701138", "0.56910604", "0.5690297", "0.5683057", "0.566655", "0.56580186", "0.56569654", "0.5653157", "0.56438226", "0.5637967", "0.5632633", "0.56323385", "0.56218755", "0.5616816", "0.5616221", "0.56133384", "0.5600114", "0.55999196", "0.5599449", "0.5599449", "0.5599449", "0.55938834", "0.5593272", "0.55908626", "0.55882865", "0.5574307", "0.55654293", "0.5560544", "0.55604446", "0.5557746", "0.5555852", "0.5544905", "0.5544905", "0.5543288", "0.5542333", "0.55377007", "0.5536709", "0.55345654", "0.5533939", "0.55311364", "0.5526645", "0.55261046", "0.5523112", "0.55230546", "0.55218714", "0.551976", "0.55169505", "0.5515411", "0.5514933", "0.55057365", "0.55042964", "0.55036753", "0.5503021", "0.55012524", "0.5500728", "0.54993796", "0.549875", "0.54950917", "0.5494609", "0.5494369", "0.54935706", "0.54910547", "0.5485951", "0.548278", "0.54794097", "0.5478381", "0.54751754", "0.5473963", "0.5473663", "0.54719234", "0.5470643", "0.54697776" ]
0.7192345
0
DELETE /efforts/1 DELETE /efforts/1.json
def destroy @effort = Effort.find(params[:id]) @effort.destroy respond_to do |format| format.html { redirect_to efforts_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @effort = Effort.find(params[:id])\n @effort.destroy\n\n respond_to do |format|\n format.html { redirect_to efforts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @editability = Editability.find(params[:id])\n @editability.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @effort_log = EffortLog.find(params[:id])\n @effort_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(effort_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @effort_rating.destroy\n respond_to do |format|\n format.html { redirect_to effort_ratings_url, notice: 'Effort rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @effort_category.destroy\n respond_to do |format|\n format.html { redirect_to effort_categories_url, notice: 'Effort category 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 @task = Task.find(params[:id])\n @task_efforts = Effort.where(:task_id => @task.id)\n @task_efforts.map(&:destroy)\n destroy!\n end", "def destroy\n @affectation = Affectation.find(params[:id])\n @affectation.destroy\n\n respond_to do |format|\n format.html { redirect_to affectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @effort_log_line_item = EffortLogLineItem.find(params[:id])\n @effort_log_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(effort_log_line_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Audit.find(params[:id]).destroy\n head :no_content\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 @exerciseoverview.destroy\n respond_to do |format|\n format.html { redirect_to exerciseoverviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @objective.strategy\n @objective.destroy\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \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 @objective = Objective.find(params[:id])\n @objective.destroy\n\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enhancement = Enhancement.find(params[:id])\n @enhancement.destroy\n\n respond_to do |format|\n format.html { redirect_to enhancements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @especy = Especie.find(params[:id])\n @especy.destroy\n\n respond_to do |format|\n format.html { redirect_to especies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @drone_attack = DroneAttack.find(params[:id])\n @drone_attack.destroy\n\n respond_to do |format|\n format.html { redirect_to drone_attacks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @improvement.destroy\n respond_to do |format|\n format.html { redirect_to improvements_path, notice: 'Tarefa foi apagada com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @actual.destroy\n respond_to do |format|\n format.html { redirect_to actuals_url, notice: 'Actual was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @overview.destroy\n respond_to do |format|\n format.html { redirect_to overviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_execution.destroy\n respond_to do |format|\n format.html { redirect_to exercise_executions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exalt = Exalt.find(params[:id])\n @exalt.destroy\n\n respond_to do |format|\n format.html { redirect_to exalts_url }\n format.json { head :ok }\n end\n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def destroy\n @individual_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to individual_company_investments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end", "def destroy\n @prof_inspection = ProfInspection.find(params[:id])\n @prof_inspection.destroy\n\n respond_to do |format|\n format.html { redirect_to client_prof_inspections_url }\n format.json { head :ok }\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 @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 @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 @exercice = Exercice.find(params[:id])\n @exercice.destroy\n\n respond_to do |format|\n format.html { redirect_to exercices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @explaination = Explaination.find(params[:id])\n @explaination.destroy\n\n respond_to do |format|\n format.html { redirect_to explainations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n @evaluable_competency.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluable_competencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expenditure = Expenditure.find(params[:id])\n @expenditure.destroy\n\n respond_to do |format|\n format.html { redirect_to expenditures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @performance_test = PerformanceTest.find(params[:id])\n @performance_test.destroy\n\n respond_to do |format|\n format.html { redirect_to performance_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @routine_interview = RoutineInterview.find(params[:id])\n @routine_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to routine_interviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @damage = Damage.find(params[:id])\n @damage.destroy\n\n respond_to do |format|\n format.html { redirect_to damages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to exps_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @design_dissertation = DesignDissertation.find(params[:id])\r\n @design_dissertation.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to design_dissertations_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end", "def destroy\n @absent.destroy\n\n respond_to do |format|\n format.html { redirect_to absents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to criteria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @experience = Experience.find(params[:id])\n @experience.destroy\n\n respond_to do |format|\n format.html { redirect_to experiences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @violation.destroy\n respond_to do |format|\n format.html { redirect_to violations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exhibition = Exhibition.find(params[:id])\n @exhibition.destroy\n\n respond_to do |format|\n format.html { redirect_to exhibitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estimate = Estimate.find(params[:id])\n @estimate.destroy\n\n respond_to do |format|\n format.html { redirect_to estimates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lifespan = Lifespan.find(params[:id])\n @lifespan.destroy\n\n respond_to do |format|\n format.html { redirect_to lifespans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @effleurage_option.destroy\n respond_to do |format|\n format.html { redirect_to effleurage_options_url, notice: 'Effleurage option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @employe.destroy\n respond_to do |format|\n format.html { redirect_to employes_path(api_id: @employe.organisme_id), notice: 'Employe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @achievment.destroy\n respond_to do |format|\n format.html { redirect_to achievments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @employer_liability_insurance.destroy\n respond_to do |format|\n format.html { redirect_to employer_liability_insurances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @responsibility = Responsibility.find(params[:id])\n @responsibility.destroy\n\n respond_to do |format|\n format.html { redirect_to responsibilities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @investable.destroy\n respond_to do |format|\n format.html { redirect_to investables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_to do |format|\n format.html { redirect_to :controller => 'design_data', :action => 'index' }\n format.json { head :no_content }\n end\n end", "def destroy\n @overall.destroy\n respond_to do |format|\n format.html { redirect_to overalls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_experiments\n @experiment.destroy\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advancement = Advancement.find(params[:id])\n @advancement.destroy\n\n respond_to do |format|\n format.html { redirect_to advancements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @impact_level\n @impact_level.destroy\n respond_to do |format|\n format.html { redirect_to impact_levels_url, notice: 'Impact level was successfully destroyed.' }\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 @expense = Expense.find params.fetch(:id)\n @expense.destroy\n head :no_content\n end", "def destroy\n @performed_exercise.destroy\n respond_to do |format|\n format.html { redirect_to performed_exercises_url, notice: 'Performed exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_exercise = DailyExercise.find(params[:id])\n @daily_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reflection = Reflection.find(params[:id])\n @reflection.destroy\n\n respond_to do |format|\n format.html { redirect_to reflections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @desc = Desc.find(params[:id])\n @desc.destroy\n\n respond_to do |format|\n format.html { redirect_to descs_url }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def destroy\n @planets_exoplanet = Planets::Exoplanet.find(params[:id])\n @planets_exoplanet.destroy\n\n respond_to do |format|\n format.html { redirect_to planets_exoplanets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n contest = @editorial.contest\n @editorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Editorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_log = ExerciseLog.find(params[:id])\n @exercise_log.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dummy = Dummy.find(params[:id])\n @dummy.destroy\n\n respond_to do |format|\n format.html { redirect_to dummies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # Logic to delete a record\n @maintenance = Maintenance.find(params[:id])\n @maintenance.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @requisition = Requisition.find(params[:id])\n @requisition.destroy\n\n respond_to do |format|\n format.html { redirect_to requisitions_url }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.73529345", "0.6870871", "0.68154883", "0.66863745", "0.65773666", "0.6575156", "0.65736735", "0.65386367", "0.6522808", "0.65180516", "0.6500292", "0.6498986", "0.6470524", "0.6450188", "0.6443897", "0.6429751", "0.6413883", "0.64088935", "0.6404612", "0.6390975", "0.63871145", "0.6383916", "0.63820434", "0.63808984", "0.6374693", "0.6374693", "0.6374693", "0.6365654", "0.6357195", "0.6347304", "0.63444054", "0.63384014", "0.6333922", "0.6327455", "0.6324933", "0.6323479", "0.63231385", "0.63184315", "0.63177514", "0.63166165", "0.6310332", "0.6300439", "0.6300054", "0.6300054", "0.6299638", "0.62992436", "0.62969756", "0.6295443", "0.6292005", "0.6289594", "0.62839526", "0.62755597", "0.6273232", "0.62685126", "0.62671185", "0.62671185", "0.62671185", "0.62671185", "0.62665194", "0.6259745", "0.6257204", "0.625255", "0.6252348", "0.6248397", "0.62456995", "0.6242329", "0.6239604", "0.62386113", "0.6238143", "0.62353075", "0.62349623", "0.62346196", "0.6234392", "0.62326187", "0.6231793", "0.6230754", "0.62274605", "0.6227378", "0.6225395", "0.6223847", "0.6221071", "0.62205964", "0.6218332", "0.62172663", "0.6215223", "0.6215223", "0.62150955", "0.62129545", "0.62122416", "0.62097263", "0.6209449", "0.6209142", "0.62080175", "0.62032706", "0.6202917", "0.62016594", "0.6201123", "0.62011176", "0.6199574", "0.61965287" ]
0.7626579
0
CSS class for HTML status codes
def class_for_code(code) "r#{Integer(code)/100}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_code; end", "def http_status\n self[:status_code]\n end", "def status_code\n STATUS_CODE\n end", "def status_code\n self.status.to_i\n end", "def status_code(*)\n end", "def status_codes\n STATUS_CODES\n end", "def status_code_meaning(number)\r\n if number == 200\r\n return \"OK\"\r\n elsif number == 301\r\n return \"Moved Permanently\"\r\n elsif number == 401\r\n return \"Unauthorized\"\r\n elsif number == 404\r\n return \"Not Found\"\r\n elsif number == 500\r\n return \"Internal Server Error\"\r\n end\r\nend", "def http_status(code)\n [code, Rack::Utils::HTTP_STATUS_CODES[code]].join(' ')\n end", "def http_status(code)\n [code, Rack::Utils::HTTP_STATUS_CODES[code]].join(' ')\n end", "def http_status(code)\n [code, Rack::Utils::HTTP_STATUS_CODES[code]].join(' ')\n end", "def status_code\n @parser.status_code\n end", "def status_code\n wrapper.status_code.to_i\n end", "def http_status_line(code = 200)\n \"#{HTTP_VERSION} #{code} #{Shelf::Utils::HTTP_STATUS_CODES[code]}\"\n end", "def status_code\n data.status_code\n end", "def http_status\n self.class.http_status\n end", "def http_status\n self.class.http_status\n end", "def code_symbol\n HTTP_STATUS_CODES[status]\n end", "def status(code)\n response.status = code\n end", "def set_status_code\n if self.status_code.nil?\n self.status_code = \"200\"\n end\n end", "def status_message; end", "def response_status(kind)\n response.headers['status'] = kind.to_s\n end", "def status(value = nil)\n\t\t\tresponse.status ||= 200\n\t\t\tresponse.headers['X-Cascade'] = 'pass' if value == 404\n\t\t\tvalue ? response.status = value : response.status\n\t\tend", "def status_code\n response_value(:code)\n end", "def status(code)\n @response.status = code\n end", "def status code=nil\n @response.status = code if code\n @response.status\n end", "def set_http_code(h_c)\n if h_c.nil?\n @http_code = 200\n else\n @http_code = h_c.to_i\n end\n end", "def status_code\n @response.status\n end", "def status(value)\n phpcall :header, \"HTTP/1.1 #{frucnatra_http_statuses[value]}\"\n end", "def set_status(code)\n new(\n status: code\n )\n end", "def status_color\n if self.success && self.error_text.nil?\n return 'green'\n elsif self.success\n return 'yellow'\n else\n return 'red'\n end\n end", "def http_code\n '000'\n end", "def getStatusCode\n @_statusCode\n end", "def page_status\n @status = \"OK\"\n @status = \"ERR\" if self.response_code > 399\n end", "def status(value=nil)\n response.status = value if value\n response.status\n end", "def status_code\n @data[:status_code].to_i\n end", "def status_code\n ActionController::StatusCodes::SYMBOL_TO_STATUS_CODE[@status]\n end", "def http_response_code(status = nil)\n if status\n @status = status\n else\n @status\n end\n end", "def status\n head :ok\n end", "def status\n head :ok\n end", "def status_code\n params[:code] || 500\n end", "def status_code\n params[:code] || 500\n end", "def status(code, message)\n self.status = code\n self.body = message\n end", "def status(code, message)\n self.status = code\n self.body = message\n end", "def css_classes\n [\n \"version-#{status}\"\n ].join(' ')\n end", "def response_code; end", "def response_code; end", "def response_code; end", "def response_code; end", "def ok_status_code\n _undefined\n end", "def status_to_css\n if status != \"Active\" || docks_available < 1\n \"error\"\n elsif docks_available == 1\n \"warning\"\n else\n \"success\"\n end\n end", "def to_i\n @status_code\n end", "def status_color\n if skipped?\n :yellow\n elsif error?\n :red\n else\n :green\n end\n end", "def status(*code)\n self.status_code = code.first if code.first.present?\n self.status_code\n end", "def css_status(status = nil)\n CSS_STATUSES[status || object.status]\n end", "def service_status(code, response_time = nil, status)\n case\n when code == \"200\" && response_time <= 0.4\n status = \"GREEN\"\n puts \"#{status}\"\n when code == \"200\" && response_time > 0.4\n status = \"ORANGE\"\n puts \"#{status}\"\n when code != \"200\"\n status = \"RED\"\n puts \"#{status}\"\n else\n status = \"CHECK SERVICE URL\"\n puts \"#{status}\"\n end\n end", "def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end", "def get_http_response_code\n raise 'To be implemented in child classes'\n end", "def stringify_statuscode!(error_pages)\n return if error_pages.nil?\n\terror_pages.each { |error_page| error_page['statusCode'] = error_page['statusCode'].to_s }\n end", "def http_err_code\n http_codes[@http_err]\n end", "def is_http_status? code\n (200..206).to_a.concat((300..307).to_a).concat((400..417).to_a) \\\n .concat((500..505).to_a).include? code.to_i\n end", "def css_class\n @css_class ||= \"project #{status.gsub(' ','-').downcase}\"\n end", "def set_status( statuscode )\n\t\t\tself.log.warn \"Unknown status code %d\" unless CLOSING_STATUS_DESC.key?( statuscode )\n\t\t\tstatus_msg = \"%d %s\" % [ statuscode, CLOSING_STATUS_DESC[statuscode] ]\n\n\t\t\tself.payload.truncate( 0 )\n\t\t\tself.payload.puts( status_msg )\n\t\tend", "def status_line\n # First line is 'Status-Line' from RFC2616 section 6.1\n # Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF\n # etc...\n return \"HTTP/#{version} #{status} #{reason}\"\n end", "def status_line\n\t\tst = self.status || self.derived_status_code\n\t\treturn STATUS_LINE_FORMAT % [ st, HTTP::STATUS_NAME[st] ]\n\tend", "def status_code\n return manual_status_code if manual_status_code\n return 422 if errors.present?\n return 200 if result\n return 400\n end", "def status_to_css_classes(status)\n case status\n when 'passing'\n { 'cell' => 'status-passing', 'icon' => 'check', 'type' => 'fas', 'text' => 'text-success' }\n when 'failing'\n { 'cell' => 'status-failing', 'icon' => 'times', 'type' => 'fas', 'text' => 'text-danger' }\n when 'errored'\n { 'cell' => 'status-errored', 'icon' => 'exclamation', 'type' => 'fas', 'text' => 'text-warning' }\n else\n { 'cell' => 'status-not-started', 'icon' => 'circle', 'type' => 'far', 'text' => 'text-info' }\n end\n end", "def headers\n { 'Status' => ActionController::Base::DEFAULT_RENDER_STATUS_CODE }\n end", "def status_error\n @status = 500\n end", "def set_status(status)\n if status.kind_of?(Symbol)\n status = Merb::ControllerExceptions::STATUS_CODES[status]\n status || raise(\"Can't find a response code with that name\")\n end\n @_status = status\n end", "def css_class\n \"flag-status #{state_name}\"\n end", "def status_code(val = nil)\n if val\n @j_del.setStatusCode(val)\n self\n else\n @j_del.getStatusCode\n end\n end", "def get_http_status line\n is_http_status?(line) ? line.to_i : nil\n end", "def response_to_status(response)\n response ? :success : :error\n end", "def status_code\n attributes[:status_code]\n end", "def status=(code)\n code = code.to_i if !code.is_a?(Fixnum)\n # TODO(sissel): Validate that 'code' is a 3 digit number\n @status = code\n\n # Attempt to set the reason if the status code has a known reason\n # recommendation. If one is not found, default to the current reason.\n @reason = STATUS_REASON_MAP.fetch(@status, @reason)\n end", "def status_to_css_classes(status)\n classes = {}\n\n case status\n when 'Passing'\n classes['cell'] = 'status-passing'\n classes['icon'] = 'fa-check'\n when 'Failing'\n classes['cell'] = 'status-failing'\n classes['icon'] = 'fa-times'\n when 'Incomplete'\n classes['cell'] = 'status-not-started'\n classes['icon'] = 'fa-circle-o'\n when 'Not_started'\n classes['cell'] = 'status-not-started'\n classes['icon'] = 'fa-circle-o'\n end\n\n classes\n end", "def response_status\n @response[:status]\n end", "def get_response_status(response)\n case response\n when Net::HTTPSuccess\n :ok\n when Net::HTTPRedirection\n :multiple_choices\n when Net::HTTPNotFound\n :not_found\n when Net::HTTPClientError\n :bad_request\n when Net::HTTPServerError\n :internal_server_error\n else\n :bad_request\n end\n end", "def status_phrase(status_symbol = :ok)\n Rack::Utils::HTTP_STATUS_CODES[status_code(status_symbol)]\n end", "def status\n response.status\n end", "def status\n response.status\n end", "def status_code\n e = nil\n each_element('status') { |xe| e = xe }\n if e and e.attributes['code'].size == 3 and e.attributes['code'].to_i != 0\n e.attributes['code'].to_i\n else\n nil\n end\n end", "def send_status( status )\n self.status = ::Rack::Utils.status_code( status )\n self.write ::Rack::Utils::HTTP_STATUS_CODES[ self.status ]\n end", "def status_color(accepted)\n if accepted == 0\n return \"style=\\\"color:red;\\\"\"\n elsif accepted == 1\n return \"style=\\\"color:gray;\\\"\"\n elsif accepted == 2\n return \"style=\\\"color:black;\\\"\"\n else\n return \"style=\\\"color:red;\\\"\"\n end\n end", "def status_code\n @status_code ||= if absolved?\n \"A\"\n elsif finished?\n \"Z\"\n elsif interrupted?\n \"P\"\n elsif final_exam_passed?\n \"S\"\n elsif continues?\n \"S\"\n elsif studying?\n \"S\"\n elsif before_admit?\n \"S\"\n else\n raise UnknownState\n end\n return @status_code\n end", "def status\n 500\n end", "def comm_status(css: '.comm-status', status: nil, **opt)\n opt[:role] = 'status' unless opt.key?(:role)\n prepend_css!(opt, css, status)\n html_div(opt) do\n STATUS_MESSAGE.map { |type, text| html_span(text, class: type) }\n end\n end", "def determine_status_color( status )\n case status\n when 'pending' then return '#cea61b'\n when 'error' then return '#bd2c00'\n when 'success' then return '#6cc644'\n end\nend", "def transform_status(status); end", "def type\n case code\n when 100..199 then :informational_response\n when 200..299 then :success\n when 300..399 then :redirection\n when 400..499 then :client_error\n when 500..599 then :server_error\n else :unknown\n end\n end", "def status\n case @result.retval\n when 0 ; \"ok\"\n when 1 ; \"warning\"\n when 2 ; \"critical\"\n end\n end", "def http_status(hs=nil)\n @_http_status = hs unless hs.nil?\n @_http_status\n end", "def status_code\n @status_code || errors.empty? ? 200 : 422\n end", "def code\n @http_response.code.to_i\n end", "def ok; @status = 200 end", "def ok; @status = 200 end", "def code\n self.response_code # .to_s\n end", "def status\n response.status\n end", "def index\n head params[:response_status]\n end", "def css_class\n case id\n when 0 # Cancelado - yellow\n 'warning'\n when 1 # Enviado - red\n 'danger'\n when 2 # Recibido - blue\n 'active'\n when 3 # Confirmado - gray\n 'info'\n when 4 # Efectuado - green\n 'success'\n end\n end", "def scode(thing)\n\t\treturn StatusCodes[thing] || ''\n\tend" ]
[ "0.70320207", "0.7025712", "0.69347167", "0.6843483", "0.6825588", "0.68053716", "0.67739874", "0.67426944", "0.67426944", "0.67426944", "0.67309284", "0.6674621", "0.6619383", "0.6604126", "0.65755445", "0.65755445", "0.65683436", "0.65647644", "0.6559685", "0.65022594", "0.6497574", "0.6491927", "0.64787036", "0.6464512", "0.64589643", "0.6453138", "0.64451903", "0.64367926", "0.6428292", "0.64278597", "0.6425185", "0.6417254", "0.6387177", "0.6363674", "0.63592494", "0.6357608", "0.63575596", "0.6342443", "0.6342443", "0.63234854", "0.63234854", "0.6309199", "0.6309199", "0.62921554", "0.6256553", "0.6256553", "0.6256553", "0.6256553", "0.62539595", "0.6249167", "0.6247811", "0.6241766", "0.62381536", "0.6234949", "0.619831", "0.61864525", "0.61800873", "0.6178544", "0.61770797", "0.61746305", "0.61571205", "0.61371225", "0.6119183", "0.6111962", "0.6111924", "0.6101631", "0.61009574", "0.60870117", "0.6080323", "0.6054704", "0.60499984", "0.60490036", "0.6045701", "0.6040953", "0.6033141", "0.6029933", "0.6019438", "0.6019321", "0.6014292", "0.60085136", "0.60085136", "0.6005465", "0.5996114", "0.59877956", "0.59831643", "0.5976024", "0.5972753", "0.5959431", "0.5957042", "0.5949493", "0.5949477", "0.5949265", "0.59398955", "0.59395087", "0.59383094", "0.59383094", "0.59378904", "0.59356123", "0.5925497", "0.59143215", "0.5907634" ]
0.0
-1
// For example, S = "abba", T = "^abba$". // ^ and $ signs are sentinels appended to each end to avoid bounds checking
def preProcess(s) n = s.length().to_i if n==0 return "^$" end ret = "^" (0..n-1).each do |re| ret += ('#' + s[re].to_s) end ret += '#$' return ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minSubstringWithAllChars(s, t)\n (0..s.size).lazy.map { |l|\n (0..s.size - l).lazy.map { |i| s[i, l] }\n .find { |x| t.each_char.all? { |c| x[c] } }\n }.find { |x| x }\nend", "def sseq(s, t)\n\tindices = []\n\tlast_idx = 0\n\tt.each_char do |chr|\n\t\ti = s.index(chr, last_idx+1)\n\t\tif i\n\t\t\tindices.push (last_idx = i + 1)\n\t\telse\n\t\t\tputs \"ooops\", chr\n\t\tend\n\tend\n\tindices.join ' '\nend", "def solve(s, t)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n s.each_char do |char|\n hash1[char] += 1\n end\n t.each_char do |char|\n hash2[char] += 1\n end\n hash1 == hash2\nend", "def find_difference(s, t)\n c = t[t.size - 1].ord\n for i in 0...t.size - 1 do \n c ^= s[i].ord\n c ^= t[i].ord\n end\n c.chr\nend", "def tr_s(p0, p1) end", "def phase_iii(s1, s2)\n s1.chars.sort! == s2.chars.sort!\n\nend", "def solve(s, t)\n if s.length != t.length\n return false\n end\n hash = Hash.new {|h, k, v| hash[k] = v}\n\n (0...s.length).each do |i|\n if !hash[s[i]] && !hash.values.include?(t[i])\n hash[s[i]] = t[i]\n elsif hash[s[i]] != t[i]\n return false\n end\n end\n true\nend", "def tr_s!(p0, p1) end", "def two_handed_sword\n Regexp.new s_to_h(<<-S)\n B1 96 B1 D3 ED AE 5F 92 01 66 03 01 .. FF FF FF\n FF .. .. .. .. 30 19 01 0B 01 00 00 00 08 00 00\n 00 30 00 00 00 00 00 00 00 01 00 00 00 00 00 00\n 00 02 00 00 00 02 00 00 00 99 32 C5 C4 CC 57 6D\n 43 89 6B 03 01 FF FF FF FF 99 32 C5 C4 CC 57 6D\n 43 27 9E 00 01 FF FF FF FF 01 00 00 00 99 32 C5\n C4 CC 57 6D 43 27 9E 00 01 FF FF FF FF 13 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00\n 00\n S\nend", "def string_edit(string1, string2)\n\nreturn true of string1==string2\nreturn false if (string1.length=string2.length).abs>1\n if string1.length<string2.length\n short_string=string1\n long_string=string2\n else \n short_string=string2 \n long_string=string1\n end\n long_string_hash={}\n \n long_string.each_char do |char|\n long_string_hash[char]||=0\n long_string_hash[char]+1\n end\n \n if short_string.length<long_string.length \n short_string.each_char do |char|\n return false if !!long_string_hash[char]\n long_string_hash[char]-=1\n return false if long_string_hash[char]<0\n end\n return true\n end \n diff_letts=0\n short_string.each_char do |char|\n diff_letts+=1 if !!long_string_hash[char]\n return false if diff_letts>1\n end\n return true\n \n \n end", "def mask_string(string, mask, step)\n s_chars = string.split \"\"\n m_chars = mask.split \"\"\n res = \"\"\n s_chars.zip(m_chars).each do |s_char, m_char|\n if m_char.to_i(16) <= step\n res += s_char\n else\n res += \" \"\n end\n end\n res\nend", "def triangular_word?(str)\nend", "def puf_syndrome\n \n end", "def s_th(string)\r\n th_ify = string.chars.map { |x| x == \"s\" ? 'th' : x }\r\n return th_ify.join\r\nend", "def str_xor(s1, s2)\n if s1.length != s2.length:\n minlen = [s1, s2].map(&:length).min\n s1 = s1[0...minlen]\n s2 = s2[0...minlen]\n end\n s1.bytes.zip(s2.bytes).map{ |b1, b2| b1 ^ b2 }.map(&:chr).join\nend", "def broad_sword\n # use regexp since .. is used for wildcard\n Regexp.new s_to_h(<<-S)\n B1 96 B1 D3 ED AE 5F 92 F4 65 03 01 .. FF FF FF\n FF .. .. .. .. 23 19 01 0B 00 00 00 00 08 00 00\n 00 2A 00 00 00 00 00 00 00 02 00 00 00 00 00 00\n 00 02 00 00 00 02 00 00 00 99 32 C5 C4 CC 57 6D\n 43 87 6B 03 01 FF FF FF FF 99 32 C5 C4 CC 57 6D\n 43 27 9E 00 01 FF FF FF FF 01 00 00 00 99 32 C5\n C4 CC 57 6D 43 27 9E 00 01 FF FF FF FF 13 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00\n 00\n S\nend", "def make_password(phrase)\n phrase.split(\" \").map do |x|\n x = x[0]\n x = \"1\" if x == \"i\" || x == \"I\"\n x = \"0\" if x == \"o\" || x == \"O\"\n x = \"5\" if x == \"s\" || x == \"S\"\n x\n end.join()\nend", "def alpha_search(str)\r\n\r\nend", "def sb(t, s, c)\n\n end", "def caesar_crypto_encode(t, s)\n t.to_s.strip.tr(\"a-zA-Z\", [*\"a\"..\"z\", *\"A\"..\"Z\"].rotate(s).join)\nend", "def spec\n string_match_operator\n string_element_reference_regexp\n string_byteslice\n string_scan\n string_unary_minus\n string_reverse\n string_tr\n\n true\nend", "def check_string(s)\r\n\t\treturn s.length == @m*@n\r\n\tend", "def palindrome_substrings(string)\n\nend", "def step_through_with(s)i\n # It doesn't solve the kata because it returns true even if same chars are met in diffrent part of the word. Like \"ThaT\"\n s.chars.count == s.chars.uniq.count\nend", "def backspace_compare(s, t)\n format_str(s) == format_str(t)\nend", "def char_tweak(normal_sign, vandalized_sign)\n normal = char_count(normal_sign)\n vandal = char_count(vandalized_sign)\n vandal.all? { |k, v| normal[k] >= v }\nend", "def solve(s)\n new_str = ''\n s.each_char do |char|\n if new_str[-1] != char\n new_str += char\n end\n end\n return new_str\nend", "def shortest_palindrome_3(s)\n idx = 0\n front = 0\n back = 0\n pow = 1\n (0...s.size).each { |i|\n dijit = s[i].ord - 'a'.ord\n front = front * 27 + dijit\n back = back + dijit * pow\n pow *= 27\n idx = [idx, i].max if front == back\n }\n\n (s[idx + 1..-1] || \"\").reverse + s\nend", "def test_seqence_valid18\n result = engine(\"Trump1%\")\n refute(result, \"'Trump1%' should not be valid because it is too short in length.\")\n end", "def sortByStrings (s,t)\n sortedStr = \"\"\n s_arr = s.split('') \n t_arr = t.split('')\n\n for tchar in t_arr\n for schar in s_arr\n if tchar == schar\n sortedStr += schar\n end\n end\n end\nreturn sortedStr\nend", "def missing_letters(string)\nend", "def string_rotation(s1, s2)\n return false if s1.length != s2.length\n double_s1 = s1 + s1\n isSubstring(double_s1, s2)\nend", "def test_mismatch\n assert_equal(nil, @s00.mismatch( \"abcdefghij\" ) )\n assert_equal( 0 , @s00.mismatch( \"_bcdefghij\" ) )\n assert_equal( 4 , @s00.mismatch( \"abcd_fghij\" ) )\n assert_equal(10 , @s00.mismatch( \"abcdefghijk\" ) )\n assert_equal( 3 , @s00.mismatch( \"abc\" ) )\n\n assert_equal(nil, @s01.mismatch( \"あいうえお\" ) )\n assert_equal( 0 , @s01.mismatch( \"_いうえお\" ) )\n assert_equal( 4 , @s01.mismatch( \"あいうえ_\" ) )\n assert_equal( 5 , @s01.mismatch( \"あいうえおか\" ) )\n assert_equal( 3 , @s01.mismatch( \"あいう\" ) )\n end", "def solve(str)\n vowels = ['a','e','i','o','u'];\n alphabet = {\n :a => 1,\n :b => 2,\n :c => 3,\n :d => 4,\n :e => 5,\n :f => 6,\n :g => 7,\n :h => 8,\n :i => 9,\n :j => 10,\n :k => 11,\n :l => 12,\n :m => 13,\n :n => 14,\n :o => 15,\n :p => 16,\n :q => 17,\n :r => 18,\n :s => 19,\n :t => 20,\n :u => 21,\n :v => 22,\n :w => 23,\n :x => 24,\n :y => 25,\n :z => 26\n };\n\n max_substring_value = 0;\n current_substring_value = 0;\n\n str.chars.each do |c|\n unless vowels.include?(c)\n current_substring_value += alphabet[:\"#{c}\"];\n else\n if current_substring_value > max_substring_value\n max_substring_value = current_substring_value;\n end\n current_substring_value = 0;\n end\n end\n\n max_substring_value\nend", "def atbash(string)\n plain = ('a'..'z').to_a\n cipher = plain.reverse\n arr = string.split('')\n solution = []\n\n # Ruby helper to iterate through string:\n # string.each_char do |el|\n\n arr.each do |el|\n cipher_index = plain.index(el)\n solution.push(cipher[cipher_index])\n end\n\n p solution.join('')\nend", "def handle_short_string(s)\n return @short_string_to_hash[s] if @short_string_to_hash[s]\n\n nonce = ''\n\n loop do\n hash = handle_long_string(s + nonce)\n\n if @hash_to_short_string[hash] && @hash_to_short_string[hash] != s\n # Collision! Add some random junk and keep trying.\n nonce = SecureRandom.hex\n else\n @hash_to_short_string[hash] = s\n @short_string_to_hash[s] = hash\n\n return hash\n end\n end\n end", "def predicate_string_term predicate\n if predicate[0] == '^'\n \"^<#{predicate[1..predicate.length-1]}>\"\n else\n \"<#{predicate}>\"\n end\nend", "def backspace_compare(s1,s2)\n\tget_filtered_str(s1) == get_filtered_str(s2)\nend", "def txString(s, line)\r\n @transform = true\r\n sent,new_sent = parseSentance(s, line, 0)\r\n matches = parseSentance(s, line, 0)\r\n good_matches = []\r\n matches.each do |match|\r\n sent, new_sent = match\r\n if sent == line\r\n good_matches << [ sent, new_sent ]\r\n end\r\n end\r\n return [ [-1, \"Failed to match given string:\" + line] ] unless good_matches.size > 0\r\n good_matches\r\n end", "def triangular_word?(string)\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n sum = 0\n string.each_char do |char|\n sum += alpha.index(char) + 1\n end\n triangularNum?(sum)\nend", "def find_the_difference(s, t)\n histogram = {}\n s.each_char do |char|\n if histogram[char]\n histogram[char] += 1\n else\n histogram[char] = 1\n end\n end\n\n t.each_char do |char|\n if histogram[char]\n histogram[char] -= 1\n return char if histogram[char] == -1\n else\n return char\n end\n end\nend", "def triplet_true?(str)\n str.each_char.with_index { |char, i| return true if char * 3 == str[i...i+3] }\n false\nend", "def non_unique_letters(string)\nend", "def backspace_compare(s, t)\r\n while s.include?(\"#\") do s.gsub!(/(^#+)|\\w#/, '') end\r\n while t.include?(\"#\") do t.gsub!(/(^#+)|\\w#/, '') end\r\n s == t\r\nend", "def solve s\n s.chars.map{|letter| letter.upcase == letter ? 'upper' : 'lower'}.count('upper') > 0.5*s.length ? s.upcase : s.downcase\nend", "def test_seqence_valid17\n result = engine(\"TRUMP12%\")\n refute(result, \"'TRUMP12%' should not be valid because it does not contain lower case letters.\")\n end", "def levenshtein_distance(s, t)\n m = s.length\n n = t.length\n return m if n == 0\n return n if m == 0\n d = Array.new(m + 1) { Array.new(n + 1) }\n\n (0..m).each { |i| d[i][0] = i }\n (0..n).each { |j| d[0][j] = j }\n (1..n).each do |j|\n (1..m).each do |i|\n d[i][j] = if s[i - 1] == t[j - 1] # adjust index into string\n d[i - 1][j -1] # no operation required\n else\n [d[i - 1][j]+1, # deletion\n d[i][j - 1]+1, # insertion\n d[i - 1][j - 1]+1, # substitution\n ].min\n end\n end\n end\n\n d[m][n]\n end", "def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend", "def XO(str)\n p = str.downcase\n g = p.count(\"x\")\n h = p.count(\"o\")\n (g == h ? true : false)\nend", "def substrings(string)\r\n \r\nend", "def soundex_str(str); end", "def soundex_str(str); end", "def scramble(s1,s2)\n s2.chars.each { |letter| return false unless s1.slice!(letter) }\n true\nend", "def num_distinct(s, t)\n len = t.size\n prefix = [1] + [0]*len # => [1, 0, 0, 0, 0, 0, 0] will happen\n s.chars.each do |char|\n len.downto(1) {|i| prefix[i]=prefix[i-1]+prefix[i] if t[i-1]==char}\n end\n p prefix\n prefix[-1]\nend", "def levenshtein_distance(s, t)\n m = s.length\n n = t.length\n return m if n == 0\n return n if m == 0\n d = Array.new(m+1) { Array.new(n+1) }\n\n (0..m).each { |i| d[i][0] = i }\n (0..n).each { |j| d[0][j] = j }\n (1..n).each do |j|\n (1..m).each do |i|\n d[i][j] = if s[i-1] == t[j-1] # adjust index into string\n d[i-1][j-1] # no operation required\n else\n [d[i-1][j]+1, # deletion\n d[i][j-1]+1, # insertion\n d[i-1][j-1]+1, # substitution\n ].min\n end\n end\n end\n d[m][n]\nend", "def string_rotation?(str1, str2)\n\nend", "def triplet_true(str)\n triplet = false\n\n str.each_char.with_index do |char,idx|\n triplet = true if str[idx + 1] == char && str[idx + 2] == char \n end\n triplet\nend", "def levenshtein_distance(s, t)\n m = s.length\n n = t.length\n return m if n == 0\n return n if m == 0\n d = Array.new(m+1) {Array.new(n+1)}\n\n (0..m).each {|i| d[i][0] = i}\n (0..n).each {|j| d[0][j] = j}\n (1..n).each do |j|\n (1..m).each do |i|\n d[i][j] = if s[i-1] == t[j-1] # adjust index into string\n d[i-1][j-1] # no operation required\n else\n [ d[i-1][j]+1, # deletion\n d[i][j-1]+1, # insertion\n d[i-1][j-1]+1, # substitution\n ].min\n end\n end\n end\n d[m][n]\n end", "def solve(s0, s1)\n # shift and push the first letter of the array length number of times\n # check if s0 == s1 each time\n return true if s0 == s1\n \n rotations = s0.length\n \n s0_arr = s0.split('')\n s1_arr = s1.split('')\n until s0_arr == s1_arr || rotations == 0\n s0_arr == s0_arr.push(s0_arr.shift)\n rotations -= 1\n return true if s0_arr == s1_arr\n end\n return false\nend", "def find_the_difference(s, t)\n s_hash = Hash.new(0)\n t_hash = Hash.new(0)\n first = s.split(\"\")\n last = t.split(\"\")\n first.map { |letter| s_hash[letter] += 1 }\n last.map { |letter| t_hash[letter] += 1 }\n (t_hash.to_a - s_hash.to_a).flatten[0]\nend", "def test_seqence_valid16\n result = engine(\"trump12%\")\n refute(result, \"'trump12%' should not be valid because it does not contain upper case letters.\")\n end", "def for_cs_sake(string)\nend", "def xor(codes, string)\n Array.new([codes.size, string.size].min) { |i| codes[i] ^ string[i].ord }.map(&:chr).join\nend", "def test_sequence_valid15\n result = engine(\"Trump12%\")\n assert(result, \"'Trump12%' should be valid because it contains caps, lowers, numbers and non-alpha-numerics.\")\n end", "def find_subs(string)\n result = []\n arr = string.chars\n arr.each_index do |outer_idx|\n (arr.size - outer_idx).times do |inner_idx|\n result << arr[outer_idx..(inner_idx + outer_idx)].join\n end\n end\n result\nend", "def is_subsequence(s, t)\n t_id = 0\n s_id = 0\n while t_id < t.length && s_id < s.length\n s_id += 1 if t[t_id] == s[s_id]\n t_id += 1\n end\n s_id == s.length\nend", "def levenshtein_distance(s, t)\n m = s.length\n n = t.length\n return m if n == 0\n return n if m == 0\n d = Array.new(m+1) {Array.new(n+1)}\n\n (0..m).each {|i| d[i][0] = i}\n (0..n).each {|j| d[0][j] = j}\n (1..n).each do |j|\n (1..m).each do |i|\n d[i][j] = if s[i-1] == t[j-1] # adjust index into string\n d[i-1][j-1] # no operation required\n else\n [ d[i-1][j]+1, # deletion\n d[i][j-1]+1, # insertion\n d[i-1][j-1]+1, # substitution\n ].min\n end\n end\n end\n d[m][n]\nend", "def brutus_cipher(string)\n\tresult = \"\"\n\tis_letter = /[a-zA-Z]/\n\tfor x in 0...string.length do\n\t\tputs \"For loop iterating...\"\n\t\tif is_letter.match(string[x])\n\t\t\tif string[x].ord.between?(88, 91) || string[x].ord > 119\n\t\t\t\tresult += (string[x].ord - 23).chr\n\t\t\telse\n\t\t\t\tresult += (string[x].ord + 3).chr\n\t\t\tend\n\t\telse\n\t\t\tresult += string[x]\n\t\tend\n\tend\n\treturn result\nend", "def scramble(s1,s2)\n s2.chars.all? { |c| s1.sub!(c, '') }\nend", "def vigenere_cipher(str,keys)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_str += alpha[new_pos % alpha.length]\n end\n\n new_str\n\nend", "def find_subs(str)\n result = []\n str.chars.each_index do |current_idx|\n (str.size - current_idx).times do |inner_idx|\n result << str[current_idx..(current_idx + inner_idx)]\n end\n end\n p result\nend", "def valid(str)\n direction = Hash.new(0)\n str.each_char do |ch|\n direction[ch] += 1\n end\n if (direction['n'] == direction['s'] && direction['e'] == direction['w'])\n print true\n else\n print false\n end\n\n\nend", "def phase_one?(str1,str2)\n dictionary = str1.chars.permutation.to_a\n dictionary.include?(str2.chars)\nend", "def processString(s=@orig_string) \n # All LaTeX Macron codes begin with an '=' token. Scan for that using a \n # RegEx. The value is set to firstSlash. \n \n firstSlash = s =~ /(\\\\=.*?\\})/\n return s if $1.nil?\n \n testChar = $1\n \n # In the event that the first character is macron-bearing follow this \n # case. \n if firstSlash == 0\n return processChar(testChar).to_s +\n processString(s[firstSlash+testChar.length..s.length])\n end\n \n # In the more general case, we take the original string up to the first\n # macron-beginning-slash. We return that + running processChar on the\n # remainder of the string, that is return part_ok +\n # processString(the_rest).\n \n return s[0..firstSlash-1] + processChar(testChar).to_s +\n processString(s[firstSlash+testChar.length..s.length])\n end", "def three_char(letter, letter_hash) # letter hash of 8 values\n\ti = (0 ... letter.length).find_all { |ind| s[ind] == '?' } # Index # of ?s\n\tpos_let = []\n\tmod_let_hash = {}\n\n\tletter_hash.each do |k, v|\n\t\tv_arry = v.split('')\n\t\ti.each do |ind|\n\t\t\tv_arry[ind] == '?'\n\t\tend\n\t\tv_arry.join\n\t\tmod_let_hash[k] = v_arry\n\tend\n\n\tmod_let_hash.each do |k,v|\n\t\tif v == letter\n\t\t\tpos_let << k\n\t\tend\n\tend\n\tpos_let\nend", "def SimpleSymbols(str)\n\n #1. surround the string by ='s\n #2. begin looping\n #3. look for letters\n #4. check if letters surround by a + on both sides\n #5. return false if they aren't\n #6. end loop\n #7. return true\n\n str = '=' + str + '='\n\n (0..str.length-1).each do |i|\n if /[a-zA-Z]/.match(str[i])\n if str[i-1] != '+' or str[i+1] != '+'\n return false\n end\n end\n end\n return true\n\nend", "def triplet_true?(str)\n str.each_char.with_index do |char, idx|\n return true if char == str[idx+1] && char == str[idx+2]\n end\n false\nend", "def triangular_word?(str)\n alpha = ('a'..'z').to_a\n sum = 0\n\n str.each_char do |char|\n sum += alpha.index(char) + 1\n end\n\n #tri_num = 1\n i = 1\n\n while i * (i + 1) / 2 < sum\n i += 1\n end\n\n i * (i + 1) / 2 == sum\n\nend", "def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend", "def lh(t, s, c)\n\n end", "def vigenere_cipher(string, keys)\n alpha = ('a'..'z').to_a\n new_word = \"\"\n\n string.each_char.with_index do |char, idx|\n old_idx = alpha.index(char)\n new_idx = old_idx + keys[idx % keys.length]\n new_char = alpha[new_idx % alpha.length]\n new_word += new_char\n end\n\n new_word\nend", "def test_seqence_valid20\n result = engine(\"DonTrump%\")\n refute(result, \"'DonTrump%' should not be valid because it is too short in length.\")\n end", "def movingShift(s, shift)\nres = ''\n s.chars.each do |x|\n ord = x.ord\n if x.ord > 64 && x.ord < 91\n ord = ((ord - 65 + shift) % 26) + 65\n else\n if x.ord > 96 && x.ord < 123\n ord = ((ord - 97 + shift) % 26) + 97\n end\n end\n shift+=1\n res += ord.chr\n end\n l = (res.length/5.0).ceil\nputs l\nputs res\n [res[0..l-1], res[l..2*len-1],res[2*l..3*l-1],res[3*l..4*len-1],res[4*l..-1]]\nend", "def scramble(st1, st2)\n st1_arr = st1.chars\n st2_arr = st2.chars\n st2_arr.all? { |char| st1_arr.count(char) >= st2.count(char) }\nend", "def nice_b?(string)\n doubledouble = false\n xyx = false\n\n pairs = Set.new\n i = 1\n while doubledouble == false && i <= string.length\n pair = \"#{string[i - 1]}#{string[i]}\"\n doubledouble = pairs.include?(pair) unless doubledouble == true\n pairs.add(pair)\n\n i += 1 if string[i] == string[i - 1] && string[i] == string[i + 1]\n i += 1\n end\n\n for idx in (1..string.length)\n curr_char = string[idx - 1]\n thrd_char = string[idx + 1]\n\n xyx ||= (curr_char == thrd_char)\n\n end\n doubledouble && xyx\nend", "def sortByStrings2(s, t)\n str_to_sort = s.split(\"\")\n sort_by_str = t.split(\"\")\n answer = \"\"\n repeated_chars = {}\n #build a hash of characters needed to sort, and their freq\n str_to_sort.each do |letter|\n if repeated_chars.has_key?(letter)\n repeated_chars[letter] += 1\n else \n repeated_chars[letter] = 1\n end \n end\n #add them to the answer string as they occur in the rule string, repeating by their freq\n sort_by_str.each do |letter|\n if repeated_chars.has_key?(letter)\n (repeated_chars[letter]).times do\n answer += letter\n end\n end \n end\n answer\nend", "def cipher(x,s)\n l = s.downcase.gsub(\" \", \"\").split(\"\")\n e = []\n a = (\"a\"..\"z\").to_a\n l.each do |v|\n e << a.find_index(v)\n end\n b = a.shift(x)\n a << b\n key = a.flatten\n u = []\n e.each do |v|\n u << key.at(v)\n end\n final = u.join\n puts final\nend", "def double_metaphone(str); end", "def is_anagram(s, t)\n return false if s.size != t.size\n\n s_dic = Array.new(26, 0)\n t_dic = Array.new(26, 0)\n\n a_ord = 'a'.ord\n s.each_char { |c| s_dic[c.ord - a_ord] += 1 }\n t.each_char { |c| t_dic[c.ord - a_ord] += 1 }\n\n s_dic == t_dic\nend", "def isSubstring (s1, s2)\n return false unless s1.length == s2.length\n return true if s1 == s2\n s1_chars = s1.chars\n s2_chars = s2.chars\n\n i = 0\n while i < s1.length\n return true if s1_chars == s2.chars\n s1_chars.rotate!\n i += 1\n end\n false\nend", "def XO(str)\n str.downcase.count('x') == str.downcase.count('o')\n\nend", "def character_by_character(string)\nend", "def xor_strings(s1, s2)\r\n s1.unpack('C*').zip(s2.unpack('C*')).map { |a, b| a ^ b }.pack('C*')\r\n end", "def spin(string)\n spin = string.split(' ').map { |s| s.length >= 5 ? s.reverse : s }\n spin.join(' ')\nend", "def can_tweak_sign?(normal_sign, vandalized_sign)\n str = normal_sign.delete \",.!?';\".downcase\n letters = character_count(str)\n vandalized_sign.each_char do |char|\n char = char.downcase\n return false if letters[char].nil? || letters[char].zero?\n\n letters[char] -= 1\n end\n true\nend", "def ex_oh(str)\n str.downcase.scan(/x/).count == str.downcase.scan(/o/).count\nend", "def XO(str)\n str.downcase.count(\"x\") === str.downcase.count(\"o\")\nend", "def kisses(to)\n 'x' * to.gsub(/[^A-Z]/, '').length\nend", "def scramble(s1,s2)\n pile_of_letters = s1.chars\n target_letters = s2.chars\n target_letters.uniq.all? { |letter| pile_of_letters.count(letter) >= target_letters.count(letter) }\nend", "def test_seqence_valid19\n result = engine(\"TrumppasswORd12%\")\n refute(result, \"'Trump1%' should not be valid because it contains password.\")\n end" ]
[ "0.62537557", "0.590668", "0.58795315", "0.5796636", "0.57098556", "0.5688818", "0.56802994", "0.56522447", "0.5647781", "0.5647702", "0.5615694", "0.5606609", "0.55827665", "0.55790293", "0.5571723", "0.5561692", "0.5556649", "0.55564815", "0.5525966", "0.54822415", "0.54776317", "0.5457037", "0.5456916", "0.5456285", "0.5448407", "0.544789", "0.54435277", "0.544186", "0.54286945", "0.542017", "0.54170823", "0.54146695", "0.5408379", "0.5403714", "0.5400049", "0.53906465", "0.53896946", "0.5388661", "0.537624", "0.5364586", "0.53584397", "0.53462183", "0.5345917", "0.5340785", "0.53314674", "0.5328993", "0.5324427", "0.5320062", "0.53153676", "0.5308378", "0.52941847", "0.52941847", "0.5286645", "0.52743727", "0.52727306", "0.526248", "0.52579564", "0.52578473", "0.5257353", "0.52547544", "0.52512544", "0.52416885", "0.5235742", "0.52337605", "0.52328223", "0.5229809", "0.522701", "0.5220711", "0.52204543", "0.52194923", "0.5218762", "0.52156", "0.52154166", "0.52108693", "0.520872", "0.51982564", "0.51919544", "0.51916987", "0.51906145", "0.51894915", "0.5188252", "0.5187682", "0.5183229", "0.51827806", "0.5178368", "0.51757544", "0.5172476", "0.51723504", "0.5167913", "0.51656735", "0.5163902", "0.5162924", "0.51625496", "0.5161759", "0.51593834", "0.5156952", "0.51568824", "0.5153619", "0.5148075", "0.5145171" ]
0.5470403
21
Saves the current state of all merged entities. For more complete error reporting, this method attempts to save all entities regardless of whether or not a previous entity or set of entities failed to save. However, it will return true if and only if all entities were saved. When data dependencies exist, this can lead to spurious errors; however, that can be dealt with by just looking further up in the log. There's no similar way to discover errors that aren't reported due to an early abort.
def save collections = [participants, people, contacts, events, instruments, response_sets, question_response_sets ].map { |c| current_for(c).compact } ActiveRecord::Base.transaction do collections.map { |c| save_collection(c) }.all?.tap do |ok| if ok logger.debug { "Re-saving response sets" } current_for(response_sets).select { |rs| rs }.each { |rs| rs.target.reload.save } logger.info { 'Merge saved' } else logger.fatal { 'Errors raised during save; rolling back' } raise ActiveRecord::Rollback end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def committed?\n @saved\n end", "def save\n save!\n rescue StandardError\n false\n end", "def save\n begin\n save!\n true\n rescue\n false\n end\n end", "def save!\n unless save\n self.class.fail_validate!(self) unless errors.empty?\n end\n return true\n end", "def save *entities\n @commit.save(*entities)\n # Do not save yet\n entities\n end", "def save!\n raise \"#{self.inspect} failed to save\" unless self.save\n true\n end", "def saved?\n return false if not self.valid?\n return self.saved \n end", "def save_with_frbr\n logger.debug \"Saving with frbr for work\"\n begin\n transaction do\n logger.debug \"**TRACE1**\"\n save! #This will throw an exception if it fails\n logger.debug \"**TRACE2 expression has id #{self.expression_id}**\"\n update_frbr_for_expression_work_relationship(self.updated_by) #This also throws an exception if it fails\n logger.debug \"**TRACE3 - relationship added\"\n end\n rescue Exception => e\n logger.debug \"Exception: #{e.class}: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n\n logger.debug \"**TRACE4**\"\n return false\n end\n\n logger.debug \"TRACEDONE\"\n #Got this far so all good\n return true\n end", "def save\n if valid?\n persist!\n true\n else\n false\n end\n end", "def save_with_dirty_tracking(*args)\n if save_without_dirty_tracking(*args)\n self.make_changes_current\n if args.first.is_a?(Hash) && args.first[:include_associations]\n args.first[:include_associations].each do |assoc|\n Array.wrap(self.send(assoc).internal_object).each(&:make_changes_current)\n end\n end\n return true\n else\n return false\n end\n end", "def save(context = :default)\n # Takes a context, but does nothing with it. This is to maintain the\n # same API through out all of dm-more. dm-validations requires a\n # context to be passed\n\n associations_saved = false\n child_associations.each { |a| associations_saved |= a.save }\n\n saved = new_record? ? create : update\n\n if saved\n original_values.clear\n end\n\n parent_associations.each { |a| associations_saved |= a.save }\n\n # We should return true if the model (or any of its associations)\n # were saved.\n (saved | associations_saved) == true\n end", "def save!\n ActiveRecord::Base.transaction do\n raise ActiveRecord::RecordInvalid if plate_wrappers.blank?\n\n plate_wrappers.collect(&:save!)\n true\n end\n rescue ActiveRecord::RecordInvalid\n # we need to cascade the errors up to the current error object\n # otherwise it will look like there are no errors\n check_plates\n false\n end", "def save\n import\n errors.none?\n end", "def save\n Course::ExperiencePointsRecord.transaction { @experience_points_records.map(&:save!).all? }\n rescue ActiveRecord::RecordInvalid\n false\n end", "def successful?\n @successful #make it true if everything saved successfully\n end", "def saved_changes?\n mutations_before_last_save.any_changes?\n end", "def saved?\n @saved\n end", "def saved?\n !!@saved\n end", "def save\n !update_case.has_key?(\"error\")\n end", "def save!\n result = false\n\n if self.validate\n result = self.save_without_validation\n else\n raise Exceptions::Validations.new(self._errors)\n end\n\n result ? true : false\n end", "def saved?\n return @saved\n end", "def persisted?\n all_persisted?\n end", "def save\n\t\tif valid?\n\t\t\tpersist!\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def save\n result = false\n\n if self.validate\n result = self.save_without_validation\n end\n\n result ? true : false\n end", "def project_saved?\n begin \n @project.transaction do\n # validations\n ensure_unique_project_name!\n ensure_unique_tasks_names! \n # save\n save_project!\n save_tasks!\n end\n return true \n rescue Exception => e\n return false\n end \n end", "def verify_no_uncommitted_merge\n if !overwrite? && @working_changeset.parents.size > 1\n raise abort(\"outstanding uncommitted merges\")\n end\n end", "def save\n perform_mapping\n unless self.errors[:data].present?\n save_nested_models\n self.record.save\n end\n end", "def handle_silent_modification_failure?\n self[:raise_on_save_failure] == false\n end", "def save\n valid? ? persist! : false\n end", "def save_valid\n if self.valid_save?\n self.save\n else\n false\n end\n end", "def update_phase!()\n @involved_entities.each do |involved_entity|\n return false unless ( !involved_entity.has_to_update || execute_update!( involved_entity.entity_class ) )\n end\n return true\n end", "def saved?\n !new_record? && attributes == saved_attributes\n end", "def save\n if modified? and @entries and !@entries.empty?\n save!\n end\n end", "def save\n save_tries = 0\n begin\n return false unless file_set.save\n rescue RSolr::Error::Http => error\n ActiveFedora::Base.logger.warn \"CurationConcerns::FileSetActor#save Caught RSOLR error #{error.inspect}\"\n save_tries += 1\n # fail for good if the tries is greater than 3\n raise error if save_tries >= 3\n sleep 0.01\n retry\n end\n yield if block_given?\n true\n end", "def only_saves_changes?\n only_save_changes\n end", "def has_changes_to_save?\n mutations_from_database.any_changes?\n end", "def save\n self.save! rescue false\n end", "def save(*args)\n if persisted? && (changes.keys - %w(history_ended_at)).any?\n false\n else\n super\n end\n end", "def save(obj)\r\n # if obj.errors.empty?\r\n set_or_replace_record obj\r\n # true\r\n # else\r\n # false\r\n # end\r\n end", "def saved?\n parent && parent.saved?\n end", "def save\n if valid?\n if !persisted?\n # Object create\n # A git object with that id already exists\n return false if self.class.exists?(id)\n else\n # Object update\n # No git ID with the current id exists\n # You are not allowed to change the ID of an object\n return false if !self.class.exists?(id)\n end\n\n clear_cached_vars\n Regulate::Git::Interface.save({\n :id => id,\n :commit_message => commit_message || \"#{ ( persisted? ) ? \"Updating\" : \"Creating\" } resource #{title}\",\n :author_name => author_name,\n :author_email => author_email,\n :attributes => attributes.to_json(:except => ['author_email', 'author_name', 'commit_message']),\n :rendered => build_rendered_html\n })\n @persisted = true\n else\n false\n end\n end", "def save_all(game_objects)\n log \"Saving given objects (#{game_objects.length})...please wait...\"\n @saved = 0\n game_objects.each do |o|\n if o.is_a? Player\n save_player(o)\n else\n store_object(o)\n end\n end\n log \"...done saving objects (#{@saved}).\"\n end", "def save\n create_or_update\n return true\n end", "def merge?\n parents.size > 1\n end", "def save(*args)\n return false unless valid?\n\n ActiveRecord::Base.transaction do\n begin\n associates.all? do |associate|\n send(associate.name).send(:save!, *args)\n end\n rescue ActiveRecord::RecordInvalid\n false\n end\n end\n end", "def save?\n save == true\n end", "def save_without_revision\n save_without_revision!\n true\n rescue\n false\n end", "def save\n self.save! rescue false\n end", "def save_only_when_valid\n if valid?\n save_without_ensure\n else\n false\n end\n end", "def save\n return false unless valid?\n @dirty.each do |key|\n @cache[key].model_id = @model.id\n @cache[key].save\n end\n @dirty = []\n true\n end", "def saved?\n @saved\n end", "def save!\n fail(InvalidDocumentError.new(self)) unless save\n true\n end", "def save!\n fail(InvalidDocumentError.new(self)) unless save\n true\n end", "def save\n return false if not self.valid?\n return self.class.write(self)\n end", "def save(*)\n create_or_update\n rescue RecordInvalid\n false\n end", "def save_modified_associations!\n @association_cache.values.each do |collection|\n if collection.changed?\n collection.save!\n end\n end\n true\n end", "def persisted?\n @saved\n end", "def save_changes\n save(:changed=>true) || false unless @changed_columns.empty?\n end", "def save\n return unless self.class.configured?\n\n report_exception\n end", "def default_save(new_model)\n if new_model.non_duplicative_save\n logger.info \"Saved validated model of type '#{new_model.class}' with id: #{new_model.id}\\n\"\n return true\n else\n logger.info \"Validated model of type '#{new_model.class}' already existed and was not saved\"\n end\n end", "def with_unsaved_associated\n associations_for_update.map do |assoc|\n association_proxy = association(assoc.name)\n if association_proxy.target.present?\n records = association_proxy.target\n records = [records] unless records.is_a? Array # convert singular associations into collections for ease of use\n # must use select instead of find_all, which Rails overrides on association proxies for db access\n records.select { |r| r.unsaved? && !r.readonly? }.map { |r| yield r }.all?\n else\n true\n end\n end.all?\n end", "def save?(locations, user)\n saved = self.save ? true : false\n\n # update owner info\n self.owner << user\n\n # update location info\n Location.find(locations).each do |location|\n unless self.locations.include? location\n self.locations << location\n end\n end\n\n return saved\n end", "def save(options={})\n result = perform_validations(options) ? super : false\n if !result\n Neo4j::Rails::Transaction.fail if Neo4j::Rails::Transaction.running?\n end\n result\n end", "def resource_saved?\n resource.save unless resource.validation_attempted?\n resource.saved?\n end", "def apply!(options={})\n should_ignore_conflict = options.fetch(:ignore_conflict, false)\n should_save = options.fetch(:save, true)\n if !should_ignore_conflict\n return false unless applyable?\n end\n apply(options)\n if should_save\n # Maybe too much responsibility?\n # Or, this should be a transaction. Feels bloated.\n development.save if self.save\n end\n end", "def save(options = {})\n perform_validations(options) ? save_without_raising(options) : false\n end", "def already_persisted?\n false\n end", "def save\n return false unless valid?\n\n @request_wrappers.all?(&:save)\n end", "def save!\n valid?\n end", "def save(bulk = false)\n caught = catch(:halt) do\n if self.new?\n _run_save_callbacks do\n save_without_callbacks(bulk)\n end\n else\n update(bulk)\n end\n end\n end", "def persistable?\n _base.persisted? && !_binding? && !_building? && !_assigning?\n end", "def save(*)\n if (status = super)\n changes_applied\n end\n\n status\n end", "def save(options={})\n begin\n self.save!(options)\n rescue FailedRequest\n return(false)\n end\n return(true)\n end", "def save(*)\n if status = super\n changes_applied\n end\n status\n end", "def save\n valid? && create.success?\n end", "def save_unknown!\n\t\t @saved = []\n\t end", "def _save_to_store\n self._warnings = []\n _commit_externals \n __pack.commit # TODO: need to add some error catching and roll back the external saves where needed\n end", "def upload_done(ids)\n # Forces a check that the supplied info is correct\n self.previous_uploads = ids.map { |id| NfsStore::Upload.find(id) }\n self.previous_upload_stored_file_ids = previous_uploads.map(&:nfs_store_stored_file_id)\n\n # Get any uploads that already have an upload_set, since it is invalid to reset it\n raise FsException::Action, \"Upload set files don't match\" if previous_uploads.map(&:upload_set).uniq.length != 1\n\n return unless parent_item&.can_edit?\n\n extra_options_config.calc_save_trigger_if self, alt_on: :upload\n end", "def persisted?\n object.respond_to?(:persisted?) && object.persisted?\n end", "def save\n begin\n create_or_update\n rescue ActiveRecord::RecordInvalid\n false\n end\n end", "def save_observation(observation)\n return true if observation.save\n\n flash_error(:runtime_no_save_observation.t)\n flash_object_errors(observation)\n false\n end", "def saved?\n self.class.exists?(self.hash)\n end", "def save\n dump_attributes!\n # return false if opts[:validate] != false && !valid?\n self.class.database.store(self)\n true\n end", "def command_save\n if @dbChanged == true\n @database.save\n @dbChanged = false\n end\n if @logChanged == true\n @log.save\n @logChanged = false\n end\n end", "def commit_required?\n @entry_set.each do |e|\n return true if e.dirty\n end\n @comment != @stored_comment || @entry_set != @stored_entries || @create\n end", "def prevent_double_save_bug\n false if self.persisted?\n end", "def saved?\n return !@realfile.nil?\n end", "def save!\n unless save\n errors = @model.errors.on(:preferences)\n errors = errors.join(\"\\n\") if errors.respond_to?(:join)\n raise PreferencesInvalid.new(\"Validation failed: \" + errors.to_s)\n end\n true\n end", "def save_with_validation\n save_without_validation\n true\n rescue ResourceInvalid => error\n errors.from_xml(error.response.body)\n false\n end", "def saved?\n Pv.tracker.project.stories.find(id).present?\n end", "def save!\n raise \"#{self.inspect} failed to save\" unless self.save\n end", "def save\n run_callbacks :save do\n return false unless valid?\n remote_attributes = remote_save(attributes)\n return false unless remote_attributes\n self.attributes = remote_attributes\n remotely_saved\n true\n end\n end", "def final_check_for_valid_sheetcells\n if has_invalid_values?\n self.finished = false\n save\n return false\n end\n\n self.finished = true\n save\n true\n end", "def saved?\n !new? && !@content\n end", "def save_results!\n ActiveRecord::Base.transaction do\n profiled_request.flamegraph = RailsMiniProfiler::Flamegraph.new(data: flamegraph) if flamegraph.present?\n profiled_request.save\n insert_traces unless traces.empty?\n end\n @saved = true\n end", "def dirty?\n @changes && @changes.size > 0\n end", "def sneaky_save(avoid_insert_conflict: nil)\n begin\n sneaky_create_or_update(avoid_insert_conflict: avoid_insert_conflict)\n rescue ActiveRecord::StatementInvalid\n false\n end\n end", "def dirty?\n @changes.length > 0\n end", "def save\n flush_deletes unless @options[:keep_old_files]\n process = only_process\n @queued_for_write.except!(:original) if process.any? && !process.include?(:original)\n flush_writes\n @dirty = false\n true\n end", "def flush\n @executors.each(&:flush)\n true\n end" ]
[ "0.6109903", "0.60229796", "0.59732074", "0.5901313", "0.5892655", "0.57836634", "0.57782817", "0.57714987", "0.57659143", "0.5695334", "0.5694243", "0.5682495", "0.56547755", "0.56536376", "0.56320524", "0.56197196", "0.5610536", "0.55997616", "0.5595881", "0.5588441", "0.55796593", "0.55583596", "0.55545443", "0.55504566", "0.5519656", "0.55161136", "0.5508316", "0.55060256", "0.5483889", "0.5461592", "0.5459231", "0.54422057", "0.54421026", "0.5441274", "0.54127777", "0.53945494", "0.5379681", "0.53426147", "0.53329384", "0.53202355", "0.5319315", "0.5316801", "0.53070265", "0.5299587", "0.5297438", "0.5295535", "0.52863574", "0.5283098", "0.5279317", "0.52753663", "0.5267541", "0.5252599", "0.5252599", "0.5246223", "0.5241238", "0.5210185", "0.52080595", "0.5201581", "0.51903147", "0.51902676", "0.519015", "0.51773816", "0.5174257", "0.5157301", "0.5155958", "0.5150787", "0.5141627", "0.5135737", "0.5129501", "0.5128109", "0.5125049", "0.51242906", "0.51220995", "0.5115885", "0.5104518", "0.510302", "0.5101225", "0.5100989", "0.5094903", "0.5086934", "0.50840664", "0.5069668", "0.5069222", "0.5061638", "0.5060263", "0.5056811", "0.50553757", "0.504496", "0.5043704", "0.5036404", "0.50343305", "0.5030508", "0.5025721", "0.5025652", "0.5023795", "0.50201494", "0.5015775", "0.50097317", "0.5004618", "0.50011367" ]
0.63260096
0
Adds and logs conflicts.
def add_conflict(entity, id, attr, o, c, p) logger.warn { "Detected conflict on #{entity} #{attr}: [o, c, p] = #{[o, c, p].inspect}" } conflicts.add(entity, id, attr, o, c, p) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conflicts\n @conflicts ||= []\n end", "def conflicts\n @conflicts ||= []\n end", "def message\n \"#{base} already defines #{conflicts}, also defined on #{owner}\"\n end", "def conflict(val)\n conflicts << val\n conflicts.dup\n end", "def conflict(val)\n conflicts << val\n conflicts.dup\n end", "def raise_if_conflicts # :nodoc:\n if has_conflicts?\n raise Gem::ConflictError.new self, conflicts\n end\n end", "def add_conflict(name, specifics)\n @conflicts << Requirement.parse(name, specifics)\n end", "def cannot_have_conflicts\n \terrors.add(:base, \"Conflicts with another reservation\") if self.has_conflicts?\n end", "def merge_conflict?; end", "def conflicts *syms\n syms.each { |sym| raise ArgumentError, \"unknown option '#{sym}'\" unless @specs[sym] }\n @constraints << [:conflicts, syms]\n end", "def conflicts=(conflicts)\n @conflicts = replace_self_version_dependencies(conflicts, 'conflicts')\n alias_of.conflicts = conflicts\n end", "def each_conflict(&block) # :yields: file, your_version, their_version\n self.lib.conflicts(&block)\n end", "def set_conflict\n @conflict = Conflict.find(params[:id])\n end", "def treat_reserved_as_conflict; end", "def mark_conflicted(filename)\n merge_state.mark_conflicted filename\n end", "def conflicts\n conflicts = {}\n self.runtime_dependencies.each do |dep|\n spec = Gem.loaded_specs[dep.name]\n if spec and not spec.satisfies_requirement? dep\n (conflicts[spec] ||= []) << dep\n end\n end\n env_req = Gem.env_requirement(name)\n (conflicts[self] ||= []) << env_req unless env_req.satisfied_by? version\n conflicts\n end", "def unwind_for_conflict\n details_for_unwind = build_details_for_unwind\n unwind_options = unused_unwind_options\n debug(depth) { \"Unwinding for conflict: #{requirement} to #{details_for_unwind.state_index / 2}\" }\n conflicts.tap do |c|\n sliced_states = states.slice!((details_for_unwind.state_index + 1)..-1)\n raise_error_unless_state(c)\n activated.rewind_to(sliced_states.first || :initial_state) if sliced_states\n state.conflicts = c\n state.unused_unwind_options = unwind_options\n filter_possibilities_after_unwind(details_for_unwind)\n index = states.size - 1\n @parents_of.each { |_, a| a.reject! { |i| i >= index } }\n state.unused_unwind_options.reject! { |uw| uw.state_index >= index }\n end\n end", "def insert_ignore\n insert_conflict\n end", "def offer_to_overwrite_conflicts\n @host.overwrite = \"true\" if @host.errors.any? and @host.errors.are_all_conflicts?\n end", "def conflicts=(conflicts)\n unless conflicts.kind_of?(Hash)\n raise(InvalidMetadata, \"conflicts must be a Hash\")\n end\n\n @conflicts.clear\n\n conflicts.each do |name, specifics|\n add_conflict(name, specifics)\n end\n end", "def create_conflict\n controller.create_conflict(resource: resource)\n end", "def check_conflict()\n check_results = []\n\n repo_name = github.pr_json[:base][:repo][:full_name]\n\n pull_requests = github.api.pull_requests(repo_name).select do |pr|\n pr[:id] != github.pr_json[:id] && pr[:base][:label] == github.pr_json[:base][:label]\n end\n\n return check_results if pull_requests.empty?\n\n g = Git.open(Dir.pwd)\n\n pull_requests.each do |pr|\n result = {\n pull_request: pr,\n mergeable: true,\n conflicts: []\n }\n\n uuid = SecureRandom.uuid\n\n r = g.add_remote(uuid, pr[:head][:repo][:ssh_url])\n r.fetch()\n\n branch1 = github.pr_json[:head][:ref]\n branch2 = \"#{uuid}/#{pr[:head][:ref]}\"\n\n base = `git merge-base #{branch1} #{branch2}`.chomp\n\n Tempfile.open('tmp') do |f|\n patch = `git format-patch #{base}..#{branch2} --stdout`.chomp\n f.sync = true\n f.puts patch\n out, s = Open3.capture2e(\"git apply --check #{f.path}\")\n\n out.each_line do |line|\n\n if 'patch failed' == line.split(':')[1].strip\n conflict = {\n file: line.split(':')[2].strip,\n line: line.split(':')[3].strip.to_i\n }\n result[:conflicts] << conflict\n end\n end\n\n result[:mergeable] = result[:conflicts].empty?\n end\n\n g.remove_remote(uuid)\n\n check_results << result\n end\n\n check_results\n end", "def detect_and_fix_resolvable_conflict_events\n events = RecordingEvent.active_user_recording_events(user)\n events.each do |e|\n overlap_type = self.class.overlap_type(self, e) \n unless overlap_type.nil?\n self.class.fix_resolvable_conflict_events(self, e, overlap_type)\n end\n end\n end", "def find_resident_session_conflict(resident_session)\n conflicting_resident_session = nil\n resident = resident_session.resident\n session = resident_session.session \n\n self.sessions.resident_sessions.all.each do |existing_resident_session|\n\n if existing_resident_session.resident.name == resident.name \n if existing_resident_session.session.overlaps? session\n #puts \" >>> found overlap...<<<\"\n conflicting_resident_session = existing_resident_session\n end\n \n #puts \">>> printing all conflicts after adding\"\n #puts all_conflicts\n #puts \"<<<\"\n end\n end\n \n conflicting_resident_session\n end", "def resolve\n debug do\n <<~MSG\n Filtering out #{conflicts.size} conflicts from #{base_local_diffs.size + base_remote_diffs.size} diffs\n Remaining diffs #{unconflicted_diffs.size}\n MSG\n end\n\n conflicts.each_with_object(unconflicted_diffs) do |conflict, diffs|\n # TODO: this will result in diffs being out of order from their\n # original order. diffs should be flagged as conflicted and\n # this method should instead remove the conflicted flag.\n diffs.concat(@conflict_resolver.resolve(conflict))\n # TODO: if the conflict is resolved, it should be removed from the\n # @conflicts array.\n end\n end", "def conflict_params\n params.require(:conflicts).permit(:date, :member_id)\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def conflicting_dependencies\n [@failed_dep.dependency, @activated.request.dependency]\n end", "def validate_duplicate_dependencies # :nodoc:\n # NOTE: see REFACTOR note in Gem::Dependency about types - this might be brittle\n seen = Gem::Dependency::TYPES.inject({}) {|types, type| types.merge({ type => {}}) }\n\n error_messages = []\n @specification.dependencies.each do |dep|\n if prev = seen[dep.type][dep.name]\n error_messages << <<-MESSAGE\nduplicate dependency on #{dep}, (#{prev.requirement}) use:\n add_#{dep.type}_dependency '#{dep.name}', '#{dep.requirement}', '#{prev.requirement}'\n MESSAGE\n end\n\n seen[dep.type][dep.name] = dep\n end\n if error_messages.any?\n error error_messages.join\n end\n end", "def check_version_conflict(other) # :nodoc:\n return if self.version == other.version\n\n # This gem is already loaded. If the currently loaded gem is not in the\n # list of candidate gems, then we have a version conflict.\n\n msg = \"can't activate #{full_name}, already activated #{other.full_name}\"\n\n e = Gem::LoadError.new msg\n e.name = self.name\n\n raise e\n end", "def treat_reserved_as_conflict=(_arg0); end", "def conflict(exception)\n # had to remove as gives away details of our db structure.\n # TODO: come up with solution to give further details\n if exception.is_a? ApiBase::Conflict\n message = exception.message || \"Conflict\"\n else\n message = \"Conflict\"\n end\n render status: :conflict, json: { message: message } \n end", "def on_conflict_sql(sql)\n @sql_on_conflict = sql\n self\n end", "def explain\n \"<Conflict wanted: #{@failed_dep}, had: #{activated.spec.full_name}>\"\n end", "def explain\n \"<Conflict wanted: #{@failed_dep}, had: #{activated.spec.full_name}>\"\n end", "def conflict_params\n params.require(:conflict).permit(:responsibility_id, :control_id)\n end", "def check_conflict_and_comment()\n results = check_conflict()\n\n results.each do |result|\n next if result[:mergeable]\n message = \"<p>This PR conflicts with <a href=\\\"#{result[:pull_request][:html_url]}\\\">##{result[:pull_request][:number]}</a>.</p>\"\n table = '<table><thead><tr><th width=\"100%\">File</th><th>Line</th></tr></thead><tbody>' + result[:conflicts].map do |conflict|\n file = conflict[:file]\n line = conflict[:line]\n line_link = \"#{result[:pull_request][:head][:repo][:html_url]}/blob/#{result[:pull_request][:head][:ref]}/#{file}#L#{line}\"\n \"<tr><td>#{file}</td><td><a href=\\\"#{line_link}\\\">#L#{line}</a></td></tr>\"\n end.join('') + '</tbody></table>'\n puts (message + table)\n warn(\"<div>\" + message + table + \"</div>\")\n end\n\n results\n end", "def mostrar_conflictos\n @conflictos= Paciente.find(params[:id]).cuestionario_conflictos\n end", "def allow_conflicts\n ((s = self.sections[\"Settings\"]) &&\n (a = s.attributes[\"AllowSetConflicts\"]) &&\n (a.value.pri == '1'))\n end", "def external_incompatibilities\n if conflict?\n [\n cause.conflict,\n cause.other\n ].flat_map(&:external_incompatibilities)\n else\n [this]\n end\n end", "def resolve(conflict)\n return [] unless @config.interactive\n base_local_diffs = conflict.base_local_diffs\n base_remote_diffs = conflict.base_remote_diffs\n choice = @hl.choose do |menu|\n menu.prompt = conflict\n menu.choice(:local, text: base_local_diffs.map(&:to_s).join(\"\\n\\t\\t\"))\n menu.choice(:remote, text: base_remote_diffs.map(&:to_s).join(\"\\n\\t\\t\"))\n # menu.choice(:neither, help: \"Don't choose either set of diffs\")\n # menu.choice(:edit, help: \"Edit the diffs (coming soon)\")\n # menu.choice(:quit, help: \"I'm in over my head. Just stop!\")\n menu.select_by = :index_or_name\n end\n case choice\n when :local\n base_local_diffs\n when :remote\n base_remote_diffs\n else\n error \"Unexpected choice #{choice.inspect}.\"\n end\n end", "def options_conflicts_with\n data.options_conflicts_with\n end", "def index\n @conflicts = Conflict.all\n end", "def create\n @conflict = Conflict.new(conflict_params)\n\n respond_to do |format|\n if @conflict.save\n format.html { redirect_to @conflict, notice: 'Conflict was successfully created.' }\n format.json { render :show, status: :created, location: @conflict }\n else\n format.html { render :new }\n format.json { render json: @conflict.errors, status: :unprocessable_entity }\n end\n end\n end", "def revert_conflicts\r\n self.update_conflicts(-1)\r\n #@tile.hit()\r\n end", "def try_resolve_conflict\n # retry the merge\n working_changeset = self[nil]\n merge_changeset = working_changeset.parents.last\n \n # backup the current file to a .resolve file (but retain the extension\n # so editors that rely on extensions won't bug out)\n path = working_join file\n File.copy(path, path + \".resolve\" + File.extname(path))\n \n # try to merge the files!\n merge_state.resolve(file, working_changeset, merge_changeset)\n \n # restore the backup to .orig (overwriting the old one)\n File.move(path + \".resolve\" + File.extname(path), path + \".orig\" + File.extname(path))\n end", "def on_conflict(column = nil)\n ::MultiInsert::Query::OnConflict.new(self, column)\n end", "def conflicts(s1,e1,s2,e2)\n if s1<=s2 and e1>s2\n return true\n elsif s1<e2 and s1>s2\n return true\n end\n return false\n end", "def check_conflicts(list)\n #return if force?\n list.each do |action, loc, tname, fname, opts|\n tpath = loc + tname\n fpath = output + fname\n if File.exist?(fpath)\n if tpath.directory?\n if !fpath.directory?\n raise \"Directory to be created clashes with a pre-existent file -- #{fname}\"\n end\n else\n if fpath.directory?\n raise \"File to be created clashes with a pre-existent directory -- #{fname}\"\n end\n end\n end\n end\n end", "def conflicts\n if new_record?\n query = 'unit_id = ? AND daterange(start_at, end_at) && daterange(?, ?)'\n Reservation.where(query, unit_id, start_at, end_at)\n else\n query = 'id <> ? AND unit_id = ? AND daterange(start_at, end_at) && daterange(?, ?)'\n Reservation.where(query, id, unit_id, start_at, end_at)\n end\n end", "def resolve_conflicts_and_versions(opts = {})\n # TODO: currently module refs al nailed as opposed to version contraints; when there are\n # version contraints; this methdo will take care of them\n ResolveModules.resolve_conflicts(self, opts)\n end", "def update\n respond_to do |format|\n if @conflict.update(conflict_params)\n format.html { redirect_to @conflict, notice: 'Conflict was successfully updated.' }\n format.json { render :show, status: :ok, location: @conflict }\n else\n format.html { render :edit }\n format.json { render json: @conflict.errors, status: :unprocessable_entity }\n end\n end\n end", "def method_conflicts\n (@module.instance_methods + @module.private_instance_methods) &\n (Boson.main_object.methods + Boson.main_object.private_methods)\n end", "def conflict?(other)\n return false unless self.class == other.class\n self.eql?(other) && self != other\n end", "def merge_conflict?\n prefix == 'U'\n end", "def conflicts\n @grid.values.select { |claims| claims.size > 1 }\n end", "def resolve_conflict(closed = nil)\n closed = [] if not closed\n conflicts = users_events.select{|e| e.start_time < self.end_bound && e.end_time > self.start_bound}.sort{|a,b| a.start_time <=> b.start_time}\n conflicts -= [self]\n # Sort the list of conflicts to pick the events which are more likely to be able to move without conflict\n sorted_conflicts = conflicts.sort{|a,b| (to_min(b.end_bound) - to_min(b.start_bound) - to_min(b.duration)) <=> (to_min(a.end_bound) - to_min(a.start_bound) - to_min(a.duration))}\n\n if conflicts.size == 1\n c = conflicts.first\n if c.static?\n return false\n end\n \n # With only one conflict, you don't have to check if moving allows you to place the event\n # Check to see if c can be moved. If it can, set new_time to the time that c can be moved to.\n if new_time = c.move?(self)\n self.move(self.start_bound)\n c.move(new_time)\n self.save\n c.save\n return true\n else\n if !closed.include?(c) && c.resolve_conflict(closed)\n self.move(self.start_bound)\n self.save\n return true\n else\n closed << c\n end\n end\n return false\n end\n \n sorted_conflicts.each do |c|\n \n # If the conflict is static, no point in even check if moving helps\n if c.static?\n next\n end\n\n index = conflicts.index(c)\n prev_c = conflicts[index - 1]\n\n # In case this conflict is the earliest conflict possible\n if index == 0\n if to_min(c.end_time) - to_min(self.start_bound) >= to_min(self.duration)\n if new_time = c.move?(self)\n self.move(self.start_bound)\n c.move(new_time)\n self.save\n c.save\n return true\n else\n if !closed.includes?(c) && c.resolve_conflict\n self.move(self.start_bound)\n self.save\n return true\n else\n closed << c\n end\n end\n end\n elsif index == conflicts.size - 1\n if to_min(self.end_bound) - to_min(prev_c.end_time) >= to_min(self.duration)\n if new_time = c.move?(self)\n self.move(prev_c.end_time)\n c.move(new_time)\n self.save\n c.save\n return true\n else\n if !closed.includes?(c) && c.resolve_conflict\n self.move(self.start_bound)\n self.save\n return true\n else\n closed << c\n end\n end\n end\n # Check to see if moving c would allow us to place the event\n elsif to_min(c.end_time) - to_min(prev_c.end_time) >= to_min(self.duration)\n # This means we can put the event here\n # Check to see if c can be moved. If it can, set new_time to the time that c can be moved to.\n if new_time = c.move?(self)\n self.move(prev_c.end_time)\n c.move(new_time)\n self.save\n c.save\n return true\n else\n if !closed.includes?(c) && c.resolve_conflict\n self.move(prev_c.end_time)\n self.save\n return true\n else\n closed << c\n end\n end\n end\n end\n\n # If we reach here, it is impossible to move the event to a location without conflict\n return false\n end", "def set_column_conflict!(column)\n @set_column_conflicts[:\"#{column}=\"] = @set_column_conflicts[\"#{column}=\"] = column.to_sym\n end", "def remove_conflicts(tx)\n tx.inputs.each{|txin|\n next if txin.coinbase?\n # look for any spending inputs not tied to this immediate tx --\n # if we find one we should mark it a conflict.\n Toshi::Models::UnconfirmedInput.from_txin(txin).each{|input|\n next if input.hsh == tx.hash\n # remove it and any dependents\n self.remove(input.transaction.bitcoin_tx)\n }\n }\n end", "def on_conflict(location_point, check_report)\n Cooldown.create_or_update!(\n location_point, Cfg.after_jump_cooldown\n )\n \n # No combat means no assets.\n nil\n end", "def add_duplicate_program_error( error )\r\n @errors.programs << error\r\n end", "def resolve_merge_conflicts_and_delete_old_description\n if (params[:delete_after] == \"true\") &&\n (old_desc = @description.class.safe_find(params[:old_desc_id]))\n if !in_admin_mode? && !old_desc.is_admin?(@user)\n flash_warning(:runtime_description_merge_delete_denied.t)\n else\n flash_notice(:runtime_description_merge_deleted.\n t(old: old_desc.partial_format_name))\n log_description_merged(old_desc)\n old_desc.destroy\n end\n end\n end", "def overlapping\n return unless calendar && sibling_overlappings?\n errors.add(:base, :overlapping)\n end", "def check_conflicts(list)\n #return if write?\n list.each do |action, fname|\n tpath = source + fname\n fpath = output + fname\n if File.exist?(fpath)\n if tpath.directory?\n if !fpath.directory?\n raise \"Directory to be created clashes with a pre-existent file -- #{fname}\"\n end\n else\n if fpath.directory?\n raise \"File to be created clashes with a pre-existent directory -- #{fname}\"\n end\n end\n end\n end\n end", "def add_fail_com\n if @fail_com != nil and @common_events[@fail_com] != nil\n @common_event_q += @common_events[@fail_com].list\n end\n if @common_events[GTBS::FAIL_COM] != nil and BattleManager.can_lose?\n @common_event_q += @common_events[GTBS::FAIL_COM].list\n end\n end_battle(2)\n end", "def realizar_cuestionario_conflicto\n @paciente = Paciente.find(params[:id])\n @accionPerfilamiento = \"Cuestionario por Conflicto\"\n end", "def updateAndCheckConflicts\n rError = nil\n\n lConflicts = []\n # Execute svn update\n change_dir(@LocalRepository) do\n `svn update --accept=postpone #{@StrFiles}`.split(\"\\n\").each do |iLine|\n # Check that this line does not tell about a conflict\n if (iLine.strip[0..0] == 'C')\n # There is a conflict\n lConflicts << iLine.strip[1..-1].strip\n end\n end\n end\n # Sum up conflicts\n if (!lConflicts.empty?)\n rError = UpdateConflictError.new(\"The following files are in conflict: #{lConflicts.join(', ')}. Please resolve the conflict by updating before committing.\")\n end\n\n return rError\n end", "def insert_conflict_sql(sql)\n if opts = @opts[:insert_conflict]\n sql << \" ON CONFLICT\"\n\n if target = opts[:constraint] \n sql << \" ON CONSTRAINT \"\n identifier_append(sql, target)\n elsif target = opts[:target]\n sql << ' '\n identifier_append(sql, Array(target))\n if conflict_where = opts[:conflict_where]\n sql << \" WHERE \"\n literal_append(sql, conflict_where)\n end\n end\n\n if values = opts[:update]\n sql << \" DO UPDATE SET \"\n update_sql_values_hash(sql, values)\n if update_where = opts[:update_where]\n sql << \" WHERE \"\n literal_append(sql, update_where)\n end\n else\n sql << \" DO NOTHING\"\n end\n end\n end", "def update_hits(queens)\r\n for q in queens\r\n q.update_conflicts()\r\n end\r\n end", "def perform_additional_merge_operations!(other)\n end", "def warn_multiples(path, matches)\n warn \"multiple matches for same request -- #{path}\"\n matches.each do |file|\n warn \" #{file}\"\n end\n end", "def raise_error_unless_state(conflicts)\n return if state\n\n error = conflicts.values.map(&:underlying_error).compact.first\n raise error || VersionConflict.new(conflicts, specification_provider)\n end", "def ignore_method_conflicts=(_arg0); end", "def merge_reservation_errors\n @order_detail.reservation.errors.each do |error|\n field = error.attribute\n field = Reservation.human_attribute_name(field) if field != :base\n message = error.message\n\n @order_detail.errors.add(field, message)\n end\n end", "def _resolve_conflicts(versions)\r\n\t\tif @conflict_resolver and versions\r\n\t\t\treturn conflict_resolver(versions)\r\n\t\telse\r\n\t\t\treturn versions\r\n end\r\n end", "def verify_no_uncommitted_merge\n if !overwrite? && @working_changeset.parents.size > 1\n raise abort(\"outstanding uncommitted merges\")\n end\n end", "def update_with_conflict_validation(*args)\n update(*args)\n rescue ActiveRecord::StaleObjectError\n self.lock_version = lock_version_was\n errors.add :base, \"この記事は、あなたが編集中に他の人に更新されました。\"\n changes.except(:content, :updated_at).each do |title, values|\n errors.add title, \"was #{values.first}\"\n end\n false\n end", "def check_column_conflicts\n mod = Sequel::Model\n columns.find_all{|c| mod.method_defined?(c)}.each{|c| get_column_conflict!(c)}\n columns.find_all{|c| mod.method_defined?(\"#{c}=\")}.each{|c| set_column_conflict!(c)}\n end", "def conflict_type\n read_attribute(:conflict_type).to_sym\n end", "def conflicting_or_created_record\n conflict || create\n end", "def conflict_device_count=(value)\n @conflict_device_count = value\n end", "def resolve_conflicts\n neighbors = nodes\n new_chain = nil\n new_validator = nil\n max_length = chain.length\n\n neighbors.each do |node|\n response = RestClient.get(\"http://#{node}/chain\")\n next unless response.code == '200'\n response_body = JSON.parse(response.body)\n length = response_body['length']\n chain = response_body['chain']\n\n validator = Validator.new(chain)\n\n # Check if the length is longer and the chain is valid\n if length > max_length && local_validator.valid_chain?\n max_length = length\n new_chain = chain\n new_validator = validator\n end\n end\n\n # Replace our chain if we discovered a new, valid chain longer than ours\n if new_chain\n @chain = new_chain\n @validator = new_validator\n true\n else\n false\n end\n end", "def resolve_aliases added\n # resolve any pending unmatched aliases\n key = added.pretty_name\n unmatched_alias_list = @unmatched_alias_lists[key]\n return unless unmatched_alias_list\n unmatched_alias_list.each do |unmatched_alias|\n added.add_alias unmatched_alias, self\n @external_aliases.delete unmatched_alias\n end\n @unmatched_alias_lists.delete key\n end", "def conflict_position # conflict always happen at sc2\n @left_to_right ? @sc2.position : (@sc2.position + @sc1.internal_distance)\n end", "def diff_conflicts(diff1, diff2)\n da1 = diff1.path.split(\"/\")\n da2 = diff2.path.split(\"/\")\n\n cmp_size = [da1, da2].map(&:size).min - 1\n return false if da2.size == cmp_size + 1\n da1[0..cmp_size] == da2[0..cmp_size]\n end", "def resolve_conflict(files)\n filename = files\n .map {|f| f['path']}\n .sort\n .first\n puts %[rm \"#{filename}\"]\nend", "def number_of_conflicts\n p (1.0-self.fitness) * $time_slots.size * $classes_array.size\n ((1.0-self.fitness) * $time_slots.size * $classes_array.size).round.to_i\n end", "def conflict?\n conflicts = users_events.select{|e| e.start_time < self.end_bound && e.end_time > self.start_bound}.sort{|a,b| a.start_time <=> b.start_time}\n conflicts -= [self]\n if conflicts.empty?\n return false\n else\n return (!self.resolve_conflict([self]))\n end\n end", "def get_column_conflict!(column)\n @get_column_conflicts[column.to_sym] = @get_column_conflicts[column.to_s] = column.to_sym\n end", "def check_merge\n\tres = ''\n\tfiles = Dir.glob(\"**/*.rb\") + Dir.glob(\"**/*.yml\") + Dir.glob(\"**/*.feature\")\n\tfiles.each do |file|\n\t\tnb = 0\n\t\tif !file.include? 'convention.rb'\n\t\t\terrors = %w(<<<<< >>>>> ===== binding\\.pry $\\tAnd)\n\t\t\terrors.each do |reg|\n\t\t\t\tnb += File.readlines(file).grep(reg).size\n\t\t\tend\n\t\tend\n\t\tif nb > 0\n\t\t\tres += \"#{file}, \"\n\t\t\t$errors = true\n\t\tend\n\tend\n\n\tif res != ''\n\t\tputs \"Some file seems to be incorrect, with error like <<<<, >>>>, ====, binding.pry...\"\n\t\tputs res\n\tend\nend", "def resolve_install_conflicts(graph, is_dependency = false)\n graph.each do |release|\n @environment.modules_by_path[options[:target_dir]].each do |mod|\n if mod.has_metadata?\n metadata = {\n :name => mod.forge_name.gsub('/', '-'),\n :version => mod.version\n }\n next if release[:module] == metadata[:name]\n else\n metadata = nil\n end\n\n if release[:module] =~ /-#{mod.name}$/\n dependency_info = {\n :name => release[:module],\n :version => release[:version][:vstring]\n }\n dependency = is_dependency ? dependency_info : nil\n latest_version = @versions[\"#{@module_name}\"].sort_by { |h| h[:semver] }.last[:vstring]\n\n raise InstallConflictError,\n :requested_module => @module_name,\n :requested_version => @version || \"latest: v#{latest_version}\",\n :dependency => dependency,\n :directory => mod.path,\n :metadata => metadata\n end\n\n resolve_install_conflicts(release[:dependencies], true)\n end\n end\n end", "def e2211_merge_improvements(values)\n end", "def freeze\n @get_column_conflicts.freeze\n @set_column_conflicts.freeze\n\n super\n end", "def create\n @reservation = Reservation.new(reservation_params)\n\n @conflicts = Reservation.conflicting(@reservation)\n\n respond_to do |format|\n if @conflicts.empty? and @reservation.save\n\n if @reservation.reservation_group\n format.html { redirect_to @reservation.reservation_group, notice: 'Reserva adicionada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @reservation }\n\n else\n User.select { |u| @reservation.can_be_decided_over?(u) }.each do |user|\n NotifyUserMailer.reservation_made(@reservation, user).deliver\n end\n\n @reservation.place.class_monitors.each do |monitor|\n NotifyUserMailer.reservation_made_to_class_monitor(@reservation, monitor).deliver\n end\n\n format.html { redirect_to @reservation, notice: 'Reserva criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @reservation }\n end\n else\n format.html { render action: 'new' }\n format.json { render json: [@conflicts, @reservation.errors], status: :unprocessable_entity }\n end\n end\n end", "def merge(other)\n @actions += other.actions\n @errors += other.errors\n @warnings += other.warnings\n @notices += other.notices\n end", "def ignore_method_conflicts; end", "def getConflictsFromRelevantPreferences(relevant_preferences)\n conflicts = Array.new\n j = 0\n\n relevant_preferences.each do |relevant_preference|\n\n # Faculty Name\n fac_name = relevant_preference[2]\n # Course Details\n cour_name = relevant_preference[0] # .course_name\n cour_title = relevant_preference[1] # .CourseTitle\n # Day-Combo\n day_combo = (findDayCombinationDataFromId((relevant_preference[3]).day_combination_id)).day_combination\n # Time-Slot\n time_slot = (findTimeSlotDataFromId((relevant_preference[3]).time_slot_id)).time_slot\n # Building\n res = findBuildingDataFromId((relevant_preference[3]).building_id)\n if res != \"\"\n building_name = (res).building_name\n else\n building_name = \"\"\n end\n # Note\n note = relevant_preference[3].note\n # Preference number\n pref_no = relevant_preference[4]\n # Variable to check course has been assigned to a slotAlready Assigned\n already_asgn = isAssigned((relevant_preference[3]).building_id, (relevant_preference[3]).day_combination_id, (relevant_preference[3]).time_slot_id, cour_name, fac_name)\n\n conflicts.insert(j, Array[fac_name, cour_name, cour_title, day_combo, time_slot, building_name, note, pref_no, already_asgn])\n j += 1\n\n end\n\n return conflicts\n # end of the method\n end", "def get_conflicts(interactions)\r\n\t\tconflict_freq = {}\r\n\t\tinteractions.each do |int|\t\t\t\r\n\t\t\tif conflict_freq[int.consumable].nil?\r\n\t\t\t\tconflict_freq[int.consumable] = 1\r\n\t\t\telse \r\n\t\t\t\tconflict_freq[int.consumable] += 1\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tif conflict_freq[int.interactant].nil?\r\n\t\t\t\tconflict_freq[int.interactant] = 1\r\n\t\t\telse\r\n\t\t\t\tconflict_freq[int.interactant] += 1\r\n\t\t\tend\r\n\t\tend\r\n\t\tconflicts = conflict_freq.keys.sort {\r\n\t\t\t|a, b| conflict_freq[b] <=> conflict_freq[a]\r\n\t\t}\r\n\t\treturn conflicts\r\n\tend", "def check_duplicates(result, duplicates)\n duplicates.map do |duplicate|\n conflict = duplicate.position_held == result.parent_position_held\n ['Possible clash with parent position held', duplicate] if conflict\n end\n end" ]
[ "0.753011", "0.753011", "0.7275232", "0.71290165", "0.71290165", "0.67822963", "0.6777635", "0.6764266", "0.6649675", "0.6615368", "0.6539875", "0.6135", "0.60148174", "0.58816713", "0.5863662", "0.5833769", "0.5806479", "0.5745109", "0.57001203", "0.56801987", "0.56792825", "0.5652367", "0.56443393", "0.5641917", "0.562251", "0.5621721", "0.5600296", "0.5600296", "0.5600296", "0.5587838", "0.557377", "0.5507882", "0.5498793", "0.5483159", "0.548082", "0.548082", "0.5462776", "0.5428252", "0.54065555", "0.53946954", "0.53557587", "0.535298", "0.53444993", "0.53282773", "0.5292556", "0.5281443", "0.5263587", "0.5239714", "0.5220931", "0.521207", "0.5163557", "0.51437837", "0.5121766", "0.50980973", "0.50904876", "0.507704", "0.50727797", "0.50314164", "0.5023601", "0.5019736", "0.50025135", "0.49964097", "0.49742118", "0.49728042", "0.49715438", "0.49675232", "0.4962355", "0.49483353", "0.49472824", "0.494457", "0.49087155", "0.49015987", "0.48866388", "0.48809448", "0.48807284", "0.48776498", "0.48520374", "0.4841223", "0.483483", "0.48266765", "0.4822197", "0.48217115", "0.48171228", "0.48140797", "0.48001483", "0.47996083", "0.47905758", "0.47833687", "0.47728178", "0.477006", "0.47534892", "0.47510394", "0.47281608", "0.4724055", "0.47146606", "0.4713514", "0.4683701", "0.46830595", "0.4682543", "0.46772668" ]
0.70366246
5
Search gem load paths.
def load_path(match, options={}) options = valid_load_options(options) specs = specifications(options) matches = [] specs.each do |spec| list = [] spec.require_paths.each do |path| glob = File.join(spec.full_gem_path, path, match) list = Dir[glob] #.map{ |f| f.untaint } list = list.map{ |d| d.chomp('/') } # return relative paths unless absolute flag if options[:relative] #not options[:absolute] # the extra '' in File.join adds a '/' to the end of the path list = list.map{ |f| f.sub(File.join(spec.full_gem_path, path, ''), '') } end matches.concat(list) end # activate the library if activate flag spec.activate if options[:activate] && !list.empty? end matches end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_paths\n [root.join('lib'), root.join('spec')].join(':')\n end", "def lookup_paths\n if list = ENV['RUBY_LIBRARY']\n list.split(/[:;]/)\n #elsif File.exist?(path_file)\n # File.readlines(path_file).map{ |x| x.strip }.reject{ |x| x.empty? || x =~ /^\\s*\\#/ }\n elsif ENV['GEM_PATH']\n ENV['GEM_PATH'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n elsif ENV['GEM_HOME']\n ENV['GEM_HOME'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n else\n warn \"No Ruby libraries.\"\n []\n end\n end", "def load_gems_in(*spec_dirs); end", "def add_to_load_path\n Gem.source_index.load_gems_in(*Gem::SourceIndex.installed_spec_directories | [ruby_spec_path, arch_spec_path])\n end", "def add_gem_paths\n require 'rubygems'\n gem_paths = []\n YARD::GemIndex.each do |spec|\n yfile = Registry.yardoc_file_for_gem(spec.name)\n next if yfile.nil?\n\n if spec.name =~ /^yard-doc-/\n gem_paths.unshift(yfile)\n else\n gem_paths.push(yfile)\n end\n end\n @search_paths += gem_paths\n rescue LoadError\n nil # noop\n end", "def full_require_paths\n @full_require_paths ||=\n begin\n full_paths = raw_require_paths.map do |path|\n File.join full_gem_path, path.tap(&Gem::UNTAINT)\n end\n\n full_paths << extension_dir if have_extensions?\n\n full_paths\n end\n end", "def add_gem_paths; end", "def gem_paths\n @_gem_paths ||= (ENV['GEM_PATH'] || ENV['GEM_HOME']).split(/[:;]/)\n end", "def find_files_for_reload\n paths = [ './', *$LOAD_PATH ].uniq\n [ $0, *$LOADED_FEATURES ].uniq.map do |file|\n next if file =~ /\\.(so|bundle)$/\n yield(find(file, paths))\n end\n end", "def find_loadpath(match, options={})\n plugins = []\n #directory = options[:directory] || DIRECTORY\n $LOAD_PATH.uniq.each do |path|\n path = File.expand_path(path)\n #list = Dir.glob(File.join(path, directory, match))\n list = Dir.glob(File.join(path, match))\n list = list.map{ |d| d.chomp('/') }\n plugins.concat(list)\n end\n plugins\n end", "def lookup!\n $LOAD_PATH.each do |base|\n Dir[File.join(base, *file_lookup_paths)].each do |path|\n path = path.delete_prefix(\"#{base}/\")\n require path\n rescue Exception\n # No problem\n end\n end\n end", "def find_bundle_measure_paths\n bundle_measure_paths = []\n\n puts \"Getting measure directories for bundle installed measure gems\"\n gems = Dir.entries(bundle_base_gem_path)\n gems.each do |gem|\n # check if has lib/measures\n gem = \"#{bundle_base_gem_path}/#{gem}/lib/measures\"\n next if ! Dir.exists?(gem)\n bundle_measure_paths << gem\n end\n\n puts \"found #{bundle_measure_paths.size} measure directories\"\n\n return bundle_measure_paths.sort\nend", "def load_gem_plugins; end", "def append_from_gems\n\t\t\t::Gem.loaded_specs.each do |name, spec|\n\t\t\t\tConsole.logger.debug(self) {\"Checking gem #{name}: #{spec.full_gem_path}...\"}\n\t\t\t\t\n\t\t\t\tif path = spec.full_gem_path and File.directory?(path)\n\t\t\t\t\tappend_path(path, name: spec.full_name)\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def load_gemfiles(directories)\n directories.each do |directory|\n gemfile = File.expand_path(File.join(directory, 'Gemfile'))\n eval(File.read(gemfile), binding) if File.exist?(gemfile)\n end\nend", "def configured_require_paths\n return ['lib'] if directory.empty?\n return [File.join(directory, 'lib')] if config.require_paths.empty?\n config.require_paths.map{|p| File.join(directory, p)}\n end", "def user_path\n load_path = $LOAD_PATH - ruby_library_locations\n load_path = load_path.reject{ |p| gem_paths.any?{ |g| p.start_with?(g) } }\n end", "def paths_from_software_gems\n @paths_from_software_gems ||=\n Array(Config.software_gems).inject([]) do |array, name|\n if (spec = Gem::Specification.find_all_by_name(name).first)\n array << File.expand_path(spec.gem_dir)\n end\n\n array\n end\n end", "def load_libs\n loadQueue = []\n Pathname.glob './lib/*.rb' do |script|\n require script.to_s\n scriptfolder = Pathname.new(script.to_s.gsub('.rb', ''))\n next if not scriptfolder.directory?\n\n loadQueue += scriptfolder.children(true).find_all {|file| file.to_s[-3..-1] == '.rb'}\n end\n \n # load the children\n loadQueue.each {|file| require file.to_s }\n end", "def load_packages\n pattern = File.expand_path(File.join(\"..\", \"*.rb\"), File.dirname(__FILE__)) \n Dir[pattern].each {|f| load f}\n end", "def includes_load_paths; end", "def find(name)\n # look into each gempath for a matching file, sort by version (roughly), \n # and return the last hit\n gem_paths.\n map { |gem_path| Dir.glob(\"#{gem_path}/gems/#{name}-[0-9]*\") }.\n flatten.\n sort_by { |gem_path| gem_path.gsub(/.*\\/gems\\/[^-]+-/, \"\") }.\n last\n end", "def resolve_paths(loaders)\n mod_resolver = loaders.instance_variable_get(:@module_resolver)\n all_mods = mod_resolver.instance_variable_get(:@all_module_loaders)\n end", "def search_path\n result = []\n\n result += $LOAD_PATH.map { |path| File.expand_path('facter', path) }\n\n if @environment_vars.include?(\"FACTERLIB\")\n result += @environment_vars[\"FACTERLIB\"].split(File::PATH_SEPARATOR)\n end\n\n # silently ignore bad search paths from $LOAD_PATH and FACTERLIB\n result = result.select { |path| valid_search_path?(path) }\n\n # This allows others to register additional paths we should search.\n # We are assuming that these are already absolute paths.\n result += Facter.search_path.select do |path|\n valid = valid_search_path?(path)\n Facter.warn \"Excluding #{path} from search path. Fact file paths must be an absolute directory\" unless valid\n valid\n end\n\n # remove any dups\n result.uniq\n end", "def generate_require_paths\n return configured_require_paths unless gemspec?\n result = []\n gemspecs.each do |file|\n base = File.dirname(file)\n # HACK: Evaluating gemspec files violates the goal of not running\n # workspace code, but this is how Gem::Specification.load does it\n # anyway.\n cmd = ['ruby', '-e', \"require 'rubygems'; require 'json'; spec = eval(File.read('#{file}'), TOPLEVEL_BINDING, '#{file}'); return unless Gem::Specification === spec; puts({name: spec.name, paths: spec.require_paths}.to_json)\"]\n o, e, s = Open3.capture3(*cmd)\n if s.success?\n begin\n hash = o && !o.empty? ? JSON.parse(o.split(\"\\n\").last) : {}\n next if hash.empty?\n @gemnames.push hash['name']\n result.concat(hash['paths'].map { |path| File.join(base, path) })\n rescue StandardError => e\n Solargraph.logger.warn \"Error reading #{file}: [#{e.class}] #{e.message}\"\n end\n else\n Solargraph.logger.warn \"Error reading #{file}\"\n Solargraph.logger.warn e\n end\n end\n result.concat(config.require_paths.map { |p| File.join(directory, p) })\n result.push File.join(directory, 'lib') if result.empty?\n result\n end", "def load_minimal_gems\r\n end", "def require_paths\n return raw_require_paths unless have_extensions?\n\n [extension_dir].concat raw_require_paths\n end", "def search_require_path(name)\n $LOAD_PATH.each do |dir|\n if check_path(dir, name, CodeLoader.source_extension, :ruby) or\n check_path(dir, name, LIBSUFFIX, :library)\n return true\n end\n end\n\n return false\n end", "def default_loadpath\n ['lib']\n end", "def add_plugins_from_lookup_folders\n @plugin_lookup_folders.each do |folder|\n if File.directory?(folder)\n #TODO: add gem root to load path ? and require short folder ?\n #$LOAD_PATH.push(folder) if i[:add_path]\n Dir.entries(folder).select{|file|file.end_with?(RUBY_FILE_EXT)}.each do |source|\n add_plugin_info(File.join(folder,source))\n end\n end\n end\n end", "def modules_paths\n puppet_environment.full_modulepath\n end", "def application_load_paths\n if defined?(ActiveSupport::Dependencies)\n if ActiveSupport::Dependencies.respond_to?(:load_paths)\n ActiveSupport::Dependencies.load_paths\n else\n ActiveSupport::Dependencies.autoload_paths\n end\n else\n $LOAD_PATH\n end\n end", "def load_paths\n @_load_paths_was = %w(lib models shared).map { |path| Padrino.root(path) }\n @_load_paths ||= @_load_paths_was\n end", "def load_paths\n unless @load_paths\n @load_paths = []\n \n if File.directory?(app_path)\n @load_paths << app_path\n \n # Sort for consistency across platforms\n @load_paths.concat(Dir[\"#{app_path}/*/\"].map(&:chop).sort!)\n end\n end\n \n @load_paths\n end", "def search_bundle_paths(word)\n\t\n\t# Open Help dictionary and find matching lines\n\ttoc = ::IO.readlines($help_toc)\n\ttoc.each do |line|\n\t\tif line =~ /href='([a-zA-Z0-9\\/]*\\b#{word}\\w*)\\.html'/\n\t\t\t\n\t\t\tpath = $1.gsub( \"/\", \".\")\n\t\t\t\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\tend\n\t\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend", "def find_gems(match, options={})\n return [] unless defined?(::Gem)\n ::Gem.search(match)\n end", "def load_path(match, options={})\n found = []\n systems.each do |system|\n found.concat system.load_path(match, options)\n end\n found.uniq\n end", "def search_all_paths(word)\n\n\tsearch_project_paths(word)\n\tsearch_bundle_paths(word)\n\t\n\t$best_paths.uniq!\n\t$package_paths.uniq!\n\t\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend", "def lib_paths\n @mpc_project.recipe.get_relative_paths(@mpc_project.lib_paths)\n end", "def update_loadpath\n project_directory = File.expand_path( \"../..\", __FILE__ ) # filepath, minus filename and lib directory\n child_directories = find_all_directories( project_directory )\n $LOAD_PATH.unshift( child_diretories )\n $LOAD_PATH.unshift( project_directory )\n $LOAD_PATH.flatten!\nend", "def modules_paths\n puppet_environment.full_modulepath\n end", "def lib_dirs_glob\n dirs = if self.raw_require_paths\n if self.raw_require_paths.size > 1\n \"{#{self.raw_require_paths.join(',')}}\"\n else\n self.raw_require_paths.first\n end\n else\n \"lib\" # default value for require_paths for bundler/inline\n end\n\n \"#{self.full_gem_path}/#{dirs}\".dup.tap(&Gem::UNTAINT)\n end", "def load_paths\n unless @load_paths\n @load_paths = []\n \n if File.directory?(app_path)\n @load_paths << app_path\n \n # Sort for consistency\n self.class.mixable_app_types.keys.map(&:to_s).sort.each do |type|\n path = \"#{app_path}/#{type}\"\n @load_paths << path if File.directory?(path)\n end\n end\n end\n \n @load_paths\n end", "def inject_into_load_path\n \n # Add ALL paths under the engine root to the load path\n %w(app/controllers \n app/helpers \n app/models\n components\n lib).collect { |dir|\n File.join(root, dir)\n }.select { |dir| File.directory?(dir) }.each do |path|\n insert_into_load_path(path) \n end\n end", "def add_plugin_load_paths\r\n plugins.each do |plugin|\r\n plugin.load_paths.each do |path|\r\n $LOAD_PATH.insert(application_lib_index + 1, path)\r\n\r\n ActiveSupport::Dependencies.load_paths << path\r\n\r\n unless configuration.reload_plugins?\r\n ActiveSupport::Dependencies.load_once_paths << path\r\n end\r\n end\r\n end\r\n\r\n $LOAD_PATH.uniq!\r\n end", "def find_modules\n find_engine\n find_storage\n find_pod\n end", "def site_packages\n effective_lib+\"python2.7/site-packages\"\n end", "def default_load_paths\n application_load_paths.collect { |lp| File.join(lp, \"widgets\") }\n end", "def find_plugin_path( mod_name )\n\t\tcandidates = self.plugin_path_candidates( mod_name )\n\t\tPluggability.log.debug \"Candidates for %p are: %p\" % [ mod_name, candidates ]\n\n\t\tcandidate_paths = candidates.\n\t\t\tflat_map {|path| Gem.find_latest_files( path ) }.\n\t\t\treject {|path| self.is_excluded_path?( path ) || ! File.file?(path) }\n\t\tPluggability.log.debug \"Valid candidates in the current gemset: %p\" % [ candidate_paths ]\n\n\t\treturn candidate_paths.first\n\tend", "def lib_files\n @files.select do |file|\n require_paths.any? do |path|\n file.start_with? path\n end\n end\n end", "def extra_load_paths\n extras = $LOAD_PATH.dup\n [ 'sitedir',\n 'sitelibdir',\n 'sitearchdir',\n 'rubylibdir',\n 'archdir' ].each {\n |var|\n extras.delete(Config::CONFIG[var]) { raise }\n }\n extras.delete('.')\n extras\n end", "def require_paths\n raw_data['require_paths'] || []\n end", "def for_gem\n called_from = caller_locations(1, 1).first.path\n Registry.loader_for_gem(called_from)\n end", "def require_paths; end", "def require_paths; end", "def load_path(match, options={})\n return [] if options[:from]\n\n options = valid_load_options(options)\n\n found = []\n $LOAD_PATH.uniq.each do |path|\n list = Dir.glob(File.join(File.expand_path(path), match))\n list = list.map{ |d| d.chomp('/') }\n # return absolute path unless relative flag\n if options[:relative]\n # the extra '' in File.join adds a '/' to the end of the path\n list = list.map{ |f| f.sub(File.join(path, ''), '') }\n end\n found.concat(list)\n end\n found\n end", "def require_tree path\n path = File.expand_path(path)\n %x{\n var file_name, file_names = Object.keys($opal.modules);\n path = path.replace(/\\/?$/, '/');\n for (var i = 0; i < file_names.length; i++) {\n file_name = file_names[i];\n if (file_name['$start_with?'](path)) {\n $opal.require(file_name);\n }\n }\n }\n nil\n end", "def load_paths\n @load_paths ||= [\"urls.rb\", \"config/urls.rb\", \"mailers/*.rb\", \"controllers/**/*.rb\", \"controllers.rb\", \"helpers/*.rb\"]\n end", "def load_plugins\n return unless plugin_prefix\n files_to_require = if Gem.respond_to? :find_latest_files\n Gem.find_latest_files(\"#{plugin_prefix}_plugin\")\n else\n Gem.find_files(\"#{plugin_prefix}_plugin\")\n end\n files_to_require.each { |path| require_plugin_path(path) }\n end", "def load_extensions\n # Load the init.rb file\n require root('init.rb') if File.exists?(root('init.rb'))\n\n # Load the gems in the config file\n @config.gems.each { |gem| require gem }\n\n # Load the extensions\n ext_roots = Dir[root(:extensions, '*')].select { |d| File.directory? d }\n ext_roots.each do |dir|\n ext = File.basename(dir)\n\n # Try extensions/name/name.rb\n # Try extensions/name/lib/name.rb\n ext_files = [\n File.join(dir, \"#{ext}.rb\"),\n File.join(dir, 'lib', \"#{ext}.rb\")\n ]\n ext_files.reject! { |f| not File.exists? f }\n require ext_files[0] if ext_files[0]\n end\n end", "def load_paths\n @load_paths ||= Config::LoadPaths.new\n end", "def locate_plugins\n Gem.refresh\n (Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.find_name('')).each do |gem|\n next if gem.name !~ PRY_PLUGIN_PREFIX\n plugin_name = gem.name.split('-', 2).last\n @plugins << Plugin.new(plugin_name, gem.name, gem, true) if !gem_located?(gem.name)\n end\n @plugins\n end", "def lookup_library(args)\n library = args[:library]\n paths = args.key?(:paths) ? sanitize_paths(args[:paths]) : []\n matches = packages_providing_library(library, *paths).join(\"\\n\")\n puts \"packages which provide library:\\n#{matches}\".bold.blue\nend", "def add_lib_to_load_path! # :nodoc:\n [root.join('lib'), root.join('vendor', 'lib'), root.join('app', 'lib')].each do |path|\n $LOAD_PATH.unshift(path.to_s) if File.exist?(path) && !$LOAD_PATH.include?(path.to_s)\n end\n end", "def load_plugins\n Gem.find_latest_files(\"pantry/init.rb\").each do |path|\n begin\n gem_path = path.gsub(\"#{Gem.dir}/gems/\", '')\n Pantry.logger.debug(\"Installing plugin from #{gem_path}\")\n require path\n rescue Exception => ex\n Pantry.logger.warn(\"Unable to load plugin at #{gem_path}, #{ex.message}\")\n end\n end\n end", "def find_packages\n LockfileParser.read(lockfile_path)\n end", "def find_gems\n @gems = RubygemsApi.call :all\n end", "def module_search_path(path)\n\t\t\t@project.add_import_path(path)\n\t\tend", "def check_all_gems(gem_path)\n gems_not_installed = []\n Constants::GEMS.each do |gem|\n string = \"Looking for Gem \\\"#{gem}\\\"...\"\n installed = check_gem gem, gem_path\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append gem name to gems_not_installed list\n gems_not_installed << gem\n end #if\n end # do\n \n gems_not_installed\n end", "def load_lab_app_lib_files\n libFiles = File.dirname(__FILE__) + \"/../lib/*.rb\"\n Dir[libFiles].each do |file|\n fullpath = File.expand_path(file)\n puts \"Loading your file #{fullpath}\"\n require fullpath\n end\n end", "def load_lib_dirs\n lib_dirs.each do |lib|\n $LOAD_PATH << lib\n end\n end", "def autoload_paths=(_arg0); end", "def find_requireable_file(file)\n root = full_gem_path\n\n require_paths.each do |lib|\n base = File.join(root, lib, file)\n Gem.suffixes.each do |suf|\n path = \"#{base}#{suf}\"\n return path if File.file? path\n end\n end\n\n return nil\n end", "def path_to_require\n name = self.rpartition('.').first\n $LOAD_PATH.each do |lib|\n name.sub!(lib+\"/\", '')\n end\n name\n end", "def load #:nodoc:\n @found ||= {}\n @loaded ||= {}\n @files ||= Gem.find_files('cartage/*.rb')\n\n @files.reverse.each do |path|\n name = File.basename(path, '.rb').to_sym\n @found[name] = path\n end\n\n :repeat while @found.map { |name, plugin|\n load_plugin(name, plugin)\n }.any?\n end", "def add_self_to_load_path\n return if default_gem?\n\n paths = full_require_paths\n\n Gem.add_to_load_path(*paths)\n end", "def installed_spec_directories\n Gem.path.collect { |dir| File.join(dir, \"specifications\") }\n end", "def load_all\n return if defined?(@loaded_all)\n\n load_env\n\n paths = search_path\n unless paths.nil?\n paths.each do |dir|\n # dir is already an absolute path\n Dir.glob(File.join(dir, '*.rb')).each do |path|\n # exclude dirs that end with .rb\n load_file(path) if File.file?(path)\n end\n end\n end\n\n @loaded_all = true\n end", "def gempaths\n\t\t\treturn Gem.path\n\t\tend", "def plugin_path_candidates( mod_name )\n\t\tprefixes = self.plugin_prefixes\n\t\tprefixes << '' if prefixes.empty?\n\n\t\treturn prefixes.flat_map {|pre| self.make_require_path(mod_name, pre) }\n\tend", "def load_helpers\n load_glob File.join(File.dirname(__FILE__), 'helpers', '*.rb')\n end", "def plugins\n matches_for_glob(\"rubygems#{Gem.plugin_suffix_pattern}\")\n end", "def installed_spec_directories; end", "def gems_dir\n raise NotImplementedError\n end", "def find_executables\n\t\tpaths = self.project_files.find_all do |path|\n\t\t\tpath.start_with?( 'bin/' )\n\t\tend\n\t\treturn paths.map {|path| path[%r{^bin/(.*)}, 1] }\n\tend", "def load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if !@loaded_paths.include?( expanded_path ) && File.exists?( expanded_path )\n $CLASSPATH << expanded_path\n load_paths << expanded_path\n @loaded_paths << expanded_path\n end\n end\n \n load_paths\n end", "def search_project_paths(word)\n\t\n\t# Collect all .as and .mxml files with a filename that contains the search\n\t# term. When used outside a project this step is skipped.\n\tTextMate.each_text_file do |file|\n\t\t\n\t\tif file =~ /\\b#{word}\\w*\\.(as|mxml)$/\n\t\t\t\n\t\t\tpath = file.sub( $project, \"\" );\n\t\t\t\n\t\t\tcommon_src_dirs.each do |remove|\n\t\t\t\tpath = path.gsub( /^.*\\b#{remove}\\b\\//, '' );\n\t\t\tend\n\n\t\t\tpath = path.gsub(/\\.(as|mxml)$/,'').gsub( \"/\", \".\").sub(/^\\./,'')\n\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend\n\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend", "def add_plugin_paths(install_dir)\n Dir.glob(File.join([install_dir, '*'])).each do |mod|\n $LOAD_PATH << File.join([mod, 'lib'])\n end\n end", "def update_load_path\n require 'bundler'\n Bundler.setup\n end", "def internal_load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if File.exists?( expanded_path )\n @class_loader.addPath( expanded_path )\n \n load_paths << expanded_path\n end\n end\n \n load_paths\n end", "def app_load_path(*paths)\n paths.each do |path|\n dir = app_path(path)\n $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)\n end\nend", "def r(*gems)\n gems.map {|g| require g.to_s}\nend", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def prepare_load_paths\n t = @target\n t = @target.parent unless @target.parent.nil?\n unless t.is_a?(Fetchers::Local)\n return # no need to mess with load-paths if this is not on disk\n end\n\n rel_dirs = (@libraries.keys + @tests.keys)\n .map { |x| File.dirname(x) }.uniq\n\n abs_dirs = rel_dirs.map { |x| @target.abs_path(x) }\n .find_all { |x| File.directory?(x) }\n .map { |x| File.expand_path(x) }\n\n abs_dirs.each do |dir|\n $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)\n end\n end", "def load_gems\n @bundler_loaded ||= Bundler.require :default, Rails.env\n end", "def generate_require_paths; end", "def add_load_path(path)\n full_path = \"#{ENV['HOME']}/.gem/#{path}\"\n\n if File.exists?(full_path)\n $: << full_path\n else\n raise(\"load path missing: #{full_path} (maybe you forgot to bundle?)\")\n end\nend", "def packages\n FileList[package_path('.*')]\n end", "def require_load_paths\n load_paths.each { |path| Padrino.require_dependencies(File.join(self.root, path)) }\n end", "def hardcode_gems\n return nil\n core = File.expand_path(File.join(__FILE__, '..', '..', '..', '..', 'gems'))\n\n Dir.open(core).each do |entry|\n try_dir = File.join core, entry\n if File.directory?(try_dir) && !['.', '..'].include?(entry)\n add_hardcoded_gem try_dir\n end\n end\n end" ]
[ "0.72364444", "0.70900047", "0.70517397", "0.6956746", "0.693558", "0.69078434", "0.69062763", "0.6902592", "0.68499345", "0.679078", "0.6691593", "0.6680091", "0.6625411", "0.65592355", "0.6555327", "0.65509486", "0.6537707", "0.6521265", "0.6518317", "0.65023416", "0.64837", "0.64714384", "0.6463839", "0.6420796", "0.64168376", "0.6406678", "0.63989156", "0.63951975", "0.6393983", "0.6386429", "0.63806254", "0.6368357", "0.6356158", "0.6344681", "0.6332876", "0.6320894", "0.6307797", "0.63022244", "0.62830347", "0.6278146", "0.62761384", "0.6275099", "0.6275081", "0.62517405", "0.62499624", "0.6237077", "0.6210449", "0.6210085", "0.6203579", "0.6201826", "0.6188082", "0.6169593", "0.61656594", "0.61579305", "0.61579305", "0.6157457", "0.6154295", "0.6127333", "0.61260027", "0.61181265", "0.61156803", "0.61104697", "0.61033297", "0.60955924", "0.6095308", "0.6094455", "0.60941154", "0.60894763", "0.6080391", "0.60787797", "0.6071009", "0.6070711", "0.60583377", "0.60415155", "0.603621", "0.60348415", "0.6031817", "0.6030372", "0.60082513", "0.599468", "0.59852993", "0.59827834", "0.59817576", "0.5975999", "0.5974744", "0.5973147", "0.59720826", "0.5968587", "0.5956932", "0.5953528", "0.59531546", "0.5950135", "0.5942516", "0.59422094", "0.59362555", "0.59265006", "0.5921211", "0.591986", "0.59120584", "0.59018683" ]
0.67986065
9
Search gem data paths.
def data_path(match, options={}) specs = specifications(options) matches = [] specs.each do |spec| list = [] glob = File.join(spec.full_gem_path, 'data', match) list = Dir[glob] #.map{ |f| f.untaint } list = list.map{ |d| d.chomp('/') } matches.concat(list) # activate the library if activate flag spec.activate if options[:activate] && !list.empty? end matches end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths_from_software_gems\n @paths_from_software_gems ||=\n Array(Config.software_gems).inject([]) do |array, name|\n if (spec = Gem::Specification.find_all_by_name(name).first)\n array << File.expand_path(spec.gem_dir)\n end\n\n array\n end\n end", "def gem_paths\n @_gem_paths ||= (ENV['GEM_PATH'] || ENV['GEM_HOME']).split(/[:;]/)\n end", "def find_bundle_measure_paths\n bundle_measure_paths = []\n\n puts \"Getting measure directories for bundle installed measure gems\"\n gems = Dir.entries(bundle_base_gem_path)\n gems.each do |gem|\n # check if has lib/measures\n gem = \"#{bundle_base_gem_path}/#{gem}/lib/measures\"\n next if ! Dir.exists?(gem)\n bundle_measure_paths << gem\n end\n\n puts \"found #{bundle_measure_paths.size} measure directories\"\n\n return bundle_measure_paths.sort\nend", "def locate()\n \n search = Dir.pwd()\n\n search = search.split(File::SEPARATOR)\n\n while not File.directory? File.join(search) + File::SEPARATOR + DATADIRNAME and File.join(search) != ''\n search.pop\n end\n \n if File.directory? File.join(search) + File::SEPARATOR + DATADIRNAME\n @library_dir = File.join(search) + File::SEPARATOR\n end \n\n \n end", "def lookup_paths\n if list = ENV['RUBY_LIBRARY']\n list.split(/[:;]/)\n #elsif File.exist?(path_file)\n # File.readlines(path_file).map{ |x| x.strip }.reject{ |x| x.empty? || x =~ /^\\s*\\#/ }\n elsif ENV['GEM_PATH']\n ENV['GEM_PATH'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n elsif ENV['GEM_HOME']\n ENV['GEM_HOME'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n else\n warn \"No Ruby libraries.\"\n []\n end\n end", "def data_path(match, options={})\n found = []\n systems.each do |system|\n found.concat system.data_path(match, options)\n end\n found.uniq\n end", "def datadir\n # TODO: drop the extra \", gem_name\" which is uselessly redundant\n File.expand_path(File.join(gems_dir, full_name, \"data\", name)).tap(&Gem::UNTAINT)\n end", "def require_paths\n raw_data['require_paths'] || []\n end", "def append_from_gems\n\t\t\t::Gem.loaded_specs.each do |name, spec|\n\t\t\t\tConsole.logger.debug(self) {\"Checking gem #{name}: #{spec.full_gem_path}...\"}\n\t\t\t\t\n\t\t\t\tif path = spec.full_gem_path and File.directory?(path)\n\t\t\t\t\tappend_path(path, name: spec.full_name)\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def add_gem_paths\n require 'rubygems'\n gem_paths = []\n YARD::GemIndex.each do |spec|\n yfile = Registry.yardoc_file_for_gem(spec.name)\n next if yfile.nil?\n\n if spec.name =~ /^yard-doc-/\n gem_paths.unshift(yfile)\n else\n gem_paths.push(yfile)\n end\n end\n @search_paths += gem_paths\n rescue LoadError\n nil # noop\n end", "def find_data_dir(path)\n each_data_path(path).find { |full_path| File.directory?(full_path) }\n end", "def installed_spec_directories; end", "def require_paths\n @require_paths ||= data.require_paths\n end", "def package_paths\n return @package_paths if defined?(@package_paths)\n\n @package_paths = begin\n output = Licensed::Shell.execute(\"php\", composer_application_path, \"show\", \"--format\", \"json\", \"--path\", allow_failure: true)\n return {} if output.to_s.empty?\n\n path_json = JSON.parse(output)\n return {} unless path_json[\"installed\"]\n\n path_json[\"installed\"].each_with_object({}) do |package, hsh|\n hsh[package[\"name\"]] = package[\"path\"]\n end\n end\n end", "def installed_spec_directories\n Gem.path.collect { |dir| File.join(dir, \"specifications\") }\n end", "def gempaths\n\t\t\treturn Gem.path\n\t\tend", "def load_paths\n [root.join('lib'), root.join('spec')].join(':')\n end", "def load_gems_in(*spec_dirs); end", "def resolve_paths\n [dataset_dir, parent.dataset_dir]\n end", "def data_path\n if ENV[\"RACK_ENV\"] == \"test\"\n File.expand_path(\"../test/data\", __FILE__)\n else\n File.expand_path(\"../data\", __FILE__)\n end\nend", "def data_path\n if ENV[\"RACK_ENV\"] == \"test\"\n File.expand_path(\"../test/data\", __FILE__)\n else\n File.expand_path(\"../data\", __FILE__)\n end\nend", "def data_path\n if ENV[\"RACK_ENV\"] == \"test\"\n File.expand_path(\"../test/data\", __FILE__)\n else\n File.expand_path(\"../data\", __FILE__)\n end\nend", "def data_root\n File.expand_path(\"spec/data\", Dir.pwd)\n end", "def test_data_find\n file = 'foo.dat'\n assert_equal(File.join(Dir.pwd,'home/.local/share', file), XDG.data.find(file))\n file = 'bar.dat'\n assert_equal(File.join(Dir.pwd,'usr/share', file), XDG.data.find(file))\n end", "def search_external_path\n Options.external_dir\n end", "def gems_dir\n raise NotImplementedError\n end", "def find_gems\n @gems = RubygemsApi.call :all\n end", "def search_paths\n # NOTE: Do not cache this list, specific generators\n # will modify it with their own lookups\n create_search_paths.select { |path| File.directory?(path) }\n end", "def find_data_file(path)\n each_data_path(path).find { |full_path| File.file?(full_path) }\n end", "def find_modules\n find_engine\n find_storage\n find_pod\n end", "def add_gem_paths; end", "def packages\n FileList[package_path('.*')]\n end", "def path\n @path ||= [\".\", \"~/.statisticus\", gem_r_lib].map {|path| File.expand_path(path)}.delete_if {|path| not File.exist?(path)}\n end", "def installed_files\n Dir.chdir(@spec.gem_dir) { Dir['**/*'].reject {|fp| ::File.directory?(fp) } }\n end", "def local_gems\n %x(ls #{local_cache_path}).split(/\\s+/)\n end", "def search_path\n result = []\n\n result += $LOAD_PATH.map { |path| File.expand_path('facter', path) }\n\n if @environment_vars.include?(\"FACTERLIB\")\n result += @environment_vars[\"FACTERLIB\"].split(File::PATH_SEPARATOR)\n end\n\n # silently ignore bad search paths from $LOAD_PATH and FACTERLIB\n result = result.select { |path| valid_search_path?(path) }\n\n # This allows others to register additional paths we should search.\n # We are assuming that these are already absolute paths.\n result += Facter.search_path.select do |path|\n valid = valid_search_path?(path)\n Facter.warn \"Excluding #{path} from search path. Fact file paths must be an absolute directory\" unless valid\n valid\n end\n\n # remove any dups\n result.uniq\n end", "def generate_require_paths\n return configured_require_paths unless gemspec?\n result = []\n gemspecs.each do |file|\n base = File.dirname(file)\n # HACK: Evaluating gemspec files violates the goal of not running\n # workspace code, but this is how Gem::Specification.load does it\n # anyway.\n cmd = ['ruby', '-e', \"require 'rubygems'; require 'json'; spec = eval(File.read('#{file}'), TOPLEVEL_BINDING, '#{file}'); return unless Gem::Specification === spec; puts({name: spec.name, paths: spec.require_paths}.to_json)\"]\n o, e, s = Open3.capture3(*cmd)\n if s.success?\n begin\n hash = o && !o.empty? ? JSON.parse(o.split(\"\\n\").last) : {}\n next if hash.empty?\n @gemnames.push hash['name']\n result.concat(hash['paths'].map { |path| File.join(base, path) })\n rescue StandardError => e\n Solargraph.logger.warn \"Error reading #{file}: [#{e.class}] #{e.message}\"\n end\n else\n Solargraph.logger.warn \"Error reading #{file}\"\n Solargraph.logger.warn e\n end\n end\n result.concat(config.require_paths.map { |p| File.join(directory, p) })\n result.push File.join(directory, 'lib') if result.empty?\n result\n end", "def find(name)\n # look into each gempath for a matching file, sort by version (roughly), \n # and return the last hit\n gem_paths.\n map { |gem_path| Dir.glob(\"#{gem_path}/gems/#{name}-[0-9]*\") }.\n flatten.\n sort_by { |gem_path| gem_path.gsub(/.*\\/gems\\/[^-]+-/, \"\") }.\n last\n end", "def search_all_paths(word)\n\n\tsearch_project_paths(word)\n\tsearch_bundle_paths(word)\n\t\n\t$best_paths.uniq!\n\t$package_paths.uniq!\n\t\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend", "def path(match, options={})\n return [] if options[:from]\n\n found = []\n $LOAD_PATH.uniq.map do |path|\n list = Dir.glob(File.join(File.expand_path(path), match))\n list = list.map{ |d| d.chomp('/') }\n found.concat(list)\n end\n found.concat(data_path(match, options))\n found\n end", "def paths\n self.config[:paths]\n end", "def get_root_dirs_from_gems\n # Get Application root dir and Modules\n hlist = {}\n alist = []\n\n # All gems\n # NOTE: Gem::GemPathSearcher#initialize is deprecated with no replacement. It will be removed on or after 2011-10-01.\n # searcher = Gem::GemPathSearcher.new\n # list = searcher.init_gemspecs\n # GemPathSearcher => Specification\n path = \"\"\n specs = Gem::Specification.find_all # {|spec| spec.contains_requirable_file? path}\n specs = specs.sort_by { |spec| spec.version }\n\n specs.each do |spec|\n $log.debug \"spec name : #{spec.name}\"\n\n # TODO: pick the first (newone), must check the Gemfile?\n if spec.name == 'rails'\n if $rails_version.nil?\n $log.debug \"rails version is #{spec.version}\"\n $rails_version = spec.version.to_s\n end\n end\n\n # KNOWN security functions\n # authentication\n $authentication = 'devise' if spec.name == 'devise'\n $authentication = 'authlogic' if spec.name == 'authlogic' # TODO\n\n # authorization\n $authorization = 'cancan' if spec.name == 'cancan'\n $authorization = 'the_role' if spec.name == 'the_role' # TODO\n\n # test\n # TODO: rspec?\n $test = 'cucumber' if spec.name == 'cucumber'\n\n c_path = spec.full_gem_path + '/app/controllers'\n v_path = spec.full_gem_path + '/app/views'\n if File.exists?(c_path) && File.exists?(v_path)\n if hlist[spec.name].nil?\n # new\n $log.debug \"rails app?\"\n hlist[spec.name] = [spec.version, spec.full_gem_path]\n else\n # hit, select latest one\n if hlist[spec.name][0] < spec.version\n hlist[spec.name][0] = spec.version\n hlist[spec.name][1] = spec.full_gem_path\n end\n end\n elsif File.exists?(c_path)\n puts \"TODO C only #{spec.full_gem_path}\"\n elsif File.exists?(v_path)\n puts \"TODO V only #{spec.full_gem_path}\"\n end\n end\n # Add this app\n hlist['this'] = [nil, Dir.pwd]\n hlist\n end", "def dependency_paths\n @dependency_paths ||= [\n *Dir.glob(config.pwd.join(\"**/node_modules/*/package.json\")),\n *Dir.glob(config.pwd.join(\"**/node_modules/@*/*/package.json\"))\n ].each_with_object({}) do |file, hsh|\n begin\n dirname = File.dirname(file)\n json = JSON.parse(File.read(file))\n hsh[\"#{json[\"name\"]}@#{json[\"version\"]}\"] = dirname\n rescue JSON::ParserError\n # don't crash execution if there is a problem parsing a package.json file\n # if the bad package.json file relates to a package that licensed should be reporting on\n # then this will still result in an error about a missing package\n end\n end\n end", "def search_path\n Options.custom_dir\n end", "def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scanner.included_files.collect{|f| @context.filepath_from_root(f) }\r\n end", "def search_bundle_paths(word)\n\t\n\t# Open Help dictionary and find matching lines\n\ttoc = ::IO.readlines($help_toc)\n\ttoc.each do |line|\n\t\tif line =~ /href='([a-zA-Z0-9\\/]*\\b#{word}\\w*)\\.html'/\n\t\t\t\n\t\t\tpath = $1.gsub( \"/\", \".\")\n\t\t\t\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\tend\n\t\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend", "def solr_data_dir\n File.join(solr_home, 'data', ::Rails.env)\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def data_bags_path\n\t# These can occur on suite-level, provisioner-level, verifier or at the default location\n kitchen_provisioner_config[:data_bags_path] || kitchen_verifier_config[:data_bags_path] || File.join('test', 'data_bags')\n end", "def modules_paths\n puppet_environment.full_modulepath\n end", "def modules_paths\n puppet_environment.full_modulepath\n end", "def setup\n File.expand_path(File.dirname(__FILE__) + '/data/')\n end", "def spec_dirs; end", "def find_plugin_path( mod_name )\n\t\tcandidates = self.plugin_path_candidates( mod_name )\n\t\tPluggability.log.debug \"Candidates for %p are: %p\" % [ mod_name, candidates ]\n\n\t\tcandidate_paths = candidates.\n\t\t\tflat_map {|path| Gem.find_latest_files( path ) }.\n\t\t\treject {|path| self.is_excluded_path?( path ) || ! File.file?(path) }\n\t\tPluggability.log.debug \"Valid candidates in the current gemset: %p\" % [ candidate_paths ]\n\n\t\treturn candidate_paths.first\n\tend", "def all_data_dirs(path)\n each_data_dir(path).to_a\n end", "def paths\n configuration.paths\n end", "def gem_root\n @@root\n end", "def default_gems() \n puts \"Gems found in default gem install location:\"\n gems_in_default = self.each_value.find_all do |gce|\n gce.gemsets_containing.include? 'default'\n end\n end", "def find_data(path, type: nil)\n if @data_dir\n full_path = ::File.join(@data_dir, path)\n case type\n when :file\n return full_path if ::File.file?(full_path)\n when :directory\n return full_path if ::File.directory?(full_path)\n else\n return full_path if ::File.readable?(full_path)\n end\n end\n parent&.find_data(path, type: type)\n end", "def all_data_paths(path)\n each_data_path(path).to_a\n end", "def full_require_paths\n @full_require_paths ||=\n begin\n full_paths = raw_require_paths.map do |path|\n File.join full_gem_path, path.tap(&Gem::UNTAINT)\n end\n\n full_paths << extension_dir if have_extensions?\n\n full_paths\n end\n end", "def lib_paths\n @mpc_project.recipe.get_relative_paths(@mpc_project.lib_paths)\n end", "def cookbooks_paths\n fetch(:cookbooks_paths).to_a.select { |path| File.exists? path }\n end", "def solr_data_dir\n File.expand_path(File.join(solr_dist_dir, 'example', 'solr', 'data'))\nend", "def entries_for_prod_dir vendor_product_id, year=nil\n\n entries=[]\n paths=_get_index_paths(vendor_product_id, year)\n paths.each { |path|\n Dir.entries(path).each {|entry_name|\n next if entry_name == '.' || entry_name == '..'\n entries << entry_name}\n }\n\n entries\n end", "def data_directory\n @data_directory\n end", "def find_files_for_reload\n paths = [ './', *$LOAD_PATH ].uniq\n [ $0, *$LOADED_FEATURES ].uniq.map do |file|\n next if file =~ /\\.(so|bundle)$/\n yield(find(file, paths))\n end\n end", "def site_files\n exclude = %r/tmp$|bak$|~$|CVS|\\.svn/o\n\n rgxp = %r/\\A#{data}\\/?/o\n paths = Hash.new {|h,k| h[k] = []}\n\n Find.find(data) do |p|\n next if exclude =~ p\n\n if test(?d, p)\n paths[p.sub(rgxp, '')]\n next\n end\n dir = ::File.dirname(p).sub(rgxp, '')\n paths[dir] << p.sub(rgxp, '')\n end\n\n paths\n end", "def find_gems(match, options={})\n return [] unless defined?(::Gem)\n ::Gem.search(match)\n end", "def add_to_load_path\n Gem.source_index.load_gems_in(*Gem::SourceIndex.installed_spec_directories | [ruby_spec_path, arch_spec_path])\n end", "def get_content_search_paths()\n r = @file_content_search_paths.clone\n p = find_project_dir_of_cur_buffer()\n if p.nil?\n p = vma.buffers.last_dir\n end\n\n if p and !@file_content_search_paths.include?(p)\n r.insert(0, p)\n end\n\n return r\n end", "def get_json_searchers\n Dir[File.expand_path(File.join(ROOT_PATH, 'resources','*.json'))].inject({}) do |json_searchers, file_path|\n json_searcher = JsonSearcher.new(file_path: file_path) rescue nil\n json_searchers[json_searcher.name] = json_searcher if json_searcher\n json_searchers\n end\n end", "def get_gem_home_root(arr)\n gem_string = \"/gems/\"\n ret = nil\n arr.each do |line|\n if line.include? gem_string\n ret = line.split(gem_string)[0] + gem_string\n break\n end\n end\n ret\n end", "def gemspec_path\n Pathname.glob('*.gemspec').first\n end", "def gems_dir\n # TODO: this logic seems terribly broken, but tests fail if just base_dir\n @gems_dir ||= File.join(loaded_from && base_dir || Gem.dir, \"gems\")\n end", "def described_datafiles\n if sip_descriptor\n sip_paths = sip_descriptor_datafile_info.keys\n\n cached_datafiles.inject([]) do |acc, df|\n sp = df['sip-path']\n acc << df if sip_descriptor_datafile_info.has_key? sp\n acc\n end\n\n else\n []\n end\n end", "def each_advisory_path(&block)\n Dir.glob(File.join(@path,'gems','*','*.yml'),&block)\n end", "def find_paths(dir=\"\")\n base = File.join(@source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir[\"*\"]) }\n paths = []\n\n entries.each do |entry|\n absolute_path = File.join(base, entry)\n relative_path = File.join(dir, entry)\n\n if File.directory?(absolute_path)\n paths.concat find_paths(relative_path)\n else\n paths << absolute_path\n end\n end\n paths\n end", "def paths\n root.paths\n end", "def search_project_paths(word)\n\t\n\t# Collect all .as and .mxml files with a filename that contains the search\n\t# term. When used outside a project this step is skipped.\n\tTextMate.each_text_file do |file|\n\t\t\n\t\tif file =~ /\\b#{word}\\w*\\.(as|mxml)$/\n\t\t\t\n\t\t\tpath = file.sub( $project, \"\" );\n\t\t\t\n\t\t\tcommon_src_dirs.each do |remove|\n\t\t\t\tpath = path.gsub( /^.*\\b#{remove}\\b\\//, '' );\n\t\t\tend\n\n\t\t\tpath = path.gsub(/\\.(as|mxml)$/,'').gsub( \"/\", \".\").sub(/^\\./,'')\n\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend\n\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend", "def plugin_files_by_dir\n Array(Ohai.config[:plugin_path]).inject([]) do |plugin_files, plugin_path|\n plugin_files + PluginFile.find_all_in(plugin_path)\n end\n end", "def stage_install_paths(stage)\n select_existing_paths = proc do |cookbook_path, paths|\n paths.select {|from, _| cookbook_path.join(from).exist?}\n end\n\n common_paths = [['metadata.json', 'metadata.json']]\n\n Dir[vendor_path.join('*')]\n .map(&Pathname.method(:new))\n .map do |cookbook_path|\n cookbook_name = File.basename cookbook_path\n is_builder = (cookbook_name == name)\n is_dimod = cookbook_name.start_with? 'dimod-'\n dimod_enabled = is_dimod && enabled_modules.include?(cookbook_name)\n\n paths = if is_builder\n common_dapp_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}/common\", 'files/default'],\n [\"templates/#{stage}/common\", 'templates/default'],\n *enabled_recipes.flat_map do |recipe|\n [[\"files/#{stage}/#{recipe}\", 'files/default'],\n [\"templates/#{stage}/#{recipe}\", 'templates/default']]\n end\n ]\n )\n\n recipe_paths = enabled_recipes\n .map {|recipe| [\"recipes/#{stage}/#{recipe}.rb\", \"recipes/#{recipe}.rb\"]}\n .select {|from, _| cookbook_path.join(from).exist?}\n\n if recipe_paths.any?\n [*recipe_paths, *common_dapp_paths]\n else\n [nil, *common_dapp_paths]\n end\n elsif is_dimod && dimod_enabled\n common_dimod_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}\", 'files/default'],\n ['files/common', 'files/default'],\n [\"templates/#{stage}\", 'templates/default'],\n ['templates/common', 'templates/default'],\n [\"attributes/#{stage}.rb\", \"attributes/#{stage}.rb\"],\n ['attributes/common.rb', 'attributes/common.rb']\n ]\n )\n\n recipe_path = \"recipes/#{stage}.rb\"\n if cookbook_path.join(recipe_path).exist?\n [[recipe_path, recipe_path], *common_dimod_paths]\n else\n [nil, *common_dimod_paths]\n end\n elsif !is_dimod\n [['.', '.']]\n end\n\n [cookbook_path, paths] if paths && paths.any?\n end.compact\n end", "def data_dir\n @datadir\n end", "def gemfile_path\n @gemfile_path ||= GEMFILES.map { |g| @config.pwd.join g }\n .find { |f| f.exist? }\n end", "def load_paths\n unless @load_paths\n @load_paths = []\n \n if File.directory?(app_path)\n @load_paths << app_path\n \n # Sort for consistency\n self.class.mixable_app_types.keys.map(&:to_s).sort.each do |type|\n path = \"#{app_path}/#{type}\"\n @load_paths << path if File.directory?(path)\n end\n end\n end\n \n @load_paths\n end", "def known_cookbook_paths\n # Keep a cache of it for performance.\n unless defined?(@cookbook_paths)\n config_file = \"#{@repository_path}/config.rb\"\n @cookbook_paths = (\n ['cookbooks'] +\n if File.exist?(config_file)\n # Read the knife configuration to get cookbook paths\n dsl_parser = DslParser.new\n dsl_parser.parse(config_file)\n cookbook_path_call = dsl_parser.calls.find { |call_info| call_info[:method] == :cookbook_path }\n cookbook_path_call.nil? ? [] : cookbook_path_call[:args].first\n else\n []\n end\n ).\n map do |dir|\n # Only keep dirs that actually exist and are part of our repository\n full_path = dir.start_with?('/') ? dir : File.expand_path(\"#{@repository_path}/#{dir}\")\n full_path.start_with?(@repository_path) && File.exist?(full_path) ? full_path.gsub(\"#{@repository_path}/\", '') : nil\n end.\n compact.\n sort.\n uniq\n end\n @cookbook_paths\n end", "def find_packages\n LockfileParser.read(lockfile_path)\n end", "def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end", "def find(dirs); end", "def vendored_path_parts(package)\n return if package.nil? || package[\"Dir\"].nil?\n package[\"Dir\"].match(/^(?<vendor_path>#{config.root}(\\/.+)*\\/[^\\/]*vendor[^\\/]*)\\/(?<import_path>.+)$/i)\n end", "def gem_development_dirs\n @gem_development_dirs ||= if ENV['GEM_DEV_DIR']\n ENV['GEM_DEV_DIR'].split(';')\n else\n [\"#{`echo $HOME`.strip}/code/gems\"]\n end\n end", "def plugins_path\n data[:plugins_path]\n end", "def load_paths\n @_load_paths_was = %w(lib models shared).map { |path| Padrino.root(path) }\n @_load_paths ||= @_load_paths_was\n end", "def lookup(glob, flags=0)\n pwd = File.expand_path(Dir.pwd)\n home = File.expand_path('~')\n while pwd != '/' && pwd != home\n paths = Dir.glob(File.join(pwd, glob), flags)\n return paths unless paths.empty?\n break if ROOT_INDICATORS.any?{ |r| File.exist?(File.join(pwd, r)) }\n pwd = File.dirname(pwd)\n end\n return []\n end", "def base_directories\n @base_dirs ||= names.map { |name| ::Gem::Specification.find_by_name(name).gem_dir }\n end", "def paths\n tree_path = File.join(File.dirname(__FILE__), 'rails_tree')\n [\"\", \"multitest\", \"results\"].inject([tree_path]) do |result, suffix|\n result << File.join(result[-1], suffix)\n end[1..3]\n end", "def cookbooks\n get_directories_absolute_paths cookbooks_path\n end", "def desired_contents\n @environments.map {|env| env.dirname }\n end", "def project_files\n keep = %r/.rake$|Rakefile$|.patch$|.c$/\n strip_path = %r/\\A#{data}?/o\n paths = Hash.new { |h,k| h[k] = [] }\n Find.find( data ) do |path|\n next unless keep =~ path\n\n if File.directory?( path ) then\n paths[ path.sub( strip_path, '' ) ]\n next\n end\n dir = ::File.dirname( path ).sub( strip_path, '' )\n paths[dir] << path.sub( strip_path, '' )\n end\n\n return paths\n end", "def expound_paths(*entries)\n paths = []\n\n entries.each do |entry|\n entry = entry.strip\n\n next if entry.empty?\n next if entry.start_with?('#')\n\n if File.directory?(entry)\n if library_path?(entry)\n paths << entry\n else\n if File.directory?(File.join(entry, 'gems'))\n subpaths = Dir.glob(File.join(entry, 'gems/*/'))\n else\n subpaths = Dir.glob(File.join(entry, '*/'))\n end\n subpaths.each do |subpath|\n paths << subpath if library_path?(subpath)\n end\n end\n elsif File.file?(entry)\n paths.concat(expound_paths(*File.readlines(entry)))\n else\n glob_paths = Dir.glob(entry)\n if glob_paths.first != entry\n paths.concat(expound_paths(*glob_paths))\n end\n end\n end\n\n paths\n end" ]
[ "0.67978895", "0.6582824", "0.65235054", "0.64876014", "0.6485551", "0.63830143", "0.6360867", "0.63585126", "0.6349846", "0.63223344", "0.6300142", "0.6299768", "0.6294332", "0.6285686", "0.6240776", "0.62154865", "0.62132496", "0.6209585", "0.6206423", "0.6202027", "0.6202027", "0.6202027", "0.619", "0.61597633", "0.61446387", "0.61342", "0.61268544", "0.61099213", "0.6092784", "0.60923404", "0.6058505", "0.6047702", "0.60302037", "0.602998", "0.6003243", "0.5987946", "0.5981095", "0.59774673", "0.5971091", "0.59499156", "0.594485", "0.5905845", "0.5901942", "0.58754325", "0.5867771", "0.5860084", "0.58528507", "0.5850402", "0.5844952", "0.58416367", "0.58323205", "0.5830269", "0.5812053", "0.5810703", "0.581037", "0.5809957", "0.57941145", "0.5793613", "0.5772964", "0.57612914", "0.57598084", "0.5758939", "0.5746255", "0.5745889", "0.5732736", "0.57318157", "0.5714301", "0.57103026", "0.57024336", "0.56812966", "0.56794596", "0.5678394", "0.5671703", "0.5665852", "0.5660555", "0.5652704", "0.563146", "0.5622899", "0.56224716", "0.5616488", "0.56148267", "0.56025314", "0.5598287", "0.5593158", "0.5584214", "0.55836135", "0.5583072", "0.55826586", "0.5579337", "0.5578073", "0.5574101", "0.5573241", "0.5572281", "0.5570329", "0.55660146", "0.55635726", "0.55613524", "0.55609334", "0.5553368", "0.55470693" ]
0.70380396
0
Removes path and expiration values from cookie.
def extract_cookie(cookie_val) cleaned_val = cookie_val.gsub(/(path=[^,;]+[,;])|(expires=.*)/, ' ') cleaned_val.gsub!(/\s+/, ' ') if @proxied_cookies.empty? return ['', cleaned_val] else @proxied_cookies.each do |key| if match = cleaned_val.match(/#{key}=(?<val>(.*));/i) return [key, match[:val]] end end end ['', ''] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unset\n @cookies.delete cookie_name, cookie_options\n end", "def clear_cookie\n create_accesses_cookie\n end", "def delete_cookie(cookies)\n cookies.delete('token')\n @user.update(token: '')\n end", "def destroy\n\t\tcookies.delete 'Vanilla'\n\t\tcookies.delete 'Vanilla-Volatile'\n\t\tsuper\n\tend", "def clear_cookies\n \tcookies.delete(:auth_token)\n end", "def delete_cookie(name)\n cookie = Cookie.new(name, \"\")\n cookie.expires = 1.year.ago \n @context.add_cookie(cookie) \n end", "def expire_cookies(session = false)\n @domains.delete_if do |_domain, paths|\n paths.delete_if do |_path, cookies|\n cookies.delete_if do |_cookie_name, cookie|\n cookie.expired? || (session && cookie.session?)\n end\n cookies.empty?\n end\n paths.empty?\n end\n end", "def delete_cookie(name); end", "def delete_all_cookies; end", "def cookie_expiration\n super\n end", "def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end", "def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end", "def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end", "def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end", "def delete_cookie(key, value = {})\n Rack::Utils.delete_cookie_header!(@headers, key, value)\n end", "def delete(name, options = {})\n set_cookie(name, \"\", options.merge(\"expires\" => Time.at(0)))\n end", "def cookie_path; end", "def delete_cookie(name)\n set_cookie(name, nil, Merb::Const::COOKIE_EXPIRED_TIME)\n end", "def uncookie_user\n cookies.delete :auth, :domain => site_domain\n end", "def remove_session_cookie\n headers['Set-Cookie'] = session_cookie \"x; expires=#{Time.at(0).httpdate}\"\n end", "def delete_cookie name, path\r\n command 'deleteCookie', name, path\r\n end", "def delete(name, options = {})\n options.stringify_keys!\n set_cookie(options.merge(\"name\" => name.to_s, \"value\" => \"\", \"expires\" => Time.at(0)))\n end", "def cookie_path=(_arg0); end", "def delete_cookie\n cookies.delete :auth_token\n end", "def log_out\n\t\tcookies.delete(:cookie_id)\n\n\tend", "def clearcookies\n cookies.delete Prismic::PREVIEW_COOKIE\n redirect_to '/'\n end", "def delete(name)\n set_cookie(\"name\" => name.to_s, \"value\" => \"\")\n end", "def forget(user)\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def delete_cookie name\n @response.delete_cookie name\n end", "def path=(path)\n\t\t# {{{\n\t\tunless path.class == String || path == nil\n\t\t\traise TypeError, \"The path of a cookie must be nil or a string\", caller\n\t\tend\n\t\t@path = path\n\t\t# }}}\n\tend", "def check_for_removal\n if @value && @unused && @unused[\"unused\"]\n @res.cookies << create_cookie(\"unused\", false, 'flash_unused')\n elsif @value\n @value = nil\n @res.cookies << create_cookie(\"unused\", nil, 'flash_unused')\n @res.cookies << create_cookie(\"message\", nil)\n end\n end", "def sign_out\n cookies.permanent[:auth_token] = nil\n session[:scope_id] = session[:scope_type] = session[:redirect] = nil\n end", "def logout\n cookies[:key] = nil\n redirect_to root_path\n end", "def delete_cookie(key)\n ::Rack::Utils.delete_cookie_header!(@_headers, key, {})\n end", "def delete_cookie(key)\n ::Rack::Utils.delete_cookie_header!(@_headers, key, {})\n end", "def after_save\n cookies['global_properties_for_user'] = nil\n end", "def finish\n @cookies.delete(RACK_SESSION_KEY)\n @cookies.each do |k,v|\n next unless changed?(k)\n v.nil? ? delete_cookie(k) : set_cookie(k, _merge_default_values(v))\n end if changed?\n end", "def destroy_auth_tkt_cookie\n # reset ticket value of cookie, to log out even if deleting cookie fails\n cookies[:auth_tkt] = { :value => '', :expire => Time.at(0), :domain => DOMAIN }\n cookies.delete :auth_tkt\n end", "def forget(user)\nuser.forget\ncookies.delete(:user_id)\ncookies.delete(:remember_token)\nend", "def forget(user)\nuser.forget\ncookies.delete(:user_id)\ncookies.delete(:remember_token)\nend", "def set_cookie_expiration(opts)\n opts = check_params(opts,[:expirations])\n super(opts)\n end", "def clear_cookies\n @cookie_jar = CookieJar.new([], @default_host)\n end", "def clean\n synchronized { @hash.delete_if { |_key, value| expired?(value) } }\n end", "def forget(user)\n user.update_attribute(:remember_digest, nil)\n cookies.delete(:student_id) if student?\n cookies.delete(:tutor_id) if tutor?\n cookies.delete(:remember_token)\n end", "def reset_cookies\n if !user_signed_in?\n cookies.delete(:truck)\n end\n end", "def delete key, opts ={}\n return if confined?\n @response.delete_cookie key, opts\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\nend", "def forget_user_from_cookie(user)\n user.forget_digest\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.unpersist # In the database\n cookies.delete(:user_id) # In the browser\n cookies.delete(:remember_token) # In the browser\n end", "def cleanup(session = false)\n # if session\n # select { |cookie| cookie.session? || cookie.expired? }\n # else\n # select(&:expired?)\n # end.each { |cookie|\n # delete(cookie)\n # }\n # # subclasses can optionally remove over-the-limit cookies.\n # self\n end", "def clean_expired!\n sessions.remove( { :expire => { '$lt' => Time.now } } )\n end", "def manually_set_cookie(value, expire_in)\n expire_date = expire_in.from_now.gmtime.strftime('%a, %d %b %Y %H:%M:%S GMT')\n response['Set-Cookie'] =\n \"cookiePermissions=#{value}; Expires=#{expire_date}; Path=/; SameSite=Lax\"\n end", "def expire_cache(path = nil)\n return unless Sinatra.options.cache_enabled\n \n path = (path.nil?) ? cache_page_path(request.path_info) : cache_page_path(path)\n if File.exist?(path)\n File.delete(path)\n #log.info( \"Expired Page deleted at: [#{path}]\")\n else\n #log.info( \"No Expired Page was found at the path: [#{path}]\")\n end\n end", "def forget\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\nend", "def log_out\n cookies.delete :remember_token\n end", "def delete key, opts ={}\n return if readonly?\n response.delete_cookie key, opts\n end", "def sign_out\n\tcookies.delete(:remember_token)\n\tcurrent_user = nil\n end", "def finish\n @cookies.delete(Action::RACK_SESSION)\n if changed?\n @cookies.each do |k, v|\n next unless changed?(k)\n\n v.nil? ? delete_cookie(k) : set_cookie(k, _merge_default_values(v))\n end\n end\n end", "def after_sign_out_path_for(resource_or_scope)\n cookies.delete :session\n building_path\n end", "def clear(path)\n set_internal(path, nil)\n end", "def forget(user)\n user.forget\n cookies.delete :id\n cookies.delete :remember_token\n end", "def expires=(value)\n @expires = value\n @expires_in = nil\n end", "def cookies(path=\"/\")\n _cookies(path_to_array(path))\n end", "def forget(user)\n user.delete_remember_digest\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:user_type_string)\n cookies.delete(:remember_token)\n end", "def forget(employee)\n employee.forget\n cookies.delete(:employee_id)\n cookies.delete(:remember_token)\n end", "def sign_out\n\t\tcurrent_user.update_attribute(:remember_token, User.encrypt(user.new_remember_token))\n\n\t\tcookies.delete(:remember_token) #not a hash value\n\t\tself.current_user = nil\n\tend", "def forget(user)\n\t user.forget\n\t cookies.delete(:user_id) #delete user_id cookie\n\t cookies.delete(:remember_token) #delete remember_token cookie\n\tend", "def forget(user)\n user.forget if user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n cookies.delete(:user_type)\n end", "def forget (user)\n\tuser.forget\n\tcookies.delete(:user_id)\n\tcookies.delete(:remember_token)\nend", "def forget(user)\n user.forget # set user.remember_digest as nil\n cookies.delete(:user_id)\n cookies.delete(:remember_token) \n end", "def cookie_remove(name)\n return dup_without_response.cookie_remove(name) if response\n\n # Remove just one matching cookie from the end.\n rejected = false\n new_cookies = cookies.reverse.reject do |cookie_name, cookie_value|\n if !rejected && (cookie_name == name)\n rejected = true\n else\n false\n end\n end.reverse\n\n cookies_string = HTTY::CookiesUtil.cookies_to_string(new_cookies)\n if cookies_string\n @headers[COOKIES_HEADER_NAME] = cookies_string\n else\n @headers.delete COOKIES_HEADER_NAME\n end\n self\n end", "def delete_cookie(name)\n browser.delete_cookie(name)\n end", "def forget(user)\n\tuser.forget\n\tcookies.delete(:user_id)\n\tcookies.delete(:remember_token)\n end", "def logout_user\n cookies.delete(:auth_token)\n end", "def sign_out\n\t\tself.current_user = nil \n\t\tcookies.delete(:remember_token)\n\tend", "def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n\n end", "def log_out\n cookies.delete :user_id\n cookies.delete :username\n redirect_to :action => \"sign_in\"\n end", "def forget(doctor)\n doctor.forget\n cookies.delete(:doctor_id)\n cookies.delete(:remember_token)\n end", "def sign_out\n @username = nil\n @current_user = nil\n\n @modhash = nil\n @cookie = nil\n end", "def forget(user)\n user.forget\n cookies.delete(:investor_id)\n cookies.delete(:remember_token)\n end", "def sign_out\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n session.delete(:user_id)\n current_user = nil\n end", "def forget(user)\n user.forget\n cookies.delete(:username)\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget # Defined in the User model\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def forget(company)\n company.forget\n cookies.delete(:company_id)\n cookies.delete(:remember_token)\n end", "def sign_out\n current_user = nil\n cookies.delete(:remember_token)\n end", "def sign_out\n current_user = nil\n cookies.delete(:remember_token)\n end", "def sign_out\n current_user = nil\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget #nil out remember_digest\n cookies.delete(:current_user_id)\n cookies.delete(:remember_token)\n end", "def sign_out\n\t\t@current_user = nil\n\t\tcookies.delete :remember_token\n\tend", "def sign_out\n self.current_user = nil \n cookies.delete(:remember_token)\n end", "def sign_out\n\t\tself.current_user = nil\n\t\tcookies.delete(:remember_token)\n\tend", "def sign_out\n current_user.update_attribute(:remember_token,\n User.digest(User.new_remember_token))\n cookies.delete(:remember_token)\n current_user.meal.delete\n self.current_user = nil\n end", "def clean(age = 2419200)\n clean_dir(@dir, @data.values.map{ |v| v['path'] }, Time.now - age)\n end", "def forget (user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end", "def sign_out\r\n self.current_user = nil\r\n cookies.delete(:remember_token)\r\n end", "def sign_out\n\t\tcookies.delete(:remember_token)\n\t\tcurrent_user = nil\n\tend", "def forget(user)\r\n user.forget\r\n cookies.delete(:user_id)\r\n cookies.delete(:remember_token)\r\n end", "def sign_out\n #forget(current_user)\n self.current_user = nil\n cookies.delete(:remember_token)\n end", "def forget(user)\n user.forget\n cookies.delete(:user)\n cookies.delete(:remember_token)\n end" ]
[ "0.64445007", "0.63492787", "0.6333", "0.63261294", "0.62320757", "0.6213248", "0.6154333", "0.6152161", "0.61477566", "0.6104468", "0.6054121", "0.6054121", "0.6054121", "0.6054121", "0.6036387", "0.6011818", "0.60099953", "0.60079265", "0.5995761", "0.5981008", "0.59489274", "0.5922504", "0.58963877", "0.58816206", "0.5858258", "0.5856219", "0.58326733", "0.5763861", "0.5744316", "0.57151425", "0.57055026", "0.57041776", "0.56815904", "0.5671141", "0.5671141", "0.56679076", "0.564299", "0.56328446", "0.56299907", "0.56299907", "0.56156594", "0.5614156", "0.56080514", "0.5589422", "0.557221", "0.55566007", "0.552598", "0.5517226", "0.5495488", "0.54739463", "0.5472917", "0.5458765", "0.54443794", "0.5432292", "0.54153043", "0.5404968", "0.54014766", "0.539191", "0.538839", "0.5387132", "0.5384776", "0.5381115", "0.53752106", "0.53725505", "0.53560907", "0.5354347", "0.5348476", "0.5343935", "0.5339408", "0.5337197", "0.53271407", "0.53199935", "0.53157645", "0.53144735", "0.5309528", "0.5305794", "0.53032184", "0.5302392", "0.5294435", "0.529027", "0.5290015", "0.52895087", "0.52881855", "0.5285443", "0.52849644", "0.5282753", "0.5282753", "0.5282753", "0.5282639", "0.52781886", "0.52737516", "0.52628547", "0.526236", "0.52618086", "0.525919", "0.5249661", "0.52419615", "0.5235733", "0.52352977", "0.523354" ]
0.5270168
91
GET /problems/1 GET /problems/1.json
def show request.headers respond_to do |format| format.html format.mobile{render :layout => !request.xhr?} format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def index\n @problems = Problem.all\n end", "def index\n @problems = Problem.all\n end", "def index\n @problems = Problem.all\n end", "def index\n @problems = Problem.active.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @problems }\n end\n end", "def index\n @problems = Problem.all\n end", "def show\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problem }\n end\n end", "def show\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problem }\n end\n end", "def show\n @problem = Problem.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @problem }\n end\n end", "def index\n @problems = Problem.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n\n respond_with @problems\n end", "def show\n include_admin = @current_user.is_admin?\n @submissions_table = @contest.all_submissions_table(include_admin)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problems }\n end\n end", "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end", "def retrieve_solved\n\t\trender json: @@problems_solved_shared\n\tend", "def show\n @problem = Problem.find(params[:id])\n end", "def show\n @problem = Problem.find_by_shortname(params[:id])\n @solutions = @problem.solutions.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n add_breadcrumb @problem.name, problem_path(@problem)\n respond_with @problem\n end", "def show\n # fetch sub problems and put it in json\n cause = []\n @problem.problem_references.each do |problem_reference|\n cause << problem_reference.sub_problem\n end\n @problem_attributes = @problem.attributes.merge(cause: cause)\n render json: @problem_attributes\n end", "def index\n @search = Problem.search(params[:q])\n @problems = @search.result.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @problems }\n end\n end", "def index\n @problems = Problem.all.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 8)\n @problem = Problem.new\n end", "def show\n\t\t@problem = Problem.find(params[:id])\n\tend", "def index\n @problems = Problem.where(source: params[:source]).first(10)\n if @problems.nil?\n spider = get_spider(params[:source])\n problems = spider.spide_problems\n problems.each do |problem|\n Problem.create(problem)\n end\n @problems = Problem.where(source: params[:source]).first(10)\n end\n render json: @problems\n end", "def get_contestproblem\n @contestproblem = Contestproblem.find_by_id(params[:id])\n return if check_nil_object(@contestproblem)\n @contest = @contestproblem.contest\n end", "def show\n @editor = Editor.find(params[:id])\n @problems = @editor.problems.order('created_at DESC')\n end", "def index\n if params[:query].present?\n @problems = Problem.global_search(params[:query])\n else\n @problems = Problem.all\n end\n end", "def new\n @problem = Problem.new\n @problem.answers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def index\n if params[:problem_id]\n @problem = Problem.find_by_shortname(params[:problem_id])\n @solutions = @problem.solutions.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n add_breadcrumb(@problem.name, problem_path(@problem))\n else\n @solutions = Solution.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n end\n add_breadcrumb \"Solutions\", problem_solutions_path(@problem)\n respond_to :html, :json, :js\n end", "def index\n @admin_problems = Problem.all\n end", "def index\n @page_title = \"Problem List\"\n respond_to do |format|\n format.html\n format.json {\n render json: ProblemsDatatable.new(view_context)\n }\n end\n end", "def get_problem\n @problem = Problem.find_by_id(params[:problem_id])\n return if check_nil_object(@problem)\n end", "def show\n @problem = Problem.find(params[:id])\n authorize @problem, :show?\n\n #TODO: restrict to problems that current user owns/manages\n @problem_sets = ProblemSet.all.select { |set| policy(set).use? } # TODO: fix to be more efficient\n @submissions = @problem.submission_history(current_user)\n\n @all_subs = {};\n @sub_count = {};\n @problem.submissions.each do |sub|\n \t @all_subs[sub.user] = [(@all_subs[sub.user] or sub), sub].max_by {|m| m.score or 0 }\n @sub_count[sub.user] = (@sub_count[sub.user] or 0) + 1\n end\n @all_subs = @all_subs.map {|s| s[1]}\n\n respond_to do |format|\n format.html { render :layout => \"problem\" }\n end\n\n if user_signed_in?\n UserProblemRelation.where(:user_id => current_user.id, :problem_id => params[:id]).first_or_create!.view! unless in_su?\n end\n end", "def respides\n n = Problem.where(source: params[:source]).count\n spider = get_spider(params[:source])\n problems = spider.spide_problems(n)\n problems.each do |problem| \n Problem.create(problem)\n end\n @problems = Problem.where(source: params[:source]).limit(10).order(:id).reverse_order\n render json: @problems\n end", "def new\n @problem_solution = ProblemSolution.new\n\n if params[:problem_id]\n @problem_solution.problem = Problem.find(params[:problem_id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @problem = Problem.new\n add_breadcrumb \"New Problem\"\n respond_with @problem\n end", "def index\n @problems = @problems.distinct.score_by_user(current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @problems }\n end\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def index\n @problems = Problem.search(params[:search], order: :posted_date, :per_page => Problem.per_page, :page => params[:page])\n #@problems = Problem.all(order: :posted_date, :per_page => Problem.per_page, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @problems }\n end\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def create\n @problem = Problem.new(problem_params)\n\n if @problem.save\n render json: @problem, status: :created, location: @problem\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end", "def request_problems()\n problem_array = []\n self.requests.each do |request|\n problem_array.push(Problem.find(request.problem_id))\n end\n problem_array\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end", "def create\n @problem = current_user.problems.build(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to root_path, notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_problem number\n @url << number.to_s\n page = HTTParty.get(@url)\n parse_page = Nokogiri::HTML(page)\n problem = []\n parse_page.css(\"p\").length.times do |n|\n problem << parse_page.css(\"p\")[n].text\n end\n problem\n end", "def destroy\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :ok }\n end\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def index\n @problemas = Problema.all\n end", "def problems_index\n \"#{edit_course_assessment_path(@course, @assessment)}/#tab_problems\"\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def problem_params\n params[:problem]\n end", "def get_contestproblem2\n @contestproblem = Contestproblem.find_by_id(params[:contestproblem_id])\n return if check_nil_object(@contestproblem)\n @contest = @contestproblem.contest\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end", "def index \n render :json => Project.find(11).bug_tracker.bugs\n end", "def update\n @problem = Problem.find(params[:id])\n\n if @problem.update(problem_params)\n head :no_content\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def new\n @submission = Submission.new\n @submission.problem = params[:problem].to_i if params[:problem]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @submission }\n end\n end", "def destroy\n @problem = Problem.find_by_shortname(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def new\n @problem = current_user.problems.build\n end", "def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @problem, :notice => 'Problem was successfully created.' }\n format.json { render :json => @problem, :status => :created, :location => @problem }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def issues\n @query = Query.new(:name => \"_\")\n @issues = @query.issues(:order => \"issues.created_on desc\", :limit => 50, :include => [:project, :author])\n res = Array.new\n @issues.each do |is|\n res << {:issue_id => is.id, :issue_title => is.subject, :issue_content => is.description, :project_name => is.project.name,\n :author_name => is.author.to_s, :author_email => is.author.mail, :issue_created_at => is.created_on, :issue_status => is.status.to_s }\n end\n render :json => res.to_json\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @problem }\n else\n format.html { render action: 'new' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @solution = Solution.new\n @problem = Problem.find_by_shortname(params[:problem_id])\n breadcrumbs\n add_breadcrumb \"New Solution\"\n respond_with @solution\n\n end", "def index\n @problems = Problem.all\n @users = User.order(\"points desc\").limit(12).all\n @problemsets = Problemset.all\n\n end", "def destroy\n @problem = Problem.find(params[:id])\n if @problem\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url, notice: 'Problem was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n format.html { render @problem }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @problems_user = ProblemsUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @problems_user }\n end\n end", "def new\n @bug = Bug.new\n @users =Bug.get_users_project(get_project_id)\n get_count_of_issue\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def show\n @problem = Problem.find_by_shortname(params[:problem_id])\n breadcrumbs\n add_breadcrumb @solution.profile.user.username, problem_solution_path(@problem, @solution)\n respond_with @solution\n end", "def set_problem\n\t @problem = Problem.find(params[:id])\n\t end", "def index\n params[:problem_id] ?\n @problem_solutions = ProblemSolution.paginate(page: params[:page], per_page: 5).order('updated_at ASC').find_all_by_problem_id(params[:problem_id]) :\n @problem_solutions = ProblemSolution.accessible_by(current_ability).paginate(page: params[:page], per_page: 5).order('updated_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def report(problems)\n json = []\n problems.each do |message|\n next if message[:kind] == :ignored && !PuppetLint.configuration.show_ignored\n\n message[:KIND] = message[:kind].to_s.upcase\n\n if message[:kind] == :fixed || [message[:kind], :all].include?(configuration.error_level)\n if configuration.json\n message['context'] = get_context(message) if configuration.with_context\n json << message\n else\n format_message(message)\n print_context(message) if configuration.with_context\n end\n end\n end\n puts JSON.pretty_generate(json) if configuration.json\n\n $stderr.puts 'Try running `puppet parser validate <file>`' if problems.any? { |p| p[:check] == :syntax }\n end", "def difficulty\n request('getdifficulty')\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @problem] }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to admin_problem_path(@problem), notice: 'Problem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @problem }\n else\n format.html { render action: 'new' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @problems = current_user.followeds_problems\n @problem = Problem.new\n @users_first_three = current_user.who_follow.last(3)\n end", "def index\n @reqdifficulties = Reqdifficulty.all\n end", "def index\n @problemas = @consulta.problemas\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 @problem_attempts = ProblemAttempt.all\n end", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def problem_params\n params.require(:problem).permit(:title, :content)\n end", "def new\n @problem = Problem.new\n @problem.titles.build({:locale => \"es\"})\n @problem.titles.build({:locale => \"en\"})\n @problem.descriptions.build({:locale => \"es\"})\n @problem.descriptions.build({:locale => \"en\"})\n @problem.cases.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def destroy\n @problem = @solution.problem\n @solution.destroy\n\n respond_to do |format|\n format.html { redirect_to problem_solutions_url }\n format.json { head :no_content }\n end\n end", "def show\n render :json => Project.find(params[:project_id]).bug_tracker.bugs.find(params[:id])\n end", "def show\n #TODO: restrict to problems that current user owns/manages\n @problem_sets = ProblemSet.accessible_by(current_ability,:update) # can only add problem to problem sets user can update to\n @submissions = @problem.submission_history(current_user)\n\n @all_subs = {};\n @sub_count = {};\n @problem.submissions.each do |sub|\n \t @all_subs[sub.user] = [(@all_subs[sub.user] or sub), sub].max_by {|m| m.score or 0 }\n @sub_count[sub.user] = (@sub_count[sub.user] or 0) + 1\n end\n @all_subs = @all_subs.map {|s| s[1]}\n\n respond_to do |format|\n format.html { render :layout => \"problem\" }\n format.xml { render :xml => @problem }\n end\n end" ]
[ "0.7573485", "0.7226409", "0.7226409", "0.7226409", "0.7224276", "0.71510506", "0.7076648", "0.7076648", "0.7019441", "0.6847158", "0.67619693", "0.6740194", "0.6740194", "0.6713735", "0.67055875", "0.67037416", "0.6671908", "0.6648854", "0.66116905", "0.65953594", "0.6579332", "0.6534826", "0.6320968", "0.63147867", "0.6294903", "0.62740797", "0.6270063", "0.625011", "0.6247423", "0.62365633", "0.6232025", "0.62132055", "0.6186772", "0.6177892", "0.6175337", "0.61650723", "0.61650723", "0.61650723", "0.61650723", "0.6154389", "0.61434567", "0.614304", "0.6132114", "0.6122245", "0.6122245", "0.6122245", "0.6122245", "0.61102223", "0.6086303", "0.6085366", "0.6063042", "0.6060548", "0.6055355", "0.6042419", "0.602524", "0.6024836", "0.6024607", "0.60196745", "0.6011948", "0.60059524", "0.59870523", "0.5985389", "0.59812903", "0.59812903", "0.59812903", "0.59812903", "0.59812903", "0.59812903", "0.59812903", "0.59812903", "0.59618676", "0.59615237", "0.5949893", "0.5940573", "0.5939898", "0.59367114", "0.59311455", "0.59248465", "0.5911443", "0.59084475", "0.5894914", "0.58893085", "0.5880254", "0.5877127", "0.5876636", "0.5867203", "0.5857393", "0.58416766", "0.58273363", "0.58258307", "0.5825114", "0.58143723", "0.5805658", "0.5798535", "0.57951003", "0.5777594", "0.5776386", "0.5765559", "0.5750499", "0.5749966", "0.5741169" ]
0.0
-1
GET /problems/new GET /problems/new.json
def new @problem.description = <<-HERE.strip_heredoc Your problem: ------------- Items that **must** have: 1. house 3. table 2. fridge Items to be _solved_: - It would be good to have a nice Ipad - and an Apple TV - an a Time capsule [Link to Apple](http://www.apple.com/) > Knowing others is intelligence; knowing yourself is true wisdom. Mastering others is strength; mastering yourself is true power. If you realize that you have enough, you are truly rich. This is a preformatted text1 This is a preformatted text2 HERE @preview = BlueCloth.new(@problem.description).to_html.html_safe respond_to do |format| format.html # new.html.erb format.json { render json: @problem } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end", "def new\n @problem = Problem.new\n add_breadcrumb \"New Problem\"\n respond_with @problem\n end", "def new\n @problem = Problem.new\n @problem.answers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = current_user.problems.build\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @problem_solution = ProblemSolution.new\n\n if params[:problem_id]\n @problem_solution.problem = Problem.find(params[:problem_id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def create\n @problem = current_user.problems.build(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to root_path, notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(problem_params)\n\n if @problem.save\n render json: @problem, status: :created, location: @problem\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @problem, :notice => 'Problem was successfully created.' }\n format.json { render :json => @problem, :status => :created, :location => @problem }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @submission = Submission.new\n @submission.problem = params[:problem].to_i if params[:problem]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @submission }\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @normal_issue = NormalIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @normal_issue }\n end\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @problem }\n else\n format.html { render action: 'new' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @solution = Solution.new\n @problem = Problem.find_by_shortname(params[:problem_id])\n breadcrumbs\n add_breadcrumb \"New Solution\"\n respond_with @solution\n\n end", "def new\n @problems_user = ProblemsUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @problems_user }\n end\n end", "def new\n @important_issue = ImportantIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @important_issue }\n end\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to admin_problem_path(@problem), notice: 'Problem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @problem }\n else\n format.html { render action: 'new' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def new\n @problem = Problem.new\n @problem.titles.build({:locale => \"es\"})\n @problem.titles.build({:locale => \"en\"})\n @problem.descriptions.build({:locale => \"es\"})\n @problem.descriptions.build({:locale => \"en\"})\n @problem.cases.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @problem] }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @bug = Bug.new\n @users =Bug.get_users_project(get_project_id)\n get_count_of_issue\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def create\n @problem = Problem.new(problem_params)\n create_tags\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @mistake = Mistake.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mistake }\n end\n end", "def new\n @work = Work.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @fix_issue = FixIssue.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fix_issue }\n end\n end", "def new\n @issue = @issuable.issues.new\n @issue.comments.build\n\n respond_to do |format|\n format.html { render layout: 'form' }# new.html.erb\n format.json { render json: @issue }\n end\n end", "def create\n response.headers.delete \"X-Frame-Options\"\n\n @problem = Problem.new(problem_params)\n\n @problem.tag_list = @problem.tag_list[0].to_s.scan(/\\w+/)\n @problem.status = \"Open\"\n @problem.user = current_user\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end", "def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hack }\n end\n end", "def new\n @solution = Solution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hack }\n end\n end", "def new\n @homework = Homework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @homework }\n end\n end", "def new\n @try = Try.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @try }\n end\n end", "def new\n @bug_list = BugList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug_list }\n end\n end", "def new\n @puzzle = Puzzle.new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puzzle }\n end\n end", "def new\n @base_issue = BaseIssue.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @base_issue }\n end\n end", "def new\n \n if params[:id].nil?\n @projects = Project.all\n else\n @project = Project.find(params[:id])\n end\n\n @priorities = Priority.all\n @stopovers = Stopover.all\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end", "def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end", "def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end", "def new\n @unfinished_project = UnfinishedProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unfinished_project }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n kick and return if not is_god?\n @puzzle = Puzzle.new\n @other_puzzles = Puzzle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puzzle }\n end\n end", "def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @help = Help.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @help }\n end\n end", "def new\n @tip = Tip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip }\n end\n end", "def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end", "def new\n get_work; get_subject\n @work_has_subject = WorkHasSubject.new(:work => @work, :subject => @subject)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work_has_subject }\n end\n end", "def new\n @gotcha = Gotcha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gotcha }\n end\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n end", "def new\n @quest_tree = QuestTree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest_tree }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tips_trick }\n end\n end", "def new\n @issue = Issue.new\n @feedback = Feedback.find(params[:feedback_id])\n @tester = Tester.find(current_tester)\n @issue.tester_id = @tester.id\n @issue.feedback_id = @feedback.id\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @issue = Issue.new\n @feedback = Feedback.find(params[:feedback_id])\n @tester = Tester.find(current_tester)\n @issue.tester_id = @tester.id\n @issue.feedback_id = @feedback.id\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @project = Project.find(session[:current_project])\n @to_do = @project.to_dos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @to_do }\n end\n end", "def new\n @group_problem = GroupProblem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group_problem }\n end\n end", "def new\n @contestproblem = Contestproblem.new\n end", "def new\n @problem.owner_id = current_user.id\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @problem }\n end\n end", "def new\n @to_do_list = ToDoList.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @to_do_list }\n end\n end", "def new\n @quest = Quest.new\n\t@categories = find_all_categories\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def new\n\n\n\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @issue }\n end\n end", "def index\n @problems = Problem.all\n end", "def index\n @problems = Problem.all\n end", "def index\n @problems = Problem.all\n end", "def new\n @todo_task = TodoTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo_task }\n end\n end", "def new\n # raise params.inspect\n @task = Task.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @request = @skill.requests.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @bug = Bug.new\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @discuss = Discuss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discuss }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @critical_question = CriticalQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critical_question }\n end\n end", "def new\n @task_changes = TaskChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_changes }\n end\n end", "def new\n @completed_quest = CompletedQuest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def new\n @unsolved = Unsolved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unsolved }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end" ]
[ "0.79234505", "0.79234505", "0.78800845", "0.74476093", "0.73984045", "0.7243975", "0.7222093", "0.70534116", "0.7007844", "0.7007793", "0.69895875", "0.6941806", "0.6937303", "0.6918376", "0.6877167", "0.68579644", "0.6856023", "0.68521476", "0.6817408", "0.68165654", "0.67824143", "0.67804784", "0.6723692", "0.6721252", "0.67164445", "0.6710621", "0.6692236", "0.6692236", "0.6662965", "0.6648547", "0.6637426", "0.6634513", "0.6620422", "0.6609648", "0.66086584", "0.66086584", "0.656642", "0.65560657", "0.6553656", "0.6538714", "0.6536603", "0.6532188", "0.6532139", "0.65306187", "0.6506311", "0.6504111", "0.6479884", "0.64614606", "0.645721", "0.6428087", "0.64201945", "0.6419449", "0.64123464", "0.64123464", "0.6404646", "0.6403425", "0.6403425", "0.6403425", "0.6403425", "0.63910854", "0.63860065", "0.6374285", "0.6374285", "0.6374285", "0.6374285", "0.6374285", "0.637371", "0.63694394", "0.6363361", "0.63613975", "0.63609153", "0.63582975", "0.6349049", "0.6343691", "0.63399786", "0.6338447", "0.6338447", "0.63381565", "0.632303", "0.63222766", "0.63214386", "0.6316083", "0.6307747", "0.6305789", "0.6296293", "0.629377", "0.629377", "0.629377", "0.6287547", "0.62841755", "0.6281157", "0.6280988", "0.627874", "0.62785417", "0.62785417", "0.62697065", "0.6268559", "0.6268459", "0.6259007", "0.62526375", "0.62526375" ]
0.0
-1
POST /problems POST /problems.json
def create respond_to do |format| if @problem.save format.html { redirect_to @problem, notice: 'Problem was successfully created.' } format.json { render json: @problem, status: :created, location: @problem } else format.html { render action: "new" } format.json { render json: @problem.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @problem = Problem.new(problem_params)\n\n if @problem.save\n render json: @problem, status: :created, location: @problem\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def create\n @problem = current_user.problems.build(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to root_path, notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(problem_params)\n create_tags\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @problem, :notice => 'Problem was successfully created.' }\n format.json { render :json => @problem, :status => :created, :location => @problem }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n response.headers.delete \"X-Frame-Options\"\n\n @problem = Problem.new(problem_params)\n\n @problem.tag_list = @problem.tag_list[0].to_s.scan(/\\w+/)\n @problem.status = \"Open\"\n @problem.user = current_user\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @problem }\n else\n format.html { render action: 'new' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def respides\n n = Problem.where(source: params[:source]).count\n spider = get_spider(params[:source])\n problems = spider.spide_problems(n)\n problems.each do |problem| \n Problem.create(problem)\n end\n @problems = Problem.where(source: params[:source]).limit(10).order(:id).reverse_order\n render json: @problems\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @problem] }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @problem = Problem.new\n @problem.answers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end", "def problem_params\n params.require(:problem).permit(:status, :category_id, :title, :description, :user_id, :status, :tag_list)\n end", "def trouble_params\n params.require(:trouble).permit(:name, :url, :solution, :status_id, :category_id, :user_id)\n end", "def create\n @contest = Contest.new(params[:contest])\n @problem_count = 4\n\n @contest.begin_date_str = params[:begin_date]\n @contest.end_date_str = params[:end_date]\n\n problems = []\n for i,p in params[:problems]\n number = p[:number]\n score = p[:score]\n\n next if number.blank? && score.blank?\n @contest.errors[:problem] << \"#{i}'s number is invalid.\" and next if number.blank?\n @contest.errors[:problem] << \"#{i}'s score is invalid.\" and next if score.blank?\n\n aoj_problem = AOJ::Problem.new(number)\n @contest.errors[:problem] << \"#{i} is invalid.\" and next unless aoj_problem.valid?\n problem = Problem.new({\n number: number.to_i,\n name: aoj_problem.name,\n score: score.to_i,\n contest: @contest,\n })\n problems << problem\n end\n @contest.problems = problems\n\n @contest.errors[:problems] << 'are required more than 0.' if problems.size==0\n\n\n unless @contest.errors.empty?\n render action: 'new' and return\n end\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 @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to admin_problem_path(@problem), notice: 'Problem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @problem }\n else\n format.html { render action: 'new' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def problem_params\n params.require(:problem).permit(:title, :content)\n end", "def index\n @problems = Problem.active.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @problems }\n end\n end", "def problem_params\n params.require(:problem).permit(:user, :content, :user_id, :body, :category_id)\n end", "def index\n @problems = Problem.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n\n respond_with @problems\n end", "def create\n @problem = Problem.new(problem_params)\n @problem.likes = 0\n respond_to do |format|\n if @problem.save\n format.html { redirect_to problems_url, success: 'Frustration was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def problem_params\n params.require(:problem).permit(:name, :description)\n end", "def index\n @problems = Problem.where(source: params[:source]).first(10)\n if @problems.nil?\n spider = get_spider(params[:source])\n problems = spider.spide_problems\n problems.each do |problem|\n Problem.create(problem)\n end\n @problems = Problem.where(source: params[:source]).first(10)\n end\n render json: @problems\n end", "def report(problems)\n json = []\n problems.each do |message|\n next if message[:kind] == :ignored && !PuppetLint.configuration.show_ignored\n\n message[:KIND] = message[:kind].to_s.upcase\n\n if message[:kind] == :fixed || [message[:kind], :all].include?(configuration.error_level)\n if configuration.json\n message['context'] = get_context(message) if configuration.with_context\n json << message\n else\n format_message(message)\n print_context(message) if configuration.with_context\n end\n end\n end\n puts JSON.pretty_generate(json) if configuration.json\n\n $stderr.puts 'Try running `puppet parser validate <file>`' if problems.any? { |p| p[:check] == :syntax }\n end", "def create\n @problem = Problem.find_by_shortname(params[:problem_id])\n @solution = @problem.solutions.create(solution_params) do |solution|\n solution.profile = current_user.profile\n end\n respond_to do |format|\n if @solution.save\n format.html { redirect_to problem_solution_path(@problem, @solution), notice: 'Solution was successfully created.' }\n format.json { render json: @problem, status: :created, location: @solution }\n else\n format.html { render \"new\" }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def problem_params\n params.require(:problem).permit(:title, :category_id, :summary, :cause, :symptom, :effect, :urgency, :address,\n :province_id, :kabupaten_id, :kecamatan_id, :kelurahan_id, :reported_by, :images => [])\n end", "def index\n @problems = Problem.all\n end", "def index\n @problems = Problem.all\n end", "def index\n @problems = Problem.all\n end", "def problem_params\n params.require(:problem).permit(:description)\n end", "def index\n @problems = Problem.all\n end", "def new\n @problem = current_user.problems.build\n end", "def destroy\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :ok }\n end\n end", "def create\n @unsolved = Unsolved.new(unsolved_params)\n respond_to do |format|\n if @unsolved.save\n format.html { redirect_to @unsolved, notice: 'Unsolved problem was successfully added.' }\n format.json { render json: @unsolved, status: :created, location: @unsolved }\n end\n end\n end", "def show\n # fetch sub problems and put it in json\n cause = []\n @problem.problem_references.each do |problem_reference|\n cause << problem_reference.sub_problem\n end\n @problem_attributes = @problem.attributes.merge(cause: cause)\n render json: @problem_attributes\n end", "def create\n @admin_problem = Problem.new(admin_problem_params)\n\n respond_to do |format|\n if @admin_problem.save\n format.html { redirect_to admin_problem_path(@admin_problem), notice: 'Admin problem was successfully created.' }\n format.json { render :show, status: :created, location: @admin_problem }\n else\n set_genres\n format.html { render :new }\n format.json { render json: @admin_problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @submission = Submission.new\n @submission.problem = params[:problem].to_i if params[:problem]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @submission }\n end\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def update\n @problem = Problem.find(params[:id])\n\n if @problem.update(problem_params)\n head :no_content\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end", "def problem_params\n params.require(:problem).permit(:title, :summary, :input_description, :output_description, :skeleton)\n end", "def index\n @search = Problem.search(params[:q])\n @problems = @search.result.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @problems }\n end\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def retrieve_solved\n\t\trender json: @@problems_solved_shared\n\tend", "def create\n @health_problem = HealthProblem.new(health_problem_params)\n\n respond_to do |format|\n if @health_problem.save\n format.html { redirect_to @health_problem, notice: 'Health problem was successfully created.' }\n format.json { render :show, status: :created, location: @health_problem }\n else\n format.html { render :new }\n format.json { render json: @health_problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @problem = Problem.new\n add_breadcrumb \"New Problem\"\n respond_with @problem\n end", "def create\n @youth_problem = YouthProblem.new(params[:youth_problem])\n\n respond_to do |format|\n if @youth_problem.save\n format.html { redirect_to(@youth_problem, :notice => 'Youth problem was successfully created.') }\n format.xml { render :xml => @youth_problem, :status => :created, :location => @youth_problem }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @youth_problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @problem = Problem.new\n @problem.titles.build({:locale => \"es\"})\n @problem.titles.build({:locale => \"en\"})\n @problem.descriptions.build({:locale => \"es\"})\n @problem.descriptions.build({:locale => \"en\"})\n @problem.cases.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def installProblems\n if ! @cud.instructor? then\n redirect_to :action=>\"index\" and return\n end\n\n if Problem.where(:assessment_id=>@assessment.id).count == 0 then\n for problem in @problems do\n p = Problem.new(:name=>problem['name'],\n :description=>problem['description'],\n :assessment_id=>@assessment.id,\n :max_score=>problem['max_score'],\n :optional=>problem['optional'])\n p.save()\n end\n end\n end", "def update\n @problem = Problem.find_by_shortname(params[:id])\n create_tags\n respond_to do |format|\n if @problem.update_attributes(problem_params)\n format.html { redirect_to @problem, notice: 'Problem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_problems()\n problem_array = []\n self.requests.each do |request|\n problem_array.push(Problem.find(request.problem_id))\n end\n problem_array\n end", "def create\n @problem_attempt = ProblemAttempt.new(problem_attempt_params)\n\n respond_to do |format|\n if @problem_attempt.save\n format.html { redirect_to @problem_attempt, notice: 'Problem attempt was successfully created.' }\n format.json { render :show, status: :created, location: @problem_attempt }\n else\n format.html { render :new }\n format.json { render json: @problem_attempt.errors, status: :unprocessable_entity }\n end\n end\n end", "def problem_params\n params[:problem]\n end", "def create\n @interactor = ProblemPersistence::ProblemCreationInteractor.call(self.params.merge(user_id: current_user.id))\n\n if @interactor.success?\n redirect_to @interactor.problem, notice: 'Problem was successfully created.' \n else\n \n #flash[:error] = interactor.error\n #render :new\n end\n end", "def problem_params\n params.require(:problem).permit(:name, :description, :max_score, :optional)\n end", "def create\n @problem = Problem.new(:owner_id => current_user.id)\n authorize! :create, @problem\n\n respond_to do |format|\n if @problem.update_attributes(permitted_params)\n format.html { redirect_to(@problem, :notice => 'Problem was successfully created.') }\n format.xml { render :xml => @problem, :status => :created, :location => @problem }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(problem_params)\n #FileUtils::mkdir_p \"grades/#{@problem.id}\"\n \n # puts \"grades/#{Problem.last.id.to_s}\\n\\n\"\n\n respond_to do |format|\n if @problem.save\n populate(@problem.id.to_s)\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @problems = Problem.all.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 8)\n @problem = Problem.new\n end", "def create\n @admin_problem = Admin::Problem.new(admin_problem_params)\n if @admin_problem.save\n @admin_problem_collection.problems << @admin_problem\n @admin_problem.scoring(@admin_problem_collection)\n redirect_to @admin_problem_collection\n else\n render :form\n end\n end", "def create\n @problems_user = ProblemsUser.new(params[:problems_user])\n @problems_user.user = current_user\n respond_to do |format|\n if @problems_user.save\n format.html { redirect_to(problems_users_path, :notice => 'Problems user was successfully created.') }\n format.xml { render :xml => @problems_user, :status => :created, :location => @problems_user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @problems_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def problem_params\n params.require(:problem).permit(\n :contest_id, :name_en, :name_ja, :description_en, :description_ja, :order\n )\n end", "def new\n @problems_user = ProblemsUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @problems_user }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to issues_url, notice: 'Issue was successfully created.' }\n format.json { render json: @issue }\n else\n format.html { redirect_to issues_url, notice: 'There was a problem saving your issue. Do you need a tissue?' }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @page_title = \"Problem List\"\n respond_to do |format|\n format.html\n format.json {\n render json: ProblemsDatatable.new(view_context)\n }\n end\n end", "def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def create\n @group_problem = GroupProblem.new(params[:group_problem])\n\n respond_to do |format|\n if @group_problem.save\n format.html { redirect_to(@group_problem, :notice => 'Group problem was successfully created.') }\n format.xml { render :xml => @group_problem, :status => :created, :location => @group_problem }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group_problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bug = Bug.new(params[:bug])\n\n respond_to do |format|\n if @bug.save\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render json: @bug, status: :created, location: @bug }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bug = Bug.new(params[:bug])\n\n respond_to do |format|\n if @bug.save\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render json: @bug, status: :created, location: @bug }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def create\n @problema = @consulta.problemas.build(problema_params)\n\n respond_to do |format|\n if @problema.save\n format.html { redirect_to consulta_problemas_path(@consulta), notice: 'Problema fue guardado con exito.' }\n format.json { render :show, status: :created, location: @problema }\n else\n format.html { render :new }\n format.json { render json: @problema.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @problems = Problem.search(params[:search], order: :posted_date, :per_page => Problem.per_page, :page => params[:page])\n #@problems = Problem.all(order: :posted_date, :per_page => Problem.per_page, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @problems }\n end\n end", "def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def show\n include_admin = @current_user.is_admin?\n @submissions_table = @contest.all_submissions_table(include_admin)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problems }\n end\n end", "def show\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problem }\n end\n end", "def show\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problem }\n end\n end", "def new_puzzle(params)\n difficulty = params[:difficulty] || \"medium\"\n case difficulty\n when \"medium\"\n blanks = rand(49..51)\n when \"hard\"\n blanks = rand(52..54)\n when \"veryhard\"\n blanks = rand(55..57)\n when \"easy\"\n blanks = rand(45..48)\n when \"veryeasy\"\n blanks = rand(40..44)\n end\n c = Sudoku.make(blanks)\n @puzzle = c[0]\n @solution = c[1]\n \n # Returns json object with array representing puzzle \n return JSON.generate({puzzle: @puzzle.puzzle}) \n end", "def create\n @reqdifficulty = Reqdifficulty.new(reqdifficulty_params)\n\n respond_to do |format|\n if @reqdifficulty.save\n format.html { redirect_to @reqdifficulty, notice: 'Reqdifficulty was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reqdifficulty }\n else\n format.html { render action: 'new' }\n format.json { render json: @reqdifficulty.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url, info: 'Frustration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to :success, notice: 'Issue was successfully created.' }\n format.json { render json: @issue }\n else\n format.html { render :new }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @problem.update_attributes(params[:problem])\n format.html { redirect_to @problem, notice: 'Problem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem_solution = ProblemSolution.new(params[:problem_solution])\n\n respond_to do |format|\n if @problem_solution.save\n format.html { redirect_to @problem_solution.problem ? solutions_by_problem_path(@problem_solution.problem) : :problem_solutions, notice: 'Решение проблемы успешно создано.' }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def destroy\n @problem = @solution.problem\n @solution.destroy\n\n respond_to do |format|\n format.html { redirect_to problem_solutions_url }\n format.json { head :no_content }\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 destroy\n @problem = Problem.find_by_shortname(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def new\n @bug = Bug.new\n @users =Bug.get_users_project(get_project_id)\n get_count_of_issue\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def show\n @problem = Problem.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @problem }\n end\n end", "def new\n @problem_solution = ProblemSolution.new\n\n if params[:problem_id]\n @problem_solution.problem = Problem.find(params[:problem_id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def problem_params\n if admin?#no matter how hard you try you can't change a problem :P\n params.require(:problem).permit(:title, :explanation, :exIn, :exOut, :points, :grading_type, :extra_probs)\n end\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end" ]
[ "0.7035215", "0.67344344", "0.6726247", "0.66629434", "0.66624814", "0.6620491", "0.6574222", "0.6516654", "0.65019697", "0.6400685", "0.6390408", "0.63000333", "0.6288726", "0.6262413", "0.6262413", "0.625801", "0.62116486", "0.618457", "0.6172585", "0.61645955", "0.6155211", "0.6143666", "0.61138386", "0.61060494", "0.6093438", "0.6025692", "0.60138535", "0.5976848", "0.595541", "0.59329784", "0.59319377", "0.59319377", "0.59319377", "0.5888103", "0.5856137", "0.5831895", "0.5779473", "0.57693404", "0.5760339", "0.5755124", "0.57527214", "0.5750959", "0.5750244", "0.5744053", "0.57153916", "0.57058185", "0.57005775", "0.5692009", "0.56903714", "0.5682857", "0.56812227", "0.5668783", "0.5657875", "0.5657362", "0.5647715", "0.5629744", "0.56128883", "0.5609537", "0.5579813", "0.556248", "0.55499554", "0.55397385", "0.55207497", "0.5520426", "0.5493838", "0.5482058", "0.5482058", "0.5482058", "0.5482058", "0.54756653", "0.54720443", "0.5447471", "0.5437804", "0.5412081", "0.5412081", "0.54053336", "0.54053336", "0.54053336", "0.54053336", "0.5399935", "0.53728175", "0.53274465", "0.5321634", "0.529374", "0.529374", "0.5282909", "0.52811646", "0.5281108", "0.52770567", "0.52764577", "0.5276196", "0.5274533", "0.5261791", "0.5258601", "0.52563256", "0.52519566", "0.525146", "0.52507126", "0.5246731", "0.5246731" ]
0.6478053
9
PUT /problems/1 PUT /problems/1.json
def update respond_to do |format| if @problem.update_attributes(params[:problem]) format.html { redirect_to @problem, notice: 'Problem was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @problem.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @problem = Problem.find(params[:id])\n\n if @problem.update(problem_params)\n head :no_content\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end", "def update\n @problem = Problem.find_by_shortname(params[:id])\n create_tags\n respond_to do |format|\n if @problem.update_attributes(problem_params)\n format.html { redirect_to @problem, notice: 'Problem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n if @problem.update_attributes(params[:problem])\n format.html { redirect_to @problem, notice: 'Problem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n if @problem.update_attributes(params[:problem])\n format.html { redirect_to @problem, notice: 'Problem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n if @problem.update_attributes(params[:problem])\n format.html { redirect_to @problem, notice: 'Problem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @problem = Problem.find(params[:id])\n\n respond_to do |format|\n if @problem.update_attributes(params[:problem])\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @problem, :notice => 'Problem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @problem.update(problem_params)\n format.html { redirect_to @problem, notice: 'Problem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @problem.update(problem_params)\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully updated.' }\n format.json { render :show, status: :ok, location: [:admin, @problem] }\n else\n format.html { render :edit }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @problem.update(problem_params)\n format.html { redirect_to root_path, notice: 'Problem was successfully updated.' }\n format.json { render :show, status: :ok, location: @problem }\n else\n format.html { render :edit }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @problem = @solution.problem\n respond_to do |format|\n if @solution.update_attributes(solution_params)\n format.html { redirect_to problem_solution_path(@problem, @solution), notice: 'Solution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def update\n respond_to do |format|\n if @problem.update(problem_params)\n format.html { redirect_to admin_problem_path(@problem), notice: 'Problem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @problem.update(problem_params)\n format.html { redirect_to @problem, success: 'Frustration was successfully updated.' }\n format.json { render :show, status: :ok, location: @problem }\n else\n format.html { render :edit }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def set_problem\n @problem = Problem.find(params[:id])\n end", "def update\n @problems_user = ProblemsUser.find(params[:id])\n\n respond_to do |format|\n if @problems_user.update_attributes(params[:problems_user])\n format.html { redirect_to(problems_users_path, :notice => 'Problems user was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @problems_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_problem\n\t @problem = Problem.find(params[:id])\n\t end", "def update\n @youth_problem = YouthProblem.find(params[:id])\n\n respond_to do |format|\n if @youth_problem.update_attributes(params[:youth_problem])\n format.html { redirect_to(@youth_problem, :notice => 'Youth problem was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @youth_problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(problem_params)\n\n if @problem.save\n render json: @problem, status: :created, location: @problem\n else\n render json: @problem.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @health_problem.update(health_problem_params)\n format.html { redirect_to @health_problem, notice: 'Health problem was successfully updated.' }\n format.json { render :show, status: :ok, location: @health_problem }\n else\n format.html { render :edit }\n format.json { render json: @health_problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def update\n respond_to do |format|\n if @admin_problem.update(admin_problem_params)\n format.html { redirect_to admin_problem_path(@admin_problem), notice: 'Admin problem was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_problem }\n else\n set_genres\n format.html { render :edit }\n format.json { render json: @admin_problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def trouble_params\n params.require(:trouble).permit(:name, :url, :solution, :status_id, :category_id, :user_id)\n end", "def create\n @problem = current_user.problems.build(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to root_path, notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @problem = Problem.find(params[:id])\n authorize @problem, :update?\n \n @problem.assign_attributes(permitted_params)\n respond_to do |format|\n if validate(@problem) && @problem.save\n format.html { redirect_to(@problem, :notice => 'Problem was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @to_do = ToDo.find(params[:id])\n\n if @to_do.update(params[:to_do])\n head :no_content\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end", "def problem_params\n params.require(:problem).permit(:status, :category_id, :title, :description, :user_id, :status, :tag_list)\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :ok }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @problem.update_attributes(permitted_params)\n format.html { redirect_to(@problem, :notice => 'Problem was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @mistake = Mistake.find(params[:id])\n\n respond_to do |format|\n if @mistake.update_attributes(params[:mistake])\n format.html { redirect_to @mistake, notice: 'Mistake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mistake.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interactor = ProblemPersistence::ProblemUpdateInteractor.call(self.params.merge(user_id: current_user.id))\n\n if @interactor.success?\n redirect_to @problem, notice: 'Problem was successfully updated.' \n end\n\n #@problem.update_attributes(problem_params)\n #@new_images = problem_images_params[\"images\"]\n #@new_images = \"\" if !@new_images\n #images_array = @new_images.split(\",\")\n #tags = problem_tags_params[\"tags\"]\n #tagsArray = tags.split(\",\")\n #version_description = params[\"version\"][\"description\"]\n\n #respond_to do |format|\n #@exception = @problem.save_edit(tagsArray, images_array, version_description, current_user)[:exception]\n #if !@exception\n #User who edits a problem automatically follows it\n # if !current_user.following? @problem\n # current_user.follow @problem\n # end\n\n # Notify problem followers\n #Notifications::Sender::SendNotifications.new(notification_type: :updated_problem,\n # actor: current_user,\n # resource: @problem).call\n=begin\n format.html { redirect_to @problem, notice: 'Problem was successfully updated.' }\n format.json { render :show, status: :ok, location: @problem }\n else\n format.html { \n flash.now[:failed_problem_create] = @exception.message\n render :edit \n }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n format.js { @problem.reload }\n=end\n #end\n end", "def update\n @to_do = ToDo.find(params[:id])\n\n if @to_do.update(to_do_params)\n head :no_content\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end", "def update\n @project = Project.find(params[:id])\n params[:project][:problem_ids] ||= []\n params[:project][:target_ids] ||= []\n params[:project][:factor_ids] ||= []\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(projects_path, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def problem_params\n params.require(:problem).permit(:title, :content)\n end", "def destroy\n @problem = Problem.find_by_shortname(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def problem_params\n params.require(:problem).permit(:user, :content, :user_id, :body, :category_id)\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to [:admin, @problem], notice: 'Problem was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @problem] }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(params[:problem])\n\n respond_to do |format|\n if @problem.save\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @problem, :notice => 'Problem was successfully created.' }\n format.json { render :json => @problem, :status => :created, :location => @problem }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @problem_attempt.update(problem_attempt_params)\n format.html { redirect_to @problem_attempt, notice: 'Problem attempt was successfully updated.' }\n format.json { render :show, status: :ok, location: @problem_attempt }\n else\n format.html { render :edit }\n format.json { render json: @problem_attempt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.new(problem_params)\n @problem.likes = 0\n respond_to do |format|\n if @problem.save\n format.html { redirect_to problems_url, success: 'Frustration was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @problems = Problem.all\n end", "def index\n @problems = Problem.all\n end", "def index\n @problems = Problem.all\n end", "def create\n @problem = Problem.new(problem_params)\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @problem }\n else\n format.html { render action: 'new' }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contestproblem.statement = params[:contestproblem][:statement]\n @contestproblem.origin = params[:contestproblem][:origin]\n if @contestproblem.at_most(:not_started_yet)\n @contestproblem.start_time = params[:contestproblem][:start_time]\n end\n if @contestproblem.at_most(:in_progress)\n @contestproblem.end_time = params[:contestproblem][:end_time]\n end\n if @date_problem\n render 'edit' and return\n end\n if @contestproblem.save\n flash[:success] = \"Problème modifié.\"\n update_contest_details\n update_problem_numbers\n redirect_to @contestproblem\n else\n render 'edit'\n end\n end", "def update\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n if @solution.update_attributes(params[:solution])\n format.html { redirect_to @solution, notice: 'Solution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to issues_path, notice: 'O assunto foi atualizado com sucesso.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n new_tags = params[:problem].to_unsafe_h[\"tag_list\"].scan(/\\w+/)\n new_tags.each do |tag|\n @problem.tag_list.add(tag)\n end\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @problem }\n else\n format.html { render :edit }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def problem_params\n params.require(:problem).permit(:name, :description)\n end", "def destroy\n @problem = @solution.problem\n @solution.destroy\n\n respond_to do |format|\n format.html { redirect_to problem_solutions_url }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if issue.save\n format.html { redirect_to issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @group_problem = GroupProblem.find(params[:id])\n\n respond_to do |format|\n if @group_problem.update_attributes(params[:group_problem])\n format.html { redirect_to(@group_problem, :notice => 'Group problem was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group_problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @problem = Problem.find_by_shortname(params[:problem_id])\n @solution = @problem.solutions.create(solution_params) do |solution|\n solution.profile = current_user.profile\n end\n respond_to do |format|\n if @solution.save\n format.html { redirect_to problem_solution_path(@problem, @solution), notice: 'Solution was successfully created.' }\n format.json { render json: @problem, status: :created, location: @solution }\n else\n format.html { render \"new\" }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @social_problem = SocialProblem.find(params[:id])\n\n respond_to do |format|\n if @social_problem.update_attributes(params[:social_problem])\n format.html { redirect_to(@social_problem, :notice => 'Social problem was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @social_problem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @issue.votes = 0\n if @issue.update(issue_params)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @problem_solution = ProblemSolution.find(params[:id])\n\n respond_to do |format|\n if @problem_solution.update_attributes(params[:problem_solution])\n format.html { redirect_to @problem_solution.problem ? solutions_by_problem_path(@problem_solution.problem) : :problem_solutions, notice: 'Решение проблемы успешно обновлено.' }\n else\n format.html { render action: 'edit' }\n end\n end\n end", "def update\n @sudoku = Sudoku.find(params[:id])\n\n respond_to do |format|\n if @sudoku.update_attributes(params[:sudoku])\n format.html { redirect_to @sudoku, notice: 'Sudoku was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sudoku.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n unless current_user.admin?\n redirect_to @tournament, flash: {error: 'Only administrators can edit tournaments.'}\n return\n end\n\n Problem.where(problem_id: params[:problem_id]).each do |prob|\n unless Contain.exists?(tournament_id: @tournament.tournament_id, problem_id: prob.problem_id)\n contain = Contain.create(tournament_id: @tournament.tournament_id, problem_id: prob.problem_id)\n end\n end\n\n if @tournament.update(tournament_params)\n redirect_to :edit_tournament, flash: {success: 'Tournament was successfully updated.'}\n else\n redirect_to @tournament, flash: {error: \"Failed to edit tournament: #{@tournament.errors.full_messages}\"}\n end\n end", "def create\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Problem was successfully created.' }\n format.json { render json: @problem, status: :created, location: @problem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @problems = Problem.active.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @problems }\n end\n end", "def create\n response.headers.delete \"X-Frame-Options\"\n\n @problem = Problem.new(problem_params)\n\n @problem.tag_list = @problem.tag_list[0].to_s.scan(/\\w+/)\n @problem.status = \"Open\"\n @problem.user = current_user\n\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @problem }\n else\n format.html { render :new }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @issue.update(issue_params)\n format.html { redirect_to course_path(@issue.courseid), notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n else\n format.html { render :edit }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @variable_trouble.update(trouble_params)\n flash[:success] = 'トラブルを更新しました'\n format.html { redirect_to troubles_url }\n format.json { render :show, status: :ok, location: @trouble }\n else\n set_search_troubles\n flash[:danger] = 'トラブル更新に失敗しました'\n format.html { render :edit }\n format.json { render json: @trouble.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @try = Try.find(params[:id])\n\n respond_to do |format|\n if @try.update_attributes(params[:try])\n format.html { redirect_to @try, notice: 'Try was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @try.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @puzzle_table = PuzzleTable.find params[:puzzle_table_id]\n @puzzle = Puzzle.find(params[:id])\n\n respond_to do |format|\n if @puzzle.update_attributes(params[:puzzle])\n format.html { redirect_to puzzle_table_puzzles_path(@puzzle_table), notice: 'Puzzle was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @puzzle.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @problems = Problem.all\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 @reqdifficulty.update(reqdifficulty_params)\n format.html { redirect_to @reqdifficulty, notice: 'Reqdifficulty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqdifficulty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bug = Bug.find(params[:id])\n @bug.jobtests.each{ |jt| jt.valid? }\n\n respond_to do |format|\n if @bug.update_attributes(params[:bug])\n flash[:notice] = 'Bug was successfully updated.'\n format.html { redirect_to(@bug) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bug.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end", "def update\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@sudoku = Sudoku.find(params[:id])\n @get_sudoku_topic = SudokuTopic.new(params[:sudoku_topic])\n # @get_sudoku_topic.topic=\"test update by code\"\n @get_sudoku_topic.save\n\n\n respond_to do |format|\n if @sudoku.update_attributes(params[:sudoku_topic])\n format.html { redirect_to @sudoku, notice: 'Sudoku was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sudoku.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def update\n @need_help = NeedHelp.find(params[:id])\n\n respond_to do |format|\n if @need_help.update_attributes(params[:need_help])\n format.json {head :no_content}\n else\n format.json {render json: @need_help.errors, status: :unprocessable_entity}\n end\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n if @problem\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url, notice: 'Problem was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n format.html { render @problem }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end" ]
[ "0.71729845", "0.68736047", "0.6796395", "0.6796395", "0.6796395", "0.6678712", "0.65402174", "0.6522685", "0.6511796", "0.63718086", "0.6302541", "0.6302541", "0.6302541", "0.6302541", "0.62581813", "0.625274", "0.6117491", "0.6117491", "0.6117491", "0.6117491", "0.6117491", "0.6117491", "0.6117491", "0.6117491", "0.6056225", "0.60376066", "0.5975606", "0.59753263", "0.59674174", "0.59628564", "0.59310406", "0.58918774", "0.5870143", "0.58638877", "0.58585286", "0.5854151", "0.5827747", "0.5815232", "0.58149177", "0.5792062", "0.5778932", "0.5776189", "0.5776189", "0.5776189", "0.5776189", "0.57564133", "0.5753662", "0.57529014", "0.57301253", "0.5722299", "0.57189727", "0.5718665", "0.5717821", "0.57064235", "0.56952006", "0.5693162", "0.5676797", "0.56627655", "0.5655065", "0.5655065", "0.5655065", "0.56507546", "0.56507087", "0.56493723", "0.56478775", "0.5637158", "0.56288105", "0.5628256", "0.5625311", "0.56193316", "0.5615953", "0.5611619", "0.55970335", "0.559563", "0.559325", "0.5577813", "0.5576657", "0.5574448", "0.55676216", "0.5561278", "0.5534389", "0.55303586", "0.55299324", "0.55279267", "0.5520011", "0.5512937", "0.55119294", "0.551096", "0.55066454", "0.5505499", "0.5499112", "0.5497307", "0.5497307", "0.54938287", "0.5493016", "0.54772186", "0.5471004", "0.5469653", "0.5468162", "0.54603285" ]
0.6683192
5
DELETE /problems/1 DELETE /problems/1.json
def destroy @problem.destroy respond_to do |format| format.html { redirect_to problems_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find_by_shortname(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem.destroy\n\n head :no_content\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n contest = @problem.contest\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Problem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to(problems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @problem = @solution.problem\n @solution.destroy\n\n respond_to do |format|\n format.html { redirect_to problem_solutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url, notice: 'Question was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_problem.destroy\n respond_to do |format|\n format.html { redirect_to admin_problems_url, notice: 'Admin problem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url, info: 'Frustration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n authorize @problem, :destroy?\n @problem.destroy\n\n respond_to do |format|\n format.html { redirect_to(problems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem = Problem.find(params[:id])\n if @problem\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url, notice: 'Problem was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n format.html { render @problem }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end", "def destroy\n @youth_problem = YouthProblem.find(params[:id])\n @youth_problem.destroy\n\n respond_to do |format|\n format.html { redirect_to(youth_problems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @health_problem.destroy\n respond_to do |format|\n format.html { redirect_to health_problems_url, notice: 'Health problem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @group_problem = GroupProblem.find(params[:id])\n @group_problem.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_problems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sudoku = SudokuTopic.find(params[:id])\n @sudoku.destroy\n\n respond_to do |format|\n format.html { redirect_to sudokus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mistake = Mistake.find(params[:id])\n @mistake.destroy\n\n respond_to do |format|\n format.html { redirect_to mistakes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @puzzle = Puzzle.find(params[:id])\n @puzzle.destroy\n\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_problem_collection.problems.destroy(@admin_problem)\n @admin_problem.destroy\n @admin_problem.scoring(@admin_problem_collection)\n redirect_to @admin_problem_collection\n end", "def destroy\n @problems_user = ProblemsUser.find(params[:id])\n @problems_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(problems_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\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 @solution = Solution.find(params[:id])\n @solution.destroy\n\n render json: { text: \"success\" }\n end", "def destroy\n @contest = Contest.find_by(path: params[:id])\n\n destroy_directory(@contest.path)\n destroy_problems(@contest)#with submits\n destroy_participants(@contest)\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n #format.json { head :no_content }\n end\n end", "def destroy\n @todo = Todo.find(params[:todo][:id])\n if @todo.destroy\n render json: {status: 200, message: \"Task with id \" + @todo.id.to_s + ': removed'}\n else\n render nothing: true, status: :bad_request\n end\n end", "def destroy\n @problem_attempt.destroy\n respond_to do |format|\n format.html { redirect_to problem_attempts_url, notice: 'Problem attempt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @programme_exercise.destroy\n respond_to do |format|\n format.html { redirect_to programme_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_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 @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n if @problem.reported_by == current_user\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to problems_url, notice: 'Problem was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n redirect_to problem_path(@problem)\n end\n end", "def destroy\n @social_problem = SocialProblem.find(params[:id])\n @social_problem.destroy\n\n respond_to do |format|\n format.html { redirect_to(social_problems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n respond_to do |format|\n format.html { redirect_to solutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipline.topics.delete_all\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url, notice: 'Discipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gotcha = Gotcha.find(params[:id])\n @gotcha.destroy\n\n respond_to do |format|\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solution.destroy\n render json: {solutions: @solution}, status: 200\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n issues_permissions\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url, notice: 'Нарушение №'+@issue.id.to_s+' удалено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @problem_solution = ProblemSolution.find(params[:id])\n @problem = @problem_solution.problem\n\n @problem_solution.destroy\n\n respond_to do |format|\n format.html { redirect_to (@problem ? solutions_by_problem_path(@problem) : :problem_solutions), notice: 'Решение проблемы успешно удалено.' }\n end\n end", "def remove_from_problem_set\n problem_set = ProblemSet.find(params[:problem_set_id])\n @problem = Problem.find(params[:id])\n problem_set.problems.delete(@problem)\n redirect_to(@problem, :notice => \"Removed from the '#{problem_set.name}' problem set.\")\n end", "def destroy\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sudoku.destroy\n respond_to do |format|\n format.html { redirect_to new_sudoku_path }\n format.json { head :no_content }\n end\n end", "def destroy\n issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to clclass_exercises_path(@clclass) }\n format.json { head :no_content }\n end\n end", "def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @performed_exercise.destroy\n respond_to do |format|\n format.html { redirect_to performed_exercises_url, notice: 'Performed exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_instruction = ExerciseInstruction.find(params[:id])\n @exercise_instruction.destroy\n\n respond_to do |format|\n format.html { redirect_to @exercise_instruction.exercise }\n format.json { head :no_content }\n end\n end", "def destroy\n @sudoku = Sudoku.find(params[:id])\n #@sudoku.details.destroy_all\n @sudoku.destroy\n\n respond_to do |format|\n format.html { redirect_to sudokus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @goal = Goal.find(params[:goal_id])\n # @solution = @goal.solutions.find(params[:id])\n @project = Project.find(params[:project_id])\n @goal = @project.goals.find(params[:goal_id])\n @solution = @goal.solutions.find(params[:id])\n @solution.destroy\n respond_to do |format|\n format.html { redirect_to project_goal_path(@project, @goal), notice: 'Solution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solution.destroy\n respond_to do |format|\n format.html { redirect_to solutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue = Issue.find(params[:id])\n @issue.destroy\n\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @important_issue = ImportantIssue.find(params[:id])\n @important_issue.destroy\n\n respond_to do |format|\n format.html { redirect_to important_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @completed_quest = CompletedQuest.find(params[:id])\n @completed_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to completed_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: \"Exercise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @problema.destroy\n respond_to do |format|\n format.html { redirect_to problemas_url, notice: 'Problema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n kick and return if not is_god?\n @puzzle = Puzzle.find(params[:id])\n @puzzle.destroy\n\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bug = Bug.find(params[:id])\n @bug.destroy\n\n respond_to do |format|\n format.html { redirect_to bugs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bug = Bug.find(params[:id])\n @bug.destroy\n\n respond_to do |format|\n format.html { redirect_to bugs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_task.destroy\n respond_to do |format|\n format.html { redirect_to exercise_tasks_url, notice: 'Exercise task was successfully destroyed.' }\n format.json { head :no_content }\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.json { head :no_content }\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.json { head :no_content }\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.json { head :no_content }\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.json { head :no_content }\n end\n end", "def destroy\n @exercise_execution.destroy\n respond_to do |format|\n format.html { redirect_to exercise_executions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @normal_issue = NormalIssue.find(params[:id])\n @normal_issue.destroy\n\n respond_to do |format|\n format.html { redirect_to normal_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_issue.destroy\n respond_to do |format|\n format.html { redirect_to project_issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = @key_questions_project.project\n @key_questions_project.destroy\n respond_to do |format|\n format.html do\n redirect_to edit_project_path(@project, page: 'key_questions'),\n notice: t('removed')\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\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.json { head :ok }\n end\n end", "def destroyit\n @judgement = Judgement.find(params[:id])\n @judgement.destroy\n\n respond_to do |format|\n format.html { redirect_to judgements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @try = Try.find(params[:id])\n @try.destroy\n\n respond_to do |format|\n format.html { redirect_to tries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @problema.destroy\n respond_to do |format|\n format.html { redirect_to consulta_problemas_path(@consulta), notice: 'Problema eliminado' }\n format.json { head :no_content }\n end\n end", "def destroy\n @to_do = ToDo.find(params[:id])\n @to_do.destroy\n\n head :no_content\n end", "def destroy\n contest = @editorial.contest\n @editorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Editorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to admin_contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_program.destroy\n respond_to do |format|\n format.html { redirect_to exercise_programs_url, notice: 'Exercise program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n courseid = @issue.courseid\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to course_path(courseid), notice: 'Issue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @challenge.destroy\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7560659", "0.7557449", "0.755692", "0.755692", "0.755692", "0.755692", "0.7495239", "0.7386734", "0.7368817", "0.73638684", "0.73053366", "0.72629756", "0.7138887", "0.7128535", "0.70500004", "0.70385283", "0.70229536", "0.70055926", "0.7003952", "0.68813664", "0.67814624", "0.6780861", "0.6774987", "0.6763806", "0.67627394", "0.66958493", "0.66958493", "0.6687312", "0.66870856", "0.6683498", "0.66625744", "0.6661006", "0.6649145", "0.6647477", "0.6647477", "0.6647477", "0.6647477", "0.66474336", "0.6640127", "0.6614109", "0.660894", "0.66035175", "0.66034776", "0.6589931", "0.6575596", "0.65678716", "0.6557049", "0.6556458", "0.65561587", "0.6555121", "0.6549544", "0.6542046", "0.6532277", "0.65182406", "0.6513626", "0.65111166", "0.65058655", "0.6505146", "0.6504787", "0.6491294", "0.64894974", "0.6486389", "0.6483338", "0.6479233", "0.64729995", "0.64709294", "0.64668614", "0.64668614", "0.64668614", "0.64668614", "0.64627534", "0.6460882", "0.645535", "0.644559", "0.64444166", "0.6444155", "0.6444143", "0.6444143", "0.6443821", "0.6443821", "0.64354485", "0.6433205", "0.6433205", "0.6433205", "0.6433205", "0.6432155", "0.64309305", "0.64294297", "0.64253896", "0.6424719", "0.64209545", "0.6417772", "0.6414305", "0.64060235", "0.64054596", "0.6401462", "0.63964736", "0.6393237", "0.6390473", "0.63898623" ]
0.76009053
0
Returns true if a primitive's rectangle is entirely inside another primitive's rectangle.
def inside_rect? outer, tolerance = 0.0 Geometry.inside_rect? self, outer, tolerance end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersect? rect\n rect.is_a?(Rectangle) && !(@x + @width < rect.x || rect.x + rect.width < @x || @y + @height < rect.y || rect.y + rect.height < @y)\n end", "def included_in?(other_rect)\n self == self.intersects(other_rect)\n end", "def contain?(rect)\n nself = self#.normalize\n rect = Rect.new_from_object(rect)#.normalize!\n return (nself.left <= rect.left and rect.right <= nself.right and\n nself.top <= rect.top and rect.bottom <= nself.bottom)\n end", "def overlap?(rect)\n return false unless rect.is_a? Rectangle\n\n return (@x1 <= rect.x2 && \n @x2 >= rect.x1 && \n @y1 <= rect.y2 && \n @y2 >= rect.y1)\n end", "def inside_rect?(point1, point2)\n lats = [point1.lat, point2.lat].sort\n lons = [point1.lon, point2.lon].sort\n la = self.lat\n lo = self.lon\n\n (la >= lats[0] && la <= lats[1] && lo >= lons[0] && lo <= lons[1])\n end", "def inArea?(x,y,width,height)\n rect=Rect.new(x,y,width,height)\n return self.over?(rect)\n end", "def rect_intersection(r1, r2)\n return (r1.x + r1.width > r2.x && r1.x < r2.x + r2.width &&\n r1.y + r1.height > r2.y && r1.y < r2.y + r2.height)\n end", "def inside?(x, y)\n x >= 0 && x < @width && y >= 0 && y < @height\n end", "def collide_rect?(rect)\n return true if collide_point?(rect.topleft)\n return true if collide_point?(rect.topright)\n return true if collide_point?(rect.bottomleft)\n collide_point?(rect.bottomright)\n end", "def overlap?(object1, object2)\n\t#upper left corner\n\tlx1 = object1.x\n\tly1 = object1.y\n\n\tlx2 = object2.x\n\tly2 = object2.y\n\t\n\t#lower right corner\n\trx1 = object1.x + object1.class::WIDTH\n\try1 = object1.y + object1.class::HEIGHT\n\n\trx2 = object2.x + object2.class::WIDTH\n\try2 = object2.y + object2.class::HEIGHT\n\n\tif rx1 - lx2 < 5 or\n\t\t\trx2 - lx1 < 5 then\n\t\treturn false\n\tend\n\n\tif ry1 - ly2 < 5 or\n\t\t\try2 - ly1 < 5 then\n\t\treturn false\n\tend\n\n\treturn true\nend", "def within?(width, height)\n check(@width_boundary, width) && check(@height_boundary, height)\n end", "def is_inside(shape)\n shape.surrounds(self)\n end", "def point_in_rectangle(point_x, point_y, first_x, first_y, second_x, second_y)\r\n\t\tif point_x.between?(first_x, second_x) and point_y.between?(first_y, second_y)\r\n\t\t\treturn true\r\n\t\tend\r\n\tend", "def point_in_rectangle(point_x, point_y, first_x, first_y, second_x, second_y)\r\n\t\tif point_x.between?(first_x, second_x) and point_y.between?(first_y, second_y)\r\n\t\t\treturn true\r\n\t\tend\r\n\tend", "def fits_inside?(other)\n width <= other.width && height <= other.height\n end", "def overlap(first_rect, second_rect)\n a1 = first_rect[0]\n a2 = first_rect[1]\n b1 = second_rect[0]\n b2 = second_rect[1]\n\n if b1[0] < a2[0] && b1[1] < a2[1]\n return true\n else \n return false\n end\n\nend", "def intersects?(other)\n return false if self.equal?(other)\n !(above?(other) || below?(other) || right_of?(other) || left_of?(other) || behind?(other) || in_front_of?(other))\n end", "def collide_rect?(other_rect)\n !intersects(other_rect).empty?\n end", "def test_obb_vs_obb(rect_a, rect_b)\n @coll_depth = Numeric::POSITIVE_INFINITY\n 2.times do |i|\n axis_a = rect_a.axes[i]\n depth_a = test_intervals(rect_a.projection(axis_a), rect_b.projection(axis_a))\n return false if depth_a == 0\n\n axis_b = rect_b.axes[i]\n depth_b = test_intervals(rect_a.projection(axis_b), rect_b.projection(axis_b))\n return false if depth_b == 0\n\n abs_a = depth_a.abs\n abs_b = depth_b.abs\n\n if abs_a < @coll_depth.abs or abs_b < @coll_depth.abs\n altb = abs_a < abs_b\n @coll_normal = altb ? axis_a : axis_b\n @coll_depth = altb ? depth_a : depth_b\n end\n end\n\n @cpa = rect_a\n @cpb = rect_b\n true\n end", "def intersects(other_rect)\n new_x = [@x, other_rect.x].max\n new_y = [@y, other_rect.y].max\n\n new_width = [@x + @width, other_rect.x + other_rect.width].min - new_x\n new_height = [@y + @height, other_rect.y + other_rect.height].min - new_y\n\n return Rectangle.empty if new_width <= 0 || new_height <= 0\n return Rectangle.new(new_x, new_y, new_width, new_height)\n end", "def overlap(first_rectangle, second_rectangle)\n\tfirst_rectangle_x1 = first_rectangle[0][0]\n\tfirst_rectanlge_y1 = first_rectangle[0][1]\n\tfirst_rectangle_x2 = first_rectangle[1][0]\n\tfirst_rectanlge_y2 = first_rectangle[1][1]\n\n\tsecond_rectangle_x1 = second_rectangle[0][0]\n\tsecond_rectanlge_y1 = second_rectangle[0][1]\n\tsecond_rectangle_x2 = second_rectangle[1][0]\n\tsecond_rectanlge_y2 = second_rectangle[1][1]\n\n\tif first_rectangle_x1 < second_rectangle_x2 && first_rectangle_x2 > second_rectangle_x1 && first_rectanlge_y1 < second_rectanlge_y2 && first_rectanlge_y2 > second_rectanlge_y1\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def include?(x, y)\n # assume a rectangular shape by default\n contain?(x, y)\n end", "def within?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#within? not defined.\"\n end", "def intersects?(other)\n other.vertices.each do |vertex|\n return true if interior?(vertex)\n end\n false\n end", "def contains?(other)\n other.corners.all? { |corner| includes_point?(corner) }\n end", "def contained?(other)\n center.distance(other.center) < (@r - other.r).abs\n end", "def over?(x, y = nil, w = nil, h = nil)\n return @x >= x.x && @x < x.x + x.w && @y >= x.y && @y < x.y + x.h if x.is_a? Rectangle\n @x >= x && @x < x + w && @y >= y && @y < y + h\n end", "def contain?(x, y)\n # assume a rectangular filled shape by default (works for several shapes like image, text, and focus)\n x.between?(self.absolute_x, self.absolute_x + calculated_width) && y.between?(self.absolute_y, self.absolute_y + calculated_height)\n end", "def intersects?(other)\n# (@x <= other.x_outer && other.x <= @x_outer) || (@y <= other.y_outer && other.y <= @y_outer) ||\n# (@z <= other.z_outer && other.z <= @z_outer)\n\n\n (other.x < (@x + @l)) && ((other.x + other.l) > @x) &&\n (other.y < (@y + @w)) && ((other.y + other.w) > @y) &&\n (other.z < (@z + @h)) && ((other.z + other.h) > @z)\n\n end", "def collide_rect?(rect)\n rect = Rect.new_from_object(rect)\n ((l >= rect.l && l <= rect.r) or (rect.l >= l && rect.l <= r)) &&\n ((t >= rect.t && t <= rect.b) or (rect.t >= t && rect.t <= b))\n end", "def in?(x, y)\n check_x = x.between?(@x, @x+@width)\n check_y = y.between?(@y, @y+@height)\n check_x && check_y\n end", "def intersects?(other)\n return false if self.xMax < other.xMin\n return false if self.xMin > other.xMax\n return false if self.yMax < other.yMin\n return false if self.yMin > other.yMax\n return false if self.zMax < other.zMin\n return false if self.zMin > other.zMax\n true\n end", "def ==(rect)\n @left_edge == rect.left_edge &&\n @right_edge == rect.right_edge &&\n @top_edge == rect.top_edge &&\n @bottom_edge == rect.bottom_edge\n end", "def in?(x, y)\n check_x = x.between?(self.x, self.x+self.width)\n check_y = y.between?(self.y, self.y+self.height)\n check_x && check_y\n end", "def within?(x, y)\n (x >= 0) && (x < height) && (y >= 0) && (y < height)\n end", "def intersectRect(rect)\n rect.containsXY(left,top) ||\n rect.containsXY(right,top) ||\n rect.containsXY(left,bottom) ||\n rect.containsXY(right,bottom) ||\n self.containsXY(rect.left,rect.top) ||\n self.containsXY(rect.right,rect.top) ||\n self.containsXY(rect.left, rect.bottom) ||\n self.containsXY(rect.right,rect.bottom)\n end", "def collide?(other)\r\n max_left = [left, other.left].max\r\n max_top = [top, other.top].max\r\n min_right = [right,other.right].min\r\n min_bottom = [bottom,other.bottom].min\r\n return max_left <= min_right && max_top <= min_bottom\r\n end", "def intersects?(r2)\n if @p2.x <= r2.p1.x or r2.p2.x <= @p1.x \n return false\n elsif @p2.y >= r2.p1.y or r2.p2.y >= @p1.y\n end\n return true\n end", "def intersects?(other_cuboid)\n\t\toverlaps_along_x_with?(other_cuboid) && overlaps_along_y_with?(other_cuboid) && overlaps_along_z_with?(other_cuboid)\n\tend", "def inRectangle(points)\n\tpointsY = points.sort{|a, b| a[Y_COORDINATE] <=> b[Y_COORDINATE]}\n\treturn false if pointsY[0][Y_COORDINATE] > ORIGIN[Y_COORDINATE]\n\treturn false if pointsY[2][Y_COORDINATE] < ORIGIN[Y_COORDINATE]\n\tpointsX = points.sort{|a, b| a[X_COORDINATE] <=> b[X_COORDINATE]}\n\treturn false if pointsX[0][X_COORDINATE] > ORIGIN[X_COORDINATE]\n\treturn false if pointsX[2][X_COORDINATE] < ORIGIN[X_COORDINATE]\n\treturn true\nend", "def intersects?(other)\n raise \"NOT A CUBOID\" unless other.is_a? Cuboid \n self_range = range_finder\n other_range = other.range_finder\n\n self_range.each do |k,_|\n return false unless overlap?(self_range[k], other_range[k])\n end \n\n true \n end", "def pos_rect_nt?(x, y, rect)\r\r\n pos_rect?(x, y, rect) && !@through\r\r\n end", "def intersects?(other)\n return false if separate? other\n return false if contained? other\n return false if coincident? other\n true\n end", "def contains?(x, y)\n x > bounds.x && x < bounds.x+bounds.width && y > bounds.y && y < bounds.y+bounds.height\n end", "def intersects?(other)\n !!intersection_with(other)\n end", "def in?(x, y)\n w = ((x.to_f-@x.to_f)**2.0)/(@width.to_f/2.0)\n h = ((y.to_f-@y.to_f)**2.0)/(@height.to_f/2.0)\n w + h <= 1\n end", "def inside?(mouse_x, mouse_y)\n pos_x = @x * @width\n pos_y = @y * @height\n mouse_x >= pos_x && mouse_x <= pos_x + @width && \\\n mouse_y >= pos_y && mouse_y <= pos_y + @height\n end", "def inside?(elem)\n [:left, :top, :width, :height].each do |type|\n return false unless elem.respond_to? type\n end\n (@left > elem.left) && (@left < elem.left + elem.width) &&\n (@top > elem.top) && (@top < elem.top + elem.height)\n end", "def collision_detected?\n ($boxes - Array(self)).any? do |other_box|\n # .include method with other_square\n other_box.include?(@square)\n end\nend", "def collision_between obj1, obj2\n\t\t\tif obj1.y + obj1.height < obj2.y ; return false ; end\n\t\t\tif obj1.y > obj2.y + obj2.height ; return false ; end\n\t\t\tif obj1.x + obj1.width < obj2.x ; return false ; end\n\t\t\tif obj1.x > obj2.x + obj2.width ; return false ; end\n\t\t\treturn true\n\t\tend", "def intersect?(obj)\n obj.x + obj.w > @x && obj.x < @x + @w &&\n (@inverted ? obj.y < get_y(obj) && obj.y + obj.h > @y : obj.y > get_y(obj) && obj.y < @y + @h)\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 overlaps? point\n inside_top_left?(point) && inside_bottom_right?(point)\n end", "def intersect?(r)\n @x < r.x + r.w && @x + @w > r.x && @y < r.y + r.h && @y + @h > r.y\n end", "def over?(object=nil,width=-1,height=-1)\n return false if object.nil?\n params=self.getObjectParams(object)\n x=params[0]\n y=params[1]\n width=params[2] if width < 0\n height=params[3] if height < 0\n return true if @x >= x && @x <= (x + width) and @y >= y && @y <= (y + height)\n return false\n end", "def include?(other_square)\n # top left\n @square.contains?(other_square.x1, other_square.y1) || \n # top right\n @square.contains?(other_square.x1, other_square.y2) || \n # bottom right\n @square.contains?(other_square.x1, other_square.y3) || \n # bottom left\n @square.contains?(other_square.x1, other_square.y4) \nend", "def contains?(x, y)\n x >= @x && x <= (@x + @width) && y >= @y && y <= (@y + @height)\n end", "def intersect?(o)\n self.class == o.class && !(@to < o.numeric_from || o.numeric_to < @from)\n end", "def intersects?(other)\n if !(self.x2 < other.x1) &&\n !(other.x2 < self.x1) &&\n !(self.y2 < other.y1) &&\n !(other.y2 < self.y1) &&\n !(self.z2 < other.z1) &&\n !(other.z2 < self.z1)\n return true\n else\n return false\n end\n end", "def fully_includes?(other)\n overlaps?(other) && other == intersection(other)\n end", "def in_bounds?(x, y)\n return false if x.to_i < 0\n return false if y.to_i < 0\n\n x.to_i < cols && y.to_i < rows\n end", "def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin < self.end and self.begin < other.end\n end\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 within?(other)\n range_within_other?(self,other)\n end", "def ==(other)\n if other.is_a?(Moon::Rect)\n x == other.x && y == other.y && w == other.w && h == other.h\n else\n false\n end\n end", "def ==(other)\n if other.is_a?(Moon::Rect)\n x == other.x && y == other.y && w == other.w && h == other.h\n else\n false\n end\n end", "def overlap? range\n !(self & range).nil?\n end", "def isInside(_pos)\n return @shape.insidePoint?(_pos) ;\n end", "def rec_intersection(rect1, rect2)\n\tx_min = [rect1[0][0],rect2[0][0]].max \n\tx_max = [rect1[1][0],rect2[1][0]].min \n\ty_min = [rect1[0][1],rect2[0][1]].max \n\ty_max = [rect1[1][1],rect2[1][1]].min \n\n\t(x_max < x_min) || (y_max < y_min) ? nil : [[x_min, y_min], [x_max, y_max]]\nend", "def intersects?(other)\n (@x <= other.x_max && other.x <= @x_max) &\n (@y <= other.y_max && other.y <= @y_max) &\n (@z <= other.x_max && other.z <= @z_max)\n end", "def left_corner_inside?(rectangle, point)\n return ((point[0] >= rectangle[0][0] and\n point[0] < rectangle[1][0]) and\n (point[1] >= rectangle[0][1] and\n point[1] < rectangle[1][1]))\nend", "def intersects?(other)\n horizontal_intersection = self.horizontal_intersection?(other)\n vertical_intersection = self.vertical_intersection?(other)\n within_z_index_range = self.within_z_index_range?(other)\n\n return within_z_index_range && vertical_intersection && horizontal_intersection\n\n end", "def intersecting_rectanges(rect1, rect2)\n\n intersecting_rect_width = 0\n intersecting_rect_height = 0\n intersecting_rect_left_x = 0\n intersecting_rect_bottom_y = 0\n\n if rect1[:left_x] + rect1[:width] > rect2[:left_x] && rect2[:left_x] > rect1[:left_x]\n intersecting_rect_width = rect1[:left_x] + rect1[:width] - rect2[:left_x]\n intersecting_rect_left_x = rect2[:left_x]\n elsif rect2[:left_x] + rect2[:width] > rect1[:left_x] && rect1[:left_x] > rect2[:left_x]\n intersecting_rect_width = rect2[:left_x] + rect2[:width] - rect1[:left_x]\n intersecting_rect_left_x = rect1[:left_x]\n end\n\n if rect1[:bottom_y] + rect1[:height] > rect2[:bottom_y] && rect2[:bottom_y] > rect1[:bottom_y]\n intersecting_rect_height = rect1[:bottom_y] + rect1[:height] - rect2[:bottom_y]\n intersecting_rect_bottom_y = rect1[:bottom_y]\n elsif rect2[:bottom_y] + rect2[:height] > rect1[:bottom_y] && rect1[:bottom_y] > rect2[:height]\n intersecting_rect_height = rect2[:bottom_y] + rect2[:height] - rect1[:bottom_y]\n intersecting_rect_bottom_y = rect2[:bottom_y]\n end\n \n {\n :left_x => intersecting_rect_left_x,\n :bottom_y => intersecting_rect_bottom_y,\n\n :width => intersecting_rect_width,\n :height => intersecting_rect_height\n }\nend", "def intersects?(cuboid)\n cuboid.vertices.each do |vertex|\n if self.contains?(vertex) || self.touches?(vertex)\n return true\n end\n end\n return false\n end", "def rectangle_inclusion_lambda(x1, y1, x2, y2)\n # take top left point and bottom right one\n x1, x2 = x2, x1 if x1 > x2\n y1, y2 = y2, y1 if y1 > y2\n\n ->(x, y) { (x1..x2).cover?(x) && (y1..y2).cover?(y) }\n end", "def intersects?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#intersects? not defined.\"\n end", "def vt_intersects?(*args)\n vt_range.intersects?(*args)\n end", "def is_within(layer)\n if !layer.nil?\n layerStartsWithinXBoundaries = self.x > layer.x && (self.x + self.width) < (layer.x + layer.width)\n layerStartsWithinYBoundaries = self.y > layer.y && (self.y + self.height) < (layer.y + layer.height)\n\n return layerStartsWithinXBoundaries && layerStartsWithinYBoundaries\n end\n\n false\n end", "def overlaps?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#overlaps? not defined.\"\n end", "def crossing?(other)\n return false unless overlaps?(other)\n (@begin_pos <=> other.begin_pos) * (@end_pos <=> other.end_pos) == 1\n end", "def overlaps?(other); end", "def overlaps?(other); end", "def overlaps?(other); end", "def intersects?(other)\n if origin <= other.origin\n vertices.each { |vertex| return true if vertex > other.origin }\n else\n other.vertices.each { |vertex| return true if vertex > origin }\n end\n false\n end", "def rec_intersection(rect1, rect2)\n bot_x, bot_y = [rect1[0][0], rect2[0][0]].max, [rect1[0][1], rect2[0][1]].max\n top_x, top_y = [rect1[1][0], rect2[1][0]].min, [rect1[1][1], rect2[1][1]].min\n return nil if bot_x > top_x || bot_y > top_y\n [[bot_x, bot_y], [top_x, top_y]]\nend", "def collide_rect?(x, y, rect)\r\r\n !@through && (pos_rect?(x, y, rect) || followers.collide_rect?(x, y, rect))\r\r\n end", "def in_bounds?(point, scr_height, scr_width)\n point[0].between?(0, scr_height-1) && point[1].between?(0, scr_width-1)\nend", "def intersect(boundingbox)\n end", "def inside?(*args)\n\t\tsignature_error = \"Specify a point(two floats, or one Point), line(two Point), or rectangle(one Rectangle).\"\n\t\t\n\t\traise \"Wrong arity. \" + signature_error unless args.length == 1 or args.length == 2\n\t\t\n\t\t\n\t\t\n\t\tcase args.length\n\t\t\twhen 1\n\t\t\t\tif klass.is_a? Point\n\t\t\t\t\tself.inside_p *args\n\t\t\t\telsif klass.is_a? Rectangle\n\t\t\t\t\tself.inside_r *args\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Will have exited by this point, unless there was an error.\n\t\t\t\traise \"One argument given. Expected Point or Rectangle, but recieved #{args[0].class.inspect} instead. \" + signature_error\n\t\t\twhen 2\n\t\t\t\tif args[0].class == args[1].class\n\t\t\t\t\tklass = args.first.class\n\t\t\t\t\tif klass.is_a? Point\n\t\t\t\t\t\t# a line, specified by two points\n\t\t\t\t\t\tself.inside_pp *args\n\t\t\t\t\telsif klass.is_a? Float\n\t\t\t\t\t\t# a point in space, specified by two floats\n\t\t\t\t\t\tself.inside_xy *args \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Will have exited by this point, unless there was an error.\n\t\t\t\traise \"Two arguments given. Expected both to be Point or both to be Float, but recieved #{[args[0].class, args[1].class].inspect} instead. \" + signature_error\n\t\tend\n\tend", "def falls_within?(x, y)\n x >= 0 && x < x_dimension && y >= 0 && y < y_dimension\n end", "def in_bounds?(x, y)\n layout.bounds.contains?(x - element_left, y - element_top)\n end", "def intersects?(cuboid)\n return true if self == cuboid\n !left_face_is_right_of_other_right_face(cuboid) &&\n !right_face_is_left_of_other_left_face(cuboid) &&\n !top_face_is_below_other_bottom_face(cuboid) &&\n !bottom_face_is_above_other_top_face(cuboid) &&\n !front_face_is_behind_other_back_face(cuboid) &&\n !back_face_is_front_other_front_face(cuboid)\n end", "def in_bounds?(x, y)\n layout.bounds.contains?(x - element_left, y - element_top)\n end", "def rec_intersection(rect1, rect2)\n x1 = [rect1[0][0],rect2[0][0]].max\n y1 = [rect1[0][1],rect2[0][1]].max\n y2 = [rect2[1][1],rect1[1][1]].min\n x2 = [rect2[1][0],rect1[1][0]].min\n if rect2[0][0] > rect1[1][0] || rect2[0][1] > rect1[1][1]\n return nil\n else\n return [[x1,y1],[x2,y2]]\n end\nend", "def surrounds(shape)\n shape.points.each do |point|\n return false unless point_is_inside(point)\n end\n return true\n end", "def in_bounds?(x, y)\n x >= 0 && x < @grid_width && y >= 0 && y < @grid_height\n end", "def tt_intersects?(*args)\n tt_range.intersects?(*args)\n end", "def intersects?(other)\n self_index = dimensions(self.vertices)\n other_index = dimensions(other.vertices)\n\n intersection = {}\n intersection[:x] = self_index[:x] & other_index[:x]\n intersection[:y] = self_index[:y] & other_index[:y]\n intersection[:z] = self_index[:z] & other_index[:z]\n\n intersection.value?([]) ? false : true\n end", "def overlaps?(other)\n cover?(other.begin) || other.cover?(first)\n end", "def contains?(point)\n point.inside?(self)\n end" ]
[ "0.7948215", "0.793003", "0.7684561", "0.74702066", "0.7290085", "0.7253465", "0.7161899", "0.7124796", "0.71138746", "0.7045976", "0.7030197", "0.7018792", "0.7002007", "0.7002007", "0.69897985", "0.6957257", "0.6946802", "0.69150203", "0.69141537", "0.69093376", "0.6886441", "0.68814474", "0.683971", "0.6821995", "0.6821914", "0.68188405", "0.6787183", "0.6782358", "0.6782003", "0.67728144", "0.67704433", "0.67548275", "0.6754613", "0.6705217", "0.67011154", "0.66826874", "0.66756016", "0.66721576", "0.6660504", "0.663417", "0.6610983", "0.66076237", "0.66044223", "0.6600871", "0.6595128", "0.6584846", "0.65728194", "0.65702116", "0.65648925", "0.6551774", "0.6517158", "0.65137196", "0.6505068", "0.64862084", "0.6472359", "0.6461323", "0.64511627", "0.64323914", "0.64320964", "0.64286935", "0.64013356", "0.6391721", "0.6391251", "0.63897485", "0.63764894", "0.63764894", "0.63615054", "0.6352749", "0.6341295", "0.633541", "0.6332277", "0.63268435", "0.63261455", "0.6312214", "0.63101614", "0.62920004", "0.6288301", "0.62731504", "0.627283", "0.62652665", "0.62629676", "0.62629676", "0.62629676", "0.62539595", "0.62415123", "0.62364674", "0.62318724", "0.6216519", "0.62072664", "0.6202357", "0.6196387", "0.6190419", "0.618933", "0.617809", "0.6164603", "0.61640227", "0.6161403", "0.61591977", "0.61588466", "0.615109" ]
0.7500801
3
Scales a primitive rect by a percentage.
def scale_rect percentage, *anchors Geometry.scale_rect self, percentage, *anchors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(*args)\n r = Rect.new x, y, w, h\n r.resolution = r.resolution * Vector2[args.singularize]\n r\n end", "def vscale(factor)\n @height = @height * factor\n @top *= factor\n self\n end", "def scale(value)\r\n value * @height/2 + @height/4\r\n end", "def scale(x, y)\n primitive 'scale ' + sprintf('%g,%g', x, y)\n end", "def scale_by(width_factor, height_factor, &block)\n squish(width*width_factor, height*height_factor, &block)\n end", "def hscale(factor)\n @width *= factor\n @left *= factor\n self\n end", "def scale(x, xmin, xmax, ymin, ymax)\n xrange = xmax - xmin\n yrange = ymax - ymin\n ymin + (x - xmin) * (yrange.to_f / xrange) \n end", "def scale( value )\n ( value - @min ) / ( @max - @min )\n end", "def set_rect(width, height)\n @width, @height = width, height\n zoom_x, zoom_y = (@width.to_f/@image_w.to_f)*@scale[0], (@height.to_f/@image_h.to_f)*@scale[1]\n @background.zoom_x, @background.zoom_y = zoom_x, zoom_y\n if @frame then @frame.zoom_x, @frame.zoom_y = zoom_x, zoom_y end\n end", "def scale(sx,sy)\n set RGhost::Scale.new(sx,sy)\n \n end", "def scale_by num\n min = 0.001\n num = min if num < min and num > -min\n self.x = self.x / num\n self.y = self.y / num\n self\n end", "def scale(*amount)\n self.dup.scale! *amount\n end", "def scale(factor)\n Point.new(self.x * factor, self.y * factor)\n end", "def scale_up(scale)\n self.side_length *= scale\n end", "def scale(f)\n @x *= f\n @y *= f\n self\n end", "def scale_by_bounds(dimensions)\n x = options[:width] / dimensions[0].to_f\n y = options[:height] / dimensions[1].to_f\n x * dimensions[1] > options[:height] ? y : x\n end", "def scales\n \n end", "def scale(factor_x, factor_y, around_x, around_y, &rendering_code); end", "def scale(factor_x, factor_y=factor_x, &rendering_code); end", "def rectified_percent\n percent = ((self.rectified_maps_count.to_f / self.maps_count.to_f) * 100).to_f\n percent.nan? ? 0 : percent\n end", "def zoom(percent)\n set RGhost::Scale.zoom(percent)\n end", "def update_scale\n heightpx = @board.height*@scale\n widthpx = @board.width*@scale\n # Gameboard\n @board_window.height = heightpx\n @board_window.width = widthpx\n # Clue windows\n @clues_windows[:rows].height = heightpx\n @clues_windows[:rows].width = (@scale*@board.clues[:rows].map { |row| row.length }.max)\n @clues_windows[:columns].height = (@scale*@board.clues[:columns].map { |column| column.length }.max)\n @clues_windows[:columns].width = widthpx\n # Clues\n @clues_list.each { |clue| clue[:text_object].delete() }\n @passing.each { |pass| pass.remove() }\n @passing = draw_passing(@board.clues)\n @clues_list = draw_clues(@board.clues)\n # Blocks\n @blocks.each do |block, cell|\n x = block.coords[:x]*@scale\n y = block.coords[:y]*@scale\n cell.coords = [x, y, x+@scale, y+@scale]\n end\n # Guide lines\n @guide_lines.each { |line| line.remove }\n @guide_lines = draw_guide_lines()\n update_highlight()\n end", "def scale\n raise NotImplementedError, \"Subclass responsibility\"\n end", "def convert(m)\n return auto(m) if @style[m] == :auto\n return @style[m] unless @style[m].percent?\n parent = self.parent || Viewport.new\n return (@style[m] * parent.inner.width / 100.0).round if [:x, :width].include?(m)\n return (@style[m] * parent.inner.height / 100.0).round\n end", "def scale(*args, &block); end", "def scale(x, y=x)\n CGContextScaleCTM(@ctx, x, y)\n end", "def click_on_perc(id, x_p, y_p)\n # Get the size of the window\n size = get_geometry(id)\n # Scale the input percentage coordinates to absolute values, and click\n click_on(id, size[0]*x_p/100, size[1]*y_p/100)\nend", "def update(point)\n\t\tsuper(point)\n\t\t\n\t\t# simple ratio solution courtesy of this link\n\t\t# http://tech.pro/tutorial/691/csharp-tutorial-font-scaling\n\tend", "def scale_to_cover(new_width, new_height, &block)\n raise ArgumentError, \"must supply the width and/or height\" if new_width.nil? && new_height.nil?\n if new_height.nil? || (!new_width.nil? && height*new_width > width*new_height)\n squish(new_width, height*new_width/width, &block)\n else\n squish(width*new_height/height, new_height, &block)\n end\n end", "def update_capture_rect\n @zoom = [100, @zoom].max\n tx, ty = @zoom_target_x, @zoom_target_y\n f = @zoom / 100.0\n w = (Graphics.width / f).to_i\n h = (Graphics.height / f).to_i\n x = (tx - w / 2.0).to_i.bound(0, Graphics.width - w)\n y = (ty - h / 2.0).to_i.bound(0, Graphics.height - h)\n @capture_rect.set(x, y, w, h)\n end", "def calulatePercentArea(image,min,max)\n height = image.size.height\n width = image.size.width\n shorter_side = width < height ? width : height\n max_side=shorter_side*max\n min_side= shorter_side * min\n return {\n min: min_side**2,\n max: max_side**2\n }\n end", "def percent_width(t, c)\n # Both of these work\n # (t.u / c) * 100.percent\n # ((t / c.to_f) * 100).percent\n # TODO make this work\n # (t / c) * 100.percent\n\n (t.u / c) * 100.percent\n end", "def normalize_x x\n (x.to_f + ((@width - @height) / @height) / 2) * @width / (@width/@height)\n end", "def sub_scale _value, _abs=0\n send_cmd(\"sub_scale #{_value} #{_abs}\")\n end", "def scale_by_pixels(dimensions)\n out_pixels = sqrt(options[:width] * options[:height]).truncate\n src_pixels = sqrt(dimensions[0] * dimensions[1]).truncate\n out_pixels / src_pixels.to_f\n end", "def update_size\n @max_x = @glade['drawingarea'].allocation.width - 1\n @max_y = @glade['drawingarea'].allocation.height - 1\n @glade['xvalue'].set_range(1,@max_x)\n @glade['yvalue'].set_range(1,@max_y)\n end", "def setscale(*)\n super\n end", "def scale_inside(other)\n wratio = other.width / width\n hratio = other.height / height\n if wratio < hratio\n Size.new(other.width, height * wratio)\n else\n Size.new(width * hratio, other.height)\n end\n end", "def rect=(rectangle); end", "def set_ratio\n @ratio = $program.width.to_f / $program.height\n end", "def scale_to_fit(new_width, new_height, &block)\n squish(*scale_dimensions_to_fit(new_width, new_height), &block)\n end", "def scale_factor(point, view)\n\n px_to_length(view)/view.pixels_to_model(1, point)\n\n end", "def scale_to_fill(new_size, position:position, scale:scale)\n new_size = SugarCube::CoreGraphics::Size(new_size)\n my_size = self.size\n if new_size.width == my_size.width && new_size.height == my_size.height && self.scale == scale\n return self\n end\n\n # first, scale down; then we'll scale back up if we went too far\n if my_size.width > new_size.width\n my_size.height *= new_size.width / my_size.width\n my_size.width = new_size.width\n end\n\n if my_size.height > new_size.height\n my_size.width *= new_size.height / my_size.height\n my_size.height = new_size.height\n end\n\n if my_size.width < new_size.width\n my_size.height *= new_size.width / my_size.width\n my_size.width = new_size.width\n end\n\n if my_size.height < new_size.height\n my_size.width *= new_size.height / my_size.height\n my_size.height = new_size.height\n end\n\n if self.size.width == my_size.width && self.size.height == my_size.height\n return self\n end\n\n if position.is_a?(Symbol)\n min_x = 0\n min_y = 0\n max_x = my_size.width\n max_y = my_size.height\n mid_x = max_x / 2\n mid_y = max_y / 2\n case position\n when :top_left, :topleft\n position = CGPoint.new(min_x, min_y)\n when :top\n position = CGPoint.new(mid_x, min_y)\n when :top_right, :topright\n position = CGPoint.new(max_x, min_y)\n when :left\n position = CGPoint.new(min_x, mid_x)\n when :center\n position = CGPoint.new(mid_x, mid_x)\n when :right\n position = CGPoint.new(max_x, mid_x)\n when :bottom_left, :bottomleft\n position = CGPoint.new(min_x, max_y)\n when :bottom\n position = CGPoint.new(mid_x, max_y)\n when :bottom_right, :bottomright\n position = CGPoint.new(max_x, max_y)\n else\n raise \"Unknown position #{position.inspect}\"\n end\n else\n position = SugarCube::CoreGraphics::Point(position)\n end\n thumbnail_x = position.x * (new_size.width - my_size.width) / my_size.width\n thumbnail_y = position.y * (new_size.height - my_size.height) / my_size.height\n\n UIGraphicsBeginImageContextWithOptions(new_size, false, scale)\n thumbnail_rect = CGRectZero\n thumbnail_rect.origin = [thumbnail_x, thumbnail_y]\n thumbnail_rect.size = my_size\n\n self.drawInRect(thumbnail_rect)\n\n new_image = UIGraphicsGetImageFromCurrentImageContext()\n UIGraphicsEndImageContext()\n\n raise \"could not scale image\" unless new_image\n\n return new_image\n end", "def rectangle(length:, width:)\n # now does squares!!!!\n (length.to_f * width.to_f).round(2)\n end", "def scale( scale_x, scale_y = scale_x )\n dup.scale!(scale_x, scale_y)\n end", "def scale factor\n Vector.new factor * @x, factor * @y, factor * @z\n end", "def scale!( scale_x, scale_y = scale_x )\n raise \"can't modify frozen object\" if frozen?\n @x, @y = @x * scale_x, @y * scale_y\n @hash = nil\n self\n end", "def fillrect(*)\n super\n end", "def scale(name)\n \n end", "def scale(range)\n u = uninterpolate\n i = interpolate(range[0], range[1])\n\n lambda do |x|\n x = ([0.0, x, (wrong + right).to_f].sort[1]).to_f\n i.call(u.call(x))\n end\n end", "def scale_fixed old_min, old_max, new_min, new_max\n self.map do |elem|\n Rya::ExtendedClasses::MATH.scale elem, old_min, old_max, new_min, new_max\n end\n end", "def resize_ratio_for asset\n base_geo = asset.geometry(:base_to_crop)\n original_geo = asset.geometry\n # Returning the biggest size as the ratio will be more exact.\n field = base_geo.width > base_geo.height ? :width : :height\n #Ratio to original / base\n original_geo.send(field).to_f / base_geo.send(field).to_f\n end", "def scale_to_fill(new_size, scale: scale)\n scale_to_fill(new_size, position: :center, scale: scale)\n end", "def update_size(x,y)\n @width = x if x > @width\n @height = y if y > @height\n end", "def scaleBatteryVoltage(v)\n ((v * 675) / 65536.0).round / 100.0\n end", "def scale_to_length(new_length)\n self.scale(new_length / length)\n end", "def rect; end", "def rect; end", "def scale_within(new_size)\n target_size = SugarCube::CoreGraphics::Size(new_size)\n image_size = self.size\n\n if CGSizeEqualToSize(target_size, self.size)\n return self\n end\n\n width = image_size.width\n height = image_size.height\n\n target_width = target_size.width\n target_height = target_size.height\n\n width_factor = target_width / width\n height_factor = target_height / height\n\n if width_factor < height_factor\n scale_factor = width_factor\n else\n scale_factor = height_factor\n end\n\n if scale_factor == 1\n return self\n end\n\n scaled_size = CGSize.new(width * scale_factor, height * scale_factor)\n return scale_to(scaled_size)\n end", "def clamp(rect)\n self.dup.clamp!(rect)\n end", "def scale(*args)\n with_command %(-scale \"#{Geometry.new(*args)}\")\n end", "def item_rect(*args, &block)\n rect = super(*args, &block)\n rect.y += [(rect.height - 98) / 2, 0].max\n rect.height = 98\n rect\n end", "def scale=(val)\n self['scale'] = val\n end", "def scale_by ratio\n new_steps = self.steps.map do |s| \n step_args = s.techniques.map do |t| \n t.is_a?(Ingredient) ? t.scale_by(ratio) : t\n end\n Step.new step_args\n end\n\n Recipe.new self.metadata, new_steps\n end", "def /(number)\n Measure.new(scale/number.to_f, unit)\n end", "def fit_sprite(s, r)\n s.x, s.y = r.x, r.y\n s.zoom_x, s.zoom_y = r.width, r.height\n end", "def scale= scale\n protected_use_method(MM::Scaling, :@scale, scale)\n end", "def scale(by)\n @x = @x * by\n @y = @y * by\n @z = @z * by\n self\n end", "def scale(factor)\n x = x2 - x1\n y = y2 - y1\n Line.new(p1, Point.new(x1 + (x * factor), y1 + (y * factor)))\n end", "def set(*args)\n if (a = args[0]).is_a? Rect\n @x, @y, @width, @height = a.x, a.y, a.width, a.height\n else\n @x, @y, @width, @height = *args\n end\n compute\n self\n end", "def setRectangular _obj, _args\n \"_obj setRectangular _args;\" \n end", "def scale(value)\n @tileset.scale = value\n end", "def space_percentage\n if quota == 0\n 0.0\n else\n (size.to_f/quota)*100 rescue 0.0\n end\n end", "def update_size(width, height) \n if @vertical\n @height += height\n @width = width if width > @width\n else\n @width += width\n @height = height if height > @height\n end\n end", "def update_position\n @curr.set_to(@parent.center)\n self.width = @scale_to_length \\\n ? @parent.curr_length * @rect_scale \\\n : @parent.rest_length * @rect_scale\n self.height = @rect_height\n self.radian = @parent.radian\n end", "def scale_by ratio, units=self.units\n scaled = Hash.new\n self.info.each do |k, v|\n scaled[k] = v\n scaled[k] = v*ratio if k == :quantity\n end\n Ingredient.new(self.name, scaled)\n end", "def scale\n scale_factor = 20 # template.png height divided by canvas height\n self.image_x *= scale_factor\n self.image_y *= scale_factor\n self.height *= scale_factor\n self.width *= scale_factor\n self.rotation *= 180 / Math::PI\n end", "def percent\n self[:percentage] = (self[:current] <= self[:max] ? self[:current]/self[:max]*100 : self[:max])\n end", "def set_fixed_scale(vmin,vmax,divisions=5,vxmin=0,vxmax=0,xdivisions=5)\n @vmin = vmin\n @vmax = vmax\n @divisions = divisions\n #TODO check\n #if (!vxnin == 0 )\n if (vxnin != 0 )\n @vxmin = vxmin\n @vxmax = vxmax\n @xdivisions = xdivisions\n end\n end", "def scale_to(new_size)\n scale_to(new_size, background:nil)\n end", "def scale_to_fill(new_size)\n scale_to_fill(new_size, position: :center)\n end", "def bound_in_rect(rect)\n result = rect\n if rect.x < 0\n result.width = rect.width - rect.x\n result.x = 0\n end\n if rect.y < 0\n result.height = result.height - rect.y\n result.y = 0\n end\n if rect.width > xsize\n result.width = xsize\n end\n if rect.height > ysize\n result.height = ysize\n end\n return result\n end", "def mul( val )\n @x.scale( val )\n @y.scale( val )\n self\n end", "def size_ratio(geom)\n geom_size = SizableLocation.new(geom).size\n if geom_size.positive?\n size.to_f / geom_size\n else\n 0.0\n end\n end", "def valid_percent_of_small\n 10.percent_of(20)\n end", "def setScaleShiftByBoundaryBox(x0,y0,x1,y1)\n @device.setScaleShiftByBoundaryBox(x0,y0,x1,y1) ;\n end", "def width; rect.width; end", "def rect\n Image.run_cmplx(self) { |x| x.complex :rect }\n end", "def percentage; end", "def percent_h(value)\n bounds.height * (clamp_percentage(value) / 100.0)\n end", "def shrink_to_fit(new_width, new_height, &block)\n new_width, new_height = scale_dimensions_to_fit(new_width, new_height)\n return block.call(self) if new_width >= width && new_height >= height\n squish(new_width, new_height, &block)\n end", "def scale d, min, max\n range = max - min\n if range != 0\n scaled = (d.to_f / range) * 360\n return clamp(scaled, 0, 360).round\n else\n 0\n end\n end", "def area; rect size; end", "def scaleTo2 (target_dims_meters)\n bb = Sketchup.active_model.bounds \n car_height = bb.depth\n min_mirror_z = 0.50 * car_height # mirrors are definitely higher than this\n\n adjusted_car_width = 0 # init with large number\n adjusted_car_min = 0\n for part in Sketchup.active_model.definitions\n max_corner = part.bounds.max\n min_corner = part.bounds.min\n # \"max_corner.z > 0\" -- a hack to remove some exhilary shit\n if max_corner.z > 0 and max_corner.z < bb.depth * min_mirror_z\n adjusted_car_width = [max_corner.y.to_m, adjusted_car_width].max\n #puts part.name, max_corner, adjusted_car_width\n adjusted_car_min = [min_corner.y.to_m, adjusted_car_min].min\n #puts part.name, max_corner, adjusted_car_width\n end\n end\n raise 'adjusted_car_width < 0' if adjusted_car_width == 0\n puts \"adjusted max: #{adjusted_car_width}, min: #{adjusted_car_min}\"\n #puts \"car_width: #{bb.height.to_m}, adjusted: #{adjusted_car_width}\"\n\n # here's what we want to have\n target_car_width = target_dims_meters[1]\n # we only use car width (y) as the most reliable (no extra stuff on sides)\n scale = target_car_width / adjusted_car_width\n origin = Geom::Point3d.new 0,0,0\n transform = Geom::Transformation.scaling origin, scale\n entities = Sketchup.active_model.entities\n #entities.transform_entities(transform, entities.to_a)\n\nend", "def fill_rect(*args)\n raise \"not implemented\"\n end", "def subdivs=( value )\r\n unless value.is_a?( Numeric )\r\n raise ArgumentError, 'Argument not numeric.'\r\n end\r\n unless SUBDIVS_RANGE.include?( value )\r\n raise ArgumentError, 'Invalid subdivision range.'\r\n end\r\n @subdivs = value\r\n end", "def scale!(rhs)\n scale rhs, self\n end", "def clamp_percent_of_resource(resource, percentage, minimum, maximum)\n percentage *= 0.01\n resource_percentage = (resource * percentage).to_i\n resource_percentage_or_maximum = [resource_percentage, maximum].min\n [resource_percentage_or_maximum, minimum].max\n end", "def scale_and_translate(outline, width, height, scale, location)\r\n tr = Geom::Transformation.scaling(height * scale, height * scale,0)\r\n outline.collect!{|pt|\r\n pt.transform!(tr)\r\n pt[0] = pt[0] + width * scale - height * scale if pt[0] > height * scale/2\r\n pt\r\n }\r\n tr = Geom::Transformation.translation([location[0] * scale, location[1] * scale])\r\n outline.collect{|pt| pt.transform(tr)}\r\n end", "def rect(x, y, width, height, rgb, fill=true)\n rect_rounded(x, y, width, height, rgb, 0, 0, fill)\n end" ]
[ "0.63197976", "0.6116605", "0.60990804", "0.5944514", "0.58709925", "0.5776801", "0.5719672", "0.56415004", "0.56407744", "0.5614465", "0.5609648", "0.5562131", "0.55542594", "0.5543392", "0.55390245", "0.5535034", "0.5492933", "0.54394084", "0.5434011", "0.5426827", "0.54217017", "0.53943485", "0.53725636", "0.5371836", "0.53127986", "0.5305685", "0.5297139", "0.52237505", "0.52228034", "0.52213126", "0.51656425", "0.51325274", "0.5128288", "0.5112543", "0.5101621", "0.5101135", "0.5098101", "0.50939196", "0.5080507", "0.5078174", "0.5070848", "0.505683", "0.5043815", "0.5042499", "0.50423986", "0.50334984", "0.50245225", "0.5021473", "0.5019123", "0.50104916", "0.49953988", "0.49787363", "0.49715817", "0.49709105", "0.49696252", "0.4968248", "0.49624905", "0.49624905", "0.4957268", "0.49535966", "0.49505144", "0.494949", "0.49493083", "0.49490806", "0.494864", "0.49376485", "0.49345008", "0.49287483", "0.49235824", "0.49215814", "0.49067363", "0.49037158", "0.48894948", "0.4874731", "0.48689467", "0.48655587", "0.48507875", "0.48451197", "0.4842229", "0.48421285", "0.48406467", "0.48373666", "0.4833445", "0.4832808", "0.48238042", "0.48236755", "0.48232543", "0.48164836", "0.4813524", "0.48121354", "0.48091564", "0.48048523", "0.4792197", "0.47880554", "0.47777373", "0.47767836", "0.477067", "0.47645164", "0.47631925", "0.4749559" ]
0.84678346
0
Returns the angle from one primitive to another primitive.
def angle_to other_point Geometry.angle_to self, other_point end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(other)\n\n # Two options here:\n #\n # 1. Math.atan2(other.cross_length(self), dot(other)) \n #\n # This is stable but slower (x 1.5)\n #\n # 2. Math.acos(dot(other) / (r * other.r)) \n #\n # This is faster but unstable around 0 and pi where the gradient of acos approaches \n # infinity. An alternative way to view this is that the gradient of cos approaches\n # zero and small differences in angle can be indistinguishable at some number of \n # decimal places.\n #\n \n # Math.acos(dot(other) / (r * other.r)) \n Math.atan2(other.cross_length(self), dot(other)) \n end", "def angle_from other_point\n Geometry.angle_from self, other_point\n end", "def angle\n Math.atan2(@y, @x)\n end", "def other_angle(a, b)\n 180 - (a + b)\nend", "def other_angle(a, b)\n 180 - (a + b)\nend", "def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end", "def angle\n Math.atan2( @y, @x )\n end", "def angle_between(other)\n raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity)\n \n v1 = self.direction\n v2 = other.direction\n\n # Convert numerator to BigDecimal for more precision.\n numerator = BigDecimal(v1.dot(v2).to_f.to_s)\n denominator = v1.to_point.abs * v2.to_point.abs\n\n return Math.acos(numerator / denominator)\n end", "def angle(*args)\n Math.acos(self.dot(*args))\n end", "def angle_to(a,b)\n a,b = *[a,b].map(&:to_np)\n d0,d1 = dist_from(a), a.dist_from(b)\n z = self.to(a,1+d1/d0)\n dz = z.dist_from(b)\n Math.asin(dz/2/d1)*2\n end", "def angle_between(p1, p2)\n vect_p1 = p1 - self\n vect_p2 = p2 - self\n\n theta = vect_p1.polar - vect_p2.polar\n theta += 360.0 if theta < 0.0\n theta = 360.0 - theta if theta > 180.0\n return theta\n end", "def angle(x1, y1, x2, y2)\n end", "def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end", "def angle(p)\n Math.atan2(p.y - self.y, p.x - self.x)\n end", "def +(other)\n return self.class.radians(@angle + other)\n end", "def angle\n @angle\n end", "def /(other)\n return self.class.radians(@angle / other)\n end", "def angle_diff(angle1, angle2)\n end", "def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end", "def angle_b\n Angle.new(\n self,\n :b,\n (\n (\n Math.acos((a**2 + c**2 - b**2) / (2.0 * a * c)) * 180\n ) / Math::PI\n )\n )\n end", "def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end", "def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end", "def angle(vector1,vector2)\n\n small = 0.00000001\n undefined = 999999.1\n\n magnitudevector1 = magnitude(vector1)\n magnitudevector2 = magnitude(vector2)\n if (magnitudevector1*magnitudevector2) > (small**2)\n aux = vdot(vector1,vector2)/(magnitudevector1*magnitudevector2)\n if aux.abs> 1.0\n aux = signal(aux) * 1.0\n end\n return Math.acos(aux)\n else\n return undefined\n end\n end", "def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end", "def -(other)\n return self.class.radians(@angle - other)\n end", "def angle_between(vector2)\n end", "def angle_direction(a,b)\n magnitude = angle_difference(a,b)\n if angle_difference(a + 1, b) < magnitude\n magnitude\n else\n -magnitude\n end\n end", "def getAngle(c1,c2)\n x = c2[0] - c1[0]\n y = c2[1] - c1[1]\n x = x <= -180 ? x + 360 : x\n x = x >= 180 ? x - 360 : x\n\n a = Math.atan2(y, x)\n rescue\n p \"Error x=#{x}, y=#{y} sq= #{Math.sqrt(x*x+y*y)} rat=#{x / Math.sqrt(x*x+y*y)}\"\n raise Error\n end", "def angle_between v\n pdotp = perpdot(v)\n dotp = dot(v)\n Math.atan2(pdotp, dotp)\n end", "def bearing_to(other)\n return 0 if self == other\n theta = Math.atan2(other.x - x, other.y - y)\n theta += Math::PI * 2 if theta < 0\n theta / DEG2RAD\n end", "def line_angle(p1,p2)\n v1 = RBA::DPoint.new(1,0)\n v2 = p2-p1\n return vector_angle(v1,v2)\n end", "def angles_diff(a1, a2)\n diff = a2 - a1\n while diff > Math::PI\n diff -= 2.0 * Math::PI\n end\n while diff < -Math::PI\n diff += 2.0 * Math::PI\n end\n diff\n end", "def atan\n math :atan\n end", "def angle\n rad / Math::PI * 180\n end", "def angle_to(point)\n Ubiquity::Geoformulas.angle self.lat, self.lon, point.lat, point.lon\n end", "def %(other)\n return self.class.radians(@angle % other)\n end", "def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end", "def angle_delta(angle1, angle2)\n \t delta = (angle1 - angle2).abs\n \t if delta >= Math::PI\n \t delta = (((2 * Math::PI) - angle1) + angle2).abs\n \t end\n \t return delta\n \tend", "def angle(path)\n io_for(path).angle\n end", "def bbAngle(first_point, second_point)\n\n angle = Math.acos(bbpDot(bbpNormalize(first_point), bbpNormalize(second_point)))\n\n angle = 0.0 if angle.abs < Float::EPSILON\n\n angle\n end", "def arctan(p1, p2)\n # atan2(y, x) → Float\n Math.atan2((p2.y - p1.y), (p2.x - p1.x))\nend", "def angle_deg\n angle * RAD_TO_DEG\n end", "def calculate_rad_angle_between(target)\n Math.atan2(target.y - y, target.x - x)\n end", "def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n if vdot >= 0\n return Math.asin(val)\n elsif vcross !=0\n return vcross/vcross.abs*Math::PI - Math.asin(val)\n else\n return Math::PI - Math.asin(val)\n end\n end", "def angle_c\n Angle.new(\n self,\n :c,\n (\n (\n Math.acos((a**2 + b**2 - c**2) / (2.0 * a * b)) * 180\n ) / Math::PI\n )\n )\n end", "def radians\n Science::Angle.new(self, :radians)\n end", "def angle_from_input\n\n return if @path.size < 2\n return unless @active_controller.is_a? Symbol\n\n i = @active_controller == :start ? 0 : 1\n corner = @path[-i]\n ref_vector = @path[-i] - @path[1 - 3 * i]\n input_vector = corner - @ip.position\n return unless input_vector.valid?\n return if input_vector.parallel? Z_AXIS\n return if input_vector.parallel? ref_vector\n\n angle = -(MyGeom.angle_in_plane input_vector, ref_vector)\n angle -= GRAPHICAL_ANGLES[i]\n angle = ((angle+90.degrees)%180.degrees)-90.degrees\n\n @end_angles[i] = angle\n\n end", "def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend", "def *(other)\n self.class.radians(@angle * other)\n end", "def to_radians\n self * Math::PI.fdiv(180)\n end", "def **(other)\n return self.class.radians(@angle**other)\n end", "def angle x1, y1, a, m, c\n x2, y2 = project x1, y1, a, m\n line x1, y1, x2, y2, c\n end", "def angle_between(vector2)\n self.class.angle_between(self, vector2)\n end", "def theta\n (@x == 0)? ((@y > 0)? @@pio2 : -@@pio2) : Math.atan2(@y,@x)\n end", "def radians\n self * 180 / Math::PI\n end", "def full_angle_between(vector1, vector2, normal = Z_AXIS)\n direction = (vector1 * vector2) % normal\n angle = vector1.angle_between(vector2)\n angle = 360.degrees - angle if direction < 0.0\n angle\n end", "def orthodrome_init_angle(lat1, lon1, lat2, lon2)\n dlon = (lon2 - lon1) * RAD_PER_DEG\n cola1 = Math.cos(lat1 * RAD_PER_DEG)\n sila1 = Math.sin(lat1 * RAD_PER_DEG)\n cola2 = Math.cos(lat2 * RAD_PER_DEG)\n sila2 = Math.sin(lat2 * RAD_PER_DEG)\n\n y = Math.sin(dlon) * cola2\n x = cola1 * sila2 - sila1 * cola2 * Math.cos(dlon)\n angle = Math.atan2(y,x)/RAD_PER_DEG # angle in degrees\n end", "def get_angle(vertices_hash)\n raise 'not circular enough for this call' if !circular\n t_v1, t_v2 = translate_edge(vertices_hash)\n dot_product = self.class.get_dot_product(t_v1, t_v2)\n origin = Vertex.new(0,0)\n magnitude_t_v1 = get_distance(origin, t_v1)\n magnitude_t_v2 = get_distance(origin, t_v2)\n cosine = dot_product / (magnitude_t_v1 * magnitude_t_v2)\n Math.acos(cosine)\n end", "def atan2(y, x)\n atan2_base(num_class[y], num_class[x])\n end", "def atan\n Double.new(Math.atan(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end", "def to_degrees\n self / Math::PI.fdiv(180)\n end", "def angle_at(point)\n Point.angle(centre, point)\n end", "def degrees\n self * Math::PI / 180\n end", "def angle_to body\n dx = body.x - self.x\n dy = body.y - self.y\n\n (R2D * Math.atan2(dy, dx)).degrees\n end", "def calc_angle(x1, y1, x2, y2)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n if (x1 == x2)\r\n if (y2 >= y1)\r\n return 0\r\n else\r\n return 180\r\n end #else\r\n elsif (y1 == y2)\r\n if (x2 >= x1)\r\n return 90\r\n else\r\n return 270\r\n end #else\r\n else\r\n x1 = x1 + 0.0 # force to be floating point\r\n x2 = x2 + 0.0 # force to floating point\r\n slope = (y2-y1) / (x2-x1)\r\n radians = Math.atan(slope)\r\n degrees = conv_radian_to_degree(radians)\r\n # Handle Adjusting Quadrent\r\n if ((x2 > x1) && (y2 > y1))\r\n # Quadrent 1;\r\n degrees = degrees\r\n elsif ((x2 > x1) && (y2 < y1))\r\n # Quadrent 2\r\n degrees = 90 - degrees;\r\n elsif ((x2 < x1) && (y2 < y1))\r\n # Quadrent 3\r\n degrees = 270 - degrees\r\n else\r\n # must be Quadrent 4\r\n degrees = 270 - degrees\r\n end # else\r\n end # else\r\n return degrees\r\nend", "def angle_of_specified_radius\n @angle_of_radius\n end", "def to_b\n return \"Math::acos(#{self.arg.to_b})\"\n end", "def angle\r\n self.data.map(&:angle)\r\n end", "def angle_equation_of_time() \r\n delta_orbit() + delta_oblique()\r\n end", "def atan(x)\n atan_base(num_class[x])\n end", "def degrees\n self * Math::PI / 180.0\n end", "def anglecw\n 360 - angle\n end", "def getBearing(p1, p2)\n dLon = rad(p2[0]-p1[0])\n lat2 = rad(p2[1])\n lat1 = rad(p1[1])\n y = Math.sin(dLon) * Math.cos(lat2)\n x = Math.cos(lat1)*Math.sin(lat2) -\n Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon)\n brng = Math.atan2(y, x)\n end", "def equirectangular_angle(lat1, lon1, lat2, lon2)\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n avlat_rad = (lat2 + lat1)/2 * RAD_PER_DEG\n\n x = dlon * Math.cos(avlat_rad)\n y = dlat\n angle = Math.atan2(x,y)/RAD_PER_DEG # angle in degrees\n end", "def <=>(other)\n @angle <=> if other.instance_of?(Angle)\n other.angle\n else\n other\n end\n end", "def calculate_deg_angle_between(target)\n calculate_rad_angle_between(target).angle_rad_to_deg_clipped\n end", "def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end", "def bbpToAngle(point)\n\n Math.atan2(v.y, v.x)\n end", "def bearing(x1, y1, x2, y2 )\n \t\tdx, dy = x2 - x1, y2 - y1\n \t\tmagnitude = distance( x1, y1, x2, y2 )\n \t\tif( dx >= 0 && dy >= 0 ) || ( dx <= 0 && dy >= 0 )\n \t\ttheta = Math.acos(-dx / magnitude) + Math::PI\n \t\telsif ( dx >= 0 && dy <= 0 ) || ( dx <= 0 && dy <= 0 )\n \t\ttheta = Math.acos(dx / magnitude)\n \t\tend\n \t\treturn 0 if magnitude == 0\n \t\ttheta = theta - (Math::PI * 2) if theta >= (Math::PI * 2)\n \t\treturn theta\n \tend", "def getGeoAngle(c1,c2)\n x = c2[0] - c1[0]\n y = c2[1] - c1[1]\n y = y <= -180 ? y+360 : y\n y = y >= 180 ? y-360 : y\n\n ca = getCentralAngle(c1,c2)\n dist = EARTH_RADIUS_FEET * ca\n ca1 = getCentralAngle(c1,[c2[0],c1[1]])\n dist1 = EARTH_RADIUS_FEET * ca1 * sign(x)\n ca2 = getCentralAngle(c2,[c2[0],c1[1]])\n dist2 = EARTH_RADIUS_FEET * ca2 * sign(y)\n\n angle = Math.atan2(dist2,dist1)\n end", "def to_rad\n self * Math::PI / 180\n end", "def normalize_bearing(angle)\n \t return ((angle + Math::PI) % (2 * Math::PI)) - Math::PI\n \tend", "def radian_angle\n @angle * Math::PI / 180.0\n end", "def getAngleOf2Vector(vector2)\n angleRad = Math.acos( self.dotProduct( vector2 ) / ( @length * vector2.length ) )\n angle = radianToDegre( angleRad )\n \n return angle\n end", "def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end", "def convert_to_radians(degrees)\n degrees * PI / 180\nend", "def angle_to(key)\n p1 = {\n x: (row_offset.to_f)+((width)/2),\n y: (row.number.to_f)-((height)/2)+(height)\n }\n\n p2 = {\n x: (key.row_offset.to_f)+((key.width)/2),\n y: (key.row.number.to_f)-((key.height)/2)+(key.height)\n }\n\n Math.atan2(p2[:x] - p1[:x], p2[:y] - p1[:y]) * 180 / Math::PI\n end", "def direction(x_diff, y_diff)\n Math.atan2(0, -1) - Math.atan2(x_diff, y_diff)\n end", "def bbpAngleSigned(first_point, second_point)\n\n first_point = bbpNormalize(first_point)\n second_point = bbpNormalize(second_point)\n\n angle = Math.atan2(first_point.x * second_point.y - first_point.y * second_point.x),\n bbpDot(first_point, second_point)\n\n angle = 0.0 if angle.abs < Float::EPSILON\n\n angle\n end", "def angle_delta_oblique() \r\n #al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()\r\n al_Sun() - ra_Sun() \r\n end", "def atan2(arg)\n Double.new(Math.atan2(self.to_f, arg.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end", "def aas(angle_a, angle_b, side_A)\n side_A / Math.sin(deg2rad(angle_a)) * Math.sin(deg2rad(angle_b))\n end", "def angle_delta_orbit() \r\n -1.0 * eqc( @ma, @ta ) \r\n end", "def rotate(angle)\n primitive 'rotate ' + sprintf('%g', angle)\n end", "def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend", "def angle_xy(xa, ya, xb, yb)\n - Math.atan2(yb-ya, xb-xa)*57.29%360\n end", "def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end", "def delta(to)\n diff = (to.to_f - self.to_f).abs % FULL_ANGLE\n diff = -(FULL_ANGLE - diff) if diff > Math::PI\n to.to_f < self.to_f ? -diff : diff\n end", "def to_code\n \"Math::acos(#{@x.to_code})\"\n end", "def acos\n math :acos\n end" ]
[ "0.7642555", "0.7580265", "0.747291", "0.7467351", "0.74523467", "0.7414426", "0.7342401", "0.7337862", "0.726271", "0.7156291", "0.71125174", "0.7042469", "0.7018013", "0.6877022", "0.687598", "0.68316835", "0.68095326", "0.6760979", "0.6749183", "0.6672454", "0.66706693", "0.66706693", "0.66494256", "0.6645016", "0.66366005", "0.66365826", "0.66233397", "0.65669274", "0.6562178", "0.6561986", "0.65552825", "0.6548581", "0.6543462", "0.6538704", "0.6533874", "0.6489564", "0.6463631", "0.6415228", "0.63857406", "0.6376862", "0.6370207", "0.63560975", "0.635562", "0.62709975", "0.62645406", "0.6233756", "0.62337476", "0.6211449", "0.62109727", "0.62068915", "0.61870277", "0.61796683", "0.6168034", "0.61633015", "0.6159103", "0.61211675", "0.61095935", "0.60994005", "0.6083278", "0.6057264", "0.6052362", "0.60302013", "0.5994683", "0.5983319", "0.59829813", "0.5980165", "0.5974554", "0.5945845", "0.59062004", "0.5899667", "0.5896109", "0.5884293", "0.5859466", "0.5857031", "0.58530873", "0.582683", "0.58108914", "0.5810061", "0.5792387", "0.5771973", "0.5764084", "0.5752296", "0.57420176", "0.57412636", "0.5731935", "0.57141423", "0.5711878", "0.5711475", "0.56993806", "0.5680933", "0.5679846", "0.5674936", "0.5667134", "0.56610274", "0.56532985", "0.565097", "0.56487983", "0.5634152", "0.56337833", "0.5587268" ]
0.74456096
5
Returns the angle to one primitive from another primitive.
def angle_from other_point Geometry.angle_from self, other_point end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_to other_point\n Geometry.angle_to self, other_point\n end", "def other_angle(a, b)\n 180 - (a + b)\nend", "def other_angle(a, b)\n 180 - (a + b)\nend", "def angle(other)\n\n # Two options here:\n #\n # 1. Math.atan2(other.cross_length(self), dot(other)) \n #\n # This is stable but slower (x 1.5)\n #\n # 2. Math.acos(dot(other) / (r * other.r)) \n #\n # This is faster but unstable around 0 and pi where the gradient of acos approaches \n # infinity. An alternative way to view this is that the gradient of cos approaches\n # zero and small differences in angle can be indistinguishable at some number of \n # decimal places.\n #\n \n # Math.acos(dot(other) / (r * other.r)) \n Math.atan2(other.cross_length(self), dot(other)) \n end", "def angle\n Math.atan2(@y, @x)\n end", "def angle(*args)\n Math.acos(self.dot(*args))\n end", "def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end", "def angle\n Math.atan2( @y, @x )\n end", "def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end", "def angle_between(other)\n raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity)\n \n v1 = self.direction\n v2 = other.direction\n\n # Convert numerator to BigDecimal for more precision.\n numerator = BigDecimal(v1.dot(v2).to_f.to_s)\n denominator = v1.to_point.abs * v2.to_point.abs\n\n return Math.acos(numerator / denominator)\n end", "def angle_to(a,b)\n a,b = *[a,b].map(&:to_np)\n d0,d1 = dist_from(a), a.dist_from(b)\n z = self.to(a,1+d1/d0)\n dz = z.dist_from(b)\n Math.asin(dz/2/d1)*2\n end", "def angle(x1, y1, x2, y2)\n end", "def angle_between(p1, p2)\n vect_p1 = p1 - self\n vect_p2 = p2 - self\n\n theta = vect_p1.polar - vect_p2.polar\n theta += 360.0 if theta < 0.0\n theta = 360.0 - theta if theta > 180.0\n return theta\n end", "def angle\n @angle\n end", "def angle(p)\n Math.atan2(p.y - self.y, p.x - self.x)\n end", "def +(other)\n return self.class.radians(@angle + other)\n end", "def angle_to(point)\n Ubiquity::Geoformulas.angle self.lat, self.lon, point.lat, point.lon\n end", "def /(other)\n return self.class.radians(@angle / other)\n end", "def angle_b\n Angle.new(\n self,\n :b,\n (\n (\n Math.acos((a**2 + c**2 - b**2) / (2.0 * a * c)) * 180\n ) / Math::PI\n )\n )\n end", "def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end", "def angle_to(v)\n ret = Math.atan2(v.y, v.x) - Math.atan2(y, x)\n if ret > Math::PI\n ret -= 2*Math::PI\n end\n if ret < -Math::PI\n ret += 2*Math::PI\n end\n ret\n end", "def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end", "def angle_a\n Angle.new(\n self,\n :a,\n (\n (\n Math.acos((b**2 + c**2 - a**2) / (2.0 * b * c)) * 180\n ) / Math::PI\n )\n )\n end", "def -(other)\n return self.class.radians(@angle - other)\n end", "def line_angle(p1,p2)\n v1 = RBA::DPoint.new(1,0)\n v2 = p2-p1\n return vector_angle(v1,v2)\n end", "def atan\n math :atan\n end", "def angle_between(vector2)\n end", "def angle_diff(angle1, angle2)\n end", "def %(other)\n return self.class.radians(@angle % other)\n end", "def angle(path)\n io_for(path).angle\n end", "def angle\n rad / Math::PI * 180\n end", "def angle_between v\n pdotp = perpdot(v)\n dotp = dot(v)\n Math.atan2(pdotp, dotp)\n end", "def angle_from_input\n\n return if @path.size < 2\n return unless @active_controller.is_a? Symbol\n\n i = @active_controller == :start ? 0 : 1\n corner = @path[-i]\n ref_vector = @path[-i] - @path[1 - 3 * i]\n input_vector = corner - @ip.position\n return unless input_vector.valid?\n return if input_vector.parallel? Z_AXIS\n return if input_vector.parallel? ref_vector\n\n angle = -(MyGeom.angle_in_plane input_vector, ref_vector)\n angle -= GRAPHICAL_ANGLES[i]\n angle = ((angle+90.degrees)%180.degrees)-90.degrees\n\n @end_angles[i] = angle\n\n end", "def radians\n Science::Angle.new(self, :radians)\n end", "def angle_with( vector )\n Math.acos( max(min(udot(vector),MAX_UDOT_PRODUCT), MIN_UDOT_PRODUCT) )\n end", "def getAngle(c1,c2)\n x = c2[0] - c1[0]\n y = c2[1] - c1[1]\n x = x <= -180 ? x + 360 : x\n x = x >= 180 ? x - 360 : x\n\n a = Math.atan2(y, x)\n rescue\n p \"Error x=#{x}, y=#{y} sq= #{Math.sqrt(x*x+y*y)} rat=#{x / Math.sqrt(x*x+y*y)}\"\n raise Error\n end", "def angle(vector1,vector2)\n\n small = 0.00000001\n undefined = 999999.1\n\n magnitudevector1 = magnitude(vector1)\n magnitudevector2 = magnitude(vector2)\n if (magnitudevector1*magnitudevector2) > (small**2)\n aux = vdot(vector1,vector2)/(magnitudevector1*magnitudevector2)\n if aux.abs> 1.0\n aux = signal(aux) * 1.0\n end\n return Math.acos(aux)\n else\n return undefined\n end\n end", "def angle_deg\n angle * RAD_TO_DEG\n end", "def bearing_to(other)\n return 0 if self == other\n theta = Math.atan2(other.x - x, other.y - y)\n theta += Math::PI * 2 if theta < 0\n theta / DEG2RAD\n end", "def angle_direction(a,b)\n magnitude = angle_difference(a,b)\n if angle_difference(a + 1, b) < magnitude\n magnitude\n else\n -magnitude\n end\n end", "def *(other)\n self.class.radians(@angle * other)\n end", "def angle x1, y1, a, m, c\n x2, y2 = project x1, y1, a, m\n line x1, y1, x2, y2, c\n end", "def angles_diff(a1, a2)\n diff = a2 - a1\n while diff > Math::PI\n diff -= 2.0 * Math::PI\n end\n while diff < -Math::PI\n diff += 2.0 * Math::PI\n end\n diff\n end", "def bbAngle(first_point, second_point)\n\n angle = Math.acos(bbpDot(bbpNormalize(first_point), bbpNormalize(second_point)))\n\n angle = 0.0 if angle.abs < Float::EPSILON\n\n angle\n end", "def **(other)\n return self.class.radians(@angle**other)\n end", "def angle_c\n Angle.new(\n self,\n :c,\n (\n (\n Math.acos((a**2 + b**2 - c**2) / (2.0 * a * b)) * 180\n ) / Math::PI\n )\n )\n end", "def arctan(p1, p2)\n # atan2(y, x) → Float\n Math.atan2((p2.y - p1.y), (p2.x - p1.x))\nend", "def radians\n self * 180 / Math::PI\n end", "def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n if vdot >= 0\n return Math.asin(val)\n elsif vcross !=0\n return vcross/vcross.abs*Math::PI - Math.asin(val)\n else\n return Math::PI - Math.asin(val)\n end\n end", "def to_radians\n self * Math::PI.fdiv(180)\n end", "def calculate_rad_angle_between(target)\n Math.atan2(target.y - y, target.x - x)\n end", "def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend", "def angle_delta(angle1, angle2)\n \t delta = (angle1 - angle2).abs\n \t if delta >= Math::PI\n \t delta = (((2 * Math::PI) - angle1) + angle2).abs\n \t end\n \t return delta\n \tend", "def angle_at(point)\n Point.angle(centre, point)\n end", "def angle_between(vector2)\n self.class.angle_between(self, vector2)\n end", "def angle_to body\n dx = body.x - self.x\n dy = body.y - self.y\n\n (R2D * Math.atan2(dy, dx)).degrees\n end", "def atan2(y, x)\n atan2_base(num_class[y], num_class[x])\n end", "def full_angle_between(vector1, vector2, normal = Z_AXIS)\n direction = (vector1 * vector2) % normal\n angle = vector1.angle_between(vector2)\n angle = 360.degrees - angle if direction < 0.0\n angle\n end", "def get_angle(vertices_hash)\n raise 'not circular enough for this call' if !circular\n t_v1, t_v2 = translate_edge(vertices_hash)\n dot_product = self.class.get_dot_product(t_v1, t_v2)\n origin = Vertex.new(0,0)\n magnitude_t_v1 = get_distance(origin, t_v1)\n magnitude_t_v2 = get_distance(origin, t_v2)\n cosine = dot_product / (magnitude_t_v1 * magnitude_t_v2)\n Math.acos(cosine)\n end", "def theta\n (@x == 0)? ((@y > 0)? @@pio2 : -@@pio2) : Math.atan2(@y,@x)\n end", "def degrees\n self * Math::PI / 180\n end", "def to_b\n return \"Math::acos(#{self.arg.to_b})\"\n end", "def angle\r\n self.data.map(&:angle)\r\n end", "def to_degrees\n self / Math::PI.fdiv(180)\n end", "def bbpToAngle(point)\n\n Math.atan2(v.y, v.x)\n end", "def orthodrome_init_angle(lat1, lon1, lat2, lon2)\n dlon = (lon2 - lon1) * RAD_PER_DEG\n cola1 = Math.cos(lat1 * RAD_PER_DEG)\n sila1 = Math.sin(lat1 * RAD_PER_DEG)\n cola2 = Math.cos(lat2 * RAD_PER_DEG)\n sila2 = Math.sin(lat2 * RAD_PER_DEG)\n\n y = Math.sin(dlon) * cola2\n x = cola1 * sila2 - sila1 * cola2 * Math.cos(dlon)\n angle = Math.atan2(y,x)/RAD_PER_DEG # angle in degrees\n end", "def angle_of_specified_radius\n @angle_of_radius\n end", "def atan(x)\n atan_base(num_class[x])\n end", "def atan\n Double.new(Math.atan(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end", "def degrees\n self * Math::PI / 180.0\n end", "def calc_angle(x1, y1, x2, y2)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n if (x1 == x2)\r\n if (y2 >= y1)\r\n return 0\r\n else\r\n return 180\r\n end #else\r\n elsif (y1 == y2)\r\n if (x2 >= x1)\r\n return 90\r\n else\r\n return 270\r\n end #else\r\n else\r\n x1 = x1 + 0.0 # force to be floating point\r\n x2 = x2 + 0.0 # force to floating point\r\n slope = (y2-y1) / (x2-x1)\r\n radians = Math.atan(slope)\r\n degrees = conv_radian_to_degree(radians)\r\n # Handle Adjusting Quadrent\r\n if ((x2 > x1) && (y2 > y1))\r\n # Quadrent 1;\r\n degrees = degrees\r\n elsif ((x2 > x1) && (y2 < y1))\r\n # Quadrent 2\r\n degrees = 90 - degrees;\r\n elsif ((x2 < x1) && (y2 < y1))\r\n # Quadrent 3\r\n degrees = 270 - degrees\r\n else\r\n # must be Quadrent 4\r\n degrees = 270 - degrees\r\n end # else\r\n end # else\r\n return degrees\r\nend", "def calculate_deg_angle_between(target)\n calculate_rad_angle_between(target).angle_rad_to_deg_clipped\n end", "def angle_equation_of_time() \r\n delta_orbit() + delta_oblique()\r\n end", "def angle_deg_with( vector )\n angle_with(vector) * RAD_TO_DEG\n end", "def angle_to(key)\n p1 = {\n x: (row_offset.to_f)+((width)/2),\n y: (row.number.to_f)-((height)/2)+(height)\n }\n\n p2 = {\n x: (key.row_offset.to_f)+((key.width)/2),\n y: (key.row.number.to_f)-((key.height)/2)+(key.height)\n }\n\n Math.atan2(p2[:x] - p1[:x], p2[:y] - p1[:y]) * 180 / Math::PI\n end", "def getBearing(p1, p2)\n dLon = rad(p2[0]-p1[0])\n lat2 = rad(p2[1])\n lat1 = rad(p1[1])\n y = Math.sin(dLon) * Math.cos(lat2)\n x = Math.cos(lat1)*Math.sin(lat2) -\n Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon)\n brng = Math.atan2(y, x)\n end", "def rotate(angle)\n primitive 'rotate ' + sprintf('%g', angle)\n end", "def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend", "def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end", "def normalize_bearing(angle)\n \t return ((angle + Math::PI) % (2 * Math::PI)) - Math::PI\n \tend", "def convert_to_radians(degrees)\n degrees * PI / 180\nend", "def atan2 _obj, _args\n \"_obj atan2 _args;\" \n end", "def bbpAngleSigned(first_point, second_point)\n\n first_point = bbpNormalize(first_point)\n second_point = bbpNormalize(second_point)\n\n angle = Math.atan2(first_point.x * second_point.y - first_point.y * second_point.x),\n bbpDot(first_point, second_point)\n\n angle = 0.0 if angle.abs < Float::EPSILON\n\n angle\n end", "def anglecw\n 360 - angle\n end", "def getAngleOf2Vector(vector2)\n angleRad = Math.acos( self.dotProduct( vector2 ) / ( @length * vector2.length ) )\n angle = radianToDegre( angleRad )\n \n return angle\n end", "def to_rad\n self * Math::PI / 180\n end", "def equirectangular_angle(lat1, lon1, lat2, lon2)\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n avlat_rad = (lat2 + lat1)/2 * RAD_PER_DEG\n\n x = dlon * Math.cos(avlat_rad)\n y = dlat\n angle = Math.atan2(x,y)/RAD_PER_DEG # angle in degrees\n end", "def <=>(other)\n @angle <=> if other.instance_of?(Angle)\n other.angle\n else\n other\n end\n end", "def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end", "def signed_angle_to(v, axis)\n dot_p = self.dot(v)\n dir = self.cross(v).dot(axis)\n\n unsigned = Math.acos(dot_p / norm / v.norm)\n if dir > 0\n return unsigned\n else\n return -unsigned\n end\n end", "def delta(to)\n diff = (to.to_f - self.to_f).abs % FULL_ANGLE\n diff = -(FULL_ANGLE - diff) if diff > Math::PI\n to.to_f < self.to_f ? -diff : diff\n end", "def reduce_angle(a)\n modtwopi(a)\n end", "def angle_delta_oblique() \r\n #al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()\r\n al_Sun() - ra_Sun() \r\n end", "def angle_xy(xa, ya, xb, yb)\n - Math.atan2(yb-ya, xb-xa)*57.29%360\n end", "def radian_angle\n @angle * Math::PI / 180.0\n end", "def getGeoAngle(c1,c2)\n x = c2[0] - c1[0]\n y = c2[1] - c1[1]\n y = y <= -180 ? y+360 : y\n y = y >= 180 ? y-360 : y\n\n ca = getCentralAngle(c1,c2)\n dist = EARTH_RADIUS_FEET * ca\n ca1 = getCentralAngle(c1,[c2[0],c1[1]])\n dist1 = EARTH_RADIUS_FEET * ca1 * sign(x)\n ca2 = getCentralAngle(c2,[c2[0],c1[1]])\n dist2 = EARTH_RADIUS_FEET * ca2 * sign(y)\n\n angle = Math.atan2(dist2,dist1)\n end", "def to_b\n return \"Math::atan(#{self.arg.to_b})\"\n end", "def deg2rad\n self * (Math::PI/180)\n end", "def test_Complex_InstanceMethods_angle\n\t\tassert_equal(0.0, Complex(1, 0).angle)\n\t\tassert_equal(0.7853981633974483, Complex(1,1).angle)\n\t\tassert_equal(1.5707963267948966, Complex(0,1).angle)\n\tend", "def rad2deg\n self * (180/Math::PI)\n end" ]
[ "0.7545739", "0.7384567", "0.7372221", "0.7313503", "0.7262168", "0.7184892", "0.71301836", "0.7107542", "0.70649385", "0.7044069", "0.6990309", "0.69445723", "0.6893734", "0.68116015", "0.6789178", "0.67859197", "0.6727259", "0.6716903", "0.6675718", "0.6672194", "0.6672194", "0.6647674", "0.66392857", "0.66145355", "0.6589648", "0.6572143", "0.65668476", "0.6535119", "0.653446", "0.64460975", "0.64269507", "0.6411731", "0.64097756", "0.6402781", "0.6400973", "0.6399897", "0.6398132", "0.6365974", "0.6363076", "0.6355958", "0.6292197", "0.62852174", "0.6254736", "0.6247814", "0.62260896", "0.62113136", "0.6209654", "0.6198474", "0.6189149", "0.61756456", "0.6165999", "0.6157002", "0.6153862", "0.6149502", "0.60824007", "0.60517085", "0.605051", "0.6027617", "0.6027001", "0.6019519", "0.6006328", "0.5993263", "0.5976695", "0.5975771", "0.5973843", "0.5971815", "0.59625924", "0.59349316", "0.5914011", "0.59026086", "0.5871204", "0.5866901", "0.5865513", "0.5831823", "0.5820578", "0.5811721", "0.58012736", "0.57986194", "0.5790376", "0.57801133", "0.57743067", "0.57070804", "0.57020247", "0.56955993", "0.56901515", "0.56886566", "0.5668537", "0.5666028", "0.56648666", "0.56648666", "0.56593513", "0.56592256", "0.5637183", "0.5636785", "0.5636069", "0.56265295", "0.560279", "0.56009614", "0.5594998", "0.55755055" ]
0.7746496
0
Returns true if a primitive is within a circle specified by the circle's center and radius.
def point_inside_circle? circle_center_point, radius Geometry.point_inside_circle? self, circle_center_point, radius end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inside_circle?(point, radius)\n (self.distance_to(point) <= radius)\n end", "def within_radius_of?(center, radius)\n return false unless center\n (self.point == center.point) || (center.distance_to(self) <= radius)\n end", "def intersects_with?(o_circle)\n pts_distance(@center, o_circle.center) < @radius + o_circle.radius\n end", "def isInside(_pos)\n _pos = Geo2D::Point::sureGeoObj(_pos) ;\n distance = centerPos().distanceTo(_pos) ;\n return distance < @radius ;\n end", "def include?(point)\n Math.sqrt((point.x - @middle.x)**2 + (point.y - @middle.y)**2) <= @radius\n end", "def circle?()\n return (@height == @width) & (@type == \"ellipse\")\n end", "def include?(point)\r\n (point - @pos).abs <= @radius\r\n end", "def in_sphere?(coords, radius)\n coords.reduce(0) { |s, c| s + c*c } <= radius**2\nend", "def point_in_circle(p, c)\n difference_v = T_VECTORS.pop.set(p) - c.position\n radius_sq = c.r * c.r\n distance_sq = difference_v.lengthsq\n T_VECTORS.push(difference_v)\n # If the distance between is smaller than the radius then the point is inside the circle.\n distance_sq <= radius_sq\n end", "def intersection_chk (x1, y1, x2, y2, center_x, center_y, radius)\n\n\t#check if the circle is in the bounding box rounded by sw_x, sw_y, ne_x, ne_y (southwest point and northeast point)\n\tif x1 < x2\n\t\tsw_x = x1\n\t\tne_x = x2\n\telse\n\t\tsw_x = x2\n\t\tne_x = x1\n\tend\n\n\tif y1 < y2\n\t\tsw_y = y1\n\t\tne_y = y2\n\telse\n\t\tsw_y = y2\n\t\tne_y = y1\n\tend\n\tsw_x = sw_x - radius\n\tsw_y = sw_y - radius\n\tne_x = ne_x + radius\n\tne_y = ne_y + radius\n\n\tif center_x > ne_x || center_x < sw_x || center_y > ne_y || center_y < sw_y\n\t\treturn -1\n\tend\n\n\t#offset the center to 0,0\n\tx1_ = x1 - center_x\n\ty1_ = y1 - center_y\n\tx2_ = x2 - center_x\n\ty2_ = y2 - center_y\n\n\t#check for intersection\n\tdx = x2_ - x1_\n\tdy = y2_ - y1_\n\tdr = Math.sqrt(dx*dx + dy*dy)\n\td = x1_*y2_ - x2_*y1_\n\tresult = radius*radius*dr*dr - (d*d)\n\tif result < 0\n\t\treturn -1\n\telse\n\t\treturn Math.sqrt(((center_x - x1)*(center_x - x1) + (center_y - y1)*(center_y - y1)).abs)\n\tend\nend", "def test_circle_circle(a, b, response)\n # Check if the distance between the centers of the two\n # circles is greater than their combined radius.\n difference_v = T_VECTORS.pop.set(b.position) - a.position\n total_radius = a.r + b.r\n total_radius_sq = total_radius * total_radius\n distance_sq = difference_v.lengthsq\n # If the distance is bigger than the combined radius, they don't intersect.\n if distance_sq > total_radius_sq\n T_VECTORS.push(difference_v)\n return false\n end\n # They intersect. If we're calculating a response, calculate the overlap.\n if response\n dist = Math.sqrt(distance_sq)\n response.a = a\n response.b = b\n response.overlap = total_radius - dist\n response.overlap_n = difference_v.normalize\n response.overlap_v = difference_v * response.overlap\n response.a_in_b = a.r <= b.r && dist <= b.r - a.r\n response.b_in_a = b.r <= a.r && dist <= a.r - b.r\n end\n T_VECTORS.push(difference_v)\n return true\n end", "def valid_radius?\n float?(radius) &&\n radius.to_f.positive? &&\n radius.to_f <= MAXIMUM_SEARCH_RADIUS_IN_KM\n end", "def test_obb_vs_circle(rect_a, cir_a)\n @coll_depth = Numeric::POSITIVE_INFINITY\n depths = []\n\n # first go through the axes of the rectangle\n 2.times do |i|\n box_axis = rect_a.axes[i]\n depth = test_intervals(rect_a.projection(box_axis), cir_a.projection(box_axis))\n return false if depth == 0\n\n if depth.abs < @coll_depth.abs\n @coll_normal = box_axis\n @coll_depth = depth\n end\n depths[i] = depth\n end\n\n # determine if the circle's center is in a vertex region\n r = cir_a.radius\n if depths[0].abs < r and depths[1].abs < r\n vertex = closest_vertex_on_obb(cir_a.samp, rect_a)\n\n # get the distance from the closest vertex on rect to circle center\n @coll_normal = vertex - cir_a.samp\n mag = @coll_normal.magnitude\n @coll_depth = r - mag\n\n if @coll_depth > 0\n # there is a collision in one of the vertex regions\n @coll_normal.div!(mag)\n else\n # rect_a is in vertex region, but is not colliding\n return false\n end\n end\n @cpa = rect_a\n @cpb = cir_a\n true\n end", "def incircle\n # Circle.new(self.incenter, self.inradius)\n end", "def in_range?(radius:, location:)\n (((location.latitude - @latitude) ** 2) + ((location.longitude - @longitude) ** 2)) < (radius ** 2)\n end", "def test_circle_vs_circle(cir_a, cir_b)\n depth_x = test_intervals(cir_a.interval_x, cir_b.interval_x)\n return false if depth_x == 0\n\n depth_y = test_intervals(cir_a.interval_y, cir_b.interval_y)\n return false if depth_y == 0\n\n @coll_normal = cir_a.samp - cir_b.samp\n mag = @coll_normal.magnitude\n @coll_depth = cir_a.radius + cir_b.radius - mag\n\n if @coll_depth > 0\n @coll_normal.div!(mag)\n @cpa = cir_a\n @cpb = cir_b\n true\n else\n false\n end\n end", "def in_radius?(lat, lng, distance = nil)\n return false unless ([lat,lng].all? && (radius.present? || distance.present?))\n distance_from([lat,lng], :km) <= ( distance ? distance : radius )\n end", "def isInside(_pos)\n return @shape.insidePoint?(_pos) ;\n end", "def near?(lat, long, mile_radius)\n # omitted\n end", "def collides?(object2); radius_collision?(object2); end", "def calc(radius, const, point)\n result = true\n prev_value = point\n\n (1..MAX_ITERATION).to_a.each do |i|\n break i if (prev_value = prev_value ** 2 + const).abs > radius\n true\n end\n end", "def in_center(point)\n\t\tif @center.nil?\n\t\t\tif\n\t\t\t\tif @width % 2 == 1\n\t\t\t\t\t(point.x == (@width - 1) / 2)\n\t\t\t\telse\n\t\t\t\t\t(Range.new(@width / 2 - 1, @width / 2) === point.x)\n\t\t\t\tend\n\n\t\t\t\tif\n\t\t\t\t\tif @height % 2 == 1\n\t\t\t\t\t\t(point.y == (@height - 1) / 2) \n\t\t\t\t\telse\n\t\t\t\t\t\t(Range.new(@height / 2 - 1, @height / 2) === point.y)\n\t\t\t\t\tend\n\n\t\t\t\t\t@center = point\n\t\t\t\t\ttrue\n\t\t\t\telse\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def contained?(other)\n center.distance(other.center) < (@r - other.r).abs\n end", "def intersection(shape, rect)\n # if both are rectangles return rectangle intersection result\n return rect_intersection(shape, rect) if shape.is_a?(Rect)\n # temporary variables\n x, y, r, d = shape.x, shape.y, shape.radius, shape.direction\n # iterate through all of rectangle's points\n [rect.x, rect.x+rect.width-1].each {|i| [rect.y, rect.y+rect.height-1].each {|j|\n # if within special circle radius\n if Math.hypot(x - i, y - j) < r ||\n Math.hypot(x - i - 1, y - j) < r ||\n Math.hypot(x - i, y - j - 1) < r ||\n Math.hypot(x - i - 1, y - j - 1) < r\n case d\n when 2 then return true if j - y >= 0 && i - x <= j - y && x - i - 1 <= j - y\n when 4 then return true if x - i - 1 >= 0 && j - y <= x - i - 1 && y - j - 1 <= x - i - 1\n when 6 then return true if i - x >= 0 && j - y <= i - x && y - j - 1 <= i - x\n when 8 then return true if y - j -1 >= 0 && i - x <= y - j - 1 && x - i - 1 <= y - j - 1\n else\n # full circle, intersection exists\n return true\n end\n end}}\n # initialize arrays\n rects, coos, rad = [], [], (r / SQRT_2).to_i\n # radius line end coordinates and rectangles depending on which circle part\n case d\n when 2\n coos.push([x - 1 - rad, y + rad])\n coos.push([2 * x - coos[0][0] - 1, coos[0][1]])\n rects.push(Rect.new(x - 1, y, 2, r))\n when 4\n coos.push([x - 1 - rad, y - 1 - rad])\n coos.push([coos[0][0], 2 * y - coos[0][1] - 1])\n rects.push(Rect.new(x - r, y - 1, r, 2))\n when 6\n coos.push([x+rad.to_i, y - 1 - rad])\n coos.push([coos[0][0], 2 * y - coos[0][1] - 1])\n rects.push(Rect.new(x, y - 1, r, 2))\n when 8\n coos.push([x - 1 - rad, y - 1 - rad])\n coos.push([2 * x - coos[0][0] - 1, coos[0][1]])\n rects.push(Rect.new(x - 1, y - r, 2, r))\n else\n rects.push(Rect.new(x - 1, y, 2, r), Rect.new(x - r - 1, y - 1, r, 2),\n Rect.new(x, y - 1, r, 2), Rect.new(x - 1, y - r - 1, 2, r))\n end\n # intersection exists if intersecting with any of the radius rectangles\n return true if rects.any? {|rec| rect_intersection(rect, rec)}\n # rectangle's border lines\n top_left = [rect.x, rect.y]\n bottom_right = [rect.x + rect.width - 1, rect.y + rect.height - 1]\n bottom_left = [rect.x, rect.y + rect.height - 1]\n top_right = [rect.x + rect.width - 1, rect.y]\n # iterate through rectangle's border lines\n [top_left, bottom_right].each {|i| [bottom_left, top_right].each {|j|\n # iterate through the characteristic lines\n coos.each {|c|\n # if borderline of rectangle intersects with diagonal radius line\n if line_intersection(i[0], i[1], j[0], j[1], c[0], c[1], x, y)\n # intersection exists\n return true\n end}}}\n # intersection does not exist\n return false\n end", "def area_of_circle(radius)\n Math::PI*(radius*radius)\nend", "def aabb_vs_circle(a, b)\n return unless a[AabbShape] && b[CircleShape]\n\n nx, ny = [b[Position].x - a[Position].x - a[CircleShape].x,\n b[Position].y - a[Position].y - a[CircleShape].y]\n\n cx, cy = [nx, ny]\n\n ex, ey = [(a[AabbShape].max_x - a[AabbShape].min_x) * 0.5,\n (a[AabbShape].max_y - a[AabbShape].min_y) * 0.5]\n\n cx, cy = [clamp(cx, -ex, ex),\n clamp(cy, -ey, ey)]\n\n inside = false\n\n if [nx, ny] == [cx, cy]\n inside = true\n\n if nx.abs < ny.abs\n cx = cx > 0 ? ex : -ex\n else\n cy = cy > 0 ? ey : -ey\n end\n end\n\n norm_x, norm_y = [nx - cx,\n ny - cy]\n\n d = norm_x ** 2 + norm_y ** 2\n r = b[CircleShape].r\n\n return if d > r ** 2 && !inside\n\n d = Math.sqrt(d)\n\n if inside\n [-norm_x, -norm_y, r + d]\n else\n [norm_x, norm_y, r - d]\n end\n end", "def circle_area(circle)\n circle.radius**2*Math::PI\nend", "def radius?\n if radius.nil?\n errors.add(:radius, \"can't be blank\")\n return false\n end\n return true\n end", "def calculate_circle_area(radius)\nend", "def calculate_circle_area(radius)\nend", "def inside_rect? outer, tolerance = 0.0\n Geometry.inside_rect? self, outer, tolerance\n end", "def contains?(point)\n point.inside?(self)\n end", "def in?(x, y)\n ((x-@x)**2) + ((y-@y)**2) <= (@r**2)\n end", "def point_inside?(point)\n Geom.point_in_polygon_2D(point, hexagon(position, RADIUS), true)\n end", "def circle_vs_circle(a, b)\n return unless a[CircleShape] && b[CircleShape]\n\n nx, ny = [b[Position].x + b[CircleShape].x - a[Position].x - a[CircleShape].x,\n b[Position].y + b[CircleShape].x - a[Position].y - a[CircleShape].y]\n\n r = a[CircleShape].r + b[CircleShape].r\n r2 = r * r\n\n return if nx * nx + ny * ny > r2\n\n d = Math.sqrt(nx * nx + ny * ny)\n\n if d != 0\n contact = Stomp::Math.vadd(Stomp::Math.to_v(a[Position]),\n Stomp::Math.vmul([nx, ny], a[CircleShape].r))\n [nx / d, ny / d, r - d, [contact]]\n else\n [1, 0, a[CircleShape].r, [Stomp::Math.to_v(a[Position])]]\n end\n end", "def calculate_circle_area(radius)\n area = PI * radius**2\n return area\nend", "def circleArea(r)\t\t\t# Function called circleArea with parameter r\n PI * r ** 2 \t\t\t# Compute the area of the circle with the given r radius\nend", "def atom_collide other\n\n # if an object is hidden they didn't collide.\n if !@node.isVisible or !other.node.isVisible or self == other\n return false\n end\n\n # determine its size\n otherSphere = other.getAsCircle\n thisSphere = getAsCircle\n dx = otherSphere.getTranslateX - thisSphere.getTranslateX\n dy = otherSphere.getTranslateY - thisSphere.getTranslateY\n distance = Math.sqrt dx*dx + dy*dy\n minDist = otherSphere.get_radius + thisSphere.get_radius + 3\n\n distance < minDist\n end", "def in?(*p)\n point = p.to_point\n point.in?(self.computed)\n end", "def inside?(x, y)\n x >= 0 && x < @width && y >= 0 && y < @height\n end", "def is_inside(shape)\n shape.surrounds(self)\n end", "def test_radius_in_arcs\n radius = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicular to the normal or Z axis\n center = Geom::Point3d.new 0,0,-30\n normal = Geom::Vector3d.new 0,0,1\n xaxis = Geom::Vector3d.new 1,0,0\n start_a = -Math::PI/2\n end_a = 4.0 * Math::PI # Large enough to make a circle\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_arc center, xaxis, normal, 5, start_a, end_a\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(5, radius,\n 'Failed in test_radius' )\n end", "def intersection?(ray)\n a = ray.d.dot(ray.d)\n b = 2.0 * ray.d.dot(ray.o.sub(@c))\n c = @c2 - 2.0 * @c.dot(ray.o) - @r2\n\n d2 = b**2 - 4 * a * c\n return false unless d2 > 0\n\n t0 = (-b - Math.sqrt(d2)) / (2 * a)\n t1 = (-b + Math.sqrt(d2)) / (2 * a)\n\n t0, t1 = t1, t0 if t0 > t1\n return false if t1 < ray.tmin || t0 > ray.tmax\n\n t_hit = t0\n if t_hit < ray.tmin\n t_hit = t1\n return false if t_hit > ray.tmax\n end\n\n true\n end", "def circle_area(radius)\n 3.14 * radius ** 2\nend", "def circleArea(r)\t# Declare a function named circleArea that takes a parameter r (the radius)\n PI * r ** 2 \t# Calculate the area of the circle using the given values\nend", "def outside?(p1, p2, p3, q)\n return true if q.equal?(p1) || q.equal?(p2) || q.equal?(p3)\n\n x, y, rsquared = MB::Geometry.circumcircle(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y)\n\n dx = q.x - x\n dy = q.y - y\n dsquared = dx * dx + dy * dy\n\n MB::M.sigfigs(dsquared, RADIUS_SIGFIGS) >= MB::M.sigfigs(rsquared, RADIUS_SIGFIGS)\n end", "def circle_vs_rigid(a, b)\n rigid_out_of_aabb(b)\n\n return unless a[CircleShape] && b[RigidShape]\n\n cx, cy = [a[Position].x + a[CircleShape].x - b[Position].x,\n a[Position].y + a[CircleShape].y - b[Position].y]\n\n radius = a[CircleShape].r\n radius2 = radius ** 2\n\n s, face, normal = shape_from(b).each_cons(2).map { |face|\n v, _ = face\n vx, vy = v\n nx, ny = get_normal(face, [0, 0])\n dx, dy = [cx - vx, cy - vy] \n s = Stomp::Math.dot_product([nx, ny], [dx, dy])\n [s, face, [nx, ny]]\n }.max\n\n return if s > radius\n\n v1, v2 = face\n\n if s < EPS\n nx, ny = normal\n nx, ny = [-nx, -ny]\n\n contacts = [[nx * a[CircleShape].r + a[CircleShape].x + a[Position].x,\n ny * a[CircleShape].r + a[CircleShape].y + a[Position].y]]\n\n penetration = radius\n\n return [nx, ny, penetration, contacts]\n end\n\n c = [cx, cy]\n dot1 = Stomp::Math.dot_product(Stomp::Math.vsub(c, v1),\n Stomp::Math.vsub(v2, v1))\n dot2 = Stomp::Math.dot_product(Stomp::Math.vsub(c, v2),\n Stomp::Math.vsub(v1, v2))\n penetration = radius - s\n\n if dot1 <= 0\n\n return if Stomp::Math.hypot2(c, v1) > radius2\n\n nx, ny = Stomp::Math.vsub(v1, c)\n\n contacts = [Stomp::Math.vadd(v1, Stomp::Math.to_v(b[Position]))]\n\n elsif dot2 <= 0\n\n return if Stomp::Math.hypot2(c, v2) > radius2\n\n nx, ny = Stomp::Math.vsub(v2, c)\n\n contacts = [Stomp::Math.vadd(v2, Stomp::Math.to_v(b[Position]))]\n\n else\n\n return if Stomp::Math.dot_product(Stomp::Math.vsub(c, v1), normal) > radius\n\n nx, ny = normal\n nx, ny = [-nx, -ny]\n\n # a.position + normal * a.radius\n contacts = [Stomp::Math.vadd(Stomp::Math.vadd(Stomp::Math.to_v(a[Position]),\n Stomp::Math.to_v(a[CircleShape])),\n Stomp::Math.vmul([nx, ny], radius))]\n \n end\n\n [nx, ny, penetration, contacts]\n end", "def dot_per_centimeter? = unit == 'dot-per-centimeter'", "def circleArea(r)\n PI * r ** 2 \nend", "def collision?(other)\n Gosu::distance(@x, @y, other.x, other.y) < @radius * @size + other.radius * other.size\n end", "def c_radius \n Math.sqrt((@x*@x)+(@y*@y))\n end", "def inradius\n @inradius ||= 2 * self.area / self.perimeter\n end", "def withinRadius(latitude,longitiude,radius)\n \n rad = 3963.1676\n lat1 = to_rad(latitude.to_f)\n lat2 = to_rad(self.latitude.to_f)\n lon1 = to_rad(longitiude.to_f)\n lon2 = to_rad(self.longitude.to_f)\n dLat = lat2-lat1 \n dLon = lon2-lon1\n \n a = Math::sin(dLat/2) * Math::sin(dLat/2) +\n Math::cos(lat1) * Math::cos(lat2) * \n Math::sin(dLon/2) * Math::sin(dLon/2);\n \n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1-a));\n \n distance = rad * c\n \n #logger.debug \"distance IS\"\n #logger.debug distance\n #logger.debug \"radius IS\"\n #logger.debug radius\n \n return distance\n end", "def check(x, y)\n calc(RADIUS, const, x + y * 1i)\n end", "def hit_top_wall?\n @y - radius <= 0 && !positive?(@velocity_y)\n end", "def collide_point?(point)\n distance = Math.hypot(point[0]-@rect.center[0],point[1]-@rect.center[1])\n distance < @rect.w/2\n end", "def intersects?(other)\n# (@x <= other.x_outer && other.x <= @x_outer) || (@y <= other.y_outer && other.y <= @y_outer) ||\n# (@z <= other.z_outer && other.z <= @z_outer)\n\n\n (other.x < (@x + @l)) && ((other.x + other.l) > @x) &&\n (other.y < (@y + @w)) && ((other.y + other.w) > @y) &&\n (other.z < (@z + @h)) && ((other.z + other.h) > @z)\n\n end", "def add_circle(center, normal, radius, numsegs = 24)\n end", "def near?(lat, long, mile_radius)\n raise ArgumentError unless mile_radius >= 0\n loc = Location.new(:latitude => lat,:longitude => long)\n R * haversine_distance(loc) <= mile_radius\n end", "def inside?(mouse_x, mouse_y)\n pos_x = @x * @width\n pos_y = @y * @height\n mouse_x >= pos_x && mouse_x <= pos_x + @width && \\\n mouse_y >= pos_y && mouse_y <= pos_y + @height\n end", "def test_is_polygon_with_circle\n m = Sketchup.active_model\n ents = m.entities\n\n # Create a circle\n center = [0, 0, 0]\n normal = [0, 0, 1]\n radius = 20\n ents.add_circle center, normal, radius\n\n # Check circle edges\n m.entities.each do |e|\n if e.is_a? Sketchup::Edge and e.curve.respond_to? 'is_polygon?'\n assert_equal(false, e.curve.is_polygon?,\n 'Curve of circle edge should not be polygon.')\n end\n end\n end", "def get_intersection(center = @root, nr_tests = 500)\n circles = []\n\n each do |node|\n next if node == center\n\n circles << Circle.get_bisector(center.p, node.p)\n\n # admissible = true\n # lc = []\n # circles.each do |c|\n # i = c.triple_inclusion(center.p, circ)\n # if i.zero?\n # lc << c\n # elsif i == 1\n # lc << c\n # admissible = false\n # # break\n # end\n # end\n # lc << circ if admissible\n # circles = lc\n end\n\n circles.uniq!\n admissibles = [false] * circles.length\n get_ud_pts(nr_tests).each do |pt|\n counter = 0\n index = -1\n circles.length.times do |i|\n if circles[i].separates(center.p, pt)\n counter += 1\n index = i\n end\n end\n admissibles[index] = true if counter == 1\n end\n\n center.border = []\n\n admissibles.length.times do |i|\n center.border << circles[i] if admissibles[i]\n end\n\n # center.border = circles\n center.angles = get_angles(center)\n end", "def contains_point?(pt)\n pt.x.between?(left, left + width - 1) &&\n pt.y.between?(top, top + height - 1)\n end", "def exists_sq?(hx, hy)\n x, y = *hex_to_sq(hx, hy)\n x_is_inside = x >= 0 && x < @radius * 2 + 1 # Refactor this into constant SQ_LENGTH\n y_is_inside = y >= 0 && y < @radius * 2 + 1\n x_is_inside && y_is_inside\n end", "def coincident?(other)\n center.distance(other.center) == 0 and @r == other.r\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 random_coordinate_inside_unit_circle\n\n # Note: could be optimized into a global scope to avoid reallocation\n random = Random.new\n\n x_coord = random.rand(1.0)\n y_coord = random.rand(1.0)\n\n # the hypotenuese of a right triangle with a vertex on 0,0 and the unit circle will be 1.0\n # 1.0 squared is... 1.0\n # we will avoid doing a squareroot here\n\n (y_coord*y_coord) + (x_coord*x_coord) <= 1.0\nend", "def inside?(*args)\n\t\tsignature_error = \"Specify a point(two floats, or one Point), line(two Point), or rectangle(one Rectangle).\"\n\t\t\n\t\traise \"Wrong arity. \" + signature_error unless args.length == 1 or args.length == 2\n\t\t\n\t\t\n\t\t\n\t\tcase args.length\n\t\t\twhen 1\n\t\t\t\tif klass.is_a? Point\n\t\t\t\t\tself.inside_p *args\n\t\t\t\telsif klass.is_a? Rectangle\n\t\t\t\t\tself.inside_r *args\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Will have exited by this point, unless there was an error.\n\t\t\t\traise \"One argument given. Expected Point or Rectangle, but recieved #{args[0].class.inspect} instead. \" + signature_error\n\t\t\twhen 2\n\t\t\t\tif args[0].class == args[1].class\n\t\t\t\t\tklass = args.first.class\n\t\t\t\t\tif klass.is_a? Point\n\t\t\t\t\t\t# a line, specified by two points\n\t\t\t\t\t\tself.inside_pp *args\n\t\t\t\t\telsif klass.is_a? Float\n\t\t\t\t\t\t# a point in space, specified by two floats\n\t\t\t\t\t\tself.inside_xy *args \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Will have exited by this point, unless there was an error.\n\t\t\t\traise \"Two arguments given. Expected both to be Point or both to be Float, but recieved #{[args[0].class, args[1].class].inspect} instead. \" + signature_error\n\t\tend\n\tend", "def contains_point?(x,y)\n contains_x = x.between?(left, right)\n contains_y = y.between?(bottom, top)\n return (contains_x && contains_y)\n end", "def inside_rect?(point1, point2)\n lats = [point1.lat, point2.lat].sort\n lons = [point1.lon, point2.lon].sort\n la = self.lat\n lo = self.lon\n\n (la >= lats[0] && la <= lats[1] && lo >= lons[0] && lo <= lons[1])\n end", "def test_contains_point_true\n\n bbox = Geom::BoundingBox.new\n bbox.add Geom::Point3d.new(0,0,0)\n bbox.add Geom::Point3d.new(10,10,10)\n\n point = Geom::Point3d.new(5,5,5)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: center' )\n\n point = Geom::Point3d.new(0,0,0)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: min' )\n\n point = Geom::Point3d.new(10,10,10)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: max' )\n end", "def sp_points_on_circle(center, normal, radius, numseg, rotAngle)\n # Get the x and y axes\n axes = Geom::Vector3d.new(normal).axes\n center = Geom::Point3d.new(center)\n xaxis = axes[0]\n yaxis = axes[1]\n xaxis.length = radius\n yaxis.length = radius\n rotAngle = 0.0 unless rotAngle.is_a?(Numeric)\n # Compute the points\n da = (Math::PI*2) / numseg\n pts = []\n for i in 0...numseg do\n angle = rotAngle + (i * da)\n cosa = Math.cos(angle)\n sina = Math.sin(angle)\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\n pts.push(center + vec)\n end\n # Close the circle\n pts.push(pts[0].clone)\n pts\n end", "def points_on_circle(center, normal, radius, numseg)\r\n # Get the x and y axes\r\n axes = Geom::Vector3d.new(normal).axes\r\n center = Geom::Point3d.new(center)\r\n xaxis = axes[0]\r\n yaxis = axes[1]\r\n \r\n xaxis.length = radius\r\n yaxis.length = radius\r\n\r\n # compute the points\r\n da = (Math::PI * 2) / numseg\r\n pts = []\r\n for i in 0...numseg do\r\n angle = i * da\r\n cosa = Math.cos(angle)\r\n sina = Math.sin(angle)\r\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\r\n pts.push(center + vec)\r\n end\r\n \r\n # close the circle\r\n pts.push(pts[0].clone)\r\n\r\n pts\r\nend", "def contain?(rect)\n nself = self#.normalize\n rect = Rect.new_from_object(rect)#.normalize!\n return (nself.left <= rect.left and rect.right <= nself.right and\n nself.top <= rect.top and rect.bottom <= nself.bottom)\n end", "def is_within(layer)\n if !layer.nil?\n layerStartsWithinXBoundaries = self.x > layer.x && (self.x + self.width) < (layer.x + layer.width)\n layerStartsWithinYBoundaries = self.y > layer.y && (self.y + self.height) < (layer.y + layer.height)\n\n return layerStartsWithinXBoundaries && layerStartsWithinYBoundaries\n end\n\n false\n end", "def test_circle_radius_after_creation_with_negative_radius\n radius = nil\n assert_nothing_raised do\n centerpoint = Geom::Point3d.new\n # Create a circle perpendicular to the normal or Z axis\n vector = Geom::Vector3d.new 0,0,1\n vector2 = vector.normalize!\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_circle centerpoint, vector2, -10\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(10, radius,\n 'Failed in test_radius' )\n end", "def contains?(*args)\n x, y = *Vector2.extract(args.singularize)\n x.between?(self.x, self.x2 - 1) && y.between?(self.y, self.y2 - 1)\n end", "def collide_rect?(rect)\n return true if collide_point?(rect.topleft)\n return true if collide_point?(rect.topright)\n return true if collide_point?(rect.bottomleft)\n collide_point?(rect.bottomright)\n end", "def surrounds(shape)\n shape.points.each do |point|\n return false unless point_is_inside(point)\n end\n return true\n end", "def nearby?(lat, lon)\n # assumes flat plane\n Math.sqrt((lat-@address.lat) ** 2 + (lon-@address.lon) ** 2)\n end", "def contains?(x,y)\n\t\tdx = Haversine.distance([@yc,@xc],[@yc,x]).to_km\n\t\tdy = Haversine.distance([@yc,@xc],[y,@xc]).to_km\n\t\t#puts dx\n\t\t#puts dy\n\t\treturn (dx < @w and dy < @h)\n\tend", "def intersects?(r2)\n if @p2.x <= r2.p1.x or r2.p2.x <= @p1.x \n return false\n elsif @p2.y >= r2.p1.y or r2.p2.y >= @p1.y\n end\n return true\n end", "def circumference_of_circle(radius)\n 2 * Pi * radius\nend", "def authen_method_radius?()\n return true if (@authen_method == TAC_PLUS_AUTHEN_METH_RADIUS)\n return false\n end", "def intersect?(r)\n @x < r.x + r.w && @x + @w > r.x && @y < r.y + r.h && @y + @h > r.y\n end", "def contain?(x, y)\n # assume a rectangular filled shape by default (works for several shapes like image, text, and focus)\n x.between?(self.absolute_x, self.absolute_x + calculated_width) && y.between?(self.absolute_y, self.absolute_y + calculated_height)\n end", "def contact?(obj)\n return false if @inverted\n obj.x + obj.w > @x && obj.x < @x + @w && obj.x.round(6) == get_x(obj).round(6) && obj.y.round(6) == get_y(obj).round(6)\n end", "def within?(x, y)\n (x >= 0) && (x < height) && (y >= 0) && (y < height)\n end", "def in_bounding_box?(point, box)\n if point.lon > box.west_lon and point.lon < box.east_lon and point.lat < box.north_lat and point.lat > box.south_lat\n return true\n else\n return false \n end\n end", "def contains_pos?(*args)\n px, py, pz = *Moon::Vector3.extract(args.singularize)\n px.between?(0, xsize) && py.between?(0, ysize) && pz.between?(0, zsize)\n end", "def contains? position\n # If POI is given instead of location, get location first\n position = position.location if PointOfInterest === position\n\n x = position[0]\n y = position[1]\n\n # Use the raycasting technique to determine if point is inside polygon\n # We are in 2D, which makes it easier.\n # We can also choose the direction of the ray, which makes it almost trivial\n # (Choose ray paralell to x-achis\n intersections = 0\n\n [vertices, vertices.first].flatten.each_cons(2) do |v1, v2|\n # Check if we are inside bounding recangle of 2 vertices\n v1x = v1[0]\n v1y = v1[1]\n v2x = v2[0]\n v2y = v2[1]\n if (v1y < y and y <= v2y) or (v1y >= y and y > v2y)\n # check if we are LEFT of or onthe line from v1 to v2 is at this x coordinate\n cp.polygon(*p.map_vertices.map{|v| v.to_a}.flatten)\n vx = v2x - v1x\n vy = v2y - v1y\n if (x <= v1x and x < v2x)\n intersections +=1\n elsif x >= v1x and x > v2x\n next\n else\n x_line = v1x + vx * (y - v1y) / vy\n if vy == 0 or vx == 0 or x < x_line\n intersections += 1\n end\n end\n end\n end\n return intersections.odd?\n end", "def hit?(x, y)\n @rect.collide_point?(x, y)\n end", "def in?(x, y)\n check_x = x.between?(@x, @x+@width)\n check_y = y.between?(@y, @y+@height)\n check_x && check_y\n end", "def intersect? rect\n rect.is_a?(Rectangle) && !(@x + @width < rect.x || rect.x + rect.width < @x || @y + @height < rect.y || rect.y + rect.height < @y)\n end", "def point_is_inside(point)\n result = false\n vertex1 = @points.length - 1\n for vertex2 in 0...@points.length\n if ((@points[vertex2].y > point.y) != (@points[vertex1].y >= point.y)) && (point.x <= (points[vertex1].x - points[vertex2].x) * (point.y - points[vertex2].y) / (points[vertex1].y - points[vertex2].y) + points[vertex2].x)\n result = !result\n end\n vertex1 = vertex2\n vertex2 += 1\n end\n return result\n end", "def collision? args\n #The minimum area enclosed by the center of the ball and the 2 corners of the block\n #If the area ever drops below this value, we know there is a collision\n min_area = ((@block_size * 3) * args.state.ball.radius) / 2\n\n #https://www.mathopenref.com/coordtrianglearea.html\n ax = @x1\n ay = @y1\n bx = @x2\n by = @y2\n cx = args.state.ball.center.x\n cy = args.state.ball.center.y\n\n current_area = (ax*(by-cy)+bx*(cy-ay)+cx*(ay-by))/2\n\n collision = false\n if @rotation >= 0\n if (current_area < min_area &&\n current_area > 0 &&\n args.state.ball.center.y > @y1 &&\n args.state.ball.center.x < @x2)\n\n collision = true\n end\n else\n if (current_area < min_area &&\n current_area > 0 &&\n args.state.ball.center.y > @y2 &&\n args.state.ball.center.x > @x1)\n\n collision = true\n end\n end\n\n return collision\n end", "def centered?(wall_width = @wall_width, width = @width, distance_from_left = @distance_from_left)\n if wall_width % 2 == 0\n return true if distance_from_left == (wall_width / 2) - (width.to_f / 2).floor or\n distance_from_left == (wall_width / 2) - (width.to_f / 2).ceil\n elsif width % 2 == 0\n return true if distance_from_left == (wall_width.to_f / 2).floor - (width / 2) or\n distance_from_left == (wall_width.to_f / 2).ceil - (width / 2)\n else\n return true if distance_from_left == (wall_width / 2) - (width / 2)\n end\n return false\n end", "def collide?(object)\n return false if object == self\n\n hitbox_a = case @direction\n when :down\n hitbox(0, rad_y)\n when :up\n hitbox(0, -rad_y)\n when :right\n hitbox(rad_x, 0)\n when :left\n hitbox(-rad_x, 0)\n end\n hitbox_b = object.hitbox\n\n # Return true if the hitboxes overlap\n (hitbox_a[0] & hitbox_b[0]).any? &&\n (hitbox_a[1] & hitbox_b[1]).any?\n end", "def point_on_base_circle(degrees)\n\t\traise 'Valentine#point_on_base_circle is not implemented. Please write this method.'\n\t\t# Hint: The following may be useful to you:\n\t\t# - Math::PI\n\t\t# - Math.cos(radians)\n\t\t# - Math.sin(radians)\n\tend", "def include?(pnt)\n pnt.lat >= south && pnt.lng >= west && pnt.lat < north && pnt.lng < east\n end" ]
[ "0.8415395", "0.82826495", "0.80688614", "0.73929596", "0.73202246", "0.7280403", "0.7115079", "0.7094616", "0.69570464", "0.6916512", "0.68164206", "0.6778389", "0.6661389", "0.66604054", "0.6582593", "0.65708387", "0.6515795", "0.643736", "0.636547", "0.635673", "0.63431525", "0.6283722", "0.62743956", "0.6219358", "0.6165564", "0.61548877", "0.6061601", "0.6059719", "0.60451", "0.60451", "0.6039171", "0.6026139", "0.59780914", "0.59678274", "0.5937622", "0.59341025", "0.5910614", "0.5906971", "0.5879992", "0.58399165", "0.5829773", "0.5814844", "0.57691836", "0.5762429", "0.57568586", "0.5748532", "0.57436275", "0.5698591", "0.56934", "0.5689569", "0.5682877", "0.56803256", "0.5680042", "0.5670997", "0.5670785", "0.5645857", "0.56423235", "0.563046", "0.5630362", "0.5622021", "0.56137973", "0.55836207", "0.556611", "0.55570334", "0.5545633", "0.55440855", "0.5533858", "0.55286545", "0.5523513", "0.5521838", "0.552092", "0.55129313", "0.5502502", "0.54929143", "0.54819506", "0.54762506", "0.5474543", "0.54684716", "0.54446906", "0.54404414", "0.54389614", "0.54316497", "0.5429209", "0.5396982", "0.5396769", "0.539673", "0.5385844", "0.53763497", "0.5373016", "0.53727025", "0.53717333", "0.5366726", "0.5359191", "0.5358982", "0.5356286", "0.5347176", "0.5347048", "0.53440374", "0.5342285", "0.5340348" ]
0.82744735
2
Returns a primitive that is anchored/repositioned based off its rectangle.
def anchor_rect anchor_x, anchor_y current_w = self.w current_h = self.h delta_x = -1 * (anchor_x * current_w) delta_y = -1 * (anchor_y * current_h) self.shift_rect(delta_x, delta_y) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectangle\n return @rectangle if @rectangle\n\n # Assume that the focal vector is Vector[0, 0, @focus.r]\n assumed = Vector[0, 0, @focus.r]\n @rectangle = [\n Vector[-@width/2, @height/2, @focus.r],\n Vector[ @width/2, @height/2, @focus.r],\n Vector[ @width/2, -@height/2, @focus.r],\n Vector[-@width/2, -@height/2, @focus.r]\n ]\n\n # Rotate assumed to @focus\n normal = assumed.cross_product(@focus)\n if normal.r < EPSILON # assumed and @focus lie on a same line\n normal = Vector[1, 0, 0] # The camera is not rolled\n end\n angle = assumed.angle(@focus)\n @rectangle = @rectangle.map { |v| v.rotate!(normal, angle) } if normal.r > EPSILON && angle > EPSILON\n\n # Translate\n @rectangle = @rectangle.map { |v| v + @position }\n\n @rectangle\n end", "def computed\n Rect.new(true_x, true_y, true_width, true_height)\n end", "def compute_self\n rect.set(self.x, self.y, self.width, self.height)\n rect.compute_self\n self.true_ox = rect.true_x - rect.abs_x + self.ox\n self.true_oy = rect.true_y - rect.abs_y + self.oy\n compute_z\n end", "def rect=(rectangle); end", "def rect; end", "def rect; end", "def roundrectangle(center_x, center_y, width, height, corner_width, corner_height)\n primitive 'roundrectangle ' + sprintf(\n '%g,%g,%g,%g,%g,%g',\n center_x, center_y, width, height, corner_width, corner_height\n )\n end", "def to_rect()\n Vector.elements([self[0]*Math.cos(self[1])*Math.cos(self[2]),\n\t\t self[0]*Math.sin(self[1])*Math.cos(self[2]),\n\t\t self[0]*Math.sin(self[2])])\n end", "def self_gate_position\n Vct.new(@width /2, 0)\n end\n #\n # rival's gate position\n #\n def rival_gate_position\n Vct.new(@width /2, height)\n end", "def rect\n Image.run_cmplx(self) { |x| x.complex :rect }\n end", "def x\n rect.x\n end", "def x1\n {left: 0, right: Pong::WIDTH - WIDTH}[side]\n end", "def textRectangle\n orect = getRect();\n orect.width -= 25;\n return rect;\n end", "def expand!(expansion)\n case expansion\n when Rectangle\n self.x -= expansion.width\n self.y -= expansion.height\n self.width += 2*expansion.width\n self.height += 2*expansion.height\n when Fixnum, Float\n self.x -= expansion\n self.y -= expansion\n self.width += 2*expansion\n self.height += 2*expansion\n else raise \"Can't expand, without a valid Rectangle or constant Fixnum!\"\n end\n self # Return self expanded rectangle\n end", "def &(other)\n ox, oy, ow, oh = *other\n nx = [x, ox].max\n ny = [y, oy].max\n Rect.new nx, ny, [x2, ox + ow].min - nx, [y2, oy + oh].min - ny\n end", "def box\n w = box_width / 2 - 1\n h = box_height / 2 - 1\n tw = 8 # track width\n fd = 8 # front depth\n rd = 6 # rear depth\n Utils.rotate(object.direction, x, y,\n x + w, y + h, #1\n x + w - tw, y + h, #2\n x + w - tw, y + h - fd, #3\n\n x - w + tw, y + h - fd, #4\n x - w + tw, y + h, #5\n x - w, y + h, #6\n\n x - w, y - h, #7\n x - w + tw, y - h, #8\n x - w + tw, y - h + rd, #9\n\n x + w - tw, y - h + rd, #10\n x + w - tw, y - h, #11\n x + w, y - h, #12\n )\n end", "def to_rect\n CGRectMake(*self[0,4])\n end", "def expand(other_rect)\n raise \"Can't expand, without a valid Rectangle!\" unless other_rect.is_a?(Rectangle)\n Rectangle.new(@x - other_rect.width, @y - other_rect.height, @width + 2*other_rect.width, @height + 2*other_rect.height)\n end", "def ref(x, y, _width, _height)\n translate(x, y) if x != 0 || y != 0\n end", "def bounding_box \r\n if @cached_bounding_box\r\n @cached_bounding_box.x = self.x + @_x_diff\r\n @cached_bounding_box.y = self.y + @_y_diff\r\n \r\n return @cached_bounding_box\r\n end\r\n \r\n width, height = self.size\r\n \r\n if scale = trait_options[:bounding_box][:scale]\r\n width_scale, height_scale = scale.is_a?(Array) ? [scale[0],scale[1]] : [scale,scale]\r\n width *= width_scale\r\n height *= height_scale\r\n end\r\n \r\n x = self.x - width * self.center_x\r\n y = self.y - height * self.center_y\r\n x += width * CENTER_TO_FACTOR[self.center_x] if self.factor_x < 0\r\n y += height * CENTER_TO_FACTOR[self.center_y] if self.factor_y < 0\r\n\r\n return Rect.new(x, y, width, height)\r\n end", "def rectangular\n [re, im]\n end", "def right\n Point.new(@x + 1, @y)\n end", "def right\n Point.new(@x + 1, @y)\n end", "def create_within radius\n Geo::Radius::Rectangular.create_from self\n end", "def union!(rect)\n self.normalize!\n rleft, rtop = self.topleft\n rright, rbottom = self.bottomright\n r2 = Rect.new_from_object(rect).normalize!\n\n rleft = [rleft, r2.left].min\n rtop = [rtop, r2.top].min\n rright = [rright, r2.right].max\n rbottom = [rbottom, r2.bottom].max\n\n self[0,4] = rleft, rtop, rright - rleft, rbottom - rtop\n return self\n end", "def get_bounding_rectangle\n leftmost_x = @panel.get_width\n rightmost_x = 0\n top_y = @panel.get_height\n bottom_y = 0\n\n @entities.each do |e|\n e_x = e.get_x\n e_y = e.get_y\n\n if e_x < leftmost_x\n leftmost_x = e_x\n end\n\n if e_x + ENTITY_WIDTH > rightmost_x\n rightmost_x = e_x + ENTITY_WIDTH\n end\n\n if e_y < top_y\n top_y = e_y\n end\n\n if e_y + ENTITY_HEIGHT > bottom_y\n bottom_y = e_y + ENTITY_HEIGHT\n end\n\n #if leftmost_x - 17 > 0\n # leftmost_x = leftmost_x -17\n #else\n # leftmost_x = 0\n #end\n\n #if rightmost_x + 17 < @panel.get_width\n # rightmost_x = rightmost_x +17\n #else\n # rightmost_x = @panel.get_width\n #end\n\n #if top_y - 17 > 0\n # top_y = top_y -17\n #else\n # top_y = 0\n #end\n\n #if bottom_y + 17 < @panel.get_height\n # bottom_y = bottom_y + 17\n #else\n # bottom_y = @panel.get_height\n #end\n\n end\n return Rectangle.new leftmost_x, top_y, rightmost_x - leftmost_x, bottom_y - top_y\n end", "def orient_if_sure(px, py, rx, ry, qx, qy)\n l = (ry - py) * (qx - px)\n r = (rx - px) * (qy - py)\n ((l - r).abs >= (3.3306690738754716e-16 * (l + r).abs)) ? l - r : 0\n end", "def area_of_rectangle(width, length)\n width*length\nend", "def abs() self.class.new(self.width.abs, self.height.abs) end", "def area_of_rect(l, w)\n return l * w\nend", "def rect(*args)\n Rect.new(self, *args)\n end", "def area; rect size; end", "def from row, col\n rect(col, row)\n end", "def collision_rect\r\r\n collision = CXJ::FREE_MOVEMENT::DEFAULT_COLLISION\r\r\n return Rect.new(collision[0], collision[1], collision[2] - 1, collision[3] - 1)\r\r\n end", "def rect\n get.rect\n end", "def to_s\n \"Rectangle corners #{c1} and #{c2}\"\n end", "def y\n rect.y\n end", "def Rect(x, y, w, h, style='')\n\t\t#Draw a rectangle\n\t\tif (style=='F')\n\t\t\top='f';\n\t\telsif (style=='FD' or style=='DF')\n\t\t\top='B';\n\t\telse\n\t\t\top='S';\n\t\tend\n\t\tout(sprintf('%.2f %.2f %.2f %.2f re %s', x * @k, (@h - y) * @k, w * @k, -h * @k, op));\n\tend", "def contract_with(m, r)\n m = m.to_s\n x = r.x + self[\"#{m}_left\"]\n y = r.y + self[\"#{m}_top\" ]\n w = r.width - self[\"#{m}_left\"] - self[\"#{m}_right\" ]\n h = r.height - self[\"#{m}_top\" ] - self[\"#{m}_bottom\"]\n r.set x, y, w, h\n end", "def rectangleArea(h, w)\r\n h * w\r\nend", "def clone\n return Rect.new(self.x, self.y, self.width, self.height)\n end", "def rect()\n Rect.new(p1, p2)\n .stroke(stroke)\n .fill(fill)\n .fill_phase(fill_phase)\n .line_width(line_width)\n .line_dash(line_dash)\n end", "def rect()\n Rect.new(p1, p2)\n .stroke(stroke)\n .fill(fill)\n .fill_phase(fill_phase)\n .line_width(line_width)\n .line_dash(line_dash)\n end", "def place_private piece, orientation, c\n return nil unless fits?(piece, orientation, c)\n case orientation\n when :vertical_up\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face][c.row + 1][c.left] = piece.id if piece.size > 1\n @a[c.face][c.row + 2][c.left] = piece.id if piece.size == 3\n\n string_end = C.new(c.face, c.row + piece.size - 1, c.left)\n\n when :vertical_down\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face][c.row - 1][c.left] = piece.id if piece.size > 1\n @a[c.face][c.row - 2][c.left] = piece.id if piece.size == 3\n\n string_end = C.new(c.face, c.row - piece.size + 1, c.left)\n\n when :sideways_right\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face][c.row][c.left + 1] = piece.id if piece.size > 1\n @a[c.face][c.row][c.left + 2] = piece.id if piece.size == 3\n\n string_end = C.new(c.face, c.row, c.left + piece.size - 1)\n\n when :sideways_left\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face][c.row][c.left - 1] = piece.id if piece.size > 1\n @a[c.face][c.row][c.left - 2] = piece.id if piece.size == 3\n\n string_end = C.new(c.face, c.row, c.left - piece.size + 1)\n\n when :long_far\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face + 1][c.row][c.left] = piece.id if piece.size > 1\n @a[c.face + 2][c.row][c.left] = piece.id if piece.size == 3\n\n string_end = C.new(c.face + piece.size - 1, c.row, c.left)\n\n when :long_near\n @a[c.face][c.row][c.left] = piece.id\n @a[c.face - 1][c.row][c.left] = piece.id if piece.size > 1\n @a[c.face - 2][c.row][c.left] = piece.id if piece.size == 3\n\n string_end = C.new(c.face - piece.size + 1, c.row, c.left)\n end\n\n return true, string_end\n end", "def translate(*args)\n r = Rect.new x, y, w, h\n r.position += Vector2[args.singularize]\n r\n end", "def magick_crop_rect\n [x1, y1, x2-x1, y2-y1]\n end", "def inspect; \"#<Rect:#{self.object_id} [%s,%s,%s,%s]>\"%self; end", "def rectangle(length:, width:)\n # now does squares!!!!\n (length.to_f * width.to_f).round(2)\n end", "def render_rectangle(rectangle)\n raise NotImplementedError\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 rectangle_area(width, height)\n area = width * height\nend", "def bounding_box\n Cuboid.new @vbuffer.buffer.min(1).to_a, @vbuffer.buffer.max(1).to_a\n end", "def update\n @box.top += 2\n @box.left -= 2\n @box.bottom += 2\n @box.right -= 2\n end", "def identity\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = 0\r\n new_point.y = 0\r\n new_point.x = @x / @x.abs if @x != 0\r\n new_point.y = @y / @y.abs if @y != 0\r\n return new_point\r\n end", "def to_collision\n #Primitives::Circle.new(@position, @radius)\n @collision_primitive\n end", "def pos\n return Rubygame::Ftor.new(@x,@y)\n end", "def get_rect_for_client i\n max_width=screen[:width_in_pixels]\n max_height=screen[:height_in_pixels]\n \n cx = max_width * 0.5\n cy = max_height * 0.5\n \n pad_x = 20\n pad_y = 40\n \n yr = 0.5 * (max_height - pad_y - inactive_client_height)\n xr = 0.5 * (max_width - pad_x - inactive_client_width)\n \n position = (get_placement_angle() * i)\n if position >= 360\n i = (position - 360 - get_placement_angle) / get_placement_angle()\n position = (get_placement_angle() + 8) * i\n if position >= 360-8\n i = (position - 360 - 8 - get_placement_angle) / get_placement_angle() \n position = (get_placement_angle() + 16) * i\n end\n end\n \n a = position * (Math::PI / 180.0)\n \n x = cx + xr * Math.cos(a)\n y = cy + yr * Math.sin(a)\n \n x,y = center_on(x,y,inactive_client_width,inactive_client_height)\n \n return x,y,inactive_client_width,inactive_client_height\n end", "def bound_in_rect(rect)\n result = rect\n if rect.x < 0\n result.width = rect.width - rect.x\n result.x = 0\n end\n if rect.y < 0\n result.height = result.height - rect.y\n result.y = 0\n end\n if rect.width > xsize\n result.width = xsize\n end\n if rect.height > ysize\n result.height = ysize\n end\n return result\n end", "def clamp!(rect)\n nself = self.normalize\n rect = Rect.new_from_object(rect)\n #If self is inside given, there is no need to move self\n unless rect.contain?(nself)\n\n #If self is too wide:\n if nself[2] >= rect[2]\n self[0] = rect.centerx - nself[2].div(2)\n #Else self is not too wide\n else\n #If self is to the left of arg\n if nself[0] < rect[0]\n self[0] = rect[0]\n #If self is to the right of arg\n elsif nself.right > rect.right\n self[0] = rect.right - nself[2]\n #Otherwise, leave x alone\n end\n end\n\n #If self is too tall:\n if nself[3] >= rect[3]\n self[1] = rect.centery - nself[3].div(2)\n #Else self is not too tall\n else\n #If self is above arg\n if nself[1] < rect[1]\n self[1] = rect[1]\n #If self below arg\n elsif nself.bottom > rect.bottom\n self[1] = rect.bottom - nself[3]\n #Otherwise, leave y alone\n end\n end\n end\n return self\n end", "def to_s; \"#<Rect [%s,%s,%s,%s]>\"%self; end", "def make_absolute(point)\n absolute_position + point * Core::Point.new(width, height)\n end", "def std() CGRectStandardize(self) end", "def to_square x, y, anchor_x = 0.5, anchor_y = nil\n GTK::Geometry.to_square(self, x, y, anchor_x, anchor_y)\n end", "def midright; return self.right, self.centery; end", "def collision_rect\r\r\n return @collisionbox\r\r\n end", "def setRectangular _obj, _args\n \"_obj setRectangular _args;\" \n end", "def norm_src_rect\n index = (@character.character_index || 0)\n pattern = @character.pattern < 3 ? @character.pattern : 1\n sx = (index % 4 * 3 + pattern) * @cw\n sy = (index / 4 * 4 + (get_direction - 2) / 2) * @ch\n self.src_rect.set(sx, sy, @cw, @ch)\n end", "def bottom\n self.ox = self.src_rect.width/2\n self.oy = self.src_rect.height\n end", "def update_placement\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end", "def interaction_rect\r\r\n collision = @interaction[@direction]\r\r\n if collision.nil?\r\r\n return collision_rect\r\r\n end\r\r\n return Rect.new(collision[0], collision[1], collision[2] - 1, collision[3] - 1)\r\r\n end", "def side(p_)\n px_ = p_.x\n py_ = p_.y\n (@sx - px_) * (@ey - py_) - (@sy - py_) * (@ex - px_)\n end", "def relative(xr, yr)\n Position.new(x + xr, y + yr)\n end", "def left\n Point.new(@x - 1, @y)\n end", "def left\n Point.new(@x - 1, @y)\n end", "def rect x, y\n [x * sprite_width, y * sprites_per_row, sprite_width, sprite_height]\n end", "def rotate_origo(angle_x = 0, angle_y = 0, angle_z = 0)\n\t\t@rect.each do |a|\n\t\t\ta.each do |b|\n\t\t\t\tx = b[0]; y = b[1]; z = b[2]\n\n\t\t\t\tx, y, z = rotate_point(x, y, z, 0, 0, 0, angle_x, angle_y, angle_z)\n\n\t\t\t\tb[0] = x; b[1] = y; b[2] = z\n\t\t\tend\n\t\tend\n\tend", "def rectangleArea(width, height)\n # return width * height\n width * height\n # set end of rectangleArea function\nend", "def rigid_vs_rigid(a, b)\n\n rigid_out_of_aabb(a)\n rigid_out_of_aabb(b)\n\n return unless a[RigidShape] && b[RigidShape]\n\n penetration_a, face_a = axis_least_penetration(Stomp::Math.to_v(a[Position]),\n shape_from(a),\n Stomp::Math.to_v(b[Position]),\n shape_from(b))\n\n penetration_b, face_b = axis_least_penetration(Stomp::Math.to_v(b[Position]),\n shape_from(b),\n Stomp::Math.to_v(a[Position]),\n shape_from(a))\n\n return if penetration_b >= 0 || penetration_a >= 0\n\n if bias_greater_than(penetration_a, penetration_b)\n\n ref_shape = a\n inc_shape = b\n ref_face = face_a\n flip = 1\n\n else\n\n ref_shape = b\n inc_shape = a\n ref_face = face_b\n flip = -1\n \n end\n\n inc_face = find_incident_face(ref_shape, inc_shape, ref_face)\n ref_face = Stomp::Math.fadd(ref_face, Stomp::Math.to_v(ref_shape[Position]))\n\n v1, v2 = ref_face\n\n side_plane_normal = normalize(Stomp::Math.vsub(v2, v1))\n\n ref_face_normal = orthogonalize(side_plane_normal)\n\n ref_c = Stomp::Math.dot_product(ref_face_normal, v1)\n neg_side = -Stomp::Math.dot_product(side_plane_normal, v1)\n pos_side = Stomp::Math.dot_product(side_plane_normal, v2)\n\n clips = [clip(Stomp::Math.vneg(side_plane_normal), neg_side, inc_face),\n clip(side_plane_normal, pos_side, inc_face)] \n\n return if clips.any? { |c| c.count < 2 }\n\n normal = Stomp::Math.vmul(ref_face_normal, flip)\n\n separation = Stomp::Math.dot_product(ref_face_normal, inc_face[0]) - ref_c\n contacts = []\n\n penetration = 0\n\n if separation <= 0\n contacts << inc_face[0]\n penetration -= separation\n end\n\n separation = Stomp::Math.dot_product(ref_face_normal, inc_face[1]) - ref_c\n\n if separation <= 0\n contacts << inc_face[1]\n penetration -= separation\n\n penetration /= 1.0 * contacts.count if contacts.count > 1\n end\n\n nx, ny = normal\n\n [nx, ny, penetration, contacts]\n end", "def command_rect(index = 0)\n r_width = contents_width / columns\n r_height = contents_height\n x = r_width * index\n y = 0\n Rect.new(x, y, r_width, r_height)\n end", "def rectangle(x, y, width, height, options={})\n cur_page.rectangle(x, y, width, height, options)\n end", "def rectangular _args\n \"rectangular _args;\" \n end", "def smallest_rect_for_points(points)\n # Create an initial rect which covers only one point\n initial_point = points.first\n rect = Rect.new(\n Point.new(initial_point.top, initial_point.left),\n Point.new(initial_point.top, initial_point.left),\n Point.new(initial_point.top, initial_point.left),\n Point.new(initial_point.top, initial_point.left)\n )\n \n # Expand it so it fills every point\n points.each do |point|\n # Check left\n if point.left < rect.top_left.left\n rect.top_left.left = point.left\n rect.bottom_left.left = point.left\n end\n\n # Check right\n if point.left > rect.top_right.left\n rect.top_right.left = point.left\n rect.bottom_right.left = point.left\n end\n\n # Check top\n if point.top < rect.top_left.top\n rect.top_left.top = point.top\n rect.top_right.top = point.top\n end\n\n # Check bottom\n if point.top > rect.bottom_left.top\n rect.bottom_left.top = point.top\n rect.bottom_right.top = point.top\n end\n end\n\n rect\nend", "def perp\n self.class.new( -@y, @x )\n end", "def box\r\n x = (@constrict.nil? || @width <= @constrict) ? 0 : ((@width-@constrict)/2.0).ceil\r\n y = (@constrict.nil? || @width <= @constrict) ? 0 : ((@height-@constrict)/2.0).ceil\r\n w = (@constrict.nil? || @width <= @constrict) ? @width : @constrict\r\n h = (@constrict.nil? || @width <= @constrict) ? @height : @constrict\r\n return x, y, w, h\r\n end", "def perp\n Vect2.new(-@y, @x)\n end", "def upper_left_box(i, j)\n x = (i / @box_height).floor * @box_height\n y = (j / @box_width).floor * @box_width\n\n return x, y\n end", "def bounding_box\n Rectangle[position, Point[@image.width, @image.height]]\n end", "def perimeter(length, width)\n p = (2 * (length + width))\n return p\nend", "def test_rotate_i\n instance = Pentomino::IPiece.new\n assert_equal(1, instance.width)\n assert_equal(5, instance.height)\n instance.rotate!\n assert_equal(5, instance.width)\n assert_equal(1, instance.height)\n end", "def translatef(*args)\n r = Rect.new x, y, w, h\n r.position += r.resolution * Vector2[args.singularize]\n r\n end", "def rect_to_rect_tech_demo\n x = 460\n\n outputs.labels << small_label(x, 17.5, \"Click inside the red box below.\") # label with instructions\n red_box = [460, 250, 355, 90, 170, 0, 0] # definition of the red box\n outputs.borders << red_box # output as a border (not filled in)\n\n # If the mouse is clicked inside the red box, two collision boxes are created.\n if inputs.mouse.click\n if inputs.mouse.click.point.inside_rect? red_box\n if !state.box_collision_one # if the collision_one box does not yet have a definition\n # Subtracts 25 from the x and y positions of the click point in order to make the click point the center of the box.\n # You can try deleting the subtraction to see how it impacts the box placement.\n state.box_collision_one = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 180, 0, 0, 180] # sets definition\n elsif !state.box_collision_two # if collision_two does not yet have a definition\n state.box_collision_two = [inputs.mouse.click.point.x - 25, inputs.mouse.click.point.y - 25, 50, 50, 0, 0, 180, 180] # sets definition\n else\n state.box_collision_one = nil # both boxes are empty\n state.box_collision_two = nil\n end\n end\n end\n\n # If collision boxes exist, they are output onto screen inside the red box as solids\n if state.box_collision_one\n outputs.solids << state.box_collision_one\n end\n\n if state.box_collision_two\n outputs.solids << state.box_collision_two\n end\n\n # Outputs whether or not the two collision boxes intersect.\n if state.box_collision_one && state.box_collision_two # if both collision_boxes are defined (and not nil or empty)\n if state.box_collision_one.intersect_rect? state.box_collision_two # if the two boxes intersect\n outputs.labels << small_label(x, 23.5, 'The boxes intersect.')\n else # otherwise, if the two boxes do not intersect\n outputs.labels << small_label(x, 23.5, 'The boxes do not intersect.')\n end\n else\n outputs.labels << small_label(x, 23.5, '--') # if the two boxes are not defined (are nil or empty), this label is output\n end\n end", "def fast_rect x, y, w, h, c\n screen.fill_rect x, self.h-y-h, w, h, color[c]\n end", "def initialize\n @x\n @y\n @facing\n @placed = false\n end", "def orientation \n @position - @prev_position\n end", "def resolve(resource, position:)\n case position\n when :subject\n return nil unless resource.literal?\n as_literal(Math.atan(resource.as_number.object))\n when :object\n return nil unless resource.literal? || resource.variable?\n resource\n end\n end", "def rect x, y, w, h, c, fill = false\n screen.draw_rect x, self.h-y-h, w, h, color[c], fill\n end", "def floor\n self.class.new(x.floor, y.floor)\n end", "def turn_right\n @shape.body.t += 300.0\n end", "def rotate\n g = Grid.new\n self.each do |point,v|\n g[Point.new(point.y,point.x)] = v\n end\n (0..g.height - 1).each do |y|\n ( 0..g.width/2.ceil - 1 ).each do |x|\n tmp = g[Point.new(x,y)]\n g[Point.new(x,y)] = g[Point.new(g.width - x - 1, y )]\n g[Point.new(g.width - x - 1,y)] = tmp\n end\n end\n g\n end", "def get_active_rect\n x = screen[:width_in_pixels] * 0.5\n y = screen[:height_in_pixels] * 0.5 \n \n x,y = center_on(x,y,active_client_width,active_client_height)\n \n return x,y,active_client_width,active_client_height\n end" ]
[ "0.630119", "0.61938596", "0.6166139", "0.6120037", "0.6005603", "0.6005603", "0.5917027", "0.58906484", "0.5822918", "0.57254636", "0.571822", "0.5618471", "0.5595407", "0.55736554", "0.5572011", "0.55672526", "0.5536303", "0.55064225", "0.5505891", "0.5492515", "0.5480817", "0.54238045", "0.54238045", "0.5402695", "0.5398815", "0.53907007", "0.536585", "0.53577924", "0.53486377", "0.53470963", "0.5339674", "0.53276134", "0.53218657", "0.53209996", "0.53199106", "0.5314362", "0.53091115", "0.5297861", "0.5281762", "0.5281274", "0.52735627", "0.52725774", "0.52725774", "0.5256954", "0.5248041", "0.5229031", "0.5205373", "0.5176675", "0.5159056", "0.51287186", "0.51202846", "0.51110786", "0.5103839", "0.50978744", "0.50965565", "0.50905836", "0.5084011", "0.50829965", "0.5079855", "0.5076136", "0.507192", "0.5070488", "0.50663096", "0.5060994", "0.505473", "0.50524354", "0.5046292", "0.50365365", "0.5027508", "0.50255877", "0.5019537", "0.5015673", "0.5011369", "0.5011369", "0.499466", "0.49845493", "0.49798837", "0.4978313", "0.4969369", "0.49640197", "0.49572736", "0.49558154", "0.49383113", "0.49352133", "0.49297783", "0.49271432", "0.4923791", "0.4922118", "0.49183008", "0.49041396", "0.49010912", "0.48984587", "0.48959363", "0.48900723", "0.48802567", "0.4869607", "0.48500803", "0.48465407", "0.48443264", "0.4842085" ]
0.5334764
31
=begin Returns true if the message should be printed in the given timestamp, otherwise returns false. If this method returns false, the message will not be printed. The timestamp is in seconds granularity. :type timestamp: Integer :type message: String :rtype: Boolean =end
def should_print_message(timestamp, message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_print_message(timestamp, message)\n if log[message].nil? || timestamp - log[message] >= 10\n log.store(message, timestamp)\n return true\n end\n \n return false\n end", "def should_print_message(timestamp, message)\n result = true\n if @messages.key?(message)\n result = timestamp - @messages[message] >= 10\n end\n @messages[message] = timestamp if result\n result\n end", "def should_print_message(timestamp, message)\n if @log_hash[message].nil?\n @log_hash[message] = timestamp\n true\n elsif (timestamp - @log_hash[message]) < 10\n false\n else\n @log_hash[message] = timestamp\n true\n end\n end", "def should_print_message(timestamp, message)\n if !@map.key?(message) || timestamp - @map[message] >= 10\n @map[message] = timestamp\n return true\n end\n false\n end", "def should_print_message(timestamp, message)\n @map[message] ||= []\n should_drop_msg = !@map[message].empty? && timestamp - @map[message].last < 10\n return false if should_drop_msg\n\n @map[message] << timestamp\n true\n end", "def display_message?\n if play? || seconds - @last_time_value < 6 && @last_time_value >= @level_num\n true\n else\n false\n end\n end", "def timestamp?\n type == \"TIMESTAMP\"\n end", "def write_message?(level_of_message); end", "def message?\n false\n end", "def write_message?(level_of_message)\n LOG_LEVELS.fetch(level) <= LOG_LEVELS.fetch(level_of_message)\n end", "def formatted_message(message)\n \"#{timestamp}#{message}\\n\".freeze if message\n end", "def timestamp_ok?(timestamp)\n return unless (Time.now - Time.at(timestamp.to_i)).abs / 1.second > 5.minute\n\n raise Unauthorized \"ERROR: you're not Slack!\"\n end", "def show_time?(reply)\n\t\t(Time.now - reply.created_at.localtime) > 300.0\n\tend", "def is_new?(message)\n result = false\n previous_messages = cache_get(message[:station_id])\n if(previous_messages)\n seen_message_before = previous_messages.any? { |m| message[:text] == m[:text] }\n\n if !seen_message_before\n if previous_messages.length > 7\n @logger.debug(\"New message - programme has changed for #{:station_id}\")\n @logger.debug(previous_messages)\n result = true \n else\n @logger.debug(\"Previous_messages.length < 7\")\n end\n end\n end\n result\n end", "def show_message_tail?\n if $game_system.message.show_tail and $game_system.message.floating and\n $game_system.message.resize and $game_system.message_frame == 0 and\n @float_id != nil\n return true\n end\n return false\n end", "def timestamping?\n !timeless\n end", "def notice_message?\n true if message[:notice]\n end", "def trace message, attention_type = nil\n validate_message_level()\n if (@message_level != MessageLevel::NO_MESSAGES && @message_level != MessageLevel::SOME_MESSAGES)\n log_info(\"## \" + message.to_s, attention_type )\n return true\n end\n return false\n end", "def able_to_send_freeform_text?\n last_inbound_message = messages.inbound.last\n return false unless last_inbound_message\n\n last_inbound_message.created_at + 24.hours >= Time.zone.now\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 msg_sent?\n true\n end", "def message(message, seconds = MAX_TIMEOUT)\n received = false\n Timeout.timeout(seconds) do\n while !received do\n output = TomQueue.test_logger.readline\n received = !!(output =~ /#{Regexp.escape(message)}/)\n end\n end\n true\nrescue Timeout::Error\n false\nend", "def puppet_checked_in_since?(timestamp)\n puppetdb.successful_report_after?(puppet_certname, timestamp, :verbose => true)\n rescue CommandException, StandardError, Timeout::Error\n logger.warn(\"Could not determine if Puppet Checked in since %s on %s: %s: %s\" % [timestamp, puppet_certname, $!.class, $!.to_s])\n false\n end", "def older_than?(time)\n time > timestamp\n end", "def message_rendered?\n @_message_rendered\n end", "def raw_message?\n !!self.raw_table\n end", "def update_message?\r\n # If showing message window\r\n if $game_temp.message_window_showing\r\n return true\r\n end\r\n return false\r\n end", "def include?(timestamp)\n return false if earlier?(timestamp) || later?(timestamp)\n\n recurrence = finite? ? self : fast_forward(timestamp)\n\n recurrence.events.lazy.each do |event|\n return true if event == timestamp\n return false if event > timestamp\n end || false\n end", "def has_timestamp?(version)\n _ver, build_info = version.split(\"+\")\n return false if build_info.nil?\n\n build_info.split(\".\").any? do |part|\n Time.strptime(part, Omnibus::BuildVersion::TIMESTAMP_FORMAT)\n true\n rescue ArgumentError\n false\n end\n end", "def cover?(timestamp)\n return false if start.nil? && finish.nil?\n return start < timestamp if finish.nil?\n return finish > timestamp if start.nil?\n\n return true if finish < timestamp\n return true if start > timestamp\n\n false\n end", "def timestamp?\n !!(self =~ /^Rel\\d\\d\\d\\d\\d\\d\\d\\d$/ ||\n self =~ /^\\w\\w\\w?_\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d$/)\n end", "def print_success_message\n puts \"You have that!\"\n true #why should this return true also? #see my comment on line 53, and look at how it's called on line 96.\n end", "def recent?\n Time.at(timestamp) >= 2.minutes.ago\n end", "def m_in(message)\n\t\tputs \"> #{Time.now} #{message}\"\n\tend", "def message_sent?\n message.state == 'sent'\n end", "def message_sent?\n message.state == 'sent'\n end", "def what_time_to_show?(message_time)\n\t\tnow = Time.now\n\t\tif (now - message_time.localtime) < (60 * 60 * 24)\n\t\t\t\"minutes\"\n\t\telsif (now - message_time.localtime) < (60 * 60 * 24 * 365)\n\t\t\t\"months\"\n\t\telse\n\t\t\t\"years\"\n\t\tend\n\tend", "def spam?(message)\n false\n end", "def passed_event?\n date_time < Time.now.utc\n end", "def has_milliseconds?\n self.format(\"%L\").to_i > 0\n end", "def get_message_formatted(message, timestamp)\r\n {\r\n data: message,\r\n timestamp: timestamp\r\n }\r\n end", "def valid?(message)\n true\n end", "def has_message?\n has_message\n # && messages.count > 0\n end", "def missing_msg\n return unless missing?\n\n 'Missing timestamp.'\n end", "def valid_timestamp?(timestamp)\n (timestamp.is_a?(Integer) ||\n (timestamp.is_a?(String) && timestamp.match(/^\\d+$/))) &&\n timestamp.to_i > 946_684_800 &&\n timestamp.to_i < (Time.now.to_i + 31_557_600)\n end", "def is_text_message?\n type == 'TextMessage'\n end", "def needs_update\n return true if @clock == 0\n return true if sign.phrase.size > sign.letters.size && @time%(60/sign.tempo) < Manager.period - 0.001\n\n false\n end", "def later?(timestamp)\n ends_at && timestamp > ends_at\n end", "def check_timestamps(block1, block2)\n timestamp_one_string = block1.timestamp_string.split('.')\n timestamp_two_string = block2.timestamp_string.split('.')\n\n timestamp_one_partition = timestamp_one_string.map(&:to_i)\n timestamp_two_partition = timestamp_two_string.map(&:to_i)\n\n if timestamp_two_partition[0] < timestamp_one_partition[0]\n puts \"Line #{block2.block_number}: Previous timestamp #{block1.timestamp_string}\n \t>= new timestamp #{block2.timestamp_string}\"\n return false\n end\n\n if timestamp_two_partition[0] == timestamp_one_partition[0]\n if timestamp_two_partition[1] <= timestamp_one_partition[1]\n puts \"Line #{block2.block_number}: Previous timestamp #{block1.timestamp_string}\n \t >= new timestamp #{block2.timestamp_string}\"\n return false\n end\n end\n true\n end", "def print(message)\n\t\ttime = Time.now\n\n\t\t@duration += (time - @lastMessageTime)\n\n\t\t@lastMessageTime = time\n\n\t\t@message = message\n\n\tend", "def isMyMessage(message)\r\n return message[:type] == :Sent\r\n end", "def check_timestamp(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end", "def time?(string)\n begin\n DateTime.strptime(string, @time_format)\n true\n rescue\n false\n end\n end", "def update_message?\r\n # If message window is showing\r\n return $game_temp.message_window_showing\r\n end", "def error_message?\n true if message[:error]\n end", "def time?\n false\n end", "def message?\n @command.eql? 'PRIVMSG'.freeze\n end", "def matches_message?(message)\n match_message(message).any?\n end", "def time_passed?(_event, time)\n Time.now > time\n end", "def earlier?(timestamp)\n starts_at && timestamp < starts_at\n end", "def has_status_timestamp?\n !overall_status_modified_at.nil?\n end", "def verify_timestamp(prev_block)\r\n unless prev_block.nil?\r\n prev_timestamp = prev_block.timestamp\r\n prev_seconds = prev_timestamp.split('.')[0].to_i\r\n\r\n curr_seconds = @timestamp.split('.')[0].to_i\r\n\r\n if prev_seconds == curr_seconds\r\n prev_nano = prev_timestamp.split('.')[1].to_i\r\n curr_nano = @timestamp.split('.')[1].to_i\r\n if prev_nano >= curr_nano\r\n raise \"Line #{total_block_number}: Prev timestamp #{prev_timestamp} >= new timestamp #{@timestamp}\"\r\n end\r\n elsif prev_seconds > curr_seconds\r\n raise \"Line #{total_block_number}: Prev timestamp #{prev_timestamp} >= new timestamp #{@timestamp}\"\r\n end\r\n true\r\n end\r\n end", "def text?\n @format == 0\n end", "def message_window_showing\n if Input.timed_permanent? and $scene.is_a?(Scene_Battle)\n return false\n else\n return @message_window_showing\n end\n end", "def up_to_date_for?(timestamp)\n keys.sort.last >= timestamp\n end", "def timed_permanent?\n if $game_temp.timed_msg and\n @timed_msg and not @timed_msg.disposed? and @timed_msg.permanent\n return true\n end\n return false\n end", "def check_timestamp!(timestamp)\n fail ArgumentError, 'Timestamp must be a Time' unless timestamp.is_a? Time\n end", "def start_with?(string)\n @message[:body].to_s.start_with?(string)\n end", "def received?\n !!self.received_at?\n end", "def time?\n !times.empty?\n end", "def pre_schedule_message(time, message)\n assert time.is_a? Fixnum\n assert time >= 0\n assert message.is_a? String\n end", "def has_created_at_timestamp?\n !!@created_at\n end", "def modified_since?(datetime_string)\n last_modified != datetime_string\n end", "def signature_ok?(timestamp)\n slack_signature = request.headers['X-Slack-Signature']\n signature = Slack::Utils.signature(\n SLACK_SIGNING_SECRET, timestamp, request.raw_post\n )\n\n return unless slack_signature != signature\n\n raise Unauthorized, \"ERROR: you're not Slack (wrong signature)\"\n end", "def receive_message\n true\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 is_something_running\n @timestamps.each_value do |timestamp|\n return true if timestamp.fetch('is_running') == true\n end\n false\n end", "def should_send?\n ten_minutes_ago = @set - 10*60\n (@ended and @ended >= ten_minutes_ago) or (@started and @started >= ten_minutes_ago)\n end", "def award_letter_sent?\n !award_letter_sent_at.blank?\n end", "def mesg message, attention_type = nil\n validate_message_level()\n if (@message_level != MessageLevel::NO_MESSAGES)\n log_info(\"# \" + message.to_s, attention_type )\n return true\n end\n return false\n end", "def time?(text)\n if datetime?(text)\n extract = Nickel.parse(text).occurrences[0].start_time\n extract.nil? ? false : true\n else\n false\n end\n\n rescue RuntimeError => e\n Failure.save_case(text, e)\n return false\n end", "def sent?\n !@sent_at.nil?\n end", "def signature_expired?(timestamp)\n\t\t\ttimestamp < ((Time.now.to_f - config[:signature_expiration])*1000).round if config[:signature_expiration]\n\t\tend", "def has_current_time?(time)\n\t\tsleep 1 # toujours lui laisser le temps\n\t\tct = VLC.current_time\n\t\tok = ct.between?(time - 2, time + 2)\n\t\tif not ok\n\t\t\tputs \"Le temps de VLC devrait être entre #{time-2} et #{time+2}, et c'est #{ct}\".rouge\n\t\tend\n\n\t\treturn ok\n\tend", "def expected_messages_received?\n count >= expected\n end", "def live_message(selected_user,previous_visit_record=Time.now)\n loaded_associated_memorization = self.memorizations.where(:memorable => true, :user_id => selected_user.id).first\n if self.comments and loaded_associated_memorization\n if self.comments.where('comments.updated_at > ?', loaded_associated_memorization.updated_at).present?\n return true\n elsif previous_visit_record < self.updated_at and loaded_associated_memorization.updated_at > previous_visit_record\n return true\n else\n return false\n end\n else\n return false\n end\n end", "def is_text_message?(message)\n !message.text.nil?\nend", "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 has_message mess, options = nil, inverse = false\n options ||= Hash.new\n ok = has_tag?(\"div#flash div.notice\", options.merge!(text: mess))\n # Message supplémentaire indiquant les messages\n # flash affichés dans la page\n mess_sup = ok ? \"\" : messages_flash_as_human(mess)\n\n message_strict = if options[:strict]\n \"message\"\n else\n \"message ressemblant à\"\n end\n\n unless options[:evaluate] === false\n SiteHtml::TestSuite::Case::new(\n tmethod,\n result: ok,\n positif: !inverse,\n on_success: \"La page affiche bien le #{message_strict} “#{mess}”.\",\n on_success_not: \"La page n'affiche pas de #{message_strict} “#{mess}” (OK).\",\n on_failure: \"La page devrait afficher un #{message_strict} “#{mess}” (#{mess_sup}).\",\n on_failure_not: \"La page ne devrait pas afficher un #{message_strict} “#{mess}”.\"\n ).evaluate\n else\n return ok\n end\n end", "def record_message(thread, timestamp)\n message = {\n :thread => thread,\n :timestamp => timestamp\n }\n @messages << message\n message\n end", "def valid_message?(message)\n !!catch_and_ignore(:invalid_message_format) { extract_encoded(message) }\n end", "def matches? string\n return true if !(@before || @after)\n\n t = Time.parse string[%r|<key>Creation Date</key>\\s+<date>(.*?)</date>|,1]\n\n return (\n !(@before && t >= @before) && # NOT (@before defined and event occurs after @before)\n !(@after && t <= @after)\n )\n end", "def timestamp?\n created_at || expires_at || @wsu_timestamp\n end", "def contains_time?(time)\n segments.each do |seg|\n return true if seg.contains_time?(time)\n end\n return false\n end", "def should_run?\n Time.zone.now - @info.last_sent - @config.delay_time >= @config.run_every\n end", "def ==(message_object)\n self.iscp_message == message_object.iscp_message ? true : false\n end", "def flash_is(message)\n within(\".notifications\") do\n expect(page).to have_text message\n end\n end", "def system_msg?\n posts.first.system_msg? rescue nil\n end", "def should_run?\n Time.zone.now - @info.last_sent - @config.delay_time >= @config.run_every\n end", "def diff?(msg, chat)\n @pgsql.exec('SELECT recent FROM telechat WHERE id = $1', [chat])[0]['recent'] != msg\n end" ]
[ "0.81502783", "0.81319153", "0.78711414", "0.76355124", "0.7587671", "0.62727463", "0.5919023", "0.58751553", "0.58407587", "0.5801317", "0.5774184", "0.57585645", "0.56052476", "0.5568675", "0.5551019", "0.5544103", "0.55289567", "0.55179673", "0.5476676", "0.5454002", "0.5433189", "0.542943", "0.53981054", "0.5366402", "0.53500813", "0.5340123", "0.53259945", "0.5316074", "0.5265746", "0.5261768", "0.5258631", "0.52219516", "0.52178895", "0.5208138", "0.5203788", "0.5203788", "0.5195979", "0.51476306", "0.5095761", "0.50917387", "0.5089204", "0.50751317", "0.50499326", "0.50472045", "0.50459784", "0.5033849", "0.50270206", "0.5021684", "0.50214624", "0.5018694", "0.5017308", "0.5014612", "0.49951023", "0.4988612", "0.49819154", "0.49755964", "0.49673602", "0.49581674", "0.49543634", "0.49501848", "0.49499905", "0.49401867", "0.49390748", "0.49360394", "0.49339914", "0.49282873", "0.49248895", "0.4908235", "0.49021822", "0.4899705", "0.4880103", "0.4878647", "0.48740602", "0.48712084", "0.4868317", "0.485148", "0.48450068", "0.4842301", "0.4831696", "0.48286662", "0.48259452", "0.48173085", "0.4815339", "0.48078948", "0.48011473", "0.47984296", "0.47983968", "0.47962913", "0.47884598", "0.47654533", "0.47650447", "0.4762404", "0.47488815", "0.47461036", "0.4744488", "0.47422034", "0.47338915", "0.47205076", "0.47197542", "0.47154847" ]
0.7944626
2
GET /party_approvals or /party_approvals.json
def index @party_approvals = PartyApproval.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approvals\n approvals_list = []\n if params[:count]\n if params[:skip]\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc').offset(params[:skip].to_i).take(params[:count].to_i)\n else\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc').take(params[:count].to_i)\n end\n else\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc')\n end\n\n # make sure we are only fetching bound approvals\n approvals_list = approvals_list.to_a.select { |approver| approver.approval.is_bound? }\n # return final approvals_list\n render status: 200, json: approvals_list.as_json(include: { approval_type: { }, approval: { methods: [:approval_status, :approval_link, :approval_source_requested_item, :approval_source, :approval_source_character_name, :approval_source_on_behalf_of], include: { approval_kind: { }, approval_approvers: { methods: [:character_name, :approver_response], include: { approval_type: { } } } } } })\n end", "def merge_request_approvals(project, merge_request)\n get(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals\")\n end", "def add_approver\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get approvers not already assigned to the contract\n @approvers = @client.unassigned_approvers_for_contract(@contract)\n\n end", "def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end", "def set_party_approval\n @party_approval = PartyApproval.find(params[:id])\n end", "def party_approval_params\n params.require(:party_approval).permit(:user, :party, :approval)\n end", "def update\n respond_to do |format|\n if @party_approval.update(party_approval_params)\n format.html { redirect_to @party_approval, notice: 'Party approval was successfully updated.' }\n format.json { render :show, status: :ok, location: @party_approval }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @party_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def project_merge_request_approval_rules(project)\n get(\"/projects/#{url_encode project}/approval_rules\")\n end", "def index\n @budget_approvers = BudgetApprover.all\n end", "def get_approval_rules()\n build_header_auth('/approval_rules', API_VERSION_1, 'GET')\n build_request()\n request = Net::HTTP::Get.new(@uri.request_uri)\n #puts \"Request headers\\n\"\n @header.each do |name, value|\n request[name] = value\n\n #puts name+\": \"+value\n end\n\n response = @http.request(request)\n # response.body = JSON.parse(response.body)\n return response\n\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def index\n @approvals = Approval.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @approvals }\n end\n end", "def budget_approver_params\n params.fetch(:budget_approver, {})\n end", "def show\n @party = Party.find(params[:id])\n \n getroles(@party.id)\n \n get_user_postal_code() \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @party }\n end\n end", "def index\n @politician_approvals = PoliticianApproval.all\n end", "def politician_approval_params\n params.require(:politician_approval).permit(:user, :party, :approval)\n end", "def index_approvals_with_http_info(dataset_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApprovalsApi.index_approvals ...'\n end\n # verify the required parameter 'dataset_id' is set\n if @api_client.config.client_side_validation && dataset_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dataset_id' when calling ApprovalsApi.index_approvals\"\n end\n # resource path\n local_var_path = '/api/v1/approvals'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'dataset_id'] = dataset_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Approval>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"ApprovalsApi.index_approvals\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApprovalsApi#index_approvals\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend", "def gov_proposals_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GovernanceApi.gov_proposals_get ...'\n end\n # resource path\n local_var_path = '/gov/proposals'\n\n # query parameters\n query_params = {}\n query_params[:'voter'] = opts[:'voter'] if !opts[:'voter'].nil?\n query_params[:'depositor'] = opts[:'depositor'] if !opts[:'depositor'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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<TextProposal>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GovernanceApi#gov_proposals_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @party = Party.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @party }\n end\n end", "def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n data || {}\n end", "def create\n @party_approval = PartyApproval.new(party_approval_params)\n\n respond_to do |format|\n if @party_approval.save\n format.html { redirect_to @party_approval, notice: 'Party approval was successfully created.' }\n format.json { render :show, status: :created, location: @party_approval }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @party_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @pokeparty = Pokeparty.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def get(*args)\n arguments(args, required: [:org_name])\n\n get_request(\"/orgs/#{arguments.org_name}\", arguments.params)\n end", "def get_require_administrator_approval_applications\n respond_to do |format|\n param = params[:payload]\n format.json {\n @project_applications = ProjectApplication.where(:student_approved => true, :professor_approved => true, :administrator_approved => nil)\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def index\n if params.has_key?(:code_id)\n logger.info(current_user)\n end\n @parties = Party.where(user_id: current_user)\n end", "def index\n unless (params[:party_id].nil? || params[:party_id] == 0) \n $party_id = params[:party_id]\n end\n @partyroles = Partyrole.find(:all, :conditions => [\"party_id = ?\", $party_id])\n @partyrole = Person.find(:first, :conditions => [\"party_id = ?\", $party_id])\n @person = Person.find(:first, :conditions => [\"party_id = ?\", $party_id], :select => \"party_id, current_last_name, current_first_name\")\n \n unless !( @partyroles.nil? || @partyroles.empty? )\n flash.now[:notice] = \"No party role has been assigned yet!\"\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @partyroles }\n end\n end", "def show\n @electronic_approval = ElectronicApproval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @electronic_approval }\n end\n end", "def index\n\n if current_user.profile.profile_rank == 'High'\n @approvals = Approval.where(approval_type: ['Noted', 'Approved']).order(:approval_type, :approved, policy_resolution_id: :desc).page(params[:page]).per(10)\n elsif current_user.profile.profile_rank == 'Medium'\n @approvals = Approval.where(approval_type: ['Reviewed', 'Noted']).order(:approval_type, :approved, policy_resolution_id: :desc).page(params[:page]).per(10)\n else\n @approvals = Approval.where(approval_type: 'Reviewed').order(:approval_type, :approved, policy_resolution_id: :desc).page(params[:page]).per(10)\n end\n \n end", "def by_any_approvals?\n includes_special_label?(IssuableFinder::Params::FILTER_ANY)\n end", "def approve_partner\n @partner = current_organization.partners.find(params[:id])\n\n # TODO: create a service that abstracts all of this from PartnersController, like PartnerDetailRetriever.call(id: params[:id])\n\n # TODO: move this code to new service,\n @diaper_partner = DiaperPartnerClient.get(id: params[:id])\n @diaper_partner = JSON.parse(@diaper_partner, symbolize_names: true) if @diaper_partner\n @agency = if @diaper_partner\n @diaper_partner[:agency]\n else\n autovivifying_hash\n end\n end", "def approvals_count\n return 0 if self.id.nil?\n return RequestSearch.approvals_for(self, show: 'pending', per_page: 1000).count\n end", "def index\n @loyalty_schemes = current_user.loyalty_schemes\n end", "def political_party_params\n params.fetch(:political_party, {})\n end", "def pending\n getProfile\n where = \"status = 'p' and (owner_id = ? OR patient_id = ?)\"\n if @user.is_therapist?\n where = \"status = 'p' and (owner_id = ? OR therapist_id = ?)\"\n end\n @appointments = Appointment.where(where, @user.id, @profile.id)\n respond_to do |format|\n format.html { render action: 'pending' }\n format.json { render :status => 200, :json => { action: 'pending', appointments: @appointments, user: @user, profile: @profile }}\n end\n end", "def create_approvals_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApprovalsApi.create_approvals ...'\n end\n # resource path\n local_var_path = '/api/v1/approvals'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_approvals_input'] || opts[:body])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Approval'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"ApprovalsApi.create_approvals\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApprovalsApi#create_approvals\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def index_approvable\n @asset_info_adjustments = AssetInfoAdjustment.accessible_by(current_ability, :approve).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html { render \"index\" }\n format.json { render json: @asset_info_adjustments }\n format.xml { render xml: @asset_info_adjustments }\n end\n end", "def approved_flights\n pireps.approved\n end", "def index\n @loyalty_schemes = current_user.loyalty_schemes\n end", "def index\n candidate = UspsInPersonProofing::Applicant.new(\n address: search_params['street_address'],\n city: search_params['city'], state: search_params['state'],\n zip_code: search_params['zip_code']\n )\n response = proofer.request_facilities(candidate)\n if response.length > 0\n analytics.idv_in_person_locations_searched(\n success: true,\n result_total: response.length,\n )\n else\n analytics.idv_in_person_locations_searched(\n success: false, errors: 'No USPS locations found',\n )\n end\n render json: response.to_json\n end", "def get_tenant_by_erp_id(args = {}) \n get(\"/tenants.json/erp-id/#{args[:erpId]}\", args)\nend", "def show\n @approval = Approval.find(params[:id])\n @recommendation = Recommendation.find(@approval.recommendation_id)\n @approvals = @recommendation.approvals.find(:all, :order => \"created_at ASC\")\n @rec_user = User.find(@recommendation.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def get_current_tenant \n get(\"/tenants.json/current\")\nend", "def show\n @partyroles = Partyrole.find(:all, :conditions => [\"party_id = ?\", $party_id])\n @partyrole = Person.find(:first, :conditions => [\"party_id = ?\", $party_id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @partyrole }\n end\n end", "def approval_params\n params.require(:approval).permit(:policy_resolution_id, :approval_type, :approver_id, :approved, :remarks)\n end", "def index\n if @party \n @buyer_leads_zip_codes = @party.buyer_leads_zip_codes\n else\n @buyer_leads_zip_codes = BuyerLeadsZipCode.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buyer_leads_zip_codes }\n end\n end", "def get_team_years_participated ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/years_participated\"\n end", "def index\n @resources = Resource.where(\"is_approved = true\")\n render json: @resources, status: 200\n end", "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "def show\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenancy_agreement }\n end\n end", "def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end", "def plans(params = {})\n scope 'default'\n get('plans/', params)\n end", "def set_budget_approver\n @budget_approver = BudgetApprover.find(params[:id])\n end", "def obligations\n self.class.get(url, { headers: @headers, query: @query })\n end", "def index\n @approval_processes = ApprovalProcess.find(:all, :conditions => {:client_id => session[:client_id]})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @approval_processes }\n end\n end", "def get_legacy_appeals(user:)\n with_monitoring_and_error_handling do\n path = 'legacy_appeals'\n headers = get_legacy_appeals_headers(user)\n response = perform :get, path, nil, headers\n raise_schema_error_unless_200_status response.status\n validate_against_schema(\n json: response.body,\n schema: HLR_GET_LEGACY_APPEALS_RESPONSE_SCHEMA,\n append_to_error_class: ' (HLR)'\n )\n response\n end\n end", "def update\n respond_to do |format|\n if @political_party.update(political_party_params)\n format.html { redirect_to @political_party, notice: 'Political party was successfully updated.' }\n format.json { render :show, status: :ok, location: @political_party }\n else\n format.html { render :edit }\n format.json { render json: @political_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def approval_params\r\n # params.fetch(:approval, {})\r\n params.require(:approval).permit(:approval_type, :date, :approval_no, :sub_type, :description, :standard, :reference, :effective_date, :expiry_date, :status, :notes, :approval_doc, product_ids: [])\r\n end", "def trip_purposes \n label = request_label(:purposes)\n \n @http_request_bundler.add(\n label, \n @url + \"/trip_purposes\", \n :get,\n head: headers,\n query: { provider_id: provider_id }\n ).response!(label)\n end", "def show\n p 'show?'\n @acceptances = []\n if(current_user)\n if(params[:id])\n @acceptance = Acceptance.find(params[:id])\n else\n @acceptances = Acceptance.where(\"user_id=? and (status=? or status = ?) and end_time> ?\", current_user.id, \"successfully paid\", \"payment pending\", Time.now())\n end\n end\n p \"acceptances are \"\n \n presenter = Api::V3::AcceptancesPresenter.new\n acceptances_json = @acceptances.map{|x| presenter.as_json(x)}\n p acceptances_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: acceptances_json }\n end\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def merge_request_level_rule(project, merge_request)\n get(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules\")\n end", "def security_advisories_year_year_get_with_http_info(year, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.security_advisories_year_year_get ...\"\n end\n # verify the required parameter 'year' is set\n if @api_client.config.client_side_validation && year.nil?\n fail ArgumentError, \"Missing the required parameter 'year' when calling DefaultApi.security_advisories_year_year_get\"\n end\n # resource path\n local_var_path = \"/security/advisories/year/{year}\".sub('{' + 'year' + '}', year.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 = ['psirt_openvuln_api_auth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#security_advisories_year_year_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def edit_merge_request_approvals(project, merge_request, options = {})\n post(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals\", body: options)\n end", "def draft_agreement_with_http_info(agreement_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgreementControllerApi.draft_agreement ...'\n end\n # verify the required parameter 'agreement_request' is set\n if @api_client.config.client_side_validation && agreement_request.nil?\n fail ArgumentError, \"Missing the required parameter 'agreement_request' when calling AgreementControllerApi.draft_agreement\"\n end\n if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 40\n fail ArgumentError, 'invalid value for \"opts[:\"idempotency_key\"]\" when calling AgreementControllerApi.draft_agreement, the character length must be smaller than or equal to 40.'\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9]*$/)\n if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern\n fail ArgumentError, \"invalid value for 'opts[:\\\"idempotency_key\\\"]' when calling AgreementControllerApi.draft_agreement, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v2/agreements'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?\n header_params[:'Vipps-System-Name'] = opts[:'vipps_system_name'] if !opts[:'vipps_system_name'].nil?\n header_params[:'Vipps-System-Version'] = opts[:'vipps_system_version'] if !opts[:'vipps_system_version'].nil?\n header_params[:'Vipps-System-Plugin-Name'] = opts[:'vipps_system_plugin_name'] if !opts[:'vipps_system_plugin_name'].nil?\n header_params[:'Vipps-System-Plugin-Version'] = opts[:'vipps_system_plugin_version'] if !opts[:'vipps_system_plugin_version'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(agreement_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AgreementReference'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth', 'ocpSubscriptionKey']\n\n new_options = opts.merge(\n :operation => :\"AgreementControllerApi.draft_agreement\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgreementControllerApi#draft_agreement\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @loyalty_scheme = current_user.loyalty_schemes.find(params[:id])\n end", "def investors_ownership_with_http_info(symbol, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.investors_ownership ...'\n end\n # verify the required parameter 'symbol' is set\n if @api_client.config.client_side_validation && symbol.nil?\n fail ArgumentError, \"Missing the required parameter 'symbol' when calling DefaultApi.investors_ownership\"\n end\n # resource path\n local_var_path = '/stock/investor-ownership'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'symbol'] = symbol\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InvestorsOwnership' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#investors_ownership\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @loyalty_scheme = current_user.loyalty_schemes.find(params[:id])\n end", "def index\n case params[:eligible_for]\n when 'collaboration'\n @collaborators = eligible_collaborators.limit(20)\n when 'ownership'\n @collaborators = eligible_owners.limit(20)\n else\n @collaborators = User.none\n end\n\n if params[:q]\n @collaborators = @collaborators.search(params[:q])\n end\n\n respond_to do |format|\n format.json\n end\n end", "def get_payouts_for_payor_v4_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentAuditServiceApi.get_payouts_for_payor_v4 ...'\n end\n allowable_values = [\"ACCEPTED\", \"REJECTED\", \"SUBMITTED\", \"QUOTED\", \"INSTRUCTED\", \"COMPLETED\", \"INCOMPLETE\", \"CONFIRMED\", \"WITHDRAWN\"]\n if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PaymentAuditServiceApi.get_payouts_for_payor_v4, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PaymentAuditServiceApi.get_payouts_for_payor_v4, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v4/paymentaudit/payouts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'payorId'] = opts[:'payor_id'] if !opts[:'payor_id'].nil?\n query_params[:'payoutMemo'] = opts[:'payout_memo'] if !opts[:'payout_memo'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'submittedDateFrom'] = opts[:'submitted_date_from'] if !opts[:'submitted_date_from'].nil?\n query_params[:'submittedDateTo'] = opts[:'submitted_date_to'] if !opts[:'submitted_date_to'].nil?\n query_params[:'fromPayorName'] = opts[:'from_payor_name'] if !opts[:'from_payor_name'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetPayoutsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :operation => :\"PaymentAuditServiceApi.get_payouts_for_payor_v4\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentAuditServiceApi#get_payouts_for_payor_v4\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def well_known\n render json: {\n authorization_endpoint: \"#{root_url}oauth/authorize\",\n token_endpoint: \"#{root_url}oauth/token\",\n introspection_endpoint: \"#{root_url}oauth/introspect\",\n revocation_endpoint: \"#{root_url}oauth/revoke\",\n scopes_supported: ['user/*.read', 'user/*.write', 'user/*.*'],\n capabilities: ['launch-standalone']\n }\n end", "def index\n #pseudo scope \n if params[:phone] \n @agencies = Agency.find_by_phone(params[:phone]);\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n else\n # Aqui estoy haciendo que el api responda en mas de 1 formato\n @agencies = Agency.all\n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end\n\n end \n end", "def get_json\n params = {}\n params['access_token'] = EXPA.client.get_updated_token\n uri = URI(url_current_person)\n uri.query = URI.encode_www_form(params)\n force_get_response(uri)\n end", "def index\n @political_parties = PoliticalParty.all\n end", "def get_client_summary_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/clients/summary/#{args[:tenantId]}\", args)\nend", "def get_notary_jurisdiction_seal_with_http_info(jurisdiction_id)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotaryApi.get_notary_jurisdiction_seal ...\"\n end\n # verify the required parameter 'jurisdiction_id' is set\n fail ArgumentError, \"Missing the required parameter 'jurisdiction_id' when calling NotaryApi.get_notary_jurisdiction_seal\" if jurisdiction_id.nil?\n # resource path\n local_var_path = \"/v2.1/current_user/notary/jurisdictions/{jurisdictionId}/seal\".sub('{format}','json').sub('{' + 'jurisdictionId' + '}', jurisdiction_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotaryApi#get_notary_jurisdiction_seal\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n permits = Permit.select('id, permit_type, applicant_name, start_date, end_date, address, application_data, city_name, ST_AsGeoJSON(geometry) AS geojson')\n .where(\"city_name = ? AND geometry IS NOT NULL AND address IS NOT NULL\", params[:city].upcase.gsub(/-/, \" \"))\n if permits\n respond_to do |format|\n format.json { render json: permits }\n end\n else\n respond_to do |format|\n format.json { render json: [], status: :bad_request }\n end\n end\n end", "def show\n if params[:id]\n @repo = Repo.find_by_id(params[:id])\n ident = \"with ID \" + params[:id].to_s\n end\n \n if (params[:owner] and params[:name])\n @repo = Repo.find_by_owner_and_name(params[:owner].strip, params[:name].strip)\n ident = params[:owner].strip + \"/\" + params[:name].strip\n end\n \n unless @repo.nil?\n @alternatives = @repo.find_related_labels\n end\n \n respond_to do |format|\n unless @repo.nil? \n # Repo and Alternatives found\n format.html # show.html.erb\n format.json { render json: @repo }\n else\n # Repo could not be found\n redirect_to repos_url, notice: \"Repo '#{ident}' could not be found.\"\n end\n end\n end", "def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end", "def gov_parameters_tallying_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GovernanceApi.gov_parameters_tallying_get ...'\n end\n # resource path\n local_var_path = '/gov/parameters/tallying'\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 = []\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GovernanceApi#gov_parameters_tallying_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def allowed_approvers\n return @allowed_approvers unless @allowed_approvers.nil?\n\n owners = owners_contents.flatten.uniq\n\n if self.author =~ /<(.+?)@amiestreet.com>/\n author_username = $1\n owners.reject! { |u| u == author_username }\n end\n @allowed_approvers = owners\n\n @allowed_approvers\n end", "def update\n respond_to do |format|\n if @budget_approver.update(budget_approver_params)\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_approver }\n else\n format.html { render :edit }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end", "def payers(params = {})\n scope 'default'\n get('payers/', params)\n end", "def index\n\t\t#should only grab pullRequests for current repository\n @pullRequests = PullRequest.where(to_repo_id: params[:repo_id]).where( status: \"SUBMITTED\")\n\n respond_with(@pullRequests)\n end", "def update\n respond_to do |format|\n if @party.update(party_params)\n format.html { redirect_to @party, notice: 'Party was successfully updated.' }\n format.json { render :show, status: :ok, location: @party }\n else\n format.html { render :edit }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def get(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'get'}.merge(authentication))\n end", "def approve\n return render_json_forbidden(:unknown_keeper) if @keeper.nil?\n return render_json_forbidden(:company_not_present) if @keeper.company.nil?\n\n @company = @keeper.company\n\n if @company.update(approved: true)\n render_json\n else\n render_json_unprocessable(error: :invalid, issues: @company.errors.details)\n end\n end", "def show\n @party_record = PartyRecord.find(params[:id])\n @set = PartySet.find(@party_record.partySet_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @party_record }\n end\n end", "def insurance_prices(params = {})\n scope 'default'\n get('prices/insurance', params)\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def destroy\n @party_approval.destroy\n respond_to do |format|\n format.html { redirect_to party_approvals_url, notice: 'Party approval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end", "def get_ApprovalURL()\n \t return @outputs[\"ApprovalURL\"]\n \tend", "def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend", "def show\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end", "def create_approvals(opts = {})\n data, _status_code, _headers = create_approvals_with_http_info(opts)\n data\n end", "def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pledge }\n end\n end", "def index\n @parties = Party.order(:name).all\n\n respond_to do |format|\n format.html\n format.json { render json: @parties }\n format.xml { render xml: @parties }\n end\n end", "def list_backoffice_information_for_arrays_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/arrays/#{args[:tenantId]}\", args)\nend" ]
[ "0.643207", "0.6275669", "0.592398", "0.5904591", "0.578622", "0.5747836", "0.5730095", "0.56563437", "0.56369066", "0.5601522", "0.55984646", "0.55951494", "0.55613357", "0.55613214", "0.5529902", "0.54554397", "0.5448509", "0.5426189", "0.54034215", "0.53918517", "0.5356828", "0.53364897", "0.5255823", "0.52535576", "0.525288", "0.5248602", "0.5247828", "0.5242738", "0.52330106", "0.5212652", "0.52068496", "0.51994187", "0.5197965", "0.5191631", "0.5188479", "0.5172501", "0.51721376", "0.515224", "0.5147822", "0.51199514", "0.51169276", "0.5099215", "0.50844455", "0.5067863", "0.5062516", "0.5042123", "0.5041234", "0.50400037", "0.5025374", "0.50200355", "0.5019736", "0.5011514", "0.500797", "0.4987829", "0.49727282", "0.49714687", "0.49674487", "0.49614316", "0.49527752", "0.49477157", "0.49451962", "0.49443853", "0.4935406", "0.49274936", "0.49273974", "0.49272084", "0.49253613", "0.49230167", "0.49131614", "0.49025556", "0.49002668", "0.48915157", "0.48840472", "0.48840207", "0.48756376", "0.48748568", "0.48659956", "0.485648", "0.4853305", "0.48510525", "0.48476335", "0.48458016", "0.48446777", "0.48433176", "0.4843052", "0.48428166", "0.48415586", "0.48361507", "0.48356628", "0.48318672", "0.48272493", "0.48197713", "0.4819347", "0.48179403", "0.48147756", "0.4814579", "0.4814494", "0.48098156", "0.48073393", "0.48066142" ]
0.6605213
0
GET /party_approvals/1 or /party_approvals/1.json
def show; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @party_approvals = PartyApproval.all\n end", "def approvals\n approvals_list = []\n if params[:count]\n if params[:skip]\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc').offset(params[:skip].to_i).take(params[:count].to_i)\n else\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc').take(params[:count].to_i)\n end\n else\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc')\n end\n\n # make sure we are only fetching bound approvals\n approvals_list = approvals_list.to_a.select { |approver| approver.approval.is_bound? }\n # return final approvals_list\n render status: 200, json: approvals_list.as_json(include: { approval_type: { }, approval: { methods: [:approval_status, :approval_link, :approval_source_requested_item, :approval_source, :approval_source_character_name, :approval_source_on_behalf_of], include: { approval_kind: { }, approval_approvers: { methods: [:character_name, :approver_response], include: { approval_type: { } } } } } })\n end", "def merge_request_approvals(project, merge_request)\n get(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals\")\n end", "def set_party_approval\n @party_approval = PartyApproval.find(params[:id])\n end", "def add_approver\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get approvers not already assigned to the contract\n @approvers = @client.unassigned_approvers_for_contract(@contract)\n\n end", "def update\n respond_to do |format|\n if @party_approval.update(party_approval_params)\n format.html { redirect_to @party_approval, notice: 'Party approval was successfully updated.' }\n format.json { render :show, status: :ok, location: @party_approval }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @party_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def party_approval_params\n params.require(:party_approval).permit(:user, :party, :approval)\n end", "def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end", "def index\n @budget_approvers = BudgetApprover.all\n end", "def index\n @approvals = Approval.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @approvals }\n end\n end", "def budget_approver_params\n params.fetch(:budget_approver, {})\n end", "def index_approvals_with_http_info(dataset_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApprovalsApi.index_approvals ...'\n end\n # verify the required parameter 'dataset_id' is set\n if @api_client.config.client_side_validation && dataset_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dataset_id' when calling ApprovalsApi.index_approvals\"\n end\n # resource path\n local_var_path = '/api/v1/approvals'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'dataset_id'] = dataset_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Approval>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"ApprovalsApi.index_approvals\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApprovalsApi#index_approvals\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @party = Party.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @party }\n end\n end", "def project_merge_request_approval_rules(project)\n get(\"/projects/#{url_encode project}/approval_rules\")\n end", "def show\n @party = Party.find(params[:id])\n \n getroles(@party.id)\n \n get_user_postal_code() \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @party }\n end\n end", "def get_approval_rules()\n build_header_auth('/approval_rules', API_VERSION_1, 'GET')\n build_request()\n request = Net::HTTP::Get.new(@uri.request_uri)\n #puts \"Request headers\\n\"\n @header.each do |name, value|\n request[name] = value\n\n #puts name+\": \"+value\n end\n\n response = @http.request(request)\n # response.body = JSON.parse(response.body)\n return response\n\n end", "def create\n @party_approval = PartyApproval.new(party_approval_params)\n\n respond_to do |format|\n if @party_approval.save\n format.html { redirect_to @party_approval, notice: 'Party approval was successfully created.' }\n format.json { render :show, status: :created, location: @party_approval }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @party_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def politician_approval_params\n params.require(:politician_approval).permit(:user, :party, :approval)\n end", "def index\n @politician_approvals = PoliticianApproval.all\n end", "def show\n @electronic_approval = ElectronicApproval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @electronic_approval }\n end\n end", "def show\n @pokeparty = Pokeparty.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def approvals_count\n return 0 if self.id.nil?\n return RequestSearch.approvals_for(self, show: 'pending', per_page: 1000).count\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def gov_proposals_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GovernanceApi.gov_proposals_get ...'\n end\n # resource path\n local_var_path = '/gov/proposals'\n\n # query parameters\n query_params = {}\n query_params[:'voter'] = opts[:'voter'] if !opts[:'voter'].nil?\n query_params[:'depositor'] = opts[:'depositor'] if !opts[:'depositor'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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<TextProposal>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GovernanceApi#gov_proposals_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def approve_partner\n @partner = current_organization.partners.find(params[:id])\n\n # TODO: create a service that abstracts all of this from PartnersController, like PartnerDetailRetriever.call(id: params[:id])\n\n # TODO: move this code to new service,\n @diaper_partner = DiaperPartnerClient.get(id: params[:id])\n @diaper_partner = JSON.parse(@diaper_partner, symbolize_names: true) if @diaper_partner\n @agency = if @diaper_partner\n @diaper_partner[:agency]\n else\n autovivifying_hash\n end\n end", "def set_budget_approver\n @budget_approver = BudgetApprover.find(params[:id])\n end", "def create_approvals_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApprovalsApi.create_approvals ...'\n end\n # resource path\n local_var_path = '/api/v1/approvals'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_approvals_input'] || opts[:body])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Approval'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"ApprovalsApi.create_approvals\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApprovalsApi#create_approvals\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_require_administrator_approval_applications\n respond_to do |format|\n param = params[:payload]\n format.json {\n @project_applications = ProjectApplication.where(:student_approved => true, :professor_approved => true, :administrator_approved => nil)\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end", "def show\n @approval = Approval.find(params[:id])\n @recommendation = Recommendation.find(@approval.recommendation_id)\n @approvals = @recommendation.approvals.find(:all, :order => \"created_at ASC\")\n @rec_user = User.find(@recommendation.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n data || {}\n end", "def pending\n getProfile\n where = \"status = 'p' and (owner_id = ? OR patient_id = ?)\"\n if @user.is_therapist?\n where = \"status = 'p' and (owner_id = ? OR therapist_id = ?)\"\n end\n @appointments = Appointment.where(where, @user.id, @profile.id)\n respond_to do |format|\n format.html { render action: 'pending' }\n format.json { render :status => 200, :json => { action: 'pending', appointments: @appointments, user: @user, profile: @profile }}\n end\n end", "def show\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenancy_agreement }\n end\n end", "def index\n unless (params[:party_id].nil? || params[:party_id] == 0) \n $party_id = params[:party_id]\n end\n @partyroles = Partyrole.find(:all, :conditions => [\"party_id = ?\", $party_id])\n @partyrole = Person.find(:first, :conditions => [\"party_id = ?\", $party_id])\n @person = Person.find(:first, :conditions => [\"party_id = ?\", $party_id], :select => \"party_id, current_last_name, current_first_name\")\n \n unless !( @partyroles.nil? || @partyroles.empty? )\n flash.now[:notice] = \"No party role has been assigned yet!\"\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @partyroles }\n end\n end", "def approved_flights\n pireps.approved\n end", "def get_tenant_by_erp_id(args = {}) \n get(\"/tenants.json/erp-id/#{args[:erpId]}\", args)\nend", "def show\n @loyalty_scheme = current_user.loyalty_schemes.find(params[:id])\n end", "def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend", "def show\n @loyalty_scheme = current_user.loyalty_schemes.find(params[:id])\n end", "def get_team_years_participated ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/years_participated\"\n end", "def index\n if params.has_key?(:code_id)\n logger.info(current_user)\n end\n @parties = Party.where(user_id: current_user)\n end", "def get_notary_jurisdiction_seal_with_http_info(jurisdiction_id)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotaryApi.get_notary_jurisdiction_seal ...\"\n end\n # verify the required parameter 'jurisdiction_id' is set\n fail ArgumentError, \"Missing the required parameter 'jurisdiction_id' when calling NotaryApi.get_notary_jurisdiction_seal\" if jurisdiction_id.nil?\n # resource path\n local_var_path = \"/v2.1/current_user/notary/jurisdictions/{jurisdictionId}/seal\".sub('{format}','json').sub('{' + 'jurisdictionId' + '}', jurisdiction_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotaryApi#get_notary_jurisdiction_seal\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def approval_params\n params.require(:approval).permit(:policy_resolution_id, :approval_type, :approver_id, :approved, :remarks)\n end", "def political_party_params\n params.fetch(:political_party, {})\n end", "def show\n @partyroles = Partyrole.find(:all, :conditions => [\"party_id = ?\", $party_id])\n @partyrole = Person.find(:first, :conditions => [\"party_id = ?\", $party_id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @partyrole }\n end\n end", "def index_approvable\n @asset_info_adjustments = AssetInfoAdjustment.accessible_by(current_ability, :approve).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html { render \"index\" }\n format.json { render json: @asset_info_adjustments }\n format.xml { render xml: @asset_info_adjustments }\n end\n end", "def index\n @approval_processes = ApprovalProcess.find(:all, :conditions => {:client_id => session[:client_id]})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @approval_processes }\n end\n end", "def index\n\n if current_user.profile.profile_rank == 'High'\n @approvals = Approval.where(approval_type: ['Noted', 'Approved']).order(:approval_type, :approved, policy_resolution_id: :desc).page(params[:page]).per(10)\n elsif current_user.profile.profile_rank == 'Medium'\n @approvals = Approval.where(approval_type: ['Reviewed', 'Noted']).order(:approval_type, :approved, policy_resolution_id: :desc).page(params[:page]).per(10)\n else\n @approvals = Approval.where(approval_type: 'Reviewed').order(:approval_type, :approved, policy_resolution_id: :desc).page(params[:page]).per(10)\n end\n \n end", "def new\n @approval = Approval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @approval }\n end\n end", "def get(*args)\n arguments(args, required: [:org_name])\n\n get_request(\"/orgs/#{arguments.org_name}\", arguments.params)\n end", "def approval_params\r\n # params.fetch(:approval, {})\r\n params.require(:approval).permit(:approval_type, :date, :approval_no, :sub_type, :description, :standard, :reference, :effective_date, :expiry_date, :status, :notes, :approval_doc, product_ids: [])\r\n end", "def show\n @party_record = PartyRecord.find(params[:id])\n @set = PartySet.find(@party_record.partySet_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @party_record }\n end\n end", "def index\n @loyalty_schemes = current_user.loyalty_schemes\n end", "def update\n respond_to do |format|\n if @political_party.update(political_party_params)\n format.html { redirect_to @political_party, notice: 'Political party was successfully updated.' }\n format.json { render :show, status: :ok, location: @political_party }\n else\n format.html { render :edit }\n format.json { render json: @political_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_politician_approval\n @politician_approval = PoliticianApproval.find(params[:id])\n end", "def by_any_approvals?\n includes_special_label?(IssuableFinder::Params::FILTER_ANY)\n end", "def index\n if @party \n @buyer_leads_zip_codes = @party.buyer_leads_zip_codes\n else\n @buyer_leads_zip_codes = BuyerLeadsZipCode.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buyer_leads_zip_codes }\n end\n end", "def investors_ownership_with_http_info(symbol, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.investors_ownership ...'\n end\n # verify the required parameter 'symbol' is set\n if @api_client.config.client_side_validation && symbol.nil?\n fail ArgumentError, \"Missing the required parameter 'symbol' when calling DefaultApi.investors_ownership\"\n end\n # resource path\n local_var_path = '/stock/investor-ownership'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'symbol'] = symbol\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InvestorsOwnership' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#investors_ownership\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def draft_agreement_with_http_info(agreement_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AgreementControllerApi.draft_agreement ...'\n end\n # verify the required parameter 'agreement_request' is set\n if @api_client.config.client_side_validation && agreement_request.nil?\n fail ArgumentError, \"Missing the required parameter 'agreement_request' when calling AgreementControllerApi.draft_agreement\"\n end\n if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 40\n fail ArgumentError, 'invalid value for \"opts[:\"idempotency_key\"]\" when calling AgreementControllerApi.draft_agreement, the character length must be smaller than or equal to 40.'\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9]*$/)\n if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'] !~ pattern\n fail ArgumentError, \"invalid value for 'opts[:\\\"idempotency_key\\\"]' when calling AgreementControllerApi.draft_agreement, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/v2/agreements'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?\n header_params[:'Vipps-System-Name'] = opts[:'vipps_system_name'] if !opts[:'vipps_system_name'].nil?\n header_params[:'Vipps-System-Version'] = opts[:'vipps_system_version'] if !opts[:'vipps_system_version'].nil?\n header_params[:'Vipps-System-Plugin-Name'] = opts[:'vipps_system_plugin_name'] if !opts[:'vipps_system_plugin_name'].nil?\n header_params[:'Vipps-System-Plugin-Version'] = opts[:'vipps_system_plugin_version'] if !opts[:'vipps_system_plugin_version'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(agreement_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AgreementReference'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth', 'ocpSubscriptionKey']\n\n new_options = opts.merge(\n :operation => :\"AgreementControllerApi.draft_agreement\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AgreementControllerApi#draft_agreement\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "def security_advisories_year_year_get_with_http_info(year, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.security_advisories_year_year_get ...\"\n end\n # verify the required parameter 'year' is set\n if @api_client.config.client_side_validation && year.nil?\n fail ArgumentError, \"Missing the required parameter 'year' when calling DefaultApi.security_advisories_year_year_get\"\n end\n # resource path\n local_var_path = \"/security/advisories/year/{year}\".sub('{' + 'year' + '}', year.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 = ['psirt_openvuln_api_auth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#security_advisories_year_year_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def approval_owner\n if self.approval_kind_id == 16\n e = OwnedShipCrewRequest.find_by approval_id: self.id\n \"#{e.character.full_name} requesting to join #{e.crew.owned_ship.title} (Crew Request)\"\n end\n end", "def get_current_tenant \n get(\"/tenants.json/current\")\nend", "def index\n @loyalty_schemes = current_user.loyalty_schemes\n end", "def merge_request_approval_state(project, id)\n get(\"/projects/#{url_encode project}/merge_requests/#{id}/approval_state\")\n end", "def update\n respond_to do |format|\n if @budget_approver.update(budget_approver_params)\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_approver }\n else\n format.html { render :edit }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_json\n params = {}\n params['access_token'] = EXPA.client.get_updated_token\n uri = URI(url_current_person)\n uri.query = URI.encode_www_form(params)\n force_get_response(uri)\n end", "def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pledge }\n end\n end", "def show\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def index\n candidate = UspsInPersonProofing::Applicant.new(\n address: search_params['street_address'],\n city: search_params['city'], state: search_params['state'],\n zip_code: search_params['zip_code']\n )\n response = proofer.request_facilities(candidate)\n if response.length > 0\n analytics.idv_in_person_locations_searched(\n success: true,\n result_total: response.length,\n )\n else\n analytics.idv_in_person_locations_searched(\n success: false, errors: 'No USPS locations found',\n )\n end\n render json: response.to_json\n end", "def create\n # raise \"errors\"\n # @approval = Approval.new(approval_params)\n @policy_resolution = PolicyResolution.find(params[:id])\n @approval = @policy_resolution.approvals.build(approval_params)\n @approval.approval_type = params[:commit]\n @approval.approved = Date.today\n\n respond_to do |format|\n if current_user.approvals << @approval #@approval.save\n format.html { redirect_to @approval, notice: 'Approval was successfully created.' }\n format.json { render :show, status: :created, location: @approval }\n else\n format.html { render :new }\n format.json { render json: @approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @party.update(party_params)\n format.html { redirect_to @party, notice: 'Party was successfully updated.' }\n format.json { render :show, status: :ok, location: @party }\n else\n format.html { render :edit }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_client_summary_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/clients/summary/#{args[:tenantId]}\", args)\nend", "def merge_request_level_rule(project, merge_request)\n get(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules\")\n end", "def show\n p 'show?'\n @acceptances = []\n if(current_user)\n if(params[:id])\n @acceptance = Acceptance.find(params[:id])\n else\n @acceptances = Acceptance.where(\"user_id=? and (status=? or status = ?) and end_time> ?\", current_user.id, \"successfully paid\", \"payment pending\", Time.now())\n end\n end\n p \"acceptances are \"\n \n presenter = Api::V3::AcceptancesPresenter.new\n acceptances_json = @acceptances.map{|x| presenter.as_json(x)}\n p acceptances_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: acceptances_json }\n end\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def destroy\n @party_approval.destroy\n respond_to do |format|\n format.html { redirect_to party_approvals_url, notice: 'Party approval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end", "def update\n @party = Party.find(params[:id])\n\n respond_to do |format|\n if @party.update_attributes(params[:party])\n format.html { redirect_to @party, notice: 'Party was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @id_proof = IdProof.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @id_proof }\n end\n end", "def rental(rental, options = {})\n get(\"rentals/#{rental}\", options).pop\n end", "def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end", "def index\n @resources = Resource.where(\"is_approved = true\")\n render json: @resources, status: 200\n end", "def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend", "def edit_merge_request_approvals(project, merge_request, options = {})\n post(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals\", body: options)\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def show\n @approval_process = ApprovalProcess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @approval_process }\n end\n end", "def get_ApprovalURL()\n \t return @outputs[\"ApprovalURL\"]\n \tend", "def request_pre_approval(account = nil)\n params = Serializer.new(self).to_params\n response = post('/pre-approvals/request', API_V2 ,account, params).parsed_response\n code = response['preApprovalRequest']['code']\n \n PagSeguro.redirect_url(API_V2) + \"/pre-approvals/request.html?code=#{code}\"\n end", "def trip_purposes \n label = request_label(:purposes)\n \n @http_request_bundler.add(\n label, \n @url + \"/trip_purposes\", \n :get,\n head: headers,\n query: { provider_id: provider_id }\n ).response!(label)\n end", "def first_approval\n miq_approvals.first || build_default_approval\n end", "def set_approval\r\n @approval = Approval.find(params[:id])\r\n end", "def approve\n return render_json_forbidden(:unknown_keeper) if @keeper.nil?\n return render_json_forbidden(:company_not_present) if @keeper.company.nil?\n\n @company = @keeper.company\n\n if @company.update(approved: true)\n render_json\n else\n render_json_unprocessable(error: :invalid, issues: @company.errors.details)\n end\n end", "def show\n # render json: @birthday_party\n end", "def set_party\n @party = Party.find_by(:code => params[:code])\n end", "def update\n respond_to do |format|\n if @politician_approval.update(politician_approval_params)\n format.html { redirect_to @politician_approval, notice: 'Politician approval was successfully updated.' }\n format.json { render :show, status: :ok, location: @politician_approval }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @politician_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def gov_proposals_proposal_id_votes_get_with_http_info(proposal_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GovernanceApi.gov_proposals_proposal_id_votes_get ...'\n end\n # verify the required parameter 'proposal_id' is set\n if @api_client.config.client_side_validation && proposal_id.nil?\n fail ArgumentError, \"Missing the required parameter 'proposal_id' when calling GovernanceApi.gov_proposals_proposal_id_votes_get\"\n end\n # resource path\n local_var_path = '/gov/proposals/{proposalId}/votes'.sub('{' + 'proposalId' + '}', proposal_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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<Vote>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GovernanceApi#gov_proposals_proposal_id_votes_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n if params[:id]\n @repo = Repo.find_by_id(params[:id])\n ident = \"with ID \" + params[:id].to_s\n end\n \n if (params[:owner] and params[:name])\n @repo = Repo.find_by_owner_and_name(params[:owner].strip, params[:name].strip)\n ident = params[:owner].strip + \"/\" + params[:name].strip\n end\n \n unless @repo.nil?\n @alternatives = @repo.find_related_labels\n end\n \n respond_to do |format|\n unless @repo.nil? \n # Repo and Alternatives found\n format.html # show.html.erb\n format.json { render json: @repo }\n else\n # Repo could not be found\n redirect_to repos_url, notice: \"Repo '#{ident}' could not be found.\"\n end\n end\n end", "def get_notary_jurisdictions_with_http_info()\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotaryApi.get_notary_jurisdictions ...\"\n end\n # resource path\n local_var_path = \"/v2.1/current_user/notary/jurisdictions\".sub('{format}','json')\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 = []\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 => 'NotaryJurisdictionList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotaryApi#get_notary_jurisdictions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end", "def get_overdue_config_json_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OverdueApi.get_overdue_config_json ...\"\n end\n # resource path\n local_var_path = \"/1.0/kb/overdue\"\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 = []\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 => 'OverdueJson')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OverdueApi#get_overdue_config_json\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @requirement_priority = RequirementPriority.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @requirement_priority }\n end\n end" ]
[ "0.66051", "0.64246833", "0.620986", "0.6083993", "0.60380757", "0.5874765", "0.5769815", "0.5761945", "0.56445503", "0.5596188", "0.5589476", "0.5560001", "0.5556063", "0.55556804", "0.5510933", "0.5509608", "0.5501054", "0.5495915", "0.5488678", "0.54462737", "0.53868616", "0.5358936", "0.5319996", "0.53000146", "0.52932525", "0.529228", "0.52446216", "0.5201722", "0.52006876", "0.5182333", "0.51815456", "0.5181057", "0.51776606", "0.516738", "0.5158535", "0.5155688", "0.51426554", "0.51393753", "0.51300263", "0.512788", "0.5127165", "0.5124257", "0.5112005", "0.51016045", "0.5101422", "0.510047", "0.5091832", "0.50823975", "0.5076427", "0.50722957", "0.50687075", "0.50585747", "0.5024602", "0.5013499", "0.50109756", "0.5005266", "0.5004027", "0.50029194", "0.4999502", "0.49980542", "0.49920934", "0.49901333", "0.4989301", "0.49857867", "0.49748263", "0.4968591", "0.49679676", "0.49646342", "0.49456137", "0.4945359", "0.4939206", "0.49379265", "0.49362266", "0.49356288", "0.4934493", "0.4933096", "0.49137", "0.49133137", "0.49118462", "0.49081153", "0.49080694", "0.4906255", "0.49027368", "0.4889778", "0.48878363", "0.488741", "0.48854372", "0.48841172", "0.48811558", "0.4879642", "0.48769915", "0.48733646", "0.48695633", "0.48672143", "0.48615703", "0.4861265", "0.48587045", "0.48585325", "0.4857542", "0.48540893", "0.48527008" ]
0.0
-1
POST /party_approvals or /party_approvals.json
def create @party_approval = PartyApproval.new(party_approval_params) respond_to do |format| if @party_approval.save format.html { redirect_to @party_approval, notice: 'Party approval was successfully created.' } format.json { render :show, status: :created, location: @party_approval } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @party_approval.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def party_approval_params\n params.require(:party_approval).permit(:user, :party, :approval)\n end", "def politician_approval_params\n params.require(:politician_approval).permit(:user, :party, :approval)\n end", "def set_party_approval\n @party_approval = PartyApproval.find(params[:id])\n end", "def update\n respond_to do |format|\n if @party_approval.update(party_approval_params)\n format.html { redirect_to @party_approval, notice: 'Party approval was successfully updated.' }\n format.json { render :show, status: :ok, location: @party_approval }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @party_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_approver\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get approvers not already assigned to the contract\n @approvers = @client.unassigned_approvers_for_contract(@contract)\n\n end", "def create\n # raise \"errors\"\n # @approval = Approval.new(approval_params)\n @policy_resolution = PolicyResolution.find(params[:id])\n @approval = @policy_resolution.approvals.build(approval_params)\n @approval.approval_type = params[:commit]\n @approval.approved = Date.today\n\n respond_to do |format|\n if current_user.approvals << @approval #@approval.save\n format.html { redirect_to @approval, notice: 'Approval was successfully created.' }\n format.json { render :show, status: :created, location: @approval }\n else\n format.html { render :new }\n format.json { render json: @approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_approvals_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApprovalsApi.create_approvals ...'\n end\n # resource path\n local_var_path = '/api/v1/approvals'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_approvals_input'] || opts[:body])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Approval'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"ApprovalsApi.create_approvals\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApprovalsApi#create_approvals\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def approval_params\n params.require(:approval).permit(:policy_resolution_id, :approval_type, :approver_id, :approved, :remarks)\n end", "def merge_request_approvals(project, merge_request)\n get(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals\")\n end", "def index\n @party_approvals = PartyApproval.all\n end", "def create\n @budget_approver = BudgetApprover.new(budget_approver_params)\n respond_to do |format|\n if @budget_approver.save\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully created.' }\n format.json { render :show, status: :created, location: @budget_approver }\n else\n format.html { render :new }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end", "def approval_params\r\n # params.fetch(:approval, {})\r\n params.require(:approval).permit(:approval_type, :date, :approval_no, :sub_type, :description, :standard, :reference, :effective_date, :expiry_date, :status, :notes, :approval_doc, product_ids: [])\r\n end", "def create_approvals(opts = {})\n data, _status_code, _headers = create_approvals_with_http_info(opts)\n data\n end", "def party_standpoint_params\n params.require(:party_standpoint).permit(:party_id, :issue_id, :agree, :disagree, :abstain, :notvote, :unknown, :decision)\n end", "def budget_approver_params\n params.fetch(:budget_approver, {})\n end", "def create\n @party = Party.new(params[:party])\n\n respond_to do |format|\n if @party.save\n format.html { redirect_to @party, notice: 'Party was successfully created.' }\n format.json { render json: @party, status: :created, location: @party }\n else\n format.html { render action: \"new\" }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_preapproved_payments(preapproval_key)\n api.execute :Pay, payment_options(preapproval_key)\nend", "def create\n Party.create(party_params)\n redirect_to order_tickets_path\n end", "def create\n @party = Party.new(party_params)\n\n respond_to do |format|\n if @party.save\n format.html { redirect_to @party, notice: 'Party was successfully created.' }\n format.json { render :show, status: :created, location: @party }\n else\n format.html { render :new }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def assign_approver\n if approver == \"1\"\n document.approver = user\n document.save!\n end\n end", "def create\n @political_party = PoliticalParty.new(political_party_params)\n\n respond_to do |format|\n if @political_party.save\n format.html { redirect_to @political_party, notice: 'Political party was successfully created.' }\n format.json { render :show, status: :created, location: @political_party }\n else\n format.html { render :new }\n format.json { render json: @political_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @politician_approval = PoliticianApproval.new(politician_approval_params)\n\n respond_to do |format|\n if @politician_approval.save\n format.html { redirect_to @politician_approval, notice: 'Politician approval was successfully created.' }\n format.json { render :show, status: :created, location: @politician_approval }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @politician_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def approve_partner\n @partner = current_organization.partners.find(params[:id])\n\n # TODO: create a service that abstracts all of this from PartnersController, like PartnerDetailRetriever.call(id: params[:id])\n\n # TODO: move this code to new service,\n @diaper_partner = DiaperPartnerClient.get(id: params[:id])\n @diaper_partner = JSON.parse(@diaper_partner, symbolize_names: true) if @diaper_partner\n @agency = if @diaper_partner\n @diaper_partner[:agency]\n else\n autovivifying_hash\n end\n end", "def party_params\n params.require(:party).permit(:result_no, :generate_no, :e_no, :party_type, :party)\n end", "def party_params\n params.require(:party).permit()\n end", "def setup_preapproval\n api.execute :Preapproval, preapproval_payment_options\nend", "def party_params\n params.require(:party).permit(:user_id, :code_id, :role, :state)\n end", "def approvals\n approvals_list = []\n if params[:count]\n if params[:skip]\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc').offset(params[:skip].to_i).take(params[:count].to_i)\n else\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc').take(params[:count].to_i)\n end\n else\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc')\n end\n\n # make sure we are only fetching bound approvals\n approvals_list = approvals_list.to_a.select { |approver| approver.approval.is_bound? }\n # return final approvals_list\n render status: 200, json: approvals_list.as_json(include: { approval_type: { }, approval: { methods: [:approval_status, :approval_link, :approval_source_requested_item, :approval_source, :approval_source_character_name, :approval_source_on_behalf_of], include: { approval_kind: { }, approval_approvers: { methods: [:character_name, :approver_response], include: { approval_type: { } } } } } })\n end", "def edit_merge_request_approvals(project, merge_request, options = {})\n post(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals\", body: options)\n end", "def approve\n return render_json_forbidden(:unknown_keeper) if @keeper.nil?\n return render_json_forbidden(:company_not_present) if @keeper.company.nil?\n\n @company = @keeper.company\n\n if @company.update(approved: true)\n render_json\n else\n render_json_unprocessable(error: :invalid, issues: @company.errors.details)\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def approval_params\n params.require(:approval).permit(:approval_status_name, :description)\n end", "def create\n @electronic_approval = ElectronicApproval.new(params[:electronic_approval])\n\n respond_to do |format|\n if @electronic_approval.save\n format.html { redirect_to @electronic_approval, notice: 'Electronic approval was successfully created.' }\n format.json { render json: @electronic_approval, status: :created, location: @electronic_approval }\n else\n format.html { render action: \"new\" }\n format.json { render json: @electronic_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pokeparty = Pokeparty.new(params[:pokeparty])\n\n respond_to do |format|\n if @pokeparty.save\n format.html { redirect_to @pokeparty, notice: 'Pokeparty was successfully created.' }\n format.json { render json: @pokeparty, status: :created, location: @pokeparty }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pokeparty.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_added_approver\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get the approver\n @approver = User.find(params[:user_id])\n\n # add the approver to the list\n @contract.approver_users << @approver\n\n # save\n if @contract.save\n\n redirect_to edit_client_contract_path(@client, @contract)\n\n else\n\n render :action => 'add_approver'\n \n end\n \n end", "def approve_join_request\n join_request = JoinRequest.find(params[:id])\n team = join_request.team\n # Only authorize the captain to do this\n if current_user.id == team.captain_id\n membership = Membership.create(\n team_id: join_request.team_id,\n user_id: join_request.user_id,\n admin: false\n )\n if membership.valid?\n join_request.destroy\n render json: {\n team: TeamSerializer.new(team),\n user: UserSerializer.new(current_user)\n }, status: :accepted\n else\n # invalid request\n render json: {\n message: \"Invalid request\",\n errors: membership.errors.full_messages\n }, status: :not_acceptable\n end\n else\n render json: { message: \"Only the captain is allowed to accept join requests\"}, status: :not_acceptable\n end\n end", "def create\n @renewal = Renewal.new(renewal_params)\n\n respond_to do |format|\n if @renewal.save\n format.html { redirect_to insurance_policy_path(@renewal.insurance_policy), notice: 'Renewal was successfully created.' }\n format.json { render :show, status: :created, location: @renewal }\n # for each new renewal added parent policy expiry and policy no will change to match current renewal\n @insurance_policy = @renewal.insurance_policy\n @insurance_policy.update_attributes(current_expiry: @renewal.expiry_date, policyno: @renewal.policyno)\n else\n format.html { render :new }\n format.json { render json: @renewal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @political_party.update(political_party_params)\n format.html { redirect_to @political_party, notice: 'Political party was successfully updated.' }\n format.json { render :show, status: :ok, location: @political_party }\n else\n format.html { render :edit }\n format.json { render json: @political_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget_approver\n @budget_approver = BudgetApprover.find(params[:id])\n end", "def create\n @previous_party = PreviousParty.new(previous_party_params)\n\n respond_to do |format|\n if @previous_party.save\n format.html { redirect_to @previous_party, notice: 'Previous party was successfully created.' }\n format.json { render :show, status: :created, location: @previous_party }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @previous_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tenancy_agreement = TenancyAgreement.new(params[:tenancy_agreement])\n @tenancy_agreement.estate_agent_id = current_user.estate_agent_id\n respond_to do |format|\n if @tenancy_agreement.save\n format.html { redirect_to tenancy_agreements_path, notice: 'Tenancy agreement was successfully created.' }\n format.json { render json: @tenancy_agreement, status: :created, location: @tenancy_agreement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenancy_agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "def gov_proposals_post_with_http_info(post_proposal_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GovernanceApi.gov_proposals_post ...'\n end\n # verify the required parameter 'post_proposal_body' is set\n if @api_client.config.client_side_validation && post_proposal_body.nil?\n fail ArgumentError, \"Missing the required parameter 'post_proposal_body' when calling GovernanceApi.gov_proposals_post\"\n end\n # resource path\n local_var_path = '/gov/proposals'\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(post_proposal_body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StdTx')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GovernanceApi#gov_proposals_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @counterparty = Counterparty.new(counterparty_params)\n @counterparty.owner = current_user\n\n respond_to do |format|\n if @counterparty.save\n format.html { redirect_to @counterparty, notice: \"Counterparty was successfully created.\" }\n format.json { render :show, status: :created, location: @counterparty }\n else\n format.html { render :new }\n format.json { render json: @counterparty.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @party_approval.destroy\n respond_to do |format|\n format.html { redirect_to party_approvals_url, notice: 'Party approval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def previous_party_params\n params.require(:previous_party).permit(:party, :politician, :start_date, :end_date)\n end", "def update\n respond_to do |format|\n if @politician_approval.update(politician_approval_params)\n format.html { redirect_to @politician_approval, notice: 'Politician approval was successfully updated.' }\n format.json { render :show, status: :ok, location: @politician_approval }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @politician_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def approve\n @bounty = Bounty.find(params[:id])\n if @bounty.update(approved: bounty_params[:approved]) && @bounty.save\n render json: {\n notice: \"Successfully posted the Bounty\",\n bounty: @bounty\n }, status: :created\n else\n render json: {\n error: @bounty.errors.full_messages.first\n }, status: :bad_request\n end\n end", "def add_party(party, which_party)\n case which_party\n when 'payer'\n @payer_party = party\n\n when 'payee'\n @payee_party = party\n\n else\n # TODO: Return an error\n end\n end", "def party_params\n \tparams.require(:party).permit(:name, candidates_attributes: [:first_name, :last_name, :party_id], elections_attributes: [:state_id, :candidate_id, :party_id, :percent, :regs, :supers, :updated_at], state_attributes: [:name, :p_or_c, :dem_date, :gop_date])\n end", "def remote_pledge(pay_to)\n \tvenmo_info = self.user.venmo_account\n \trequest = 'https://api.venmo.com/v1/payments'\n \tresponse = HTTParty.post(request, query: {\n access_token: venmo_info.access_token,\n user_id: pay_to,\n amount: self.amount.to_s,\n note: 'Payment from my app'\n })\n\n \tJSON.parse(response.body)\n end", "def approve\n registration = Registration.find(params[:id])\n if (params[:assigned_points].present? || registration.evidence.points)\n registration.update(assigned_points: params[:assigned_points])\n registration.update(approved: true)\n end\n redirect_to :registrations\n end", "def create\n @req = Req.new(req_params)\n @req.office = current_user.office\n @req.user = current_user\n\n\n respond_to do |format|\n if @req.save\n flash[:notice] = \"Your requirement has been saved\"\n format.html { redirect_to @req }\n format.json { render :show, status: :created, location: @req }\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @party.update(party_params)\n format.html { redirect_to @party, notice: 'Party was successfully updated.' }\n format.json { render :show, status: :ok, location: @party }\n else\n format.html { render :edit }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget_approver.update(budget_approver_params)\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_approver }\n else\n format.html { render :edit }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end", "def sign_approval\n approval = params[:approval]\n approval_by = \"#{approval}_by\"\n approval_date = \"#{approval}_date\"\n @return[approval_by] = current_user.id\n @return[approval_date] = Time.now\n if @return.save\n respond_to do |format|\n format.js {}\n end\n end\n end", "def create\n @approval = Approval.new(params[:approval])\n\n respond_to do |format|\n if @approval.save\n format.html { redirect_to @approval, notice: 'Approval was successfully created.' }\n else\n format.html { render action: \"show\" }\n end\n end\n end", "def create\n @party = Party.new(party_params)\n\n respond_to do |format|\n if @party.save\n format.html { redirect_to @party, notice: '作成しました。' }\n format.json { render :show, status: :created, location: @party }\n else\n format.html { render :new }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def wepay_postfill\n # If the user approved the 'preapproval' and \n if params.has_key?('preapproval_id')\n @order = Order.find_by_token(params[:preapproval_id])\n unless @order.nil?\n wepay = WePay.new(Settings.wepay_client_id, Settings.wepay_access_token, _use_stage = (!Rails.env.production?))\n # Let's find the user information on Wepay end..\n response = wepay.call('/preapproval', Settings.wepay_access_token, {\n :preapproval_id => params[:preapproval_id]\n })\n \n @order.wepay_postfill(response)\n if params['status'] != 'approved' \n redirect_to :action => :share, :uuid => @order.uuid\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n else\n redirect_to root_url\n end\n end", "def political_party_params\n params.fetch(:political_party, {})\n end", "def political_party_params\n params.require(:political_party).permit(:name, :description)\n end", "def create\n params[:submission][:verdict] = 'pending'\n create_base(params[:submission]) \n end", "def object_approver_params\n params.require(:object_approver).permit(:employee_id, :kind, :object_id, :object_type, :cancel_url, :redirect_url)\n end", "def create\n @m_approval = MApproval.new(params[:m_approval])\n\n respond_to do |format|\n if @m_approval.save\n format.html { redirect_to :controller => \"m_approvals\", :action => \"index\" }\n #format.html { redirect_to @m_approval }\n format.json { render json: @m_approval, status: :created, location: @m_approval }\n else\n format.html { render action: \"new\" }\n format.json { render json: @m_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n line_item1 = PledgeLineItem.create(:amount => params[:amount0])\n line_item2 = PledgeLineItem.create(:amount => params[:amount1])\n @pledge.pledge_line_items = [line_item1, line_item2]\n @pledge.user = current_user\n @pledge.organization = Organization.find(params[:org])\n\n respond_to do |format|\n if @pledge.save\n flash[:notice] = 'Pledge was successfully created.'\n format.html { redirect_to(@pledge) }\n format.xml { render :xml => @pledge, :status => :created, :location => @pledge }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pledge.errors, :status => :unprocessable_entity }\n end\n end\n end", "def project_merge_request_approval_rules(project)\n get(\"/projects/#{url_encode project}/approval_rules\")\n end", "def update\n @party = Party.find(params[:id])\n\n respond_to do |format|\n if @party.update_attributes(params[:party])\n format.html { redirect_to @party, notice: 'Party was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def appeal_params\n params.require(:appeal).permit(:full_name, :dob_dd, :dob_mm, :dob_yyyy, :solicitor_name, :provider_acct_num)\n end", "def party_info_params\n params.require(:party_info).permit(:result_no, :generate_no, :party_no, :party_type, :name, :member_num)\n end", "def set_politician_approval\n @politician_approval = PoliticianApproval.find(params[:id])\n end", "def approve_merge_request(project, merge_request, options = {})\n post(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approve\", body: options)\n end", "def eligibility(params = {})\n scope 'default'\n post('eligibility/', params)\n end", "def create\n @approval = Approval.new(params[:approval])\n\n respond_to do |format|\n if @approval.save\n \n \n flash[:notice] = 'Approval was successfully created.'\n format.html { redirect_to(@approval) }\n format.xml { render :xml => @approval, :status => :created, :location => @approval }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @approval.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if params.has_key?(:unbound_contributions)\n user = User.find_by(id: params[:user_id])\n ride = Ride.find_by(id: params[:ride_id])\n price = ride[:price]\n distance = user.rides.find_by(id: params[:ride_id])[:realtime_km]\n project_id = ride.project[:id]\n\n contribution_amount = price*distance\n user.update_attribute(:unbound_contributions, contribution_amount)\n user.contributions.update_attributes(amount: contribution_amount, project_id: project_id)\n user.rides.find_by(id: ride.id).update_attribute(:is_paid, true)\n render json: {:status => 200}\n else\n ride = Ride.find_by(id: params[:ride_id])\n new_ride = ride.requests.create!(passenger_id: params[:user_id], requested_from: params[:requested_from],\n request_to: params[:requested_to])\n unless new_ride.nil?\n respond_with ride: new_ride, anfrage: true, status: :created\n else\n respond_with ride: new_ride, anfrage: false, status: :bad_request\n end\n end\n end", "def settle\n \n\n if params[\"code\"]\n auth_code = params[\"code\"]\n end \n url = \"https://api.venmo.com/v1/oauth/access_token\"\n @response = HTTParty.post(url, :query => {:client_id => '1916', :client_secret => 'eGcyNHaysfbFGZ6xkMffUw3gGrKFzksG', :code => auth_code})\n user = @response[\"user\"]\n @access_token = @response[\"access_token\"]\n @refresh_token = @response[\"refresh_token\"]\n @email = params[:email]\n @amount = params[:amount]\n \n url = \"https://api.venmo.com/v1/payments\"\n @amount = HTTParty.post(url, :query => { \"access_token\" => @access_token, :email => @email, :amount => @amount, :note => 'PayUp'})\n redirect_to bets_path\n end", "def update\n redirect_to root_path, alert: \"You are not authorised to view that page.\" unless current_member.is_admin?\n unless request.get?\n if params[:commit] == \"Reject Request\"\n @order.update(approver: current_member, deadline: Time.now, returned: true)\n redirect_to club_path(current_member.club), notice: \"The Order Request was rejected successfully.\"\n else\n @order.update(approver: current_member, deadline: params[:order][:deadline], returned: false, approved_at: Time.current)\n redirect_to club_path(current_member.club), notice: \"The Order Request was accepted successfully.\"\n end\n end\n end", "def upsert_marketo_lead(params)\n # todo: verify required fields? perhaps get form fields and validation logic from marketo?\n # removing params included by rails\n params.delete :action\n params.delete :controller\n params.delete :marketo_form\n # parse incoming values to json\n body = {\n #\"action\"=>\"createOnly\",\n \"lookupField\"=>\"email\",\n \"input\"=>[params]\n }.to_json\n @body = body\n # set post uri\n uri = URI(Config.get_create_lead_url)\n # setup http request\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n uri.query = \"access_token=#{get_marketo_token}\"\n request = Net::HTTP::Post.new(uri, { 'Content-Type' => 'application/json' })\n request.body = @body\n # make http request\n response = http.request(request)\n return response.body\n end", "def approve_with(params)\n statement = \\\n eval(\"#{params[:type]}.create(params)\")\n self.approval ||= StudyPlanApproval.create\n self.approval.update_attribute(\"#{params[:type].underscore}_id\", statement.id)\n if statement.is_a?(LeaderStatement) && !approval.tutor_statement\n approval.tutor_statement =\n TutorStatement.create(statement.attributes)\n end\n if statement.cancel?\n cancel!\n elsif statement.is_a?(DeanStatement)\n approve!\n end\n save\n end", "def create\n @customer = Customer.new(customer_params)\n if current_user.role == 'Party'\n @customer.update!(:party_id => current_user.party.id) \n redirect_to customers_path\n else\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end\nend", "def create\n @api_v1_mentorship_interest = Api::V1::MentorshipInterest.new(api_v1_mentorship_interest_params)\n\n respond_to do |format|\n if @api_v1_mentorship_interest.save\n format.html { redirect_to @api_v1_mentorship_interest, notice: 'Mentorship interest was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_mentorship_interest }\n else\n format.html { render :new }\n format.json { render json: @api_v1_mentorship_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def vacation_approver_params\n params.require(:vacation_approver).permit(:employee_id, :cancel_url, :redirect_url)\n end", "def update\n respond_to do |format|\n if @approval.update(approval_params)\n format.html { redirect_to @approval, notice: 'Approval was successfully updated.' }\n format.json { render :show, status: :ok, location: @approval }\n else\n format.html { render :edit }\n format.json { render json: @approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def gov_proposals_proposal_id_votes_post_with_http_info(proposal_id, post_vote_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: GovernanceApi.gov_proposals_proposal_id_votes_post ...'\n end\n # verify the required parameter 'proposal_id' is set\n if @api_client.config.client_side_validation && proposal_id.nil?\n fail ArgumentError, \"Missing the required parameter 'proposal_id' when calling GovernanceApi.gov_proposals_proposal_id_votes_post\"\n end\n # verify the required parameter 'post_vote_body' is set\n if @api_client.config.client_side_validation && post_vote_body.nil?\n fail ArgumentError, \"Missing the required parameter 'post_vote_body' when calling GovernanceApi.gov_proposals_proposal_id_votes_post\"\n end\n # resource path\n local_var_path = '/gov/proposals/{proposalId}/votes'.sub('{' + 'proposalId' + '}', proposal_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(post_vote_body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StdTx')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GovernanceApi#gov_proposals_proposal_id_votes_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_submit_rent\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: '123456',\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n post :new, params_hash\n assert_response 200\n\n quote = Agents::Branches::AssignedAgents::Quote.last\n ### Now lets submit the quote\n post :submit, { udprn: '123456', quote_id: quote.id }\n response = Oj.load(@response.body)\n assert_response 200\n assert_equal response['message'], 'The quote is accepted'\n end", "def approve(request_id)\n @client.make_request :post,\n requests_path('approve'),\n request_id: request_id\n end", "def expression_of_interest_params\n params.require(:expression_of_interest).permit(:sponsor_id, :opportunity_id, :approved)\n end", "def update\n @pokeparty = Pokeparty.find(params[:id])\n\n respond_to do |format|\n if @pokeparty.update_attributes(params[:pokeparty])\n format.html { redirect_to @pokeparty, notice: 'Pokeparty was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pokeparty.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_pre_approval(account = nil)\n params = Serializer.new(self).to_params\n response = post('/pre-approvals/request', API_V2 ,account, params).parsed_response\n code = response['preApprovalRequest']['code']\n \n PagSeguro.redirect_url(API_V2) + \"/pre-approvals/request.html?code=#{code}\"\n end", "def counterparty_params\n params.require(:counterparty).permit(:company_full_name, :company_short_name, :signatory_person, :signatory_person_genitive, :signatory_basis, :signatory_basis_genitive, :inn, :kpp, :ogrn, :legal_address, :real_address, :post_address, :phone, :email)\n end", "def create\n @person = Person.new(person_params)\n @agreement = Agreement.last\n @person.skip_validation = false\n respond_to do |format|\n if @person.save\n @person.agreements << Agreement.last\n if current_user\n if current_user.user?\n current_user.person_id = @person.id\n current_user.save\n end\n end\n format.html { redirect_to @person, notice: 'Uppgifterna lades till. Tack.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @party_relationship_type = PartyRelationshipType.new(party_relationship_type_params)\n\n respond_to do |format|\n if @party_relationship_type.save\n format.html { redirect_to @party_relationship_type, notice: 'Party relationship type was successfully created.' }\n format.json { render :show, status: :created, location: @party_relationship_type }\n else\n format.html { render :new }\n format.json { render json: @party_relationship_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opportunity = Opportunity.new(params[:opportunity])\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render json: @opportunity, status: :created, location: @opportunity }\n else\n @supplier_accounts = SupplierAccount.approved.order 'fantasy_name'\n \n format.html { render action: \"new\" }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def enemy_party_info_params\n params.require(:enemy_party_info).permit(:result_no, :generate_no, :party_no, :enemy_num)\n end", "def party_name_params\n params.require(:party_name).permit(:party, :name, :start_date, :end_date)\n end", "def set_party\n @party = Party.find(params[:party_id])\n end", "def create\n @book_approval = BookApproval.new(book_approval_params)\n\n respond_to do |format|\n if @book_approval.save\n format.html { redirect_to @book_approval, notice: 'Book approval was successfully created.' }\n format.json { render :show, status: :created, location: @book_approval }\n else\n format.html { render :new }\n format.json { render json: @book_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @party = Party.new(params[:party])\n if @party.partyname.blank?\n @party.partyname = @party.partyfirstname + \" \" +@party.partylastname\n end\n if @party.ship_address1.blank? || @party.ship_address1.nil?\n @party.ship_address1 = @party.partyaddress1\n @party.ship_address2 = @party.partyaddress2\n @party.ship_city = @party.partycity\n @party.ship_state = @party.partystate\n @party.ship_postalcode = @party.partypostalcode\n @party.ship_phone = @party.partyphone\n end\n \n if @party.rate_hour.nil?\n @party.rate_hour = 0\n end\n if @party.charge_hour.nil?\n @party.charge_hour = 0\n end\n \n @party.user_id = session[:s_user_id]\n \t session[:s_user_email] = nil\n \t \n \t if session[:s_is_new_user] == true\n \t @party.system_user_id = session[:s_user_id]\n \t else\n \t @party.system_user_id = 0\n \t end\n\n respond_to do |format|\n if @party.save\n if session[:s_is_new_user] == true\n #updateuser(@party.id) - deprecated\n session[:s_is_new_user] = false \n end\n \n format.html { redirect_to(\"/partyview\", :notice => 'Party was successfully created.') }\n format.xml { render :xml => @party, :status => :created, :location => @party }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @party.errors, :status => :unprocessable_entity }\n end\n end\n end", "def approve_setup_fee_collection( current_user )\n self.is_setup_fee_collection_approved = true \n self.setup_fee_collection_approver_id = current_user.id \n self.save\n \n # create all those payment payable : loan disbursement \n end", "def lanparty_params\n params.require(:lanparty).permit(:partyname, :address, :city, :startdate, :enddate, :description, :game_ids => [])\n end", "def paid\n #if @notification.acknowledge # check if it’s genuine Robokassa request\n #@user.approve! # project-specific code\n render :text => @notification.success_response\n @user.approve!\n #else\n #head :bad_request\n #end\n end", "def update_approvals_needed(team_id)\n team = Team.find(team_id)\n num_of_members = team.users.size\n accounts = team.accounts\n accounts.update_all(approvals_needed: num_of_members)\n end" ]
[ "0.69791937", "0.6520171", "0.6458408", "0.63690704", "0.6335551", "0.6312647", "0.62580043", "0.6023837", "0.5969117", "0.5886409", "0.58461154", "0.5826825", "0.58157295", "0.5810201", "0.578843", "0.57762676", "0.576642", "0.57582396", "0.5749369", "0.5747433", "0.572701", "0.57203764", "0.57195127", "0.5675528", "0.56560886", "0.5648562", "0.5600469", "0.5560112", "0.55540246", "0.5537798", "0.55234784", "0.54845965", "0.5481947", "0.54540586", "0.5433648", "0.54107136", "0.5405793", "0.53723395", "0.5352333", "0.53478664", "0.5341168", "0.5331901", "0.5322702", "0.53221995", "0.5314285", "0.53042966", "0.5288924", "0.5288754", "0.52813363", "0.527822", "0.5274988", "0.52625126", "0.52539736", "0.52480197", "0.52467626", "0.52419144", "0.5240876", "0.52363217", "0.5219893", "0.5218206", "0.52136064", "0.5200852", "0.52000487", "0.5183335", "0.5181062", "0.5169723", "0.5165474", "0.51650506", "0.51605326", "0.5150114", "0.51481336", "0.5125354", "0.51206315", "0.5115326", "0.5101114", "0.50998765", "0.5098579", "0.50870365", "0.5079565", "0.5078119", "0.5075646", "0.5073888", "0.5070856", "0.5068433", "0.50684255", "0.506562", "0.5058799", "0.5057007", "0.5051571", "0.5050025", "0.50399745", "0.5033671", "0.5032929", "0.50297856", "0.50295985", "0.50251466", "0.5024544", "0.50186193", "0.50150967", "0.50020504" ]
0.6896017
1
PATCH/PUT /party_approvals/1 or /party_approvals/1.json
def update respond_to do |format| if @party_approval.update(party_approval_params) format.html { redirect_to @party_approval, notice: 'Party approval was successfully updated.' } format.json { render :show, status: :ok, location: @party_approval } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @party_approval.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_party_approval\n @party_approval = PartyApproval.find(params[:id])\n end", "def update\n respond_to do |format|\n if @political_party.update(political_party_params)\n format.html { redirect_to @political_party, notice: 'Political party was successfully updated.' }\n format.json { render :show, status: :ok, location: @political_party }\n else\n format.html { render :edit }\n format.json { render json: @political_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @party = Party.find(params[:id])\n\n respond_to do |format|\n if @party.update_attributes(params[:party])\n format.html { redirect_to @party, notice: 'Party was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pokeparty = Pokeparty.find(params[:id])\n\n respond_to do |format|\n if @pokeparty.update_attributes(params[:pokeparty])\n format.html { redirect_to @pokeparty, notice: 'Pokeparty was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pokeparty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @party.update(party_params)\n format.html { redirect_to @party, notice: 'Party was successfully updated.' }\n format.json { render :show, status: :ok, location: @party }\n else\n format.html { render :edit }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget_approver.update(budget_approver_params)\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_approver }\n else\n format.html { render :edit }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @politician_approval.update(politician_approval_params)\n format.html { redirect_to @politician_approval, notice: 'Politician approval was successfully updated.' }\n format.json { render :show, status: :ok, location: @politician_approval }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @politician_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def party_approval_params\n params.require(:party_approval).permit(:user, :party, :approval)\n end", "def update\n respond_to do |format|\n if @approval.update(approval_params)\n format.html { redirect_to @approval, notice: 'Approval was successfully updated.' }\n format.json { render :show, status: :ok, location: @approval }\n else\n format.html { render :edit }\n format.json { render json: @approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_merge_request_approvals(project, merge_request, options = {})\n post(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals\", body: options)\n end", "def update\n\n params[:requirement][:industry_ids] ||= []\n if params['Submit_for_Approval']\n @requirement.status = 'Submitted'\n end\n if params[:requirement][:status] == \"Rejected\"\n Requirement.destroy(params[:id])\n redirect_to requirements_path\n else\n respond_to do |format|\n if @requirement.update_attributes(params[:requirement])\n if (params['Submit_for_Approval']) and (@requirement.status != 'Submitted')\n flash[:error] = 'Could not submit requirement for approval'\n end\n format.html { redirect_to @requirement, notice: 'Requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def add_approver\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get approvers not already assigned to the contract\n @approvers = @client.unassigned_approvers_for_contract(@contract)\n\n end", "def update\n @electronic_approval = ElectronicApproval.find(params[:id])\n\n respond_to do |format|\n if @electronic_approval.update_attributes(params[:electronic_approval])\n format.html { redirect_to @electronic_approval, notice: 'Electronic approval was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @electronic_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def politician_approval_params\n params.require(:politician_approval).permit(:user, :party, :approval)\n end", "def update\n respond_to do |format|\n if @previous_party.update(previous_party_params)\n format.html { redirect_to @previous_party, notice: 'Previous party was successfully updated.' }\n format.json { render :show, status: :ok, location: @previous_party }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @previous_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @party_record = PartyRecord.find(params[:id])\n\n respond_to do |format|\n if @party_record.update_attributes(params[:party_record])\n format.html { redirect_to @party_record, notice: 'Party record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @party_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def approve\n return render_json_forbidden(:unknown_keeper) if @keeper.nil?\n return render_json_forbidden(:company_not_present) if @keeper.company.nil?\n\n @company = @keeper.company\n\n if @company.update(approved: true)\n render_json\n else\n render_json_unprocessable(error: :invalid, issues: @company.errors.details)\n end\n end", "def update!(**args)\n @third_party_claims = args[:third_party_claims] if args.key?(:third_party_claims)\n end", "def update\n respond_to do |format|\n if @party.update(party_params)\n format.html { redirect_to @party, notice: '編集しました。' }\n format.json { render :show, status: :ok, location: @party }\n else\n format.html { render :edit }\n format.json { render json: @party.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n if @early_pregnancy.update_attributes(params[:early_pregnancy])\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @m_approval = MApproval.find(params[:id])\n\n respond_to do |format|\n if @m_approval.update_attributes(params[:m_approval])\n format.html { redirect_to :controller => \"m_approvals\", :action => \"index\" }\n #format.html { redirect_to @m_approval }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @m_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def update *reqs\n fire :updating, :updated do\n @environments |= @sandbox.environments\n @options.merge! reqs.pop if Hash === reqs.last\n @requirement = Gem::Requirement.new reqs unless reqs.empty?\n end\n\n self\n end", "def update\n redirect_to root_path, alert: \"You are not authorised to view that page.\" unless current_member.is_admin?\n unless request.get?\n if params[:commit] == \"Reject Request\"\n @order.update(approver: current_member, deadline: Time.now, returned: true)\n redirect_to club_path(current_member.club), notice: \"The Order Request was rejected successfully.\"\n else\n @order.update(approver: current_member, deadline: params[:order][:deadline], returned: false, approved_at: Time.current)\n redirect_to club_path(current_member.club), notice: \"The Order Request was accepted successfully.\"\n end\n end\n end", "def update\n @id_proof = IdProof.find(params[:id])\n\n respond_to do |format|\n if @id_proof.update_attributes(params[:id_proof])\n format.html { redirect_to @id_proof, notice: 'Id proof was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @id_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def merge_request_approvals(project, merge_request)\n get(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals\")\n end", "def update\n @approval = Approval.find(params[:id])\n\n respond_to do |format|\n if @approval.update_attributes(params[:approval])\n flash[:notice] = 'Approval was successfully updated.'\n format.html { redirect_to(@approval) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @approval.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @counterparty.update(counterparty_params)\n format.html { redirect_to @counterparty, notice: \"Counterparty was successfully updated.\" }\n format.json { render :show, status: :ok, location: @counterparty }\n else\n format.html { render :edit }\n format.json { render json: @counterparty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opportunity = Opportunity.find(params[:id])\n\n respond_to do |format|\n if @opportunity.update_attributes(params[:opportunity])\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully updated.' }\n format.json { head :ok }\n else\n @supplier_accounts = SupplierAccount.approved.order 'fantasy_name'\n \n format.html { render action: \"edit\" }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_approvals_needed(team_id)\n team = Team.find(team_id)\n num_of_members = team.users.size\n accounts = team.accounts\n accounts.update_all(approvals_needed: num_of_members)\n end", "def update\n authorize @employment\n respond_to do |format|\n\n if @employment.update(employment_params)\n format.html { redirect_to openings_path, notice: 'Employment was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment }\n else\n format.html { redirect_to openings_path }\n format.json { render json: @employment.errors, status: :unprocessable_entity }\n end\n end\n end", "def assign_approver\n if approver == \"1\"\n document.approver = user\n document.save!\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @req.update(req_params)\n flash[:notice] = \"Your requirement has been saved\"\n format.html { redirect_to @req }\n format.json { render :show, status: :ok, location: @req }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget_approver\n @budget_approver = BudgetApprover.find(params[:id])\n end", "def update\n respond_to do |format|\n if @funding_requirement.update(funding_requirement_params)\n format.html { redirect_to @funding_requirement, notice: 'Funding requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @approval = Approval.find(params[:id])\n\n respond_to do |format|\n if @approval.update_attributes(params[:approval])\n format.html { redirect_to root_path, notice: 'Thanks for Approving/Declining the Recommendation' }\n else\n format.html { render action: \"show\" }\n end\n end\n end", "def update\n @partyrelationship = Partyrelationship.find(params[:id])\n\n respond_to do |format|\n if @partyrelationship.update_attributes(params[:partyrelationship])\n format.html { redirect_to(@partyrelationship, :notice => 'Partyrelationship was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @partyrelationship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n if @tenancy_agreement.update_attributes(params[:tenancy_agreement])\n format.html { redirect_to tenancy_agreements_path, notice: 'Tenancy agreement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenancy_agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n if @person_interest.update_attributes(params[:person_interest])\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @party_name.update(party_name_params)\n format.html { redirect_to @party_name, notice: 'Party name was successfully updated.' }\n format.json { render :show, status: :ok, location: @party_name }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @party_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_mentorship_interest.update(api_v1_mentorship_interest_params)\n format.html { redirect_to @api_v1_mentorship_interest, notice: 'Mentorship interest was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_mentorship_interest }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_mentorship_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_object_approver\n @object_approver = ObjectApprover.find(params[:id])\n end", "def update\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n if params[:patent][:research_areas]\n research_area = ResearchArea.find(params[:patent][:research_areas].to_i)\n @patent.research_areas << research_area\n @patent.save\n format.json { render json: research_area }\n elsif @patent.update_attributes(params[:patent])\n format.html { redirect_to @patent, notice: 'Patent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n\n if @service_level_agreement.update_attributes(params[:service_level_agreement])\n render :json => {:success => true}\n else\n render :json => {:success => false, :message => @service_level_agreement.errors.full_messages.join(\". \") }\n end\n end", "def update\n respond_to do |format|\n if @politically_exposed_person.update(politically_exposed_person_params)\n format.html { redirect_to politically_exposed_people_url,\n notice: 'Politically exposed person was successfully updated.' }\n format.json { render :show, status: :ok, location: @politically_exposed_person }\n else\n format.html { render :edit }\n format.json { render json: @politically_exposed_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @party = Party.find(params[:id])\n @setweather = false\n \n if params[:party][:partyname].blank?\n params[:party][:partyname] = params[:party][:partyfirstname] + \" \" + params[:party][:partylastname]\n end\n #logger.debug \"WEATHER PARTY *** #{@party.inspect}\" \n if @party.partyweatherpostalcode != params{:partyweatherpostalcode}\n if !params{:partyweatherpostalcode}.nil?\n @setweather = true\n end\n end\n\n respond_to do |format|\n if @party.update_attributes(params[:party])\n \n if @setweather == true\n Party.get_weather(session[:s_user_id])\n end\n \n format.html { redirect_to(\"/partyview\" , :notice => 'Party was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @party.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident_proof.update(incident_proof_params)\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_proof }\n else\n format.html { render :edit }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @warranty.update(warranty_params)\n format.html { redirect_to @warranty, notice: 'Warranty was successfully updated.' }\n format.json { respond_with_bip(@warranty) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@warranty) }\n end\n end\n end", "def update\n respond_to do |format|\n if @party_relationship_type.update(party_relationship_type_params)\n format.html { redirect_to @party_relationship_type, notice: 'Party relationship type was successfully updated.' }\n format.json { render :show, status: :ok, location: @party_relationship_type }\n else\n format.html { render :edit }\n format.json { render json: @party_relationship_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @partytype = Partytype.find(params[:id])\n\n respond_to do |format|\n if @partytype.update_attributes(params[:partytype])\n format.html { redirect_to(@partytype, :notice => 'Partytype was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @partytype.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @approval_process = ApprovalProcess.find(params[:id])\n\n respond_to do |format|\n if @approval_process.update_attributes(params[:approval_process])\n format.html { redirect_to @approval_process, :notice => 'Approval process was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @approval_process.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @party_list.update(party_list_params)\n format.html { redirect_to @party_list, notice: 'Party list was successfully updated.' }\n format.json { render :show, status: :ok, location: @party_list }\n else\n format.html { render :edit }\n format.json { render json: @party_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_approvals_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApprovalsApi.create_approvals ...'\n end\n # resource path\n local_var_path = '/api/v1/approvals'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_approvals_input'] || opts[:body])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Approval'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"ApprovalsApi.create_approvals\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApprovalsApi#create_approvals\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @first_party_principal = args[:first_party_principal] if args.key?(:first_party_principal)\n @third_party_principal = args[:third_party_principal] if args.key?(:third_party_principal)\n end", "def update\n respond_to do |format|\n if @book_approval.update(book_approval_params)\n format.html { redirect_to @book_approval, notice: 'Book approval was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_approval }\n else\n format.html { render :edit }\n format.json { render json: @book_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # this action is not provided for partyroles\n end", "def update!(**args)\n @approved = args[:approved] if args.key?(:approved)\n end", "def create\n @party_approval = PartyApproval.new(party_approval_params)\n\n respond_to do |format|\n if @party_approval.save\n format.html { redirect_to @party_approval, notice: 'Party approval was successfully created.' }\n format.json { render :show, status: :created, location: @party_approval }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @party_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employment_contract.update(employment_contract_params)\n format.html { redirect_to request_steps_path, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_contract }\n else\n format.html { render :edit }\n format.json { render json: @employment_contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def approval_params\n params.require(:approval).permit(:policy_resolution_id, :approval_type, :approver_id, :approved, :remarks)\n end", "def update\n @party_type = PartyType.find(params[:id])\n\n respond_to do |format|\n if @party_type.update_attributes(params[:party_type])\n flash[:notice] = 'PartyType was successfully updated.'\n format.html { redirect_to(@party_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @party_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_politician_approval\n @politician_approval = PoliticianApproval.find(params[:id])\n end", "def update!(**args)\n @access = args[:access] if args.key?(:access)\n @explained_policies = args[:explained_policies] if args.key?(:explained_policies)\n end", "def update!(**args)\n @access = args[:access] if args.key?(:access)\n @explained_policies = args[:explained_policies] if args.key?(:explained_policies)\n end", "def update\n respond_to do |format|\n if @company_investor.update(company_investor_params)\n format.html { redirect_to @company_investor, notice: 'Company investor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company_investor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proposed_person = ProposedPerson.find(params[:id])\n\n respond_to do |format|\n if @proposed_person.update_attributes(params[:proposed_person])\n flash[:notice] = 'ProposedPerson was successfully updated.'\n format.html { redirect_to(@proposed_person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @proposed_person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n authorize @objective.strategy, :update_objective?\n respond_to do |format|\n if @objective.update(objective_params)\n format.html { redirect_to @objective}\n format.json { render :show, status: :ok, location: @objective }\n else\n format.html { render :edit }\n format.json { render json: @objective.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @counterparty = Counterparty.find(params[:id])\n\n respond_to do |format|\n if @counterparty.update_attributes(params[:counterparty])\n flash[:notice] = 'Counterparty was successfully updated.'\n format.html { redirect_to(@counterparty) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @counterparty.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proof_sale.update(proof_sale_params)\n format.html { redirect_to @proof_sale, notice: 'Proof sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @proof_sale }\n else\n format.html { render :edit }\n format.json { render json: @proof_sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pre_payment_req.update(pre_payment_req_params)\n format.html { redirect_to @pre_payment_req, notice: 'Pre payment req was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_payment_req }\n else\n format.html { render :edit }\n format.json { render json: @pre_payment_req.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lanparty.update(lanparty_params)\n format.html { redirect_to @lanparty, notice: 'Lanparty was successfully updated.' }\n format.json { render :show, status: :ok, location: @lanparty }\n else\n format.html { render :edit }\n format.json { render json: @lanparty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proof_cost = ProofCost.find(params[:id])\n\n respond_to do |format|\n if @proof_cost.update_attributes(params[:proof_cost])\n format.html { redirect_to @proof_cost, notice: 'Proof cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proof_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_approver(approver_email)\n first_approval = self.proposal.approvals.first\n if first_approval.user_email_address != approver_email\n first_approval.destroy\n replacement = self.proposal.add_approver(approver_email)\n replacement.move_to_top\n end\n end", "def update!(**args)\n @client_ids_allowed = args[:client_ids_allowed] if args.key?(:client_ids_allowed)\n @is_editorial = args[:is_editorial] if args.key?(:is_editorial)\n @modifications_allowed = args[:modifications_allowed] if args.key?(:modifications_allowed)\n @regions_allowed = args[:regions_allowed] if args.key?(:regions_allowed)\n @regions_disallowed = args[:regions_disallowed] if args.key?(:regions_disallowed)\n @requires_attribution = args[:requires_attribution] if args.key?(:requires_attribution)\n @requires_first_party_only = args[:requires_first_party_only] if args.key?(:requires_first_party_only)\n @requires_linkback = args[:requires_linkback] if args.key?(:requires_linkback)\n @requires_share_alike = args[:requires_share_alike] if args.key?(:requires_share_alike)\n end", "def update\n @client_org_orderable = ClientOrgOrderable.find(params[:id])\n\n respond_to do |format|\n if @client_org_orderable.update_attributes(params[:client_org_orderable])\n format.html { redirect_to @client_org_orderable, notice: 'Client org orderable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_org_orderable.errors, status: :unprocessable_entity }\n end\n end\n end", "def budget_approver_params\n params.fetch(:budget_approver, {})\n end", "def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end", "def approval_params\r\n # params.fetch(:approval, {})\r\n params.require(:approval).permit(:approval_type, :date, :approval_no, :sub_type, :description, :standard, :reference, :effective_date, :expiry_date, :status, :notes, :approval_doc, product_ids: [])\r\n end", "def update\n @order_pick = OrderPick.find(params[:id])\n\n respond_to do |format|\n if @order_pick.update_attributes(params[:order_pick])\n format.html { redirect_to @order_pick, notice: 'Order pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_pick.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update\n standard_update(Interest, params[:id], interest_params)\n end", "def update\n @project_prereq = ProjectPrereq.find(params[:id])\n\n respond_to do |format|\n if @project_prereq.update_attributes(params[:project_prereq])\n format.html { redirect_to(@project_prereq, :notice => 'Project prereq was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project_prereq.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 @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\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pay_agreement.update(pay_agreement_params)\n format.html { redirect_to [@fee, @pay_agreement], notice: 'Pay agreement was successfully updated.' }\n format.json { render :show, status: :ok, location: @pay_agreement }\n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @pay_agreement.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end" ]
[ "0.6594875", "0.6508229", "0.64911336", "0.6352692", "0.6327853", "0.63191134", "0.62818646", "0.6247028", "0.6158167", "0.6094758", "0.6075864", "0.60524327", "0.6009123", "0.5998709", "0.598375", "0.59671915", "0.58947796", "0.5890873", "0.58388966", "0.58255935", "0.58211356", "0.5819004", "0.5815473", "0.5793675", "0.5783882", "0.5768285", "0.5764087", "0.5756331", "0.57474357", "0.57468873", "0.5742234", "0.57407767", "0.5737542", "0.5734412", "0.57309324", "0.571544", "0.5708349", "0.5706097", "0.5699767", "0.5693858", "0.5678578", "0.5678134", "0.56741965", "0.564406", "0.56399655", "0.5639842", "0.5635407", "0.56341016", "0.560433", "0.56017184", "0.5597446", "0.5592754", "0.55888796", "0.55871046", "0.5585595", "0.55825657", "0.5572632", "0.5564195", "0.55615294", "0.5561095", "0.55494726", "0.55406094", "0.55385906", "0.5537783", "0.5529458", "0.5528405", "0.5528405", "0.55254894", "0.5524044", "0.5512982", "0.5512621", "0.5504217", "0.55015814", "0.5495349", "0.54942656", "0.549392", "0.5491447", "0.5484672", "0.547451", "0.5473036", "0.5472412", "0.5471283", "0.54692864", "0.54689866", "0.5467878", "0.5463044", "0.5459337", "0.5459337", "0.5459337", "0.5459337", "0.5459337", "0.5459337", "0.5459337", "0.5459337", "0.54574966", "0.5455699", "0.54537517", "0.5453225", "0.54462606", "0.5445231" ]
0.7152015
0
DELETE /party_approvals/1 or /party_approvals/1.json
def destroy @party_approval.destroy respond_to do |format| format.html { redirect_to party_approvals_url, notice: 'Party approval was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_approver\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # find the approver\n @approver = User.find(params[:user_id])\n\n # double check use is an approver\n if @contract.is_approver?(@approver)\n\n # delete them from the list\n @contract.approver_users.delete(@approver)\n \n end\n \n redirect_to edit_client_contract_path(@client, @contract)\n \n end", "def destroy\n @approval = Approval.find(params[:id])\n @approval.destroy\n\n respond_to do |format|\n format.html { redirect_to approvals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @electronic_approval = ElectronicApproval.find(params[:id])\n @electronic_approval.destroy\n\n respond_to do |format|\n format.html { redirect_to electronic_approvals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget_approver.destroy\n respond_to do |format|\n format.html { redirect_to budget_approvers_url, notice: 'Budget approver page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @party = Party.find(params[:id])\n @party.destroy\n\n respond_to do |format|\n format.html { redirect_to parties_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @m_approval = MApproval.find(params[:id])\n @m_approval.destroy\n \n respond_to do |format|\n format.html { redirect_to m_approvals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @approval = Approval.find(params[:id])\n @approval.destroy\n\n respond_to do |format|\n format.html { redirect_to(approvals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @approval.destroy\n respond_to do |format|\n format.html { redirect_to approvals_url, notice: 'Approval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @politician_approval.destroy\n respond_to do |format|\n format.html { redirect_to politician_approvals_url, notice: 'Politician approval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n @service_level_agreement.destroy\n\n render :json => {:success => true}\n end", "def destroy\n @pokeparty = Pokeparty.find(params[:id])\n @pokeparty.destroy\n\n respond_to do |format|\n format.html { redirect_to pokeparties_url }\n format.json { head :ok }\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 @party.destroy\n respond_to do |format|\n format.html { redirect_to parties_url, notice: 'Party was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @party.destroy\n respond_to do |format|\n format.html { redirect_to parties_url, notice: 'Party was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @party = Party.find(params[:id])\n begin\n @party.destroy \n rescue ActiveRecord::DeleteRestrictionError => e\n @party.errors.add(:base, e)\n end \n respond_to do |format|\n\n if e.nil?\n \n format.html { redirect_to(\"/partyview\", :notice => 'party was successfully deleted.') }\n format.xml { head :ok }\n else \n format.html { render :action => \"edit\" }\n end\n \n \n end\n end", "def delete_and_give_me_a_json(additional_path, params = nil)\n if self.service_base_path != nil\n if params == nil\n params = Hash.new\n end\n params[:api_key] = self.access_token\n message = self.http_client.delete \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json\", params\n trata_erro(message.content)\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @id_proof = IdProof.find(params[:id])\n @id_proof.destroy\n\n respond_to do |format|\n format.html { redirect_to id_proofs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n @tenancy_agreement.destroy\n\n respond_to do |format|\n format.html { redirect_to tenancy_agreements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @political_party.destroy\n respond_to do |format|\n format.html { redirect_to political_parties_url, notice: 'Political party was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @party.destroy\n respond_to do |format|\n format.html { redirect_to parties_url, notice: '削除しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @funding_requirement.destroy\n respond_to do |format|\n format.html { redirect_to funding_requirements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @partyrelationship = Partyrelationship.find(params[:id])\n @partyrelationship.destroy\n\n respond_to do |format|\n format.html { redirect_to(partyrelationships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @partyrole = Partyrole.find(params[:id])\n @partyrole.destroy\n\n respond_to do |format|\n format.html { redirect_to(partyroles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @partyrole = Partyrole.find(params[:id])\n @partyrole.destroy\n\n respond_to do |format|\n format.html { redirect_to(partyroles_url) }\n format.xml { head :ok }\n end\n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @party_list.destroy\n respond_to do |format|\n format.html { redirect_to party_lists_url, notice: 'Party list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n # Read the configuration from DynamoDB \n db = AWS::DynamoDB.new\n table = db.tables[CONFIGS[:db][:party_configs][:table]]\n table.hash_key = [:party_id, :string]\n item = table.items[id]\n return false if (!item.exists?)\n item.delete\n return true\n end", "def destroy\n @person_interest = PersonInterest.find(params[:id])\n @person_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to person_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @previous_party.destroy\n respond_to do |format|\n format.html { redirect_to previous_parties_url, notice: 'Previous party was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_investor.destroy\n respond_to do |format|\n format.html { redirect_to company_investors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_mentorship_interest.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_mentorship_interests_url, notice: 'Mentorship interest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @party_type = PartyType.find(params[:id])\n @party_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(party_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @individual_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to individual_company_investments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @partytype = Partytype.find(params[:id])\n @partytype.destroy\n\n respond_to do |format|\n format.html { redirect_to(partytypes_url) }\n format.xml { head :ok }\n end\n end", "def delete_pathway\n pathway = Pathway.find(params[:pathway_par])\n current_user.pathways.delete(pathway)\n if current_user.pathways.size < 1\n respond_to do |format|\n format.html { redirect_to '/saved#pathways' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @loyalty_scheme = current_user.loyalty_schemes.find(params[:id])\n @loyalty_scheme.destroy\n \n respond_to do |format|\n format.html { redirect_to loyalty_schemes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_org_orderable = ClientOrgOrderable.find(params[:id])\n @client_org_orderable.destroy\n\n respond_to do |format|\n format.html { redirect_to client_org_orderables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @proof_cost = ProofCost.find(params[:id])\n @proof_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to proof_costs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @approval_process = ApprovalProcess.find(params[:id])\n @approval_process.destroy\n\n respond_to do |format|\n format.html { redirect_to approval_processes_url }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n @early_pregnancy.destroy\n\n respond_to do |format|\n format.html { redirect_to early_pregnancies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @agreement_renewal.destroy\n respond_to do |format|\n format.html { redirect_to agreement_renewals_url, notice: 'Agreement renewal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fund_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to fund_company_investments_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @org = Org.from_param(params[:abbr])\r\n @org.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to orgs_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def remove_interest\n @interest = Interest.where(\"user_id = ? and property_id= ?\",params[:user_id],params[:property_id])\n @interest.first.destroy\n\n respond_to do |format|\n format.html { redirect_to interests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @company_policy_item = CompanyPolicyItem.find(params[:id])\n company_policy = @company_policy_item.company_policy\n @company_policy_item.destroy\n\n respond_to do |format|\n format.html { redirect_to client_company_policy_company_policy_items_path(client_id: company_policy.client_id, company_policy_id: company_policy_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_area_interest.destroy\n respond_to do |format|\n format.html { redirect_to project_area_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @agency.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: 'Agency was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @objective.strategy\n @objective.destroy\n respond_to do |format|\n format.html { redirect_to objectives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @counterparty = Counterparty.find(params[:id])\n @counterparty.destroy\n\n respond_to do |format|\n format.html { redirect_to(counterparties_url) }\n format.xml { head :ok }\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 delete(*rest) end", "def destroy\n @incident_proof.destroy\n respond_to do |format|\n format.html { redirect_to incident_proofs_url, notice: 'Incident proof was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end", "def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n party = Party.find(params[:id])\n party.destroy\n redirect_to order_tickets_path\n end", "def delete_project_merge_request_approval_rule(project, approval_rule_id)\n delete(\"/projects/#{url_encode project}/approval_rules/#{approval_rule_id}\")\n end", "def destroy\n @api_v1_initiative_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_updates_url, notice: 'Initiative update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @persons_release = PersonsRelease.find(params[:id])\n @persons_release.destroy\n\n respond_to do |format|\n format.html { redirect_to persons_releases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pay_agreement.destroy\n respond_to do |format|\n format.html { redirect_to fee_pay_agreements_path(@fee), notice: 'Pay agreement was successfully destroyed.' }\n format.json { head :no_content }\n format.js { }\n end\n end", "def destroy\n @agreement.destroy\n respond_to do |format|\n format.html { redirect_to agreements_url, notice: 'Agreement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @proposed_person = ProposedPerson.find(params[:id])\n @proposed_person.destroy\n\n respond_to do |format|\n format.html { redirect_to(proposed_people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end", "def destroy\n @party_name.destroy\n respond_to do |format|\n format.html { redirect_to party_names_url, notice: 'Party name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @match_requirement.destroy\n respond_to do |format|\n format.html { redirect_to match_requirements_url, notice: 'Match requirement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cancelReservation(lease_uuid)\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s \n cert_path = APP_CONFIG['cert_path']\n \n header = {\"Content-Type\" => \"application/json\"}\n options = {uuid: lease_uuid}\n\n #puts options.to_json \n uri = URI.parse(broker_url+\"/resources/leases\")\n pem = File.read(cert_path)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.cert = OpenSSL::X509::Certificate.new(pem)\n http.key = OpenSSL::PKey::RSA.new(pem)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Delete.new(uri.request_uri, header)\n request.body = options.to_json\n\n response = http.request(request)\n puts response\n if response.header.code != '200'\n puts \"Something went wrong\"\n puts response\n end\n end", "def destroy\n @expense = current_user.organization.expenses.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @governor = Governor.find(params[:id])\n @governor.destroy\n\n respond_to do |format|\n format.html { redirect_to governors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @part_company = PartCompany.find(params[:id])\n @part_company.destroy\n\n respond_to do |format|\n format.html { redirect_to part_companies_url }\n format.json { head :ok }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n\n # Save the capital project\n capital_project = @funding_request.activity_line_item.capital_project\n @funding_request.destroy\n notify_user(:notice, \"The Funding Request was successfully removed from ALI #{@activity_line_item.name}.\")\n\n # Check to see if the capital project status needs to change after removing\n # the funding request\n if capital_project.funding_difference != 0\n capital_project.save\n end\n\n respond_to do |format|\n format.html { redirect_to capital_project_activity_line_item_url(@project, @activity_line_item) }\n format.json { head :no_content }\n end\n end", "def destroy\n @policy.destroy\n respond_to do |format|\n format.html { redirect_to policys_url }\n format.json { render json: { status: 200 } }\n end\n end", "def destroy\n @project = @req.project\n if owner_or_admin_obj? @req, @project #or (current_user.id and @req.user_id == current_user.id) or (@project.sandbox == true and @project.key == session[:project_key])\n @req.runs.map{|r| RunsController.destroy_run_call @req.project, r}\n @req.destroy\n respond_to do |format|\n format.html { redirect_to reqs_url, notice: 'Req was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @counterparty.destroy\n respond_to do |format|\n format.html { redirect_to counterparties_url, notice: \"Counterparty was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @fp7_contractor.destroy\n respond_to do |format|\n format.html { redirect_to fp7_contractors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_release = ClientRelease.find(params[:id])\n @client_release.destroy\n\n respond_to do |format|\n format.html { redirect_to client_releases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @partnership.destroy\n respond_to do |format|\n format.html { redirect_to partnerships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @compromise = Compromise.find(params[:id])\n @compromise.destroy\n\n respond_to do |format|\n format.html { redirect_to compromises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @extended_warranty = ExtendedWarranty.find(params[:id])\n @extended_warranty.destroy\n\n respond_to do |format|\n format.html { redirect_to extended_warranties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @walkathon_pledge.destroy\n respond_to do |format|\n format.html { redirect_to walkathon_pledges_url, notice: 'Pledge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n objective_id = params[:id]\n team_id = params[:okr_team_id]\n status = TeamObjective.delete_team_objective(objective_id)\n respond_to do |format|\n if status == 200\n format.html { redirect_to \"/team/#{team_id}/team_objectives/team_dashboard/\", \n notice: 'Team objective was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to \"/team/#{team_id}/team_objectives/team_dashboard/\", \n notice: 'Failed to destroy team objective' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @applied_line.destroy\n respond_to do |format|\n format.html { redirect_to applied_lines_url, notice: 'Applied line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant = Applicant.find(params[:id])\n @applicant.destroy\n\n respond_to do |format|\n format.html { redirect_to applicants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant = Applicant.find(params[:id])\n @applicant.destroy\n\n respond_to do |format|\n format.html { redirect_to applicants_url }\n format.json { head :no_content }\n end\n end", "def destroy_req_usecase\n find_user\n if !@user.nil?\n req=Requirement.find_by_id(session[:req_id])\n if !session[:req_id].nil? and !req.nil?\n @use_case=UseCase.find(params[:id])\n if !@use_case.nil? and @user.privilige!=\"Read\"\n @use_case.requirements.delete(req)\n end\n respond_to do |format|\n format.html { redirect_to show_usecases_url(req.id) }\n end\n else\n redirect_to requirements_path\n end\n else\n redirect_to sign_in_url\n end\n\n end", "def destroy\n @party_relationship_type.destroy\n respond_to do |format|\n format.html { redirect_to party_relationship_types_url, notice: 'Party relationship type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @decision.destroy\n respond_to do |format|\n format.html { redirect_to decisions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @external_partnership = ExternalPartnership.find(params[:id])\n @external_partnership.destroy\n\n respond_to do |format|\n format.html { redirect_to external_partnerships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estimate = Estimate.find(params[:id])\n @estimate.destroy\n\n respond_to do |format|\n format.html { redirect_to estimates_url }\n format.json { head :no_content }\n end\n end", "def delete_merge_request_level_rule(project, merge_request, appr_rule_id)\n delete(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}\")\n end", "def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end" ]
[ "0.6725972", "0.6553308", "0.6502757", "0.65018857", "0.63829803", "0.6318106", "0.63008183", "0.621909", "0.61684126", "0.6152238", "0.6144509", "0.6131181", "0.6101823", "0.6059425", "0.60181546", "0.60181546", "0.6016522", "0.60050917", "0.6000904", "0.59897053", "0.5988244", "0.5980306", "0.59352475", "0.5833366", "0.5831951", "0.580727", "0.580727", "0.5804728", "0.5799191", "0.5791934", "0.5787995", "0.5783252", "0.5783017", "0.5781488", "0.5781398", "0.5774516", "0.5774162", "0.5771181", "0.5769866", "0.5742604", "0.5742361", "0.5726019", "0.57249904", "0.5721874", "0.5716535", "0.5710645", "0.57069236", "0.5703106", "0.56972843", "0.56899416", "0.5686125", "0.56804407", "0.5680405", "0.5668614", "0.5663064", "0.56625354", "0.56615394", "0.56546426", "0.56484413", "0.56380105", "0.563609", "0.5633676", "0.5633535", "0.5630369", "0.5628769", "0.56245166", "0.5623554", "0.5622604", "0.56176615", "0.56126153", "0.5611704", "0.56105566", "0.5610402", "0.56087196", "0.5606962", "0.55998385", "0.5599527", "0.55924386", "0.5592268", "0.5591806", "0.5587978", "0.55858254", "0.5581129", "0.5573818", "0.5573707", "0.55702114", "0.5568945", "0.55684817", "0.55617136", "0.5559589", "0.5559589", "0.55573076", "0.5553644", "0.5553084", "0.55524784", "0.5551201", "0.5549646", "0.55468863", "0.55445397", "0.55428034" ]
0.6904088
0
Use callbacks to share common setup or constraints between actions.
def set_party_approval @party_approval = PartyApproval.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a list of trusted parameters through.
def party_approval_params params.require(:party_approval).permit(:user, :party, :approval) 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
GET /rules/1 GET /rules/1.json
def show flash.keep respond_to do |format| format.html # show.html.erb format.json { render :json => @rule } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @rules = Rule.all\n render_for_api :public, :json => @rules\n end", "def show\n render json: @rule\n end", "def rule(name)\n begin\n @name=name\n @content=get_rest \"rules/#{@name}\"\n rescue Stingray::NotFoundError \n nil\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @rules }\n end\n end", "def show\n @rule_set = RuleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def get_rule(rule_id)\n get(\"rules/#{rule_id}\")\n end", "def get_all_rules\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n }\n }\n @response = Typhoeus.get(@rules_url, @options)\n raise \"An error occurred while retrieving active rules from your stream: #{@response.body}\" unless @response.success?\n\n @body = JSON.parse(@response.body)\nend", "def index\n @target_rules = TargetRule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @target_rules }\n end\n end", "def get_rules\r\n @rules\r\n end", "def distributed_engine_rules_2_json_simple(rules)\n\n end", "def index\n @rules = Rule.page(params[:page])\n\n respond_with(@rules)\n end", "def index\n @http_domain_rules = collection.all\n\n respond_to do |format|\n format.json { render json: @http_domain_rules }\n end\n end", "def index\n\t@account = Account.find(params[:account_id])\n @rules = @account.rules\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def show\n @http_domain_rule = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @http_domain_rule }\n end\n end", "def show\n @target_rule = TargetRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @target_rule }\n end\n end", "def show\n @rulebook = Rulebook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rulebook }\n end\n end", "def show\n @rounting_rule = RountingRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rounting_rule }\n end\n end", "def index\n if !params[:ids].nil?\n ids = params[:ids].split \",\"\n @rules = Rule.find(ids)\n else\n if params[:query].nil? or params[:query].length < 2\n @rules = []\n else\n @rules = Rule.with_query(params[:query])\n end\n end\n end", "def get_parsed_rules\n items=InfoParserRule.where(:id_info_source=>params[:id_info_source],:operation=>params[:operation],:kind=>params[:kind])\n render :json=>items\n end", "def index\n @convert_rules = ConvertRule.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @convert_rules }\n end\n end", "def new\n @rule_set = RuleSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def rules(section_id = @one_section_id)\n url = @url_sections + '/' + section_id + '/rules'\n @nsx_client.get(url)\n end", "def show\r\n @contact_rule = ContactRule.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @contact_rule }\r\n end\r\n end", "def show\n @convert_rule = ConvertRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @convert_rule }\n end\n end", "def rule_params_list\n render json: @rule.params\n end", "def show\n @posting_rule = PostingRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @posting_rule }\n end\n end", "def getJSON\n rulesPayload = Hash.new\n rulesPayload[:rules] = @rules\n rulesPayload.to_json\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rules1\n @rules1\nend", "def get_rule(scope, kind, id)\n make_request(:get, \"/pushrules/#{scope}/#{kind}/#{id}\").parsed_response\n end", "def rule_by_id; end", "def index\n @rules = Rule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def rules\n @rules ||= {}\n end", "def rule_by_id(rule_id)\n url = @base_url + '/rules/' + rule_id\n valid_codes = [NSXConstants::CODE_CREATED,\n NSXConstants::CODE_OK,\n NSXConstants::CODE_BAD_REQUEST,\n NSXConstants::CODE_NOT_FOUND]\n additional_headers = []\n @nsx_client.get(url, additional_headers, valid_codes)\n end", "def index\n @agreement = Agreement.find(params[:agreement_id])\n @posting_rules = @agreement.posting_rules\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posting_rules }\n end\n end", "def show\n @obligation_rule = ObligationRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @obligation_rule }\n end\n end", "def generate_policy_rules\n user = User.find_by(username: params[:user_id])\n head :not_found if user.nil?\n raise Exceptions::SecurityTransgression unless user.viewable_by? current_user\n render json: user.all_rules, root: false,\n include: request_includes, host: request.host_with_port, status: :ok\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def show\n @taxon_rule = TaxonRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxon_rule }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rulebook }\n end\n end", "def show\n respond_with(@rule)\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.json { render :show, status: :created, location: @rule }\n else\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @info_parser_rule = InfoParserRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_parser_rule }\n end\n end", "def show\n @rule = Rule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rule }\n end\n end", "def show\n if RewardRule.count == 0\n create\n else\n @reward_rule = RewardRule.first\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward_rule }\n end\n end\n end", "def index\n @rule_types = RuleType.all\n end", "def rule(rule_id, fields: nil, include_fields: nil)\n raise Auth0::InvalidParameter, 'Must supply a valid rule id' if rule_id.to_s.empty?\n path = \"#{rules_path}/#{rule_id}\"\n request_params = {\n fields: fields,\n include_fields: include_fields\n }\n get(path, request_params)\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def index\n @rulebooks = Rulebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rulebooks }\n end\n end", "def get_approval_rules()\n build_header_auth('/approval_rules', API_VERSION_1, 'GET')\n build_request()\n request = Net::HTTP::Get.new(@uri.request_uri)\n #puts \"Request headers\\n\"\n @header.each do |name, value|\n request[name] = value\n\n #puts name+\": \"+value\n end\n\n response = @http.request(request)\n # response.body = JSON.parse(response.body)\n return response\n\n end", "def create rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_post_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def rule\n verify_ajax_request\n require_parameters :id\n rule_key = params[:id].split(':')\n @rule = Rule.first(:conditions => ['plugin_name=? and plugin_rule_key=?', rule_key[0], rule_key[1]], :include => :rule_note)\n render :partial => 'issue/rule'\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def show\n @field_rule = FieldRule.find(params[:id])\n @object_rule = ObjectRule.find(params[:object_rule_id])\n end", "def rules_by_name; end", "def index\n @lar_rules = LarRule.all\n end", "def firewall_rules\n return unless exists?\n additional_resource_properties(\n {\n property_name: \"firewall_rules\",\n property_endpoint: \"#{id}/firewallRules\",\n api_version: @opts[:firewall_rules_api_version],\n },\n )\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def get_rule(rule)\n @rules[rule]\n end", "def rules(options={})\n get('getNotificationRules', options)\n end", "def get_rules(scope = nil)\n path = scope ? \"/pushrules/#{scope}\" : '/pushrules'\n make_request(:get, path).parsed_response\n end", "def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.json { render :show, status: :ok, location: @rule }\n else\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def rules\n @rules ||= Rules.new(path, logger)\n end", "def show\n @route_rule = RouteRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_rule }\n end\n end", "def show\n @rule_type = RuleType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rule_type }\n end\n end", "def show\n #@rule = Rule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rule }\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rule }\n else\n format.html { render action: 'new' }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @template_rules = TemplateRule.all\n end", "def rules\n return @rules\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render :show, status: :created, location: @rule }\n else\n format.html { render :new }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def show_entities\n rule = Rule.find_by(id: HASHIDS.decode(params[:rule_id]))\n return head :not_found if rule.nil?\n # raise Exceptions::SecurityTransgression unless rule.viewable_by? current_user\n render json: rule.entities, host: request.host_with_port, include: ['entity_type'], root: false, status: :ok\n end", "def new\n @reward_rule = RewardRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reward_rule }\n end\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def all\n @rules\n end", "def show\n @provider_fw_rule = ProviderFwRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider_fw_rule }\n end\n end", "def by_id(id)\n @rules.select { |rule| rule.id == id }\n end", "def create\n @rule = Rule.new(rule_params)\n\n if @rule.save\n respond_with(@rule, location: rules_url, notice: 'Rule was successfully created.')\n else\n respond_with(@rule)\n end\n end", "def index\n @facebook_user_stories = GameRules::Rules.the_rules.facebook_user_stories\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facebook_user_stories }\n end\n end", "def rules\n self.class.rules\n end" ]
[ "0.71463287", "0.7027388", "0.69776374", "0.6970006", "0.6843102", "0.6822989", "0.6683223", "0.6683223", "0.6683223", "0.6683223", "0.6619106", "0.6601413", "0.6549146", "0.65400594", "0.64686435", "0.64344156", "0.6413582", "0.64124274", "0.6388942", "0.63414055", "0.63099414", "0.6276609", "0.621204", "0.6198446", "0.6190551", "0.61811364", "0.6170015", "0.6158013", "0.6146015", "0.6133283", "0.6107242", "0.6101843", "0.609833", "0.609833", "0.609833", "0.609833", "0.609833", "0.60967225", "0.60956335", "0.60781544", "0.60755056", "0.6062765", "0.6046601", "0.6021327", "0.59889084", "0.5967997", "0.59619224", "0.59619224", "0.59619224", "0.5937975", "0.5934262", "0.59145886", "0.5912039", "0.58991385", "0.58776623", "0.58661854", "0.5858682", "0.58418846", "0.58357483", "0.58357483", "0.5808469", "0.57902735", "0.57776946", "0.5750807", "0.5745615", "0.5697569", "0.56884253", "0.56857383", "0.568503", "0.56817514", "0.56817514", "0.56817514", "0.56817514", "0.56817514", "0.56817514", "0.56817514", "0.56768763", "0.56763816", "0.5671367", "0.56536454", "0.56460345", "0.5639412", "0.5633861", "0.5631581", "0.56305254", "0.5626493", "0.56158346", "0.56115896", "0.5609001", "0.558043", "0.555689", "0.555689", "0.555689", "0.555689", "0.55510104", "0.5543605", "0.549985", "0.5485116", "0.54784006", "0.54772675" ]
0.5950644
49
GET /rules/new GET /rules/new.json
def new create_rule @tid = params[:pattern_id] if (@tid && @tid.to_i > 0) if current_user.patterns.find(@tid).nil? raise AppExceptions::InvalidParameter.new('Security Alert: Invalid pattern_id was specified!') end @rule.pattern_id = @tid end load_pattern @guided_workflow = params[:guided_workflow] respond_to do |format| format.html # new.html.erb format.json { render :json => @rule } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @rule_set = RuleSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rulebook }\n end\n end", "def new\n @convert_rule = ConvertRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @convert_rule }\n end\n end", "def new\n @rule = Rule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rule }\n end\n end", "def new\r\n @contact_rule = ContactRule.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @contact_rule }\r\n end\r\n end", "def new\n @route_rule = RouteRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_rule }\n end\n end", "def new\n @reward_rule = RewardRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reward_rule }\n end\n end", "def new\n @rule_type = RuleType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rule_type }\n end\n end", "def new\n @info_parser_rule = InfoParserRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_parser_rule }\n end\n end", "def new\n @taxon_rule = TaxonRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxon_rule }\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.json { render :show, status: :created, location: @rule }\n else\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rule }\n else\n format.html { render action: 'new' }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.json { render json: @posting_rule }\n end\n end", "def new\n @obligation_rule = ObligationRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @obligation_rule }\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render :show, status: :created, location: @rule }\n else\n format.html { render :new }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @rule = RuleName.new\n\t@account = Account.find(params[:account_id])\n\t@pockets = Pocket.user_pockets(@current_user.id)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rule }\n end\n end", "def new\n @context_rule = ContextRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @context_rule }\n end\n end", "def new\n @rule = Rule.new\n end", "def create\n @rule = Rule.new()\n @rule.what = rule_params[:what]\n @rule.discount = rule_params[:discount]\n @rule.icon = rule_params[:icon]\n @rule.method = rule_params[:method]\n @rule.api_services = rule_params[:api_services]\n @rule.user = current_user\n @rule.save()\n render json: @rule, status: :created\n end", "def new\n @constraint = Constraint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constraint }\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n if @rule.save\n respond_with(@rule, location: rules_url, notice: 'Rule was successfully created.')\n else\n respond_with(@rule)\n end\n end", "def new(options) \n Client.get(\"/patterns/new\", :query => options)\n end", "def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end", "def new\n @provider_fw_rule = ProviderFwRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider_fw_rule }\n end\n end", "def new\n @code_rule = CodeRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @code_rule }\n end\n end", "def new\n @security = OpenStack::Nova::Compute::SecurityGroup.new\n @rule = OpenStack::Nova::Compute::Rule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @security }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end", "def new\n @categories = Category.where(validity: true)\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @concept = Concept.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @concept }\n end\n end", "def new\n @railway = Railway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @railway }\n end\n end", "def new\n @checklist = Checklist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checklist }\n end\n end", "def create\n @rule_type = RuleType.new(rule_type_params)\n\n respond_to do |format|\n if @rule_type.save\n format.html { redirect_to @rule_type, notice: 'Rule type was successfully created.' }\n format.json { render :show, status: :created, location: @rule_type }\n else\n format.html { render :new }\n format.json { render json: @rule_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n #create a new validation\n @validation = Validation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @validation }\n end\n end", "def new\n @expression_relationship_type = ExpressionRelationshipType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expression_relationship_type }\n end\n end", "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def new\n @pattern = Pattern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pattern }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def create\n @rule_set = RuleSet.new(params[:rule_set])\n\n respond_to do |format|\n if @rule_set.save\n format.html { redirect_to @rule_set, :notice => 'Rule set was successfully created.' }\n format.json { render :json => @rule_set, :status => :created, :location => @rule_set }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @rule_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @predicate = Predicate.new\n\n respond_to do |format|\n format.html { render layout: 'form' }# new.html.erb\n format.json { render json: @predicate }\n end\n end", "def new\n @schema = Schema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schema }\n end\n end", "def create\n @template_rule = TemplateRule.new(template_rule_params)\n\n respond_to do |format|\n if @template_rule.save\n format.html { redirect_to @template_rule, notice: 'Template rule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template_rule }\n else\n format.html { render action: 'new' }\n format.json { render json: @template_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @schema = Schema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @schema }\n end\n end", "def create rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_post_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def new\n @title = t('view.flows.new_title')\n @flow = Flow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flow }\n end\n end", "def new\n @assignment = Assignment.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @price_rule = PriceRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @price_rule }\n end\n end", "def new\n @objective = Objective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objective }\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @numbering_rule = NumberingRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @numbering_rule }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end", "def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n puts @category.inspect\n @internal = @category.internals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internal }\n end\n end", "def new\n @fact = fact_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fact }\n end\n end", "def new\n @resource_type = ResourceType.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_type }\n end\n end", "def create\n @new_ = New.new(new__params)\n\n respond_to do |format|\n if @new_.save\n format.html { redirect_to @new_, notice: \"New was successfully created.\" }\n format.json { render :show, status: :created, location: @new_ }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @new_.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @decision = Decision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @decision }\n end\n end", "def new\n @node = Node.new\n authorize! :create, @node\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @entry = Entry.new\n\n render json: @entry\n end", "def new\n @category = Category.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @assignment }\n end\n end", "def new\n @strategy = Strategy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @strategy }\n end\n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @check = Check.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @check }\n end\n end", "def create\n @reward_rule = RewardRule.new(params[:reward_rule])\n\n respond_to do |format|\n if @reward_rule.save\n format.html { redirect_to @reward_rule, notice: 'Reward rule was successfully created.' }\n format.json { render json: @reward_rule, status: :created, location: @reward_rule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reward_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category}\n end\n end", "def new\n @restriction = Restriction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restriction }\n end\n end", "def new\n @criterion = Criterion.new\n render json: @criterion\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def new\n @complexity = Complexity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @complexity }\n end\n end", "def new\n @http_domain_rule = collection.build\n if @http_domain_rule.core_application\n @http_domain_rule.actions = [[\"forward\", @http_domain_rule.core_application.name]]\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @http_domain_rule }\n end\n end", "def new\n @label = Label.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @label }\n end\n end", "def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end", "def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end", "def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end", "def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end", "def new\n @target_rule = TargetRule.new(params[:target_rule])\n# @deal = Deal.find_by_id(params[:target_rule][:deal_id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @target_rule }\n end\n end", "def create\n @lar_rule = LarRule.new(lar_rule_params)\n\n respond_to do |format|\n if @lar_rule.save\n format.html { redirect_to @lar_rule, notice: 'Lar rule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @lar_rule }\n else\n format.html { render action: 'new' }\n format.json { render json: @lar_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @level_category = LevelCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level_category }\n end\n end", "def new\n @protocol = Protocol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protocol }\n end\n end", "def new\n @road = Road.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @road }\n end\n end" ]
[ "0.7555783", "0.72656727", "0.7149641", "0.7116677", "0.70686734", "0.7029182", "0.7013985", "0.6961055", "0.69131935", "0.6908905", "0.68914926", "0.68903095", "0.68700063", "0.68451375", "0.68110037", "0.6792977", "0.6707119", "0.6659611", "0.6639479", "0.6617542", "0.6605053", "0.66019946", "0.6572775", "0.65548694", "0.65512687", "0.6531954", "0.65318215", "0.6489337", "0.64824724", "0.64707047", "0.6453753", "0.6444678", "0.6431274", "0.6430277", "0.6404466", "0.6399532", "0.634496", "0.6344013", "0.6343372", "0.6335853", "0.6335693", "0.63217276", "0.6316991", "0.6314389", "0.6314389", "0.6314389", "0.6313712", "0.6313016", "0.63130033", "0.63072634", "0.63064724", "0.63042766", "0.6301872", "0.6299865", "0.6299185", "0.6294166", "0.6294166", "0.6294166", "0.62925845", "0.62925845", "0.62892264", "0.6280177", "0.62784857", "0.6278308", "0.6276847", "0.6271085", "0.6255332", "0.6247909", "0.6241371", "0.6241371", "0.6241371", "0.6241371", "0.6241371", "0.6241371", "0.6241371", "0.6241371", "0.6241371", "0.6239004", "0.62388974", "0.6237762", "0.6233186", "0.623067", "0.6229999", "0.62260866", "0.6223537", "0.62170464", "0.62118095", "0.61984575", "0.6196163", "0.6193288", "0.61907214", "0.61903596", "0.6190108", "0.6189669", "0.6188929", "0.61853224", "0.6184323", "0.6179479", "0.6174819", "0.6173366" ]
0.7037782
5
POST /rules POST /rules.json
def create # validating pattern_id, the specified pattern must belong to the current user @tid = params[:rule][:pattern_id] if (!(@tid && @tid.to_i > 0)) @tid = params[:pattern_id] end if (@tid && @tid.to_i > 0) @pattern = current_user.patterns.find(@tid) raise AppExceptions::InvalidParameter.new('Security Alert! Invalid pattern_id was specified!') unless @pattern end @rule = current_user.rules.new(params[:rule]) @rule.pattern = @pattern @rule.save! flash.keep load_pattern respond_to do |format| format.html { redirect_to( url = pattern_path(@pattern), :flash => {:success => 'Successfully created the specified Rule.' })} format.json { render :json => @rule, :status => :created } end rescue Exception => e respond_to do |format| warning_message = pre_process_exception(e) if not warning_message.nil? logger.debug(warning_message) format.html { redirect_to pattern_rules_url(@pattern), :flash => {:error => warning_message} } format.json { render :json => @rule, :status => :unprocessable_entity } end error_message = "Failed to create the specified Rule." format.html { redirect_to pattern_rules_url(@pattern), :flash => {:error => error_message} } format.json { render :json => @rule, :status => :unprocessable_entity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_post_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.json { render :show, status: :created, location: @rule }\n else\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rule = Rule.new()\n @rule.what = rule_params[:what]\n @rule.discount = rule_params[:discount]\n @rule.icon = rule_params[:icon]\n @rule.method = rule_params[:method]\n @rule.api_services = rule_params[:api_services]\n @rule.user = current_user\n @rule.save()\n render json: @rule, status: :created\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render :show, status: :created, location: @rule }\n else\n format.html { render :new }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rule }\n else\n format.html { render action: 'new' }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n if @rule.save\n respond_with(@rule, location: rules_url, notice: 'Rule was successfully created.')\n else\n respond_with(@rule)\n end\n end", "def rule_params\n params.require(:rule).permit()\n end", "def add_rule(params)\n response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n params.to_json,\n @@headers)\n\n check_rest_response(response)\n end", "def add_rule(subject, clauses)\n options = { :body => {\n :Subject => subject,\n :Clauses => clauses }.to_json }\n response = @create_send.post \"/segments/#{segment_id}/rules.json\", options\n end", "def create\n @rule_set = RuleSet.new(params[:rule_set])\n\n respond_to do |format|\n if @rule_set.save\n format.html { redirect_to @rule_set, :notice => 'Rule set was successfully created.' }\n format.json { render :json => @rule_set, :status => :created, :location => @rule_set }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @rule_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_rule(name, script, order = nil, enabled = true, stage = 'login_success')\n raise Auth0::InvalidParameter, 'Must supply a valid name' if name.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid script' if script.to_s.empty?\n request_params = {\n name: name,\n enabled: enabled,\n script: script,\n order: order,\n stage: stage\n }\n post(rules_path, request_params)\n end", "def rule_params\n params.require(:rule).permit(:id, :body)\n end", "def distributed_engine_rules_2_json_simple(rules)\n\n end", "def construct_rules rules\n parsed_rules = {:rules => []}\n rules.each do |rule|\n parsed_rules[:rules] << rule.attributes\n end\n parsed_rules.to_json\n end", "def create\n @test_rule = TestRule.new(test_rule_params)\n\n respond_to do |format|\n if @test_rule.save\n format.html { redirect_to @test_rule, notice: 'Test rule was successfully created.' }\n format.json { render :show, status: :created, location: @test_rule }\n else\n format.html { render :new }\n format.json { render json: @test_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def getJSON\n rulesPayload = Hash.new\n rulesPayload[:rules] = @rules\n rulesPayload.to_json\n end", "def create\n @rule_type = RuleType.new(rule_type_params)\n\n respond_to do |format|\n if @rule_type.save\n format.html { redirect_to @rule_type, notice: 'Rule type was successfully created.' }\n format.json { render :show, status: :created, location: @rule_type }\n else\n format.html { render :new }\n format.json { render json: @rule_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def rule_params\n params.require(:rule).permit(:title, :text, :category)\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def create\n if actions = params[:http_domain_rule].try(:[], :actions)\n actions = JSON.load(actions) if String === actions\n params[:http_domain_rule][:actions] = actions\n end\n\n @http_domain_rule = collection.build(params[:http_domain_rule])\n\n respond_to do |format|\n if @http_domain_rule.save\n format.html do\n flash[:success] = 'Domain rule was successfully created.'\n redirect_to @core_application\n end\n format.json { render json: @http_domain_rule, status: :created, location: @http_domain_rule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @http_domain_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reward_rule = RewardRule.new(params[:reward_rule])\n\n respond_to do |format|\n if @reward_rule.save\n format.html { redirect_to @reward_rule, notice: 'Reward rule was successfully created.' }\n format.json { render json: @reward_rule, status: :created, location: @reward_rule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reward_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def apply_rules(json, type, rules)\n rules.each do |rule|\n next unless rule.function.call(json)\n rule.metadata = json\n rule.type = type\n\n case rule.modifier\n when :warning\n warnings << rule\n when :error\n errors << rule\n end\n end\n end", "def update_rules\n create_update_rules\n end", "def rule_params\n params.require(:rule).permit(\n :title,\n :reason,\n :start_date,\n :stop_date,\n :allow,\n :start_time,\n :stop_time,\n :day_mask,\n :prio,\n :room_ids => [],\n :days_array => ['0', '1', '2', '3', '4', '5', '6']\n )\n end", "def create\n @attend_rule = AttendRule.new(attend_rule_params)\n\n respond_to do |format|\n if @attend_rule.save\n format.html { redirect_to @attend_rule, notice: 'Attend rule was successfully created.' }\n format.json { render :show, status: :created, location: @attend_rule }\n else\n format.html { render :new }\n format.json { render json: @attend_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @context = Context.find(params[:context_id])\n @context_rule = @context.context_rules.create(params[:context_rule])\n redirect_to context_path(@context)\n end", "def rule_params\n params.require(:rule).permit(:description, :name, :start, :stop, :role)\n end", "def create\r\n @contact_rule = ContactRule.new(params[:contact_rule])\r\n\r\n respond_to do |format|\r\n if @contact_rule.save\r\n format.html { redirect_to @contact_rule, notice: 'Contact rule was successfully created.' }\r\n format.json { render json: @contact_rule, status: :created, location: @contact_rule }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @contact_rule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @field_rule = FieldRule.new(field_rule_params)\n @field_rule.object_rule_id = params[:object_rule_id]\n\n respond_to do |format|\n if @field_rule.save\n format.html { redirect_to object_rule_path(@field_rule.object_rule.id), notice: ' field rule was successfully created.' }\n format.json { render :show, status: :created, location: @field_rule }\n else\n format.html { render :new }\n format.json { render json: @field_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template_rule = TemplateRule.new(template_rule_params)\n\n respond_to do |format|\n if @template_rule.save\n format.html { redirect_to @template_rule, notice: 'Template rule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template_rule }\n else\n format.html { render action: 'new' }\n format.json { render json: @template_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n return if @content.nil?\n put_rest \"rules/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end", "def add_rules(rules)\n options = {request: []}\n rules.each do |rule|\n options[:request] << rule.attributes\n end\n response = nil\n if @parent.class == Profitbricks::LoadBalancer\n response = Profitbricks.request :add_firewall_rules_to_load_balancer, options.merge(load_balancer_id: @parent.id)\n self.reload\n else\n response = Profitbricks.request :add_firewall_rules_to_nic, options.merge(nic_id: self.nic_id)\n self.reload\n end\n \n end", "def rule_params\n params.require(:rule).permit(:name, :method_name, parameters_attributes: [:id, :name, :data_type, :_destroy])\n end", "def delete_all_rules(rules)\n return if rules.nil?\n\n @ids = rules['data'].map { |rule| rule['id'] }\n @payload = { delete: { ids: @ids } }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while deleting your rules: #{@response.status_message}\" unless @response.success?\nend", "def to_json\n json = { :name => @name.to_sym, :rules => {} }\n @rules.inject(json[:rules]) do |result, (k, v)|\n result.update(k => v.to_json)\n end\n json\n end", "def rules=(value)\n @rules = value\n end", "def rule_params\n #Map the number to the real property name\n params.require(:rule).permit(:property, :rel, :target, :portfolio, :activated, :description)\n end", "def create\n @taxon_rule = TaxonRule.new(params[:taxon_rule])\n\n respond_to do |format|\n if @taxon_rule.save\n format.html { redirect_to @taxon_rule, notice: 'Taxon rule was successfully created.' }\n format.json { render json: @taxon_rule, status: :created, location: @taxon_rule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxon_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def rule_params_list\n render json: @rule.params\n end", "def rule_params\n params.require(:rule).permit(:value, :device_discoverer_id, :version_discoverer_id, :condition_ids => [])\n end", "def add_rules(rules)\n rules.each do |rule|\n add_rule rule\n end\n end", "def rules\n @rules ||= {}\n end", "def create\n @transaction_rule = @business.transaction_rules.new(transaction_rule_params)\n\n respond_to do |format|\n if @transaction_rule.save\n format.html { redirect_to business_transaction_rules_path(@business), notice: _(\"Regla creada\") }\n format.json { render json: @transaction_rule, status: :created, location: @transaction_rule }\n else\n format.html do\n render action: \"new\"\n end\n format.json { render json: @transaction_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def create\n @obligation_rule = ObligationRule.new(params[:obligation_rule])\n\n respond_to do |format|\n if @obligation_rule.save\n format.html { redirect_to @obligation_rule, notice: 'Obligation rule was successfully created.' }\n format.json { render json: @obligation_rule, status: :created, location: @obligation_rule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @obligation_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @security = OpenStack::Nova::Compute::SecurityGroup.new();\n @security.name = params[:name]\n @security.description = params[:description]\n @security.save\n \n # TODO\n params[:rules].each do |k, v|\n @rule = OpenStack::Nova::Compute::Rule.new\n @rule.ip_protocol = v[:ip_protocol]\n @rule.from_port = v[:from_port]\n @rule.to_port = v[:to_port]\n @rule.cidr = v[:cidr]\n @rule.parent_group = @security\n @security.rule = @rule\n @rule.save\n @security.rule = @rule\n end\n\n respond_to do |format|\n format.json { render json: { status: 0 } }\n end\n\n # respond_to do |format|\n # if @security.save\n # format.html { redirect_to @security, notice: 'Security was successfully created.' }\n # format.json { render json: @security, status: :created, location: @security }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @security.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def index\n @rules = Rule.all\n render_for_api :public, :json => @rules\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @rules }\n end\n end", "def rule_params\n params.require(:rule).permit(:name, :activated, :delta, :duration,\n :key_advice, :full_advice)\n end", "def create\n @payin_rule = @ad.payin_rules.build(payin_rule_params)\n\n if @payin_rule.save\n render text: \"Added rule\";\n else\n LOG.error message: \"payout rule was not saved:... #{@payin_rule.inspect}\"\n render text: \"failed\", status: :bad_request\n end\n end", "def new\n @rule_set = RuleSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def create\n @convert_rule = ConvertRule.new(params[:convert_rule])\n\n @convert_rule.user_id = current_user.id\n @convert_rule.status = \"valid\"\n\n respond_to do |format|\n if @convert_rule.save\n format.html { redirect_to @convert_rule, notice: 'Convert rule was successfully created.' }\n format.json { render json: @convert_rule, status: :created, location: @convert_rule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @convert_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"STORING IN SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.add(@db_name, rules, @schema_graph, \"application/rdf+xml\")\n self\n end", "def batch_rules(rules, forward_to_replicas = false, clear_existing_rules = false, request_options = {})\n client.post(\"#{Protocol.batch_rules_uri(name)}?forwardToReplicas=#{forward_to_replicas}&clearExistingRules=#{clear_existing_rules}\", rules.to_json, :batch, request_options)\n end", "def create\n @rule = Rule.new(params[:rule])\n\n respond_to do |format|\n if @rule.save\n format.html { redirect_to(edit_ruleset_path(@rule.ruleset), :notice => 'Die neue Bedingung wurde angelegt.') }\n format.xml { render :xml => @rule, :status => :created, :location => @rule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def delete rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_delete_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def create\n @target_rule = TargetRule.new(params[:target_rule])\n\n respond_to do |format|\n if @target_rule.save\n format.html { redirect_to new_target_rule_path, notice: 'Compaign Params was successfully created.' }\n# format.html { redirect_to @target_rule, notice: 'Compaign Params was successfully created.' }\n format.json { render json: @target_rule, status: :created, location: @target_rule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @target_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_rule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_add_rule_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def create\n @rule = Rule.new(rule_params)\n create_result = @rule.save\n\n condition_result = true\n unless condition_params.values.all? {|x| x.empty?}\n @condition = Condition.create(condition_params)\n @rule.conditions << @condition \n condition_result = @rule.save\n else\n @condition = Condition.new\n end\n\n respond_to do |format|\n if create_result && condition_result\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render :show, status: :created, location: @rule }\n else\n format.html { render :new }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n unless condition_params.values.all? {|x| x.empty?}\n @rule.conditions << Condition.create(condition_params)\n @rule.save\n end\n end", "def create\n render_json_auto @survey.add_logic_control_rule(params[:logic]) and return\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def create\n @reorder_rule = ReorderRule.new(reorder_rule_params)\n\n respond_to do |format|\n if @reorder_rule.save\n format.html { redirect_to @reorder_rule, notice: 'Reorder rule was successfully created.' }\n format.json { render :show, status: :created, location: @reorder_rule }\n else\n format.html { render :new }\n format.json { render json: @reorder_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_policy_rules\n user = User.find_by(username: params[:user_id])\n head :not_found if user.nil?\n raise Exceptions::SecurityTransgression unless user.viewable_by? current_user\n render json: user.all_rules, root: false,\n include: request_includes, host: request.host_with_port, status: :ok\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def create\n @route_rule = RouteRule.new(params[:route_rule])\n\n respond_to do |format|\n if @route_rule.save\n flash[:notice] = 'RouteRule was successfully created.'\n format.html { redirect_to(@route_rule) }\n format.xml { render :xml => @route_rule, :status => :created, :location => @route_rule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def index\n @agreement = Agreement.find(params[:agreement_id])\n @posting_rules = @agreement.posting_rules\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posting_rules }\n end\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def create\n \t\n @rule = Rule.build_rule(params[:rule])\n\t@account = Account.find(params[:account_id])\n\t@rule.account = @account\n\t@rule.user_id = @current_user.id\n\t@rule.pocket_id = params[:prefix][:pocket_id]\n respond_to do |format|\n \t\n if params[:commit].eql?('Create') && @rule.save\n flash[:notice] = 'Rule was successfully created.'\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { render :xml => @rule, :status => :created, :location => @rule }\n elsif params[:commit].eql?('Cancel')\n \tformat.html { redirect_to(account_rules_url(@account)) }\n \t else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rulemaking_params\n params.require(:rulemaking).permit(:rulemaking_name, :agency, :allow_push_import)\n end", "def create\n @lar_rule = LarRule.new(lar_rule_params)\n\n respond_to do |format|\n if @lar_rule.save\n format.html { redirect_to @lar_rule, notice: 'Lar rule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @lar_rule }\n else\n format.html { render action: 'new' }\n format.json { render json: @lar_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @logged_in.update_site? and @rule.save\n format.html { redirect_to(@rule, :notice => 'Rule was successfully created.') }\n format.xml { render :xml => @rule, :status => :created, :location => @rule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @target_rules = TargetRule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @target_rules }\n end\n end", "def add_rules(rules)\n rules.each {|a_rule| @l.addToken(a_rule.tokID,a_rule.re)}\n end", "def plugin_rule_create(plugin_id, type, host, opts = {} )\n post_data = {\n :plugin_id => plugin_id,\n :type => type,\n :host => host\n }\n nessus_rest_post('plugin-rules',post_data.merge(validate_options(opts)))\n end", "def create\n @site_rule = SiteRule.new(site_rule_params)\n respond_to do |format|\n params[:images].map{|key,value| params[:images].delete(key) if value.blank?}\n params[:links].map{|key,value| params[:links].delete(key) if value.blank?}\n params[:rule_value].map{|key_root,value_root| value_root.map{|key,value| value_root.delete(key) if value.blank?}; params[:rule_value].delete(key_root) if value_root.blank?}\n @site_rule.rule_value = params[:rule_value]\n @site_rule.links = params[:links]\n @site_rule.images = params[:images]\n if @site_rule.save\n format.html { redirect_to @site_rule, notice: 'Site rule was successfully created.' }\n format.json { render :show, status: :created, location: @site_rule }\n else\n format.html { render :new }\n format.json { render json: @site_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n respond_to do |format|\n if @posting_rule.save\n format.html { redirect_to @agreement.becomes(Agreement), notice: 'Posting rule was successfully created.' }\n else\n format.html { redirect_to @agreement.becomes(Agreement), alert: @posting_rule.errors.messages }\n format.js { render :new }\n end\n end\n end", "def create\n @smart_group_rule = SmartGroupRule.new(smart_group_rule_params)\n\n respond_to do |format|\n if @smart_group_rule.save\n format.html { redirect_to @smart_group_rule, notice: 'Smart group rule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @smart_group_rule }\n else\n format.html { render action: 'new' }\n format.json { render json: @smart_group_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @machine_time_rule = MachineTimeRule.new(machine_time_rule_params)\n # authorize(@machine_time_rule)\n respond_to do |format|\n if @machine_time_rule.save\n format.html { redirect_to @machine_time_rule, notice: 'Machine time rule was successfully created.' }\n format.json { render :show, status: :created, location: @machine_time_rule }\n else\n format.html { render :new }\n format.json { render json: @machine_time_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def rule(name)\n begin\n @name=name\n @content=get_rest \"rules/#{@name}\"\n rescue Stingray::NotFoundError \n nil\n end\n end", "def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.json { render :show, status: :ok, location: @rule }\n else\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@info_parser_rule = InfoParserRule.new(params[:info_parser_rule])\n @info_parser_rule = InfoParserRule.new(:p_field => params[:p_field],\n :p_rules => params[:p_rules],\n :id_info_source=>params[:id_info_source],\n :operation=>params[:operation],\n :kind=>params[:kind],\n )\n\n respond_to do |format|\n if @info_parser_rule.save\n #format.html { redirect_to @info_parser_rule, notice: 'Info parser rule was successfully created.' }\n format.json { render json: @info_parser_rule, status: :created, location: @info_parser_rule }\n else\n #format.html { render action: \"new\" }\n format.json { render json: @info_parser_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def rule_params\n params.permit(:api_services, :icon, :method, :what, :discount, :user_id)\n end", "def destroy\n @rule.destroy\n render json: {}\n\n end", "def create\n record = TaxRule.new(params[:record])\n respond_to do |format|\n if record.save\n format.html \n format.json { render json: {} }\n else\n format.html { render action: \"new\" }\n format.json { render json: {} }\n end\n end\n end", "def list_event_create_rules request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_event_create_rules_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::ListEventCreateRulesResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def create\n @rule_type = RuleType.new(params[:rule_type])\n\n respond_to do |format|\n if @rule_type.save\n flash[:notice] = 'RuleType was successfully created.'\n format.html { redirect_to(@rule_type) }\n format.xml { render :xml => @rule_type, :status => :created, :location => @rule_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rule_type.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.7646483", "0.71496737", "0.70469105", "0.68827236", "0.68346715", "0.6764645", "0.6703075", "0.6535743", "0.6513507", "0.6446378", "0.6432997", "0.6416578", "0.6414961", "0.63828355", "0.6326537", "0.6323394", "0.6290568", "0.62344164", "0.6203308", "0.6171059", "0.6106182", "0.6086054", "0.6064416", "0.605377", "0.5997004", "0.59840834", "0.5975032", "0.592953", "0.59248275", "0.5902153", "0.58916813", "0.58874893", "0.5883807", "0.5871248", "0.5835084", "0.581212", "0.5806775", "0.58056796", "0.5802273", "0.5793655", "0.5790741", "0.57850903", "0.5771057", "0.57694364", "0.5767459", "0.5767459", "0.5767459", "0.57670575", "0.5763836", "0.5763802", "0.57572573", "0.5745389", "0.5727587", "0.5694741", "0.56922835", "0.5690019", "0.56680155", "0.5662901", "0.56622905", "0.56534785", "0.564672", "0.5643996", "0.5638558", "0.5631623", "0.561798", "0.559997", "0.5599782", "0.55957955", "0.55927575", "0.55927575", "0.55927575", "0.55927575", "0.55927575", "0.55927575", "0.55927575", "0.5587211", "0.5575031", "0.5575031", "0.55403745", "0.5529736", "0.55149114", "0.5511877", "0.5507283", "0.5493322", "0.547804", "0.54663706", "0.5463837", "0.5455168", "0.545143", "0.543397", "0.5428112", "0.54017615", "0.5398942", "0.5394438", "0.53916734", "0.5383058", "0.53770417", "0.53770417", "0.53770417", "0.53770417", "0.53637785" ]
0.0
-1
PUT /rules/1 PUT /rules/1.json
def update flash.keep respond_to do |format| if @rule.update_attributes(params[:rule]) format.html { redirect_to pattern_rules_url(@pattern), :flash => {:success => 'Successfully updated the Rule.' }} format.json { render :json => @rule } else log_message << @rule.errors.full_messages.to_s unless @rule.nil? || @rule.errors.nil? || @rule.errors.full_messages.nil? logger.error(log_message) logger.debug(e.backtrace) error_message = "Failed to update the specified Rule." format.html { redirect_to pattern_rules_url(@pattern), :flash => {:error => error_message} } format.json { render :json => @rule, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_rules\n create_update_rules\n end", "def update!(**args)\n @rules = args[:rules] if args.key?(:rules)\n end", "def update!(**args)\n @rules = args[:rules] if args.key?(:rules)\n end", "def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.json { render :show, status: :ok, location: @rule }\n else\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def update\n if @rule.update(rule_params)\n respond_with(@rule, location: rules_url, notice: 'Rule was successfully updated.')\n else\n respond_with(@rule)\n end\n end", "def update\n @rule_set = RuleSet.find(params[:id])\n\n respond_to do |format|\n if @rule_set.update_attributes(params[:rule_set])\n format.html { redirect_to @rule_set, :notice => 'Rule set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @rule_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.html { redirect_to @rule, notice: 'Rule was successfully updated.' }\n format.json { render :show, status: :ok, location: @rule }\n else\n format.html { render :edit }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.html { redirect_to @rule, notice: 'Rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rule.update(rule_params)\n format.html { redirect_to @rule, notice: 'Rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n return if @content.nil?\n put_rest \"rules/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end", "def update(id, rule)\n rule = fix_conditions(rule)\n @rule = Rule.get(id)\n raise NotFound unless @rule\n if @rule.update(rule)\n redirect resource(@rule)\n else\n display @rule, :edit\n end\n end", "def update\n #@rule = Rule.find(params[:id])\n\n respond_to do |format|\n if @rule.update_attributes(rule_params)\n format.html { redirect_to(@rule, :notice => 'Rule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def update!(**args)\n @invalid_rules = args[:invalid_rules] if args.key?(:invalid_rules)\n @matched_rules = args[:matched_rules] if args.key?(:matched_rules)\n @triggered_rules = args[:triggered_rules] if args.key?(:triggered_rules)\n end", "def update\n @taxon_rule = TaxonRule.find(params[:id])\n\n respond_to do |format|\n if @taxon_rule.update_attributes(params[:taxon_rule])\n format.html { redirect_to @taxon_rule, notice: 'Taxon rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxon_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def set *rules\n\n raise ArgumentError, 'expected one or more rules' if rules.empty?\n\n if rules == [[]]\n self.clear\n else\n rules = rule_hashes(rules)\n client.put_bucket_cors(:bucket_name => bucket.name, :rules => rules)\n end\n\n nil\n\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def update\n if actions = params[:http_domain_rule].try(:[], :actions)\n actions = JSON.load(actions) if String === actions\n params[:http_domain_rule][:actions] = actions\n end\n\n @http_domain_rule = collection.find(params[:id])\n\n respond_to do |format|\n if @http_domain_rule.update_attributes(params[:http_domain_rule])\n format.html do\n flash[:success] = 'Domain rule was successfully updated.'\n redirect_to @core_application\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @http_domain_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rule_type.update(rule_type_params)\n format.html { redirect_to @rule_type, notice: 'Rule type was successfully updated.' }\n format.json { render :show, status: :ok, location: @rule_type }\n else\n format.html { render :edit }\n format.json { render json: @rule_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @error = args[:error] if args.key?(:error)\n @rule = args[:rule] if args.key?(:rule)\n end", "def update!(**args)\n @rule_set = args[:rule_set] if args.key?(:rule_set)\n end", "def update\n @target_rule = TargetRule.find(params[:id])\n\n respond_to do |format|\n if @target_rule.update_attributes(params[:target_rule])\n format.html { redirect_to @target_rule, notice: 'Target rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @target_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rule.update_attributes(params[:rule])\n format.js \n format.html { redirect_to(@rule, :notice => 'Rule was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n record = TaxRule.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def update\n @route_rule = RouteRule.find(params[:id])\n\n respond_to do |format|\n if @route_rule.update_attributes(params[:route_rule])\n flash[:notice] = 'RouteRule was successfully updated.'\n format.html { redirect_to(@route_rule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rule_type = RuleType.find(params[:id])\n\n respond_to do |format|\n if @rule_type.update_attributes(params[:rule_type])\n flash[:notice] = 'RuleType was successfully updated.'\n format.html { redirect_to(@rule_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rule_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n clean_params = rule_params\n clean_params[:portfolio] = Portfolio.find(clean_params[:portfolio])\n clean_params[:property] = Property.find(clean_params[:property])\n if @rule.update(clean_params)\n format.html { redirect_to dashboard_path, notice: 'Rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rules(list, params)\n params[:taxa].each do |taxon_params|\n taxon = Taxon.find_by_id(taxon_params[:taxon_id].to_i)\n next unless taxon\n list.build_taxon_rule(taxon)\n end\n list\n end", "def update_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})\n requires :network_acl_id\n\n service.replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options)\n true\n end", "def set_rule\n @rule = Rule.find_by id: params[:id], user: current_user\n end", "def update\n @transaction_rule = @business.transaction_rules.find(params[:id])\n\n respond_to do |format|\n if @transaction_rule.update_attributes(transaction_rule_params || {})\n format.html { redirect_to business_transaction_rules_path(@business), notice: _(\"Regla actualizada\") }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @contact_rule = ContactRule.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @contact_rule.update_attributes(params[:contact_rule])\r\n format.html { redirect_to @contact_rule, notice: 'Contact rule was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @contact_rule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @test_rule.update(test_rule_params)\n format.html { redirect_to @test_rule, notice: 'Test rule was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_rule }\n else\n format.html { render :edit }\n format.json { render json: @test_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def rule_params\n params.require(:rule).permit(:id, :body)\n end", "def update\n @reward_rule = RewardRule.find(params[:id])\n\n respond_to do |format|\n if @reward_rule.update_attributes(params[:reward_rule])\n format.html { redirect_to @reward_rule, notice: 'Reward rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reward_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @field_rule.update(field_rule_params)\n format.html { redirect_to object_rule_field_rule_url, notice: ' field rule was successfully updated.' }\n format.json { render :show, status: :ok, location: @field_rule }\n else\n format.html { render :edit }\n format.json { render json: @field_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @policy_id = args[:policy_id] if args.key?(:policy_id)\n @rules = args[:rules] if args.key?(:rules)\n end", "def plugin_rule_update(rule_id, plugin_id, type, host, opts = {} )\n post_data = {\n :rule_id => rule_id,\n :plugin_id => plugin_id,\n :type => type,\n :host => host\n }\n nessus_rest_post(\"plugin-rules/#{rule_id}\",post_data.merge(validate_options(opts)))\n end", "def distributed_engine_rules_2_json_simple(rules)\n\n end", "def set_rule\n @rule = Rule.find(params[:id])\n unless @logged_in.update_site?\n @rule.readonly!\n end\n end", "def apply_rules(json, type, rules)\n rules.each do |rule|\n next unless rule.function.call(json)\n rule.metadata = json\n rule.type = type\n\n case rule.modifier\n when :warning\n warnings << rule\n when :error\n errors << rule\n end\n end\n end", "def updateAnsweringRuleOnRoutingExt(client, accountId, extensionId, answeringRuleId, forwardingNumberId)\n body = {\n 'enabled' => true,\n 'forwarding' => {\n 'notifyMySoftPhones' => true,\n 'softPhonesRingCount' => 5,\n 'ringingMode' => 'Sequentially',\n 'rules': [{\n 'index': 1,\n 'ringCount': 3,\n 'forwardingNumbers' => [{\n 'id' => forwardingNumberId\n }],\n }]\n }\n }\n client.http.put do |req|\n req.url \"account/#{accountId}/extension/#{extensionId}/answering-rule/#{answeringRuleId}\"\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\nend", "def modify_rule(rule_id, actions, conditions)\n params = {}\n\n params.merge!(Fog::AWS.serialize_keys('Actions', actions))\n params.merge!(Fog::AWS.serialize_keys('Conditions', conditions))\n\n request({\n 'Action' => 'ModifyRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::ModifyRule.new\n }.merge(params))\n end", "def update\n respond_to do |format|\n if @template_rule.update(template_rule_params)\n format.html { redirect_to @template_rule, notice: 'Template rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @context_rule = ContextRule.find(params[:id])\n\n respond_to do |format|\n if @context_rule.update_attributes(params[:context_rule])\n format.html { redirect_to(@context_rule, :notice => 'Context rule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @context_rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @role = args[:role] if args.key?(:role)\n @rule = args[:rule] if args.key?(:rule)\n end", "def set_rule\n @rule = params[:rule].to_i\n\n if @rule == 0 or @rule == 1 or @rule == 2\n else\n @rule = 0\n end\n end", "def update\n @rule = Rule.find(params[:id])\n\t@account = Account.find(params[:account_id])\n params[:rule][:pocket_id] = params[:prefix][:pocket_id]\n respond_to do |format|\n if params[:commit].eql?('Cancel') || @rule.update_attributes(params[:rule])\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @track = Track.find(params[:id])\n \n if params[:rules]\n rules = params[:rules][:names].collect.with_index { |name, i| {:name => name, :track_id => params[:rules][:track_ids][i], :body => params[:rules][:bodies][i] } } \n \n rules.each do |r|\n if not @track.rules.find_by_name(r[:name])\n @track.rules.build(r)\n end\n end\n end\n\n if params[:factors]\n factors = params[:factors][:names].collect.with_index { |name, i| {:name => name, :track_id => params[:factors][:track_ids][i], :factoree_type => params[:factors][:factoree_type][i], :factoree_id => params[:factors][:factoree_ids][i]} }\n \n factors.each do |f|\n if not @track.factors.find_by_name(f[:name])\n @track.factors.build(f)\n end\n end\n end\n\n respond_to do |format|\n if @track.update_attributes(params[:track])\n format.html { redirect_to @track, notice: 'Track was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @track.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_rule(params)\n response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n params.to_json,\n @@headers)\n\n check_rest_response(response)\n end", "def update\n @convert_rule = ConvertRule.find(params[:id])\n\n respond_to do |format|\n if @convert_rule.update_attributes(params[:convert_rule])\n format.html { redirect_to @convert_rule, notice: 'Convert rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @convert_rule.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 respond_to do |format|\n if @lar_rule.update(lar_rule_params)\n format.html { redirect_to @lar_rule, notice: 'Lar rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lar_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def rule(name)\n begin\n @name=name\n @content=get_rest \"rules/#{@name}\"\n rescue Stingray::NotFoundError \n nil\n end\n end", "def rule_params\n params.require(:rule).permit()\n end", "def update\n respond_to do |format|\n if @attend_rule.update(attend_rule_params.tap{|t|Rails.logger.info(\"-------#{t.inspect}\")})\n flash[:notice] = \"操作成功\"\n format.html { redirect_to :back }\n format.json { render :show, status: :ok, location: @attend_rule }\n else\n format.html { render :edit }\n format.json { render json: @attend_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.json { render :show, status: :created, location: @rule }\n else\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @posting_rule = PostingRule.find(params[:id])\n\n respond_to do |format|\n if @posting_rule.update_attributes(permitted_params(@posting_rule).posting_rule)\n format.html { redirect_to @posting_rule, notice: 'Posting rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @posting_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @code_rule = CodeRule.find(params[:id])\n\n respond_to do |format|\n if @code_rule.update_attributes(params[:code_rule])\n flash[:notice] = 'CodeRule was successfully updated.'\n format.html { redirect_to(@code_rule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @code_rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @obligation_rule = ObligationRule.find(params[:id])\n\n respond_to do |format|\n if @obligation_rule.update_attributes(params[:obligation_rule])\n format.html { redirect_to @obligation_rule, notice: 'Obligation rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @obligation_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @rule_actions_pairs = args[:rule_actions_pairs] if args.key?(:rule_actions_pairs)\n end", "def update\n\n respond_to do |format|\n if @rulebook.update_attributes(rulebook_params)\n format.html { redirect_to configuration_path(@rulebook), notice: 'Rulebook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rulebook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @price_rule = PriceRule.find(params[:id])\n\n respond_to do |format|\n if @price_rule.update_attributes(params[:price_rule])\n flash[:notice] = 'PriceRule was successfully updated.'\n format.html { redirect_to(@price_rule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @price_rule.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rules=(value)\n @rules = value\n end", "def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end", "def update!(**args)\n @enforce = args[:enforce] if args.key?(:enforce)\n @validate = args[:validate] if args.key?(:validate)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @rules = args[:rules] if args.key?(:rules)\n @time_updated = args[:time_updated] if args.key?(:time_updated)\n end", "def update!(**args)\n @firewall_policy = args[:firewall_policy] if args.key?(:firewall_policy)\n @rule_priority = args[:rule_priority] if args.key?(:rule_priority)\n end", "def rule_params\n #Map the number to the real property name\n params.require(:rule).permit(:property, :rel, :target, :portfolio, :activated, :description)\n end", "def update\n respond_to do |format|\n if @rulemaking.update(rulemaking_params)\n format.html { redirect_to rulemakings_path, notice: 'Rulemaking was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @info_parser_rule = InfoParserRule.find(params[:id])\n\n respond_to do |format|\n if @info_parser_rule.update_attributes(params[:info_parser_rule])\n format.html { redirect_to @info_parser_rule, notice: 'Info parser rule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @info_parser_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_rule(subject, clauses)\n options = { :body => {\n :Subject => subject,\n :Clauses => clauses }.to_json }\n response = @create_send.post \"/segments/#{segment_id}/rules.json\", options\n end", "def update!(**args)\n @fallback_name = args[:fallback_name] if args.key?(:fallback_name)\n @name = args[:name] if args.key?(:name)\n @rules = args[:rules] if args.key?(:rules)\n end", "def create\n @rule = Rule.new()\n @rule.what = rule_params[:what]\n @rule.discount = rule_params[:discount]\n @rule.icon = rule_params[:icon]\n @rule.method = rule_params[:method]\n @rule.api_services = rule_params[:api_services]\n @rule.user = current_user\n @rule.save()\n render json: @rule, status: :created\n end", "def set_rule\n # Extracts the last 6 digits from the stig_id parameter\n stig_id = params[:stig_id]&.last(6)\n\n # Returns out of the function if stig ID is blank or empty\n return if stig_id.blank?\n\n # Queries the Rule model with component_id and rule_id as arguments to find a specific rule.\n @rule = Rule.find_by(component_id: params[:id], rule_id: stig_id)\n\n # If a record for the rule exists, set the instance variable @rule_json to the rule's JSON attribute\n if @rule.present?\n @rule_json = @rule.to_json\n\n # Else, create an error message and respond to either HTML or JSON requests\n else\n message = 'The requested component and control combination could not be found.'\n respond_to do |format|\n flash.alert = message\n\n # If html format is requested, redirect back to default page\n format.html do\n redirect_back(fallback_location: root_path)\n end\n format.json do\n # Render a json response in a toast message format\n # as well as setting status code of the response to not_found (404)\n render json: {\n toast: {\n title: 'Control not found',\n message: message,\n variant: 'danger'\n }\n }, status: :not_found\n end\n end\n end\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render :show, status: :created, location: @rule }\n else\n format.html { render :new }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def edit\n @firewall = OpenStack::Nova::Compute::SecurityGroup.find(params[:id])\n @rules = @firewall.rules\n end", "def put(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Put.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n begin\n response = http.start {|http| http.request(request) }\n rescue\n puts url\n end\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def add_rule(rule)\n @rulebook.add_rule rule\n end", "def rule=(rule)\n write_attribute :rule_id, case rule\n when ReputationRule\n rule.id\n else \n ReputationRule.find_by_name( rule ).try(:id)\n end\n end", "def set_rule_type\n @rule_type = RuleType.find(params[:id])\n end", "def clear_rules\n cs_delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.html { redirect_to @rule, notice: 'Rule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rule }\n else\n format.html { render action: 'new' }\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def location_rule_update\n if params[:name].blank? #or (params[:cut].length == 0 and params[:add].length ==0)\n flash[:notice] = _('Please_enter_name')\n redirect_to :action => 'location_rule_edit', :id => @rule.id and return false\n end\n @rule.name = params[:name]\n @rule.cut = params[:cut] if params[:cut]\n @rule.add = params[:add] if params[:add]\n @rule.minlen = params[:minlen] if !params[:minlen].blank?\n @rule.maxlen = params[:maxlen] if !params[:maxlen].blank?\n @rule.tariff_id = params[:tariff] if params[:tariff]\n @rule.lcr_id = params[:lcr] if params[:lcr]\n @did = Did.where(\"did LIKE ?\", params[:did].to_s).first if params[:did]\n @rule.did_id = @did ? @did.id : \"\"\n if params[:user].to_i == -1\n @rule.device_id = \"\"\n else\n @rule.device_id = params[:s_device] ? params[:s_device] : (params[:device_id_from_js] if params[:device_id_from_js])\n end\n @rule.save ? flash[:status] = _('Rule_updated') : flash_errors_for(_('Rule_not_updated'), @rule)\n redirect_to :action => 'location_rules', :id => @rule.location_id\n end", "def batch_rules(rules, forward_to_replicas = false, clear_existing_rules = false, request_options = {})\n client.post(\"#{Protocol.batch_rules_uri(name)}?forwardToReplicas=#{forward_to_replicas}&clearExistingRules=#{clear_existing_rules}\", rules.to_json, :batch, request_options)\n end", "def delete_all_rules(rules)\n return if rules.nil?\n\n @ids = rules['data'].map { |rule| rule['id'] }\n @payload = { delete: { ids: @ids } }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while deleting your rules: #{@response.status_message}\" unless @response.success?\nend", "def rule_params\n params.require(:rule).permit(:title, :text, :category)\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def add_rules(rules)\n options = {request: []}\n rules.each do |rule|\n options[:request] << rule.attributes\n end\n response = nil\n if @parent.class == Profitbricks::LoadBalancer\n response = Profitbricks.request :add_firewall_rules_to_load_balancer, options.merge(load_balancer_id: @parent.id)\n self.reload\n else\n response = Profitbricks.request :add_firewall_rules_to_nic, options.merge(nic_id: self.nic_id)\n self.reload\n end\n \n end", "def update!(**args)\n @action_outputs = args[:action_outputs] if args.key?(:action_outputs)\n @rule = args[:rule] if args.key?(:rule)\n end", "def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7043215", "0.68250173", "0.68250173", "0.67708766", "0.66996753", "0.66590863", "0.65952486", "0.6517969", "0.6490037", "0.6487923", "0.6310482", "0.6200341", "0.61940855", "0.61617744", "0.61617744", "0.61617744", "0.61617744", "0.6155782", "0.61403614", "0.6119514", "0.6118723", "0.6118723", "0.6118723", "0.60769635", "0.60429925", "0.602669", "0.5991826", "0.5960266", "0.5950016", "0.5918344", "0.59129363", "0.5900169", "0.5885877", "0.5871915", "0.58437574", "0.58212847", "0.58194584", "0.58133996", "0.5797274", "0.57963234", "0.5792939", "0.5790501", "0.5777455", "0.57728744", "0.5770913", "0.5759618", "0.5733829", "0.57192564", "0.5709731", "0.57010245", "0.5669287", "0.56667405", "0.56495076", "0.5643412", "0.56187904", "0.56023544", "0.55976397", "0.5594942", "0.5582161", "0.55820435", "0.55727977", "0.5552744", "0.5544585", "0.55442625", "0.55414397", "0.5541433", "0.5515519", "0.5507685", "0.54902947", "0.5483904", "0.54773146", "0.54771346", "0.5474624", "0.54689306", "0.54625416", "0.5460619", "0.54600006", "0.54501903", "0.5447749", "0.5443211", "0.5396807", "0.5392806", "0.5388925", "0.53835565", "0.5382502", "0.53769773", "0.53682697", "0.53672814", "0.5362387", "0.5358294", "0.53556895", "0.5350334", "0.5342089", "0.53414965", "0.5331843", "0.53261054", "0.5318273", "0.5317404", "0.53099406", "0.53099406" ]
0.56026965
55
GET /rules GET //rules.json
def index respond_to do |format| format.html # index.html.erb format.json { render :json => @rules } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rules\n @rules=get_endpoint('rule').keys\n end", "def index\n @rules = Rule.all\n render_for_api :public, :json => @rules\n end", "def get_all_rules\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n }\n }\n @response = Typhoeus.get(@rules_url, @options)\n raise \"An error occurred while retrieving active rules from your stream: #{@response.body}\" unless @response.success?\n\n @body = JSON.parse(@response.body)\nend", "def get_rules\r\n @rules\r\n end", "def show\n render json: @rule\n end", "def index\n @http_domain_rules = collection.all\n\n respond_to do |format|\n format.json { render json: @http_domain_rules }\n end\n end", "def rule(name)\n begin\n @name=name\n @content=get_rest \"rules/#{@name}\"\n rescue Stingray::NotFoundError \n nil\n end\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def rules(section_id = @one_section_id)\n url = @url_sections + '/' + section_id + '/rules'\n @nsx_client.get(url)\n end", "def index\n @target_rules = TargetRule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @target_rules }\n end\n end", "def distributed_engine_rules_2_json_simple(rules)\n\n end", "def index\n\t@account = Account.find(params[:account_id])\n @rules = @account.rules\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def getJSON\n rulesPayload = Hash.new\n rulesPayload[:rules] = @rules\n rulesPayload.to_json\n end", "def rules\n @rules ||= {}\n end", "def rules(options={})\n get('getNotificationRules', options)\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def index\n @rules = Rule.page(params[:page])\n\n respond_with(@rules)\n end", "def get_parsed_rules\n items=InfoParserRule.where(:id_info_source=>params[:id_info_source],:operation=>params[:operation],:kind=>params[:kind])\n render :json=>items\n end", "def rule_params_list\n render json: @rule.params\n end", "def create rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_post_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def get_rules(scope = nil)\n path = scope ? \"/pushrules/#{scope}\" : '/pushrules'\n make_request(:get, path).parsed_response\n end", "def show\n @rule_set = RuleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def generate_policy_rules\n user = User.find_by(username: params[:user_id])\n head :not_found if user.nil?\n raise Exceptions::SecurityTransgression unless user.viewable_by? current_user\n render json: user.all_rules, root: false,\n include: request_includes, host: request.host_with_port, status: :ok\n end", "def index\n if !params[:ids].nil?\n ids = params[:ids].split \",\"\n @rules = Rule.find(ids)\n else\n if params[:query].nil? or params[:query].length < 2\n @rules = []\n else\n @rules = Rule.with_query(params[:query])\n end\n end\n end", "def get_approval_rules()\n build_header_auth('/approval_rules', API_VERSION_1, 'GET')\n build_request()\n request = Net::HTTP::Get.new(@uri.request_uri)\n #puts \"Request headers\\n\"\n @header.each do |name, value|\n request[name] = value\n\n #puts name+\": \"+value\n end\n\n response = @http.request(request)\n # response.body = JSON.parse(response.body)\n return response\n\n end", "def index\n @convert_rules = ConvertRule.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @convert_rules }\n end\n end", "def rules(enabled: nil, fields: nil, include_fields: nil, stage: nil, page: nil, per_page: nil)\n request_params = {\n enabled: enabled,\n fields: fields,\n include_fields: include_fields,\n stage: stage,\n page: page,\n per_page: per_page\n }\n get(rules_path, request_params)\n end", "def rules\n return @rules\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def index\n @rules = Rule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def get_rule(rule_id)\n get(\"rules/#{rule_id}\")\n end", "def construct_rules rules\n parsed_rules = {:rules => []}\n rules.each do |rule|\n parsed_rules[:rules] << rule.attributes\n end\n parsed_rules.to_json\n end", "def rules\n @rules ||= Rules.new(path, logger)\n end", "def index\n @agreement = Agreement.find(params[:agreement_id])\n @posting_rules = @agreement.posting_rules\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posting_rules }\n end\n end", "def firewall_rules\n return unless exists?\n additional_resource_properties(\n {\n property_name: \"firewall_rules\",\n property_endpoint: \"#{id}/firewallRules\",\n api_version: @opts[:firewall_rules_api_version],\n },\n )\n end", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def rules=(value)\n @rules = value\n end", "def all\n @rules\n end", "def show\n @rulebook = Rulebook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rulebook }\n end\n end", "def rules\n self.class.rules\n end", "def show\n @http_domain_rule = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @http_domain_rule }\n end\n end", "def rule(rule_id, fields: nil, include_fields: nil)\n raise Auth0::InvalidParameter, 'Must supply a valid rule id' if rule_id.to_s.empty?\n path = \"#{rules_path}/#{rule_id}\"\n request_params = {\n fields: fields,\n include_fields: include_fields\n }\n get(path, request_params)\n end", "def index\n @rulebooks = Rulebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rulebooks }\n end\n end", "def get_rule(scope, kind, id)\n make_request(:get, \"/pushrules/#{scope}/#{kind}/#{id}\").parsed_response\n end", "def show\n @target_rule = TargetRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @target_rule }\n end\n end", "def show_entities\n rule = Rule.find_by(id: HASHIDS.decode(params[:rule_id]))\n return head :not_found if rule.nil?\n # raise Exceptions::SecurityTransgression unless rule.viewable_by? current_user\n render json: rule.entities, host: request.host_with_port, include: ['entity_type'], root: false, status: :ok\n end", "def index\n @lar_rules = LarRule.all\n end", "def index\n @rule_types = RuleType.all\n end", "def rules\n cluster.configurationEx.rule\n end", "def rules\n cluster.configurationEx.rule\n end", "def delete rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_delete_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def rules_by_name; end", "def get_rules(section_id, opts = {})\n data, _status_code, _headers = get_rules_with_http_info(section_id, opts)\n data\n end", "def show\n @rounting_rule = RountingRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rounting_rule }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rulebook }\n end\n end", "def rules(event)\n @rules[event]\n end", "def new\n @rule_set = RuleSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def show\n flash.keep\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rule }\n end\n end", "def get_rules(store_id, opts = {})\n data, _status_code, _headers = get_rules_with_http_info(store_id, opts)\n return data\n end", "def to_json\n json = { :name => @name.to_sym, :rules => {} }\n @rules.inject(json[:rules]) do |result, (k, v)|\n result.update(k => v.to_json)\n end\n json\n end", "def load_rules; end", "def show\r\n @contact_rule = ContactRule.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @contact_rule }\r\n end\r\n end", "def rules\n\t\tf = File.read(\"./rules.txt\")\n\t\tputs \"#{f}\"\n\t\tback_option = gets.chomp.to_i\n\t\trules_option(back_option)\n\tend", "def list_plugin_rules\n nessus_rest_get('plugin-rules')['plugin-rules']\n end", "def get_bre_rules_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RuleEngineRulesApi.get_bre_rules ...\"\n end\n # resource path\n local_var_path = \"/bre/rules\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_enabled'] = opts[:'filter_enabled'] if !opts[:'filter_enabled'].nil?\n query_params[:'filter_system'] = opts[:'filter_system'] if !opts[:'filter_system'].nil?\n query_params[:'filter_trigger'] = opts[:'filter_trigger'] if !opts[:'filter_trigger'].nil?\n query_params[:'filter_action'] = opts[:'filter_action'] if !opts[:'filter_action'].nil?\n query_params[:'filter_condition'] = opts[:'filter_condition'] if !opts[:'filter_condition'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'PageResourceBreRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RuleEngineRulesApi#get_bre_rules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @rule = Rule.new(rule_params)\n\n respond_to do |format|\n if @rule.save\n format.json { render :show, status: :created, location: @rule }\n else\n format.json { render json: @rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def get_rule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_get_rule_request request_pb\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::FirewallPolicyRule.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def data_rules\n # renders static page\n end", "def rules\n return [] if @rules.empty?\n @rules.sort_by { |k| k['priority'] }.map { |h| h['rule_name'] }\n end", "def run_rules(url, rules)\n str = url.to_s\n return str if rules.nil?\n rules.each do |rule|\n case rule\n when 'noproto'\n str = str.gsub(%r{^https?://}, '')\n when 'nossl', 'http'\n str = str.gsub(%r{^https://}, 'http://')\n when 'ssl', 'https'\n str = str.gsub(%r{^http://}, 'https://')\n when 'base32'\n str = Base32.encode(str).to_s\n when 'base64'\n str = Base64.encode64(str).delete(\"\\n\")\n when 'md4'\n str = OpenSSL::Digest::MD4.hexdigest(str)\n when 'md5'\n md5 = Digest::MD5.new\n md5.update str\n str = md5.hexdigest\n when 'sha1'\n str = Digest::SHA1.hexdigest(str)\n when 'reverse'\n str = str.reverse\n when 'upcase'\n str = str.upcase\n when 'downcase'\n str = str.downcase\n when 'rot13'\n str = str.tr('A-Za-z', 'N-ZA-Mn-za-m')\n when 'urlencode'\n str = CGI.escape(str).gsub(/\\+/, '%20')\n when 'urldecode'\n str = CGI.unescape(str)\n when 'append-hash'\n str = \"#{str}##{rand(36**6).to_s(36)}\"\n when 'append-method-get'\n separator = str.include?('?') ? '&' : '?'\n str = \"#{str}#{separator}method=get&_method=get\"\n else\n logger.warn(\"Unknown rule: #{rule}\")\n end\n end\n str\n end", "def parse_http_rule rule_yaml\n rule = Google::Api::HttpRule.new\n rule.selector = rule_yaml[HTTP_RULES_SELECTOR_KEY] if rule_yaml.key? HTTP_RULES_SELECTOR_KEY\n verb_path = HTTP_RULES_VERBS_ALLOWED.find { |verb| rule_yaml[verb] }\n rule.send \"#{verb_path}=\", rule_yaml[verb_path] if verb_path\n rule.body = rule_yaml[HTTP_RULES_BODY_KEY] if rule_yaml.key? HTTP_RULES_BODY_KEY\n\n if rule_yaml.key? HTTP_RULES_ADDITIONAL_BINDINGS_KEY\n rule.additional_bindings = rule_yaml[HTTP_RULES_ADDITIONAL_BINDINGS_KEY].map do |binding_yaml|\n parse_http_rule binding_yaml\n end\n end\n\n rule\n end", "def index\n @template_rules = TemplateRule.all\n end", "def show\n @posting_rule = PostingRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @posting_rule }\n end\n end", "def rules # :nodoc:\n # Rules should always be returned sorted with oldest first.\n @rules.sort! { |a, b| b[:age] <=> a[:age] }\n end", "def show\n @convert_rule = ConvertRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @convert_rule }\n end\n end", "def rule_by_id; end", "def index\n @facebook_user_stories = GameRules::Rules.the_rules.facebook_user_stories\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facebook_user_stories }\n end\n end", "def show\n respond_with(@rule)\n end", "def rule_params\n params.require(:rule).permit()\n end", "def get_all_config_rules\n config_rules = []\n\n # Fetch all rules with pagination\n response = @client.describe_config_rules\n config_rules += response.config_rules\n while response.next_token\n response = @client.describe_config_rules(next_token: response.next_token)\n config_rules += response.config_rules\n end\n config_rules = config_rules.map(&:to_h)\n\n # Add necessary data to rules using helpers\n add_compliance_to_config_rules(config_rules)\n add_results_to_config_rules(config_rules)\n end", "def rule_by_id(rule_id)\n url = @base_url + '/rules/' + rule_id\n valid_codes = [NSXConstants::CODE_CREATED,\n NSXConstants::CODE_OK,\n NSXConstants::CODE_BAD_REQUEST,\n NSXConstants::CODE_NOT_FOUND]\n additional_headers = []\n @nsx_client.get(url, additional_headers, valid_codes)\n end", "def parse_firewall_rules\n script_code = 'netsh advfirewall firewall show rule name=all verbose'\n cmd = powershell_out(script_code) # Not logged because it makes too much noise\n\n retval = parse_firewall_paragraphs(cmd)\n\n raise 'Could not parse firewall rules' if retval.empty?\n return retval\n end", "def apply_rules(json, type, rules)\n rules.each do |rule|\n next unless rule.function.call(json)\n rule.metadata = json\n rule.type = type\n\n case rule.modifier\n when :warning\n warnings << rule\n when :error\n errors << rule\n end\n end\n end", "def show\n @obligation_rule = ObligationRule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @obligation_rule }\n end\n end", "def get_rules_with_http_info(store_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V2UserAnalyticsApi.get_rules ...\"\n end\n # verify the required parameter 'store_id' is set\n fail ArgumentError, \"Missing the required parameter 'store_id' when calling V2UserAnalyticsApi.get_rules\" if store_id.nil?\n # resource path\n local_var_path = \"/v2/user/analytics/{storeId}/rules\".sub('{format}','json').sub('{' + 'storeId' + '}', store_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Rules')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V2UserAnalyticsApi#get_rules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.7499306", "0.72862667", "0.7198168", "0.7049526", "0.68032885", "0.6667045", "0.66605824", "0.6649178", "0.6649178", "0.6649178", "0.6649178", "0.66284627", "0.66202074", "0.66168904", "0.6533221", "0.6523069", "0.65159124", "0.6510809", "0.6490104", "0.6490104", "0.64789164", "0.64789164", "0.64789164", "0.64744157", "0.6433125", "0.6382365", "0.6342219", "0.63421386", "0.6332892", "0.63324183", "0.6325751", "0.62906885", "0.6180997", "0.61778915", "0.6177721", "0.6155123", "0.61493355", "0.61493355", "0.61493355", "0.61493355", "0.61493355", "0.61493355", "0.61493355", "0.6133891", "0.6125061", "0.6060565", "0.60534656", "0.604697", "0.6007686", "0.59519583", "0.5945632", "0.5930412", "0.59296006", "0.5927712", "0.5917545", "0.5826559", "0.5818549", "0.58128816", "0.5806034", "0.58016986", "0.5784302", "0.57832843", "0.57811797", "0.57811797", "0.57811755", "0.57753", "0.57729113", "0.576074", "0.5758326", "0.57571256", "0.5756313", "0.5744896", "0.5736943", "0.57153636", "0.5712105", "0.5708376", "0.57035136", "0.5697083", "0.56919914", "0.56881356", "0.5681279", "0.5668866", "0.5658213", "0.5644784", "0.5643922", "0.56395906", "0.56356686", "0.5601366", "0.5586522", "0.5580756", "0.557594", "0.55640984", "0.55590147", "0.5554751", "0.5550844", "0.55243415", "0.5513547", "0.55034", "0.5498725", "0.5480242" ]
0.7071368
3
DELETE /rules/1 DELETE /rules/1.json
def destroy @rule.destroy flash.keep respond_to do |format| format.html { redirect_to pattern_path(@pattern), :flash => {:success => 'Successfully deleted the specified Rule.' } } format.json { render :json => @rule, :status => :ok } end rescue Exception => e respond_to do |format| warning_message = pre_process_exception(e) if not warning_message.nil? logger.debug(warning_message) format.html { redirect_to pattern_rules_url(@pattern), :flash => {:error => warning_message} } format.json { render :json => @rule, :status => :unprocessable_entity } end error_message = "Failed to destroy the specified Rule." format.html { redirect_to pattern_rules_url(@pattern), :flash => {:error => error_message} } format.json { render :json => @rule, :status => :unprocessable_entity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rule.destroy\n render json: {}\n\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end", "def delete rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_delete_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def destroy\n @rule_set = RuleSet.find(params[:id])\n @rule_set.destroy\n\n respond_to do |format|\n format.html { redirect_to rule_sets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@rule = Rule.find(params[:id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lar_rule.destroy\n respond_to do |format|\n format.html { redirect_to lar_rules_url }\n format.json { head :no_content }\n end\n end", "def delete_all_rules(rules)\n return if rules.nil?\n\n @ids = rules['data'].map { |rule| rule['id'] }\n @payload = { delete: { ids: @ids } }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while deleting your rules: #{@response.status_message}\" unless @response.success?\nend", "def clear_rules\n response = @create_send.delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def clear_rules\n cs_delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def destroy\n @target_rule = TargetRule.find(params[:id])\n @target_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to target_rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rule.destroy\n\n respond_with(rule, location: rules_url, notice: 'RUle was successfully destroyed.')\n end", "def destroy\n @taxon_rule = TaxonRule.find(params[:id])\n @taxon_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to taxon_rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route_rule = RouteRule.find(params[:id])\n @route_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_rule.destroy\n respond_to do |format|\n format.html { redirect_to test_rules_url, notice: 'Test rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rule = Rule.find(params[:id])\n \n\t@account = Account.find(params[:account_id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @template_rule.destroy\n respond_to do |format|\n format.html { redirect_to template_rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_rule(scope, kind, id)\n make_request(:delete, \"/pushrules/#{scope}/#{kind}/#{id}\").code == 200\n end", "def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end", "def destroy\n @reward_rule = RewardRule.find(params[:id])\n @reward_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to reward_rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @field_rule.destroy\n respond_to do |format|\n format.html { redirect_to object_rule_field_rules_url, notice: ' field rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @contact_rule = ContactRule.find(params[:id])\r\n @contact_rule.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to contact_rules_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @rule_type.destroy\n respond_to do |format|\n format.html { redirect_to rule_types_url, notice: 'Rule type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def plugin_rule_delete(rule_id)\n nessus_rest_delete(\"plugin-rules/#{rule_id}\")\n end", "def destroy\n @attend_rule.destroy\n respond_to do |format|\n format.html { redirect_to attend_rules_url, notice: 'Attend rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rule_type = RuleType.find(params[:id])\n @rule_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(rule_types_url) }\n format.xml { 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 @http_domain_rule = collection.find(params[:id])\n @http_domain_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end", "def destroy\n @site_rule.destroy\n respond_to do |format|\n format.html { redirect_to site_rules_url, notice: 'Site rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @info_parser_rule = InfoParserRule.find(params[:id])\n @info_parser_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to info_parser_rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction_rule = @business.transaction_rules.find(params[:id])\n @transaction_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to business_transaction_rules_url(@business), notice: _(\"Regla eliminada\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @obligation_rule = ObligationRule.find(params[:id])\n @obligation_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to obligation_rules_url }\n format.json { head :no_content }\n end\n end", "def delete!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n type = DELETE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 166:10: 'delete'\n match( \"delete\" )\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__, 45 )\n\n end", "def destroy\n @posting_rule = PostingRule.find(params[:id])\n @posting_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to agreement_path(@posting_rule.agreement) }\n format.json { head :no_content }\n end\n end", "def destroy\n @constraint.destroy\n respond_to do |format|\n format.html { redirect_to constraints_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @certificate_rule.destroy\n respond_to do |format|\n format.html { redirect_to admin_certificate_rules_url, notice: 'Certificate rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @convert_rule = ConvertRule.find(params[:id])\n @convert_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to convert_rules_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def destroy\n @context = Context.find(params[:context_id])\n @context_rule = @context.context_rules.find(params[:id])\n @context_rule.destroy\n redirect_to context_path(@context)\n end", "def delete(name)\n @driver.deleteRule([name])\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @prd_attribute = PrdAttribute.find(params[:id])\n @prd_attribute.destroy\n\n #delete_rules()\n\n respond_to do |format|\n format.html { redirect_to(prd_attributes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @constraint = Constraint.find(params[:id])\n @constraint.destroy\n\n respond_to do |format|\n format.html { redirect_to constraints_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payin_rule = PayinRule.find_by(guid: params[:guid])\n\n if @payin_rule.destroy!\n head :ok\n else\n head :bad_request\n end\n end", "def destroy\n @notification_rule.destroy\n respond_to do |format|\n format.html { redirect_to notification_rules_url, notice: 'Notification rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete_rule!(objectID, forward_to_replicas = false, request_options = {})\n res = delete_rule(objectID, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def destroy\n @price_rule = PriceRule.find(params[:id])\n @price_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(price_rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reorder_rule.destroy\n respond_to do |format|\n format.html { redirect_to reorder_rules_url, notice: 'Reorder rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_firewall_rule project:, name:\n client = ::Google::Cloud::Compute::V1::Firewalls::Rest::Client.new\n operation = client.delete project: project, firewall: name\n\n wait_until_done operation: operation\nend", "def destroy\n #Finds selected validation\n @validation = Validation.find(params[:id])\n #destroys validation\n @validation.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def destroy\n @shcedule.destroy\n respond_to do |format|\n format.html { redirect_to shcedules_url, notice: 'Shcedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @nsgrule.destroy\n respond_to do |format|\n format.html { redirect_to nsgrules_url, notice: 'Nsgrule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider_fw_rule = ProviderFwRule.find(params[:id])\n @provider_fw_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to provider_fw_rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @code_rule = CodeRule.find(params[:id])\n @code_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(code_rules_url) }\n format.xml { head :ok }\n end\n end", "def clear\n @rule = Rule.find(params[:id])\n @rule.hits.destroy_all\n\n respond_to do |format|\n format.html { redirect_to params[:referrer] || @rule }\n end\n end", "def destroy\n @system_rule.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, @system] }\n format.xml { head :ok }\n format.js\n end\n website.add_log(user: current_user, action: \"Deleted system_rule: #{@system_rule.name}\")\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @rulemaking.destroy\n respond_to do |format|\n format.html { redirect_to rulemakings_url, notice: 'Rulemaking was successfully destroyed.' }\n end\n end", "def destroy\n @expression_relationship = ExpressionRelationship.find(params[:id])\n @expression_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to expression_relationships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @check_route.destroy\n respond_to do |format|\n format.html { redirect_to check_routes_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @asainactiverule = Asainactiverule.find(params[:id])\n @asainactiverule.destroy\n\n respond_to do |format|\n format.html { redirect_to asainactiverules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to definitions_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 @rule.destroy\n render :update do |page|\n page.hide(\"rule_#{@rule.id}\")\n end\n end", "def destroy\n @road = Road.find(params[:id])\n @road.destroy\n\n respond_to do |format|\n format.html { redirect_to roads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_rule.antragStatus\n @antrag_status.destroy\n respond_to do |format|\n format.html { redirect_to antrag_statuses_url, notice: 'Antrag status was successfully destroyed.' }\n format.json { head :no_content }\n end \n else\n redirect_to root_path alert: \"Keine Recht\"\n end\n \n end", "def destroy\n @student_group_rule = StudentGroupRule.find(params[:id])\n @student_group_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_group_rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flow = Flow.find(params[:id])\n @flow.destroy\n\n respond_to do |format|\n format.html { redirect_to flows_url, notice: t('view.flows.correctly_deleted') }\n format.json { head :ok }\n end\n end", "def destroy\n\n @definition = Definition.find(params[:id])\n @definition.destroy\n\n respond_to do |format|\n format.html { redirect_to(definitions_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @reloud_check = ReloudCheck.find(params[:id])\n @reloud_check.destroy\n\n respond_to do |format|\n format.html { redirect_to reloud_checks_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @expression_relationship_type = ExpressionRelationshipType.find(params[:id])\n @expression_relationship_type.destroy\n\n respond_to do |format|\n format.html { redirect_to expression_relationship_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\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 @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\n end", "def destroy\n reminder = @reminder_rule.reminder\n @reminder_rule.destroy\n CountAllocator.new(reminder).allocate!\n\n respond_to do |format|\n format.html { redirect_to reminder, notice: 'Reminder rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @violation.destroy\n respond_to do |format|\n format.html { redirect_to violations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_rule.antragtyp\n @antrag_typ.destroy\n respond_to do |format|\n format.html { redirect_to antrag_typs_url, notice: 'Antrag typ was successfully destroyed.' }\n format.json { head :no_content }\n end \n else\n redirect_to root_path alert: \"Keine Recht\"\n end\n \n end", "def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @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 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 @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.767555", "0.7588715", "0.7470095", "0.7402141", "0.7284156", "0.72284585", "0.7158197", "0.7144923", "0.7144923", "0.707657", "0.7033421", "0.7021132", "0.7005468", "0.69536763", "0.69455576", "0.68766856", "0.6860493", "0.68428296", "0.6833697", "0.6825529", "0.6805035", "0.6804649", "0.6777658", "0.6775988", "0.6763947", "0.6757245", "0.6751236", "0.6713236", "0.67066246", "0.6703521", "0.6640998", "0.6602139", "0.65917856", "0.65669936", "0.6566715", "0.65663046", "0.6523618", "0.6487697", "0.6485661", "0.64400464", "0.6431078", "0.6387214", "0.6386477", "0.6380591", "0.63738173", "0.63695467", "0.63556165", "0.63428813", "0.63300335", "0.6309002", "0.6304295", "0.6285076", "0.6273244", "0.62613016", "0.624825", "0.6241323", "0.62409616", "0.6232724", "0.6210787", "0.6189971", "0.61864257", "0.6186367", "0.61805946", "0.61724544", "0.61602557", "0.61391157", "0.6137108", "0.61368036", "0.61225885", "0.6118265", "0.6117493", "0.61039716", "0.6101307", "0.6098695", "0.6097174", "0.60886616", "0.6086042", "0.6086042", "0.6085944", "0.6081012", "0.6074239", "0.6064608", "0.6061697", "0.6055635", "0.6055635", "0.6053687", "0.60534394", "0.60521483", "0.60479933", "0.6041641", "0.6041181", "0.60396373", "0.6027929", "0.6011207", "0.6001717", "0.5995967", "0.59958726", "0.5990239", "0.5989807", "0.5987659", "0.5986866" ]
0.0
-1
GET /pro_asphalts GET /pro_asphalts.json
def index @q = ProAsphalt.ransack(params[:q]) @pro_asphalts = policy_scope(@q.result.order(day: :desc).paginate(:page => params[:page], :per_page => 20)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end", "def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end", "def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end", "def show\n @asproduct = Asproduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asproduct }\n end\n end", "def index\n @tsps = Tsp.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@tsps }\n end\n end", "def show\n @pinit = Pinit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinit }\n end\n end", "def index\n @pugs = Pug.all\n\n render json: @pugs\n end", "def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end", "def show\n @establec_ppal = EstablecPpal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @establec_ppal }\n end\n end", "def show\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voprosy }\n end\n end", "def index\n @nasp_rails = NaspRail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @nasp_rails }\n end\n end", "def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end", "def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end", "def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end", "def set_pro_asphalt\n @pro_asphalt = ProAsphalt.find(params[:id])\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 @programas = Programa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end", "def show\n @aspirant = Aspirant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @aspirant }\n end\n end", "def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end", "def show\n @bp = Bp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp }\n end\n end", "def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end", "def show\n @pizzashop = Pizzashop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pizzashop }\n end\n end", "def show\n @produktion_site = ProduktionSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produktion_site }\n end\n end", "def index\n @admin_pricing_foams = Admin::Pricing::Foam.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_foams.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end", "def index\n @ped_programs = PedProgram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_programs }\n end\n end", "def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end", "def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end", "def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def show\n @behatweb = Behatweb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @behatweb }\n end\n end", "def index\n render json: Procedure.all, status: :ok\n end", "def show\n render json: @prossumer\n end", "def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end", "def show\n @psa_state = PsaState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa_state }\n end\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index\n @parishes = Parish.all\n\n render json: @parishes\n end", "def show\n @appdotnet_social = AppdotnetSocial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appdotnet_social }\n end\n end", "def show\n \n @erp = Erp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @erp }\n end\n end", "def index\n @prueba_jsons = PruebaJson.all\n end", "def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end", "def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end", "def index\n @healthpros = Healthpro.all\n end", "def index\n @pizzas = Pizza.all\n render json: @pizzas\n end", "def show\n @harvest_trello = HarvestTrello.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @harvest_trello }\n end\n end", "def show\n render json: @pricing\n end", "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def show\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end", "def index\n @src_gsts = SrcGst.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @src_gsts }\n end\n end", "def show\n @web_app = WebApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_app }\n end\n end", "def show\n @nasp_rail = NaspRail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @nasp_rail }\n end\n end", "def show\n @program_app = ProgramApp.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @program_app\n end\n end\n end", "def index\n @programas = Programa.all_active\n @programa = Programa.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end", "def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def index\n @tp_parameters = TpParameter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tp_parameters }\n end\n end", "def index\n @proverbes = Proverbe.all\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 @produkt = Produkt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produkt }\n end\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def show\n @apuesta_detail = ApuestaDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apuesta_detail }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end", "def create\n @pro_asphalt = ProAsphalt.new(pro_asphalt_params)\n\n respond_to do |format|\n if @pro_asphalt.save\n format.html { redirect_to pro_asphalts_path(@pro_asphalt), notice: 'Pro asphalt was successfully created.' }\n format.json { render :show, status: :created, location: @pro_asphalt }\n else\n format.html { render :new }\n format.json { render json: @pro_asphalt.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end", "def index\n @level_progrations = LevelProgration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @level_progrations }\n end\n end", "def show\n @home_promotion = Home::Promotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_promotion }\n end\n end", "def show\n eps = EpV2.select(\"id,title,prelink\").where(\"show_id = #{params[:id]}\")\n .order(\"id DESC\").paginate(:page => params[:page], :per_page => 20)\n\n render :json => eps.to_json\n end", "def index\n @apartments = @building.apartments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apartments }\n end\n end", "def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end", "def index\n @pashiris = Pashiri.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 @programa = Programa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @programa }\n end\n end", "def index\n @proposals = Proposal.all\n\n render json: @proposals\n end", "def index\n @ped_program_definitions = PedProgramDefinition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_program_definitions }\n end\n end", "def show\n json_response(@api_v1_product)\n end", "def index\n @plans = Plan.all\n\n render json: @plans\n end", "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "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 show\n @amplicon = Amplicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @amplicon }\n end\n end", "def index\n @ventas_presupuestos = Ventas::Presupuesto.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_presupuestos }\n end\n end", "def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end", "def show\n @tsp = Tsp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@tsp }\n end\n end", "def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end", "def show\n @strategyweb = Strategyweb.find(params[:id])\n\n respond_to do |format|\n format.html\n# format.json { render json: @strategyweb }\n end\n end", "def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end", "def show\n @runway_ap = RunwayAp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @runway_ap }\n end\n end", "def new\n @psa = Psa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @psa }\n end\n end", "def show\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_slim }\n end\n end", "def index\n @parks = Park.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parks }\n end\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 index\n @homes = Home.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homes }\n end\n end", "def show\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospitalization }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_development_costs }\n end\n end", "def index\n get_sparepart\n get_data\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n format.js\n end\n end", "def index\n @himalayas = Himalaya.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def show\n @sklad = Sklad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sklad }\n end\n end", "def index\n @pubs = Pub.all\n\n render json: @pubs\n end", "def index\n @purchase_preferences = PurchasePreference.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchase_preferences }\n end\n end", "def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end" ]
[ "0.6379269", "0.6335165", "0.62464714", "0.62393945", "0.6178793", "0.61323595", "0.6052054", "0.60419554", "0.6037285", "0.5973937", "0.5973345", "0.59635615", "0.5940387", "0.59333044", "0.59324217", "0.5894664", "0.5892881", "0.5868076", "0.585804", "0.58449334", "0.5842571", "0.5831714", "0.5812938", "0.5806044", "0.580458", "0.5800266", "0.579123", "0.5787675", "0.57804424", "0.5764597", "0.5752211", "0.5743128", "0.5739279", "0.57366383", "0.57340723", "0.5731461", "0.5730515", "0.57260036", "0.5719794", "0.5719418", "0.5716706", "0.5716228", "0.5710243", "0.5709272", "0.57053626", "0.5703384", "0.56956136", "0.5694187", "0.5688355", "0.56877023", "0.5683264", "0.56793416", "0.567625", "0.5675927", "0.5673454", "0.5669105", "0.56675917", "0.5666339", "0.56597257", "0.56586707", "0.565476", "0.56501013", "0.5647028", "0.5643253", "0.564244", "0.5640499", "0.5634783", "0.56315625", "0.56282526", "0.56254226", "0.56236756", "0.5617429", "0.5616265", "0.5614751", "0.5612704", "0.5605517", "0.5605233", "0.5597118", "0.5596705", "0.55845404", "0.5583344", "0.55810654", "0.55772233", "0.55749637", "0.55725384", "0.55711234", "0.55660737", "0.5565551", "0.55621016", "0.5561025", "0.5560233", "0.55567795", "0.5555469", "0.5553121", "0.55509573", "0.5548334", "0.5547006", "0.5542281", "0.5539516", "0.553927" ]
0.58523124
19
GET /pro_asphalts/1 GET /pro_asphalts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end", "def show\n @asproduct = Asproduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asproduct }\n end\n end", "def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end", "def show\n @pinit = Pinit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinit }\n end\n end", "def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end", "def show\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voprosy }\n end\n end", "def show\n @establec_ppal = EstablecPpal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @establec_ppal }\n end\n end", "def show\n @produktion_site = ProduktionSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produktion_site }\n end\n end", "def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end", "def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def set_pro_asphalt\n @pro_asphalt = ProAsphalt.find(params[:id])\n end", "def index\n @tsps = Tsp.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@tsps }\n end\n end", "def index\n @pugs = Pug.all\n\n render json: @pugs\n end", "def show\n @produkt = Produkt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produkt }\n end\n end", "def show\n @pizzashop = Pizzashop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pizzashop }\n end\n end", "def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end", "def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end", "def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end", "def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end", "def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end", "def show\n @bp = Bp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp }\n end\n end", "def show\n render json: @prossumer\n end", "def index\n @programas = Programa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end", "def show\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end", "def show\n @programa = Programa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @programa }\n end\n end", "def index\n @ped_programs = PedProgram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_programs }\n end\n end", "def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end", "def show\n @psa_state = PsaState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa_state }\n end\n end", "def show\n \n @erp = Erp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @erp }\n end\n end", "def show\n @aspirant = Aspirant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @aspirant }\n end\n end", "def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end", "def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end", "def show\n @prod = Prod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prod }\n end\n end", "def show\n @program_app = ProgramApp.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @program_app\n end\n end\n end", "def show\n @behatweb = Behatweb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @behatweb }\n end\n end", "def index\n @nasp_rails = NaspRail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @nasp_rails }\n end\n end", "def show\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @propose }\n end\n end", "def index\n render json: Procedure.all, status: :ok\n end", "def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\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 respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end", "def index\n @prueba_jsons = PruebaJson.all\n end", "def index\n @parishes = Parish.all\n\n render json: @parishes\n end", "def show\n @promocion = Promocion.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @promocion }\n end\n end", "def new\n @psa = Psa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @psa }\n end\n end", "def show\n @prepagada = Prepagada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prepagada }\n end\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def show\n @prod = Prod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @prod }\n end\n end", "def show\n @apuesta_detail = ApuestaDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apuesta_detail }\n end\n end", "def show\n json_response(@api_v1_product)\n end", "def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end", "def index\n @programas = Programa.all_active\n @programa = Programa.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programas }\n end\n end", "def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end", "def show\n @home_promotion = Home::Promotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_promotion }\n end\n end", "def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end", "def index\n @proverbes = Proverbe.all\n end", "def index\n @tp_parameters = TpParameter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tp_parameters }\n end\n end", "def index\n @healthpros = Healthpro.all\n end", "def show\n @tsp = Tsp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@tsp }\n end\n end", "def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end", "def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end", "def show\n eps = EpV2.select(\"id,title,prelink\").where(\"show_id = #{params[:id]}\")\n .order(\"id DESC\").paginate(:page => params[:page], :per_page => 20)\n\n render :json => eps.to_json\n end", "def show\n @safra_produto = SafraProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_produto }\n end\n end", "def show\n @web_app = WebApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_app }\n end\n end", "def show\n @harvest_trello = HarvestTrello.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @harvest_trello }\n end\n end", "def show\n render json: @pricing\n end", "def show\n @ped_program = PedProgram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ped_program }\n end\n end", "def show\n @prospective = Prospective.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @prospective }\n end\n end", "def index\n @admin_pricing_foams = Admin::Pricing::Foam.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_pricing_foams.map { |i| { value: i.id, text: i.to_s } }, status: :ok }\n end\n end", "def show\n @appdotnet_social = AppdotnetSocial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appdotnet_social }\n end\n end", "def show\n @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @propuesta }\n end\n end", "def show\n @p_detail = PDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @p_detail }\n end\n end", "def index\n @proposals = Proposal.all\n\n render json: @proposals\n end", "def show\n @nasp_rail = NaspRail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @nasp_rail }\n end\n end", "def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end", "def index\n @pizzas = Pizza.all\n render json: @pizzas\n end", "def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end", "def create\n @pro_asphalt = ProAsphalt.new(pro_asphalt_params)\n\n respond_to do |format|\n if @pro_asphalt.save\n format.html { redirect_to pro_asphalts_path(@pro_asphalt), notice: 'Pro asphalt was successfully created.' }\n format.json { render :show, status: :created, location: @pro_asphalt }\n else\n format.html { render :new }\n format.json { render json: @pro_asphalt.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @profesore = Profesore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesore }\n end\n end", "def index\n @prospies = Prospie.all\n end", "def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end", "def show\n @proficiency = Proficiency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proficiency }\n end\n end", "def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end", "def show\n @promo = Promo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promo }\n end\n end", "def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def index\n @projetos = Projeto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projetos }\n end\n end", "def show\n @preguntum = Preguntum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preguntum }\n end\n end", "def show\n @strategyweb = Strategyweb.find(params[:id])\n\n respond_to do |format|\n format.html\n# format.json { render json: @strategyweb }\n end\n end", "def index\n @proyects = Proyect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proyects }\n end\n end", "def show\n @phlog = Phlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phlog }\n end\n end", "def index\n @pashiris = Pashiri.all\n end", "def show\n @home_searches_product = Home::Searches::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_product }\n end\n end", "def show\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospitalization }\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 show\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipante }\n end\n end", "def index\n @level_progrations = LevelProgration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @level_progrations }\n end\n end", "def show\n @runway_ap = RunwayAp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @runway_ap }\n end\n end" ]
[ "0.66307276", "0.6440781", "0.64183074", "0.63948107", "0.6373259", "0.6304016", "0.62000364", "0.6185852", "0.6163788", "0.61514455", "0.6136792", "0.6119852", "0.6095174", "0.6067323", "0.60637444", "0.6062768", "0.6060332", "0.6047385", "0.6044225", "0.60409296", "0.6022435", "0.6021306", "0.60207313", "0.60084957", "0.5999919", "0.59889483", "0.59670407", "0.5926445", "0.59197086", "0.59155494", "0.5911966", "0.59094256", "0.59077626", "0.59055805", "0.59051645", "0.59051645", "0.5892319", "0.588649", "0.58713394", "0.58679515", "0.58663", "0.58649427", "0.5862399", "0.5850892", "0.58487225", "0.5848591", "0.58468986", "0.5843994", "0.5841541", "0.58413774", "0.5839993", "0.5839049", "0.58290136", "0.58287436", "0.5826933", "0.58255124", "0.5823318", "0.58196616", "0.5818822", "0.5817973", "0.5814343", "0.58070916", "0.5798709", "0.5798302", "0.57966936", "0.57952696", "0.5784838", "0.57836837", "0.57817566", "0.5777917", "0.577773", "0.57755536", "0.5775296", "0.57706076", "0.5770313", "0.57680887", "0.5763941", "0.57604", "0.5754502", "0.57531106", "0.5748574", "0.5748309", "0.57441324", "0.57351404", "0.5732657", "0.57270604", "0.5722353", "0.5722284", "0.5721663", "0.5721555", "0.5720187", "0.5719908", "0.57162917", "0.5714441", "0.57137", "0.57132125", "0.57097137", "0.57085997", "0.5708248", "0.5707427", "0.5700897" ]
0.0
-1
POST /pro_asphalts POST /pro_asphalts.json
def create @pro_asphalt = ProAsphalt.new(pro_asphalt_params) respond_to do |format| if @pro_asphalt.save format.html { redirect_to pro_asphalts_path(@pro_asphalt), notice: 'Pro asphalt was successfully created.' } format.json { render :show, status: :created, location: @pro_asphalt } else format.html { render :new } format.json { render json: @pro_asphalt.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @pro_asphalt_type = ProAsphaltType.new(pro_asphalt_type_params)\n\n respond_to do |format|\n if @pro_asphalt_type.save\n format.html { redirect_to @pro_asphalt_type, notice: 'Pro asphalt type was successfully created.' }\n format.json { render :show, status: :created, location: @pro_asphalt_type }\n else\n format.html { render :new }\n format.json { render json: @pro_asphalt_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def pro_asphalt_params\n params.require(:pro_asphalt).permit(:province_pro_asset_id, :day, :pro_asphalt_hours, :pro_asphalt_machines_num, pro_asphalt_subs_attributes: ProAsphaltSub.attribute_names.map(&:to_sym).push(:_destroy))\n end", "def pro_asphalt_type_params\n params.require(:pro_asphalt_type).permit(:pro_asphalt_type_name)\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n @spaethi = Spaethi.new(params[:spaethi])\n\n respond_to do |format|\n if @spaethi.save\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully created.' }\n format.json { render json: @spaethi, status: :created, location: @spaethi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @psa = Psa.new(params[:psa])\n\n respond_to do |format|\n if @psa.save\n format.html { redirect_to @psa, notice: 'Psa was successfully created.' }\n format.json { render json: @psa, status: :created, location: @psa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @psa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asproduct = Asproduct.new(params[:asproduct])\n\n respond_to do |format|\n if @asproduct.save\n format.html { redirect_to @asproduct, notice: 'Asproduct was successfully created.' }\n format.json { render json: @asproduct, status: :created, location: @asproduct }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asproduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def pay\n #definitin de l'url de base\n base_payment_url = 'http://197.159.2.146:7086/sprintpayapi/payment/orangemoney/request'\n #definition des headers\n\n headers: {\n 'Postman-Token': '9669f6e7-402b-4dc9-a370-472194583c32',\n 'cache-control': 'no-cache',\n 'Authorization': 'SP:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n 'DateTime': 'YYYYYYYYYYYYYYYYYYYY',\n 'Content-Type': 'application/json'\n }\n\n #defintion du bodies/main content\n setBody: {\n \"amount\": 1,\n \"currency\": \"EUR\",\n \"firstName\": \"AMADOU\",\n \"lastName\": \"BAKARI\",\n \"address1\": \"Yaounde\",\n \"address2\": \"Nkolfoulou\",\n \"city\": \"Yaounde\",\n \"state\": \"Centre\",\n \"country\": \"FR\",\n \"postal\": \"0332\",\n \"mobileNumber\": \"237690000999\",\n \"emailId\": \"amadoubakari@gmail.com\",\n \"spMerchandUrl\": \"http://sprint-pay.com/\"\n }\n\n #envoi du paiement\n response = httparty.post(\n base_payment_url,\n body: setBody,\n headers: headers\n )\n\n self.class.post(\n base_payment_url,\n body: setBody,\n headers: headers\n )\n #puts response\n\n end", "def new\n @psa = Psa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @psa }\n end\n end", "def set_pro_asphalt\n @pro_asphalt = ProAsphalt.find(params[:id])\n end", "def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end", "def create\n @thuctap = Thuctap.new(thuctap_params)\n respond_to do |format|\n if @thuctap.save\n format.html { redirect_to @thuctap, notice: 'Thuctap was successfully created.' }\n format.json { render :show, status: :created, location: @thuctap }\n else\n format.html { render :new }\n format.json { render json: @thuctap.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @the_rasp = TheRasp.new(the_rasp_params)\n\n respond_to do |format|\n if @the_rasp.save\n format.html { redirect_to @the_rasp, notice: 'The rasp was successfully created.' }\n format.json { render :show, status: :created, location: @the_rasp }\n else\n format.html { render :new }\n format.json { render json: @the_rasp.errors, status: :unprocessable_entity }\n end\n end\n end", "def thuctap_params\n params.require(:thuctap).permit(:partner_info_id, :title, :content, :address, :tag, :endtime)\n end", "def update\n respond_to do |format|\n if @pro_asphalt.update(pro_asphalt_params)\n format.html { redirect_to pro_asphalts_path(@pro_asphalt), notice: 'Pro asphalt was successfully updated.' }\n format.json { render :show, status: :ok, location: @pro_asphalt }\n else\n format.html { render :edit }\n format.json { render json: @pro_asphalt.errors, status: :unprocessable_entity }\n end\n end\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def create\n @aspirant = Aspirant.new(params[:aspirant])\n\n respond_to do |format|\n if @aspirant.save\n format.html { redirect_to @aspirant, :notice => 'Аспирант успешно создан.' }\n format.json { render :json => @aspirant, :status => :created, :location => @aspirant }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @aspirant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @pashiri = Pashiri.new(pashiri_params)\n\n respond_to do |format|\n if @pashiri.save\n format.html { redirect_to @pashiri, notice: 'Pashiri was successfully created.' }\n format.json { render :show, status: :created, location: @pashiri }\n else\n format.html { render :new }\n format.json { render json: @pashiri.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paradigm_praat = ParadigmPraat.new(paradigm_praat_params[:paradigm_praat])\n\n respond_to do |format|\n if @paradigm_praat.save\n format.html { redirect_to @paradigm_praat, notice: 'Paradigm praat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @paradigm_praat }\n else\n format.html { render action: 'new' }\n format.json { render json: @paradigm_praat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alunosprof = Alunosprof.new(alunosprof_params)\n\n respond_to do |format|\n if @alunosprof.save\n format.html { redirect_to @alunosprof, notice: 'Alunosprof was successfully created.' }\n format.json { render :show, status: :created, location: @alunosprof }\n else\n format.html { render :new }\n format.json { render json: @alunosprof.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ahoogah = Ahoogah.new(ahoogah_params)\n\n respond_to do |format|\n if @ahoogah.save\n format.html { redirect_to @ahoogah, notice: 'Ahoogah was successfully created.' }\n format.json { render :show, status: :created, location: @ahoogah }\n else\n format.html { render :new }\n format.json { render json: @ahoogah.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hospice = Hospice.new(hospice_params)\n\n respond_to do |format|\n if @hospice.save\n format.html { redirect_to @hospice, notice: 'Hospice was successfully created.' }\n format.json { render :show, status: :created, location: @hospice }\n else\n format.html { render :new }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ppb = Ppb.new(ppb_params)\n\n respond_to do |format|\n if @ppb.save\n format.html { redirect_to @ppb, notice: 'Pharmaceutical Listing was successfully created.' }\n format.json { render :show, status: :created, location: @ppb }\n else\n format.html { render :new }\n format.json { render json: @ppb.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shiva = Shiva.new(shiva_params)\n respond_to do |format|\n if @shiva.save\n format.html { redirect_to @shiva, notice: 'Shiva was successfully created.' }\n #format.js\n format.json { render :show, status: :created, location: @shiva }\n else\n format.html { render :new }\n #format.js\n format.json { render json: @shiva.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @healthpro = Healthpro.new(@healthpro)\n\n respond_to do |format|\n if @healthpro.save\n format.html { redirect_to @healthpro, notice: 'Healthpro was successfully created.' }\n format.json { render action: 'show', status: :created, location: @healthpro }\n else\n format.html { render action: 'new' }\n format.json { render json: @healthpro.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "def create\n @obsah = Obsah.new(obsah_params)\n respond_to do |format|\n if @obsah.save\n format.html { redirect_to @obsah, notice: 'Obsah was successfully created.' }\n format.json { render :show, status: :created, location: @obsah }\n else\n format.html { render :new }\n format.json { render json: @obsah.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @surah = Surah.new(surah_params)\n\n respond_to do |format|\n if @surah.save\n format.html { redirect_to @surah, notice: 'Surah was successfully created.' }\n format.json { render action: 'show', status: :created, location: @surah }\n else\n format.html { render action: 'new' }\n format.json { render json: @surah.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @spaethi = Spaethi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spaethi }\n end\n end", "def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sulabh_address = SulabhAddress.new(sulabh_address_params)\n\n respond_to do |format|\n if @sulabh_address.save\n format.html { redirect_to @sulabh_address, notice: 'Sulabh address was successfully created.' }\n\t\tformat.js\n format.json { render :show, status: :created, location: @sulabh_address }\n else\n format.html { render :new }\n format.json { render json: @sulabh_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @probando = Probando.new(probando_params)\n\n respond_to do |format|\n if @probando.save\n format.html { redirect_to @probando, notice: 'Probando was successfully created.' }\n format.json { render :show, status: :created, location: @probando }\n else\n format.html { render :new }\n format.json { render json: @probando.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @apuesta_detail = ApuestaDetail.new(params[:apuesta_detail])\n\n respond_to do |format|\n if @apuesta_detail.save\n format.html { redirect_to @apuesta_detail, notice: 'Apuesta detail was successfully created.' }\n format.json { render json: @apuesta_detail, status: :created, location: @apuesta_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @apuesta_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @palabra_bolsa = PalabraBolsa.new(palabra_bolsa_params)\n\n respond_to do |format|\n if @palabra_bolsa.save\n format.html { redirect_to @palabra_bolsa, notice: 'Palabra bolsa was successfully created.' }\n format.json { render :show, status: :created, location: @palabra_bolsa }\n else\n format.html { render :new }\n format.json { render json: @palabra_bolsa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @angelitopro = Angelitopro.new(angelitopro_params)\n\n respond_to do |format|\n if @angelitopro.save\n format.html { redirect_to @angelitopro, notice: \"Angelitopro was successfully created.\" }\n format.json { render :show, status: :created, location: @angelitopro }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @angelitopro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @runway_ap = RunwayAp.new(params[:runway_ap])\n\n respond_to do |format|\n if @runway_ap.save\n format.html { redirect_to @runway_ap, notice: 'Runway ap was successfully created.' }\n format.json { render json: @runway_ap, status: :created, location: @runway_ap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @runway_ap.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Loggin data from POST\n logger.debug \"--\" * 50\n logger.debug \"Data from POST: #{params.inspect}\"\n logger.debug \"--\" * 50\n\n @nasp_rail = NaspRail.new(params.keep_if { |key, value| NaspRail.column_names.include? key })\n\n respond_to do |format|\n if @nasp_rail.save\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @nasp_rail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_pro_asphalt_type\n @pro_asphalt_type = ProAsphaltType.find(params[:id])\n end", "def create\n @psa_state = PsaState.new(params[:psa_state])\n\n respond_to do |format|\n if @psa_state.save\n format.html { redirect_to @psa_state, notice: 'Psa state was successfully created.' }\n format.json { render json: @psa_state, status: :created, location: @psa_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @psa_state.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 new\n @asproduct = Asproduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asproduct }\n end\n end", "def create\n @pkhd = Pkhd.new(pkhd_params)\n\n respond_to do |format|\n if @pkhd.save\n format.html { redirect_to edit_pkhd_path(@pkhd), notice: 'Pemakaian Berhasil di Buat.' }\n #format.json { render :show, status: :created, location: @pkhd }\n else\n format.html { render :new }\n format.json { render json: @pkhd.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anuphat = Anuphat.new(anuphat_params)\n\n respond_to do |format|\n if @anuphat.save\n format.html { redirect_to @anuphat, notice: 'Anuphat was successfully created.' }\n format.json { render :show, status: :created, location: @anuphat }\n else\n format.html { render :new }\n format.json { render json: @anuphat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def create\n @tuhu_prodoct = Tuhu::Prodoct.new(tuhu_prodoct_params)\n\n respond_to do |format|\n if @tuhu_prodoct.save\n format.html { redirect_to @tuhu_prodoct, notice: 'Prodoct was successfully created.' }\n format.json { render :show, status: :created, location: @tuhu_prodoct }\n else\n format.html { render :new }\n format.json { render json: @tuhu_prodoct.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pendaftaran_kela = PendaftaranKela.new(pendaftaran_kela_params)\n\n respond_to do |format|\n if @pendaftaran_kela.save\n format.html { redirect_to @pendaftaran_kela, notice: 'Pendaftaran kela was successfully created.' }\n format.json { render :show, status: :created, location: @pendaftaran_kela }\n else\n format.html { render :new }\n format.json { render json: @pendaftaran_kela.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end", "def create\n @pai = Pai.new(pai_params)\n\n respond_to do |format|\n if @pai.save\n format.html { redirect_to pais_path, notice: 'Pais creado existosamente.' }\n format.json { render :index, status: :created, location: @pai }\n else\n format.html { render :new }\n format.json { render json: @pai.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 create\n @establec_ppal = EstablecPpal.new(params[:establec_ppal])\n\n respond_to do |format|\n if @establec_ppal.save\n format.html { redirect_to @establec_ppal, notice: 'Registro creado satisfactoriamente.' }\n format.json { render json: @establec_ppal, status: :created, location: @establec_ppal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @establec_ppal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exp_profissional = ExpProfissional.new(exp_profissional_params)\n\n respond_to do |format|\n if @exp_profissional.save\n format.html { redirect_to @exp_profissional, notice: 'Exp profissional was successfully created.' }\n format.json { render :show, status: :created, location: @exp_profissional }\n else\n format.html { render :new }\n format.json { render json: @exp_profissional.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n\n if Pricing.varient_split_add params\n #audit(@pricing, current_user)\n render json: @pricing, status: :created\n else\n render json: @pricing.errors, status: :unprocessable_entity\n end\n end", "def create\n @shouldersbiceps1 = Shouldersbiceps1.new(shouldersbiceps1_params)\n\n respond_to do |format|\n if @shouldersbiceps1.save\n format.html { redirect_to @shouldersbiceps1, notice: 'Shouldersbiceps1 was successfully created.' }\n format.json { render :show, status: :created, location: @shouldersbiceps1 }\n else\n format.html { render :new }\n format.json { render json: @shouldersbiceps1.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # merge the raw post data into the params\n params.merge!(Rack::Utils.parse_nested_query(request.raw_post))\n\n url = params[:australia_post_api_connection][:shop]\n\n #try to find the shop preference using url\n preference = Preference.find_by_shop_url!(url)\n\n # recalculate the weight to include blanks\n calculated_weight = params[:australia_post_api_connection][:blanks].to_i * preference.default_weight.to_f\n calculated_weight += params[:australia_post_api_connection][:weight].to_f\n\n items = params[:australia_post_api_connection][:items]\n \n if (preference.offers_flat_rate)\n if (calculated_weight <= preference.under_weight)\n @service_list = Array.new\n @service_list.append({ name: \"Shipping\",\n code: \"Shipping\",\n price: preference.flat_rate.to_s}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return #evil...\n end\n end\n \n weight = params[:australia_post_api_connection][:weight]\n \n if (preference.free_shipping_by_collection)\n subtract_weight = 0\n \n #get free shipping items weight and subtract total weight.\n item_array = items.split(',')\n \n app_shop = Shop.find_by_url(url)\n \n ShopifyAPI::Session.temp(app_shop.myshopify_domain, app_shop.token) do \n item_array.each do |item|\n variant = ShopifyAPI::VariantWithProduct.find(item) \n p = ShopifyAPI::Product.find(variant.product_id)\n \n p.collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n \n p.smart_collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n end\n end\n \n \n weight = weight.to_f - subtract_weight/1000\n end\n\n\n if (weight.to_f == 0.0)\n #no need to call australia post. no weight of item\n @service_list = Array.new\n @service_list.append({ name: \"Free Shipping\",\n code: \"Free Shipping\",\n price: \"0.0\"}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return\n else \n @australia_post_api_connection = AustraliaPostApiConnection.new({:weight=> weight,\n :blanks => params[:australia_post_api_connection][:blanks],\n :from_postcode => preference.origin_postal_code,\n :country_code => params[:australia_post_api_connection][:country_code],\n :to_postcode => params[:australia_post_api_connection][:to_postcode],\n :height=>preference.height, :width=>preference.width, :length=>preference.length,\n :container_weight => preference.container_weight, :items => items\n })\n end\n \n @australia_post_api_connection.domestic = ( @australia_post_api_connection.country_code == \"AUS\" )\n\n # get country list from the API -- we'll format these if there were no errors\n @service_list = @australia_post_api_connection.data_oriented_methods(:service) # get the service list\n\n if @australia_post_api_connection.domestic\n shipping_methods = preference.shipping_methods_allowed_dom\n shipping_desc = preference.shipping_methods_desc_dom\n else\n shipping_methods = preference.shipping_methods_allowed_int\n shipping_desc = preference.shipping_methods_desc_int\n end\n\n respond_to do |format|\n if @australia_post_api_connection.save\n\n @countries = get_country_list(@australia_post_api_connection)\n # TODO right now we are not including the suboptions for each shipping type\n #filter out unwanted methods more efficiently?\n\n @service_list = Array.wrap( @service_list[1]['service'] ).inject([]) do |list, service|\n Rails.logger.debug(\"service code is \" + service['code'])\n if shipping_methods[service['code']]\n price_to_charge = service['price'].to_f\n shipping_name = shipping_desc[service['code']].blank? ? service['name'] : shipping_desc[service['code']]\n unless preference.nil?\n unless preference.surcharge_percentage.nil?\n if preference.surcharge_percentage > 0.0\n price_to_charge =(price_to_charge * (1 + preference.surcharge_percentage/100)).round(2)\n end\n end\n\n unless preference.surcharge_amount.nil?\n if preference.surcharge_amount > 0.0\n price_to_charge = (price_to_charge + preference.surcharge_amount).round(2)\n end\n end\n end\n\n list.append({ name: shipping_name,\n code: service['code'],\n price: price_to_charge})\n end\n \n list\n end\n\n # check if need to add free shipping option\n if (preference.free_shipping_option)\n @service_list.append({ name: preference.free_shipping_description,\n code: \"Free\",\n price: \"0.00\"})\n end\n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false }\n else // if @australia_post_api_connection.save\n # set the flash\n\n flash.now[:error] = @australia_post_api_connection.api_errors.join(', ')\n # format.html { render action: \"new\" }\n # format.json { render json: @australia_post_api_connection.errors, status: :unprocessable_entity }\n # if (flash.now[:error].blank?)\n # format.html { render :text => \"api_error\" }\n # else\n format.html { render partial: \"trouble\", layout: false }\n # end\n end\n end\n end", "def sponser_params\n params.require(:sponser).permit(:name, :Address, :Catagory, :Gander, :Funding, :Typemanagment, :phone, :exprience, :sponcerBio)\n end", "def create\n @wide_puppet = WidePuppet.new(wide_puppet_params)\n\n respond_to do |format|\n if @wide_puppet.save\n format.html { redirect_to action: \"index\", notice: 'Wide puppet was successfully created.' }\n format.json { render :show, status: :created, location: @wide_puppet }\n else\n format.html { render :new }\n format.json { render json: @wide_puppet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit!\n @msshipbag = Msshipbag.new(params[:msshipbag])\n\n respond_to do |format|\n if @msshipbag.save\n format.html { redirect_to(@msshipbag, :notice => 'Msshipbag was successfully created.') }\n format.xml { render :xml => @msshipbag, :status => :created, :location => @msshipbag }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @msshipbag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @pinit = Pinit.new(params[:pinit])\n\n respond_to do |format|\n if @pinit.save\n format.html { redirect_to @pinit, notice: 'Pinit was successfully created.' }\n format.json { render json: @pinit, status: :created, location: @pinit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pinit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @abogado_p = AbogadoP.new(abogado_p_params)\n\n respond_to do |format|\n if @abogado_p.save\n format.html { redirect_to abogado_ps_path, notice: 'El abogado se ha creado correctamente.' }\n format.json { render :show, status: :created, location: @abogado_p }\n else\n format.html { render :new }\n format.json { render json: @abogado_p.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_parks_from_api\n url = \"https://developer.nps.gov/api/v1/parks?limit=500&api_key=GhGhpL8DrRdsEAwfu0Mn4gXuhgkdnhVnrEnNfmRx\"\n resp = RestClient.get(url)\n json_hash = JSON.parse(resp)\n park_codes = []\n\n json_hash.each do |data_key, value|\n if data_key[\"data\"]\n value.each do |hash_keys|\n Park.create(park_name: hash_keys[\"fullName\"], park_code: hash_keys[\"parkCode\"])\n \n end\n end\n end\n\nend", "def create\n @spkj_bsb = SpkjBsb.new(params[:spkj_bsb])\n # @spkj_bsb.tname=current_user.name\n @spkj_bsb.user_id = current_user.id\n @spkj_bsb.uid = current_user.uid\n @spkj_bsb.sp_s_52=current_user.user_s_province\n @spkj_bsb.sp_i_state=1\n @spkj_bsb.save\n respond_to do |format|\n format.html { redirect_to(\"/spkj_bsbs\") }\n format.json { render json: @spkj_bsb }\n end\n end", "def create\n @essay = Essay.new(params[:essay])\n\n respond_to do |format|\n if @essay.save\n format.html { redirect_to @essay, 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 #raise penduduk_params.to_yaml\n @penduduk = Penduduk.new(penduduk_params)\n @golongan_darahs = GolonganDarah.all\n @agamas = Agama.all\n @pekerjaans= Pekerjaan.all\n @status_keluargas = StatusKeluarga.all\n @pendidikans = Pendidikan.all\n @kelurahans = Kelurahan.all\n @kecamatans = Kecamatan.all\n @kabupatens = Kabupaten.all\n @penghasilans = Penghasilan.all \n respond_to do |format|\n if @penduduk.save\n format.html { redirect_to @penduduk, notice: 'Penduduk was successfully created.' }\n format.json { render :show, status: :created, location: @penduduk }\n else\n format.html { render :new }\n format.json { render json: @penduduk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pharmacy = Pharmacy.new(pharmacy_params)\n respond_to do |format|\n if @pharmacy.save\n format.json { render :show, status: :created, location: @pharmacy }\n else\n format.json { render json: @pharmacy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @formaspagamento = Formaspagamento.new(formaspagamento_params)\n\n respond_to do |format|\n if @formaspagamento.save\n format.html { redirect_to formaspagamentos_url, notice: 'Forma de Pagamento criada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @formaspagamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bp = Bp.new(params[:bp])\n\n respond_to do |format|\n if @bp.save\n format.html { redirect_to @bp, notice: 'Bp was successfully created.' }\n format.json { render json: @bp, status: :created, location: @bp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bp.errors, status: :unprocessable_entity }\n end\n end\n end", "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 # @site_appraisal = SiteAppraisal.new(site_appraisal_params)\n @site_appraisal = current_user.site_appraisals.build(site_appraisal_params)\n\n respond_to do |format|\n if @site_appraisal.save\n format.html { redirect_to @site_appraisal, notice: \"Site appraisal was successfully created.\" }\n format.json { render :show, status: :created, location: @site_appraisal }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @site_appraisal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @snp = Snp.new(params[:snp])\n\n respond_to do |format|\n if @snp.save\n format.html { redirect_to @snp, notice: 'Snp was successfully created.' }\n format.json { render json: @snp, status: :created, location: @snp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @snp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spiking = Spiking.new(spiking_params)\n\n respond_to do |format|\n if @spiking.save\n format.html { redirect_to @spiking, notice: 'Spiking was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spiking }\n else\n format.html { render action: 'new' }\n format.json { render json: @spiking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @division_pai = DivisionPai.new(division_pai_params)\n\n respond_to do |format|\n if @division_pai.save\n format.html { redirect_to @division_pai, notice: 'Division pais creada exitosamente.' }\n format.json { render :show, status: :created, location: @division_pai }\n else\n format.html { render :new }\n format.json { render json: @division_pai.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_sap_pvm_instance(instance_hash)\n post(\"cloud-instances/#{guid}/sap\", instance_hash.to_json)\n end", "def create\n @estadopro = Estadopro.new(estadopro_params)\n\n respond_to do |format|\n if @estadopro.save\n format.html { redirect_to @estadopro, notice: 'Estadopro was successfully created.' }\n format.json { render :show, status: :created, location: @estadopro }\n else\n format.html { render :new }\n format.json { render json: @estadopro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shouldersbiceps3 = Shouldersbiceps3.new(shouldersbiceps3_params)\n\n respond_to do |format|\n if @shouldersbiceps3.save\n format.html { redirect_to @shouldersbiceps3, notice: 'Shouldersbiceps3 was successfully created.' }\n format.json { render :show, status: :created, location: @shouldersbiceps3 }\n else\n format.html { render :new }\n format.json { render json: @shouldersbiceps3.errors, status: :unprocessable_entity }\n end\n end\n end", "def hookah_params\n params.require(:hookah).permit(:title, :description)\n end", "def create\n @plasmid_probe = PlasmidProbe.new(plasmid_probe_params)\n\n respond_to do |format|\n if @plasmid_probe.save\n format.html { redirect_to @plasmid_probe, notice: 'Plasmid probe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @plasmid_probe }\n else\n format.html { render action: 'new' }\n format.json { render json: @plasmid_probe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # rp - request parameters\n rp = req_params\n\n # сюда будем собирать ошибки при проверке заявки\n errors = {}\n\n model_name(rp, errors)\n aas_names(rp, errors)\n check_human(rp, errors)\n\n if errors.empty?\n export(rp) if PSOFT_DB\n mail(rp)\n render json: { message: format(I18n.t('request.status.ok'), id: rp.id || ' -') }\n else\n render status: :unprocessable_entity, json: errors\n end\n end", "def create\n @appwebexemp = Appwebexemp.new(appwebexemp_params)\n\n respond_to do |format|\n if @appwebexemp.save\n format.html { redirect_to @appwebexemp, notice: 'Appwebexemp was successfully created.' }\n format.json { render :show, status: :created, location: @appwebexemp }\n else\n format.html { render :new }\n format.json { render json: @appwebexemp.errors, status: :unprocessable_entity }\n end\n end\n end", "def ahoogah_params\n params.require(:ahoogah).permit(:License, :State, :Comment, :Tag1, :Tag2, :Tag3)\n end", "def create\n @hanghoa = Hanghoa.new(hanghoa_params)\n\n respond_to do |format|\n if @hanghoa.save\n format.html { redirect_to @hanghoa, notice: \"Hanghoa was successfully created.\" }\n format.json { render :show, status: :created, location: @hanghoa }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @hanghoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def foodsp_params\n params.require(:foodsp).permit(:productsp, :pricesp, :expirysp, :caloriessp, :proteinssp, :sugarsp, :fatsp, :customersp_id)\n end", "def add_prowl(options)\n uri = URI.parse(\"https://prowl.weks.net/publicapi/add\")\n https = Net::HTTP.new(uri.host, uri.port)\n # We have to use SSL\n https.use_ssl = true\n # Avoid to get warning\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Post.new(uri.path)\n # Default options for notifications\n options = {:apikey => $configure[:prowl][:apikey], :application => \"Twitter\", :priority => 0}.merge(options)\n req.set_form_data(options)\n https.request(req)\nend", "def create\n @nap = Nap.new(nap_params)\n\n respond_to do |format|\n if @nap.save\n format.html { redirect_to @nap, notice: 'Nap was successfully created.' }\n format.json { render :show, status: :created, location: @nap }\n else\n format.html { render :new }\n format.json { render json: @nap.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @nasp_rail = NaspRail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @nasp_rail }\n end\n end", "def spiking_params\n params.require(:spiking).permit(:spik_short_name, :spik_long_name, :spik_process_description, :spik_device_needed, :pros, :cons, :reference_id, :user_id)\n end", "def create\n @atp_stock = AtpStock.new(atp_stock_params)\n\n respond_to do |format|\n if @atp_stock.save\n format.html { redirect_to @atp_stock, notice: 'Atp stock was successfully created.' }\n format.json { render :show, status: :created, location: @atp_stock }\n else\n format.html { render :new }\n format.json { render json: @atp_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def hanghoa_params\n params.require(:hanghoa).permit(:tensp, :mota, :anh, :soluong, :dongia, :iddanhmuc)\n end", "def suscriber_wm\n\t\turi = URI(\"http://staging.benchprep.com/api/v1/test/fixtures.json\")\t\n\n\t\tres = Net::HTTP.post_form(uri, 'email' => 'integration-tester+1@benchprep.com&enrollments_persona=subscriber&devices_persona=web_and_mobile')\n\t\t# write this output to a file\n\t\toutput = File.open( \"spec/fixtures/sp_wm_persona.json\",'w' ){|f| \n\t\t\tf.flock(File::LOCK_EX)\n\t\t\tf.write(res.body)\n\t\t}\n\n\t\t# Now parse this string as json\n\t\tjson = File.read('spec/fixtures/sp_wm_persona.json')\n\t\templs = JSON.parse(json)\n\n\t\treturn empls #pretty printed output\n\tend", "def create\n\n @prepagada = Prepagada.new({ :prepagada => params[:prepagada], :odontologo_id => params[:odontologo_id] })\n\n respond_to do |format|\n if @prepagada.save\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully created.' }\n format.json { render json: @prepagada, status: :created, location: @prepagada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pra = Pra.new(pra_params)\n\n respond_to do |format|\n if @pra.save\n format.html { redirect_to @pra, notice: 'Pra was successfully created.' }\n format.json { render :show, status: :created, location: @pra }\n else\n format.html { render :new }\n format.json { render json: @pra.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @new_pro = NewPro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_pro }\n end\n #ejecutar el shell de wapp\n\n \n\n end", "def add_pbts pbts\n params = init_params\n params[:pbts] = pbts.to_json\n request_url = UrlGenerator.url_for(\"pbts\", \"add\")\n asgn = SignatureGenerator.signature_for(http_verb: 'POST', url: request_url, params: params)\n\n res = self.post(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end", "def create\n @phenological_stage = PhenologicalStage.new(phenological_stage_params)\n\n respond_to do |format|\n if @phenological_stage.save\n format.js\n format.html { redirect_to @phenological_stage, notice: 'Phenological stage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @phenological_stage }\n else\n format.js\n format.html { render action: 'new' }\n format.json { render json: @phenological_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @voprosy = Voprosy.new(params[:voprosy])\n\n respond_to do |format|\n if @voprosy.save\n format.html { redirect_to @voprosy, notice: 'Voprosy was successfully created.' }\n format.json { render json: @voprosy, status: :created, location: @voprosy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @voprosy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @addh = Addh.new(addh_params)\n\n respond_to do |format|\n if @addh.save\n format.html { redirect_to @addh, notice: 'Addh was successfully created.' }\n format.json { render :show, status: :created, location: @addh }\n else\n format.html { render :new }\n format.json { render json: @addh.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @behatweb = Behatweb.new(params[:behatweb])\n\n respond_to do |format|\n \n\n if @behatweb.save\n format.html { redirect_to @behatweb, notice: 'Behatweb was successfully created.' }\n format.json { render json: @behatweb, status: :created, location: @behatweb }\n else\n format.html { render action: \"new\" , :layout => 'default'}\n format.json { render json: @behatweb.errors, status: :unprocessable_entity ,action: \"new\"}\n end\n end\n end", "def create\n apt_data = params[:apt]\n picture_ids = apt_data.delete :picture_ids\n @apt = Apt.new(apt_data)\n\n respond_to do |format|\n if @apt.save\n update_pictures_with_apt_id picture_ids, @apt\n\n format.html { redirect_to @apt, notice: 'Apt was successfully created.' }\n format.json { render json: @apt, status: :created, location: @apt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @apt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sponsercf = Sponsercf.new(sponsercf_params)\n\n respond_to do |format|\n if @sponsercf.save\n \n format.html { redirect_to @sponsercf, notice: 'Sponsercf was successfully created.' }\n format.json { render :show, status: :created, location: @sponsercf }\n else\n format.html { render :new }\n format.json { render json: @sponsercf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sloth = Sloth.new(sloth_params)\n\n respond_to do |format|\n if @sloth.save\n format.html { redirect_to @sloth, notice: 'Sloth was successfully created.' }\n format.json { render :show, status: :created, location: @sloth }\n else\n format.html { render :new }\n format.json { render json: @sloth.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.62469727", "0.6104164", "0.5992982", "0.5991333", "0.5924378", "0.5784002", "0.5672843", "0.56616414", "0.56147814", "0.5579136", "0.5576561", "0.5573956", "0.557165", "0.55567193", "0.5496198", "0.54859376", "0.54844826", "0.54456675", "0.5439304", "0.5392716", "0.5384893", "0.5381689", "0.53728503", "0.53691304", "0.5359283", "0.5322483", "0.5319269", "0.5304498", "0.5300796", "0.5276612", "0.5271512", "0.5264158", "0.5254068", "0.52525526", "0.5243613", "0.5222516", "0.52212507", "0.52204263", "0.52188694", "0.5214429", "0.51990646", "0.5197395", "0.5194432", "0.5187289", "0.51842606", "0.51788783", "0.5178076", "0.517395", "0.5172338", "0.51671785", "0.516539", "0.51639426", "0.51637506", "0.5163466", "0.5159864", "0.5156922", "0.5156739", "0.5154204", "0.5152704", "0.51481223", "0.5142669", "0.5140895", "0.5140355", "0.5138795", "0.51367795", "0.5136449", "0.51355463", "0.512585", "0.5121857", "0.51216406", "0.51214975", "0.5119332", "0.511758", "0.5116008", "0.51156217", "0.5112522", "0.51087713", "0.5108677", "0.51070774", "0.51069033", "0.510684", "0.51064336", "0.5099664", "0.5095342", "0.5092739", "0.50913066", "0.50912166", "0.5090525", "0.5088758", "0.50865495", "0.5083389", "0.5083112", "0.50824916", "0.5082218", "0.5079821", "0.5076662", "0.5073908", "0.5070671", "0.50657004", "0.50591505" ]
0.68560326
0
PATCH/PUT /pro_asphalts/1 PATCH/PUT /pro_asphalts/1.json
def update respond_to do |format| if @pro_asphalt.update(pro_asphalt_params) format.html { redirect_to pro_asphalts_path(@pro_asphalt), notice: 'Pro asphalt was successfully updated.' } format.json { render :show, status: :ok, location: @pro_asphalt } else format.html { render :edit } format.json { render json: @pro_asphalt.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @procedure.update(procedure_params)\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @pro_asphalt_type.update(pro_asphalt_type_params)\n format.html { redirect_to @pro_asphalt_type, notice: 'Pro asphalt type was successfully updated.' }\n format.json { render :show, status: :ok, location: @pro_asphalt_type }\n else\n format.html { render :edit }\n format.json { render json: @pro_asphalt_type.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 patch!\n request! :patch\n end", "def update\n @asproduct = Asproduct.find(params[:id])\n\n respond_to do |format|\n if @asproduct.update_attributes(params[:asproduct])\n format.html { redirect_to @asproduct, notice: 'Asproduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asproduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n if @psa.update_attributes(params[:psa])\n format.html { redirect_to @psa, notice: 'Psa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @psa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n if @ventas_presupuesto.update_attributes(params[:ventas_presupuesto])\n format.html { redirect_to @ventas_presupuesto, notice: 'Presupuesto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ventas_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @voprosy = Voprosy.find(params[:id])\n\n respond_to do |format|\n if @voprosy.update_attributes(params[:voprosy])\n format.html { redirect_to @voprosy, notice: 'Voprosy was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @voprosy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n if @spaethi.update_attributes(params[:spaethi])\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proef = Proef.find(params[:id])\n\n respond_to do |format|\n if @proef.update_attributes(params[:proef])\n format.html { redirect_to @proef, notice: 'Test werd succesvol gewijzigd.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proef.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profissional.update(profissional_params)\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @healthpro.update(healthpro_params)\n format.html { redirect_to root_path, notice: 'Healthpro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @healthpro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prospect.update(prospect_params)\n format.html { redirect_to @prospect, notice: 'Prospect was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prospect.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @new_pro = NewPro.find(params[:id])\n\n respond_to do |format|\n if @new_pro.update_attributes(params[:new_pro])\n format.html { redirect_to @new_pro, notice: 'New pro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @new_pro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proverb.update(proverb_params)\n format.html { redirect_to @proverb, notice: \"Proverb was successfully updated.\" }\n format.json { render :show, status: :ok, location: @proverb }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @proverb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @person = @profissional.person\n if @person.update(profissional_params[:person_attributes])\n if profissional_params[:specialization].present?\n @profissional.update_attributes(:specialization => profissional_params[:specialization])\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { render :show, status: :ok, location: @profissional }\n else\n format.html { render :edit }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end", "def update\n respond_to do |format|\n if @prospecto.update(prospecto_params)\n format.html { redirect_to @prospecto, notice: 'Prospecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto }\n else\n format.html { render :edit }\n format.json { render json: @prospecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @propperty.update(propperty_params)\n format.html { redirect_to @propperty, notice: 'Propperty was successfully updated.' }\n format.json { render :show, status: :ok, location: @propperty }\n else\n format.html { render :edit }\n format.json { render json: @propperty.errors, status: :unprocessable_entity }\n end\n end\n end", "def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @prepagada = Prepagada.find(params[:id])\n\n respond_to do |format|\n if @prepagada.update_attributes(params[:prepagada])\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n if @propose.update_attributes(params[:propose])\n format.html { redirect_to @propose, notice: 'Propuesta actualizada' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @propose.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @preceed = Preceed.find(params[:id])\n\n respond_to do |format|\n if @preceed.update_attributes(params[:preceed])\n format.html { redirect_to @preceed, notice: 'Preceed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preceed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @precioproducto = Precioproducto.find(params[:id])\n\n respond_to do |format|\n if @precioproducto.update_attributes(params[:precioproducto])\n format.html { redirect_to @precioproducto, notice: 'Precioproducto was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @precioproducto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prototype = Prototype.find(params[:id])\n\n respond_to do |format|\n if @prototype.update_attributes(params[:prototype])\n format.html { redirect_to @prototype, notice: 'Prototype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prototype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @placa.update(placa_params)\n format.html { redirect_to @placa, notice: 'Placa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @placa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_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 put!\n request! :put\n end", "def update\n @list = HqProc.all(:order => :name)\n @object = HqProc.find(params[:id])\n \n \n params[:hq_proc][:new_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:existing_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:assigned_hq_rsrc] ||= {}\n \n @hq_proc = HqProc.find(params[:id])\n respond_to do |format|\n if @hq_proc.update_attributes(params[:hq_proc])\n @objects = HqProc.all(:order => 'name ASC')\n flash[:notice] = 'Process was successfully updated.'\n format.js if request.xhr?\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { head :ok }\n else\n messages = '<ul>Error:'\n @hq_proc.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { render :xml => @hq_proc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pplan.update(pplan_params)\n\n\n @sale = Sale.find_by(:id => @pplan.sale_id)\n @sale.update(:approve => nil)\n @pplan.update(:saledate => @sale.saledate, :selling_price => @sale.selling_price, :contact_id => @sale.contact_id, :batch_id => @sale.batch_id )\n\n\n format.html { redirect_to :back , notice: 'Pplan was successfully updated.' }\n format.json { head :no_content }\n\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @pplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @probando.update(probando_params)\n format.html { redirect_to @probando, notice: 'Probando was successfully updated.' }\n format.json { render :show, status: :ok, location: @probando }\n else\n format.html { render :edit }\n format.json { render json: @probando.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @paradigm_praat.update(paradigm_praat_params)\n format.html { redirect_to @paradigm_praat, notice: 'Paradigm praat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paradigm_praat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prospect.update(prospect_params)\n format.html { redirect_to @prospect, notice: t('.prospect_was_successfully_updated') }\n format.json { render :show, status: :ok, location: @prospect }\n else\n format.html { render :edit }\n format.json { render json: @prospect.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hospice.update(hospice_params)\n format.html { redirect_to @hospice, notice: 'Hospice was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospice }\n else\n format.html { render :edit }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prospie.update(prospie_params)\n format.html { redirect_to @prospie, notice: 'Prospie was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospie }\n else\n format.html { render :edit }\n format.json { render json: @prospie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @thuctap.update(thuctap_params)\n format.html { redirect_to @thuctap, notice: 'Thuctap was successfully updated.' }\n format.json { render :show, status: :ok, location: @thuctap }\n else\n format.html { render :edit }\n format.json { render json: @thuctap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alunosprof.update(alunosprof_params)\n format.html { redirect_to @alunosprof, notice: 'Alunosprof was successfully updated.' }\n format.json { render :show, status: :ok, location: @alunosprof }\n else\n format.html { render :edit }\n format.json { render json: @alunosprof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profilsekolah.update(profilsekolah_params)\n format.html { redirect_to @profilsekolah, notice: 'Profilsekolah was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profilsekolah.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n if @produccion.update_attributes(params[:produccion])\n format.html { redirect_to @produccion, notice: 'Se ha modificado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @produccion.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 @pizzatopping.update(pizzatopping_params)\n format.html { redirect_to @pizzatopping, notice: 'Pizzatopping was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pizzatopping.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @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 @papel = Papel.find(params[:id])\n\n respond_to do |format|\n if @papel.update_attributes(params[:papel])\n format.html { redirect_to @papel, notice: 'Papel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @papel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @program.update(program_params)\n @program.update_attribute('approved', false)\n UserMailer.notify_approver(@program).deliver\n format.html { redirect_to brand_programs_path(@program.brand), notice: 'Program was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @program.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prospecto.update(prospecto_params)\n format.html { redirect_to @prospecto, notice: 'Prospecto actualizado' }\n format.json { render :show, status: :ok, location: @prospecto }\n else\n format.html { render :edit }\n format.json { render json: @prospecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pizzashop = Pizzashop.find(params[:id])\n\n respond_to do |format|\n if @pizzashop.update_attributes(params[:pizzashop])\n format.html { redirect_to @pizzashop, notice: 'Pizzashop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pizzashop.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @provin.update(provin_params)\n format.html { redirect_to @provin, notice: 'Provin was successfully updated.' }\n format.json { render :show, status: :ok, location: @provin }\n else\n format.html { render :edit }\n format.json { render json: @provin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @procedure = Procedure.find(params[:id])\n @options = Option.new\n @types = Type.new\n respond_to do |format|\n if @procedure.update_attributes(params[:procedure])\n format.html { redirect_to \"/procedures\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @procedure.errors, :status => :unprocessable_entity }\n end\n end\n end", "def pro_farm_update\n respond_to do |format|\n activo = params[:pro_far][:activo_produc]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n ProFar.where(producto_id: id, farmacium_id:farmacia_id).update_all(activo_produc: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @prospect.update(prospect_params)\n format.html { redirect_to prospects_path, notice: 'Prospect was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospect }\n else\n format.html { render :edit }\n format.json { render json: @prospect.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @placa_casa = PlacaCasa.find(params[:id])\n @placa_casa.pessoa.update_attributes(params[:pessoa]) \n @placa_casa.placa.update_attributes(params[:placa])\n\n respond_to do |format|\n if @placa_casa.update_attributes(params[:placa_casa])\n format.html { redirect_to(@placa_casa, :notice => ' - Dados atualizados com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @placa_casa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @pre = Pre.find(params[:id])\n\n respond_to do |format|\n if @pre.update_attributes(params[:pre])\n format.html { redirect_to @pre, notice: 'Pre was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, Pupil\n respond_to do |format|\n if @pupil.update(pupil_attrs)\n format.html { redirect_to @pupil, notice: t('action.update.succeed', entity: Pupil.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pupil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n if @produccion.update_attributes(params[:produccion])\n format.html { redirect_to @produccion, notice: 'Produccion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @produccion.errors, status: :unprocessable_entity }\n end\n end\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_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @proposta.update(propostum_params)\n format.html { redirect_to @proposta, notice: 'Propostum was successfully updated.' }\n format.json { render :show, status: :ok, location: @proposta }\n else\n format.html { render :edit }\n format.json { render json: @proposta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @areas_profissional.update(areas_profissional_params)\n format.html { redirect_to @areas_profissional, notice: 'Área atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @areas_profissional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @apuesta_detail = ApuestaDetail.find(params[:id])\n\n respond_to do |format|\n if @apuesta_detail.update_attributes(params[:apuesta_detail])\n format.html { redirect_to @apuesta_detail, notice: 'Apuesta detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apuesta_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n before_update\n\n @studenthousinginfo.status = 'Waiting for Approval'\n\n respond_to do |format|\n if @studenthousinginfo.update(studenthousinginfo_params)\n format.html { redirect_to @studenthousinginfo, notice: 'Studenthousinginfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @studenthousinginfo }\n else\n format.html { render :edit }\n format.json { render json: @studenthousinginfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tuhu_prodoct.update(tuhu_prodoct_params)\n format.html { redirect_to @tuhu_prodoct, notice: 'Prodoct was successfully updated.' }\n format.json { render :show, status: :ok, location: @tuhu_prodoct }\n else\n format.html { render :edit }\n format.json { render json: @tuhu_prodoct.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pro_entry.update(pro_entry_params)\n format.html { redirect_to @pro_entry, notice: 'Pro entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @pro_entry }\n else\n format.html { render :edit }\n format.json { render json: @pro_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prospect.update(prospect_params)\n format.html { redirect_to @prospect, notice: 'Prospect was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospect }\n else\n format.html { render :edit }\n format.json { render json: @prospect.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_pessoa.update(sivic_pessoa_params)\r\n format.html { redirect_to @sivic_pessoa, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_pessoa.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @proforma.update(proforma_params)\n format.html { redirect_to @proforma, notice: 'Proforma generada correctamente.' }\n format.json { render :show, status: :ok, location: @proforma }\n else\n format.html { render :edit }\n format.json { render json: @proforma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pashiri.update(pashiri_params)\n format.html { redirect_to @pashiri, notice: 'Pashiri was successfully updated.' }\n format.json { render :show, status: :ok, location: @pashiri }\n else\n format.html { render :edit }\n format.json { render json: @pashiri.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profesor = Profesor.find(params[:id])\n\n if @profesor.update(profesor_params)\n head :no_content\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "def update\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n if @repa.update_attributes(params[:repa])\n format.html { redirect_to @repa, notice: 'Repa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pg_first.update(pg_first_params)\n format.html { redirect_to @pg_first, notice: 'Pg first was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pg_first.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n\n # RhoConnect server\n server = \"http://127.0.0.1:9292\"\n login = \"rhoadmin\"\n password = \"\"\n\n # Login to the RhoConnect server\n res = RestClient.post(\"#{server}/login\", { :login => login, :password => password }.to_json, :content_type => :json)\n\n # Get the token from the login response\n token = RestClient.post(\"#{server}/api/get_api_token\", '', { :cookies => res.cookies })\n\n # Send a ping message, which triggers a ping on the device\n ping_params = {\n :api_token => token,\n :user_id => [\"bhanu\"], # user_id that this message is for\n :sources => [\"Product\"], # sources we want to sync when this message is received\n :vibrate => \"2\",\n :message => \"#{params[:product][:name]} has been updated\",\n :sound => ''\n }\n\n RestClient.post(\"#{server}/api/ping\", ping_params.to_json, :content_type => :json)\n\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plasmid_probe.update(plasmid_probe_params)\n format.html { redirect_to @plasmid_probe, notice: 'Plasmid probe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plasmid_probe.errors, status: :unprocessable_entity }\n end\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 @ba_spec = BaSpec.find(params[:id])\n\n respond_to do |format|\n if @ba_spec.update_attributes(params[:ba_spec])\n format.html { redirect_to session[:return_to] }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ba_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n respond_to do |format|\n if @product_spec.update(product_spec_params)\n format.html { redirect_to @product_spec, notice: 'Product spec was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_spec }\n else\n format.html { render :edit }\n format.json { render json: @product_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @snp = Snp.find(params[:id])\n\n respond_to do |format|\n if @snp.update_attributes(params[:snp])\n format.html { redirect_to @snp, notice: 'Snp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @snp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n respond_to do |format|\n if @ficheprospect.update(ficheprospect_params)\n format.html { redirect_to prospect_path(@prospect), notice: 'La qualification du prospect a ete modifiee avec succes.' }\n format.json { render :show, status: :ok, location: @ficheprospect }\n else\n format.html { render :edit }\n format.json { render json: @ficheprospect.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.64197206", "0.6389722", "0.6289051", "0.62460405", "0.6230696", "0.622748", "0.62242496", "0.61871284", "0.6154919", "0.6154137", "0.61442643", "0.61331826", "0.6088461", "0.60534203", "0.60404587", "0.6039339", "0.6038272", "0.60241663", "0.60094815", "0.5997083", "0.59927016", "0.59906614", "0.598639", "0.5980698", "0.598007", "0.5975441", "0.5964036", "0.5961761", "0.59590745", "0.59499276", "0.5940887", "0.59395415", "0.59385896", "0.5932885", "0.59220284", "0.59161973", "0.5913428", "0.5909388", "0.59061867", "0.58950794", "0.58889025", "0.58844894", "0.5884287", "0.5884029", "0.588019", "0.5879085", "0.5863056", "0.5862703", "0.58576053", "0.5850204", "0.5846245", "0.58457357", "0.58454126", "0.58454126", "0.5845317", "0.58451176", "0.58435875", "0.58425784", "0.5836975", "0.58365613", "0.5835774", "0.5834707", "0.58338404", "0.58287495", "0.5828247", "0.5828198", "0.58275837", "0.582752", "0.582728", "0.5826054", "0.5821308", "0.5821308", "0.58198", "0.5818191", "0.5817736", "0.5817508", "0.5817345", "0.5816989", "0.58118665", "0.5801838", "0.58011323", "0.5799165", "0.5799067", "0.5794847", "0.57910645", "0.57903", "0.57894117", "0.5788738", "0.5787291", "0.5787239", "0.5783956", "0.5783666", "0.57822067", "0.5779215", "0.5779215", "0.57761467", "0.5775412", "0.5775202", "0.5775091", "0.57737434" ]
0.6804847
0
DELETE /pro_asphalts/1 DELETE /pro_asphalts/1.json
def destroy @pro_asphalt.destroy respond_to do |format| format.html { redirect_to pro_asphalts_url, notice: 'Pro asphalt was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @healthpro.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @apuesta_detail = ApuestaDetail.find(params[:id])\n @apuesta_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_details_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 destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @surah.destroy\n respond_to do |format|\n format.html { redirect_to surahs_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @spaethi = Spaethi.find(params[:id])\n @spaethi.destroy\n\n respond_to do |format|\n format.html { redirect_to spaethis_url }\n format.json { head :ok }\n end\n end", "def destroy\n @asproduct = Asproduct.find(params[:id])\n @asproduct.destroy\n\n respond_to do |format|\n format.html { redirect_to asproducts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thuctap.destroy\n respond_to do |format|\n format.html { redirect_to thuctaps_url, notice: 'Thuctap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pro_asphalt_type.destroy\n respond_to do |format|\n format.html { redirect_to pro_asphalt_types_url, notice: 'Pro asphalt type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @psa = Psa.find(params[:id])\n @psa.destroy\n\n respond_to do |format|\n format.html { redirect_to psas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profilsekolah.destroy\n respond_to do |format|\n format.html { redirect_to profilsekolahs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prod = Prod.find(params[:id])\n @prod.destroy\n\n respond_to do |format|\n format.html { redirect_to prods_url }\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_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @sklad = Sklad.find(params[:id])\n @sklad.destroy\n\n respond_to do |format|\n format.html { redirect_to sklads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prospecto.destroy\n respond_to do |format|\n format.html { redirect_to prospectos_url, notice: 'Prospecto eliminado' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @shouldersbiceps1.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps1s_url, notice: 'Shouldersbiceps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @behatweb = Behatweb.find(params[:id])\n @behatweb.destroy\n\n respond_to do |format|\n format.html { redirect_to behatwebs_url }\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 return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @pg_first.destroy\n respond_to do |format|\n format.html { redirect_to pg_firsts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pharmacy.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @shouldersbiceps3.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps3s_url, notice: 'Shouldersbiceps3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pashiri.destroy\n respond_to do |format|\n format.html { redirect_to pashiris_url, notice: 'Pashiri was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @capa = Capa.find(params[:id])\n @capa.destroy\n\n respond_to do |format|\n format.html { redirect_to capas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pkhd.destroy\n respond_to do |format|\n format.html { redirect_to pkhds_url, notice: 'Pkhd was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pro_far = ProFar.where([\"producto_id = ? and farmacium_id = ?\", params[:id], session[:farmacia_id]]).first\n @pro_far.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end", "def destroy\n @gatha.destroy\n respond_to do |format|\n format.html { redirect_to gathas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prospect.destroy\n respond_to do |format|\n format.html { redirect_to prospects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apoio.destroy\n respond_to do |format|\n format.html { redirect_to apoios_url, notice: 'Apoio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @produccion = Produccion.find(params[:id])\n @produccion.destroy\n\n respond_to do |format|\n format.html { redirect_to produccions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @precioproducto = Precioproducto.find(params[:id])\n @precioproducto.destroy\n\n respond_to do |format|\n format.html { redirect_to precioproductos_url }\n format.json { head :ok }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @produccion = Produccion.find(params[:id])\n @produccion.destroy\n\n respond_to do |format|\n format.html { redirect_to producciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shouldersbicepshome3.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbicepshome3s_url, notice: 'Shouldersbicepshome3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ficheprospect = @prospect.ficheprospects.find(params[:id]) \n @ficheprospect.destroy\n respond_to do |format|\n format.html { redirect_to prospect_ficheprospect_path(@prospect), notice: 'Ficheprospect was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prospecto.destroy\n respond_to do |format|\n format.html { redirect_to prospectos_url, notice: 'Prospecto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def destroy\n @pichanga = Pichanga.find(params[:id])\n @pichanga.destroy\n\n respond_to do |format|\n format.html { redirect_to pichangas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n @ventas_presupuesto.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_presupuestos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @proef = Proef.find(params[:id])\n @proef.destroy\n\n respond_to do |format|\n format.html { redirect_to niveau_path(@proef.niveau), notice: 'Test werd succesvol verwijderd.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shiva.destroy\n respond_to do |format|\n format.html { redirect_to shivas_url, notice: 'Shiva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prepagada = Prepagada.find(params[:id])\n @prepagada.destroy\n\n respond_to do |format|\n format.html { redirect_to prepagadas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @paradigm_praat.destroy\n respond_to do |format|\n format.html { redirect_to paradigm_praats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @proverb.destroy\n respond_to do |format|\n format.html { redirect_to proverbs_url, notice: \"Proverb was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @promo = Promo.find(params[:id])\n @promo.destroy\n\n respond_to do |format|\n format.html { redirect_to promos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @promo = Promo.find(params[:id])\n @promo.destroy\n\n respond_to do |format|\n format.html { redirect_to promos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ahoogah.destroy\n respond_to do |format|\n format.html { redirect_to ahoogahs_url, notice: 'Ahoogah was successfully destroyed.' }\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 @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @proposta.destroy\n respond_to do |format|\n format.html { redirect_to proposta_url, notice: 'Propostum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end", "def destroy\n @rishabh.destroy\n respond_to do |format|\n format.html { redirect_to rishabhs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hqproduct.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @aspirant = Aspirant.find(params[:id])\n @aspirant.destroy\n\n respond_to do |format|\n format.html { redirect_to aspirants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n @competency_pertenece_asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to competency_pertenece_asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @runway_ap = RunwayAp.find(params[:id])\n @runway_ap.destroy\n\n respond_to do |format|\n format.html { redirect_to runway_aps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @obsah.destroy\n respond_to do |format|\n format.html { redirect_to obsahs_url, notice: 'Obsah was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @capacidad = Capacidad.find(params[:id])\n @capacidad.destroy\n\n respond_to do |format|\n format.html { redirect_to capacidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @himalaya = Himalaya.find(params[:id])\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tantosha.destroy\n # @tantosha.delete\n respond_to do |format|\n format.html { redirect_to tantoshas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @suplente = Suplente.find(params[:id])\n @suplente.destroy\n\n respond_to do |format|\n format.html { redirect_to suplentes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apolice.destroy\n respond_to do |format|\n format.html { redirect_to apolices_url, notice: 'Registro deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end", "def destroy\n @probando.destroy\n respond_to do |format|\n format.html { redirect_to probandos_url, notice: 'Probando was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pessoa = Pessoa.find(params[:id])\n @pessoa.destroy\n\n respond_to do |format|\n format.html { redirect_to pessoas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alunosprof.destroy\n respond_to do |format|\n format.html { redirect_to alunosprofs_url, notice: 'Alunosprof was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tuhu_prodoct.destroy\n respond_to do |format|\n format.html { redirect_to tuhu_prodocts_url, notice: 'Prodoct was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thirtyone.destroy\n respond_to do |format|\n format.html { redirect_to thirtyones_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7073675", "0.6944771", "0.69359535", "0.69125956", "0.6895646", "0.68633246", "0.68496364", "0.6821556", "0.6819525", "0.6805395", "0.6791739", "0.67755556", "0.67601293", "0.675454", "0.67471665", "0.67424715", "0.67424715", "0.67424715", "0.67424715", "0.6740911", "0.67342615", "0.67267966", "0.67256916", "0.67241806", "0.6723305", "0.6721732", "0.67206687", "0.67175347", "0.6710956", "0.6710379", "0.67040104", "0.66996133", "0.66928256", "0.6690195", "0.6684351", "0.6678253", "0.6674282", "0.66736776", "0.66693926", "0.6668222", "0.66680336", "0.6667932", "0.6666685", "0.66646117", "0.6663146", "0.6662436", "0.6661788", "0.66609365", "0.66594195", "0.6658057", "0.6654529", "0.6654401", "0.66542", "0.6651413", "0.6651413", "0.66482997", "0.66469544", "0.66411394", "0.66393596", "0.663471", "0.6634465", "0.66338897", "0.6629703", "0.66254985", "0.6624071", "0.6623872", "0.6622756", "0.66217935", "0.66213703", "0.66213703", "0.6621204", "0.662008", "0.66200465", "0.6615176", "0.6612181", "0.66101146", "0.6608614", "0.6608572", "0.66075087", "0.6607384", "0.6607143", "0.6605827", "0.660449", "0.6602814", "0.6600793", "0.6599167", "0.65983224", "0.6595893", "0.659249", "0.65924484", "0.65891063", "0.6587959", "0.65834355", "0.6582497", "0.6582497", "0.65820366", "0.6580898", "0.65805674", "0.6580357", "0.6578182" ]
0.71840423
0
Use callbacks to share common setup or constraints between actions.
def set_pro_asphalt @pro_asphalt = ProAsphalt.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 pro_asphalt_params params.require(:pro_asphalt).permit(:province_pro_asset_id, :day, :pro_asphalt_hours, :pro_asphalt_machines_num, pro_asphalt_subs_attributes: ProAsphaltSub.attribute_names.map(&:to_sym).push(:_destroy)) 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
GEM FRIENDLY REFERENCE: GET /artists GET /artists.json
def index if (params.has_key?(:artist)) searched_name = artist_params[:artist_name] found = Artist.all.select{|n| n.artist_name.downcase == searched_name.downcase} if found[0] != nil @artists = found else @artists = Artist.all.reverse_order require 'musicbrainz' @foundArtists = MusicBrainz::Artist.search(artist_params[:artist_name]) # GEM GITHUB => https://github.com/localhots/musicbrainz end else @artists = Artist.all.reverse_order end @artist = Artist.new gon.next_artist_id = Artist.with_deleted.last.id + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def artists\n # TODO: add param for albums and songs\n a = Artist.all\n render json: a\n end", "def artists\n if RESPONSE.code == 200\n # Return data to page\n JSON.parse(RESPONSE.to_s)['topartists']['artist']\n else\n # print error message\n \"Error Code #{RESPONSE.code}\"\n end\n end", "def show\n @artists = Artist.find(params[:id])\n puts @artists\n render json:@artists, status: :ok\n end", "def index\n if params[:album_id]\n @artists = Album.resolve(params[:album_id]).artist\n else\n @artists = Artist.order(:name)\n end\n\n render json: @artists\n end", "def artists(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s\n http_get(path, query)\n end", "def artists(options={})\n call_pageable('library.getartists', :artists, Artist, {:user => @user.name}.merge(options))\n end", "def get_artist(id)\n @connection.get \"artists/#{id}\"\n end", "def artists\n link :top_artists, :Artist, name\n end", "def index \n artists = Artist.all \n render json: artists \n end", "def list_artists\n all_artists = artist_data[\"artists\"][\"items\"]\n all_artists.each do | artist |\n artist_name = artist[\"name\"]\n artists[artist_name] ||= {}\n artists[artist_name][:popularity] = artist[\"popularity\"]\n end\n artists\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def get_artist(artist_id)\n query_and_build \"artists/#{artist_id}\"\n end", "def get_related_artists(artist_code)\n\n params = {\n seed_artists: artist_code\n }\n JSON.parse(api_call(\"https://api.spotify.com/\",\"v1/recommendations\",params))\n\n end", "def show\n @artists=Artist.all\n end", "def artists_hash\n parse(get_artists)\n end", "def artists\n MusicImporter.new(path).print_artists\n end", "def index\n @artists = current_user.artists.all\n end", "def artist\n\t\tArtist.find(artist_id)\n\tend", "def favourite_artists\n @favourite_artists = FavouriteArtist.all\n render :json => @favourite_artists.to_json\n end", "def top_artists\n \n artists=[]\n spotify_artists = JSON.parse(api_call(\"https://api.spotify.com/\",\"v1/me/top/artists\"))\n\n spotify_artists['items'].each do |item|\n new_artist = Artist.find_or_create_by(name: item['name'], spotify_id: item['id'])\n new_artist.update(genre_list: item['genres'])\n artists << new_artist\n end\n\n artists\n\n end", "def artists\n @artists ||= artists_raw.map {|a| @session.artist.build(:name => a) }\n end", "def artists\n link :top_artists, :Artist, country\n end", "def artist\n # What is the .artists method being called on here?\n # The default behaviour in Ruby is to see if the method\n # exists for the current object, i.e. the instance\n # In JS, you would have to write: 'this.artists'\n self.artists.first\n # ^ 'self.' is the default, so it can be left out\n end", "def index\n @spotify_artists = SpotifyArtist.all\n end", "def index\n\t\t@artist_name = params[:artist_name]\n\t\tdownloader = ScDownloader.new\n\t\t@artists = downloader.get_artists(@artist_name)\n\tend", "def artists\n render :nothing => true and return if params[:id].nil?\n\n if ( params[:meta] == 'tattoos' )\n @artist = Artist.find(params[:id], :include => :tattoos)\n render :json => @artist.tattoos.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end\n \n @artist = Artist.find(params[:id])\n render :json => @artist.to_json(:include => :assets)\n end", "def artists_locations(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s.gsub(/[_]/,'/')\n resp = http_get(path, query)\n end", "def artists\n songs.map do |song|\n song.artist\n end\n end", "def artists\n songs.map do |song|\n song.artist\n end\n end", "def artist_names\n artists.map do |artist|\n artist.name\n end\n end", "def artist()\n sql = \"SELECT * FROM artists WHERE id = $1\"\n values = [@artist_id]\n artists = SqlRunner.run(sql, values)\n result = artists.map {|artist| Artist.new(artist)}\n return result\n end", "def artists(user, options={})\n get(:standard, {:method => \"library.getArtists\", :user => user}.merge(options))\n end", "def index\n @user_artists = UserArtist.all\n end", "def get_artist\n Artist.find(params[:id])\n end", "def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend", "def artist_albums(artist, options = {})\n get \"artists/#{artist}/albums\", options\n end", "def artists\n @songs.collect do |song|\n song.artist\n end\n end", "def artists\n @songs.collect do |song|\n song.artist\n end\n end", "def familiarity artist\n url = \"http://developer.echonest.com/api/v4/artist/familiarity?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\"\n result = parseURL url\n result[\"response\"][\"artist\"][\"familiarity\"]\nend", "def artist_names\n self.artists.map do |artist|\n artist.name\n end\n end", "def artist_names\n self.artists.collect do |n|\n n.name \n end\n end", "def artists\n songs.map {|song| song.artist}\n end", "def artist\n artists.first\n end", "def artists\n self.songs.collect{|song| song.artist}\n end", "def artist_search(query={})\n result = self.class.get(\"/search/artists.json?query=#{query[:artist_name]}\")\n Songkickr::ArtistResult.new result\n end", "def show\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artist }\n end\n end", "def artist\n\t\tartists == nil ? nil : artists.first\n\tend", "def recommended_artists()\n get(:session, {:method => \"user.getRecommendedArtists\"})\n end", "def list_artist\n Artist.all.each.with_index(1) {|artist, i| puts \"#{i}. #{artist.name}\"}\n end", "def artists\n self.songs.map {|song| song.artist}\n end", "def index\n @location = set_location\n local_artists = compile_artists(@location)\n @artists = sort_artists(local_artists)\n @selected_artist = select_artist(@artists, params['select_artist'])\n end", "def featured_artists\n self.all_artists.map{|artist_obj| artist_obj.name}\nend", "def artists\n super.map do |artist|\n Spotify::SDK::Artist.new(artist, parent)\n end\n end", "def artist_names #return array of the names of all artists that have a painting in a gallery\n artists.name #pull array from artists method and call reader to get their name\n end", "def set_artist\n @artist = Artist.resolve(params[:id])\n end", "def show\n @artist = current_user.artists.find(params[:id])\n raise \"not found\" if @artist.blank?\n @albums = @artist.albums.all\n rescue\n redirect_to artists_url, :notice => \"Can't find this artist.\"\n end", "def query_artist(artist_name = 'Dire+Straits')\n \"http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=#{artist_name}&api_key=1ca2cf614eeaa185c2b61753b434b599&format=json\"\n end", "def artist()\n sql = \"SELECT * FROM albums WHERE artist_id = $1\"\n values = [@id]\n results = SqlRunner.run(sql,values)\n artist_data = results[0]\n artist = Artist.new(artist_data)\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def artist\n @ole.Artist\n end", "def artist\n if artists.nil?\n Artist.new :name => super\n elsif artists.size > 1\n artists\n else\n artists.first\n end\n end", "def artistInfo(artist)\n\tartistinfo = HTTParty.get(\"http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=#{artist}&api_key=#{API_KEY}&format=json\")\n\treturn artistinfo\nend", "def artist\r\n @artist\r\n end", "def artist()\n sql = \"SELECT * FROM artists WHERE id = $1\"\n values = [@artist_id]\n result = SqlRunner.run(sql, values)[0]\n return Artist.new(result)\n end", "def artist\n @artist\n end", "def artist\n @artist\n end", "def artists\n paintings.map{|art| art.artist.name}\n\n end", "def artists\n # - this method will show the connection between songs and artists \n self.songs.collect do |f| \n f.artist\n end\n end", "def set_artist\n @artist = Artist.find_by(name: params[:name])\n end", "def get_top_artists( params )\n LastFM.get( \"chart.getTopArtists\", params )\n end", "def artist(url: nil, name: nil)\n name = Utility::ArtistUrlParser.call(url) if url\n\n return [] if name.nil? || name.empty?\n\n Utility::ArtistLoader.call(agent, id, name)\n end", "def to_artists(raw_artists)\n result = []\n raw_artists.each do |raw_artist|\n \tresult << raw_artist[\"name\"]\n end\n\n result\n end", "def artists\n songs.map do |song|\n song.artist\n # binding.pry\n end\n end", "def show\n @artist = Artist.find(params[:id])\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def show\n @artist = @album.artist\n end", "def artist\n artist = Spotify.album_artist!(pointer)\n Artist.new(artist) unless artist.null?\n end", "def artist_name\n self.artists.collect do |artist|\n artist.name\n end\n end", "def artists_get()\n\trows = $conn.execute('SELECT * FROM artists')\n\t\n\t# convert back into array.\n\tartists = []\n\trows.each do |row|\n\t\tartists.push(row['name'])\n\tend\n\t\n\treturn artists\nend", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def bookmarked_artists\n doc = request(@user, \"favoriteartists\")\n artists = []\n doc.xpath('//rss/channel/item').each do |node|\n artists << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :artist => node.xpath('mm:Artist/dc:title').text.strip,\n :station => node.xpath('pandora:stationLink').text.strip }\n end\n artists\n end" ]
[ "0.7812069", "0.7784614", "0.76863056", "0.7555241", "0.7538351", "0.7435646", "0.73612255", "0.7344018", "0.7329503", "0.732899", "0.7262973", "0.7262973", "0.7262973", "0.7262973", "0.7262973", "0.7262973", "0.72628874", "0.7251068", "0.724836", "0.7239009", "0.7224838", "0.72039956", "0.71252704", "0.70778304", "0.7057607", "0.70480263", "0.7042473", "0.7040657", "0.70262396", "0.7024537", "0.70201075", "0.70196277", "0.70110154", "0.70110154", "0.69994664", "0.6984287", "0.6962573", "0.69432545", "0.69183534", "0.6907966", "0.6898477", "0.68922484", "0.68922484", "0.6891315", "0.6890673", "0.68788546", "0.6865362", "0.6857842", "0.6845923", "0.68308187", "0.68242425", "0.6823521", "0.6812815", "0.6793968", "0.67917156", "0.67647004", "0.6753214", "0.67492926", "0.6733957", "0.6728444", "0.6725234", "0.6720586", "0.67186385", "0.66940284", "0.66852975", "0.6679552", "0.66716266", "0.6666133", "0.6664938", "0.66574067", "0.66574067", "0.6654442", "0.66535175", "0.6650549", "0.6642551", "0.66352916", "0.6633715", "0.6628592", "0.66282237", "0.66174763", "0.66174763", "0.66174763", "0.661334", "0.6608263", "0.6589241", "0.65728104", "0.657114", "0.657114", "0.657114", "0.657114", "0.657114", "0.657114", "0.657114", "0.657114", "0.657114", "0.657114", "0.657114", "0.657114", "0.657114", "0.65685636" ]
0.70474195
26
GET /artists/1 GET /artists/1.json
def show @artist = Artist.find(params[:id]) gon.artist = Artist.find(params[:id]) @artists = Artist.all @venues = Venue.all @concert = Concert.new gon.sk_key = ENV['SK_API'] gon.tm_key = ENV['TM_API'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @artists = Artist.find(params[:id])\n puts @artists\n render json:@artists, status: :ok\n end", "def artists\n # TODO: add param for albums and songs\n a = Artist.all\n render json: a\n end", "def index\n if params[:album_id]\n @artists = Album.resolve(params[:album_id]).artist\n else\n @artists = Artist.order(:name)\n end\n\n render json: @artists\n end", "def get_artist(id)\n @connection.get \"artists/#{id}\"\n end", "def artists\n if RESPONSE.code == 200\n # Return data to page\n JSON.parse(RESPONSE.to_s)['topartists']['artist']\n else\n # print error message\n \"Error Code #{RESPONSE.code}\"\n end\n end", "def show\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artist }\n end\n end", "def index \n artists = Artist.all \n render json: artists \n end", "def get_artist(artist_id)\n query_and_build \"artists/#{artist_id}\"\n end", "def artists(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s\n http_get(path, query)\n end", "def get_artist\n Artist.find(params[:id])\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def show\n @artists=Artist.all\n end", "def artists\n render :nothing => true and return if params[:id].nil?\n\n if ( params[:meta] == 'tattoos' )\n @artist = Artist.find(params[:id], :include => :tattoos)\n render :json => @artist.tattoos.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end\n \n @artist = Artist.find(params[:id])\n render :json => @artist.to_json(:include => :assets)\n end", "def show\n @artist = Artist.find(params[:id])\n end", "def show\n @artist = current_user.artists.find(params[:id])\n raise \"not found\" if @artist.blank?\n @albums = @artist.albums.all\n rescue\n redirect_to artists_url, :notice => \"Can't find this artist.\"\n end", "def show\n @artist = Artist.find params[:id]\n end", "def index\n\t\t@artist_name = params[:artist_name]\n\t\tdownloader = ScDownloader.new\n\t\t@artists = downloader.get_artists(@artist_name)\n\tend", "def show\n \n @artist = Artist.where(id: params[:id]).first\n if @artist \n render json: @artist, status: 200\n else\n #render error: {error: 'Artist not found'}, status: 404\n return_not_found\n # format.any { render :json => {:response => 'Artista not found' }, :status => 404 }\n \n end\n end", "def index\n if (params.has_key?(:artist))\n searched_name = artist_params[:artist_name]\n found = Artist.all.select{|n| n.artist_name.downcase == searched_name.downcase}\n if found[0] != nil\n @artists = found\n else\n @artists = Artist.all.reverse_order\n require 'musicbrainz'\n @foundArtists = MusicBrainz::Artist.search(artist_params[:artist_name])\n # GEM GITHUB => https://github.com/localhots/musicbrainz\n end\n else\n @artists = Artist.all.reverse_order\n end\n @artist = Artist.new\n gon.next_artist_id = Artist.with_deleted.last.id + 1\n end", "def index\n @spotify_artists = SpotifyArtist.all\n end", "def artist\n\t\tArtist.find(artist_id)\n\tend", "def show\n @query = params[:id].gsub('+', ' ')\n @autoplay = params[:autoplay]\n \n begin\n @artist = LastfmArtist.new(@query, @lastfm, true)\n rescue\n @artist = nil\n end\n \n unless @artist\n not_found\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @artist }\n end\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def artist_albums(artist, options = {})\n get \"artists/#{artist}/albums\", options\n end", "def favourite_artists\n @favourite_artists = FavouriteArtist.all\n render :json => @favourite_artists.to_json\n end", "def artists(options={})\n call_pageable('library.getartists', :artists, Artist, {:user => @user.name}.merge(options))\n end", "def get_related_artists(artist_code)\n\n params = {\n seed_artists: artist_code\n }\n JSON.parse(api_call(\"https://api.spotify.com/\",\"v1/recommendations\",params))\n\n end", "def list_artists\n all_artists = artist_data[\"artists\"][\"items\"]\n all_artists.each do | artist |\n artist_name = artist[\"name\"]\n artists[artist_name] ||= {}\n artists[artist_name][:popularity] = artist[\"popularity\"]\n end\n artists\n end", "def index\n @artists = current_user.artists.all\n end", "def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend", "def new\n @artist = Artist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @artist }\n end\n end", "def index\n @user_artists = UserArtist.all\n end", "def artist()\n sql = \"SELECT * FROM artists WHERE id = $1\"\n values = [@artist_id]\n result = SqlRunner.run(sql, values)[0]\n return Artist.new(result)\n end", "def artist()\n sql = \"SELECT * FROM artists WHERE id = $1\"\n values = [@artist_id]\n artists = SqlRunner.run(sql, values)\n result = artists.map {|artist| Artist.new(artist)}\n return result\n end", "def show\n @artist_tag = ArtistTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artist_tag }\n end\n end", "def new\n @artist = Artist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @artist }\n end\n end", "def artist\n artists.first\n end", "def index\n # @songs = Song.find_by_artist_id params[:artist_id]\n @songs = Song.find_all_by_artist_id params[:artist_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end", "def show\n @albums = Artist.find(params[\"id\"]).albums\n end", "def artists\n link :top_artists, :Artist, name\n end", "def set_artist\n @artist = Artist.resolve(params[:id])\n end", "def artistInfo(artist)\n\tartistinfo = HTTParty.get(\"http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=#{artist}&api_key=#{API_KEY}&format=json\")\n\treturn artistinfo\nend", "def list_artist\n Artist.all.each.with_index(1) {|artist, i| puts \"#{i}. #{artist.name}\"}\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def artist\n # What is the .artists method being called on here?\n # The default behaviour in Ruby is to see if the method\n # exists for the current object, i.e. the instance\n # In JS, you would have to write: 'this.artists'\n self.artists.first\n # ^ 'self.' is the default, so it can be left out\n end", "def familiarity artist\n url = \"http://developer.echonest.com/api/v4/artist/familiarity?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\"\n result = parseURL url\n result[\"response\"][\"artist\"][\"familiarity\"]\nend", "def query_artist(artist_name = 'Dire+Straits')\n \"http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=#{artist_name}&api_key=1ca2cf614eeaa185c2b61753b434b599&format=json\"\n end", "def artists_hash\n parse(get_artists)\n end", "def artist()\n sql = \"SELECT * FROM albums WHERE artist_id = $1\"\n values = [@id]\n results = SqlRunner.run(sql,values)\n artist_data = results[0]\n artist = Artist.new(artist_data)\n end", "def top_artists\n \n artists=[]\n spotify_artists = JSON.parse(api_call(\"https://api.spotify.com/\",\"v1/me/top/artists\"))\n\n spotify_artists['items'].each do |item|\n new_artist = Artist.find_or_create_by(name: item['name'], spotify_id: item['id'])\n new_artist.update(genre_list: item['genres'])\n artists << new_artist\n end\n\n artists\n\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def artists\n MusicImporter.new(path).print_artists\n end", "def show\n @artist = @album.artist\n end", "def artist()\n sql = \"SELECT artist_name FROM artists WHERE id = $1\"\n values = [@artist_id]\n result = SqlRunner.run(sql, values)\n return result[0][\"artist_name\"]\n end", "def set_artist\n\t\t@artist = Artist.find(params[:id])\n\tend", "def set_artist\n @artist = Artist.find_by(id: params[:id])\n end", "def index\n respond_with Artist.all\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def show\n @artist = Artist.find(params[:id], :include=>[:albums])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @artist }\n end\n end", "def set_artist\n @artist = Artist.find_by(name: params[:name])\n end", "def artists_locations(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s.gsub(/[_]/,'/')\n resp = http_get(path, query)\n end", "def artist_show_song\r\n\r\n\t\t#@artist = Artist.find(params[:id])\r\n\t\tsearchString = params[:url_slug]\r\n\t\t@artist = Artist.find_by_url_slug(searchString)\r\n\t\t@song = @artist.song.find.by_url_slug(params[:song_name])\r\n\r\n\t\trespond_to do |format|\r\n\t\t\tformat.html # show.html.erb\r\n\t\t\tformat.xml { render :xml => @artist }\r\n\t\tend\r\n\tend", "def set_artist\n @artist = Artist.friendly.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id] || params[:artist_id])\n end", "def set_artist\n @artist = Artist.find(artist_params[:id])\n end", "def artist\n\t\tartists == nil ? nil : artists.first\n\tend", "def index\n @location = set_location\n local_artists = compile_artists(@location)\n @artists = sort_artists(local_artists)\n @selected_artist = select_artist(@artists, params['select_artist'])\n end", "def artist_search(query={})\n result = self.class.get(\"/search/artists.json?query=#{query[:artist_name]}\")\n Songkickr::ArtistResult.new result\n end", "def show\n @album = Album.find(params[:id])\n @potential_songs = Song.where(:artist_id => @album.artist.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def show\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @artist }\n end\n end", "def set_artist\n @artist = Artist.friendly.find(params[:id])\n end", "def artist\n if artists.nil?\n Artist.new :name => super\n elsif artists.size > 1\n artists\n else\n artists.first\n end\n end", "def artists(user, options={})\n get(:standard, {:method => \"library.getArtists\", :user => user}.merge(options))\n end", "def artists\n link :top_artists, :Artist, country\n end", "def biography artist\n url = \"http://developer.echonest.com/api/v4/artist/biographies?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\"\nend", "def info(options={})\n get(:standard, {:method => \"artist.getInfo\"}.merge(options))\n end", "def show\n @fine_artist = FineArtist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fine_artist }\n end\n end", "def set_artistum\n @artistum = Artistum.find(params[:id])\n end", "def artist(url: nil, name: nil)\n name = Utility::ArtistUrlParser.call(url) if url\n\n return [] if name.nil? || name.empty?\n\n Utility::ArtistLoader.call(agent, id, name)\n end", "def index\n @artistas = Artista.all\n end" ]
[ "0.8384725", "0.80260485", "0.8016215", "0.7995721", "0.7846519", "0.7710554", "0.7693747", "0.76757026", "0.7489406", "0.74404496", "0.73917294", "0.73917294", "0.73917294", "0.73917294", "0.73917294", "0.73917294", "0.733127", "0.73234177", "0.72865427", "0.7215986", "0.7175809", "0.71594715", "0.7136799", "0.71240115", "0.71147937", "0.7109659", "0.7095203", "0.70718014", "0.70517373", "0.70288163", "0.70232636", "0.70196736", "0.7000027", "0.69977736", "0.69762295", "0.69597894", "0.69596297", "0.695528", "0.6949957", "0.69471425", "0.69218755", "0.6884179", "0.6878159", "0.68626595", "0.6862488", "0.685725", "0.6852905", "0.6827157", "0.6822338", "0.6822338", "0.6822338", "0.6817996", "0.6817996", "0.680064", "0.6798833", "0.67948496", "0.6793292", "0.6792978", "0.67846596", "0.678453", "0.678453", "0.678453", "0.678453", "0.678453", "0.678453", "0.678453", "0.678453", "0.678453", "0.678453", "0.678453", "0.678453", "0.678453", "0.6783459", "0.6756084", "0.6726706", "0.67162204", "0.67118216", "0.671174", "0.67079157", "0.66918266", "0.6687533", "0.66859996", "0.6684414", "0.6668775", "0.6654631", "0.6649532", "0.66453236", "0.6629996", "0.66278714", "0.6627795", "0.66260797", "0.6603034", "0.6593088", "0.6582132", "0.65761065", "0.6567831", "0.65566164", "0.6550386", "0.6533526", "0.652673", "0.65195346" ]
0.0
-1
POST /artists POST /artists.json
def create @artist = Artist.find_or_create_by(artist_name: artist_params[:artist_name]) @artist.update(artist_params) gon.artist = @artist end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @artist = Artist.new(params[:artist])\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, :notice => 'Artist was successfully created.' }\n format.json { render :json => @artist, :status => :created, :location => @artist }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @artist = Artist.new(params[:artist])\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, :notice => 'Artist was successfully created.' }\n format.json { render :json => @artist, :status => :created, :location => @artist }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @artist = Artist.new(artist_params)\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, notice: 'Artist was successfully created.' }\n format.json { render :show, status: :created, location: @artist }\n else\n format.html { render :new }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @artist = Artist.new(artist_params)\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, notice: 'Artist was successfully created.' }\n format.json { render :show, status: :created, location: @artist }\n else\n format.html { render :new }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @artist = Artist.new(artist_params)\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, notice: t(:create_notice) }\n format.json { render :show, status: :created, location: @artist }\n else\n format.html { render :new }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @artist = Artist.new(artist_params)\n @artist.artist_echo_info\n @artist.related_artists_echo\n @artist.twitter_echo\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist }\n format.json { render :show, status: :created, location: @artist }\n else\n format.html { redirect_to root_path, notice: \"Musiak couldn't index that request. Maybe try a different spelling.\" }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n artist = Artist.new({\n name: params[:artist][:name],\n first_name: params[:artist][:first_name],\n age: params[:artist][:age],\n alive: params[:artist][:alive]\n })\n\n artist.save\n redirect_to '/artists'\n end", "def create\n @artist = Artist.new(artist_params)\n\n respond_to do |format|\n if @artist.save\n\n format.html { redirect_to @artist, notice: 'Artist was successfully created.' }\n\n format.json { render :show, status: :created, location: @artist }\n\n else\n\n format.html { render :new }\n\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def create\n @artist = Artist.new(params[:artist])\n @artist.user = @current_user\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to session[:redirect_origin].pop || artist_url(@artist), notice: 'Artist was successfully created.' }\n format.json { render json: @artist, status: :created, location: @artist }\n else\n format.html { render action: 'new' }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def artists\n # TODO: add param for albums and songs\n a = Artist.all\n render json: a\n end", "def create\n @spotify_artist = SpotifyArtist.new(spotify_artist_params)\n\n respond_to do |format|\n if @spotify_artist.save\n format.html { redirect_to @spotify_artist, notice: 'Spotify artist was successfully created.' }\n format.json { render :show, status: :created, location: @spotify_artist }\n else\n format.html { render :new }\n format.json { render json: @spotify_artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_artist = UserArtist.new\n\t@artist = Artist.find params[:artist_id]\n\t@user_artist.user_id = @current_user.id\n\t@user_artist.artist_id = @artist.id\n\t\n respond_to do |format|\n if @user_artist.save\n format.html { redirect_to @artist, notice: 'User artist was successfully created.' }\n format.json { render :show, status: :created, location: @user_artist }\n else\n format.html { render :new }\n format.json { render json: @user_artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @artists = Artist.find(params[:id])\n puts @artists\n render json:@artists, status: :ok\n end", "def artists\n if RESPONSE.code == 200\n # Return data to page\n JSON.parse(RESPONSE.to_s)['topartists']['artist']\n else\n # print error message\n \"Error Code #{RESPONSE.code}\"\n end\n end", "def create\n @artist = Artist.new(params[:artist])\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to @artist, notice: 'Artist was successfully created.' }\n format.json { render json: @artist, status: :created, location: @artist }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @artist = Artist.new(artist_params)\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to admin_artist_path(@artist), notice: 'Artist was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def create\n @similar_artist = SimilarArtist.new(similar_artist_params)\n\n respond_to do |format|\n if @similar_artist.save\n format.html { redirect_to @similar_artist, notice: 'Similar artist was successfully created.' }\n format.json { render :show, status: :created, location: @similar_artist }\n else\n format.html { render :new }\n format.json { render json: @similar_artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @artist = Artist.new(artist_params)\n @artist.organization_id = params[:organization_id]\n\n respond_to do |format|\n if @artist.save\n format.html { redirect_to organization_artist_url(organization_id: @organization.id, id: @artist.id), notice: 'Artist was successfully created.' }\n format.json { render action: 'show', status: :created, location: @artist }\n else\n format.html { render action: 'new' }\n format.json { render json: @artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @artist = Artist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @artist }\n end\n end", "def create\n @artist = Artist.new(params[:artist])\n\n respond_to do |format|\n if @artist.save\n flash[:notice] = 'Artist was successfully created.'\n format.html { redirect_to(@artist) }\n format.xml { render :xml => @artist, :status => :created, :location => @artist }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @artist = Artist.new(params[:artist])\n\n respond_to do |format|\n if @artist.save\n flash[:notice] = 'Artist was successfully created.'\n format.html { redirect_to(@artist) }\n format.xml { render :xml => @artist, :status => :created, :location => @artist }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n task = Task.create(task_params)\n @artist = Artist.find_by_id(task_params[:artist_id])\n task.artist = @artist\n task.save!\n render json: task\n end", "def new\n @artist = Artist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @artist }\n end\n end", "def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end", "def index \n artists = Artist.all \n render json: artists \n end", "def create\n @params = format_params(artist_params)\n @artist = Artist.new(@params)\n @result = ArtistCommander.process_new_artist(@artist)\n if @result[:type] == \"error\"\n flash[:error] = @result[:value]\n redirect_to '/artists/new'\n else\n @artist.save\n associate_artist_albums\n respond_to do |format|\n @artist.save\n format.html { redirect_to @artist, notice: \"Artist was successfully created.\" }\n format.json { render :show, status: :created, location: @artist }\n end\n end\n end", "def artist_params\n params.require(:artist).permit(:name, :description)\n end", "def artist_params\n params.require(:artist).permit(:name)\n end", "def index\n if params[:album_id]\n @artists = Album.resolve(params[:album_id]).artist\n else\n @artists = Artist.order(:name)\n end\n\n render json: @artists\n end", "def create \n artist = Artist.create(artist_params)\n redirect_to artist #rails knows to go to the show page you need to just reference the correct object\n end", "def add_artist(artist)\n post(:session, {:method => \"library.addArtist\", :artist => artist})\n end", "def updateartists\n @album = Album.find(params[:id])\n album_param = params[:albums]\n @album.artists.delete_all \n album_param[:artists].each do |artist_id|\n artist = Artist.find(artist_id)\n @album.artists << artist \n end \n respond_to do |format|\n format.html { redirect_to(:action => :show) }\n format.xml { head :ok }\n end \n end", "def artist_params\n params.require(:artist).permit(:name, :image, :popularity, :spotify_url)\n end", "def artist_params\n params.require(:artist).permit(:artist_name)\n end", "def create\n @artistum = Artistum.new(artistum_params)\n\n respond_to do |format|\n if @artistum.save\n current_user.update(artista_id: @artistum.id)\n format.html { redirect_to @artistum, notice: 'Artistum was successfully created.' }\n format.json { render :show, status: :created, location: @artistum }\n else\n format.html { render :new }\n format.json { render json: @artistum.errors, status: :unprocessable_entity }\n end\n end\n end", "def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend", "def favourite_artists\n @favourite_artists = FavouriteArtist.all\n render :json => @favourite_artists.to_json\n end", "def create\n @fine_artist = FineArtist.new(params[:fine_artist])\n\n respond_to do |format|\n if @fine_artist.save\n flash[:notice] = 'FineArtist was successfully created.'\n format.html { redirect_to(@fine_artist) }\n format.xml { render :xml => @fine_artist, :status => :created, :location => @fine_artist }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fine_artist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def artist_params\n params.require(:artist).permit(:name, :album_id)\n end", "def artist_params\n params.require(:artist).permit(:name)\n end", "def create\n @song = Song.new(song_params)\n @song.artist = get_artist(params)\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def artist_params\n params.require(:artist).permit(:name, :contact, :bio, :url, :location)\n end", "def artist_params\n params.require(:artist).permit(:name, :description, :image, :remote_image_url)\n end", "def artists\n render :nothing => true and return if params[:id].nil?\n\n if ( params[:meta] == 'tattoos' )\n @artist = Artist.find(params[:id], :include => :tattoos)\n render :json => @artist.tattoos.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end\n \n @artist = Artist.find(params[:id])\n render :json => @artist.to_json(:include => :assets)\n end", "def artist_params\n params.require(:artist).permit(:name, :image)\n end", "def create\n @artist_tag = ArtistTag.new(params[:artist_tag])\n\n respond_to do |format|\n if @artist_tag.save\n format.html { redirect_to artist_tags_path, notice: 'Artist tag was successfully created.' }\n format.json { render json: @artist_tag, status: :created, location: @artist_tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @artist_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create # instantiate artist instance with its name and bio attributes mass assigned from strong params hash\n @artist = Artist.new(artist_params) # argument is strong params hash, returned by calling #artist_params private method\n @artist.save # save artist instance to DB by inserting its row representation into artists table\n redirect_to artist_url(@artist) # redirect to show page that displays the artist just created\n end", "def artist_params\n params.require(:artwork).permit(:artist_name)\n end", "def artist_params\n params.require(:artist).permit(:name, :image_link, :biography)\n end", "def artists(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s\n http_get(path, query)\n end", "def new\n @artist_tag = ArtistTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @artist_tag }\n end\n end", "def artist_params\n params.require(:artist).permit(:name_en, :name_jp, :viaf_identifier, :local_identifier)\n end", "def new\n @artist = Artist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @artist }\n format.js\n end\n end", "def create\n redirect_to new_album_path, alert: \"You have to select at least one artist.\" and return if params[:album][:album_artists].size == 1 && params[:album][:album_artists][0].empty? # TODO: Find a better way to do this, it does not play nicely with json and xml\n @album = Album.new(album_params)\n album_artists\n album_cover if params[:search_online]\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n format.xml { render xml: @album, status: :created }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n format.xml { render xml: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def artist_params\n params.require(:artist).permit(:title, :biography, :genre_id, :artist_img)\n end", "def artist_params\n params.require(:artist).permit(:artist_name, :artist_same, :artist_score)\n end", "def artists\n @artists ||= artists_raw.map {|a| @session.artist.build(:name => a) }\n end", "def spotify_artist_params\n params.require(:spotify_artist).permit(:name, :spotifyID, :images, :popularity, :genres)\n end", "def artist_params\n params.require(:artist).permit(:name, :biography, :photo, :genre, :related_artist, :hotttnesss, :twitter, albums_attributes: [:name])\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def index\n @artists = Artist.all\n end", "def create\n song = Song.new(song_params)\n song.artist_id = @artist.id\n\n if song.save\n render status: 201, json: {\n message: 'Song successfully created',\n song: song\n }.to_json\n else\n render status: 422, json: {\n errors: song.errors\n }.to_json\n end\n end", "def list_artists\n all_artists = artist_data[\"artists\"][\"items\"]\n all_artists.each do | artist |\n artist_name = artist[\"name\"]\n artists[artist_name] ||= {}\n artists[artist_name][:popularity] = artist[\"popularity\"]\n end\n artists\n end", "def create\n @stay_in = \"Thêm Mới Nghệ Sĩ\"\n @admin_artist = Artist.new(params[:artist])\n\n respond_to do |format|\n if @admin_artist.save\n format.html { redirect_to admin_artist_path(@admin_artist), notice: 'Thêm nghệ sĩ thành công.' }\n format.json { render json: @admin_artist, status: :created, location: @admin_artist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_artist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @exhibition = Exhibition.new(params[:exhibition])\r\n unless params[:artist_ids].blank? \r\n @artists = Artist.find(params[:artist_ids])\r\n @exhibition.artists = @artists\r\n end\r\n respond_to do |format|\r\n if @exhibition.save\r\n flash[:notice] = 'Exhibition was successfully created.'\r\n format.html { redirect_to(:controller=>:admin, :action=>:exhibition_list) }\r\n format.xml { render :xml => @exhibition, :status => :created, :location => @exhibition }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @exhibition.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def artist_params\n params.require(:artist).permit(:artist_name, :artist_image, :deleted_at, :mb_id)\n end", "def artist_params\n params.require(:artist).permit(:description, :genre, :origin, :yearsactive, :members, :name, :user_id)\n end", "def artist_params\n params.require(:artist).permit(:name, :age)\n end", "def artist_params\n\t\tparams.require(:artist).permit(:name, :photo)\n\tend", "def create\n @song = Song.new(song_params)\n\n respond_to do |format|\n if @song.save\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def top_artists\n \n artists=[]\n spotify_artists = JSON.parse(api_call(\"https://api.spotify.com/\",\"v1/me/top/artists\"))\n\n spotify_artists['items'].each do |item|\n new_artist = Artist.find_or_create_by(name: item['name'], spotify_id: item['id'])\n new_artist.update(genre_list: item['genres'])\n artists << new_artist\n end\n\n artists\n\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def create\n @art = Art.new(params[:art])\n\n respond_to do |format|\n if @art.save\n format.html { redirect_to @art, notice: 'Art was successfully created.' }\n format.json { render json: @art, status: :created, location: @art }\n else\n format.html { render action: \"new\" }\n format.json { render json: @art.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @artist_medium = ArtistMedia.new(artist_medium_params)\n\n respond_to do |format|\n if @artist_medium.save\n format.html { redirect_to @artist_medium, notice: 'Artist was successfully created.' }\n format.json { render :show, status: :created, location: @artist_medium }\n else\n format.html { render :new }\n format.json { render json: @artist_medium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @artist = Artist.new(params[:artist])\n \n respond_to do |format|\n if @artist.save\n if session[:redirect]\n redirect=\"/events/new?artist=#{@artist.id}\"\n session[:redirect]=nil\n RAILS_DEFAULT_LOGGER.error('went in to redirect: ' + redirect)\n format.html { redirect_to(redirect, :notice => 'Artist was successfully created.') }\n else\n format.html { redirect_to(@artist, :notice => 'Artist was successfully created.') }\n format.xml { render :xml => @artist, :status => :created, :location => @artist }\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @artist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n artwork = Artwork.new(artwork_params)\n if artwork.save\n render json: artwork\n else\n render json: artwork.errors.full_messages, status: :unprocessable_entity\n end\n end", "def new\n @album = Album.new\n @artists = Artist.all\n end", "def create\n @artista = Artista.new(artista_params)\n\n respond_to do |format|\n authorize! :create, @artista\n if @artista.save\n format.html { redirect_to @artista, notice: 'Artista was successfully created.' }\n format.json { render :show, status: :created, location: @artista }\n else\n format.html { render :new }\n format.json { render json: @artista.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n params.each do |key, value|\n puts \"#{key} is #{value}\"\n end\n\n if !current_user.events.find_by_event_id(params['Id'])\n artist_list = []\n params['Artists'].each do |artist|\n artist_list << artist['Name']\n end\n @event = current_user.events.create( event_id: params['Id'], venue_name: params['Venue']['Name'], date: params['Date'], artist_names: artist_list.join(', '))\n end\n\n respond_to do |format|\n if @event && @event.save\n format.html { \n if params['artistId']\n redirect_to events_path('artistId' => params['artistId'])\n elsif params['zipCode']\n redirect_to events_path('zipcode' => params['zipCode'])\n else\n redirect_to :back\n end \n }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { \n if params['artistId']\n redirect_to events_path('artistId' => params['artistId'])\n elsif params['zipCode']\n redirect_to events_path('zipcode' => params['zipCode'])\n else\n redirect_to :back\n end\n }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def artist_params\n params.require(:artist).permit(:name, :wikilink)\n end", "def create\n @song = @artist.songs.new(song_params)\n\n respond_to do |format|\n if @song.save\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render action: 'show', status: :created, location: @song }\n else\n format.html { render action: 'new' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def artist_params\n params.permit(:city, :state, :spotify_id, :name, :followers, :popularity, :genres, :images)\n end", "def index\n @spotify_artists = SpotifyArtist.all\n end", "def artist_params\n params.require(:artist).permit(:name, :vat_number, :organization_id)\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def index\n if (params.has_key?(:artist))\n searched_name = artist_params[:artist_name]\n found = Artist.all.select{|n| n.artist_name.downcase == searched_name.downcase}\n if found[0] != nil\n @artists = found\n else\n @artists = Artist.all.reverse_order\n require 'musicbrainz'\n @foundArtists = MusicBrainz::Artist.search(artist_params[:artist_name])\n # GEM GITHUB => https://github.com/localhots/musicbrainz\n end\n else\n @artists = Artist.all.reverse_order\n end\n @artist = Artist.new\n gon.next_artist_id = Artist.with_deleted.last.id + 1\n end", "def artist_params\n params.require(:artist).permit( :name, :dob, :nationality, :followers, :image )\n end", "def create\n @art = Art.new(art_params)\n\n respond_to do |format|\n if @art.save\n format.html { redirect_to @art, notice: 'Art was successfully created.' }\n format.json { render :show, status: :created, location: @art }\n else\n format.html { render :new }\n format.json { render json: @art.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_artist\n @artist = Artist.find_by(name: params[:name])\n end", "def artists_hash\n parse(get_artists)\n end", "def artist_params\n params.require(:artist).permit(:bio, :name, :birth, :nationality, :web, :photo_attributes => [:id, :artist_id, :image])\n end", "def new\n @artist = Artist.new\n #@album.nicknames = {\"jedne\", \"dwa\", \"trzy\"}\n 3.times { @artist.nicknames.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @artist }\n end\n end", "def create\n @profil_artiste = ProfilArtiste.new(profil_artiste_params)\n @profil_artiste.artiste_id = current_artiste.id\n respond_to do |format|\n if @profil_artiste.save\n format.html { redirect_to @profil_artiste, notice: 'Profil artiste was successfully created.' }\n format.json { render :show, status: :created, location: @profil_artiste }\n else\n format.html { render :new }\n format.json { render json: @profil_artiste.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @artist = Artist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artist }\n end\n end" ]
[ "0.74462026", "0.74462026", "0.73641914", "0.73641914", "0.73176426", "0.731292", "0.72659725", "0.72546893", "0.71016383", "0.71015084", "0.69932723", "0.68638533", "0.6809128", "0.6808301", "0.6780417", "0.6761821", "0.6760281", "0.6695696", "0.66905534", "0.6678908", "0.6678908", "0.6652562", "0.6614779", "0.6614306", "0.66130525", "0.6583243", "0.65733033", "0.6572527", "0.65599364", "0.65529674", "0.6526047", "0.65173817", "0.65164894", "0.64929265", "0.6489822", "0.6481382", "0.6469095", "0.6456965", "0.6445814", "0.6409803", "0.63947266", "0.6364119", "0.6352764", "0.63425463", "0.6342117", "0.6340606", "0.63221365", "0.62903994", "0.6286721", "0.6278319", "0.62694293", "0.6262625", "0.6247886", "0.6244775", "0.6239455", "0.6223492", "0.6209997", "0.6207967", "0.61882746", "0.61855763", "0.61855763", "0.61855763", "0.61855763", "0.61855763", "0.61855763", "0.6179996", "0.61772984", "0.61722696", "0.61575824", "0.6155301", "0.6141121", "0.61390007", "0.61139053", "0.6108617", "0.6108071", "0.6104492", "0.6104492", "0.6104492", "0.6104383", "0.6091756", "0.6079656", "0.6072091", "0.6071814", "0.6061093", "0.60606533", "0.60537267", "0.60484254", "0.6047054", "0.60468775", "0.6035936", "0.6021809", "0.6019162", "0.6018292", "0.601686", "0.6010051", "0.6007772", "0.5997492", "0.5985252", "0.5982584", "0.5979583" ]
0.65347683
30
DELETE /artists/1 DELETE /artists/1.json
def destroy @artist.destroy respond_to do |format| format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to artists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to artists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: t(:destroy_notice) }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_artist = Artist.find(params[:id])\n @admin_artist.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_artists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to(artists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to(artists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to(artists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: \"Artist was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n\n format.json { head :no_content }\n end\n end", "def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to organization_artists_url(organization_id: @organization.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @artist = Artist.find(params[:id])\n @artist.destroy\n\n respond_to do |format|\n format.html { redirect_to artists_url }\n format.json { head :ok }\n #format.js { render :nothing => true }\n end\n end", "def destroy\n @artist.destroy_songs\n @artist.albums.destroy_all\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'Artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to admin_artists_url }\n end\n end", "def destroy\n @fine_artist = FineArtist.find(params[:id])\n @fine_artist.destroy\n\n respond_to do |format|\n format.html { redirect_to(fine_artists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @spotify_artist.destroy\n respond_to do |format|\n format.html { redirect_to spotify_artists_url, notice: 'Spotify artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @artista.destroy\n respond_to do |format|\n format.html { redirect_to artistas_url, notice: 'Artista was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @artist.destroy\n respond_to do |format|\n format.html { redirect_to artists_url, notice: 'artist was successfully destroyed.' }\n end\n end", "def destroy\n @artist_medium.destroy\n respond_to do |format|\n format.html { redirect_to artist_mediums_url, notice: 'Artist was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_artist.destroy\n respond_to do |format|\n format.html { redirect_to user_artists_url, notice: 'User artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @similar_artist.destroy\n respond_to do |format|\n format.html { redirect_to similar_artists_url, notice: 'Similar artist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @artist_tag = ArtistTag.find(params[:id])\n @artist_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to artist_tags_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @art = Art.find(params[:id])\n @art.destroy\n\n respond_to do |format|\n format.html { redirect_to art_index_url }\n format.json { head :ok }\n end\n end", "def destroy\n \n @artist_data.destroy\n respond_to do |format|\n @artist_data.avatar = nil\n format.html { redirect_to \"/artistas/adm\", notice: 'Artist data was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n end", "def unfollow_artist\n relationship_to_delete = Relationship.where(follower_id: params[:follower_id], followed_id: params[:followed_id])\n relationship_to_delete[0].destroy\n relationships = Relationship.where(followed_id: params[:followed_id])\n render json: relationships\n end", "def destroy\n #@artigo = Artigo.find(params[:id])\n #@artigo.destroy\n\n respond_to do |format|\n format.html { redirect_to artigos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @artist.artist_brands.size <= 1\n @artist.destroy\n else\n @artist.artist_brands.each do |ab|\n ab.destroy if ab.brand == website.brand\n end\n end\n respond_to do |format|\n format.html { redirect_to(admin_artists_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted artist: #{@artist.name}\")\n end", "def destroy\n @album.destroy\n render json: @album\n end", "def destroy\n @instagram_arts.destroy\n respond_to do |format|\n format.html { redirect_to arts_url, notice: 'Art was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo3.destroy\n respond_to do |format|\n format.html { redirect_to todo3s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album_follow.destroy\n respond_to do |format|\n format.html { redirect_to album_follows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @musician = Musician.find(params[:id])\n @musician.destroy\n\n respond_to do |format|\n format.html { redirect_to musicians_url }\n format.json { head :ok }\n end\n end", "def destroy\n @art.destroy\n respond_to do |format|\n format.html { redirect_to arts_url, notice: 'Art was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @art.destroy\n respond_to do |format|\n format.html { redirect_to arts_url, notice: 'Art was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @art.destroy\n respond_to do |format|\n format.html { redirect_to arts_url, notice: 'Art was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumone.destroy\n respond_to do |format|\n format.html { redirect_to albumones_url, notice: 'Albumone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to musics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @music = Music.find(params[:id])\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to home_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumfife.destroy\n respond_to do |format|\n format.html { redirect_to albumfives_url, notice: 'Albumfive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @music = Music.find_by_sql(\"SELECT * FROM Musics M Where M.id = \" + params[:id]).first()\n @music.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/musics\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @rede_social.destroy\n respond_to do |format|\n format.html { redirect_to \"/show_rede_social/#{@artist_data.id}/adm/remover\", notice: 'Rede social was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { render json: { status: 200 } }\n end\n end", "def destroy\n @art.destroy\n respond_to do |format|\n format.html { redirect_to arts_url, notice: 'You have relinquished this moment' }\n format.json { head :no_content }\n end\n end", "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song.destroy\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @artwork.destroy\n respond_to do |format|\n format.html { redirect_to artworks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @music_type.destroy\n respond_to do |format|\n format.html { redirect_to music_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uriy.destroy\n respond_to do |format|\n format.html { redirect_to uriys_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n respond_to do |format|\n if @album.destroy\n format.html { redirect_to artist_albums_url, notice: 'album was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { render action: 'delete' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url, notice: 'Удалена запись о музыке.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @articuloind = Articuloind.find(params[:id])\n @articuloind.destroy\n\n respond_to do |format|\n format.html { redirect_to articuloinds_url }\n #format.json { head :ok }\n end\n end", "def destroy\n @albumsix.destroy\n respond_to do |format|\n format.html { redirect_to albumsixes_url, notice: 'Albumsix was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_art.destroy\n respond_to do |format|\n format.html { redirect_to list_arts_url, notice: 'List art was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @artwork_created_by = ArtworkCreatedBy.find(params[:id])\n @artwork_created_by.destroy\n\n respond_to do |format|\n format.html { redirect_to artwork_created_bies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @talent = Talent.find(params[:id])\n @talent.destroy\n\n respond_to do |format|\n format.html { redirect_to talents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end", "def destroy\n @talent = Talent.find(params[:id])\n @talent.destroy\n\n respond_to do |format|\n format.html { redirect_to talents_url }\n format.json { head :ok }\n end\n end", "def destroy\n @albums = Album.all\n @album = Album.find(params[:id])\n @album.destroy\n \n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @artpiece = Artpiece.find(params[:id])\n @artist = @artpiece[:artist_id]\n @artpiece.destroy\n\n redirect_to :controller => \"artists\", :action => \"show\", :id => @artist\n end", "def destroy\n @todo.destroy\n render json: [\"Deleted successfully.\"], status: :ok\n end", "def destroy\n @musician.destroy\n respond_to do |format|\n format.html { redirect_to musicians_url, notice: 'Musician was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url, notice: 'Music was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @music.destroy\n respond_to do |format|\n format.html { redirect_to musics_url, notice: 'Music was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @new_artwork.destroy\n respond_to do |format|\n format.html { redirect_to new_artworks_url, notice: 'New artwork was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def updateartists\n @album = Album.find(params[:id])\n album_param = params[:albums]\n @album.artists.delete_all \n album_param[:artists].each do |artist_id|\n artist = Artist.find(artist_id)\n @album.artists << artist \n end \n respond_to do |format|\n format.html { redirect_to(:action => :show) }\n format.xml { head :ok }\n end \n end", "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @albumfour.destroy\n respond_to do |format|\n format.html { redirect_to albumfours_url, notice: 'Albumfour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @art = Art.find(params[:id])\n @art.destroy\n\n respond_to do |format|\n format.html { redirect_to(arts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @art = Art.find(params[:id])\n @art.destroy\n\n respond_to do |format|\n format.html { redirect_to(arts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n respond_to do |format|\n if @song.destroy\n format.html { redirect_to artist_album_songs_url, notice: 'album was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { render action: 'delete' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7928831", "0.7928831", "0.79146665", "0.7787535", "0.77650654", "0.7681658", "0.7681658", "0.7681658", "0.7652797", "0.76416695", "0.75489223", "0.7544106", "0.75380546", "0.7514569", "0.74450904", "0.74302214", "0.7381367", "0.73496217", "0.7348394", "0.71544236", "0.7152854", "0.71301144", "0.71079725", "0.702908", "0.6925321", "0.6920101", "0.69182897", "0.6916522", "0.6890057", "0.6869341", "0.684309", "0.683568", "0.6830474", "0.68169445", "0.68169445", "0.68169445", "0.6754645", "0.67492193", "0.67492193", "0.67492193", "0.6743042", "0.6729101", "0.6729101", "0.6729101", "0.6725496", "0.6725166", "0.67243594", "0.6716914", "0.6705767", "0.6702482", "0.67004263", "0.6697108", "0.6697108", "0.6697108", "0.6697108", "0.6697108", "0.6697108", "0.6697108", "0.6692686", "0.66918087", "0.66852826", "0.668219", "0.668219", "0.668219", "0.668219", "0.668219", "0.66818887", "0.6681248", "0.6678269", "0.6677844", "0.6676998", "0.66541076", "0.6646286", "0.6639558", "0.66389495", "0.6635733", "0.66354483", "0.66330254", "0.66292346", "0.6617349", "0.66148615", "0.6614389", "0.6611566", "0.6611566", "0.6607243", "0.65901655", "0.6582859", "0.65797704", "0.65797704", "0.65797704", "0.65797704", "0.65797704", "0.65797704", "0.6576855", "0.657395", "0.657395", "0.6573056" ]
0.76563317
10
Use callbacks to share common setup or constraints between actions.
def set_artist @artist = Artist.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 artist_params params.require(:artist).permit(:artist_name, :artist_image, :deleted_at, :mb_id) 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
Remembers a user in the database for user in persistent sessions.
def remember self.remember_token = User.new_token update_attribute(:remember_digest, User.digest(remember_token)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end", "def change_password\n @user = User.find_by_id(session[:remember_token])\n end", "def load_user(user)\n session[:user_id] = user.id\n session_reset_timeout!\n user.update_attributes last_login_on: Time.now, login_count: user.login_count + 1\n end", "def set_user\n zeus = User.find(@zeus_user.id)\n zeus.state = User.states['retrieved_password']\n zeus.save!\n \n request.session[:rbac_user_id] = @zeus_user.id\n end", "def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end", "def with_user(new_user, &block)\n begin\n set_user(new_user)\n yield exists?(:previous_user) ? fetch(:previous_user) : nil\n ensure\n reset_user\n end\n \n clear_sessions\n end", "def set_session_current_user(user)\n self.current_user = user\n # Try to reuse existing sessions.\n if session[:authpwn_suid]\n token = Tokens::SessionUid.with_code(session[:authpwn_suid]).first\n if token\n if token.user == user\n token.touch\n return user\n else\n token.destroy\n end\n end\n end\n if user\n session[:authpwn_suid] = Tokens::SessionUid.random_for(user,\n request.remote_ip, request.user_agent || 'N/A').suid\n else\n session.delete :authpwn_suid\n end\n end", "def lookup_user\n reset_session #use this when they ask you to find a user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def save_session user\n # The password_seed method is used to generate the stored token.\n # The remember_token is then stored as a signed cookie along with the\n # user's ID from the database.\n remember_token = password_seed\n cookies.permanent.signed[:remember_user_id] = user.id\n cookies.permanent.signed[:remember_user_token] = remember_token\n \n # The WHIRLPOOL hash of remember_token and the user's password seed is\n # then stored in the database.\n remember_hash = Digest::Whirlpool.hexdigest(remember_token +\n user.password_seed)\n user.update_attributes(:remember_hash => remember_hash)\n user.save\n end", "def remember user\n # generates the remember token and saves it's encrypted form to the db\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember\n self.remember_token = User.new_token\n self.remember_digest = User.digest(self.remember_token)\n update_attribute(:remember_digest, self.remember_digest) #for new user, this creates record\n end", "def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end", "def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end", "def user_remember(user)\n user.remember_user\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def set_user\n @user = User.find(session[:id]) if @user.nil && session[:id]\n end", "def sign_in(user)\n sign_out\n\n user.touch(:last_login_at)\n user_session = user.sessions.new(ip_address: request.remote_ip, user_agent: request.user_agent)\n if user_session.save\n user.password_resets.delete_all\n @current_session = user_session\n end\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def fetch_user\n\n # Check if user_id in the session is the id of a real user in our db. If it is, we will get the user object in @current_user; if not, we will get nil\n if session[:user_id].present?\n @current_user = User.find_by id: session[:user_id]\n end\n\n # If we did get nil from the above query, delete the session because the user_id is stale (invalid)\n if @current_user.nil?\n session[:user_id] = nil # unless @current_user.present?\n end\n\n end", "def fetch_user\n @current_user = User.find_by(:id => session[:user_id]) if session[:user_id]\n\n session[:user_id] = nil unless @current_user.present?\n end", "def user_remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def set_user\n @user = User.find_by(username: params[:user][:username])\n session[:user_id] = @user.id\n end", "def set_user_session\n @user = user_session.find(params[:id])\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def maintain_session_and_user\n if session[:id]\n if @application_session = Session.find_by_id(session[:id])\n @application_session.update_attributes(:ip_address => request.remote_addr, :path => request.path_info)\n @user = @application_session.person\n else\n flash[:notice] = \"Excuse me, but your session data appears to be outdated. Do you mind logging in again?\"\n session[:id] = nil\n redirect_to(root_url) #If he has an incorrect session id, send to root\n end\n end\n end", "def set_current_user(user)\n sha1 = Digest::SHA1.hexdigest(user.id.to_s + Time.now.to_i.to_s)\n cookies[:remember_token] = { :value => sha1, :expires => 3.years.from_now }\n user.remember_token = sha1\n user.save\n @current_user = user\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def sign_in(user)\n # Issues new random piece of text (aka\n # remember_token) to user\n remember_token = User.new_remember_token\n # Giving user plain text token\n cookies.permanent[:remember_token] = remember_token\n # Hashing the version of the remember_token which the host maintains.\n user.update_attribute(:remember_token, User.hash(remember_token))\n #sets the one who signed in (user) to current user\n self.current_user=user\n end", "def sign_in(user)\n remember_token = User.new_remember_token # create a new remember token\n cookies.permanent[:remember_token] = remember_token # save the remember token on the client side as a cookie\n user.update_attributes remember_token: User.hash(remember_token) # save the remember token on the server side in the DB\n self.current_user = user\n end", "def restore_last_user\n return @last_user if @last_user\n if session[:last_user_id].present?\n @last_user = User.find_by_id(session[:last_user_id])\n message = translate(\"users.sign_in_back\", user: @last_user.name)\n set_flash_message(message, :success, false)\n session.destroy()\n session[:id] = @last_user.id if @last_user.present?\n return @last_user\n end\n end", "def remember\n self.remember_token = Incline::User::new_token\n update_attribute(:remember_digest, Incline::User::digest(self.remember_token))\n end", "def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end", "def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end", "def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end", "def alter_current_user(&block)\n user = current_user\n user = User.find(user.id) if user.frozen? # Since we're modifying it, we can't use the one from memcached.\n yield(user)\n user.save if logged_in?\n $CACHE.delete(\"users/#{session[:user_id]}\")\n set_current_user(user)\n user\n end", "def remember\n self.remember_token = User.new_token\n\n # update_attribute bypasses validations, since we don't have user's password\n # here, which is normally necessary for changing records on the table\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def current_user=(new_user)\n current_session.user = new_user\n end", "def remember(user) \n user.remember # the method creates remember_token for that user and saves the hashed the version in the db \n cookies.permanent.signed[:user_id] = user.id # This stores the user.ID(encrypted) in the browser cookie\n cookies.permanent[:remember_token] = user.remember_token # This stores the remember token(encrypted) in the cookie \n # the remember token was created in the first line of code \"user.remember\"\n end", "def destroy\n User.find(current_user.id)\n reset_session\n redirect_to new_user_path\n end", "def remember(user)\n user.remember # Calls model\n cookies.permanent.signed[:user_id] = user.id # Save off encryped user ID\n cookies.permanent[:remember_token] = user.remember_token # Save off random thing for validation\n end", "def reset_current_user(user_x)\n user = User === user_x ? user_x : User.find(user_x)\n unless user.nil? || current_user_id == user.id\n clear_auth_cookie\n reset_user_session\n set_current_user(user)\n end \n end", "def remember(user)\n user.remember\n # abort(@session[:user_id].to_s)\n # cookies.permanent.signed[:user_id] = user.id\n # cookies.permanent[:remember_token] = user.remember_token\n end", "def set_user_session\n @user_session = UserSession.find\n end", "def remember\n self.remember_token = User.new_token\n update remember_digest: User.digest(remember_token)\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember(user)\n user.persist\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def change_password\n @user=User.find(current_user)\n end", "def set_user\n if session[:user_id].nil?\n @user = nil\n else\n @user = User.find(session[:user_id])\n end\n end", "def sign_in(user)\n remember_token = User.new_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_digest, User.digest(remember_token))\n cookies.permanent.signed[:user_id] = user.id\n self.current_user = user\n end", "def remember\n self.remember_token = User.new_token\n self.update_attribute :remember_digest, User.digest(remember_token)\n end", "def remember(user)\n user.save_remember_digest\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember\n self.remember_token = User.new_token\n self.update_attribute(:remember_digest, User.digest(self.remember_token))\n end", "def set_user_session\n UserSession.current_user = current_user\n end", "def remember\n self.remember_token = User.generate_remember_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end", "def set_user_session(user)\n session[:logged_in_users_id] = user.id\n end", "def remember\n self.remember_token=User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def set_user\n UserInfo.current_user = session[:user]\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def login!(user)\n user.reset_session_token!\n # curr_session_token == user.session_token\n # sets user.curr_session_token and persists to UserSessionsOwnership table\n user.set_curr_session_token\n @current_user = user # set current_user upon login\n # session[:session_token] = user.session_token\n session[:session_token] = user.curr_session_token\n end", "def remember(user)\n\t\t#calls the remember method in AdminUser model\n\t\tuser.remember\n\t\t#cookies method helps to do permanent sessions. This is actually a syntactic sugar for a bigger thing. \n\t\tcookies.permanent.signed[:user_name] = user.username\n\t\t#save the remembertoken as well. this dosent need to be encrypted\n\t\tcookies.permanent[:remember_token] = user.remember_token\n\tend", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.login_token = User.new_token\n update_attribute(:login_digest, User.digest(self.login_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end" ]
[ "0.6907703", "0.6520468", "0.6276567", "0.6271878", "0.6216145", "0.619693", "0.61958396", "0.61565614", "0.6154017", "0.6150753", "0.61354303", "0.611746", "0.611746", "0.60892946", "0.6061138", "0.6054463", "0.6048063", "0.6048001", "0.6047364", "0.60468477", "0.60464585", "0.60390043", "0.6031747", "0.6031747", "0.6025114", "0.6009819", "0.60058725", "0.59740174", "0.5967943", "0.5966209", "0.5949208", "0.59482616", "0.59459126", "0.59459126", "0.59405065", "0.5940229", "0.59397846", "0.5928315", "0.59268993", "0.5918215", "0.5918136", "0.5915061", "0.5900793", "0.58967113", "0.5889004", "0.58885634", "0.588007", "0.5880043", "0.5879273", "0.58706695", "0.5861337", "0.5860759", "0.5847441", "0.5847143", "0.58419764", "0.583885", "0.58363324", "0.5834857", "0.58332586", "0.58332586", "0.58332586", "0.5833237", "0.58318466", "0.58315027", "0.5831426", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051", "0.5831051" ]
0.5833045
62
Returns true if the given token matches the digest.
def authenticated?(remember_token) return false if remember_digest.nil? BCrypt::Password.new(remember_digest).is_password?(remember_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticated?(digest, token)\n digest = send(\"#{digest}_digest\")\n # Use metaprogramming to select the appropriate token attribute based on\n # the parameter digest.\n return false if digest.nil? # Digest does not exist in the database.\n BCrypt::Password.new(digest).is_password?(token)\n # Decrypts the digest and compares it to the token.\n end", "def authenticated?(token, digest = nil)\n return false if digest.present? && BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n digest.is_digest_for? token\n end", "def validate_token(digest, token)\n if token.nil? || digest.nil?\n false\n else\n BCrypt::Password.new(digest).is_password?(token)\n end\n end", "def authenticated_with_token?(token)\n return false if token.nil?\n token == remember_digest\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n digest == Digest::SHA1.hexdigest(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n digest == Digest::SHA1.hexdigest(token)\n end", "def valid_signature?(token)\n return false unless token =~ /&HMACSHA256=(.*)$/\n original_signature = CGI.unescape(token[/&HMACSHA256=(.*)$/, 1])\n bare_token = token.gsub(/&HMACSHA256=(.*)$/, '')\n signature = Base64.encode64(HMAC::SHA256.new(Base64.decode64(shared_secret)).update(bare_token.toutf8).digest).strip\n return original_signature == signature\n end", "def match_token(token)\n return true\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\") # no need for self.send as we're in the user model\n return false if digest.nil?\n # verify the token matches the digest\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n # when digest nil ist soll die methode false zurückgeben damit Bcrypt keinen Fehler hervorrufen kann, wenn man sich bei zwei BRowsern eingeloggt hat und sich nur bei einem abmeldet, aber beide schließt.\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token) #takes a token, hashes it and compares it to the original hash_digest from the database. If hash_digest of given token is equal to the one saved in the database, authenticatedß returns true.\n end", "def authenticated?(attribute, token)\n digest = self.try(\"#{attribute}_digest\")\n return false if digest.nil?\n ::BCrypt::Password.new(digest) == token\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_token_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n \n digest = send(\"#{attribute}_digest\")\n \n return false if digest.blank? \n #ry.binding\n \n #BCrypt::Password.new will fail with invalid_hash as the new hash not having the valid_hash? coming tru for BCrypt gem.\n #It should be passed all the params as in cost and salt, so that it can be successfully be parsed. Otherwise use create.\n #https://github.com/codahale/bcrypt-ruby/blob/master/lib/bcrypt/password.rb\n # alias is_password, :== \n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n \treturn false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n\tdigest = send(\"#{attribute}_digest\")\n\treturn false if digest.nil?\n\tBCrypt::Password.new(digest).is_password?(token)\nend", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token) \n end", "def authenticated?(auth_token)\n return false if auth_token_digest.nil?\n BCrypt::Password.new(auth_token_digest).is_password? (auth_token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n\t\tdigest = send(\"#{attribute}_digest\")\n\t\treturn false if digest.nil?\n\t\tBCrypt::Password.new(digest).is_password?(token)\n\tend", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\") # self is omitted on send()\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n digest.present? ? BCrypt::Password.new(digest).is_password?(token) : false\n end", "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil? \n \n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n \tdigest = send(\"#{attribute}_digest\")\n \treturn false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n \tend", "def authenticated?(token)\n digest = self.otp_digest\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute,token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil?\n\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{ attribute }_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n\n end", "def valid_token?(token)\n exists?(:token => token)\n end", "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n return false if digest.nil? # Password.new(nil) raises error\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n \tdigest = send(\"#{attribute}_digest\")\n \treturn false if digest.nil?\n \tBCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end", "def authenticated?(attribute, token)\n digest = self.send(\"#{attribute}_digest\")\n return false if digest.nil?\n BCrypt::Password.new(digest).is_password?(token)\n end" ]
[ "0.78424853", "0.76170635", "0.7406786", "0.72879815", "0.7143585", "0.71428716", "0.71428716", "0.7028208", "0.6984801", "0.6964507", "0.6905196", "0.6859846", "0.6843323", "0.6824065", "0.67973304", "0.67884517", "0.67749035", "0.676529", "0.6751168", "0.67464095", "0.6743642", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6717869", "0.6716728", "0.67155164", "0.67155164", "0.67155164", "0.67155164", "0.67155164", "0.67155164", "0.67155164", "0.67155164", "0.67155164", "0.67155164", "0.6714587", "0.6714452", "0.6714318", "0.671096", "0.6710529", "0.67039156", "0.6687869", "0.6679038", "0.6677953", "0.66753757", "0.6671193", "0.66700786", "0.66696876", "0.66696876", "0.66696876", "0.66696876", "0.66696876", "0.66696876", "0.66696876", "0.66696876" ]
0.0
-1
Returns true if the current user is reviewing the other user
def reviewing?(other_user) reviewing.include?(other_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ever_reviewed_by?(user_id)\n\t\tself.reviews.any?{|review| review.user_id == user_id}\n\tend", "def is_resident_review?\n user_review = self.user \n if user_review != nil\n user_review = self.user\n if user_review.is_resident_of?(self.city)\n return true \n else\n return false\n end \n else \n return false \n end \n end", "def post_review?(next_review, user)\n\n (next_review && \n !self.review_locked? && \n next_review.designer_id == user.id &&\n next_review.review_type_id == next_review.design.phase_id)\n\n end", "def reviewable_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :reviewer)\n end", "def is_reviewer?(user)\n review_result = self.design_review_results.detect { |drr| drr.reviewer == user }\n review_result != nil\n end", "def reviewed?(profile)\n self.reviews.find_by_profile_id(profile.id)\n end", "def current_user_is_reviewer?(current_user_id)\n get_logged_in_reviewer_id(current_user_id) != nil\n end", "def reviewed_school?(user)\n self.reviews.exists?(user: user)\n end", "def can_review?\n reviewer? || moderator? || administrator?\n end", "def user_already_reviewed(movie)\n \t@user_already_reviewed = -1\n \tif user_signed_in? \n\n\t reviewFound = movie.reviews.where('user_id' => current_user.id).first\n\t if reviewFound && reviewFound.status == true\n\t @user_already_reviewed = 0\n\t elsif reviewFound && reviewFound.status == false\n\t @user_already_reviewed = 1\n\t elsif movie.user_id == current_user.id\n\t @user_already_reviewed = 2\n\t end\n\tend\n \treturn @user_already_reviewed\nend", "def user_reviews\n Review.all.select {|review| review.user == self}\n end", "def hasReviewed(u, e)\n return Event.find_by(id: e).reviews.find_by(user_id: u) != nil\n end", "def reviewed?\n @status == :reviewed\n end", "def hasNotReviewed(id)\n email_address = current_user.email\n reviews = Review.where(user_email: email_address)\n\n if logged_in?\n reviews.each do |rv|\n if rv.user_id == id\n return false\n end\n end\n else\n return false\n end\n return true\n end", "def other_user_profile?\n !is_owner\n end", "def in_review?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='In Review'\").id\n end", "def has_reviewed?(advocate)\n !!Review.find(:first, :conditions => [\"reviews.reviewer_id = ? AND reviews.reviewee_id = ?\", self.id, advocate.id])\n end", "def advising?(other_user)\n advisees.include?(other_user)\n end", "def voted_on?(user)\n return !self.ratings.find_by_user_id(user.id).nil?\n end", "def both_user_verified?\n current_user.is_verified? && object.is_verified?\n end", "def reviews\n Review.all.select do |r|\n r.user == self\n end\n end", "def authorize_user_review\n session[:return_to] ||= request.referer\n if current_user != @review.user\n flash[:notice] = \"You didn't write that review\"\n redirect_to session.delete(:return_to)\n end\n\n end", "def just_reviewed?\n reviewed? and reviewed_changed?\n end", "def is_editable_by(another_user)\n !!(\n is_associated_to_somebody_else_than(another_user) &&\n !@swimmer.associated_user.find_any_friendship_with(another_user).nil?\n )\n end", "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\n end", "def reviewer_locked_in?\n ReviewStatus.closed_reviews.include?(self.review_status)\n end", "def mayEdit? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYEDIT ) )\n return true\n end\n end\n end\n return false\n end", "def has_reviewed?(advocate)\n if self.is_a?(Client)\n !!self.reviews.find(:first, :conditions => [\"reviews.reviewee_id = ?\", advocate.id])\n else\n false\n end\n end", "def update?\n !@user.nil? && !@user.nil? && \\\n @proposal.user == @user\n end", "def user_is_owner_of_proposal?(proposal_user_id)\n \t\tuser_signed_in? && (proposal_user_id == current_user.id)\n \tend", "def reviewed?\n review_count = Review.where(user: user, essay: assignment.essays).count\n total_count = assignment.user_assignments.count\n total_count - review_count - 1 <= 0\n end", "def who_is_it(opponent)\n opponent.user == current_user\n end", "def reviewing_provider?\n\t\t(params[:controller] == 'profiles' && params[:action] == 'rate') ||\n\t\t\t(params[:controller] == 'reviews' && ['new', 'create'].include?(params[:action]))\n\tend", "def current_user?(user)\n user == current_person.user\n end", "def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?',\n self.id, reviewer.id, assignment.id]) > 0\n end", "def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?', \n self.id, reviewer.id, assignment.id]) > 0\n end", "def reviewed_by?(reviewer)\n return TeamReviewResponseMap.count(:conditions => ['reviewee_id = ? AND reviewer_id = ? AND reviewed_object_id = ?', \n self.id, reviewer.id, assignment.id]) > 0\n end", "def can_rate?(person)\n person != self.reviewer && person != self.reviewee && !self.rated_by?(person)\n end", "def is_reviewer?\n self.reviewer_role != nil\n end", "def reviewed_by?(reviewer)\n ReviewResponseMap.where('reviewee_id = ? && reviewer_id = ? && reviewed_object_id = ?', id, reviewer.get_reviewer.id, assignment.id).count > 0\n end", "def current_user?(user)\r\n user == current_user\r\n end", "def current_user?(user)\n user && user == current_user\n end", "def fields_user_id_and_reviewer_id_are_different\n if self.user_id == self.reviewer_id\n errors.add(\"You cannot give yourself a review\")\n end\n end", "def is_approvable_by(another_user)\n return false unless is_associated_to_somebody_else_than(another_user)\n\n existing_friendship = @swimmer.associated_user.find_any_friendship_with(another_user)\n !!(\n existing_friendship &&\n existing_friendship.pending? &&\n (existing_friendship.friend_id == another_user.id) # Another user is the one *receiving* the invite\n )\n end", "def donating_to?(other_user)\n return true if self.donating_to == (other_user)\n end", "def rated_by?(user)\n rating && rating.user_ratings.exists?(:user_id => user)\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end", "def reviewed?\n !application_review_decision_type.nil?\n end", "def is_approver?(user)\n\n self.users.include?(user)\n\n end", "def is_scorable_review? \n if self.is_resident_review?\n return true # Review belongs to resident of the city, so it's scorable.\n elsif self.has_enough_votes? # Reviewer isn't resident of city being review, so does the review have enough votes to be scorable\n return true # Has enough votes to affect city score \n else # Review doesn't have enough votes and is a non-resident review.\n return false\n end \n end", "def current_user?(user)\n \t\tuser == current_user\n \tend", "def inactive_reviewers?\n self.inactive_reviewers unless @results_with_inactive_users\n @results_with_inactive_users.size > 0\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def reviews?(resource)\n project = resource.projects.hidden.first\n project && project.collaborators.exists?(id)\n end", "def current_user?(user)\n user == current_user\n end", "def applies_to?(user); false end", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def can_review(cp)\n cps_as_reviewer.include?(cp)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def verify_user\n redirect_to forbidden_path unless user_signed_in? && @review.user_id == current_user.id\n end", "def current_user?(user)\n \t\tuser == current_user\n \tend", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def current_user?(user)\n current_user == user\n end", "def viewer?(current_user)\n return false unless current_user\n\n viewers.where(id: current_user).count == 1\n end", "def following? other_user\n following.include?(other_user)\n end", "def is_this_user\n\t\t@user.id == current_user.id\n\tend", "def rated_by_user?(user)\n rtn = false\n if user\n self.ratings.each { |b|\n rtn = true if user.id == b.user_id\n }\n end\n rtn\n end", "def current_user?(user) \n user == current_user\n end", "def rated_by_current_user?(user)\n self.appearance_ratings.exists?(:user_id => user)\n end", "def operational?\n @user1_confirmed && @user2_confirmed\n end", "def following?(other_user)\n\t following.include?(other_user)\n \tend", "def likable?\n if current_user\n !dog_has_owner? || dog_owner.id != current_user.id ? true : false\n else\n false\n end\n end", "def voted\n\t\tcurrent_user = User.current_user\n\t\tunless current_user.blank?\n\t\t\tcurrent_user.voted?(self)\n\t\telse\n\t\t\tfalse\n\t\tend \n\tend" ]
[ "0.75062317", "0.73316294", "0.729414", "0.71572375", "0.7104558", "0.7097598", "0.7087988", "0.707417", "0.70628905", "0.7010617", "0.69329786", "0.6839503", "0.68301105", "0.6784396", "0.678437", "0.67695665", "0.67623967", "0.67427266", "0.6731118", "0.6730113", "0.6712953", "0.66817904", "0.6679422", "0.6652904", "0.66364723", "0.6635675", "0.66214585", "0.6618761", "0.6576981", "0.6552091", "0.6542765", "0.65355814", "0.6535026", "0.65319806", "0.6525778", "0.65253156", "0.65253156", "0.6523102", "0.65154713", "0.6501875", "0.6491842", "0.64905685", "0.6486866", "0.6479867", "0.6472217", "0.64714", "0.6468344", "0.6468344", "0.6468344", "0.6468344", "0.6468344", "0.6468344", "0.6468344", "0.6467677", "0.6447067", "0.64409816", "0.643634", "0.64294213", "0.6425479", "0.6422844", "0.6419095", "0.6415323", "0.64049524", "0.6404552", "0.6404552", "0.6404552", "0.6404552", "0.6404552", "0.6404552", "0.6404552", "0.6404552", "0.6404552", "0.6404552", "0.6404194", "0.6404144", "0.6404144", "0.6404144", "0.6404144", "0.64014876", "0.64014876", "0.64003235", "0.63995326", "0.6397231", "0.6397231", "0.6397231", "0.6397231", "0.6397231", "0.6397231", "0.6397231", "0.6397231", "0.63949555", "0.63878375", "0.63876325", "0.63864666", "0.63848686", "0.63842875", "0.6381117", "0.63776624", "0.63751155", "0.63748026" ]
0.8577895
0
GET /veiculo_motoristas GET /veiculo_motoristas.json
def index v = params[:id] @veiculo = Veiculo.find(v) @veiculo_motoristas = VeiculoMotorista.where('veiculo_id=?',@veiculo.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @motoristas = Motorista.all\n end", "def index\n @motorista = Motoristum.all\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def index\n @mencions = Mencion.order(\"escuela_id\").paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mencions }\n end\n end", "def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end", "def set_motorista\n @motorista = Motorista.find(params[:id])\n end", "def index\n @motivos = Motivo.all\n end", "def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end", "def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end", "def set_veiculo_motorista\n @veiculo_motorista = VeiculoMotorista.find(params[:id])\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def veiculo_motorista_params\n params.require(:veiculo_motorista).permit(:veiculo_id, :motorista_id, :status)\n end", "def index\n seleccionarMenu(:rondas)\n @rondas = Ronda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rondas }\n end\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end", "def index \n @lancamentorapido = Lancamentorapido.new \n @lancamentorapidos = Lancamentorapido.all\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lancamentorapidos }\n end\n end", "def show\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def buscarModelos\n id_marca = params[:id_marca]\n @modelos = Modelo_Vehiculo.new\n @objmodelos = @modelos.buscarModelosMarca(id_marca)\n parsed_json = ActiveSupport::JSON.decode($tirajson)\n i=0\n @objmodelos.each do |modelo|\n #puts @objmodelo.imagen1\n @modelos.creararchivofisico(modelo.descripcion+'.jpg',$directorio_raiz+'/public/images/modelovehiculo/',modelo.imagen1)\n parsed_json[i][\"imagen3\"]=\"images/modelovehiculo/\"+modelo.descripcion+'.jpg'\n parsed_json[i][\"imagen1\"]=\"\"\n i=i+1\n end\n $tirajson = parsed_json.to_json\n render :text => $tirajson\n end", "def index\n \n if current_user.tipo == 2\n @receita_medicas = ReceitaMedica.where(:medico_id => current_user.id)\n elsif current_user.tipo == 1\n @receita_medicas = ReceitaMedica.where(:paciente_id => current_user.id)\n elsif current_user.tipo == 3\n @receita_medicas = Venda.receitas_medicas(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @receita_medicas }\n end\n end", "def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end", "def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end", "def index\n @mercadoria = Mercadorium.all\n end", "def index\n @articulos = Articulo.where(\"tipo = 'articulo'\").order(\"created_at desc\") \n @noticias = Articulo.where(\"tipo = 'noticia' and mostrar_carrusel='1'\").order(\"created_at desc\").limit(3)\n @articulos = @articulos.page(params[:page]).per_page(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articulos }\n end\n end", "def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @moradors = Morador.all\n end", "def index\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos.count > 0\n @imagen_pedidos = @pedidos[0].imagen_pedidos\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagen_pedidos }\n end\n else\n redirect_to pedidos_path, notice: 'No tiene pedidos pendientes'\n end\n end", "def index\n @movimientos = Movimiento.all\n end", "def index\n @movimientos = Movimiento.all\n end", "def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end", "def index\n autentica_especial\n authorize! :read, Sal7711Gen::Articulo\n prepara_meses\n @muestraid = params[:muestraid].to_i\n if params.to_unsafe_h.count > 2\n # 2 params que siempre estan son controller y action si hay\n # más sería una consulta iniciada por usuario\n prepara_pagina\n Sal7711Gen::Bitacora.a( request.remote_ip, current_usuario, \n 'index', params)\n end\n respond_to do |format|\n format.html { }\n format.json { head :no_content }\n format.js { render 'resultados' }\n end\n end", "def set_motoristum\n @motoristum = Motoristum.find(params[:id])\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end", "def create\n @motorista = Motorista.new(motorista_params)\n\n respond_to do |format|\n if @motorista.save\n format.html { redirect_to @motorista, notice: 'Motorista was successfully created.' }\n format.json { render :show, status: :created, location: @motorista }\n else\n format.html { render :new }\n format.json { render json: @motorista.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def index\n @registro_videoconferencia = RegistroVideoconferencium.all\n render json: @registro_videoconferencia\n end", "def index\n @jogos = Jogo.por_titulo(params[:titulo])\n end", "def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end", "def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end", "def index\n @horas_disponibles = HorasDisponible.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @horas_disponibles }\n end\n end", "def index\n @mottos = Motto.all\n end", "def index\n @normas = Norma.all\n render json: @normas\n end", "def index\n @moons = Moon.all\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n @mantenimientos = Mantenimiento.all\n end", "def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end", "def index\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalles = @recibo.renglon_recdetalles.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_recdetalles }\n end\n end", "def index\n @misiones = Misione.all\n end", "def index\n @municaos = Municao.page(params['page']).per(5);\n end", "def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end", "def index\n @pagamentos = Pagamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\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 @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\n @movers = Mover.all\n\n render json: @movers\n end", "def new\n @motivobaja = MotivoBaja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def index\n @relatorios = Relatorio.all.page(params[:page]).per(15)\n end", "def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end", "def index\n @materias = Materia.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @materias }\n end\n end", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def show\n @mision = Mision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mision }\n end\n end", "def create\n @veiculo_motorista = VeiculoMotorista.new(veiculo_motorista_params)\n\n respond_to do |format|\n if @veiculo_motorista.save\n format.html { redirect_to @veiculo_motorista, notice: 'Veiculo motorista was successfully created.' }\n format.json { render :show, status: :created, location: @veiculo_motorista }\n else\n format.html { render :new }\n format.json { render json: @veiculo_motorista.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end", "def index\n @search = NiconicoMovie.search(params[:q])\n @niconicomovies = @search.result.order(\"id DESC\").page(params[:page]).per(25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @niconicomovies }\n end\n end", "def index\n @mesasredondas = Mesasredonda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mesasredondas }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @tipo_magueyes = TipoMaguey.all\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\n end", "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end", "def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end", "def new\n @caracteristica_imovel = CaracteristicaImovel.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_imovel }\n end\n end", "def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def show\n \n @protectora = Protectora.find(params[:id])\n @nombreProtectora = Protectora.find(params[:id]).nombre\n @mis_mascotas = Mascotum.find(:all, :conditions => {:protectora => @nombreProtectora})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protectora }\n end\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end", "def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def index\n @setors = Setor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @setors }\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def index\n @ordem_servicos = OrdemServico.all\n end", "def index\n @ordem_servicos = OrdemServico.all\n end", "def index\n @medidores = Medidor.all\n end" ]
[ "0.715657", "0.711209", "0.6496485", "0.64221895", "0.64105785", "0.6409307", "0.63932294", "0.6362864", "0.6319858", "0.62985593", "0.62590164", "0.6215608", "0.6198035", "0.6166453", "0.6165283", "0.6145858", "0.61431426", "0.6131027", "0.6123103", "0.6109765", "0.6093716", "0.60892695", "0.60862434", "0.60799825", "0.60590297", "0.6048579", "0.6037906", "0.6021002", "0.59865224", "0.5948447", "0.59402865", "0.5928174", "0.5924207", "0.590533", "0.5894866", "0.5894866", "0.5894736", "0.58919555", "0.5879467", "0.58788365", "0.5874622", "0.5866299", "0.58516407", "0.58509034", "0.58421826", "0.5839214", "0.58386356", "0.5835805", "0.58317363", "0.58233076", "0.58216935", "0.58202887", "0.58188325", "0.5815442", "0.58124727", "0.58069134", "0.5804067", "0.5800711", "0.579846", "0.5797437", "0.57966083", "0.57909614", "0.5787307", "0.57775533", "0.5775449", "0.5768459", "0.5767742", "0.5766678", "0.5761828", "0.5761275", "0.57538205", "0.5745158", "0.5741066", "0.5740481", "0.57404387", "0.57404387", "0.5740314", "0.57374847", "0.57341343", "0.5730383", "0.5727529", "0.5718857", "0.57177126", "0.57150024", "0.5712121", "0.5707509", "0.57059383", "0.5705052", "0.57042164", "0.57040024", "0.56966174", "0.56955516", "0.5694837", "0.56943595", "0.56918925", "0.5691233", "0.5685224", "0.56852156", "0.56852156", "0.56810945" ]
0.6963104
2
GET /veiculo_motoristas/1 GET /veiculo_motoristas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @motorista = Motoristum.all\n end", "def index\n @motoristas = Motorista.all\n end", "def index\n v = params[:id]\n @veiculo = Veiculo.find(v)\n @veiculo_motoristas = VeiculoMotorista.where('veiculo_id=?',@veiculo.id)\n end", "def set_motorista\n @motorista = Motorista.find(params[:id])\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def set_veiculo_motorista\n @veiculo_motorista = VeiculoMotorista.find(params[:id])\n end", "def index\n @mencions = Mencion.order(\"escuela_id\").paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mencions }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end", "def index\n @motivos = Motivo.all\n end", "def show\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end", "def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end", "def set_motoristum\n @motoristum = Motoristum.find(params[:id])\n end", "def buscarModelos\n id_marca = params[:id_marca]\n @modelos = Modelo_Vehiculo.new\n @objmodelos = @modelos.buscarModelosMarca(id_marca)\n parsed_json = ActiveSupport::JSON.decode($tirajson)\n i=0\n @objmodelos.each do |modelo|\n #puts @objmodelo.imagen1\n @modelos.creararchivofisico(modelo.descripcion+'.jpg',$directorio_raiz+'/public/images/modelovehiculo/',modelo.imagen1)\n parsed_json[i][\"imagen3\"]=\"images/modelovehiculo/\"+modelo.descripcion+'.jpg'\n parsed_json[i][\"imagen1\"]=\"\"\n i=i+1\n end\n $tirajson = parsed_json.to_json\n render :text => $tirajson\n end", "def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end", "def index\n seleccionarMenu(:rondas)\n @rondas = Ronda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rondas }\n end\n end", "def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end", "def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end", "def veiculo_motorista_params\n params.require(:veiculo_motorista).permit(:veiculo_id, :motorista_id, :status)\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end", "def index\n \n if current_user.tipo == 2\n @receita_medicas = ReceitaMedica.where(:medico_id => current_user.id)\n elsif current_user.tipo == 1\n @receita_medicas = ReceitaMedica.where(:paciente_id => current_user.id)\n elsif current_user.tipo == 3\n @receita_medicas = Venda.receitas_medicas(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @receita_medicas }\n end\n end", "def index \n @lancamentorapido = Lancamentorapido.new \n @lancamentorapidos = Lancamentorapido.all\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lancamentorapidos }\n end\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def index\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos.count > 0\n @imagen_pedidos = @pedidos[0].imagen_pedidos\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagen_pedidos }\n end\n else\n redirect_to pedidos_path, notice: 'No tiene pedidos pendientes'\n end\n end", "def show\n @mision = Mision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mision }\n end\n end", "def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end", "def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end", "def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end", "def new\n @motivobaja = MotivoBaja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def create\n @motorista = Motorista.new(motorista_params)\n\n respond_to do |format|\n if @motorista.save\n format.html { redirect_to @motorista, notice: 'Motorista was successfully created.' }\n format.json { render :show, status: :created, location: @motorista }\n else\n format.html { render :new }\n format.json { render json: @motorista.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end", "def index\n @jogos = Jogo.por_titulo(params[:titulo])\n end", "def index\n @articulos = Articulo.where(\"tipo = 'articulo'\").order(\"created_at desc\") \n @noticias = Articulo.where(\"tipo = 'noticia' and mostrar_carrusel='1'\").order(\"created_at desc\").limit(3)\n @articulos = @articulos.page(params[:page]).per_page(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articulos }\n end\n end", "def new\n @caracteristica_imovel = CaracteristicaImovel.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_imovel }\n end\n end", "def index\n @registro_videoconferencia = RegistroVideoconferencium.all\n render json: @registro_videoconferencia\n end", "def index\n @mercadoria = Mercadorium.all\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def new\n @uf = Uf.first\n @municipios = @uf.municipios\n @cargo_eleicao = Eleicao.find(:first, :conditions => \"status = true\").cargo_eleicaos\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end", "def index\n @normas = Norma.all\n render json: @normas\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def show\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @noto }\n end\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end", "def show\n @mision_mision = MisionMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mision_mision }\n end\n end", "def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end", "def index\n @moons = Moon.all\n end", "def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end", "def index\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalles = @recibo.renglon_recdetalles.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_recdetalles }\n end\n end", "def index\n @movimientos = Movimiento.all\n end", "def index\n @movimientos = Movimiento.all\n end", "def index\n @horas_disponibles = HorasDisponible.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @horas_disponibles }\n end\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def index\n autentica_especial\n authorize! :read, Sal7711Gen::Articulo\n prepara_meses\n @muestraid = params[:muestraid].to_i\n if params.to_unsafe_h.count > 2\n # 2 params que siempre estan son controller y action si hay\n # más sería una consulta iniciada por usuario\n prepara_pagina\n Sal7711Gen::Bitacora.a( request.remote_ip, current_usuario, \n 'index', params)\n end\n respond_to do |format|\n format.html { }\n format.json { head :no_content }\n format.js { render 'resultados' }\n end\n end", "def show\n \n @protectora = Protectora.find(params[:id])\n @nombreProtectora = Protectora.find(params[:id]).nombre\n @mis_mascotas = Mascotum.find(:all, :conditions => {:protectora => @nombreProtectora})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protectora }\n end\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def index\n @moradors = Morador.all\n end", "def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end", "def ocRecibir\n id = params[:id]\n ocClass = Oc.new\n result = ocClass.recibirOC(id) \n render :json => {:aceptado => result, :idoc => id} \n\n end", "def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def index\n @movers = Mover.all\n\n render json: @movers\n end", "def show\n @reputacao_motoristum = ReputacaoMotoristum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reputacao_motoristum }\n end\n end", "def create\n @motoristum = Motoristum.new(motoristum_params)\n\n respond_to do |format|\n if @motoristum.save\n format.html { redirect_to @motoristum, notice: 'Motoristum was successfully created.' }\n format.json { render :show, status: :created, location: @motoristum }\n else\n format.html { render :new }\n format.json { render json: @motoristum.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @mottos = Motto.all\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end", "def index\n @pagamentos = Pagamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end", "def create\n @veiculo_motorista = VeiculoMotorista.new(veiculo_motorista_params)\n\n respond_to do |format|\n if @veiculo_motorista.save\n format.html { redirect_to @veiculo_motorista, notice: 'Veiculo motorista was successfully created.' }\n format.json { render :show, status: :created, location: @veiculo_motorista }\n else\n format.html { render :new }\n format.json { render json: @veiculo_motorista.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @materias = Materia.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @materias }\n end\n end", "def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def show\n @mouvement_recurrent = MouvementRecurrent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mouvement_recurrent }\n end\n end", "def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\n end", "def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def show\n @monnaie = Monnaie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monnaie }\n end\n end", "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\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 new\n @torso = Torso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torso }\n end\n end", "def show\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mercado_metum }\n end\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end" ]
[ "0.7034552", "0.7017888", "0.69255054", "0.6478721", "0.6391567", "0.63090926", "0.6297477", "0.6290496", "0.6276555", "0.62532", "0.6244004", "0.61952424", "0.61941785", "0.61802965", "0.61505544", "0.61133623", "0.6110617", "0.6090354", "0.6082925", "0.6052975", "0.60286653", "0.6011533", "0.5997337", "0.59972066", "0.59906524", "0.5979942", "0.597776", "0.5964343", "0.59633136", "0.5962351", "0.5941874", "0.5935269", "0.5928456", "0.5923427", "0.59186333", "0.59152013", "0.5892221", "0.58908844", "0.58815366", "0.5875168", "0.5872821", "0.58479387", "0.584645", "0.58440036", "0.58403087", "0.58379817", "0.583163", "0.5824443", "0.5819255", "0.58148223", "0.5809988", "0.5801009", "0.5778948", "0.57785726", "0.5773375", "0.57693774", "0.57682997", "0.5765457", "0.57571065", "0.5755711", "0.57553595", "0.57473886", "0.5746958", "0.5746958", "0.57446945", "0.57437813", "0.5741727", "0.57412356", "0.57407147", "0.57351047", "0.57334906", "0.5727771", "0.5726688", "0.5726", "0.57243186", "0.57211065", "0.5720821", "0.5718923", "0.57172185", "0.57168293", "0.571576", "0.5713169", "0.57108015", "0.5710165", "0.5709238", "0.57088256", "0.56994915", "0.5698906", "0.56959206", "0.56959206", "0.56944793", "0.5693015", "0.5692463", "0.56902415", "0.56891996", "0.56874555", "0.56858456", "0.56818163", "0.5676418", "0.56712383", "0.56682605" ]
0.0
-1
POST /veiculo_motoristas POST /veiculo_motoristas.json
def create @veiculo_motorista = VeiculoMotorista.new(veiculo_motorista_params) respond_to do |format| if @veiculo_motorista.save format.html { redirect_to @veiculo_motorista, notice: 'Veiculo motorista was successfully created.' } format.json { render :show, status: :created, location: @veiculo_motorista } else format.html { render :new } format.json { render json: @veiculo_motorista.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @motorista = Motorista.new(motorista_params)\n\n respond_to do |format|\n if @motorista.save\n format.html { redirect_to @motorista, notice: 'Motorista was successfully created.' }\n format.json { render :show, status: :created, location: @motorista }\n else\n format.html { render :new }\n format.json { render json: @motorista.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @motoristum = Motoristum.new(motoristum_params)\n\n respond_to do |format|\n if @motoristum.save\n format.html { redirect_to @motoristum, notice: 'Motoristum was successfully created.' }\n format.json { render :show, status: :created, location: @motoristum }\n else\n format.html { render :new }\n format.json { render json: @motoristum.errors, status: :unprocessable_entity }\n end\n end\n end", "def veiculo_motorista_params\n params.require(:veiculo_motorista).permit(:veiculo_id, :motorista_id, :status)\n end", "def motoristum_params\n params.require(:motoristum).permit(:name, :cpf, :tipo_de_caminhao, :ano, :marca)\n end", "def motorista_params\n params.require(:motorista).permit(:nome, :cnh, :telefone, :email, :cpf, :empresa_id)\n end", "def create\n @reputacao_motoristum = ReputacaoMotoristum.new(params[:reputacao_motoristum])\n\n respond_to do |format|\n if @reputacao_motoristum.save\n format.html { redirect_to(@reputacao_motoristum, :notice => 'Voce reputou o motorista com sucesso.') }\n format.xml { render :xml => @reputacao_motoristum, :status => :created, :location => @reputacao_motoristum }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reputacao_motoristum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def motivo_params\n params.require(:motivo).permit(:descricao, :motivo_id, :setor_1, :prazo_1, :setor_2, :prazo_2, :setor_3, :prazo_3, :obs, :created_by, :updated_by)\n end", "def create\n @motivo = Motivo.new(motivo_params)\n\n respond_to do |format|\n if @motivo.save\n format.html { redirect_to @motivo, notice: 'Motivo was successfully created.' }\n format.json { render :show, status: :created, location: @motivo }\n else\n format.html { render :new }\n format.json { render json: @motivo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_motorista\n @motorista = Motorista.find(params[:id])\n end", "def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end", "def create\n @motivobaja = MotivoBaja.new(motivo_baja_params)\n\n respond_to do |format|\n if @motivobaja.save\n format.html { redirect_to @motivobaja, notice: 'Motivo Baja was successfully created.' }\n format.json { render json: @motivobaja, status: :created, location: @motivobaja }\n else\n format.html { render action: \"new\" }\n format.json { render json: @motivobaja.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @imobiliaria = Imobiliaria.new(imobiliaria_params)\r\n\r\n respond_to do |format|\r\n if @imobiliaria.save\r\n format.json { render json: @imobiliaria, status: :created }\r\n else \r\n format.json { render json: @imobiliaria.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @torso = Torso.new(params[:torso])\n\n respond_to do |format|\n if @torso.save\n format.html { redirect_to @torso, notice: 'Torso was successfully created.' }\n format.json { render json: @torso, status: :created, location: @torso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objetivo = Objetivo.new(objetivo_params)\n @objetivo.mision= @mision\n\n respond_to do |format|\n if @objetivo.save\n format.html { redirect_to [@mision, @objetivo], notice: 'Objetivo was successfully created.' }\n format.json { render :show, status: :created, location: [@mision, @objetivo] }\n else\n format.html { render :new }\n format.json { render json: [@mision, @objetivo].errors, status: :unprocessable_entity }\n end\n end\n end", "def set_veiculo_motorista\n @veiculo_motorista = VeiculoMotorista.find(params[:id])\n end", "def create\n @motto = Motto.new(motto_params)\n\n respond_to do |format|\n if @motto.save\n format.html { redirect_to @motto, notice: 'Motto was successfully created.' }\n format.json { render :show, status: :created, location: @motto }\n else\n format.html { render :new }\n format.json { render json: @motto.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @motoristas = Motorista.all\n end", "def index\n @motorista = Motoristum.all\n end", "def create \n @lancamentorapido = Lancamentorapido.new(params[:lancamentorapido])\n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n respond_to do |format|\n if @lancamentorapido.save\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully created.' } \n# format.html { redirect_to '/lancamentorapidos'}\n format.json { render json: lancamentorapidos_path, status: :created, location: @lancamentorapido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end", "def crear\n # byebug\n ruta = Ruta.new\n ruta.nombre = params[:ruta][:nombre]\n ruta.descripcion = params[:ruta][:descripcion]\n ruta.subruta = params[:ruta][:subruta]\n ruta.save\n redirect_to action: \"index\"\n\n # respond_to do |format|\n # if @ruta.save\n # format.html { redirect_to @ruta, notice: \"Rutum was successfully created.\" }\n # format.json { render :show, status: :created, location: @ruta }\n # else\n # format.html { render :new }\n # format.json { render json: @ruta.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @parametro = Parametro.new(parametro_params)\n @parametro.observacion = @parametro.multiparametro('Ingresa 1', 'Ingresa 2', 'Ingresa 3')\n respond_to do |format|\n if @parametro.save\n format.html { redirect_to @parametro, notice: \"Parametro was successfully created.\" }\n format.json { render :show, status: :created, location: @parametro }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @parametro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @municao = Municao.new(municao_params)\n\n respond_to do |format|\n if @municao.save\n format.html { redirect_to @municao, notice: 'A Munição foi criada com sucesso!' }\n format.json { render :show, status: :created, location: @municao }\n else\n format.html { render :new }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @Empresa = Empresa.find(params[:empresa_id])\n p simulacion_params[:id]\n if simulacion_params[:id]!=nil\n respond_to do |format| \n format.html { render json: 1 and return}\n end\n end\n simulacion=@Empresa.simulacions.new(simulacion_params)\n respond_to do |format|\n if simulacion.save\n format.html { render json: {simulacion:simulacion}}\n else\n format.html { render action: simulacion.errors }\n end\n end\n end", "def create\n @mision = Mision.new(mision_params)\n\n respond_to do |format|\n if @mision.save\n format.html { redirect_to @mision, notice: 'La misión se creó correctamente.' }\n format.json { render :show, status: :created, location: @mision }\n else\n format.html { render :new }\n format.json { render json: @mision.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medio_pago = MedioPago.new({ :medio_pago => params[:medio_pago], :odontologo_id => params[:odontologo_id] })\n #@medio_pago = MedioPago.new(params[:medio_pago])\n\n respond_to do |format|\n if @medio_pago.save\n format.html { redirect_to @medio_pago, notice: 'Medio pago was successfully created.' }\n format.json { render json: @medio_pago, status: :created, location: @medio_pago }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medio_pago.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_motoristum\n @motoristum = Motoristum.find(params[:id])\n end", "def create\n # Crear nuevo voto\n @voto = Voto.new(params[:voto])\n\n # Asociarlo con el usuario\n @voto.usuario_id = current_usuario.id\n\n # Asociarlo con la Pregunta o Respuesta\n votable_type = params[:voto][:votable_type]\n votable_id = params[:voto][:votable_id]\n if votable_type=='Pregunta'\n @voto.votable = Pregunta.find(votable_id)\n else\n @voto.votable = Respuesta.find(votable_id)\n end\n\n respond_to do |format|\n if @voto.save\n resp = {\n :votos_total => @voto.votable.votos_total,\n :votos_menos => @voto.votable.votos_menos,\n :votos_mas => @voto.votable.votos_mas\n }\n format.json { render json: resp, status: :created, location: @voto }\n else\n format.json { render json: @voto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @morador = Morador.new(morador_params)\n @morador.ativo = true\n @morador.data_inclusao = DateTime.now\n respond_to do |format|\n if @morador.save\n format.html { redirect_to @morador, notice: 'Morador foi criado com sucesso!' }\n format.json { render :show, status: :created, location: @morador }\n else\n format.html { render :new }\n format.json { render json: @morador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def create\n @truck = Truck.new(truck_params)\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos()\n \n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def create\n {:numero_parcelas=>@numero_parcelas}\n @matricula = Matricula.new(matricula_params)\n\n respond_to do |format|\n if @matricula.save\n format.html { redirect_to @matricula, notice: 'Matricula was successfully created.' }\n format.json { render :show, status: :created, location: @matricula }\n else\n format.html { render :new }\n format.json { render json: @matricula.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @observaciontutor = Observaciontutor.new(observaciontutor_params)\n\n respond_to do |format|\n if @observaciontutor.save\n format.html { redirect_to @observaciontutor, notice: 'Observaciontutor was successfully created.' }\n format.json { render :show, status: :created, location: @observaciontutor }\n else\n format.html { render :new }\n format.json { render json: @observaciontutor.errors, status: :unprocessable_entity }\n end\n end\n end", "def municao_params\n params.require(:municao).permit(:calibre, :descricao)\n end", "def motivo_params\n params.require(:motivo).permit(:nome)\n end", "def create\n @ordem_servico = OrdemServico.new(ordem_servico_params)\n set_funcionario\n @ordem_servico.valor_total = @ordem_servico.get_valor_ordem_servico\n\n respond_to do |format|\n if @ordem_servico.save\n format.html { redirect_to @ordem_servico, notice: t('messages.cadastro_salvo')}\n format.json { render :show, status: :created, location: @ordem_servico }\n else\n @ordem_servico.servico_items.build unless @ordem_servico.servico_items.size > 0\n @ordem_servico.produto_items.build unless @ordem_servico.produto_items.size > 0\n format.html { render :new }\n format.json { render json: @ordem_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reuniao = Reuniao.new(reuniao_params)\n @pautum=Pautum.new\n @reuniao.pautum =@pautum\n @reuniao.atum=Atum.new\n @reuniao.status=\"Preparação\"\n @pautum.status=\"Preparação\"\n \n respond_to do |format|\n if @reuniao.save\n @pautum.titulo=@reuniao.titulo\n @pautum.save\n format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n else\n format.html { render :new }\n format.json { render json: @reuniao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @laboratorio = Laboratorio.new(laboratorio_params)\n get_responsavel\n puts \"O responsavel é: #{@laboratorio.responsavel_id}\"\n if (@responsavel != \"sem_responsavel\")\n @laboratorio.docentes << Docente.find(@laboratorio.responsavel_id)\n puts \"Add relação entre #{@laboratorio.nome} e #{Docente.find(@laboratorio.responsavel_id).user.nome}\"\n end\n respond_to do |format|\n if @laboratorio.save\n format.html { redirect_to @laboratorio, notice: 'Laboratorio was successfully created.' }\n format.json { render :show, status: :created, location: @laboratorio }\n else\n format.html { render :new }\n format.json { render json: @laboratorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mencion = Mencion.new(params[:mencion])\n\n respond_to do |format|\n if @mencion.save\n format.html { redirect_to @mencion, notice: 'Mencion creada' }\n format.json { render json: @mencion, status: :created, location: @mencion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mencion.errors, status: :unprocessable_entity }\n end\n end\n end", "def morador_params\n params.require(:morador).permit(:nome, :rg, :cpf, :tel_residencial, :tel_celular, :tel_comercial, :ramal, :email, :parentesco, :tipo, :apartamento_id)\n end", "def create\n @relatorio = Relatorio.new(relatorio_params)\n\n respond_to do |format|\n if @relatorio.save\n format.html { redirect_to @relatorio, notice: 'Relatorio was successfully created.' }\n format.json { render :show, status: :created, location: @relatorio }\n else\n format.html { render :new }\n format.json { render json: @relatorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.new(params[:juzgado])\n\n respond_to do |format|\n if @juzgado.save\n format.html { redirect_to @juzgado, notice: 'Juzgado fue creado satisfactoriamente.' }\n format.json { render json: @juzgado, status: :created, location: @juzgado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @juzgado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @movimiento = Movimiento.new(movimiento_params)\n\n respond_to do |format|\n if @movimiento.save\n format.html { redirect_to @movimiento, notice: 'Movimiento was successfully created.' }\n format.json { render :show, status: :created, location: @movimiento }\n else\n format.html { render :new }\n format.json { render json: @movimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ministerio = Ministerio.new(params[:ministerio])\n\n respond_to do |format|\n if @ministerio.save\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully created.' }\n format.json { render json: @ministerio, status: :created, location: @ministerio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @registro_medicion = Api::RegistroMedicion.new(registro_medicion_params)\r\n @registro_medicion.microcontrolador = Api::Microcontrolador.find_or_create_by(nivel: params[:nivel], area: params[:area])\r\n #TODO Mande que tipo de variable ambiental es\r\n\r\n @registro_medicion.variable_ambiental = Api::VariableAmbiental.where(tipo: params[:tipo]).first\r\n\r\n if @registro_medicion.save && Api::RegistroMedicionesHelper.verify(@registro_medicion, params[:promedio])\r\n render json: @registro_medicion.to_json, status: :ok\r\n else\r\n render :json => { :mssg => 'Hubo un error creando el registro medicion.' }, status: :unprocessable_entity\r\n end\r\n end", "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @orden_trabajo = OrdenTrabajo.new(orden_trabajo_params)\n \n calcula_tinetas!\n actualiza_fecha!\n\n respond_to do |format|\n if actualiza_materias! != false\n if @orden_trabajo.save\n format.html { redirect_to @orden_trabajo, notice: 'La orden de trabajo se creo correctamente.' }\n format.json { render :show, status: :created, location: @orden_trabajo }\n else\n format.html { render :new }\n format.json { render json: @orden_trabajo.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new }\n format.json { render json: @orden_trabajo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quinto = Quinto.new(quinto_params)\n \n @quinto.anio = params[:anio]\n @quinto.mes = params[:mes]\n \n \n respond_to do |format|\n if @quinto.save\n format.html { redirect_to @quinto, notice: 'Quinto was successfully created.' }\n format.json { render :show, status: :created, location: @quinto }\n else\n format.html { render :new }\n format.json { render json: @quinto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = Caracteristica.new(caracteristica_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Caracteristica was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @remito = Remito.new(params[:remito])\n\n respond_to do |format|\n if @remito.save\n format.html { redirect_to @remito, notice: 'Remito was successfully created.' }\n format.json { render json: @remito, status: :created, location: @remito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mision = Mision.new(params[:mision])\n\n respond_to do |format|\n if @mision.save\n format.html { redirect_to @mision, notice: 'Mision was successfully created.' }\n format.json { render json: @mision, status: :created, location: @mision }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mision.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @midia = Midia.new(midia_params)\n\n respond_to do |format|\n if @midia.save\n format.html { redirect_to @midia, notice: 'Um novo tipo de mídia foi criado com sucesso.' }\n format.json { render json: @midia, status: :created, location: @midia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @midia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_maguey = TipoMaguey.new(tipo_maguey_params)\n\n respond_to do |format|\n if @tipo_maguey.save\n format.html { redirect_to @tipo_maguey, notice: 'Tipo maguey creado exitosamente.' }\n format.json { render :show, status: :created, location: @tipo_maguey }\n else\n format.html { render :new }\n format.json { render json: @tipo_maguey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relogio = Relogio.new(params[:relogio])\n\n respond_to do |format|\n if @relogio.save\n format.html { redirect_to @relogio, notice: 'Relogio was successfully created.' }\n format.json { render json: @relogio, status: :created, location: @relogio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relogio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reconocimiento = Reconocimiento.new(params[:reconocimiento])\n\n respond_to do |format|\n if @reconocimiento.save\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully created.' }\n format.json { render :json => @reconocimiento, :status => :created, :location => @reconocimiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n seleccionarMenu(:rondas)\n @ronda = current_usuario.rondas.build(params[:ronda])\n\n respond_to do |format|\n if @ronda.save\n format.html { redirect_to @ronda, notice: 'Ronda creada satisfactoriamente.' }\n format.json { render json: @ronda, status: :created, location: @ronda }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ronda.errors, status: :unprocessable_entity }\n end\n end\n end", "def misione_params\n params.require(:misione).permit(:nombre, :locacion, :fecha, :heroes_requeridos, :integer)\n end", "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "def create\n @veiculo = Veiculo.new(params[:veiculo])\n\n respond_to do |format|\n if @veiculo.save\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully created.' }\n format.json { render :json => @veiculo, :status => :created, :location => @veiculo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @homeroom = Homeroom.new(homeroom_params)\n\n respond_to do |format|\n if @homeroom.save\n format.html { redirect_to @homeroom, notice: 'Homeroom was successfully created.' }\n format.json { render :show, status: :created, location: @homeroom }\n else\n format.html { render :new }\n format.json { render json: @homeroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # services / get_nutrients.rb\n fetched_params = GetNutrients.new(params[:marmiton_url]).perform\n puts fetched_params\n @recipe = Recipe.new(fetched_params)\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to root_path, notice: 'La recette a été crée.' }\n else\n format.html { redirect_to root_path, notice: \"La recette n'a pas pu être ajoutée.\" }\n end\n end\n end", "def create\n @leito = Leito.new(params[:leito])\n\n respond_to do |format|\n if @leito.save\n format.html { redirect_to @leito, notice: 'Leito was successfully created.' }\n format.json { render json: @leito, status: :created, location: @leito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @leito.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @monnaie = Monnaie.new(params[:monnaie])\n\n respond_to do |format|\n if @monnaie.save\n format.html { redirect_to @monnaie, notice: 'Monnaie was successfully created.' }\n format.json { render json: @monnaie, status: :created, location: @monnaie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monnaie.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @musico = Musico.new(musico_params)\n\n respond_to do |format|\n if @musico.save\n format.html { redirect_to @musico, notice: 'Musico was successfully created.' }\n format.json { render :show, status: :created, location: @musico }\n else\n format.html { render :new }\n format.json { render json: @musico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @remedio = Remedio.new(params[:remedio])\n\n respond_to do |format|\n if @remedio.save\n format.html { redirect_to @remedio, notice: 'Remedio was successfully created.' }\n format.json { render json: @remedio, status: :created, location: @remedio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @remedio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @novedad_mecanica = @unidad.novedades_mecanicas.build(novedad_mecanica_params)\n\n respond_to do |format|\n if @novedad_mecanica.save\n format.html { redirect_to [@unidad,@novedad_mecanica], notice: 'Novedad mecanica was successfully created.' }\n format.json { render :show, status: :created, location: @novedad_mecanica }\n else\n format.html { render :new }\n format.json { render json: @novedad_mecanica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def buscarModelos\n id_marca = params[:id_marca]\n @modelos = Modelo_Vehiculo.new\n @objmodelos = @modelos.buscarModelosMarca(id_marca)\n parsed_json = ActiveSupport::JSON.decode($tirajson)\n i=0\n @objmodelos.each do |modelo|\n #puts @objmodelo.imagen1\n @modelos.creararchivofisico(modelo.descripcion+'.jpg',$directorio_raiz+'/public/images/modelovehiculo/',modelo.imagen1)\n parsed_json[i][\"imagen3\"]=\"images/modelovehiculo/\"+modelo.descripcion+'.jpg'\n parsed_json[i][\"imagen1\"]=\"\"\n i=i+1\n end\n $tirajson = parsed_json.to_json\n render :text => $tirajson\n end", "def create\n @traslado = Traslado.new(traslado_params)\n\n respond_to do |format|\n if @traslado.save\n format.html { redirect_to @traslado, notice: 'Traslado was successfully created.' }\n format.json { render :show, status: :created, location: @traslado }\n else\n format.html { render :new }\n format.json { render json: @traslado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orden_mantenimiento = OrdenMantenimiento.new(orden_mantenimiento_params)\n\n respond_to do |format|\n if @orden_mantenimiento.save\n format.html { redirect_to @orden_mantenimiento, notice: 'Orden creada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @orden_mantenimiento }\n else\n format.html { render :new }\n format.json { render json: @orden_mantenimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @motivonegativa = Motivonegativa.new(params[:motivonegativa])\n\n respond_to do |format|\n if @motivonegativa.save\n format.html { redirect_to(@motivonegativa, :notice => 'Motivonegativa was successfully created.') }\n format.xml { render :xml => @motivonegativa, :status => :created, :location => @motivonegativa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @motivonegativa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @micropot = Micropot.new(micropot_params)\n\n respond_to do |format|\n if @micropot.save\n format.html { redirect_to @micropot, notice: 'Micropot was successfully created.' }\n format.json { render :show, status: :created, location: @micropot }\n else\n format.html { render :new }\n format.json { render json: @micropot.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @motivobaja = MotivoBaja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def create\n @vo2maximo = Vo2maximo.new(vo2maximo_params)\n\n respond_to do |format|\n if @vo2maximo.save\n format.html { redirect_to @vo2maximo, notice: 'Vo2maximo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vo2maximo }\n else\n format.html { render action: 'new' }\n format.json { render json: @vo2maximo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @simulado = Simulado.new(simulado_params)\n\n respond_to do |format|\n if @simulado.save\n format.html { redirect_to @simulado, notice: 'Simulado was successfully created.' }\n format.json { render :show, status: :created, location: @simulado }\n else\n format.html { render :new }\n format.json { render json: @simulado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @metodologia = Metodologia.new(metodologia_params)\n\n respond_to do |format|\n if @metodologia.save\n format.html { redirect_to @metodologia, notice: 'Metodologia was successfully created.' }\n format.json { render action: 'show', status: :created, location: @metodologia }\n else\n format.html { render action: 'new' }\n format.json { render json: @metodologia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos[0].imagen_pedidos.count < 3\n @imagen_pedido = ImagenPedido.new(params[:imagen_pedido])\n @imagen_pedido.pedido_id = @pedidos[0].id\n respond_to do |format|\n if @imagen_pedido.save\n format.html { redirect_to imagen_pedidos_path, notice: 'La imagen fue subida satisfactoriamente.' }\n format.json { render json: @imagen_pedido, status: :created, location: @imagen_pedido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imagen_pedido.errors, status: :unprocessable_entity }\n end\n end\n else\n #moviendo el estado a 1: Listo para verificacion\n @pedidos[0].status = 1\n @pedidos[0].save\n redirect_to pedidos_path, notice: 'El pedido ha sido enviado\nsatisfactoriamente.'\n end\n end", "def create\n @mision_mision = MisionMision.new(params[:mision_mision])\n\n respond_to do |format|\n if @mision_mision.save\n format.html { redirect_to @mision_mision, notice: 'Mision mision was successfully created.' }\n format.json { render json: @mision_mision, status: :created, location: @mision_mision }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mision_mision.errors, status: :unprocessable_entity }\n end\n end\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def create\n @directorio = Directorio.new(directorio_params)\n\n respond_to do |format|\n if @directorio.save\n format.html { redirect_to @directorio, notice: 'Directorio was successfully created.' }\n format.json { render :show, status: :created, location: @directorio }\n else\n format.html { render :new }\n format.json { render json: @directorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ruta = Ruta.new(ruta_params)\n respond_to do |format|\n if params[:parada_inicial] != \"\"\n @inicio = Parada.find(params[:parada_inicial])\n @ruta.parada.push(@inicio)\n @ruta_parada = @ruta.ruta_parada.find_by(parada_id: @inicio.id)\n @ruta_parada.tipo = 1\n @ruta_parada.save\n end\n if params[:parada_final] != \"\"\n @final = Parada.find(params[:parada_final])\n @ruta.parada.push(@final)\n @ruta_parada = @ruta.ruta_parada.find_by(parada_id: @final.id)\n @ruta_parada.tipo = -1\n @ruta_parada.save\n end\n if params[:grupo_paradas] != \"\"\n @paradas = Parada.where(:id => params[:grupo_paradas])\n @ruta.parada << @paradas\n end\n if @ruta.save\n format.html { redirect_to @ruta, notice: 'Ruta was successfully created.' }\n format.json { render :show, status: :created, location: @ruta }\n else\n format.html { render :new }\n format.json { render json: @ruta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medio = Medio.new(params[:medio])\n\n respond_to do |format|\n if @medio.save\n format.html { redirect_to @medio, :notice => 'Medio was successfully created.' }\n format.json { render :json => @medio, :status => :created, :location => @medio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @medio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #Parámetros permitidos.\n lectura_params\n\n #Asignación de variables.\n numero = params[:lectura][:numero].upcase\n actual = params[:lectura][:actual].to_i\n medidor = Medidor.find_by(numero: numero)\n periodo = Periodo.last\n consumominimo = Servicio.find_by(id: 1)\n\n #Cálculos.\n consumototal = actual - medidor.medicion\n consumototal = actual - medidor.medicion\n if consumototal > consumominimo.m3 then\n consumoexceso = consumototal - consumominimo.m3\n else\n consumoexceso = 0\n end\n\n #Editar lectura.\n @lectura = Lectura.new\n @lectura.cliente_id = medidor.cliente_id\n @lectura.periodo_id = periodo.id\n @lectura.fecha = Date.today\n @lectura.numero = numero\n @lectura.actual = actual\n @lectura.consumo = consumototal\n @lectura.exceso = consumoexceso\n\n #Guardar lectura.\n respond_to do |format|\n if @lectura.save\n medidor.medicion = actual\n medidor.save\n puts'Lectura guardada'\n format.json { render :show, status: :created, location: @lectura }\n #format.html { redirect_to @lectura, notice: 'La lectura fue creada.' }\n #format.js { }\n else\n puts'Lectura no guardada'\n format.json { render json: @lectura.errors, status: :unprocessable_entity }\n #format.html { render :new }\n end\n end\n end", "def create\n @mercadorium = Mercadorium.new(mercadorium_params)\n\n respond_to do |format|\n if @mercadorium.save\n format.html { redirect_to @mercadorium, notice: 'Mercadorium was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mercadorium }\n else\n format.html { render action: 'new' }\n format.json { render json: @mercadorium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reltramovano = Reltramovano.new(params[:reltramovano])\n\n respond_to do |format|\n if @reltramovano.save\n format.html { redirect_to @reltramovano, notice: 'Reltramovano was successfully created.' }\n format.json { render json: @reltramovano, status: :created, location: @reltramovano }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reltramovano.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testimonio = Testimonio.new(testimonio_params)\n\n respond_to do |format|\n if @testimonio.save\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' }\n format.json { render :show, status: :created, location: @testimonio }\n else\n format.html { render :new }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trnodo = Trnodo.new(params[:trnodo])\n\n respond_to do |format|\n if @trnodo.save\n format.html { redirect_to @trnodo, notice: 'Trnodo was successfully created.' }\n format.json { render json: @trnodo, status: :created, location: @trnodo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trnodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @caracteristica_imovel = CaracteristicaImovel.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_imovel }\n end\n end", "def create\n @mueble = Mueble.new(mueble_params)\n \n\n respond_to do |format|\n if @mueble.save\n #@modelo = @mueble.modelos.new\n #@modelo.nombre = 'Base'\n #@modelo.codigo=@mueble.nombre.concat('-BASE')\n #@modelo.descripcion= 'Modelo BASE automático (creado al crear el mueble base)' \n #@modelo.save\n format.html { redirect_to @mueble, notice: 'Se ha creado el mueble correctamente' }\n format.json { render :show, status: :created, location: @mueble }\n else\n format.html { render :new }\n format.json { render json: @mueble.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @noto = Noto.new(params[:noto])\n\n respond_to do |format|\n if @noto.save\n format.html { redirect_to @noto, :notice => 'Noto was successfully created.' }\n format.json { render :json => @noto, :status => :created, :location => @noto }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @noto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @caracteristica_imovel = CaracteristicaImovel.new(params[:caracteristica_imovel])\n \n descricao_aux = @caracteristica_imovel.descricao.downcase \n descricao_aux = descricao_aux.titleize\n \n @caracteristica_imovel.attributes = {:contador => '0'}\n @caracteristica_imovel.attributes = {:descricao => descricao_aux}\n \n if has_role?(current_user, 'corretor')\n #@imovel_detalhe.attributes = {:ativo => false}\n end\n \n #@caracteristica_imovel.increment!(:contador)\n \n respond_to do |format|\n if @caracteristica_imovel.save\n # Comentado o trecho que direcionava novamente para a tela de cadastro e não a listagem.\n #format.html { redirect_to new_administrativo_caracteristica_imovel_path, notice: 'Característica '+@caracteristica_imovel.descricao+' foi cadastrada com sucesso.' }\n #format.json { render json: @caracteristica_imovel, status: :created, location: new_administrativo_caracteristica_imovel_path }\n format.html { redirect_to administrativo_caracteristica_imovels_path, notice: 'Característica '+@caracteristica_imovel.descricao+' foi cadastrado com sucesso.' }\n format.json { render json: @caracteristica_imovel, status: :created, location: @caracteristica_imovel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @caracteristica_imovel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cargo_eleicao = CargoEleicao.new(params[:cargo_eleicao])\n\n respond_to do |format|\n if @cargo_eleicao.save\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully created.' }\n format.json { render json: @cargo_eleicao, status: :created, location: @cargo_eleicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kodomo = Kodomo.new(kodomo_params)\n\n respond_to do |format|\n if @kodomo.save\n format.html { redirect_to @kodomo, notice: 'Kodomo was successfully created.' }\n format.json { render :show, status: :created, location: @kodomo }\n else\n format.html { render :new }\n format.json { render json: @kodomo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @matriculacion = Matriculacion.new(matriculacion_params)\n\n respond_to do |format|\n if @matriculacion.save\n format.html { redirect_to @matriculacion, notice: 'Matriculacion was successfully created.' }\n format.json { render :show, status: :created, location: @matriculacion }\n else\n format.html { render :new }\n format.json { render json: @matriculacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def create\n @autobus = Autobus.new(autobus_params)\n respond_to do |format|\n @autobus.is_taken = false\n if @autobus.save\n format.html { redirect_to @autobus, notice: 'Autobus creado exitosamente.' }\n format.json { render action: 'show', status: :created, location: @autobus }\n\n 1.upto(@autobus.capacidad.to_i) { |n| \n @asiento = Asiento.new\n @asiento.is_active = true\n @asiento.asiento_no = n\n @asiento.autobus_id = @autobus.id\n if (n < @autobus.capacidad.to_i/2)\n @asiento.tipo = 'V'\n else\n @asiento.tipo = 'P'\n end\n @asiento.save\n }\n else\n format.html { render action: 'new' }\n format.json { render json: @autobus.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orador = Orador.new(params[:orador])\n\n respond_to do |format|\n if @orador.save\n format.html { redirect_to @orador, notice: 'Orador was successfully created.' }\n format.json { render json: @orador, status: :created, location: @orador }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orcamento = Orcamento.new(orcamento_params)\n\n respond_to do |format|\n if @orcamento.save\n format.html { redirect_to @orcamento, notice: 'Orcamento criado com sucesso!' }\n format.json { render :show, status: :created, location: @orcamento }\n else\n format.html { render :new }\n format.json { render json: @orcamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @movimento = Movimento.new(movimento_params)\n\n respond_to do |format|\n if @movimento.save\n format.html { redirect_to(@movimento, :notice => t('activerecord.successful.messages.created', :model => @movimento.class.model_name.human))}\n format.json { render :show, status: :created, location: @movimento }\n else\n format.html { render :new }\n format.json { render :json => { :errors => @movimento.errors.full_messages }, :status => 422 }\n end\n end\n end", "def create\n @sotrudniki = Sotrudniki.new(params[:sotrudniki])\n\n respond_to do |format|\n if @sotrudniki.save\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully created.' }\n format.json { render json: @sotrudniki, status: :created, location: @sotrudniki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.72027105", "0.7016685", "0.6976601", "0.6560173", "0.6491024", "0.64376765", "0.6427915", "0.6420078", "0.6240106", "0.60365313", "0.5992116", "0.598732", "0.59785324", "0.59689844", "0.59529907", "0.59221596", "0.5910748", "0.588988", "0.58633775", "0.58596474", "0.585471", "0.5851666", "0.58401066", "0.5821267", "0.580697", "0.58029485", "0.57924974", "0.578726", "0.5785685", "0.5780342", "0.5770759", "0.5753179", "0.5739839", "0.57193655", "0.5718908", "0.57137096", "0.5703828", "0.56990814", "0.56973064", "0.5682742", "0.56712866", "0.5663674", "0.5658444", "0.565498", "0.56522334", "0.563819", "0.5636954", "0.56269395", "0.56266993", "0.5624539", "0.5620607", "0.56152475", "0.5603726", "0.55953383", "0.5593871", "0.5589655", "0.5588716", "0.5576456", "0.5573376", "0.55733347", "0.5572856", "0.5572192", "0.5565443", "0.556535", "0.5564772", "0.5563874", "0.5562208", "0.5552268", "0.555151", "0.553992", "0.55388534", "0.55376905", "0.5536963", "0.5536648", "0.55364245", "0.5535632", "0.55319023", "0.5531584", "0.55298", "0.5521454", "0.5517045", "0.5515407", "0.5510671", "0.5510436", "0.5504196", "0.5496669", "0.5496252", "0.5494684", "0.54935145", "0.5492195", "0.54918015", "0.54913044", "0.54881597", "0.54881287", "0.5487315", "0.5484161", "0.54840124", "0.5481736", "0.54804415", "0.5478971" ]
0.7000522
2
PATCH/PUT /veiculo_motoristas/1 PATCH/PUT /veiculo_motoristas/1.json
def update respond_to do |format| if @veiculo_motorista.update(veiculo_motorista_params) format.html { redirect_to @veiculo_motorista, notice: 'Veiculo motorista was successfully updated.' } format.json { render :show, status: :ok, location: @veiculo_motorista } else format.html { render :edit } format.json { render json: @veiculo_motorista.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @motorista.update(motorista_params)\n format.html { redirect_to @motorista, notice: 'Motorista was successfully updated.' }\n format.json { render :show, status: :ok, location: @motorista }\n else\n format.html { render :edit }\n format.json { render json: @motorista.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @motoristum.update(motoristum_params)\n format.html { redirect_to @motoristum, notice: 'Motoristum was successfully updated.' }\n format.json { render :show, status: :ok, location: @motoristum }\n else\n format.html { render :edit }\n format.json { render json: @motoristum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @motivo.update(motivo_params)\n format.html { redirect_to @motivo, notice: 'Motivo was successfully updated.' }\n format.json { render :show, status: :ok, location: @motivo }\n else\n format.html { render :edit }\n format.json { render json: @motivo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reputacao_motoristum = ReputacaoMotoristum.find(params[:id])\n\n respond_to do |format|\n if @reputacao_motoristum.update_attributes(params[:reputacao_motoristum])\n format.html { redirect_to(@reputacao_motoristum, :notice => 'A reputacao do motorista foi atualizada com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reputacao_motoristum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @voluntario.update(voluntario_params) and @voluntario.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @voluntario, notice: 'Voluntario was successfully updated.' }\n format.json { render :show, status: :ok, location: @voluntario }\n else\n format.html { render :edit }\n format.json { render json: @voluntario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n \n\n respond_to do |format|\n\n \n if @solicitudrecurso.update_attributes(:motivos => params[:motivos])\n \n @solicitudrecursos = Solicitudrecurso.find_all_by_usuario_id(@usuario_actual.id)\n format.html { redirect_to :action => \"index\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @solicitudrecurso.errors, :status => :unprocessable_entity }\n end\n \n end\n end", "def update\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos()\n @tipo_unidad = @truck.get_tipos()\n @config = @truck.get_config()\n @clase = @truck.get_clase()\n @color = @truck.get_color()\n\n\n respond_to do |format|\n if @truck.update(truck_params)\n format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck }\n else\n format.html { render :edit }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n set_funcionario\n if @ordem_servico.update(ordem_servico_params)\n format.html { redirect_to @ordem_servico, notice: t('messages.cadastro_atualizado') }\n format.json { render :show, status: :ok, location: @ordem_servico }\n else\n format.html { render :edit }\n format.json { render json: @ordem_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n if @tipo_vehiculo.update_attributes(params[:tipo_vehiculo])\n format.html { redirect_to @tipo_vehiculo, notice: 'Tipo vehiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @lancamentorapido = Lancamentorapido.find(params[:id]) \n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n\n respond_to do |format|\n if @lancamentorapido.update_attributes(params[:lancamentorapido])\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @telefononegocio = Telefononegocio.find(params[:id])\n\n respond_to do |format|\n if @telefononegocio.update_attributes(params[:telefononegocio])\n format.html { redirect_to @telefononegocio, notice: 'Telefononegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @telefononegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"update\"\n\tputs params\n\tputs \"controllo target\"\n\tputs params[:opera][:target]\n\tnew_opera_params = opera_params\n\tnew_opera_params.delete(\"target\")\n\tif params[:opera][:target] != nil \n\t if params[:opera][:target].length > 3\n\t puts \"modifico\"\n\t target_id = params[:opera][:target].split('-')[0].to_s\n\t target_type = params[:opera][:target].split('-')[1].to_s\n\t \n\t new_opera_params.merge({\"target_id\" => target_id})\n\t\tnew_opera_params.merge({\"target_type\" => target_type})\n\t\t\n\t\tputs new_opera_params\n\t end\n\tend\n\tputs new_opera_params\n respond_to do |format|\n if @opera.update(new_opera_params)\n format.html { redirect_to @opera, notice: 'Opera was successfully updated.' }\n format.json { render :show, status: :ok, location: @opera }\n else\n format.html { render :edit }\n format.json { render json: @opera.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n if @torso.update_attributes(params[:torso])\n format.html { redirect_to @torso, notice: 'Torso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n if @motivobaja.update(motivo_baja_params)\n format.html { redirect_to @motivobaja, notice: 'Motivo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @motivobaja.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_maguey.update(tipo_maguey_params)\n format.html { redirect_to @tipo_maguey, notice: 'Tipo maguey actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @tipo_maguey }\n else\n format.html { render :edit }\n format.json { render json: @tipo_maguey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n if @reconocimiento.update_attributes(params[:reconocimiento])\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kodomo.update(kodomo_params)\n format.html { redirect_to @kodomo, notice: 'Kodomo was successfully updated.' }\n format.json { render :show, status: :ok, location: @kodomo }\n else\n format.html { render :edit }\n format.json { render json: @kodomo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n if @noto.update_attributes(params[:noto])\n format.html { redirect_to @noto, :notice => 'Noto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @noto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @basico_modelo_vehiculo.update(basico_modelo_vehiculo_params)\n format.html { redirect_to @basico_modelo_vehiculo, notice: 'Modelo vehiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @basico_modelo_vehiculo }\n else\n format.html { render :edit }\n format.json { render json: @basico_modelo_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Cargo\n respond_to do |format|\n # if !@cargo.sueldos.where(created_at: Time.now.beginning_of_month..Time.now.end_of_month).empty?\n nuevo = false\n if $quincena == 0\n nuevo = @cargo.sueldos.where(created_at: Time.now.beginning_of_month..(Time.now.beginning_of_month + 14.days)).empty?\n else\n nuevo = @cargo.sueldos.where(created_at: (Time.now.beginning_of_month + 15.days)..Time.now.end_of_month).empty?\n end\n key, value = params[:cargo][:sueldos_attributes].first\n\n if nuevo\n\n viejo = @cargo.sueldos.where(activo: true).last\n\n @cargo.sueldos.update_all(activo: false)\n crear = @cargo.sueldos.new\n crear.monto = params[:cargo][:sueldos_attributes][key][:monto]\n crear.sueldo_integral = params[:cargo][:sueldos_attributes][key][:sueldo_integral]\n\n params[:cargo][:sueldos_attributes][key][:monto] = viejo.monto\n params[:cargo][:sueldos_attributes][key][:sueldo_integral] = viejo.sueldo_integral\n\n end\n if @cargo.update(cargo_params)\n log(\"Se ha actualizado el cargo: #{@lt}\", 1)\n\n format.html { redirect_to @cargo, notice: 'Los datos del cargo fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @cargo }\n else\n format.html { render :edit }\n format.json { render json: @cargo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chronicle.update(chronicle_params)\n format.html { redirect_to @chronicle, notice: t('flash_message.notice.successfully_updated', model: Chronicle.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def update\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n if @remito.update_attributes(params[:remito])\n format.html { redirect_to @remito, notice: 'Remito was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_ministerio.update(sivic_ministerio_params)\r\n format.html { redirect_to @sivic_ministerio, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @formulario = Formulario.find(params[:id])\n\n respond_to do |format|\n if @formulario.update_attributes(params[:formulario])\n format.html { redirect_to @formulario, notice: 'Formulario was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @municao.update(municao_params)\n format.html { redirect_to @municao, notice: 'A Munição foi editada com sucesso!' }\n format.json { render :show, status: :ok, location: @municao }\n else\n format.html { render :edit }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fluxomatricula = Fluxomatricula.find(params[:id])\n\n respond_to do |format|\n if @fluxomatricula.update_attributes(params[:fluxomatricula])\n format.html { redirect_to @fluxomatricula, notice: 'Fluxomatricula was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fluxomatricula.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vo2maximo.update(vo2maximo_params)\n format.html { redirect_to @vo2maximo, notice: 'Vo2maximo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vo2maximo.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\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n if @vano.update_attributes(params[:vano])\n format.html { redirect_to @vano, notice: 'Vano was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vano.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n if @personaje_mision.update_attributes(params[:personaje_mision])\n format.html { redirect_to @personaje_mision, notice: 'Personaje mision was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje_mision.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @parola.update(parola_params)\n format.html { redirect_to parolas_url, notice: 'Parola was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parola.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end", "def veiculo_motorista_params\n params.require(:veiculo_motorista).permit(:veiculo_id, :motorista_id, :status)\n end", "def update\n respond_to do |format|\n if @rotina.update(rotina_params)\n format.html { redirect_to rotinas_path, notice: 'Rotina atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rotina.errors, status: :unprocessable_entity }\n end\n end\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 @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mision = Mision.find(params[:id])\n\n respond_to do |format|\n if @mision.update_attributes(params[:mision])\n format.html { redirect_to @mision, notice: 'Mision was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mision.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ocorrencia.update(ocorrencia_params)\n format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ocorrencia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(caracteristica_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Caracteristica was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @basico_marca_vehiculo.update(basico_marca_vehiculo_params)\n format.html { redirect_to @basico_marca_vehiculo, notice: 'Marca vehiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @basico_marca_vehiculo }\n else\n format.html { render :edit }\n format.json { render json: @basico_marca_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n if @observacao_vocacionada.update_attributes(params[:observacao_vocacionada])\n format.html { redirect_to @observacao_vocacionada}\n flash[:notice] = \"Registro alterado com sucesso!\"\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observacao_vocacionada.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @homeroom.update(homeroom_params)\n format.html { redirect_to @homeroom, notice: 'Homeroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @homeroom }\n else\n format.html { render :edit }\n format.json { render json: @homeroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @producto_vehiculo.update(producto_vehiculo_params)\n format.html { redirect_to @producto_vehiculo, notice: 'Producto vehiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_vehiculo }\n else\n format.html { render :edit }\n format.json { render json: @producto_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @telefono.update(telefono_params)\n format.html { redirect_to @telefono, notice: 'Telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefono }\n else\n format.html { render :edit }\n format.json { render json: @telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n if @ativo_outro.update_attributes(params[:ativo_outro])\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(carpeta_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n if @relogio.update_attributes(params[:relogio])\n format.html { redirect_to @relogio, notice: 'Relogio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @relogio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caracteristica_tipo_vehiculo.update(caracteristica_tipo_vehiculo_params)\n format.html { redirect_to @caracteristica_tipo_vehiculo, notice: 'Caracteristica tipo Vehiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @caracteristica_tipo_vehiculo }\n else\n format.html { render :edit }\n format.json { render json: @caracteristica_tipo_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_veiculo.update(tipo_veiculo_params)\n format.html { redirect_to @tipo_veiculo, notice: 'Tipo veiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_veiculo }\n else\n format.html { render :edit }\n format.json { render json: @tipo_veiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mou.update(mou_params)\n format.html { redirect_to @mou, notice: 'Mou was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mou.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 respond_to do |format|\n if @objetivo.update(objetivo_params)\n format.html { redirect_to [@mision, @objetivo], notice: 'Objetivo was successfully updated.' }\n format.json { render :show, status: :ok, location: [@mision, @objetivo] }\n else\n format.html { render :edit }\n format.json { render json: [@mision, @objetivo].errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @productos = Car.where(:pedidoID => params[:id])\n respond_to do |format| \n if @pedido.update(pedido_params)\n \n format.html { redirect_to \"/\", notice: 'Pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedido }\n RestClient.post \"https://api:key-e7d79c66e74391fdf48b657624f23ddc\"\\\n \"@api.mailgun.net/v3/sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org/messages\",\n :from => \"Sistema de Pedidos <mailgun@sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org>\",\n #:to => \"proteina@sinergroup.com.mx\",\n :to => \"proteina@sinergroup.com.mx\",\n :subject => \"Solicitud de Pedido\",\n :html => (render_to_string(template: \"../views/pedidos/email\")).to_str\n else\n format.html { render :edit }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @motto.update(motto_params)\n format.html { redirect_to @motto, notice: 'Motto was successfully updated.' }\n format.json { render :show, status: :ok, location: @motto }\n else\n format.html { render :edit }\n format.json { render json: @motto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mutacao = Mutacao.find(params[:id])\n\n respond_to do |format|\n if @mutacao.update_attributes(params[:mutacao])\n format.html { redirect_to @mutacao, notice: 'Mutacao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mutacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n if @livro.update_attributes(params[:livro])\n format.html { redirect_to @livro, :notice => 'Livro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @livro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @requerimiento = Requerimiento.find(params[:id])\n\n respond_to do |format|\n if @requerimiento.update_attributes(params[:requerimiento])\n format.html { redirect_to \"#{requerimientos_path}/#{@requerimiento.numero}\", notice: 'Requerimiento was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @requerimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ficha = Ficha.find(params[:id])\n\n respond_to do |format|\n if @ficha.update_attributes(params[:ficha])\n format.html { redirect_to @ficha, notice: 'Ficha alterada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ficha.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @metodologia.update(metodologia_params)\n format.html { redirect_to @metodologia, notice: 'Metodologia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @metodologia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @przedmiot = Przedmiot.find(params[:id])\n\n respond_to do |format|\n if @przedmiot.update_attributes(params[:przedmiot])\n format.html { redirect_to @przedmiot, notice: 'Przedmiot został zaktualizowany.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @przedmiot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quimicos_serigrafia_producto.update(quimicos_serigrafia_producto_params)\n format.html { redirect_to @quimicos_serigrafia_producto, notice: 'Quimicos serigrafia producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @quimicos_serigrafia_producto }\n else\n format.html { render :edit }\n format.json { render json: @quimicos_serigrafia_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(revista_params)\n format.html { redirect_to @objeto, notice: 'Revista was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @relatorio.update(relatorio_params)\n format.html { redirect_to @relatorio, notice: 'Relatorio was successfully updated.' }\n format.json { render :show, status: :ok, location: @relatorio }\n else\n format.html { render :edit }\n format.json { render json: @relatorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n if @os_tarefa.update(os_tarefa_params)\n #se as situacao da tarefa nao for aceita, altera a ordem_servico_pagamento para null\n if(@os_tarefa.situacao!=OsTarefa.situacoes[0] && @os_tarefa.situacao!=OsTarefa.situacoes[1])\n\n @os_tarefa.ordem_servico_pagamento=nil\n @os_tarefa.save\n end\n\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_tarefa }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @modelo = Modelo.find(params[:id])\n\n respond_to do |format|\n if @modelo.update_attributes(params[:modelo])\n format.html { redirect_to @modelo, notice: 'Modelo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @modelo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @remocao = Remocao.find(params[:id])\n respond_to do |format|\n if @remocao.update_attributes(params[:remocao])\n flash[:notice] = 'Remocao efetuada com sucesso.'\n format.html { redirect_to(@remocao) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @remocao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoveiculo.update(tipoveiculo_params)\n format.html { redirect_to @tipoveiculo, notice: 'Tipoveiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoveiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n if @relatorios.update_attributes(params[:relatorio])\n flash[:notice] = 'RELATORIO SALVO COM SUCESSO.'\n format.html { redirect_to(@relatorios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @relatorios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n h = {\n cuerpo: noticium_params[:cuerpo],\n bajada: noticium_params[:bajada],\n titular: noticium_params[:titular]\n }\n if @noticium.update(h)\n format.html { redirect_to @noticium, notice: 'Noticium was successfully updated.' }\n format.json { render :show, status: :ok, location: @noticium }\n else\n format.html { render :edit }\n format.json { render json: @noticium.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6697531", "0.64190316", "0.6380966", "0.63192177", "0.62720495", "0.61819303", "0.61576074", "0.61467355", "0.6096365", "0.6069864", "0.6065608", "0.60617673", "0.60515505", "0.6050087", "0.6042295", "0.60370535", "0.60250884", "0.6024544", "0.6024063", "0.6011435", "0.6007965", "0.6006695", "0.60051256", "0.60033625", "0.59911406", "0.5986545", "0.5984505", "0.59836394", "0.5977962", "0.59766686", "0.59748626", "0.5974333", "0.596858", "0.59679294", "0.59657806", "0.5962931", "0.5958169", "0.5957694", "0.59571546", "0.5948306", "0.5943037", "0.59308755", "0.59204155", "0.59119743", "0.59117264", "0.59116054", "0.59113914", "0.5910695", "0.58990943", "0.589906", "0.58981323", "0.58972615", "0.5896734", "0.5894759", "0.58908474", "0.5889375", "0.58832884", "0.587849", "0.58766806", "0.58754456", "0.58724105", "0.58671474", "0.58669275", "0.58668995", "0.5865148", "0.586465", "0.58642435", "0.585669", "0.5850385", "0.5849924", "0.584786", "0.58446836", "0.5842899", "0.58406883", "0.5836917", "0.5832969", "0.5831577", "0.58285165", "0.5826714", "0.58257043", "0.5825676", "0.5823755", "0.58225423", "0.58203244", "0.58189595", "0.58182937", "0.581759", "0.58115804", "0.58109784", "0.5809273", "0.5808579", "0.58070576", "0.5806372", "0.5805225", "0.58047175", "0.58009005", "0.5800801", "0.57990754", "0.5792463", "0.5791186" ]
0.6876356
0
DELETE /veiculo_motoristas/1 DELETE /veiculo_motoristas/1.json
def destroy @veiculo_motorista.destroy respond_to do |format| format.html { redirect_to veiculo_motoristas_url, notice: 'Veiculo motorista was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @motorista.destroy\n respond_to do |format|\n format.html { redirect_to motoristas_url, notice: 'Motorista was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @motoristum.destroy\n respond_to do |format|\n format.html { redirect_to motorista_url, notice: 'Motoristum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reputacao_motoristum = ReputacaoMotoristum.find(params[:id])\n @reputacao_motoristum.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_motorista_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @motivo.destroy\n respond_to do |format|\n format.html { redirect_to motivos_url, notice: 'Motivo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ordem_servico.destroy\n respond_to do |format|\n format.html { redirect_to ordem_servicos_url, notice: t('messages.cadastro_removido') }\n format.json { head :no_content }\n end\n end", "def destroy\n @requerimiento = Requerimiento.find(params[:id])\n @requerimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to requerimientos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_relatorioscelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_relatorioscelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n @imobiliaria.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @nominee.destroy\n respond_to do |format|\n format.html { redirect_to nominees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mision.destroy\n respond_to do |format|\n format.html { redirect_to misions_url, notice: 'La misión se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_vehiculos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @archivo.destroy\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end", "def destroy\n @dynamique = Dynamique.find(params[:id])\n @dynamique.destroy\n\n respond_to do |format|\n format.html { redirect_to dynamiques_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @caracteristica_tipo_vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to caracteristica_tipo_vehiculos_url, notice: 'Caracteristica tipo Vehiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @leito = Leito.find(params[:id])\n @leito.destroy\n\n respond_to do |format|\n format.html { redirect_to leitos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_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 destroy\n \t @motivobaja = MotivoBaja.find(params[:id])\n @motivobaja.destroy\n respond_with(@motivobaja)\n end", "def destroy\n @orcamento.destroy\n respond_to do |format|\n format.html { redirect_to orcamentos_url, notice: 'Orçamento apagado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mou.destroy\n respond_to do |format|\n format.html { redirect_to mous_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n @observacao_vocacionada.destroy\n\n respond_to do |format|\n format.html { redirect_to observacao_vocacionadas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @archivo = Archivo.find(params[:id])\n @archivo.destroy\n\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trnodo = Trnodo.find(params[:id])\n @trnodo.destroy\n\n respond_to do |format|\n format.html { redirect_to trnodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @detalle_carrito.destroy\n respond_to do |format|\n format.html { redirect_to detalle_carritos_url, notice: 'Detalle carrito was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @remedio = Remedio.find(params[:id])\n @remedio.destroy\n\n respond_to do |format|\n format.html { redirect_to remedios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurantes_proximo.destroy\n respond_to do |format|\n format.html { redirect_to restaurantes_proximos_url, notice: 'Restaurantes proximo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @basico_modelo_vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to basico_modelo_vehiculos_url, notice: 'Modelo vehiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @detalle_orden_trabajo.destroy\n respond_to do |format|\n format.html { redirect_to @orden_trabajo, notice: 'Detalle fue eliminado con éxito.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @midia.destroy\n\n respond_to do |format|\n format.html { redirect_to midias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @realiza = Realiza.find(params[:id])\n @realiza.destroy\n\n respond_to do |format|\n format.html { redirect_to realizas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @sotrudniki = Sotrudniki.find(params[:id])\n @sotrudniki.destroy\n\n respond_to do |format|\n format.html { redirect_to sotrudnikis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @votacion.destroy\n respond_to do |format|\n format.html { redirect_to votacions_url, notice: 'Votacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @veiculo.destroy\n respond_to do |format|\n format.html { redirect_to veiculos_url, notice: 'Veiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mantenimiento.destroy\n respond_to do |format|\n format.html { redirect_to mantenimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @razmer_go = RazmerGo.find(params[:id])\n @razmer_go.destroy\n\n respond_to do |format|\n format.html { redirect_to razmer_gos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pedido.destroy\n respond_to do |format|\n format.html { redirect_to pedidos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @basico_marca_vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to basico_marca_vehiculos_url, notice: 'Marca vehiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuestum.destroy\n respond_to do |format|\n format.html { redirect_to comentarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mercadorium.destroy\n respond_to do |format|\n format.html { redirect_to mercadoria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @donante.destroy\n respond_to do |format|\n format.html { redirect_to donantes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estado_remate.destroy\n respond_to do |format|\n format.html { redirect_to estado_remates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to vehiculos_url, notice: 'Vehiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocupacion.destroy\n respond_to do |format|\n format.html { redirect_to ocupacions_url, notice: 'Ocupacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ejemplo.destroy\n respond_to do |format|\n format.html { redirect_to ejemplos_url, notice: 'Ejemplo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @objetivo.destroy\n respond_to do |format|\n format.html { redirect_to mision_objetivos_url, notice: 'Objetivo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @torso = Torso.find(params[:id])\n @torso.destroy\n\n respond_to do |format|\n format.html { redirect_to torsos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end", "def destroy\n @ruta.destroy\n respond_to do |format|\n format.html { redirect_to rutas_url, notice: 'Ruta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @odontologo = Odontologo.find(params[:id])\n @odontologo.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/administrador/odontologos\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @lixotodo.destroy\n respond_to do |format|\n format.html {redirect_to lixotodos_url, notice: 'Registro excluído com sucesso.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to recursos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @livro.destroy\n respond_to do |format|\n format.html { redirect_to livros_url, notice: 'Livro apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @metodo = Metodo.find(params[:id])\n @metodo.destroy\n\n respond_to do |format|\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n seleccionarMenu(:rondas)\n @ronda = Ronda.find(params[:id])\n @ronda.destroy\n\n respond_to do |format|\n format.html { redirect_to rondas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mision = Mision.find(params[:id])\n @mision.destroy\n\n respond_to do |format|\n format.html { redirect_to misions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anteproyecto_observacion.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_observaciones_url, notice: 'Anteproyecto observacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reltramovano = Reltramovano.find(params[:id])\n @reltramovano.destroy\n\n respond_to do |format|\n format.html { redirect_to reltramovanos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to referencia_bases_url, notice: \"Referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @simulado.destroy\n respond_to do |format|\n format.html { redirect_to simulados_url, notice: 'Simulado was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7443823", "0.7443297", "0.72892845", "0.7154575", "0.71507543", "0.7120174", "0.71023834", "0.70814943", "0.70771194", "0.7076857", "0.7065652", "0.7059782", "0.70542973", "0.70409906", "0.7026376", "0.6993293", "0.69803995", "0.6974884", "0.69677144", "0.69633025", "0.6948391", "0.6945691", "0.69430184", "0.6938219", "0.6937643", "0.6937019", "0.6934554", "0.6933274", "0.69306445", "0.6930188", "0.6924612", "0.6924575", "0.69155467", "0.69137883", "0.69106483", "0.6910312", "0.6908669", "0.69043094", "0.6902203", "0.689945", "0.6899053", "0.68921894", "0.6886786", "0.68866456", "0.68819565", "0.6876537", "0.6875662", "0.6872977", "0.6869454", "0.686533", "0.6864063", "0.6863629", "0.6857281", "0.6852379", "0.6850371", "0.68487173", "0.6848488", "0.6847989", "0.68473274", "0.68454546", "0.68453014", "0.6845221", "0.6844369", "0.684201", "0.68418425", "0.684093", "0.68397784", "0.6838633", "0.6837083", "0.6834708", "0.68326706", "0.68296605", "0.6827878", "0.68275356", "0.6827312", "0.6825055", "0.68205017", "0.6819594", "0.6816552", "0.6813816", "0.68128115", "0.6811896", "0.68090546", "0.6808153", "0.68055904", "0.6804301", "0.6804161", "0.68032795", "0.6799833", "0.67960405", "0.67952144", "0.6792906", "0.67905295", "0.6789107", "0.6786332", "0.6786182", "0.67856616", "0.67827886", "0.678275", "0.67825365" ]
0.7515056
0